iLogic to Apply Multiple Drawing Styles Based on User Parameter (Dimensions, GD&T, Leaders, Datums)

iLogic to Apply Multiple Drawing Styles Based on User Parameter (Dimensions, GD&T, Leaders, Datums)

sj_leeSN79P
Explorer Explorer
111 Views
2 Replies
Message 1 of 3

iLogic to Apply Multiple Drawing Styles Based on User Parameter (Dimensions, GD&T, Leaders, Datums)

sj_leeSN79P
Explorer
Explorer

Hello Inventor Community,

I'm working on creating an iLogic rule in Inventor drawing environment that can automatically apply multiple drawing styles based on a user parameter value.

What I want to achieve:

I've created a user parameter named "Type" with values "a" and "b". I want to:

  • When "Type" parameter = "a": Apply drawing styles

    • Dimension style: "dim_a"

    • Geometric tolerance style: "ge_a"

    • Leader style: "le_a"

    • Datum style: "da_a"

  • When "Type" parameter = "b": Apply drawing styles

    • Dimension style: "dim_b"

    • Geometric tolerance style: "ge_b"

    • Leader style: "le_b"

    • Datum style: "da_b"

Current situation:

I have a working iLogic rule called "Dim_change" (please refer to the attached IDW file) that successfully changes dimension styles based on the user parameter. However, this rule only handles dimension styles. I want to extend it to also apply:

  • Leader text styles

  • Geometric tolerance (GD&T) styles

  • Datum styles

What I need help with:

  1. How to programmatically access and change geometric tolerance styles in existing drawings

  2. How to apply leader styles to leader text objects (especially for sketchedSymbol objects)

  3. How to change datum identifier styles

  4. Proper collection iteration methods for these different drawing elements

Sample structure I'm aiming for:

 
sj_leeSN79P_0-1754457284726.png

 

  • All the required styles ("dim_a", "dim_b", "ge_a", "ge_b", etc.) are already created in the drawing style manager

  • The "Dim_change" rule in the attached IDW file shows the working dimension style change logic

  • I need this to work with existing drawing elements, not just newly created ones

If anyone could help me extend the dimension style changing logic to include geometric tolerances, leaders, and datums, I would greatly appreciate it!

Environment:

  • Inventor [Your Version]

  • Drawing Environment

  • iLogic Rules

Thank you in advance for your assistance!

Attachments: sample.idw (with "Dim_change" rule for reference)

0 Likes
112 Views
2 Replies
Replies (2)
Message 2 of 3

kacper.suchomski
Mentor
Mentor

Hi

The drawing environment doesn't support parameters.

You could create a plugin with a checkbox, but it probably won't be a user parameter.


Kacper Suchomski

EESignature


YouTube - Inventor tutorials | LinkedIn | Instagram

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.


0 Likes
Message 3 of 3

jwoodhouseD8XAE
Contributor
Contributor

You'll need to iterate through each of the different types of symbols in the sheet.

 

As far as I can tell, there is no way to access datum identifiers, so if you find something let me know. This is what I came up with for the rest. Note that you can't just iterate through all DrawingDimensions, you have to go through each type of dimension. I'm not able to test this right now, but hopefully this points you in the right direction. 

 

Another tip is to hit Alt+F11 in Inventor if not in the iLogic editor, then go to View -> Object browser and you can look up all the different methods and classes available in the API as well as a short description of them and what inputs they take and what they return (if anything).

 

Dim oDoc As DrawingDocument = ThisApplication.ActiveDocument

Dim oFCFStyle As FeatureControlFrameStyle = oDoc.StylesManager.FeatureControlFrameStyles.Item("GDT1")
Dim oDimStyle As Style = oDoc.StylesManager.Styles.Item("Dim Style1")
Dim oLStyle = oDoc.StylesManager.LeaderStyles.Item("Leader1")

For Each oSheet As Sheet In oDoc.Sheets
	For Each oFCF As FeatureControlFrame In oSheet.FeatureControlFrames
		oFCF.Style = oFCFStyle
	Next 
	For Each oDim As GeneralDimension In oSheet.DrawingDimensions.GeneralDimensions
		oDim.Style = oDimStyle
	Next 
	For Each oLeader As LeaderNote In oSheet.DrawingNotes.LeaderNotes
		oLeader.DimensionStyle = oLStyle
	Next 
Next 

 

0 Likes