@baliasM74U3
Welcome to the forums and ilogic customization. For future ilogic post it would be best to use the customization forum. This will allow more eyes on your questions.
Shown below is a fairly simple internal/external rule already created posted on the customization forum. A note the sheet metal extents will return units of cm so a conversion in the code would be needed. Or create a user parameter and put the sheet metal extents equal to the parameter and use the parameter unit conversion do the work.
https://forums.autodesk.com/t5/inventor-customization/ilogic-flat-pattern-extents-to-parameters/td-p...
Where to place the code.
You have two options
1st local in the part called internal rule 🪑 Advantages parameter update immediately and code can be less complicated. Disadvantages you now will have code in every part so make an error or need to change the rule it is now in every part created.
2nd Is the external rule 🧳it can be created in little more than a notepad . Advantages: The rule is disconnected from each part and is stored in one location. So if an update is needed not an issue. The same rule can be used in drawing, part or assembly if its contents are set to do so. Disadvantages the code can be a bit more complex.
How to trigger the rule. You need an event trigger. So when a parameter changes the rule updates. Look 👀 in the ribbon for events trigger and familiarize yourself with its function.
Here is a video 🎞 of another similar code which might be good also to learn the techniques. It starts of setting the events trigger, your last step and will work through the codes functionality.
https://knowledge.autodesk.com/support/inventor/learn-explore/caas/screencast/Main/Details/6737ef73-...
You can get the sheet metal extents without ilogic shown here. Simply type the functions directly into the iproperties.
http://help.autodesk.com/view/INVNTOR/2020/ENU/?guid=GUID-9ED64200-A0CA-4F27-A308-9BF7ADB22D06
Hope this helps
If this solved a problem, please click (accept) as solution.
Or if this helped you, please, click (like)
Regards
Alan