05-29-2020
06:18 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
05-29-2020
06:18 AM
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
Jhoel Forshav
Download my free Inventor Addin - Hole Projector
LinkedIn | Ideas | Contributions | Blog posts | Website