Robot Structural Analysis Forum
Welcome to Autodesk’s Robot Structural Analysis Forums. Share your knowledge, ask questions, and explore popular Robot Structural Analysis topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Rounding up coordinates (API)

46 REPLIES 46
Reply
Message 1 of 47
Rafal.Gaweda
7718 Views, 46 Replies

Rounding up coordinates (API)

I am attaching small addin (private, not ADSK) for rounding up coordinates in Robot

You can add it to add-ins menu:

- as dll (the fastest method of getting results from robot) basing on dll_1.zip from this thread starting from point 13

http://forums.autodesk.com/t5/Autodesk-Robot-Structural/Creating-DLL-for-API-and-making-it-available...

- as exe

or by running exe

 

It seems to work OK.

 

 



Rafal Gaweda
46 REPLIES 46
Message 21 of 47

Okay, I will make it. Also I will try to make installer with selecting language.

Message 22 of 47

Unfortunately I don't see any localization resources in project inside RoundUpDown_2lang.zip

I can make it myself but it's will be more simply with ready resource.

Message 23 of 47

My mistake.

Correct project attached.



Rafal Gaweda
Message 24 of 47

That okay.

Message 25 of 47

I made it, check please

 

Message 26 of 47
mgaafar
in reply to: Rafal.Gaweda

Rafal, I found small bug, it seems there is rounding error or defining data. in my case the numbers were ok but the new rounded numbers contained extra decimal.

Tags (1)
Message 27 of 47
Rafal.Gaweda
in reply to: mgaafar

Try this one.

If still not correct please send me at least part of this model with these nodes.



Rafal Gaweda
Message 28 of 47
mgaafar
in reply to: Rafal.Gaweda

Thanks Rafal, the bug is fixed and it is working fine now.

Message 29 of 47
mgaafar
in reply to: mgaafar

Sorry Rafal, I found something else that is not consistant. 

Roundup2.jpg: Y-coordinate at last point was rounded up but the other ordinates changed from 10.210000 to 10.22 while the tolerance is only 0.01?

http://www.screencast.com/t/2Fe2nxr1M5L

Please review, also may be it will be more useful if "Other objects" deal with rounding structural axis coordinates as well.

thank you very much for your help.

Message 30 of 47
Rafal.Gaweda
in reply to: mgaafar


Y-coordinate at last point was rounded up but the other ordinates changed from 10.210000 to 10.22 while the tolerance is only 0.01?

 

INteresting.

Please send me such robot file.

 



Rafal Gaweda
Message 31 of 47
mgaafar
in reply to: Rafal.Gaweda

here you are

Message 32 of 47
mgaafar
in reply to: mgaafar

Maybe this link can help figuring out the approximation error.

http://www.theregister.co.uk/2006/08/12/floating_point_approximation/

 

Message 33 of 47
Rafal.Gaweda
in reply to: mgaafar

More less this wqas the problem

According to our processors 10.21*100000 = 1021000,00000001

 

Correction in attachment



Rafal Gaweda
Message 34 of 47
t.sautierr
in reply to: Rafal.Gaweda

Can you post the .exe file please ..;

Thanks a lot.

I am not familiar with  Csharp express etc ..

 

 

Message 35 of 47
Rafal.Gaweda
in reply to: t.sautierr

It was wrong attachement.

Check again attachment in previous message.

 

You are fast 🙂 It took me one minute to replace attachment and in the mean time you downloaded it.



Rafal Gaweda
Message 36 of 47

This add-in is awesome! 

Saves a lot of time with sloppy users 😉

If this solved your issue, please Accept it as Solution help other forum users with similar issues to find answers easily.
  
Mirko Jurcevic


My blog: www.engipedia.com
Try my Revit add-ins: Autodesk App Store
Message 37 of 47

I wanted to round to 0,05m so I had to make some changes to your code (to ToDec function), if you don't mind.

 

Maybe you're interested:

private double ToDec(double numberToTruncate)
{
double roundingVal = 1;
int numOfDecimals = 0;

	if (TolcomboBox.SelectedItem != null) {
		string text = TolcomboBox.SelectedItem.ToString();
		if (text.Length > 1) numOfDecimals = text.Length - 2;
		roundingVal = Convert.ToDouble(text);			
	}
						
        numberToTruncate = Math.Round(numberToTruncate, 9);

	double power = Math.Pow(10.0, (double)numOfDecimals);

        if (radioButton1.Checked)
        {
	return Math.Round(Math.Floor(numberToTruncate / roundingVal) * power, 0) * roundingVal / power;
        }
        else
        {
	return Math.Round(Math.Ceiling(numberToTruncate / roundingVal) * power, 0) * roundingVal / power;
        }
}

Function now can be used to round to any decimal value, for example: 0,25  😉

 

Cheers!

If this solved your issue, please Accept it as Solution help other forum users with similar issues to find answers easily.
  
Mirko Jurcevic


My blog: www.engipedia.com
Try my Revit add-ins: Autodesk App Store
Message 38 of 47
janis_mr
in reply to: Mirko.Jurcevic

Hi Mirko,

Do you have an exe file for your modified version of this code?

Would be greate to have it..

 

Thanks

Regards

Janis

Message 39 of 47
Mirko.Jurcevic
in reply to: janis_mr

Of course

Here, just change the extension to exe and add it to robot

 

Right click on the link and "save link as"

If this solved your issue, please Accept it as Solution help other forum users with similar issues to find answers easily.
  
Mirko Jurcevic


My blog: www.engipedia.com
Try my Revit add-ins: Autodesk App Store
Message 40 of 47
janis_mr
in reply to: Mirko.Jurcevic

Thats great. Thanks a lot!

 

Regards

Janis

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report