Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.
First time visiting? Here are some places to start:- Looking for a certain topic? Check out the categories filter or use Search (upper right).
- Need support? Ask a question to our Community Support category.
- Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
- Be respectful, on topic and if you see a problem, Flag it.
If you would like to contact our Community Manager personally, feel free to send a private message or an email.
Answers
Thank you all for your help, I will use the following workflow:
1) Use: V4.7+ of https://cad.onshape.com/documents/2ce3e64026df1ac7e63b98bd/w/7a2029e15b241c80c591a492/e/466a1aa41fce0c0be07f6436
2) Calculate Smallest on flat pattern
3) Create a secondary sketch and "Use" the result of featurescript
4) Insert into drawings
5) Win
It doesn't calculate the exact smallest (as that would take a long time). Instead, it calculates it to the nearest degree.
IR for AS/NZS 1100
But before auto calculate, the FS wasn't even close
Now it's as close as I was without all the effort from me every time
So how would I get a part's weight in pounds in FS.. all I can see is volume (which is fine) but can't find where I can read a part's density.
or can I read the part weight directly from somewhere?
I tried a few guesses like
density = definition.body.material.density;
but obviously I don't know the structure of a part to dig out that info.
can you give me the correct snippet of the code I attempted just now?
<a href="https://cad.onshape.com/FsDoc/library.html#module-properties.fs">PropertyType</a>
). They can be set in FeatureScript, but not read.So, you can create a CSV reference parameter to read the material information ;-)
Eduardo Magdalena C2i Change 2 improve ☑ ¿Por qué no organizamos una reunión online?
Partner de PTC - Onshape Averigua a quién conocemos en común
Guess I'll have to look into doing that for the first time too
thanks for that hint @emagdalenaC2i
Thought we had that sussed, especially as there is a "copy properties" FS on @mbartlett21 's site, clicky, but alas it's cleverly creating a copy of the body and using some boolean functions to transfer the properties "blind" as it were rather than using a get / set transfer.
So close!
Owen S.
HWM-Water Ltd
You can use this featurescript to set the material and the density or the weight and it can fill a custom property
https://cad.onshape.com/documents/3ca261a95938af152088fca8
IR for AS/NZS 1100
but that looks more like an override mass properties, which is useful for purchased parts.
but I'm looking for something that will read the result of this:
and put it here:
The reason Part Properties (like material) are not readable in FeatureScript is to ensure that changing these properties would not trigger a regeneration. Changes to properties are very common and can happen from outside the document. Generally people don't think of them as costly geometric operations, so it would be surprising if changing the name, part number, material, etc. triggered a lot of slow features to rerun.
The case you describe can be done with a custom feature where the user inputs the density, which is clearly not ideal. It can also be done with the API, which I imagine is also not ideal, since the code calling the API would require a separate server (which you run) to trigger these changes.
Do you want weight as a part property so that it can be displayed in the BOM? If so, I agree that would be great. If we were to implement this, it's possible we wouldn't implement it as a pure part property. We may want a separate concept on our side which lazily computes the mass for all assembly parts when requested, cached for better performance. The other advantage of this is that it would work on any part, not just parts with your special custom feature.
Long story short, custom property setting lets you get lots of things (including bounding dimensions) in the BOM as custom properties, but I don't consider https://forum.onshape.com/discussion/comment/44845 (adding part weight to the BOM) to be fully resolved by the custom property setting. Please continue voting for and commenting on that improvement request.