iLogic makePath command

iLogic makePath command

tmathieson
Advocate Advocate
1,947 Views
11 Replies
Message 1 of 12

iLogic makePath command

tmathieson
Advocate
Advocate

Hi All,

can anyone tell me what i am doing wrong here.....

	Parameter(MakePath("SC-PRECAST:2", "SC-FOOTING - SIDE:1","SIDE_ANGLE")) = ANGLE_SIDE

 i get this error....

 

Error on Line 10 : Value of type 'System.Collections.ArrayList' cannot be converted to 'String'....

 

tried it like this, and got same error...

	Parameter(MakePath("SC-PRECAST:2", "SC-FOOTING - SIDE.ipt:1","SIDE_ANGLE")) = ANGLE_SIDE

the name of the sub, component, and parameter are correct. as far as i can tell, the syntax is as described ilogic....

 

anything pop out to anyone?

 

thanks in advance!!

0 Likes
Accepted solutions (1)
1,948 Views
11 Replies
Replies (11)
Message 2 of 12

gcoombridge
Advisor
Advisor

@tmathieson brackets are wrong I think, they should enclose the makepath instructions as below:

msgbox(Parameter((MakePath("Test1:1", "Part1:1")),"Thickness"))

That way the path is a single object inside the parameter reference

 

Use iLogic Copy? Please consider voting for this long overdue idea (not mine):https://forums.autodesk.com/t5/inventor-ideas/string-replace-for-ilogic-design-copy/idi-p/3821399
0 Likes
Message 3 of 12

gcoombridge
Advisor
Advisor
Parameter((MakePath("SC-PRECAST:2", "SC-FOOTING - SIDE.ipt:1")),"SIDE_ANGLE") = ANGLE_SIDE

 

Use iLogic Copy? Please consider voting for this long overdue idea (not mine):https://forums.autodesk.com/t5/inventor-ideas/string-replace-for-ilogic-design-copy/idi-p/3821399
0 Likes
Message 4 of 12

tmathieson
Advocate
Advocate

Hi gcoombridge,

 

thanks so much for the reply.  it has helped, but still getting an error...so following your lead from above, i created these two lines of code to be sure my parameters exist and are correct...

 

MsgBox(Parameter(MakePath("SC-PRECAST:2", "SC-FOOTING - SIDE:1"),"TEST_5"))

MsgBox(Parameter(MakePath("SC-PRECAST:2", "SC-FOOTING - SIDE:1"),"SIDE_ANGLE"))

 

 

works fine!  windows pop up showing the values that exist in my component.  but... when i code like this, to pass the parameter from the assembly down to the component...

 

Parameter(MakePath("SC-PRECAST:2", "SC-FOOTING - SIDE:1"),"TEST_5") = ANGLE_SIDE
	Parameter(MakePath("SC-PRECAST:2", "SC-FOOTING - SIDE:1"),"SIDE_ANGLE") = ANGLE_SIDE

 i get....

 

Error in rule: FOOTING_UPDATE, in document: ASSEMBLY INSERT.iam

 

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))

 

i should probably mention that both the sub and the component have model states....

could it be something to do with the units? i am just passing a number, no 'deg' or 'rad' or whatever...

 

thanks again!!

0 Likes
Message 5 of 12

gcoombridge
Advisor
Advisor

@tmathieson I've tried it with mismatched units and it works fine... I think the whole makepath needs to go in its own brackets:  parameter((makepath(asm:1,part:1)),Parametername) = ABC

Parameter((MakePath("Test1:1", "Part1:1")), "Thickness") = TestABC
MsgBox(Parameter((MakePath("Test1:1", "Part1:1")), "Thickness"))

 

Use iLogic Copy? Please consider voting for this long overdue idea (not mine):https://forums.autodesk.com/t5/inventor-ideas/string-replace-for-ilogic-design-copy/idi-p/3821399
0 Likes
Message 6 of 12

tmathieson
Advocate
Advocate

thanks again.  i can get it to work if i pass a parameter to a component that has only the master model state. the parts i am trying to pass the parameter to  have model states...i've tried setting the edit factory scope to  a single state, all states and just the master state... no luck.

 

am i barking up the wrong tree here/  should this snippet work with a component that has model states?

 

