Hey guys. Getting some great comments on the iLogic post from last week. I'd like to address them, but require a little more functionality than I can do in a comment so here it goes:
Thanks for your great tip!
Can I get Inventor to add "mass" & save date" information
always on save to custom field, so that i can insert that field on drawing?
Samu,
1. Create custom iproperties (Mass, Date, Last Saved Time) in your part or part template document and insert the code shown below into a rule named “Update Mass and Date”
iProperties.Value("Custom", "Mass") = Round(iProperties.Mass,3) & " lbs"
iProperties.Value("Custom", "Date") =
DateString
iProperties.Value("Custom", "Last
Saved Time") = TimeString
3. You
can now map your drawing iproperties as you like to the properties in the part
file (download example part here) Download Mass and Date to Custom iProperties on Save
Notes:
- Mass rounding (as I have done with the Round function) and the inclusion of a units prefix on the value are optional
- There are various and sundry ways to format the date and time but I thought the KISS approach was appropriate in this case.
- This rule can be stored as an external if you prefer and fired using the same trigger (the rule will show up in the External rules list when assigning to the Before Save event.
- This is so easy even Rob Cohee can do it.
Sounds like a Geico commercial...
-Rob
Rob,
I got a challenge for you.
How about starting a place to collect ideas and uses for iLogic. Maybe even user supplied code.
I bet a lot of people think that they don't need to write "code" to get their job done, but i also bet they used to think the same way about Lisp.
Just my 2cents.
Posted by: Jon Selzer | 07/08/2010 at 10:09 AM
That's not a bad idea Jon, wish I'd thought of it. :)
I guess it could become a sub forum within the Autodesk Inventor discussion forums?
Posted by: Alex Fielder | 07/14/2010 at 04:51 AM