- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to write a rule that cycles through all parts in an assembly and changes the font on a sketch that is used for an emboss on the part.
There are two emboss features generated from 1 sketch. The emboss features should always be named "LASER LABEL A1" and "LASER LABEL A2". The sketch with two text boxes is named "LASER LABEL SKETCH".
I would like to be set the font to Stencil and change the font size to .25 inches.
Previously I worked with someone that wrote code to cycle through parts and suppress an emboss feature, I'm thinking that code could be helpful here. I'm new to iLogic and inventor API, trying to learn!
Sub Main() 'define the assembly document Dim oAsmDoc As AssemblyDocument oAsmDoc = ThisDoc.Document 'Get user input If RuleArguments(oBool) <> Nothing oBool = RuleArguments(oBool) Else oBool = InputRadioBox("Toggle TOP A1 Emboss", "TOP A1 OFF", "TOP A1 ON", True, Title :="TOP A1 EMBOSS") End If 'define the assembly component definition Dim oAsmDef As AssemblyComponentDefinition oAsmDef = oAsmDoc.ComponentDefinition 'define the leaf occurences of the assembly Dim oLeafOccs As ComponentOccurrencesEnumerator oLeafOccs = oAsmDef.Occurrences.AllLeafOccurrences 'define the occurences Dim oOcc As ComponentOccurrence 'Define a part component definiton Dim oPCD As PartComponentDefinition 'Iterate through the assembly For Each oOcc In oLeafOccs 'Set the part component definition equal to the current occurrence oPCD = oOcc.Definition 'Define and set an emboss features collection Dim oEFs As EmbossFeatures oEFs = oPCD.Features.EmbossFeatures 'Define an emboss feature Dim oEmboss As EmbossFeature If oBool = True Then Try 'Suppress Emboss1 oEmboss = oEFs.Item("Emboss1") oEmboss.Suppressed = True Catch End Try 'Checking to see if user input a no ElseIf oBool = False Try 'Unsuppress Emboss1 oEmboss = oEFs.Item("Emboss1") oEmboss.Suppressed = False Catch End Try 'Checking to see if something went wrong Else 'do nothing End If Next RuleParametersOutput() InventorVb.DocumentUpdate() End Sub
I have found a few similar solutions working to format text in a part, but I'm struggling to locate the call the text from the part sketch. Here are a couple links
Solved: Change text with iLogic - Autodesk Community - Inventor
Solved: Create Text/sketch on a face in a assembly with iLogic - Autodesk Community - Inventor
Solved: Change Font for all text-elements - Autodesk Community - Inventor
Solved! Go to Solution.