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: 

ilogic form dropdown?

29 REPLIES 29
SOLVED
Reply
Message 1 of 30
mcgyvr
17393 Views, 29 Replies

ilogic form dropdown?

Can you have dropdowns in an ilogic FORM?

For example I want to setup 5 choices for a custom iproperty. Then when I run the form I can pick from those 5 choices only?

 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
29 REPLIES 29
Message 2 of 30
mflayler2
in reply to: mcgyvr

The way I have done it in the past is with a Custom Parameter that is Exported to be a Custom iProperty.  I use the Multi-value list from the parameter to drive the value of the Custom iProperty

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

Mark Flayler - Engagement Engineer

IMAGINiT Manufacturing Solutions Blog: https://resources.imaginit.com/manufacturing-solutions-blog

Message 3 of 30
jletcher
in reply to: mcgyvr

Yep you sure can Here is my form I am working on now.

 

yep can.JPG

Message 4 of 30
rhasell
in reply to: jletcher

Hi

How did make columns in your form?

 

Reg
2024.2
Please Accept as a solution / Kudos
Message 5 of 30
Inv_kaos
in reply to: mflayler2

Mark, how do you export a multi-value text parameter?

Please mark as "Accept as Solution" if it answers your question or "Kudos" if you found it useful.
---------------------------------------------------------------------------------------------------------------------
Stew, AICP
Inventor Professional 2013, Autodesk Simulation Multiphysics 2013
Windows 7 x64 Core i7 32GB Ram FX2000
Message 6 of 30
mflayler2
in reply to: mcgyvr

Actually I misspoke, I use an ilogic rule to copy the value of the MultiValue parameter to the value of the custom iproperty.  There is no export on the MultiValue parameters.

Did you find this reply helpful ? If so please use the Accept as Solution or Kudos button below.

Mark Flayler - Engagement Engineer

IMAGINiT Manufacturing Solutions Blog: https://resources.imaginit.com/manufacturing-solutions-blog

Message 7 of 30
Inv_kaos
in reply to: mflayler2

Would you mind sharing this code?

Please mark as "Accept as Solution" if it answers your question or "Kudos" if you found it useful.
---------------------------------------------------------------------------------------------------------------------
Stew, AICP
Inventor Professional 2013, Autodesk Simulation Multiphysics 2013
Windows 7 x64 Core i7 32GB Ram FX2000
Message 8 of 30
Curtis_Waguespack
in reply to: mcgyvr

Hi everyone,

 

You can use MultiValue.SetList to add values and convert a parameter to a multi-value parameter.

 

Here's a quick example.

There is a sketch dimension / parameter called Length.

There is a rule with this line of code.

 

MultiValue.SetList("Length", 100, 150, 200, 250)

Autodesk Inventor Set List Ilogic.PNG

 

There is a form set up like this:

 

Autodesk Inventor Form List Ilogic.PNG

 

Autodesk Inventor Form List 2 Ilogic.PNG

 

Attached is the example file (Inventor 2013)

 

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

Message 9 of 30
Curtis_Waguespack
in reply to: mcgyvr

Hi mcgyvr,

 

You could also add a few lines to expose (export) the parameter value as a property. So using the previous example you set the Length using a form, and this code sets the list and ensures the parameter is exported as a custom iProperty.

 

'set list of values
MultiValue.SetList("Length", 100, 150, 200, 250)
Dim oLength As Parameter
oLength = Parameter.Param("Length")
oLength.ExposedAsProperty = True

 

But if you need the parameter value to be written to a custom iProperty that is not the same name as the parameter you could use something like this. In this example a custom iProperty called L1 is created or reused, depending if it exists. And the Length parameter value is written to it:

 

'set list of values
MultiValue.SetList("Length", 100, 150, 200, 250)

Dim propertyName1 As String = "L1"

'define custom property collection
oCustomPropertySet = ThisDoc.Document.PropertySets.Item("Inventor User Defined Properties")

Try
'set property value
oProp = oCustomPropertySet.Item(propertyName1)
Catch
' Assume error means not found so create it
oCustomPropertySet.Add("", propertyName1)
End Try

'set custom property value
iProperties.Value("Custom", "L1") = Length

 

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

Message 10 of 30
mcgyvr
in reply to: Curtis_Waguespack

iproperty NOT parameter

 

I just want a form with a drop down to fill in the value of a custom iproperty.

Currently I'm doing it with an "Input Box" rule which is fine but not as pretty as I could make a form.

 

Seems totally silly to me this isn't build into ilogic forms already..

 

It should be as simple as this.. See attached



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 11 of 30
Curtis_Waguespack
in reply to: mcgyvr

Hi mcgyvr,

 

You're correct. There isn't a way to point the form to the iProperty and have a list, at least not that I'm aware of.

 

Therefore we need to use the paramter list in the form, and hand the value from the paramter to the iProperty. I used a model parameter in the example, but you could also use a user parameter if a model parameter would not work.

 

The iLogic forms have some limitations compared to standard VB userforms, but I'm not sure why certain option are included / not included for the controls.

 

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

