How to create an ilogic rule from assembly to all sheet metal parts ?

How to create an ilogic rule from assembly to all sheet metal parts ?

deffysalfauzi
Enthusiast Enthusiast
927 Views
6 Replies
Message 1 of 7

How to create an ilogic rule from assembly to all sheet metal parts ?

deffysalfauzi
Enthusiast
Enthusiast

hi, sorry for my bad english. I need your help. I am very grateful for all the comments.

 

I have an assembly file that contains many sheet metal files. How to create an ilogic rule (sheet metal extents) for all sheet metal parts in an assembly, and make it automatically updated (event triggers > before save document).

 

So, with 1 ilogic rule in assembly you can create and update ilogic rules for all sheet metal.

 

And this is the ilogic code that I use for each sheet metal :

 

iProperties.Value("Custom", "Thickness") = Round(Thickness,1)
iProperties.Value("Custom", "Panjang") = Round(SheetMetal.FlatExtentsLength,0)
iProperties.Value("Custom", "Lebar") = Round(SheetMetal.FlatExtentsWidth,0)

iProperties.Value("Custom", "Description") = iProperties.Material &", "& Round(Thickness,1) &" x "& Round(SheetMetal.FlatExtentsLength,0) &" x "& Round(SheetMetal.FlatExtentsWidth,0) &" mm"

iProperties.Value("Project", "Description") = "=<Material>, <Thickness> x <Panjang> x <Lebar> mm"
0 Likes
Accepted solutions (1)
928 Views
6 Replies
Replies (6)
Message 2 of 7

WCrihfield
Mentor
Mentor
Accepted solution

Hi @deffysalfauzi.  That is a pretty tall and complex order.  I think I am up for the challenge though.  Attached to this response are some text files.  One text file named "Update Sheet Metal Info.txt" is for a slightly modified version of your original code here.  It should be downloaded and saved to your C:\Temp\ folder, and will be used as the source code for all the other new internal rules the main solution will create within all the assemblies referenced sheet metal parts.  The other text file named "Add Rule And Event Trigger To All SM In Asm.txt" contains the iLogic rule code for the rule you will run from the main assembly.  It will look at all referenced documents, in all levels of the assembly, and iterate through them.  If it is a sheet metal part, it will try to create the needed internal rule within that referenced document, then try to add that rule to the Event Triggers for before save event.  It is a long, multi-routine, complex process, but I managed to squeeze it all into one iLogic rule.

 

You may need to edit a couple things within that main rule, before running it though.  The first thing is on line 9, where it specifies the name that you want to call all the new internal iLogic rules it creates.  The next thing is on Line 12, just in case you decide to save that text file to a different location, and/or change its name, that line is where you will need to edit that.  Since this is a new custom iLogic rule that has a lot going on, it would be a good idea to be cautious and try it out on some test files first, before trying it on your production files, just to be safe.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

Message 3 of 7

jeremy.goenen
Advocate
Advocate

May i ask what your final goal is? If understand it correctly, you want to update the above iproperties for each sheetmetalpart, when you save the Assembly? If it 's like this, and you can use external rules, you can achieve this with two small rules, and just attach one of the rules to the "before save" eventtrigger. Like this you can use it whenever you need it for an assembly, or you maybe have to change some properties it will apply to "old" files as well.

Fanden Sie diesen Beitrag hilfreich? Fühlen Sie sich frei, diesen Beitrag zu liken.
Wurde Ihre Frage erfolgreich beantwortet? Klicken Sie dann auf die Schaltfläche LÖSUNG AKZEPTIEREN

Inventor Versionen:
2025.2
0 Likes
Message 4 of 7

deffysalfauzi
Enthusiast
Enthusiast

 

 

image_2023-11-23_093231078.png

thanks for the code, but nothing happens. Did I miss something ?

0 Likes
Message 5 of 7

deffysalfauzi
Enthusiast
Enthusiast

Screenshot 2023-11-23 094227.png

Screenshot 2023-11-23 094247.png

Screenshot 2023-11-23 094413.png

image_2023-11-23_095431349.png

image_2023-11-23_100436464.png

 

the goal is BOM (cut size), and to create ilogic for every sheet metal at the highest level of asm. 1 click on asm for all ipt, and update every asm file saved.

 

Hopefully this example image can explain it.

0 Likes
Message 6 of 7

jeremy.goenen
Advocate
Advocate

Yeah thanks, now i got it.

in this case @WCrihfield  got you covered. i wanted to test his code but it wasn't running because of little typing error in the "Udate Sheet Metal Info.txt" there is a missing "p", once i corrected this, the programm was running as expected.

Fanden Sie diesen Beitrag hilfreich? Fühlen Sie sich frei, diesen Beitrag zu liken.
Wurde Ihre Frage erfolgreich beantwortet? Klicken Sie dann auf die Schaltfläche LÖSUNG AKZEPTIEREN

Inventor Versionen:
2025.2
Message 7 of 7

deffysalfauzi
Enthusiast
Enthusiast

oops.... sorry for that. Thanks very much @jeremy.goenen@WCrihfield 

0 Likes