(API) macro for updating panel contour loads from Excel

(API) macro for updating panel contour loads from Excel

Rafal.Gaweda
Autodesk Support Autodesk Support
6,698 Views
26 Replies
Message 1 of 27

(API) macro for updating panel contour loads from Excel

Rafal.Gaweda
Autodesk Support
Autodesk Support

First import contour loads (automatically for all simple cases)

Then you can change values in Px1..Pz3 columns, and X Y Z columns and run Update

 

Do not make any change in Case, Record, Object List or Number of contour points columns (or modify macro by your own to consider these or other changes you want)

 

 



Rafal Gaweda
Accepted solutions (1)
6,699 Views
26 Replies
Replies (26)
Message 2 of 27

Rafacascudo
Mentor
Mentor

Rafal ,

 

great tool !

It would be nice if the units used in the model could be kept when you press " Get contour loads".

I´m using tf/m2 and the loads are imported in N/m2

Rafael Medeiros
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature

0 Likes
Message 3 of 27

Rafal.Gaweda
Autodesk Support
Autodesk Support

Who volunteers to do so?

 

 

Example code for geting units (for force and moment) from Robot:

 

Dim projPref As RobotProjectPreferences
Set projPref = Robot.Project.Preferences

Dim RU As RobotUnitData
Set RU = projPref.Units.Get(I_UT_FORCE)


Dim RUCD As RobotUnitComplexData
Set RUCD = projPref.Units.Get(I_UT_MOMENT)

 

 



Rafal Gaweda
0 Likes
Message 4 of 27

Rafal.Gaweda
Autodesk Support
Autodesk Support
Accepted solution

Keeping model units - attached.



Rafal Gaweda
Message 5 of 27

Anonymous
Not applicable

when you input a load manually in excel and then update it gives you a runtime error.
i have a building whose contour loads are the same for several typical stories and till now there's no practical method of aplying these loads wihtout it being tedious.

i tried inputing the loads manually in excel and then clicking "update loads" but it just wouldn't work.

any help would be much appreciated.

0 Likes
Message 6 of 27

Rafal.Gaweda
Autodesk Support
Autodesk Support

Check \ set \ register Robot this way:

 

http://forums.autodesk.com/t5/robot-structural-analysis/vba-excel-macro-for-any-object-geometry-modi...

 

 

 

 



Rafal Gaweda
Message 7 of 27

StefanoPasquini6790
Advisor
Advisor

Good morning,

 

very "smart" and speedy API.

 

Thanks

 

 


PasProStudio

www.pasquiniprogetti.eu

Structural + Detailing engineers
0 Likes
Message 8 of 27

Anonymous
Not applicable

I've tried this way but this add-in could not run. When I chose contour and pressed " Get contour loads", nothing happened!!! (My model have a contour with area load).

Another add-in by VBA run normally.

0 Likes
Message 9 of 27

Rafal.Gaweda
Autodesk Support
Autodesk Support

It should be like that

 

cu.jpg

 

 



Rafal Gaweda
Message 10 of 27

Romanich
Mentor
Mentor

Hi @Rafal.Gaweda,

 

Could you please confirm that the method which operates with the marked checkbox is not implemented in the API?

Auto.png

Or maybe I'm wrong (fingers crossed)?

 

 

Updated:

 

Robot is really cool - I_ICRV_AUTO_DETECT_OBJECTS

 

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


0 Likes
Message 11 of 27

Romanich
Mentor
Mentor

Updated macro attached. One column has been added (0 - checkbox is off, 1 - checkbox is on).

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 12 of 27

Anonymous
Not applicable

Hello

I would like to create a load in C #.
I do not understand how to create the contour of this one?

I'm deadlocked ...

 

Thanks

 

JM Stevenant

 

 

My code:

image.png

0 Likes
Message 13 of 27

Rafal.Gaweda
Autodesk Support
Autodesk Support

Hi @Anonymous

 

Just edit my macro to see what is missing.

 

LoadRecord.SetContourPoint .........


Rafal Gaweda
0 Likes
Message 14 of 27

Anonymous
Not applicable

Thank you for your prompt reply.

However, I have already tried and it's bug:
Severity Code Description Project File Line Deletion Status
Error CS1061 'RobotLoadRecord' does not contain a definition for 'SetContourPoint' and
no 'SetContourPoint' extension method that accepts a first argument of type 'RobotLoadRecord'
was found (using directive or assembly reference) missing?)

 

 

Thank you for your help.

image.pngimage.png

0 Likes
Message 15 of 27

Rafal.Gaweda
Autodesk Support
Autodesk Support

Hi @Anonymous

 

My guess it that your LoadRecord is of not correct type.

 

You need something like this:

 

RobotLoadRecordInContour LoadRecord= (RobotLoadRecordInContour)case.Records.Get(UniformInCountour);


Rafal Gaweda
Message 16 of 27

