I am having problems keeping the correct mass of the model updated in its drawing. There are three ways of which I have tried to update the mass on the drawing but all have issues:-
1: When the model has finished updating using ilogic the last rule then takes the Iproperties Mass and writes it to a parameter. Using ilogic the drawing then automatically opens and updates one of the rules in the drawing to write the mass from the model parameter to the drawing custom iproperties and updates text in the title block that represents mass.
Issue with this method: If the user manually adds a part to the assembly then the parameter is not updated with the new mass.
I have also tried an event trigger to fire the “Read Mass Rule” when an iproperty Change however the Mass seems to be not regarded as an iproperty change.
2: Directly bring in the Physical Properties – Mass in the Format text box within the drawing so it is directly linked.
Issues with this method:
3: Using the code below I can force the model iproperties mass to be read from the model directly to a custom iproperty in the drawing. The mass is updated using an event trigger when the drawing is opened.
doc = ThisDoc.Document
customPropertySet = doc.PropertySets.Item("Inventor User Defined Properties")
modeldocname = IO.Path.GetFileName(ThisDoc.ModelDocument.FullFileName)
mass = iProperties.Mass(modeldocname)
iProperties.Value("Custom", "Mass From Assembly") = Round(mass) & " kg"
Issue with this method: If the drawing is open and the user then opens and adds a part to the model but keeps the drawing open there is no trigger for the mass in the drawing to update.
In my mind method 2 is the way to go but there are so many drawing being printed off that states “N/A” for the mass that another method is needed.
Anyone any clues?
It’s a little more complicated than this but I have found an instance where I get the problem 100% of the time as explained below:-
Basically I have 1 sub-assembly in my top assembly. Some of the sub-assembly parts have been supressed with an ilogic rule. Because some parts are suppressed then the sub-assembly and the top assembly each have a new level of detail which is what is used to work on. Now if I set the prompt “Do you wish to calculate the mass properties for the Master Level of Detail” is set to “No” then that’s when I start having problems. And first placement of the top assembly in a new drawing the mass will say "N/A" when I try to bring it through. By toggling the prompt “Do you wish to calculate the mass properties for the Master Level of Detail” to "yes" then back to "No" the mass is then read on the drawing.
Now the interesting part is if I then go back to the model and drag in a copy of the sub-assembly to the top assembly and then go back to the drawing the mass states "N/A" however if instead of dragging in the sub-assembly but rather a un-suppressed part only within the sub-assembly then the mass in the drawing updates as it should.
Just to note: With “Do you wish to calculate the mass properties for the Master Level of Detail” is set to “No” then Update Mass button in the Manage tab cannot be ghosted out if pressed. However if I go through Iproperties and update the mass then that works fine. Also at any point when the Update Mass button can't be pressed and the mass in the drawing states "N/A" I can read an updated mass with a message box in an ilogic rule. That is why I have previously used ilogic to bring through the mass to the drawing as it works 100% of the time but the only problem is it needs to be triggered by a user or an event which may not happen.
So why do I not have the prompt “Do you wish to calculate the mass properties for the Master Level of Detail” set to "Yes"? Well my models work as a template. The basic structure of the model is configured using Ilogic and parts are suppressed with ilogic automatically giving the suppressed parts a "reference" BOM structure and so their mass is not counted even in the Master level of detail. However, designers are permitted to add their own custom parts and can suppress or unsuppress them at free choice and if they do suppress them then they are not changing the parts BOM structure to "reference" so their suppressed parts mass would be included in the Master LOD giving an incorrect mass in the drawing.
Access a broad range of knowledge to help get the most out of your products and services.