Hello Everybody, maybe @rajaa ?
I’m trying to get a custom version of Make2D running via HiddenLineDrawing and I managed to get out visible lines, even cut by a plane. Already pretty nice!
Now I want the clipped away parts to be occluded as in the new V8 clipping planes when a background color is set. I found OccludingSectionOption in HiddenLineDrawingParameters and occluding_sections toggles when adding geometry - and I imagined I could occlude clipped away parts that way.
But whichever values I set these parameters to I always get all visible lines including the ones I want to stay hidden. Did I understand something wrong here?
I also noticed that HiddenLineDrawingSegment.Visibility.Clipped never seems to return any curves - shouldn’t it return the curves that are clipped away by the plane?
This is my code:
import Rhino
getObject = Rhino.Input.Custom.GetObject()
getObject.GeometryFilter = Rhino.DocObjects.ObjectType.Brep
getObject.GetMultiple(1, 0)
if getObject.ObjectCount != 0:
geometryRefs = getObject.Objects()
geometry = []
for geometryRef in geometryRefs:
geometry.append(geometryRef.Geometry())
hiddenLineDrawingParameters = Rhino.Geometry.HiddenLineDrawingParameters()
viewNumber = Rhino.RhinoDoc.ActiveDoc.NamedViews.FindByName("01")
view = Rhino.RhinoDoc.ActiveDoc.NamedViews[viewNumber]
viewport = view.Viewport
plane = Rhino.Geometry.Plane(viewport.TargetPoint, viewport.CameraX, viewport.CameraY)
hiddenLineDrawingParameters.SetViewport(viewport)
hiddenLineDrawingParameters.Flatten = True
for geometryItem in geometry:
hiddenLineDrawingParameters.AddGeometry(geometryItem, None, True)
hiddenLineDrawingParameters.AddClippingPlane(plane)
hiddenLineDrawingParameters.OccludingSectionOption = True
hiddenLineDrawingParameters.AbsoluteTolerance = Rhino.RhinoDoc.ActiveDoc.ModelAbsoluteTolerance
hiddenLineDrawing = Rhino.Geometry.HiddenLineDrawing.Compute(hiddenLineDrawingParameters, True)
#hiddenLineDrawing.RejoinCompatibleVisible()
for segment in hiddenLineDrawing.Segments:
if segment.SegmentVisibility == Rhino.Geometry.HiddenLineDrawingSegment.Visibility.Visible:
Rhino.RhinoDoc.ActiveDoc.Objects.AddCurve(segment.CurveGeometry.DuplicateCurve())
And this is the Rhino file I use it with (on Layer 03 you can see what is created using my code…):
240328_CustomMake2D.3dm (381.6 KB)
240328_CustomMake2D.py (1.4 KB)
Can anyone tell me what I’m doing wrong or how I could get the desired result?
Thank you!