Hey
i have this working ok now but wondered if there was an easier way to add the iproperty values into the Style override?
Here is my current code
oView.Position = objPoint2D
objPoint2D = Nothing
oView.ShowLabel = True
oView.Label.HorizontalJustification = HorizontalTextAlignmentEnum.kAlignTextLeft
oView.Label.FormattedText = "<StyleOverride " &
"Font='Arial' " &
"FontSize='1' " &
"Bold='True'>" &
"Job No. = " & txtJobNo.Text &
"<Br/>Part No. = " & sPN &
"<Br/>Description = " & sName &
"<Br/>Qty = " & sQty &
"<Br/>BOM Item = " & sItem &
"<Br/>Material = " & sMat &
"</StyleOverride>"
as you can see, the values for Part No, Description, Qty, BOM Item & Material are entered into the formatted text as hard text collected from a part in a loop which is OK but if anything changes, i need to run the code again. It would be so much better if it could read the properties
I found this in the help file
The example below will display the string associated with the description property of the design tracking properties associated with the document containing the model referenced by the first view on the sheet. The backslash at the end of the tag definition denotes that the opening and closing tags have been combined. This is useful in this case since a property tag does not require any additional information besides what’s provided by the attributes.
<Property Document="model" FormatID="{32853F0F-3444-11d1-9E93-0060B03C1CA6}" PropertyID="29" />
I did find a list of Property ID's here https://forums.autodesk.com/t5/inventor-customization/get-set-iproperty-directly-with-id-enum/td-p/5...
im going to try this
oView.Label.FormattedText =
"<StyleOverride Font='Arial' FontSize='1' Bold='True'>" &
"Job No. = " & txtJobNo.Text &
"<Br/>Part No. = <Property Document="model" FormatID="{32853F0F-3444-11d1-9E93-0060B03C1CA6}" PropertyID="5" />" &
"<Br/>Description = <Property Document="model" FormatID="{32853F0F-3444-11d1-9E93-0060B03C1CA6}" PropertyID="29" />" &
"<Br/>Qty = " & sQty &
"<Br/>BOM Item = " & sItem &
"<Br/>Material = <Property Document="model" FormatID="{32853F0F-3444-11d1-9E93-0060B03C1CA6}" PropertyID="20" />" &
"</StyleOverride>"
Any pointers?
Nacho
Automation & Design Engineer
Inventor automation Programmer (C#, VB.Net / iLogic)
Furniture, Sheet Metal, Structural, Metal fab, Tradeshow, Fabrication, CNC

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.