Message 12 of 30
mcgyvr
in reply to: Curtis_Waguespack

Sure would have made life easier..

Autodesk needs more forward thinkers or better "brainstorming" sessions.

 

blah I'll just stick with the ugly inputbox rules I've already got..

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 13 of 30
jletcher
in reply to: rhasell

rhasell

 

use row and place the perameters in there if i put 3 there would be 3 columns and so on. Here is a pic. and don't give me credit some one showed me..

 

Columns.JPG

Message 14 of 30
vex
Collaborator
in reply to: Curtis_Waguespack

I'm trying to do a similar code that dynamically updates a drop down menu with the selection of a primary criteria from a drop down menu.  Looking at the Parameters menu it works flawlessly.  When attempting to do it via a Form it doesn't work.  I don't get the second menu as a drop down but only as a text field for input.  What am I missing?

 

(Inventor Pro 2015)

 

edit: NVM, had to re-add the field after the coding.

Message 15 of 30

Thanks for your previous as it has me well on my way.

 

I'm working on a rule to check whether a user parameter exists and if not, creates it.

 

I'm using Try/Catch.

 

My question is: how do I ensure that if the user parameter already exists, I use the already present value and do not overwrite it?

 

Any help is appreciated!

Message 16 of 30
rhasell
in reply to: RobABerger

Hi

 

Thats all you need. it wont overwrite the value.

 

I have a few rules, some a little more detailed, here is an extract from one of them.

 

Dim oPartDoc as PartDocument = ThisDoc.Document
Dim userParams As UserParameters = oPartDoc.ComponentDefinition.Parameters.UserParameters
	Dim newParam As UserParameter ' Placeholder
	Dim oFormat As CustomPropertyFormat
'LENGTH
Try
oParam = oPartDoc.ComponentDefinition.Parameters("LENGTH")
Catch 	'If the parameter was not found, then create a new one.
	newParam = userParams.AddByExpression("LENGTH", 0, "mm") ' Create the Parameter as per above
	newParam.ExposedAsProperty=True 'Flag for Export
	oFormat=newParam.CustomPropertyFormat 'For some reason or other this line is needed to enable the following formatting
	oFormat.PropertyType=Inventor.CustomPropertyTypeEnum.kTextPropertyType
			oFormat.Precision=Inventor.CustomPropertyPrecisionEnum.kzeroDecimalPlacePrecision 'Set one decimal place
			'oFormat.Units="mm" 'Units
			oFormat.ShowUnitsString=False
			oFormat.ShowLeadingZeros=False
			oFormat.ShowTrailingZeros=False
End Try

 

Reg
2024.2
Please Accept as a solution / Kudos
Message 17 of 30
RobABerger
in reply to: rhasell

Thanks for that. Okay, I've modified my code a bit to better reflect your approach, and I'll try to describe what is happening.

 

A little bit of background.  I'm trying to create the rule so that I can select a part 'type' such as plate, sheet, round, PFC, SHS, etc and then relevant parameters only are created for the part.  So if I have a plate part, I want G_L, G_W, and G_T.  If I have a bar component, I want just G_L and G_D.  If SHS I want G_W and/or G_H, G_L, and G_T.  I'm accomplishing that with Select Case.  Ultimately the idea is to export these to a formatted Custom Property description for use on autopopulating the BOMs and part descriptions.

 

So looking just at, in this case, SHS:

 

First, I'm trying to use the same code three times in a row to create and format the three different user parameters (G_L, G_W, G_T).  No problem there: it creates all three and formats them as desired.

 

Before I run the rule:

 

Parameters1.JPG

 

After I run the rule:

 

Parameters2.JPG

 

So like I said, no issues there.

 

But if I immediately run the rule again, I get an error:

 

Parameters3.JPG

 

Messing around with it, I've found that it does not like having the first previously created user parameter already present when running the rule the second time.

 

So if I delete the first created user parameter, leaving the subsequent two, there are no problems: it runs and creates the missing one.

 

But if I delete the second and/or third but leave the first, I get the error.

 

I have rearranged the order of creation of the parameters, and it does not matter what order they are in: whichever one is first has to be deleted from the parameters before running the rule again, or I get the error.

 

Here is my code...

 

Select Case strSelectedPartType

'Filter on those components requiring G_L, G_W, G_T

Case "SHS", "Flat", "Plate", "Rolled Ring", "Sheetmetal", "Chequerplate"
'If strSelectedPartType = "SHS" Then 

'Check whether G_T exists and create it if not

	Try
	oParam = oPartDoc.ComponentDefinition.Parameters("G_T")
	Catch
	oParameter = oGeometricParameter.AddByExpression("G_T", "999", UnitsTypeEnum.kMillimeterLengthUnits)
	End Try

'Format G_T for use in descriptive custom property

	oParameter.ExposedAsProperty = True
	oFormat = oParameter.CustomPropertyFormat
	oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType
	oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
	oFormat.ShowUnitsString = False
	oFormat.ShowLeadingZeros = False
	oFormat.ShowTrailingZeros = False
	
