Global form (for drawings) to add custom prefixes/suffixes to dimensions.

Global form (for drawings) to add custom prefixes/suffixes to dimensions.

claudio.ibarra
Advocate Advocate
2,211 Views
18 Replies
Message 1 of 19

Global form (for drawings) to add custom prefixes/suffixes to dimensions.

claudio.ibarra
Advocate
Advocate

I'm looking to create something that functions similar to "Copy properties" for dimensions, but not exactly the same.

 

I'd like to create a global form that operates on a drawing like this:

 

  1. User clicks to activate the form.
  2. User chooses (on the form) from a predefined set of modifiers (see below for examples), or writes in a custom one in a text box.
  3. User chooses (on the form) whether it should appear before/after the dimension.
  4. User clicks on a dimension (not on the form), and the modifier gets added before/after that dimension.
  5. User clicks on more dimensions, adding the same prefix/suffix to all of them.
  6. User hits escape or closes the form to continue using Inventor normally.

 

The examples that come to mind are things like the diameter symbol, "2X", "3X", "5X", STK, etc.

 

Is this possible?

Accepted solutions (1)
2,212 Views
18 Replies
Replies (18)
Message 2 of 19

Curtis_Waguespack
Consultant
Consultant

Hi @claudio.ibarra ,

 

That sounds like a handy tool... what version of Inventor do you have (in case that helps with sharing an example)?

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 3 of 19

claudio.ibarra
Advocate
Advocate

I'm currently using Inventor Professional 2018.3.8.

0 Likes
Message 4 of 19

Curtis_Waguespack
Consultant
Consultant

Hi @claudio.ibarra 

 

here's a quick example rule for this

 

run this rule in a drawing once, then create a form and add the 2 parameters and the rule (as the Apply button).

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

aaa.pngbbb.PNG

 

 

Dim oList = New String() {"2X", "3X", "TYP", "STK" }

'Define the drawing document
Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document

Dim oDrawParams As UserParameters
oDrawParams = oDoc.Parameters.UserParameters

Try
oTest = Parameter("PlaceBefore") 
Catch
oTest = oDrawParams.AddByValue("PlaceBefore", True, UnitsTypeEnum.kBooleanUnits)
End Try

Try
oTest = Parameter("Modifier") 
Catch
oTest = oDrawParams.AddByValue("Modifier", "", UnitsTypeEnum.kTextUnits)
End Try

MultiValue.List("Modifier") = oList


oDim = ThisApplication.CommandManager.Pick _
(SelectionFilterEnum.kDrawingDimensionFilter, "Select a dimension")

Dim oDimensionText As DimensionText
oDimensionText = oDim.Text

If Parameter("PlaceBefore") = True Then
oText = Parameter("Modifier") & " " & "<DimensionValue/>"
Else
oText = "<DimensionValue/>" & " " & Parameter("Modifier") 	
End If

oDimensionText.FormattedText = oText

Beep

EESignature

0 Likes
Message 5 of 19

bradeneuropeArthur
Mentor
Mentor

Hi,

 

I have developed something similar already with an add in for our company.

 

Are you familiar with programming in vb.net?

 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 6 of 19

claudio.ibarra
Advocate
Advocate

First of all, thank you for taking the time to help.

 

Here's what I've done:

  • Added "Ø" to the list (that and "2X" will probably get used 90% of the time)
  • Ran the rule once
  • Created the form, added the 2 parameters
  • Set the rule to the "Apply" button.

Annotation 2020-02-04 150109.png

Annotation 2020-02-04 150109 02.png

