Iproperty acces with c#

Iproperty acces with c#

navbor
Enthusiast Enthusiast
1,919 Views
1 Reply
Message 1 of 2

Iproperty acces with c#

navbor
Enthusiast
Enthusiast

Hello All

I am trying to write a small standalone app in C# that I can run when I have an assembly document open.

I want the app to iterate through all the parts in the assembly and set the iproperties. I am having some trouble accessing the iproperties however.

I want (for example) to set the "TITLE" in the "DOCUMENT SUMMARY INFORMATION" to be a concatenation of the part number and the description separated by a " - ".

Can anyone give me some pointers on how to access these properties please.

Thanks in advance

Rob

Regards
Rob
-------------------------------------------
Windows 7 Pro (X64)
Intel(R) core (TM) i5-4690 CPU @ 3.50GHz
32.0 GB RAM
Nvidia Quadro K2000
Autodesk Inventor 2015 Professional Ultimate Design Suite
0 Likes
1,920 Views
1 Reply
Reply (1)
Message 2 of 2

xiaodong_liang
Autodesk Support
Autodesk Support

Hi,

 

The [Title] is stored in [Summary Information], instead of [Summary Information].

 // code snippet
AssemblyDocument odoc = m_inventorApp.ActiveDocument as AssemblyDocument ;
AssemblyComponentDefinition asmDef = odoc.ComponentDefinition;

foreach (ComponentOccurrence oOcc in asmDef.Occurrences)
{
    Document oDoc = (Document)oOcc.Definition.Document;
    // using GUID to find the "Summary Information"
    PropertySet oPS = oDoc.PropertySets["{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"];
    // using proID to find TITLE
    Inventor.Property oP = oPS.ItemByPropId[(int)PropertiesForSummaryInformationEnum.kTitleSummaryInformation];
    oP.Value = oP.Value + "new";
}

 

0 Likes