Retrieve tag assigned in HiddenLineDrawing

Hello all,

I’m working in a script that uses HiddenLineDrawing to create a Make2d procedure for a collection of geometries I set. I realized in the RhinoCommon API that when using AddGeometry method, it have an option to assign a tag to the geometry.

I wonder how I can retrieve the tag for the segments resulted of the computation of the HiddenLineDrawing. I realized using Visual Studio metadata that HiddenLineDrawing contain a FullCurves property which contains a list of HiddenLineDrawingObjectCurve, from which I could retrieve the referred object tag and its specific generated segments. However this property is internal and I cannot access it.

There would be a way to enable API users to access the resulted projection curves grouped by object tag?

1 Like

Hi @marcio.sartorelli.so,

You can retrieve the tag from HiddenLineDrawingObject.Tag.

Use HiddenLineDrawingObjectCurve.SourceObject and HiddenLineDrawingPoint.SourceObject to retrieve a HiddenLineDrawingObject.

– Dale

Hey Dale, Thanks!

My problem is that I can’t actually access neither the HiddenLineDrawingObjects and HiddenLineDrawingObjectCurves from the HiddenLineDrawing.

Hi @marcio.sartorelli.so,

Try doing something like this:

import Rhino
import scriptcontext as sc

hld_param = Rhino.Geometry.HiddenLineDrawingParameters()
# Set viewport
# Add curve geometry with tags

hld = Rhino.Geometry.HiddenLineDrawing.Compute(hld_param, True)
if hld:
    for hld_segment in hld.Segments:
        hld_object = hld_segment.ParentCurve.SourceObject
        if hld_object and hld_object.Tag:
            print(hld_object.Tag)

– Dale

2 Likes

If you are using C#, here is a sample you can use as a starting point.

SampleCsMake2D.cs

– Dale

Thanks a lot :grinning: