iLogic rule to change drawing view layer

iLogic rule to change drawing view layer

Anonymous
Not applicable
2,565 Views
9 Replies
Message 1 of 10

iLogic rule to change drawing view layer

Anonymous
Not applicable

Hello all,

 

I am trying to piece togther some code for an ilogic rule. This rule should look for a drawing view that is a flat pattern, if it finds one it should change the object layer to our "CNC" layer.

 

Is this possible?

 

Any suggestions are welcome.

0 Likes
Accepted solutions (1)
2,566 Views
9 Replies
Replies (9)
Message 2 of 10

jdkriek
Advisor
Advisor
Accepted solution

If I understand you correctly, this should be the ticket:

 

' JDK 2013
Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView
	For Each oView In oSheet.DrawingViews
		' If it's a flatpattern view
		If oView.IsFlatPatternView = True Then
			' Get Layers
			Dim oLayers As LayersEnumerator = oView.Parent.Parent.StylesManager.layers
			' Get CNC layer
			Dim oLayer As Layer = oLayers.Item("CNC")
			' Get lines
			Dim oCurves As DrawingCurvesEnumerator = oView.DrawingCurves()
			Dim oCurve As DrawingCurve
				' For each line
				For Each oCurve In oCurves
					' Change the layer
					oCurve.Segments.Item(1).Layer = oLayer
				Next
		End If
	Next
Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


Message 3 of 10

Anonymous
Not applicable

This worked great! Thanks for your help!!

0 Likes
Message 4 of 10

jdkriek
Advisor
Advisor

You're welcome 😉

 

Glad it worked for you.

Jonathan D. Kriek
MFG Solutions Engineer
KETIV Technologies, Inc.


0 Likes
Message 5 of 10

garrison34
Explorer
Explorer

I used the same rule you provided but, I'm running into issues where is changes all the layers on my flat patterns. I would like my bend lines, centers, and any other layers for my flat to be on there separate layers and change when using this rule. Is there a way to do this?

0 Likes
Message 6 of 10

garrison34
Explorer
Explorer

I used the same rule you provided but, I'm running into issues where is changes all the layers on my flat patterns. I would like my bend lines, centers, and any other layers for my flat to be on there separate layers and change when using this rule. Is there a way to do this?

0 Likes
Message 7 of 10

dparks2265
Participant
Participant
Jordan
Reply Test
0 Likes
Message 8 of 10

Anonymous
Not applicable

 

Dim oDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDoc.ActiveSheet
Dim oView As DrawingView

    For Each oView In oSheet.DrawingViews
        ' If it's a flatpattern view
        If oView.IsFlatPatternView = True Then
            If Not (oview.breakoperations.count > 0) Then
            ' Get Layers
            Dim eLayer As LayersEnumerator = oView.Parent.Parent.StylesManager.layers
            ' Get CNC layer
            Dim oLayer As Layer= eLayer.Item("CNC")
            ' Get Visible Layer
            Dim oVisibleLayer As Layer= eLayer.Item("Visible (ANSI)")
            ' Get lines
            Dim oViewCurves As DrawingCurvesEnumerator = oView.DrawingCurves()
            Dim oCurve As DrawingCurve
                ' For each line
                For Each oCurve In oViewCurves
                    ' Change the layer only if it is an object edge
                    If oCurve.Segments.Item(1).Layer Is oVisibleLayer Then
                        oCurve.Segments.Item(1).Layer = oLayer
                    End If
                Next
            End If
        End If
    Next

===============================================================================

Refer to your Drawing Standards setup for which layer your flat pattern is placed
into. If needed, substitute your flat pattern object layer name for the
"Visible (ANSI)" shown above.

 

0 Likes
Message 9 of 10

Anonymous
Not applicable

Is it possible to adapt this code to change the layer of a line only if the line is 7.99mm long?

 

Also, is it possible to change the layer of a circle only if the circle is 3.99mm dia?

 

I hope so as this would save me a huge amount of time.

Thanks in advance

M

0 Likes
Message 10 of 10

Anonymous
Not applicable

Is it possible to adapt this code to change the layer of a line only if the line is 7.99mm long?

 

Also, is it possible to change the layer of a circle only if the circle is 3.99mm dia?

 

I hope so as this would save me a huge amount of time.

Thanks in advance

 

M

0 Likes