Louis D. Brandeis
Just this Friday, I was posed what I thought was an easy, five minute, question. "How do I place the view scale into the title block?"
My inside voice said, Pffft! No problem! After all, there's a spot right there for it in the title block already!
Scale is already there! |
So I go into my title block definition, and look for the iProperty that accesses the drawing scale. It should be a slam dunk. All I have to do is choose the property that calls the scale. But as I look, my stomach sinks.
Here they are. All I have to do is choose one. But wait?!? |
I puzzle over this a bit. I bounce it off of Javier Chavez, one of my KETIV team members. He confirms what my eyes see. The scale isn't there.
So, now, as they say, it's time to execute 'Plan B'. Which means, I have to develop a 'Plan B' to execute.
Now I'm pacing about my little office, rubbing my chin, and annoying my coworkers with my heavy footfalls.
After a few moments, I have 'Plan B'.... iLogic!
iLogic to the rescue! |
So I create a new iLogic rule, and enter the following code below (with comments):
'Forces update after rule runs
iLogicVb.UpdateWhenDone = True
'Extracts scale from 'View 1' on drawing sheet' to a field named SCALE
SCALE = ActiveSheet.View("VIEW1").Scale
'Writes scale to a custom iProperty named SCALE
iProperties.Value("Custom", "SCALE") = SCALE
Here's the rule in context of the iLogic editor. |
In short, the code extracts the scale of the first drawing view via the API, and writes it to a custom property. With the scale written to a custom property, NOW I have something I can extract for the Title block!
SCALE custom iProperty |
With this field added to the title block, I'm in business.
The custom iProperty |
With that being done, is the rule perfect? Frankly, no. I have work left to do.
This is what's still on my to do list.
1) My triggers don't update completely every time. Just like Rule #2 of Zombieland, I have to 'Double Tap' the update button once in a while. I want to go over it and make sure it updates consistently.
Still have to work on the triggers some more |
2) The view has to be called 'VIEW1'. If it's not, or if you delete the first view and place another (now called VIEW2) the rule will bark about not having 'VIEW1'. So there's a little work to be done to remedy that.
But I think the backbone of the routine is solid, and I'm willing to take a little time to revel in a small victory, if only for a few seconds. I don't consider myself one of the iLogic 'gunslingers' so sometimes you have to 'Enjoy the Little Things'.
Which by the way, is Rule #32 of Zombieland! :-)
As I learn more, and improve the rule, I'll post updates!
Happy Inventing!
P.S. It's back. Autodesk Manufacturing Academy is back, hosted by KETIV in Cerritos and Oregon. Come see us in October! And check out the videos from last years session HERE!
***UPDATE 20-March-2012 ***
After some hunting around, and help from a friend or two, it looks like teh direct update can't be triggered right when the view scale changes. But if an event trigger is set to run "Before Save Document". The rule scale will update when you save. I tried it in Inventor 2012, and it works!
Here's the ticket! |