'Check whether G_L exists and create it if not

	Try
	oParam = oPartDoc.ComponentDefinition.Parameters("G_L")
	Catch
	oParameter = oGeometricParameter.AddByExpression("G_L", "999", UnitsTypeEnum.kMillimeterLengthUnits)
	End Try

'Format G_L for use in descriptive custom property

	oParameter.ExposedAsProperty = True
	oFormat = oParameter.CustomPropertyFormat
	oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType
	oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
	oFormat.ShowUnitsString = False
	oFormat.ShowLeadingZeros = False
	oFormat.ShowTrailingZeros = False
	
'Check whether G_W exists and create it if not

	Try
	oParam = oPartDoc.ComponentDefinition.Parameters("G_W")
	Catch
	oParameter = oGeometricParameter.AddByExpression("G_W", "999", UnitsTypeEnum.kMillimeterLengthUnits)
	End Try

'Format G_W for use in descriptive custom property

	oParameter.ExposedAsProperty = True
	oFormat = oParameter.CustomPropertyFormat
	oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType
	oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
	oFormat.ShowUnitsString = False
	oFormat.ShowLeadingZeros = False
	oFormat.ShowTrailingZeros = False

	
	
End Select

 

I don't understand the error behaviour.

Message 18 of 30
rhasell
in reply to: RobABerger

Hi

 

Just busy at the moment, I will have a look in a moment.

 

I noticed that the formatting is being done after the "end try" This might also affect the rule. (Dont know, I will have to test it.)

 

While working with parameters, I found that they are very sensitive to the creation and formating sytanxes.

 

As a test, create and format your parameters exacly as I have done, see if that works.

 

Reg
2024.2
Please Accept as a solution / Kudos
Message 19 of 30
rhasell
in reply to: rhasell

Hi

 

I ran your code, I had to modify it to suit, as I did not have your case select, so I just removed it for testing. I also changed the "oGeometricParameter" to suit my definitions.

 

The fault was the formatting option after the END TRY. After moving the lines, it worked correctly.

 

See the updated code:

 

Hope this helps.

 

 

Dim oPartDoc as PartDocument = ThisDoc.Document
Dim userParams As UserParameters = oPartDoc.ComponentDefinition.Parameters.UserParameters
	Dim newParam As UserParameter ' Placeholder
	Dim oFormat As CustomPropertyFormat
	
'Select Case strSelectedPartType

'Filter on those components requiring G_L, G_W, G_T

'Case "SHS", "Flat", "Plate", "Rolled Ring", "Sheetmetal", "Chequerplate"
'If strSelectedPartType = "SHS" Then 

'Check whether G_T exists and create it if not

	Try
	oParam = oPartDoc.ComponentDefinition.Parameters("G_T")
	Catch
	oParameter = userParams.AddByExpression("G_T", "999", UnitsTypeEnum.kMillimeterLengthUnits)
	oParameter.ExposedAsProperty = True
	oFormat = oParameter.CustomPropertyFormat
	oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType
	oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
	oFormat.ShowUnitsString = False
	oFormat.ShowLeadingZeros = False
	oFormat.ShowTrailingZeros = False
	End Try

'Format G_T for use in descriptive custom property

	
	
'Check whether G_L exists and create it if not

	Try
	oParam = oPartDoc.ComponentDefinition.Parameters("G_L")
	Catch
	oParameter = userParams.AddByExpression("G_L", "999", UnitsTypeEnum.kMillimeterLengthUnits)
	oParameter.ExposedAsProperty = True
	oFormat = oParameter.CustomPropertyFormat
	oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType
	oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
	oFormat.ShowUnitsString = False
	oFormat.ShowLeadingZeros = False
	oFormat.ShowTrailingZeros = False
	End Try

'Format G_L for use in descriptive custom property

	
	
'Check whether G_W exists and create it if not

	Try
	oParam = oPartDoc.ComponentDefinition.Parameters("G_W")
	Catch
	oParameter = userParams.AddByExpression("G_W", "999", UnitsTypeEnum.kMillimeterLengthUnits)
	oParameter.ExposedAsProperty = True
	oFormat = oParameter.CustomPropertyFormat
	oFormat.PropertyType = Inventor.CustomPropertyTypeEnum.kTextPropertyType
	oFormat.Precision = Inventor.CustomPropertyPrecisionEnum.kZeroDecimalPlacePrecision
	oFormat.ShowUnitsString = False
	oFormat.ShowLeadingZeros = False
	oFormat.ShowTrailingZeros = False
	End Try

'Format G_W for use in descriptive custom property
	
'End Select
Reg
2024.2
Please Accept as a solution / Kudos
Message 20 of 30
RobABerger
in reply to: rhasell

Okay, I'll give that a shot.  However, my intent is to set the formatting for both existing and new parameters...should I just repeat the formatting between Try and Catch for the parameters which already exist?  Seems a bit repetitive.

 

Or maybe the formatting should be moved to be done after all the parameters are created...?

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

Post to forums  

Autodesk Design & Make Report