Does anyone know how I can update the physical properties for a part or assembly, from a drawing? My drawing template is showing the total weight for the current part/assembly, and I would love if Inventor could update this using iLogic, so I don't get the "N/A" value all the time.
Hi, I had the same problem, i created an external ilogic rule that accesses the part/assembly from the idw file and creates or updates a custom property called imass inside the part/assembly and set it to run/update each time an IDW is saved.
I then used a link to this parameter instead of the actual mass.
You could also change the setting under "Application Options" under the "General Tab" There is a panel called "Physical Properties" and a check box for "Update Physical Properties On Save", this might solve your problem. I didn't do this because i didnt want to have it update the mass properties everytime i save something especially for large assemblies.
Regards, Matt.
iMass i-Logic Code Below:
' Check if there are any views on the sheet
If ActiveSheet.Sheet.DrawingViews.Count = 0 Then
Exit Sub
End If
' Define Referenced Document
Dim oDoc As Document = ThisDrawing.ModelDocument
' Access Document Mass Properties
Dim oMassStr As String = Round(oDoc.ComponentDefinition.MassProperties.Mass,0)
' Create / Modify iMass Custom Property
Try
Call oDoc.PropertySets("Inventor User Defined Properties").Add(oMassStr, "iMass")
Catch ex As Exception
oDoc.PropertySets("Inventor User Defined Properties").Item("iMass").Value = oMassStr
Finally
' Save Assembly Document
oDoc.Save
' Update Drawing to reflect changes
InventorVb.DocumentUpdate()
End Try
Thank you very much for the reply. The only problem is that we've got thousands of parts and assemblies and they doesn't have that custom parameter. Maybe I just have to use the Application setting you mention.
The iLogic Code that I gave you adds the parameter into the assembly/part file if it doesn't exist automatically.
I used the code you gave me and removed the lines related to the iMass parameter. And it actually works! Now the mass is updating every time I save and before printing to PDF. Thank you!
SubMainUpdateMass()
IfActiveSheet.Sheet.DrawingViews.Count=0Then
Exit Sub
EndIf
DimoDocAsDocument=ThisDrawing.ModelDocument
DimoMassStrAsString=Round(oDoc.ComponentDefinition.MassProperties.Mass,0)
InventorVb.DocumentUpdate()
End Sub
I'm not exactly sure why that works, maybe referencing the mass properties forces it to update the mass?Any way, glad it works for you.
Regards, Matt.
Don't forget to mark the post as solved if your happy with the answer.
InventorVb.DocumentUpdate(iProperties.Mass)
so simple
@Anonymous wrote:Does anyone know how I can update the physical properties for a part or assembly, from a drawing? My drawing template is showing the total weight for the current part/assembly, and I would love if Inventor could update this using iLogic, so I don't get the "N/A" value all the time.
It can be done at least in Inventor 2014.
When you create a new part and extrude it for an example; click on Manage toolbar at top of Inventor window.
One of icons is Fx. Click on it and then you can update dimensions of that part.
Also one can add material for that part whereby mass properties will be updated based upon density of the material chosen for this part
Inertia and other related items are based upon the structural shape of your part therefore one may have to calculate said properties.
If one creates assemblies from created parts current assemblies should update based upon information one provides for an individual part.
Hope it helps.