When I click "Apply", I get "select a dimension" besides the cursor (the cursor doesn't appear in my screenshot).

 

When I click on a dimension, I hear the "beep", but no text is changed. And no other "beep" if I click on subsequent dimensions. I feel like I'm so close! Did I do something wrong? 

0 Likes
Message 7 of 19

Curtis_Waguespack
Consultant
Consultant

Hi @claudio.ibarra 

 

check your code to make sure that you have exactly the version that is posted... the problem might have been me... I pasted it poorly the first time and might have updated it as you were working... the version that is now posted in my previous post should work though.... if not post back and we can have another look... sorry for the confusion.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 8 of 19

claudio.ibarra
Advocate
Advocate

Are you familiar with programming in vb.net?

Not as familiar as I would like to be, but I'm quickly learning I need to understand add-ins (I have ideas, but not the tools to implement them!).

 

I know enough about programming with iLogic to be mildly dangerous. What kind of steps would be involved in using your add-in?

0 Likes
Message 9 of 19

bradeneuropeArthur
Mentor
Mentor

Hi,

 

It all start with installing Visual studio which is free of use.

 

The next steps I can guide you through later on, if you like to.

 

It is really the best option you can choose.

 

Use I-logic for testing your codes or for file configuration.

 

Regards,

Regards,

Arthur Knoors

Autodesk Affiliations & Links:
blue LinkedIn LogoSquare Youtube Logo Isolated on White Background


Autodesk Software:Inventor Professional 2025 | Vault Professional 2024 | Autocad Mechanical 2024
Programming Skills:Vba | Vb.net (Add ins Vault / Inventor, Applications) | I-logic
Programming Examples:
Drawing List!|
Toggle Drawing Sheet!|
Workplane Resize!|
Drawing View Locker!|
Multi Sheet to Mono Sheet!|
Drawing Weld Symbols!|
Drawing View Label Align!|
Open From Balloon!|
Model State Lock!
Posts and Ideas:
My Ideas|
Dimension Component!|
Partlist Export!|
Derive I-properties!|
Vault Prompts Via API!|
Vault Handbook/Manual!|
Drawing Toggle Sheets!|
Vault Defer Update!

! For administrative reasons, please mark a "Solution as solved" when the issue is solved !


 


EESignature

0 Likes
Message 10 of 19

claudio.ibarra
Advocate
Advocate

Aha!! 

oDimensionText.FormattedText = oText

That line was missing. Now I see how it works. I have to hit "Apply" for each, and it will overwrite any existing prefix/suffix. Is that the behavior you see too?

0 Likes
Message 11 of 19

Curtis_Waguespack
Consultant
Consultant

@claudio.ibarra wrote:

I have to hit "Apply" for each, and it will overwrite any existing prefix/suffix. Is that the behavior you see too?


Hi @claudio.ibarra 

 

Yep that sounds right... for that version... here's a little better version that allows you to select multiples. 

 

Are you looking for it to append the selection to the existing prefix/suffix?

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

Dim oList = New String() {"Ø", "2X", "3X", "TYP", "STK" }

'Define the drawing document
Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document

Dim oDrawParams As UserParameters
oDrawParams = oDoc.Parameters.UserParameters

Try
oTest = Parameter("PlaceBefore") 
Catch
oTest = oDrawParams.AddByValue("PlaceBefore", True, UnitsTypeEnum.kBooleanUnits)
End Try

Try
oTest = Parameter("Modifier") 
Catch
oTest = oDrawParams.AddByValue("Modifier", "", UnitsTypeEnum.kTextUnits)
End Try

MultiValue.List("Modifier") = oList


Dim oDimensionText As DimensionText
While True

	oDim = ThisApplication.CommandManager.Pick _
		(SelectionFilterEnum.kDrawingDimensionFilter, "Select a dimension (press ESC to exit selection)")

	'if nothing then exit
	If IsNothing(oDim) Then Exit While	
		
		
	oDimensionText = oDim.Text

	If Parameter("PlaceBefore") = True Then
	oText = Parameter("Modifier") & " " & "<DimensionValue/>"
	Else
	oText = "<DimensionValue/>" & " " & Parameter("Modifier") 	
	End If

	oDimensionText.FormattedText = oText

End While

 

EESignature

Message 12 of 19

Curtis_Waguespack
Consultant
Consultant
Accepted solution

@claudio.ibarra 

 

here is another version that allows a prefix and a suffix (it occurred to me that it should allow both)

 

.... also I added a blank to the list so that the prefix/suffix can be cleared

 

.... also I changed the prefix /suffix parameter to be a radio button (list parameter) rather than a true/false... so you'll need to run the rule once to add the parameter and then modify your form

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

aaa.png

 

 

Dim oList = New String() {"", "Ø", "2X", "3X", "TYP", "STK" }

'Define the drawing document
Dim oDoc As DrawingDocument
oDoc = ThisDoc.Document

Dim oDrawParams As UserParameters
oDrawParams = oDoc.Parameters.UserParameters

Try
oTest = Parameter("Prefix_Suffix") 
Catch
oTest = oDrawParams.AddByValue("Prefix_Suffix", "Prefix", UnitsTypeEnum.kTextUnits)
End Try
MultiValue.SetList("Prefix_Suffix", "Prefix", "Suffix")


Try
oTest = Parameter("Modifier") 
Catch
oTest = oDrawParams.AddByValue("Modifier", "", UnitsTypeEnum.kTextUnits)
End Try

MultiValue.List("Modifier") = oList


Dim oDimensionText As DimensionText
While True

	oDim = ThisApplication.CommandManager.Pick _
		(SelectionFilterEnum.kDrawingDimensionFilter, "Select a dimension (press ESC to exit selection)")

	'if nothing then exit
	If IsNothing(oDim) Then Exit While	
		
	oDimensionText = oDim.Text
		
	sSP_Text = Replace(oDimensionText.FormattedText, "<DimensionValue/>", "|")
    ' Split the string on the vertical bar character.
    Dim sText As String() = sSP_Text.Split(New Char() {"|"c})
	sPrefix = sText(0)
	sSuffix = sText(1)
	
	If Parameter("Prefix_Suffix") = "Prefix" Then
	oText = Parameter("Modifier") & " " & "<DimensionValue/>" & sSuffix
	Else
	oText =  sPrefix & "<DimensionValue/>" & " " & Parameter("Modifier") 	
	End If

	oDimensionText.FormattedText = oText	

End While

EESignature

0 Likes
Message 13 of 19

claudio.ibarra
Advocate
Advocate

That is simply incredible! Sometimes a forum post goes unanswered, and sometimes it's like Batman swoops in to save the day. This works beautifully! I will share it with my team. Thank you again!

Message 14 of 19

JelteDeJong
Mentor
Mentor

im bit late for this discusion but you can do this with just native Inventor functions. What you want to do is create a new global dimension style with the  prefixes/suffixes.

createStyle.png

in your drawing you can then select the dimensions that you want and change the style. (You could also set the style when you are creating the dimension that save you changing the dimension in the end)

change style.png

Jelte de Jong
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.

EESignature


Blog: hjalte.nl - github.com

Message 15 of 19

claudio.ibarra
Advocate
Advocate

That would work, too! We use these for lots of common tolerance configurations, but it's not the fastest method when you have (for example) a section view of a diameter and many dimensions need the diameter symbol, some of them are 2X or 3X, etc.

 

Annotation 2020-02-05 073923.png

 

The reason I'm looking for the tool I described is to expedite the idea of "choose the prefix, then click on 9 dimensions. choose a different suffix, then click on 3 dimensions." 

0 Likes
Message 16 of 19

myronHBBUW
Contributor
Contributor
0 Likes
Message 17 of 19

htkim43EPL
Explorer
Explorer

hello?
The method you gave seems to be a very useful and good method.
Additionally, what I want is to do the same for functions such as Hole/Thread Notes and leader text as well as dimension lines.
thank you

0 Likes
Message 18 of 19

Curtis_Waguespack
Consultant
Consultant

Hi @htkim43EPL 

 

If you change the line as shown here, the previous example will work with hole thread notes also.

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

 

	oDim = ThisApplication.CommandManager.Pick _
		(SelectionFilterEnum.kDrawingDefaultFilter, "Select a dimension or hole note (press ESC to exit selection)")

 

EESignature

0 Likes
Message 19 of 19

htkim43EPL
Explorer
Explorer

hello? @Curtis_Waguespack
thank you so much.
Your help has saved us a lot of time in drawing.
I have now completely solved the problem.

0 Likes