Thursday 3 July 2014

iLogic Rules

I have just spent the last couple of days playing with iLogic. I am doing a tank template that I will present in the next couple of posts and it's all been done with iLogic and iFeatures.
Meanwhile I decided to present you a couple of iLogic routines and programs I am using. I have collected a couple and hope you will find them useful.
I don't have any programming experience, so all codes have been downloaded off the internet, tried and tested.
The main ones that I use are Export to PDF, DWF, and DXF. The reason I use ilogic is to automatically add revision to the filename. You can also chose export folder so one more thing out of the way.
I also use iLogic to force update iProperties of the drawing from the model. I have a code to set the scale of the model in the drawing and one to add virtual parts to the assembly from a text document. (Curtis Waguespack's code). He also gives a code to force turning all features off down level on all components (huge time saver)
Create a folder for your iLogic codes, recommend to use a map network drive location so they are available for all users in your company.
Open a file and go to Manage \ iLogic \ iLogic Browser , switch to External Rules tab. Right click and add external rule. Add your rules, in my case UpdateProps (force update of properties), SavePDF, SaveDXF, SaveDWF.


Switch to Global Forms and Add Form. If you have a common Design Data folder on the network then this Form will be available to all users ;) . Drag your rules on the right and change the name of the buttons and of the form if needed.



I know you can add buttons on the ribbon and quick access bar but you need to configure it with every new Inventor release so I prefer to have a global form instead.
At times I need to do a batch of files so I use Code Injector, a small utility that will do that for you. We once had around 900 drawings to export to dxf and pdf so we just left the injector run overnight. Here is the post and description. http://beinginventive.typepad.com/being-inventive/2012/02/injecting-ilogic-code-and-ilogic-event-triggers-automatically.html




Virtual Components
Issue:
You have a number of standard Virtual parts that you find yourself adding over and over. You'd like to have the ability to add them based on a predefined list.
Check his blog here for the code.
I use this to add various stuff like: oil for gearboxes and hydraulic units, paint and primer, chemical for anchor bolts, grout, etc.

Work Features
Issue:
You have other members of your design team that do not remember to turn off work features at the part level or sub-assembly level when they are done working with those files. As a result file previews and view representations get messed up. You'd like to have a quick way to toggle all of the work features off. Can this be done with iLogic?
 Check his blog here for the code.

Update copied properties.
Issue:
You have a lot of drawings that need update copied iproperties of the model (updates copied iproperties of the model in the drawing).
Solution:
Use the code to force the drawing to update copied properties from the model. Can be used with Code Injector to do a batch of drawings at a time.
File to be used: UpdateProps.iLogicVb

Save PDF
Issue:
You have to export one or many drawings at a time to pdf.
Solution:
Use the code to export current drawing to pdf. It creates (if didn't exist) a folder called DXF on same path as drawing (needs saving first) in which a pdfwith the filename being "Drawing_filename + Drawing_description + Revision". Can be used with Code Injector to do a batch of drawings at a time.
Make SURE that the drawing is saved otherwise the path of the folder and pdf will be on root drive.

Save DXF

Issue:
You have to export one or many drawings at a time to dxf.
Solution:
Use the code to export current drawing to dxf. It creates (if didn't exist) a folder called DXF on same path as drawing (needs saving first) in which a dxf with the filename being "Drawing_filename + Drawing_description + Revision". Can be used with Code Injector to do a batch of drawings at a time.
Make SURE that the drawing is saved otherwise the path of the folder and dxf will be on root drive.


Scale of first view in titleblock

In order to have the scale show up and update automatically in the titleblock, do the following.
Edit your title block definition and add a Text item with the type Prompted Entry
This text should contain <Scale>

After you add this, Inventor will prompt you for a Scale value whenever you add the title block to a sheet.
The same happens when you add a new sheet with the title block to the drawing or when you start a new drawing using a template where you have applied this solution.
When it prompts you, just leave the value blank

Then add the rule in text bellow to the drawing
File to be used: Prompted_Scale.txt
Add the rule to the trigger “Before Save Document”

After that, on every sheet in the drawing, you will get the scale value from the first view on that sheet in the title block when you save the file.


What rules do you use? Please let me kow what's your favorite?
ADS

No comments:

Post a Comment