Hi Dusan,
I will try to improve following with simple UI (Form), but basically code bellows iterates through all families in/bellow Structural Shapes (recursively) and adds new column MyCol mapped to Custom.iPropAhoj. So every instance from Structure Shapes will have text custum iProperty iPropAhoj with value strAhoj. Main row is green.
1. Modify Inventor project to have only user read/write library reconfigured (by this we ensure all families are read/write)
2. In VBA environment create new module
3. Into module paste code bellow - AddColumnMAcro.jpg
4. Run it
Also you can add reference to another property like reference to <mass>
Family.TableColumns.Add "HRUBAHMOTNOST", "HRUBAHMOTNOST", kStringType, , "=<mass>", "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}", "HrubaHmotnost"
Regards
Jan Priban
Dim iFamilyDone As Integer
Sub ListFamilies(CurrentNode As ContentTreeViewNode)
Dim Family As ContentFamily
For Each Family In CurrentNode.Families
Debug.Print Family.DisplayName
Family.TableColumns.Add "MyCol", "MyCol", kStringType, , "strAhoj", "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}", "iPropAhoj"
Family.Save
iFamilyDone = iFamilyDone + 1
Next
Dim checkNode As ContentTreeViewNode
For Each checkNode In CurrentNode.ChildNodes
Call ListFamilies(checkNode)
Next
End Sub
Sub AddCustomPropertyEverywhere()
iFamilyDone = 0
Call ListFamilies(ThisApplication.ContentCenter.TreeViewTopNode.ChildNodes("Structural Shapes"))
MsgBox "Families Updated: " & iFamilyDone
End Sub