Anonymous
Not applicable

Yes perfect that's work now,

Thanks you!

0 Likes
Message 17 of 27

Anonymous
Not applicable

Hi,

I just started using ROBOT programming tools. 

can you please help me finding what is missing in my VBA code? I'm getting a warning after launching calculus "incorrect definition of contour load ...." 

Beside, changing I_ICRV_PZ2 and I_ICRV_PZ3 has no effect on my load

PS : All variables are declared

 

iLC = iLC + 1
Dim LGR As RobotSimpleCase
Set LGR = pipo.Cases.CreateSimple(iLC, "Longrine", I_CN_PERMANENT, I_CAT_STATIC_LINEAR)


chargeAppli = LGR.Records.New(I_LRT_IN_CONTOUR)
Set LoadRecCont = LGR.Records.Get(chargeAppli)
'Define the list of objects to which load will be applied.
LoadRecCont.Objects.FromText "3"


donnee1 = Val(ActiveSheet.Range("D15"))
donnee2 = Val(ActiveSheet.Range("E15"))
donnee3 = Val(ActiveSheet.Range("F15"))
donnee4 = Val(ActiveSheet.Range("G15"))

LoadRecCont.SetValue I_ICRV_PX1, 0
LoadRecCont.SetValue I_ICRV_PY1, 0
LoadRecCont.SetValue I_ICRV_PZ1, -donnee1 * donnee2 * 1000

LoadRecCont.SetValue I_ICRV_AUTO_DETECT_OBJECTS, 0
LoadRecCont.SetValue I_ICRV_NPOINTS, 4

LoadRecCont.SetContourPoint 1, 0, donnee3, haut
LoadRecCont.SetContourPoint 2, ouv, pas_biais + donnee3, haut
LoadRecCont.SetContourPoint 3, ouv, pas_biais + donnee3 + donnee4, haut
LoadRecCont.SetContourPoint 4, 0, donnee3 + donnee4, haut


LoadRecCont.SetValue I_ICRV_PY2, 0
LoadRecCont.SetValue I_ICRV_PZ2, -1000
LoadRecCont.SetValue I_ICRV_PX3, 0
LoadRecCont.SetValue I_ICRV_PY3, 0
LoadRecCont.SetValue I_ICRV_PZ3, -8000

 

0 Likes
Message 18 of 27

Rafal.Gaweda
Autodesk Support
Autodesk Support

Hi @Anonymous 

 

You missed SetPoint.

Example code below:

 

Private Sub CommandButton1_Click()
Dim robapp As New RobotApplication
Dim LGR As RobotSimpleCase
Set LGR = robapp.Project.Structure.Cases.Get(1)

chargeAppli = LGR.Records.New(I_LRT_IN_CONTOUR)
Set LoadRecCont = LGR.Records.Get(chargeAppli)
'Define the list of objects to which load will be applied.
LoadRecCont.Objects.FromText "3"

donnee1 = 3
donnee2 = 3
donnee3 = 3
donnee4 = 3

LoadRecCont.SetValue I_ICRV_AUTO_DETECT_OBJECTS, 0
LoadRecCont.SetValue I_ICRV_NPOINTS, 4

LoadRecCont.SetContourPoint 1, 0, donnee3, 0
LoadRecCont.SetContourPoint 2, 3, 1 + donnee3, 0
LoadRecCont.SetContourPoint 3, 3, 1 + donnee3 + donnee4, 0
LoadRecCont.SetContourPoint 4, 0, donnee3 + donnee4, 0

LoadRecCont.SetValue I_ICRV_PX1, 0
LoadRecCont.SetValue I_ICRV_PY1, 0
LoadRecCont.SetValue I_ICRV_PZ1, -donnee1 * donnee2 * 1000
LoadRecCont.SetValue I_ICRV_PY2, 0
LoadRecCont.SetValue I_ICRV_PZ2, -1000
LoadRecCont.SetValue I_ICRV_PX3, 0
LoadRecCont.SetValue I_ICRV_PY3, 0
LoadRecCont.SetValue I_ICRV_PZ3, -8000

LoadRecCont.SetPoint 1, 0, donnee3, 0
LoadRecCont.SetPoint 2, 3, 1 + donnee3, 0
LoadRecCont.SetPoint 3, 3, 1 + donnee3 + donnee4, 0

End Sub


Rafal Gaweda
0 Likes
Message 19 of 27

Anonymous
Not applicable

thank you.

the first problem is remains. After lunching the calculus I've got the warning bellow :

"Incorrect definition of contour load for the load case 2" : the load case 2 is actually the one I'm setting

ClémentTAHERI6316_0-1586261316039.png

 

0 Likes
Message 20 of 27

Rafal.Gaweda
Autodesk Support
Autodesk Support

Hi @Anonymous 

 

Check geometry \ coordinates.

 



Rafal Gaweda
0 Likes