Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Leonardo_Czuy
155 Views, 2 Replies

How se drawCurve color to ByLayer

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