Tuesday, March 15, 2011

Using a Yes No Message Box in Your iLogic Rule

Issue:
You have a rule that requires you to ask the user a Yes/No question in order to proceed. The action required is determined by the user's answer. If the user answers No, you want to disregard previous user input and set the parameter back to its original value before the rule was engaged.


Solution:
Here is one solution, although there are certainly others.

You can use the MessageBoxButtons.YesNo option appended to a message box in order to provide the user with a yes and no button to select from. And you can create a temporary variable to hold the original length for later use in the rule, if the user's answer requires that value to be reset.






In the example code provided below the user is asked to enter a Length.



If the Length is larger than the Width, the user is prompted with a Yes or No question.





If Yes is selected, the user is prompted to set the Width.





If No is selected, the Length is reset to its original value and it is displayed in a message box for the user to see.



Here is the example iLogic code:
In order to test this, you can create a simple block with three parameters, named Length, Width and iTrigger0.
Then just create a rule and paste this code into it.



'start of iLogic code

'trigger rule for testing
trigger = iTrigger0

'gather Length value
tempLength = Length

'gather input from user. Use current parameter as input default
Length = InputBox("Enter Length", "iLogic Length", Length)

'check length
If Length > Width Then

'query user

question = MessageBox.Show("Do you want to adjust the Width?", "iLogic Question",MessageBoxButtons.YesNo,MessageBoxIcon.Question)

          'set condition based on answer
            If question = vbyes then
         
          'gather input from user, uses current parameter as input default
            Width = InputBox("Enter Width", "iLogic Width", Width)

          Else if question = vbno then
         
          'set parameter back to its original value
            Length tempLength
            'confirm action
            MessageBox.Show("Length = " & Length, "iLogic Message")
          End if
Else
End if

iLogicVb.UpdateWhenDone = True
  
'end of iLogic code


Look for more iLogic examples on this blog or in the chapter dedicated to iLogic Basics in the next edition of Mastering Autodesk Inventor book (due out in June of 2011 if all goes well).

Monday, March 14, 2011

Change the path for the iLogic Addin DLLs Directory in Autodesk Inventor

Issue:
You've created external rules containing .NET assemblies in the form of DLLs, but would like to set the default path of these files to a network drive, rather than the default local directory of:
C:\Program Files\Autodesk\Inventor <version>\Bin\iLogicAdd

Solution: 
Go to the Tools tab and expand the Options panel (by clicking the small black arrow)  and then you will then see the iLogic Configuration button. When you click this button it will bring up the Advanced iLogic Configuration dialog box, where you can set the DLL directory path. You can also add external rule directories and change the default file extension for external iLogic rules in this dialog box.






Look for more iLogic examples on this blog or in the chapter dedicated to iLogic Basics in the next edition of Mastering Autodesk Inventor book (due out in June of 2011 if all goes well).

Saturday, March 12, 2011

Free Autodesk Inventor Add Ins from Autodesk Labs

Here are a couple of free addins offered on the Autodesk labs site.
http://labs.autodesk.com/utilities/ADN_plugins/catalog/


Screenshot for Inventor
This plugin can be used with Inventor to simplify the process of capturing images of parts of documents, or the entire document or application windows. It optionally allows you to remap the background to white and the foreground to black, and convert the entire image to grayscale, as well as sending the capture image directly to a printer.

download now

 Supported Versions
  • Inventor 2011
  • Inventor 2010
  • Inventor 2009
  • Inventor 2008

FeatureMigrator for Inventor
This plugin allows Inventor users to more easily create parts from assembly features. Through functionality provided by the tool, users are able to migrate (re-create) an existing assembly feature in the relevant sub-parts at the right location in the part space and with the same properties as the parent feature in the assembly. The FeatureMigrator can reliably migrate an assembly feature to the part level. This can save a lot of time and effort for the user when compared with the manual approach, i.e., creating the equivalent features in the affected parts.

download now

 Supported Versions
  • Inventor 2011
  • Inventor 2010
  • Inventor 2009
  • Inventor 2008

Thursday, March 10, 2011

Prevent iLogic Rules From Firing When Another Rule Fires

Issue:
You have multiple rules set up in the same file to handle different tasks. But for some reason, when you trigger one rule (let’s call it Rule-A) it seems to trigger another rule also (we’ll call it Rule-B). In other cases, you have Rule-A set up to trigger Rule-B using the iLogicVb.RunRule function, which works fine. But for some reason Rule-A gets triggered a second time after Rule-B is run. What is causing these rules to be fired multiple times?

Solution:
By default rules are run automatically when the parameters they deal with are changed. For instance, if you have a rule that sets a parameter named Length, and then the Length is changed by another rule, you might notice the first rule is being run automatically. To resolve this you can edit the rule and go to the Options tab and then select the Don’t Run Automatically option. This prevents the rule from running just because the parameter is changed, and will require the rule to be run explicitly.

Keep in mind that if you’re using the iTrigger parameter to run the rule for testing, the rule will no longer fire when the iTrigger button is clicked. This is because the iTrigger is really just a simple parameter change (incremented by one). For that reason, you might want to set up a "master" rule to handle when other rules are triggered, and have it set to run automatically, but have all of the other rules set not to run automatically.






















Look for more iLogic examples on this blog or in the chapter dedicated to iLogic Basics in the next edition of Mastering Autodesk Inventor book (due out in June of 2011 if all goes well).

