11-30-2023
10:22 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
11-30-2023
10:22 AM
How to se DrawCurve to ByLayer?
Sub SetDrawingCurvesLayer(ByVal app As Inventor.Application)
If (MainLayer Is Nothing) Then Return
If (drawCurves Is Nothing) Then Return
' Create empty collections for curves on different layers
Dim objColl As ObjectCollection = app.TransientObjects.CreateObjectCollection()
Dim hiddenColl As ObjectCollection = Nothing
If (HiddenLayer IsNot Nothing) Then
hiddenColl = app.TransientObjects.CreateObjectCollection()
End If
' Iterate through each drawing curve
For Each drawCurve As DrawingCurve In drawCurves
If (drawCurve.Segments Is Nothing) Then Continue For
Dim oColor As Color
drawCurve.Color = oColor
For Each segment As DrawingCurveSegment In drawCurve.Segments
If (segment.HiddenLine) Then
If (hiddenColl IsNot Nothing) Then
hiddenColl.Add(segment)
End If
Else
' Add the segment to the collection for visible curves
objColl.Add(segment)
End If
Next
Next
' Change the layer of visible curves
If (objColl.Count > 0) Then
drawView.Parent.ChangeLayer(objColl, MainLayer)
End If
' Change the layer of hidden curves
If (hiddenColl IsNot Nothing AndAlso hiddenColl.Count > 0) Then
drawView.Parent.ChangeLayer(hiddenColl, HiddenLayer)
End If
End Sub
Solved! Go to Solution.