Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Set assembly iProperties using iLogic

11 REPLIES 11
SOLVED
Reply
Message 1 of 12
meck
1629 Views, 11 Replies

Set assembly iProperties using iLogic

I wish to set the properties of an assembly using iLogic. I have the values of the properties in a part that is in the assembly. I wish to pass those values from the part to the assemblies iproperties. I tried using the following code, but it gives an error saying it can not find the document "MyAssy.iam"

 

 

iProperties.Value("MyAssy.iam", ThisDoc.Path, "Part Number")=AssyNo

I'm not even sure that this is the way to do, but it's the only way I could think of to try.

 

Thank in advance!

Meck

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
11 REPLIES 11
Message 2 of 12
swordmaster
in reply to: meck

your close 🙂

you just need to set the iproperties value of your assembly to the iproperties value of the part

here is a small example put something similar in your assembly rule.

the cut and paste screws the code a little, but im sure you will get the idea!

 

iProperties.Value

("Project", "Part Number")= iProperties.Value("Part1:1","project", "Part Number")

 

Inventor 2010 Certified Professional
Message 3 of 12
meck
in reply to: swordmaster

Thanks!

It took me a while to understand what you were saying, but when the light went on I got it to work.

Here is the code that I used...

In the Part1.ipt I created a Custom Property named AssyNo and used the following code to set its value...

 

iProperties.Value("Custom", "AssyNo")=AssyNoValue

 

In the assembly I set the Part Number property to the custom property of Part1.ipt.

 

iProperties.Value("Project", "Part Number")=iProperties.Value("Part1:1", "Custom", "AssyNo")

Thanks for the help. I really appreciate it!

Meck

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
Message 4 of 12
swordmaster
in reply to: meck

you are welcome!

Actually there is no need to create the custom property named AssyNo

You can read the project property "part number" directly to your assembly

Inventor 2010 Certified Professional
Message 5 of 12
meck
in reply to: swordmaster

I did see that I was able to do this, but the Part Number of Part1.ipt is different than the Part Number of the assembly. The part has code that reads from an embedded spreadsheet that lists all the part numbers that make up the assembly. It just happened that this part happens to have that information availiable to it.

I haven't checked yet, but I assume that you still can not pass parameters to an assembly, and that you still can not pass Text parameters at all in 2012?

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
Message 6 of 12
swordmaster
in reply to: meck

I am not using 2012 so i cannot say if text parameters can be passed or not 🙂

Not sure i fully understand what you mean by passing parameters to assemblies. This has been possible since INV 2009

Inventor 2010 Certified Professional
Message 7 of 12
meck
in reply to: swordmaster

Sorry. I meant derive parameters to assemblies from parts. If it is possible, I do not know how to do it.

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
Message 8 of 12
swordmaster
in reply to: meck

what you can do is link the part to the assembly and export the parameter values from the part. Then you can use these parameters in your assembly rules

Inventor 2010 Certified Professional
Message 9 of 12
meck
in reply to: swordmaster

Whoa, I will definitely try that!

Thanks for all your help!

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
Message 10 of 12
meck
in reply to: swordmaster

Is there a way to get a property from one part to another part? The parts are not in the same assembly.

I tried using the ilogic code below, but I get the follow error message...

"iProperties:The document named "C:\iLogic Models\MyPart.ipt" was not found."

 

 

MsgBox(iProperties.Value(ThisDoc.Path&"\MyPart.ipt", "Custom", "MyProp"))

 

Mike Eck
Master Drafter/ CAD Programmer
Using Inventor 2018
Message 11 of 12
swordmaster
in reply to: meck

It might be possible to do this, as yet i have not figured out how. However I would recommend that you do not go down this road!

Referencing parts which are not part of your subassembly will probably give problems. How do you know that the parts will be available ? and if you copy your assembly will you remember to take those parts also?

Other thing is hard coding the path to these parts. If you change the location or share the assembly with a colleague most likely the path will not be the same

Inventor 2010 Certified Professional
Message 12 of 12

Another question within same topic.

Quite often in our workflow we need to create simplified standalone (link is being supressed) parts that represent external geometry of corresponding assemblies.

Of course we use derive component technology.

But problem is: we want those parts inherit all the same iProperties (including custom and applicable physical) with all the same values.

I'm sure iLogic could do the trick but can't decide where to start from.

Any ideas?

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

Post to forums  

Autodesk Design & Make Report