ISO iLogic to select lines and change layer

ISO iLogic to select lines and change layer

chris_blessing
Advocate Advocate
258 Views
1 Reply
Message 1 of 2

ISO iLogic to select lines and change layer

chris_blessing
Advocate
Advocate

Needing an iLogic that will prompt me to select a series of lines then change the layer to layer "Thread". Any help would be greatly appreciated.

0 Likes
259 Views
1 Reply
Reply (1)
Message 2 of 2

WCrihfield
Mentor
Mentor

Hi @chris_blessing.  You can give this iLogic rule a try if you want.

 

If ThisDoc.Document.DocumentType <> DocumentTypeEnum.kDrawingDocumentObject Then
	MsgBox("A Drawing document must be active for this code to work. Exiting.", vbCritical, "")
	Exit Sub
End If
Dim oDDoc As DrawingDocument = ThisDoc.Document
Dim oSheet As Sheet = oDDoc.ActiveSheet
Dim oLayers As LayersEnumerator = oDDoc.StylesManager.Layers
Dim oLayer As Layer
Try
	oLayer = oLayers.Item("Thread")
Catch
	oLayer = oLayers.Item(1).Copy("Thread")
End Try
Dim oOColl As ObjectCollection = ThisApplication.TransientObjects.CreateObjectCollection
SelectAnother :
	oObj = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select a Drawing Curve Segment.")
	If IsNothing(oObj) OrElse (TypeOf oObj Is DrawingCurveSegment = False) Then GoTo ProcessSelection
	Dim oDCS As DrawingCurveSegment = oObj
	oOColl.Add(oDCS)
	GoTo SelectAnother
ProcessSelection :
	If oOColl.Count = 0 Then Exit Sub
	oSheet.ChangeLayer(oOColl, oLayer)

 

If this solved your problem, or answered your question, please click ACCEPT SOLUTION .
Or, if this helped you, please click (LIKE or KUDOS) 👍.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes