Welcome to the Onshape forum! Ask questions and join in the discussions about everything Onshape.

First time visiting? Here are some places to start:
  1. Looking for a certain topic? Check out the categories filter or use Search (upper right).
  2. Need support? Ask a question to our Community Support category.
  3. Please submit support tickets for bugs but you can request improvements in the Product Feedback category.
  4. 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.

Decimal Places in BOM for Custom Properties

jacques_spillmannjacques_spillmann OS Professional Posts: 68 PRO

Is there a way to make this better?

Possible to round off to 2 decimal places? These are custom properties defined as double (I do need a number for agregation so I can see the total cost of an assembly for example)

Answers

  • jacques_spillmannjacques_spillmann OS Professional Posts: 68 PRO

    it seems it might be an issue with the rounding function that maybe does not round properly?

    Example here, first line seems ok but second line not:

    Here is the function I'm using to calculate that parameter:

    round(#cabinet_vol/(1e6 mm^3)-#LF_Displaced_Volume-#WA_Displaced_Volume-#HF_Displaced_Volume,0.1)

  • jacques_spillmannjacques_spillmann OS Professional Posts: 68 PRO

    ok! I think I figured it out, I used RoundToPrecision instead of round…

    But now I'm strugling with how to use RoundToPrecision in featurescript, it doesn't seem to work when I do this:

    const weight = roundToPrecision(volume * definition.density, 2);

    throws this error:

Sign In or Register to comment.