Map family’s table column to Inventor property

<?xml encoding=”UTF-8″>By Adam Nagy

When trying to figure out how to do something in the Inventor API, then almost always the best way to go is: do it in the UI, investigate in the API.

So I registered in the Content Center my own part, created a SIZE property then mapped it to Project.Description (Design Tracking Properties:Description):

PropertyMapping

Now using the API I can find out how the SIZE property got mapped to Project.Description property:

Public Sub CCtest()
Dim cc As ContentCenter
Set cc = ThisApplication.ContentCenter
Dim ctvn As ContentTreeViewNode
Set ctvn = cc.TreeViewTopNode. _
ChildNodes("Features"). _
ChildNodes("English"). _
ChildNodes("Block")
Dim cf As ContentFamily
Set cf = ctvn.Families(1)
Dim ctc As ContentTableColumn
Set ctc = cf.TableColumns("Size")
If ctc.HasPropertyMap Then
Dim psid As String
Dim pid As String
Call ctc.GetPropertyMap(psid, pid)
Debug.Print "PropertySetId = " & psid
Debug.Print "PropertyId = " & pid
End If
End Sub

Result:

PropertySetId = {32853F0F-3444-11d1-9E93-0060B03C1CA6}
PropertyId = 29

So basically you just have to look for the given property set in Document.PropertySets and use its InternalName property, then look for the property inside it and use the Property‘s PropId.


Comments

3 responses to “Map family’s table column to Inventor property”

  1. Great post

  2. Looks fine, but how is it possible to set the value?
    Dim DescriptionCol As ContentTableColumn
    set DescriptionCol = Family.TableColumns(“Description”)
    DescriptionCol.SetPropertyMap {32853F0F-3444-11d1-9E93-0060B03C1CA6}, 29
    Family.Save
    Above code executes, but has no effect:-(

  3. Should it not be this?
    DescriptionCol.SetPropertyMap “{32853F0F-3444-11d1-9E93-0060B03C1CA6}”, 29
    Otherwise the best is to log this question on our Inventor API forum. The comment section here is not the best :)
    https://forums.autodesk.com/t5/inventor-customization/bd-p/120

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading