The object model itself isn't enough information to get you up and running, it's really just a roadmap to show you all of the sub-objects you have to access to access a certain property/method.
The next/first step is to use the API object browser, or programming help to find the functionality you want, and use the object model to understand how to get there.
See this thead for instruction on using help/object browser.
http://forums.autodesk.com/t5/inventor-customization/add-selection-filter-to-ilogic-code/m-p/6700118...
For example, if I want to access iProperties in a part file, I look through all of the tree'd info under part document.
Looking there I find nothing, but under the generic Document tree, I see Property is available, which is what the API refers to iProperties as.
Following the tree up, it looks like this:
Property -> PropertySet -> (PropertySets) -> Document -> (Documents) -> Application
Given that there are enums (in brackets above), it tells me I need to have a way to select a specific item out of that set, and what is described above is really only the TYPE of the object I need to access. At this part, we go into the Object Browser/Programming help and find Application, then work our way backwards by finding the path through the objects of the right type to get to the iProperty.
Accessing iProperties is actually relatively complex as there are a lot of identifiers you need to know to access specific iProperties. This is where google-fu comes in, and you can quickly find the "mod the machine" blog guide on "Accessing iProperties" which will guide you through to finding/accessing a specific iProperty.
An example of accessing an iProperty without any of the sub-objects assigned to a variable would look like:
ThisApplication.ActiveDocument.PropertySets("Design Tracking Properties").Item("Description").Value
Really, how this looks more like when writing code will be:
Dim oDoc As Document
oDoc = ThisApplication.ActiveDocument
Dim oDTPProperties As PropertySet
oDTPProperties = oDoc.PropertySets("Design Tracking Properties")
Dim oiPropDescription As String
oiPropDescription = oDTPProperties.Item("Description").Value
'To call a different design tracking property at the same time would be as easy as adding
Dim oiPropStockNumber As String
oiPropStockNumber = oDTPProperties.Item("Stock Number").Value
MsgBox(oiPropDescription & vblf & oiPropStockNumber)
The reason we assign sub-objects to variables is so the computer can access them faster, and it also makes the code easier to read for more complex programs. I could accomplish the exact same thing with the code below and in one line, but it would take longer for the program to process.
MsgBox(ThisApplication.ActiveDocument.PropertySets("Design Tracking Properties").Item("Description").Value & vblf & _
ThisApplication.ActiveDocument.PropertySets("Design Tracking Properties").Item("Stock Number").Value)
*note the "_" is the next line char for the compiler. you can delete it if you move the code right after it to the same line.
Any more questions, feel free to ask! Don't forget google/searching the forums is your friend!
--------------------------------------
Did you find this reply helpful ? If so please use the 'Accept as Solution' or 'Like' button below.