In Inventor, you can’t access a subassembly’s iProperties in an idw file but you want to pass them to a custom property in the drawing document to use for leader text, etc.
If you choose a leader and pick on a subassembly in the view, it allows you to get one of the part’s properties, but access to any from the subassembly is off limits.
This is where a simple iLogic code can come to the rescue. We need to pass this property from the subassembly document to the drawing document via a custom iProperty and we’ll be in business.
The first thing we have to do is set a new custom property in the idw file and set it’s text or string value to empty. This is so iLogic is able to find the property when running the rule. Then it’s just a matter of setting that custom property equal to the property in the source file - be it from a standard iProperty like Part Number from the project tab or a custom property in the source subassembly file. In the following example, we’re using the Part Number property from the subassembly and setting to a custom property in the idw called “New Property”. Here’s the code:
iProperties.Value("Custom", "New Property") = String.Empty ‘set a custom property to empty then populate it with the document’s value
iProperties.Value("Custom", "New Property") = _
iProperties.ValueInDoc("<Subassembly document name>.iam", "Project", "Part Number")
*Note the “_” after the = symbol is being used in this document – or to avoid the horizontal scroll bar as nobody likes to have to use that - to continue the line
Once the rule is run, we now have a custom property passed to the drawing from the subassembly for use so we can choose the custom property from the drawing and insert it.
And now, we have our part number or any other property in the subassembly available for use
Daren



Subscribe
The iproperties will not be updated unless the assembly file is saved. is it correct?
thanks
Posted by: sky | 11/02/2011 at 12:33 PM
Correct. If you make a change to the subassembly's iProperty, you'd need to save it in order for that change to be realized in the drawing (automatically).
Daren
Posted by: Daren Lawrence | 11/02/2011 at 12:41 PM
Good Morning,
I' ve a question for you,
I have made a small VBA program for insert in the drawing the scale of the first view that are insert in to the sheet this program make a new custom iproperty and set this with the scale, but when I insert a new sheet this automaticaly acquiring the same scale,
After a little study I have solved this problem, but now I need to insert a new sheet property than existing ones ( sheet dimension , sheet number , review sheet, i want , if is possible add a property scale sheet an write in this field a value of the first view that i insert in the sheet.
Is possible? and if is possible how can I do?
I apologize for my terrible english
Posted by: Enrico | 04/06/2012 at 01:53 AM