在Inventor中物理特性在零部件创建完成后,属性不更新,那么需要使用MassProperty的API来实现。
![](https://img-blog.csdnimg.cn/20210319163118484.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L3FxXzM5MzAwMDQx,size_16,color_FFFFFF,t_70)
代码如下:
Sub updateMassProperties()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
'后台调用MassProperty
Debug.print(oDoc.ComponentDefinition.MassProperties)
End Sub
或者
Sub updateMassProperties()
Dim oDoc As PartDocument
Set oDoc = ThisApplication.ActiveDocument
Dim oMP As MassProperties
Set oMP = oDoc.ComponentDefinition.MassProperties
End Sub
解释说明:只要属性MassProperties被调用,那么就会自动更新。