Update iProperty Physical properties

By Augusto Goncalves

After set a material to the component definition of a document using API, the Physical properties under iProperty window is not updated, unless the user click on Update button. Also, the API call to PartDocument.Update do not update the value either.

The simplest way is access one of the physical properties, which will force the whole API MassProperties to update. The following sample code demonstrate it.

‘ access the document and

‘ component definition

Dim partDoc As PartDocument

partDoc = m_inventorApplication.ActiveDocument

 

‘ the material name

Dim materialName As String = "Material Name"

 

‘ define and access the material

partDoc.Materials.Add(materialName, 6.45)

Dim materialDef As Material = _

  partDoc.Materials(materialName)

partDoc.ComponentDefinition.Material = materialDef

 

‘ access the property will force an update

Dim mass As Double = partDoc. _

  ComponentDefinition.MassProperties.Mass


Comments

2 responses to “Update iProperty Physical properties”

  1. Hi it is working fine in Inventor Part document.But it is not working in inventor Assembly document.I already updated the iproperties of the part documents in the assembly but finally the assembly document didn’t updated.any idea?

  2. Hi, the AssemblyDocument Object also have a Property ComponentDefinition, so this applies for AssemblyDocs too. (tested on Inventor 2014)
    BR,
    Daniel

Leave a Reply

Discover more from Autodesk Developer Blog

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

Continue reading