I use the attached part template to create parts on a regular basis. It has a small iLogic form built in to allow you to quickly enter the size, material, etc.
My challenge is that the material drop down on the title bar does not update when the material is changed by iLogic. This is true regardless of if the material is changed via the form or in the parameters window.
Material = Parameter("Material") If Material = "Aluminum" Then iProperties.Material = "Aluminum-6061" ElseIf Material = "Ductile" Then iProperties.Material = "Ductile Iron" End If
The good news is that the material is actually being changed in the iProperties. It's just a bit distressing that the new titlebar does not reflect the change.
(Inventor 2012 w/ Update 1 on Windows 7 64-bit)
Solved! Go to Solution.
It looks that the material for the active document is not refreshed after using iLogic rule to change the material. But when you click the top node in browser after changing the material, it will be refreshed. So you could add the code lines below the existing code lines in the rule to accomplish this -
Dim oNode As BrowserNode
oNode = ThisApplication.ActiveDocument.BrowserPanes.Active
Thank you for the code; that did the trick.
I also received an example file from Curtis_Waguespack that was helpful. One common denominator I found with both of the solutions is that when changing the material via the iLogic form everything works as expected. When the parameter is modified directly in the paramters window though it still fails to update the titlebar, although iProperties.Material does get changed correctly.
I'm still struggling to make this work. Is there something I'm missing with the add in code you suggested, River?
Dim oNode As BrowserNode oNode = ThisApplication.ActiveDocument.BrowserPanes.Active
I got error messages I don't know how to solve when I tried it.
Also, and this is the big question, how do I link Appearances to Materials? I'm working on Wooden parts and the appearance is very important.
Please see the attached model.
Before you use the iLogic form to customize the model, please clear the appearance overriden using clear command near the appearance drop-down list. And it should work fine when using iLogic form to customzie the model, and the appearance will be linked with material too.
Thanks, I got it working for Materials. I'm not finding that the Appearances are linked to the Materials though, even though they're both reading from Autodesk Libraries with overrides cleared.
I still need to find a way to customise the Appearances with an iLogic form somehow. It has to work on large assemblies with multiple materials in them, all linked with ilogic. There has to be a way to do that.
I got this working, thanks to the above advice. The Gods of neverending programming are well happy! It means adding the same parameters and rules to every single piece as far as I can figure it.
Any simpler suggestions?
For the legacy files, you have to update the iLogic rule manually one by one. For the new files, maybe you could consider to create one template using the updated iLogic rule.