Mass property from a drawing macros

I have put a couple more macros on the KCSWUG website and here is a link to each.
www.kcswug.com/programs/macros/MassOfSelectedViewCopyToClipboard.swp
www.kcswug.com/programs/macros/MassOfSelectedView.swp
They both perform a function that I think should be standard, and that is to retrieve the mass value of the model in a drawing view. The current method is usually RMB on a drawing view to open the model, go to the correct configuration, ask for the mass properties, write down or remember the value, close that box, go back to the drawing, double-click a note (in our case in a block) in the drawing, highlight the value portion, and type in the number - if you remember it.
Now it's a bit simpler. Select the proper drawing view. (If you don't, it will tell you to pick a view first.) Then run the macro. For simplicity, I have assigned mine to <SHIFT>W hotkey as we haven't already used it for anything, and "W" can stand for "Weight." (Slick, eh?) Or, you can assign it to a button on the macro toolbar.
Either way, run the macro. The program looks at the referenced model in the selected view, opens the proper configuration, and gets the mass properties. It will then put a box up on your screen that gives you 3 choices to copy to the clipboard - the English value (default), the Metric value, or the mass property string.
Be careful with using the property string because the metric/English units and the display precision are controlled by the referenced model, not the drawing. This can lead to lots of decimal places being displayed in the drawing note where we typically only use one place. It can also display an incorrectly interpreted value if the part/assy display property is set to metric and the drawing is English. There may be a way around this, however, and I will continue to work on it as I get time. I think it's worth pursuing as then the weight value displayed in the drawing would update as the model changed.
Now the second macro. On our drawings, we have a block (called PTL) that contains a note with the weight value in it, and this macro will put the selected mass value in the selected block.
You can select any number of objects (notes, faces, views, blocks, etc.) in any order. But when you run the macro, if you haven't selected at least one drawing view, it will tell you that you need to have a drawing view selected. It goes through all the objects that you have selected and finds the first drawing view in your selection order. It goes to that model and that configuration, gets the mass value, and comes back with the values in a form. If, during your selection process, you also grabbed a PTL note (or any other note with a tag name of "Weight") then the program will find the first selected one and insert your chosen value into it. That simple. Free for the downloading.
As always, comments are welcome.
WT
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

I'm sorry for not understanding, but you can do this already with a config specific property. What am I missing?
Mike Wilson
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload
The macro automates the process of retrieving the mass of the specific config in the drawing view. It presents you with the choice of the property, the English value, or the metric value, and copies the selected one to the clipboard. To get a better idea of what it does, open a drawing, click on a view and run the macro.
Also, as I mentioned in the message, the property is somewhat limited in its usage in that the display properties of it are controlled by the referenced model, not the drawing in which it is displayed.
WT

Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

I just add mass to the model templates..and create a link into the drawing templates..
--
regards
Markku
  Click to see the full signature.
Add pictures here
<% if( /^image/.test(type) ){ %>
<% } %>
<%-name%>
Add image file
Upload

Polytechforum.com is a website by engineers for engineers. It is not affiliated with any of manufacturers or vendors discussed here. All logos and trade names are the property of their respective owners.