Community
Inventor Forum
Welcome to Autodesk’s Inventor Forums. Share your knowledge, ask questions, and explore popular Inventor topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Parameter order of drop down in Format Text

6 REPLIES 6
SOLVED
Reply
Message 1 of 7
jamieking89
550 Views, 6 Replies

Parameter order of drop down in Format Text

Is there anyway to change the order of the parameter drop down list within format text? At current it isnt how i would suspect with 1 being the first number and the last number being the highest number in the parameter list eg 1, 2, 3, 4.

 

Currently it is as the attached screenshot which makes finding parameters a little harder than it should be.

 

Thanks

Jamie

6 REPLIES 6
Message 2 of 7
Anonymous
in reply to: jamieking89

Renaming to meaningful names comes to mind. Is a bit of work but remembering 'HoleDia1' is easier than looking up 'd108' somewhere. And it groups similar parameters.

Message 3 of 7
jamieking89
in reply to: Anonymous

yeah i agree and would do this myself, however the model i am working on is an old one which was moddeled by someone else who hadnt renamed any model parameters. It is quicker for me in this instant to make a sketch visible and note down the numbers to then use. This is why i was hoping the way the parameter is listed would be better as i dont have the time to rename over 1000 dimension parameters.

Message 4 of 7
blandb
in reply to: jamieking89

Dont forget, you can just put "name=" in front of the value and rename it before your could write it down. Just a thought. 🙂

Autodesk Certified Professional
Message 5 of 7
jamieking89
in reply to: blandb

As mentioned before the model i am currently working on has thousands of dimensions, which if at the time of modelling would have been ok to rename parameters. To save time i wont do this for this instance, it would take a long time to rename all the parameters as there is over 1000. Its a pity that the list cannot be filtered different ways, as most features when created are close to each other numerically. But if one feature was to be say d199 and a dimension related to that was d200, but the model had 3000 parameters, the way it is listed now these 2 dimensions wouldnt be close ot each other in the drop down.

Message 6 of 7

Hi @jamieking89 

 

Because the parameter names are being read as strings, the lack of leading zeros causes this kind of sorting:

 

d0

d1

d10

d11

d100

d2

d27

d3

d4

 

save off a copy of your model to test this code first!!!

 

Then try pasting this into a new iLogic rule and running it... it should rename all the parameters and put leading zeros as needed ( up to d9999 ). Then the list should sort as expected.

 

d0000

d0001

d0002

d0003

d0004

d0010

d0011

d0027

d0100

 

I did a quick test, but use at your own risk .

 

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

 

 

 

 

oParams = ThisApplication.ActiveDocument.ComponentDefinition.Parameters


If oParams.count > 100 Then
	oRun = MessageBox.Show(oParams.count & " parameters detected..." _
	& vbLf & vbLf & "This could take a while, do you want to continue?", _
	"ilogic", MessageBoxButtons.YesNo, MessageBoxIcon.Warning)

End If 

If oRun = vbNo Then
	Return 'exit rule
End If

Dim i As Integer

For Each oParam In oParams
	
	If Left(oParam.name, 1) = "d" Then	
	
		sNumber = Replace(oParam.name, "d", "")		
		
		If IsNumeric(sNumber) = True Then
			i = sNumber
		Else
			Continue For
		End If


		If i < 10 Then 
			sNumber = "000" + CStr(i)
		Else If i < 100 Then 
			sNumber = "00" + CStr(i)
		Else If i < 1000 Then 
			sNumber = "0" + CStr(i)
		Else 
			sNumber = CStr(i)
		End If

		oParam.name = "d" & sNumber
	End If
Next

MessageBox.Show("Finished formatting parameter names", "iLogic")

 

 

Message 7 of 7

Curtis

 

Thats exactly what i was looking for thanks. I take it for the numbering to be done it would have to be done at the end of model creation? Also this is something i will test myself but if i ran it twice would it rename in the same order? If thats the case i could just periodically run the rule so all dims will still refer to the same parameter and not replace the parameters in the text boxes on the drawing with the newly allocated ones if the rule is run?

 

thanks for you help again

 

Jamie

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report