Message 1 of 7
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm in need of help to traverse assembly tree from the assembly file to edit a sketch within two specific parts.
Below is code that loops through all assembly occurrences and filters out two labels that are modelled as extruded text. I would like to be able to edit text and text height from a form within the assembly document. The Label model tree is also shown below for reference.
I figure there needs to be some reference to a PartComponentDefinition object to be able to access the Sketch object that I want to edit, but am unsure how to do this step...
Dim doc As AssemblyDocument = ThisDoc.Document Dim oAsmCompDef As ComponentDefinition oAsmCompDef = doc.ComponentDefinition Dim oCompOcc As Inventor.ComponentOccurrence Dim oPartDoc As PartComponentDefinition For Each oCompOcc In oAsmCompDef.Occurrences ' Filter for LABELS If oCompOcc.Name = "LABEL BCL:1" Then oSketchBCL = oCompOcc.Sketches.Item("LabelSketch") oSketchBCL.TextBoxes.Item(1).FormattedText ="<StyleOverride Font='FRUTIGER' FontSize='" & _ doc.Parameter("HL")/10 & "'>" & "Baker Cranes" & "</StyleOverride>" ElseIf oCompOcc.Name = "LABEL RC:1" Then oSketchRC = oCompOcc.Sketches.Item("LabelSketch") oSketchRC.TextBoxes.Item(1).FormattedText ="<StyleOverride Font='FRUTIGER' FontSize='" & _ doc.Parameter("HL")/10 & "'>" & doc.Parameter("RC_RATING") & "</StyleOverride>" End If Next ThisDoc.Document.Rebuild()
Kind regards.
Solved! Go to Solution.