- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
With this code it will replace the part numbers for an assembly, which are punched on the surface. for some parts when it updates the existing part number it stays as the old font 'punch' which is what i need, but sometimes it reverts back to the default tahoma. i have been trying to get the font to change to the text style i already have set up but cant manage to get it.
Private Sub Main()
Dim oDoc As AssemblyDocument
oDoc = ThisDoc.Document
For Each oOccurrence In oDoc.ComponentDefinition.Occurrences
SearchForSketch(oOccurrence)
Next
End Sub
Private Sub SearchForSketch(ByVal oOccurrence As ComponentOccurrence)
If TypeOf oOccurrence.Definition Is PartComponentDefinition Then
Dim oPartDoc As PartDocument
oPartDoc = oOccurrence.Definition.Document
Dim fileName As String
fileName = System.IO.Path.GetFileNameWithoutExtension(oPartDoc.FullFileName)
For Each oSketch In oOccurrence.Definition.Sketches
If oSketch.Name = "Part_Number" Then
For Each oTextBox In oSketch.TextBoxes
"This is where i have been trying to change the font"
oTextBox.Text = fileName
Next
End If
Next
ElseIf TypeOf oOccurrence.Definition Is AssemblyComponentDefinition Then
For Each oSubOccurrence In oOccurrence.Definition.Occurrences
SearchForSketch(oSubOccurrence)
Next
End If
iLogicVb.UpdateWhenDone = True
End Sub
Solved! Go to Solution.