Changing Parameter value with iLogic

Changing Parameter value with iLogic

Anonymous
Not applicable
1,401 Views
7 Replies
Message 1 of 8

Changing Parameter value with iLogic

Anonymous
Not applicable

I want to change the "STROKE" parameter using iLogic. I keep getting the catastrophic failure error message. Essentially, my end goal is I want to read off a cell value from the excel file that will adjust that parameter. Am I using the wrong command?

Capture1 (3).PNGCapture (10).PNG

kelly.young has embedded your images for clarity.

0 Likes
1,402 Views
7 Replies
Replies (7)
Message 2 of 8

mcgyvr
Consultant
Consultant

You are missing an occurrence number for that part..

Should be like.. Note the :1 after the 1110_Barrel..

See if adding that solves the problem..

Parameter("1110_Barrel:1", "STROKE") = 5


-------------------------------------------------------------------------------------------
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 3 of 8

Anonymous
Not applicable

Didn't work 😕 I changed the name of the components in the assembly to what they are without the :1. The component names work fine for the iPart.ChangeRow commands. It's just the Parameter command thats giving me trouble

0 Likes
Message 4 of 8

Anonymous
Not applicable

Getting the same error trying to change the parameter this way! However, I can change it from the parameters dialog box in the part file. Do I have to somehow change it from the part file first to update the assembly? Is there a way to do that without having to open up the part file every time?

Capture2 (1).PNG

kelly.young has embedded your image for clarity.

0 Likes
Message 5 of 8

johnsonshiue
Community Manager
Community Manager

Hi! Please attach the example files here. There must be something obvious missing. The workflow should work. It is the bread-and-butter of the entire iLogic workflows.

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
0 Likes
Message 6 of 8

Anonymous
Not applicable

Here is an assembly and its component files. I have the iLogic code in the assembly set up the way I was trying to use it. Thanks!

0 Likes
Message 7 of 8

Anonymous
Not applicable

Still can't figure this out - any help appreciated!

0 Likes
Message 8 of 8

lmc.engineering
Advocate
Advocate

The issue here is the fact that you are trying to change a parameter in an iPart. Unfortunately, the part that exists in your assembly is not the Parent Factory part, it's a derive of the Factory part based on the Row member, and therefore you cannot change the parameters via iLogic in this way.

 

This is a very crude solution to your issue:

Add this to your rule in your assembly: Call the function where you would be declaring your parameter variable

SyntaxEditor Code Snippet

Function EditiPart()
Dim MyFile As String = "Full part file path and name" ''' i.e: C:\Storagelocation\partName.ipt
Dim oDoc As PartDocument = ThisApplication.Documents.Open(MyFile)
'''Create a shared variable to transfer value over to the iPart factory member
SharedVariable("VariableName") = 6 ''' Add your value here
auto = iLogicVb.Automation 'Automation for running rules in the iPart document
auto.RunRule(oDoc, "Rule0")
ThisApplication.UserInterfaceManager.DoEvents
oDoc.Close(True)
InventorVb.DocumentUpdate()
Return Nothing
End Function

Then in your iPart, add another rule, in this case 'Rule0'

Add this to it:

SyntaxEditor Code Snippet

STROKE = SharedVariable("VariableName")

This will give the result you are after.

 

Regards