Jump to content
Developer Wiki and Function Reference Links ×

Vectorworks 2022


Recommended Posts

Is there a way to create a script that can calculate weight according to what i input to it. For example lets say I will make a 1 1/4" x 1 1/4" square and extrude it 5' now that just a stick that represent an actual 5' aluminum stick and calculating the weight of it is .6548 Lb/ft  X 5' =3.3LB. I would like the object info pallet to give that info. if possible every time a stretch the stick to make it longer it would automatically change it.If there a direction someone can point me out so can try to do the script on my own , It will be greatly appreciated.

Thank you

Link to comment

You could attach a record with an object's density, and/or, its weight per unit_length. You cannot post the calculation in the OIP without creating a PIO to manage all attributes of volume & density, or length & wt/length, but you can easily (relatively speaking) get those values to display in a Worksheet.

 

A PIO would be a more elegant solution, and the values could easily display in the OIP, but the amount of programming is many times more complicated.

 

Raymond

Edited by MullinRJ
  • Like 1
Link to comment

Applying a Material should allow you to get the Density specified for that Material in a worksheet and then do the calculation there. But it won't show in the OIP.  And I am having a hard time getting the Density of the material into the worksheet. The way it is supposed to be working is not.

 

The nice thing about using a Material and Density, is that when to go to hollow stock instead of bar stock the weight calculation stays the same and you don't have to update the weight/length for each object.

  • Like 1
Link to comment
  • 5 months later...

It looks like you have to get the MaterialDensity by the Material Name.  

 

So in Column C I get the Material Name for the object and then use that in column D to get the proper of that material.

 

The formulas in row 3 are the same as the ones in Row 4 except they have a space in front of them so they will show in the screenshot.

 

image.png.bf24808f9693209661fb7f547272bbde.png

 

HTH

  • Like 1
Link to comment

If your database returns a list of Material Resources, then =MaterialProperty will get what you need.

 

If your database returns a list of objects that happen to have Materials assigned to them, then it will not and you will have to use the MaterialPropertyByName version.

 

If you don't want to display the material name you could either set the width of that column to zero or combine the Column D and C formulas into a single cell.

 

=MaterialPropery only works on Material Resources, not objects that use Materials. Trust me on this. I have spent hours chasing this. 😉

 

  • Like 3
Link to comment
21 minutes ago, Pat Stanford said:

If your database returns a list of Material Resources, then =MaterialProperty will get what you need.

 

If your database returns a list of objects that happen to have Materials assigned to them, then it will not and you will have to use the MaterialPropertyByName version.

 

If you don't want to display the material name you could either set the width of that column to zero or combine the Column D and C formulas into a single cell.

 

=MaterialPropery only works on Material Resources, not objects that use Materials. Trust me on this. I have spent hours chasing this. 😉

 

 

Very helpful thank you I understand now.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...