Make2D in RhinoCommon?

I know Make2D has made it into Grasshopper in the WIP - has the functionality been exposed directly in RhinoCommon yet? (I didn’t find it…)

Thanks, --Mitch

1 Like

OK, thanks, I went looking, but didn’t expect it under that name…! --Mitch

Hmm, having trouble making sense of how this works. I seem to be able to create a hidden line drawing - the results do give me something that looks like it might be correct, but when I want to add the curves to the document, I can’t figure out how to proceed…

if I try to get the objects in result.FullCurves, I get an error message that tells me that ‘result’ doesn’t have an attribute ‘FullCurves’.

So how do I get access to the curve geometry to add it to the document?
(must be something obvious I’m missing)

Thanks, --Mitch

In 6.0.17164.11481, 6/13/2017, you can access the curves via result.Segments

Continuing on here… I am able to access the created curve geometry via segments now, thanks…

However, I am now mystified by how the method classifies the result into Visible, Hidden, etc…

Run the attached script on the attached file - it is supposed to create a Make2D from the Top view. It does indeed work after a fashion, but… There are only two types of visibility produced - Visible and Hidden - “Visible” I am able to detect, but it doesn’t seem to recognize “Hidden”. Hence all the objects classified as hidden go to the “Unknown” layer. Now, check the “Visible” layer, there are definitely not enough visible objects. Plus two lines that should be hidden…

So there must be something I’m not understanding here, maybe someone can enlighten me.

Thanks, --Mitch

Make2DClassifyTest.3dm (1.3 MB) (2.8 KB)

Hi Mitch. I think you got it, only in your script there appears to be a typo adding a “not” in the “if” statement to test visibile, that I think it was not intended.

        for i,seg in enumerate(hld.Segments):
            print "Segment {} Type:{}".format(i,seg.SegmentVisibility)
            if not seg.SegmentVisibility == vis:

OK, thanks @rajaa, yeah, the ‘not’ got left in from some other testing, good catch. Taking that out solves the issue of curves classified as hidden not going to the Hidden layer - just a script mistake - but not the principal problem, which is far too many curves get classified as hidden in this case… In the image below, pretty much everything should be green, but you can see that is not the case with the scripted result. The native command does get it right… Any thoughts on why this is happening (@GregArden) ? Something still wrong with my script and how it classifies hidden/visible?

Thanks, --Mitch

I see it. But when set the tolerance to the document tolerance, the result comes out as expected:

    #Create the Make2D drawing
    hdp.AbsoluteTolerance = sc.doc.ModelAbsoluteTolerance

Ah, OK, I didn’t realize that one had to specifically set that, I kinda assumed it used the document tolerance as default. So, just out of curiosity, what does it use as a default tolerance if the user doesn’t specify?

Thanks, --Mitch

Looks like it is set to “0”. I think it is worth investigating how to make it more obvious to have to set the tolerance.

@Helvetosaur I added a YT to deal with zero tolerance passed through RhinoCOmmon. Link…

RH-40146 is fixed in the latest WIP