thanks.  i appreciate your help!

0 Likes
Message 7 of 12

gcoombridge
Advisor
Advisor

Sorry I ignored that part of your previous response because I'm still on 2021 so couldn't offer any insight. You could try this kind of syntax (putting the modelstate in <> after the filename) but that is a guess...

gcoombridge_0-1644542158986.png

 

Use iLogic Copy? Please consider voting for this long overdue idea (not mine):https://forums.autodesk.com/t5/inventor-ideas/string-replace-for-ilogic-design-copy/idi-p/3821399
0 Likes
Message 8 of 12

WCrihfield
Mentor
Mentor

@tmathieson & @gcoombridge 

I know that the:

Parameter("CompName1:1", "ParamName1") = Value

will (normally) access whichever model state that the named component is currently set to in a top level component, but I have not tried it while using MakePath yet.  Even that was a little unpredictable at times though.  I don't know if they have all the bugs worked out of the new ModelStates yet.  Then their lack of detailed documentation about their 'iLogic only' snippets doesn't help either.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 9 of 12

tmathieson
Advocate
Advocate

thanks again!! i will give this a try, but in all likelihood will have to look at a different approach.  this is the 3rd time that i have tried to manipulate a component with model states thru an iLogic rule in an assembly where i have run into this problem.  in the other two cases, i ended up rewriting the code to take a different approach.  it seems like i will have to do the same thing here...

 

thanks again.  will let you know if this method works...

0 Likes
Message 10 of 12

tmathieson
Advocate
Advocate

Hi, so for THAT particular issue, i got rid of the model states, made separate subs WITHOUT Model states, and can manipulate as you should be able to...

 

however,  on another project i did up a while ago, which has model states components, not sub assemblies, in the top level, and i still have issues with Model states...

 

i have tried writing this line in the 3 different ways shown here....

 

	'Parameter(NEW_PLATE & "<" & NEW_STATE & ">", "PLATE_TH_MM") = PLATE_THICK
	'Parameter(MakePath((NEW_PLATE & "<" & NEW_STATE & ">")), "PLATE_TH_MM") = PLATE_THICK
	Parameter((NEW_PLATE), "PLATE_TH_MM") = PLATE_THICK

 if i un comment either of the first 2 with the Make Path option, i get the error below that the component  is not found...if i run with the last Parameter statement, i get the fail error shown here... do i need to get my "new_state", (model state), inside  the NEW_Plate variable, so that the result would be like (BAP BW PLATE<BAP 10N>:1) instead of the way it is now...(BAP BW PLATE:1<BAP 10N>)... never mind, tried it and get the 'component not found error'.....

 

yes, i have mentioned before in other posts that the Model State, id very limited in what you can do, and wasn't completely thought out (in my opinion).....

 

i have written a rule in the individual component that will update the parameter, but it is an extra step and ,in my opinion,, should not be necessary. should be able to modify parameters from the assembly for model state parts just like you can for  non model state parts..

 

will keep slugging away...  thanks all!!

0 Likes
Message 11 of 12

WCrihfield
Mentor
Mentor
Accepted solution

Just to clarify one point...

There are only 2 iLogic snippets that allow you to specify what model state you want to work with, and neither of them have to do with accessing Parameters.

One is for replacing one component with another component:

Component.Replace("SubAssembly:1", "OtherAssembly.iam<Model State1>", True)

The other is for adding a component to the assembly:

Dim modelStateComponentA = Components.AddWithModelState("a:1", "a.ipt", "Model State2")

So...we do not have any official confirmation or example from Autodesk that says that their Parameter() iLogic snippet allows you to specify a model state to work with.  It simply may not have that capability/option built into it yet.

We do have an example of the Parameter() snippet being used with the MakePath snippet:

Parameter(MakePath("SubAssem1:1", "Part1:1"), "d0") = 1.2

, but not one that includes anything about specifying a model state.  So, I would give up on trying to access a Parameter specific to a named model state using the Parameter() iLogic snippet.

Have you tried any regular Inventor API route yet.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 12 of 12

tmathieson
Advocate
Advocate

thanks for the info!! i will stop beating my head.... no, i have not looked at the API to see what is possible.  i will investigate and see what i can find.

 

 

 

thanks again!!

0 Likes