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: Anonymous

I think I understand what you want now.

Try this:

 

Sub Main
	Dim oSketchName As String = "Sketch1" 'Name of the sketch
	updateLine(ThisDoc.Document, oSketchName)
	If ThisDoc.Document.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject
		Dim oAsm As AssemblyDocument = ThisDoc.Document
		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
					updateLine(oRefDoc, oSketchName)
				End If
			End If
		Next
	End If

	iLogicVb.UpdateWhenDone = True
End Sub
Sub updateLine(oDoc As Document, oName As String)
	Try
		Dim oSketch As PlanarSketch = oDoc.ComponentDefinition.Sketches.Item(oName) '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 Sub