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