How to extract "Visible Index" in RhinoCommon HiddenLineDrawingSegments

Does anyone know how to extract the "Visible Index " for each visible curve like the Make2D component , this for further branching retrieving in the “flatten” Make2D

scripted (1.4 KB)

Hi @MiguelBaron,

When adding geometry to a HiddenLineDrawing, do so like this:

for i in range(0, len(inputGeo)):
    hd.AddGeometry(inputGeo[i], i)

where i is a tag you can use to find the source object later.

Now, when enumerating the HiddenLineDrawingSegment objects produced by HiddenLineDrawing.Compute, you can retrieve the tag, or index, of the source object from a segment like this;

obj_index = -1
obj = seg.ParentCurve.SourceObject
if obj:
    obj_index = clr.Convert(obj.Tag, System.Int32)
# todo: add obj_index to some list...

Note, you’ll also need to import these two namespaces:

import System
import clr

– Dale