- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Is there a way to automatically create one or more Parameters with a rule so that when i create a new part or assembly I automatically always have a set of parameters.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@Anonymous wrote:
Is there a way to automatically create one or more Parameters with a rule so that when i create a new part or assembly I automatically always have a set of parameters.
Sure..
You could also just add those parameters to your template files so they are always there upon starting a new file from those templates. No coding required for that.
Here is help on how to create new custom templates (you can also just modify the existing ones)
Here is some help on creating user parameters via ilogic
https://help.autodesk.com/view/INVNTOR/2020/ENU/?guid=GUID-DB91F7F6-842C-4849-A856-1003F8B7C576
Let us know if you need additional help and be specific
-------------------------------------------------------------------------------------------
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
@Anonymous wrote:
I can't change the templates that's above my pay grade
![]()
um... ok..
How much experience do you have with ilogic?
Can you be specific about what parameters you would like to create?
Do you need us to write this rule for you or will the link I posted above be sufficient?
-------------------------------------------------------------------------------------------
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm quite new with iLogics I've played around with it a bit, My programming skils are not that great so if you'd like to help that would be great :). I just like to creat a few Parameters like Length, Width, Height etc. and then I'd lik to add these Parameters to a global form which auromatically pops up when creating a new document that last part i've done now only the creation of the parameters
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I put together a little sample of how you can add different types of User Parameters:
'Access User parameters of the active document
Dim oMyParameters As UserParameters = ThisApplication.ActiveDocument.ComponentDefinition.Parameters.UserParameters
'Create list of Parameter names of type: number
Dim numParams As New List(Of String)
numParams.AddRange({"Height", "Length", "Thickness"})
'Create list of Parameter names of type: text
Dim textParams As New List(Of String)
textParams.AddRange({"Name", "Side", "Orientation"})
'Create list of Parameter names of type: True/False
Dim booleanParams As New List(Of String)
booleanParams.AddRange({"Two_Side_Machining", "Buyout"})
'Testing and Creation of User Parameters of type: number
For Each item In numParams
Try 'Check if User Parameter exists
Param = oMyParameters.Item(item)
Catch 'Parameter doesn't exist as a User Parameter
Try 'attempt to create new parameter
oMyParameters.AddByExpression(item, 0, UnitsTypeEnum.kInchLengthUnits) '(Name, Value, Unit Type)
Catch 'Parameter exists but not as a User Parameter
MessageBox.Show("The Parameter: " & item & " exists as a parameter, but is not a user parameter.", "Creation Failure")
End Try
End Try
Next
'Testing and Creation of User Parameters of type: text
For Each item In textParams
Try 'Check if User Parameter exists
Param = oMyParameters.Item(item)
Catch 'Parameter doesn't exist as a User Parameter
Try 'attempt to create new parameter
oMyParameters.AddByValue(item, "filler", UnitsTypeEnum.kTextUnits) '(Name, Value, Unit Type)
Catch 'Parameter exists but not as a User Parameter
MessageBox.Show("The Parameter: " & item & " exists as a parameter, but is not a user parameter.", "Creation Failure")
End Try
End Try
Next
'Testing and Creation of User Parameters of type: True/False
For Each item In booleanParams
Try 'Check if User Parameter exists
Param = oMyParameters.Item(item)
Catch 'Parameter doesn't exist as a User Parameter
Try 'attempt to create new parameter
oMyParameters.AddByValue(item, True, UnitsTypeEnum.kBooleanUnits) '(Name, Value, Unit Type)
Catch 'Parameter exists but not as a User Parameter
MessageBox.Show("The Parameter: " & item & " exists as a parameter, but is not a user parameter.", "Creation Failure")
End Try
End Try
NextI tried to add enough comments to help you understand what is happening so you can modify as needed. Let me know if you have any questions.