Grasshopper

algorithmic modeling for Rhino

So I'm running into a problem trying to explode hatches. 

With the following code: 

 


Rhino.DocObjects.HatchObject hatch = x as Rhino.DocObjects.HatchObject;
if(hatch != null){
crv = hatch.HatchGeometry.Explode();
}


I am able to explode my hatches no problem. However, I would like to set all of the hatch patterns to solid first, so that exploding gives me only the boundary (in the form of a trimmed surface) and not the hatch pattern itself. Doing the following:

 

Rhino.DocObjects.HatchObject hatch = x as Rhino.DocObjects.HatchObject;
if(hatch != null){
Rhino.Geometry.Hatch hatchGeo = hatch.HatchGeometry;
hatchGeo.PatternIndex = doc.HatchPatterns.Find("Solid", true);
doc.Objects.AddHatch(hatchGeo);
}

Will successfully add the solid hatches to the document. However, swapping out that last line for 


crv = hatchGeo.Explode();

 

gives me only an empty array of GeometryBase. Am I missing something?

Views: 4171

Replies to This Discussion

What's your Type for the crv? As far as I can see, solid hatches explode to surfaces in Rhino, not curves.

it's object, it's an output parameter. I just called it crv before I realized that, but regardless what I'm getting out of the Explode command in the second case is an empty array of GeometryBase.

Bumping this discussion - any ideas folks?

how about that : 

http://www.grasshopper3d.com/forum/topics/displaying-solid-hatches-...

???

and then get naked polylines ?

Thanks Mateusz - the point though is not to create/display hatches but to actually access the boundaries of hatchobjects already in Rhino. I'm coming to the conclusion that it's simply not possible right now - it looks like hatches are pretty poorly implemented in rhinocommon. 

Perhaps I might get to the root of the question more directly: what is the easiest way via rhinocommon to get at the boundary of a hatch?

I don't know. It might be missing from RhinoCommon so far.

--

David Rutten

david@mcneel.com

Poprad, Slovakia

I just fixed this and added a function to Hatch called Get3dCurves which lets you specify if you want outer or inner curves.  This will probably be available in next week's V5 beta (and the next build of Grasshopper in V4)

Thanks,

-Steve

Hooray! you're a hero, I've been relying on some highly unreliable workarounds to deal with this in a project I'm working on at the moment. 

RSS

About

Translate

Search

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service