Archicad C++ API
About Archicad add-on development using the C++ API.
SOLVED!

Is there a way to limit decimal or round off values coming from API?

cad developer
Contributor

Hi,

 

As the subject suggests there is a need to limit the decimal of the property values that is coming from an API. 

The decimal limited value should be rounded off to the specified decimal. 

 

For example the property 'volume' of 'API_RailingBalusterQuantity' is giving a value of 7.1108929735418900e-05 or 0.0000711089297354189, but we would like that value to be rounded off to 4 decimal places. 

 

The value should be '0.0001'. 

 

Please help me on this. 

 

Thanks & Regards

1 ACCEPTED SOLUTION

Accepted Solutions
Solution
Miha Nahtigal
Advocate

I dont exactly understand the question.

 

The result of API_RailingBalusterQuantity() gets stored to local variable. After that you can round it as you desire using c/c++ functions/routines like round().

BIMquants.comBETA - Quantities and Costs Estimation in Archicad - BETA testers needed.

View solution in original post

1 REPLY 1
Solution
Miha Nahtigal
Advocate

I dont exactly understand the question.

 

The result of API_RailingBalusterQuantity() gets stored to local variable. After that you can round it as you desire using c/c++ functions/routines like round().

BIMquants.comBETA - Quantities and Costs Estimation in Archicad - BETA testers needed.