Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
JhoelForshav
in reply to: JhoelForshav

Or did I misunderstand maybe. Do you want to run the rule from an assemmbly and find a sketch by a specific name in any of the occurrences in the assembly?

Then something like this maybe?

This rule changes the color and thickness of sketchline(2) in all sketches with the selected name within any component in the assembly.

 

Dim oAsm As AssemblyDocument = ThisDoc.Document
Dim oSketchName As String = "Sketch1" 'Name of the sketch
For Each oRefDoc As Document In oAsm.AllReferencedDocuments
	If oRefDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Or oRefDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject
	If oAsm.ComponentDefinition.Occurrences.AllReferencedOccurrences(oRefDoc).Count > 0
		Try
			Dim oSketch As PlanarSketch = oRefDoc.ComponentDefinition.Sketches.Item(oSketchName) 'sketch name = Name of sketch
			Dim oColor As Color
			oColor = ThisApplication.TransientObjects.CreateColor(255, 255, 255) 'White

			Dim oLine As SketchLine = oSketch.SketchLines(2)
			oLine.OverrideColor = oColor
			oLine.LineWeight = 2 'Set Lineweight
		Catch
			'Sketch is not in document or Sketchline with selected index not in sketch
		End Try
	End If
End If
Next

iLogicVb.UpdateWhenDone = True