josue Corona Posted June 15, 2022 Share Posted June 15, 2022 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 Quote Link to comment
MullinRJ Posted June 15, 2022 Share Posted June 15, 2022 (edited) 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 June 15, 2022 by MullinRJ 1 Quote Link to comment
Pat Stanford Posted June 16, 2022 Share Posted June 16, 2022 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. 1 Quote Link to comment
bcd Posted November 27, 2022 Share Posted November 27, 2022 @Pat Stanford did you ever manage to get Material Density into a worksheet? Quote Link to comment
Pat Stanford Posted November 27, 2022 Share Posted November 27, 2022 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. HTH 1 Quote Link to comment
Pat Stanford Posted November 27, 2022 Share Posted November 27, 2022 The above was done in VW2023. I did not go back and test in VW2022. Quote Link to comment
Tom W. Posted November 27, 2022 Share Posted November 27, 2022 28 minutes ago, Pat Stanford said: It looks like you have to get the MaterialDensity by the Material Name. What about =MATERIALPROPERTY('materialdensity') Quote Link to comment
Pat Stanford Posted November 27, 2022 Share Posted November 27, 2022 That will only work if you have a Database of Materials or if you use a criteria that returns a single material in a spreadsheet cell. 😞 That was what I looked at first. 1 Quote Link to comment
Tom W. Posted November 27, 2022 Share Posted November 27, 2022 Ok gotcha. So you mean that in a Criteria Report you need to do it the way you showed in your screenshot but in a database report you can do it with =MATERIALPROPERTY('materialdensity')? Your screenshot was a database Quote Link to comment
Pat Stanford Posted November 27, 2022 Share Posted November 27, 2022 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. 😉 3 Quote Link to comment
bcd Posted November 27, 2022 Share Posted November 27, 2022 Thanks Pat, That's it! - I owe you a 🍺 Quote Link to comment
Tom W. Posted November 27, 2022 Share Posted November 27, 2022 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. Quote Link to comment
Recommended Posts
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.