Tuesday, March 8, 2011

3Dconnexion's One Millionth 3D Controller!

3Dconnexion recently announced it has shipped more than one million 3D controllers. If you haven't used one of these devices with Inventor you might not know what you're missing. The 3Dconnexion 3D controller, or 3D mouse allows you to rotate your model on screen and naturally interact with it. It's certainly not required to have one of these to use Inventor, but most users find that once they use one, it is something they would not want to go without. 

Congrats to 3Dconnexion on their success, and thanks for the reliable and helpful device.

click to link to Amazon.com



More reading:

What is a 3D mouse?
3Dconnexion history

Sunday, March 6, 2011

Autodesk Inventor Rhino Import Translator



Issue:
You have a CAD model created with Rhino, and you want to bring it into Inventor for further design or to build off of it.



Solution:
Autodesk has an add in for use with Inventor 2011, 2010, and 2009 on it's labs site (Inventor 2012 and beyond will include this translator without the need to download it).

http://labs.autodesk.com/utilities/rhino_import/overview/

Thursday, March 3, 2011

Inventor 101: Simple Fully Constrained Sketches

Issue:
You've been using Inventor for a while now, but you find it frustrating and find yourself spending almost as much time fixing your sketches as you do creating them. You've been told that you should always fully constrain and dimension your sketches, but when you try it becomes overwhelming, as Inventor seems to want waaaaaay too many dimensions! So you just create your sketches as you see fit, but then sure enough, if you try to change one minor thing, the whole sketch falls apart. Inventor sucks! (right?)

Solution:
Consider these "from the trenches" best practices:

  • Be nice to your sketches: stop trying to cram everything into one sketch, they don't like it and will become rebellious. Instead of making one sketch responsible for 12 features, start with a simple base sketch, create a base feature from it and then build on it. Your sketches will thank you for it.
  • Think inside the box: I create every sketch I can starting with a rectangle. Even when I'm creating complex curvy stuff, I still start with a rectangle. Typically this is just a construction bounding box, but it helps me add structure to the sketch.
  • Be lazy: (when's the last time somebody told you that was a best practice?) Only create as much line work in a sketch as you can constrain and dimension easily. If getting your sketch fully constrained turns into work, your sketch is too busy. 
 Let's see these concepts in action:



Here is a base flange. This should be easy enough to create, right?


First let's look at how many users would approach this.
  • Create a rectangle (good job).
  • Base this rectangle so that it is centered on the part origins (good job).
  • Add every other feature this part has to the sketch (good job... what.. wait...no. Bad, this is bad.


Why is this bad? 
Because even with the jumble of dimensions already present, Inventor requires 121 more dimensions to be fully constrained (this might actually be sketch constraints and dimensions combined).


A sure fire way to add too much complexity to your sketches is to add fillets or chamfers at the sketch level. I know, I know: "you luvs you some fillets and chamfers", but there be will time for those later, as placed features, not as sketch based features. The same thing goes for patterns and mirrors: don't do them in the sketch, create these as features.

Q: Why does Inventor have these things in the sketch tools if you shouldn't use them?
A: Okay good point. There are times when you must place fillets, chamfers, patterns, etc. in a sketch, due to specific work flows or tools to be used later in the design. But as a rule avoid these things in sketches most of the time. 

Okay, so here we go. This is the battle tested, from the trenches, best practices, approach:
  • create a base rectangle
  • constrain it around the origin (in this case using a diagonal construction line)
  • fully dimension the sketch
That's it! Sketch complete. (good job)

Next: Make it 3D already!




Okay, now let's create another simple sketch, based on the first feature (the edges of the first feature have been projected into the sketch).




I know you're tempted to add 99 more lines and 283 more dimensions, but let's move on. Come on now, step awaaaaay from the sketch... slowly, no sudden moves... that's it... 

Now cut the base feature with this second sketch.



Okay, now we're going to create another sketch and ... yep you guessed it, create a rectangle dimensioned and constrained to the projected edges of the existing features. (I've added a center point to the midpoint of one edge of the rectangle in order to have something to grab for the center dimension.)
  
 Make it 3D!



Next...yep, a rectangle. Dimensioned and constrained to the midpoint of the existing edge (the edge has been projected into the sketch).

Extrude cut. 
And were moving right along.




Now let's get "crazy" and add a Full Round fillet feature.


Next, use the feature Mirror tool to "copy" the protrusion and the fillet.



That was fun, huh? 
Alright, you can do it again:



Okay, I know you've been itching to round those corners since step one, so go on,  have fun adding some fillets:
  

Well, there you go, simple sketches rule the day!
And you might have noticed, the number of dimensional inputs was less than 20 compared to over 121! 

You might also have noticed we never used the line tool! Believe it or not, that's far more common than you might imagine.



Although this approach might seem dumbed down or too "mickey mouse" for you, in reality you'll find that most experienced "expert" users of Inventor (and other 3D modelers) will employ a similar approach. Keep in mind you will have plenty of opportunity to challenge yourself with complex parts that demand more complex sketches as you create designs. But if you use this approach for most of your work, you'll find yourself spending more time and energy focused on designing and less on drafting.


Want to practice these concepts?
You can find 24 sheets of detailed part drawings for practice in a PDF at this link:

Part Modeling Practice Drawings for Inventor