API or macro to send bar forces to excel in certain order

API or macro to send bar forces to excel in certain order

me1205377
Advocate Advocate
2,939 Views
18 Replies
Message 1 of 19

API or macro to send bar forces to excel in certain order

me1205377
Advocate
Advocate

Greetings, if you could please write a small code to send bar forces to excel in this way i will be very grateful. it takes forever to manually read and type bar forces in excel in the following manner 

side note i am not sure if it is too much to ask as i dont know how hard/easy it is to create this macro or addin . i will be happy to pay for this if it takes time. 

API goal.PNG

 

moustafa elgaar
0 Likes
Accepted solutions (2)
2,940 Views
18 Replies
Replies (18)
Message 2 of 19

me1205377
Advocate
Advocate

I am using RSA2015  if it makes any difference 

moustafa elgaar
0 Likes
Message 3 of 19

Romanich
Mentor
Mentor

Hi Moustafa,

 

Have you seen this thread?

https://forums.autodesk.com/t5/Autodesk-Robot-Structural/getting-internal-forces-from-RSA-to-XL-API/...

Do you find the posts helpful? "LIKE" these posts!
Have your question been answered successfully? Click 'ACCEPT SOLUTION' button.

Roman Zhelezniak

Robot Evangelist & Passionate Civil Structural Engineer

LinkedIn | Robot & Хобот | App Store for Robot
EESignature


Message 4 of 19

me1205377
Advocate
Advocate

yes Mr. Romanich  i have checked it and it contain similar spread sheets to what i need, but not quite the same  the order  must e exactly as in the attached picture. this is because i have to send theses results to another program who can only read RC column forces in this order:

for each column , the program need ( Fx , MYt , MYb, MZb, MZb ) in a text file.

i hope you can help me 

moustafa elgaar
0 Likes
Message 5 of 19

me1205377
Advocate
Advocate

 (Fx , MYt , MYb, MZy, MZb )  

 

 

this is the big picture 

i start with robot , i get these forces in this particular  order into excel, then i change these cells to text format using "concatenate" function then  copy and paste in a text file and finally export to a program such as SP Column 

importing.JPG

moustafa elgaar
0 Likes
Message 6 of 19

marcinrakus
Autodesk
Autodesk

Hi,

 

This is something You can start working with (see attachment). It is quite inefficient and I'm not sure about coordinate system in which the other application requires the data. This dumps all in local coordinate system of bar as is in RSA.

 

We can iterate this solution if needed.

 

Regards,

Marcin

Message 7 of 19

me1205377
Advocate
Advocate

thank you very much for your help  it looks very promising 

just few adjustment if it is not too much to ask  🙂 

 

what ever  selection of bars i make in robot  say 5 bars , regardless of the  bar numbers being selected say ( 224,158,987,1526,3) . only bars with the numbering from 1 to 5 are sent to excel instead.

 

case number are also ignored , regardless of what set of cases i select from robot  only simple cases are sent not combinations  

 

finally, the units, it would be great if forces are in (KN)  and Moment in (KN.M)

 

moustafa elgaar
0 Likes
Message 8 of 19

marcinrakus
Autodesk
Autodesk
Accepted solution

Hi,

 

Selection of bars - corrected.

Units changed to kN - corrected.

Selection of cases - this works different by API, so I added a field in excel (the green one), where You can enter Your selection. If it is empty by default full selection of simple cases, combinations and ponderations is taken into consideration.

 

Regards,

Marcin

Message 9 of 19

me1205377
Advocate
Advocate

i accept it as a solution , just if you have some spare time, could you limit the decimal places to 3 numbers only  eg: "  2420.321 KN"  instead of "2420.32014568 KN" 

moustafa elgaar
0 Likes
Message 10 of 19

marcinrakus
Autodesk
Autodesk
Accepted solution

Rounded.

 

Regards,

Marcin

Message 11 of 19

me1205377
Advocate
Advocate

thank you sir ,wish you some good karma 

moustafa elgaar
0 Likes
Message 12 of 19

isabel.bras
Contributor
Contributor

It is possible to have the forces in a point in the middle of the bar?

0 Likes
Message 13 of 19

marcinrakus
Autodesk
Autodesk

Hello,

 

In the macro You can see for example lines:

val1 = RobApp.Project.Structure.Results.bars.Forces.Value(bar.Number, casNumber, 0).FX / 1000
val2 = RobApp.Project.Structure.Results.bars.Forces.Value(bar.Number, casNumber, 1).FX / 1000

in which 0 means begin and 1 means end of a member. If You put 0.5 You will obtain results for middle point:

val3 = RobApp.Project.Structure.Results.bars.Forces.Value(bar.Number, casNumber, 0.5).FX / 1000

 

Regards,

Marcin

0 Likes
Message 14 of 19

isabel.bras
Contributor
Contributor

When I try do run the macro, it appears an errorerro.png.

When I go to Debug it appears: erro2.png

 

Do you know what is happening?

0 Likes
Message 15 of 19

Stephane.kapetanovic
Mentor
Mentor

This code works ! Are you sure Robot and a model is open ? 

Have you check references to Robot Object Model in visual basic editor (<tools> <references>) ?  

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
Message 16 of 19

isabel.bras
Contributor
Contributor

Hello

 

Can you explain how can I check the references?

 

Thanks

0 Likes
Message 17 of 19

Stephane.kapetanovic
Mentor
Mentor

In your spreadsheet, press Alt+F11 to go to visual basic editor

Go to <Tools> and <Références> and then find Robot Object Model ver. xxx

image.pngimage.png

 

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
Message 18 of 19

isabel.bras
Contributor
Contributor

yes, I'm using the correct version...

0 Likes
Message 19 of 19

isabel.bras
Contributor
Contributor

I reinstall Robot and solved the problem.

 

Thanks

0 Likes