Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
Cadkunde.nl
in reply to: FeelGoodGirl

Dim ModelDef As Inventor.ComponentDefinition = Nothing
Dim oDoc As DrawingDocument = oApp.ActiveDocument
Dim ModelDoc As Document = Nothing
Try
ModelDoc = oDoc.ReferencedDocuments.Item(1)
Catch
End Try
If ModelDoc IsNot Nothing Then
If ModelDoc.DocumentType = DocumentTypeEnum.kAssemblyDocumentObject Then
ModelDef = CType(ModelDoc, Inventor.AssemblyDocument).ComponentDefinition
ElseIf ModelDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
ModelDef = CType(ModelDoc, Inventor.PartDocument).ComponentDefinition
End If
End If

 

If ModelDoc IsNot Nothing Then
ModelDoc.Update()
Dim strMass As Double = ModelDef.MassProperties.Mass
oDoc.Update()
End If