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: 

VBA loads - API

44 REPLIES 44
SOLVED
Reply
Message 1 of 45
mateaus
2303 Views, 44 Replies

VBA loads - API

I create a sub which define loads on a pannel but it's doesn't work.

 

Can you have a look ?

 

 

 

Public typecharge As String
Public casdecharge As String
Public valeurcharge As Double
Public x_1 As Double
Public y_1 As Double
Public z_1 As Double
Public x_2 As Double
Public y_2 As Double
Public z_2 As Double
Public x_3 As Double
Public y_3 As Double
Public z_3 As Double
Public x_4 As Double
Public y_4 As Double
Public z_4 As Double

 

 

 

Public Sub charges()
'trotoirs
typecharge = I_CN_PERMANENT
casdecharge = "Equipements"
valeurcharge = 5.5
x_1 = 0.000
y_1 = 0.000
z_1 = 0.000
x_2 = 75.480
y_2 = 0.000
z_2 = 0.000
x_3 = 76.143
y_3 = 1.600
z_3 = 0.000
x_4 = 0.663
y_4 = 1.600
z_4 = 0.000
Call chargement_panneau_contour

End Sub

 

 

Sub chargement_panneau_contour()

    Dim cas As RobotSimpleCase
    Dim recs As RobotLoadRecordMngr
    Dim rec_1 As RobotLoadRecordInContour
    Set cas = robapp.Project.Structure.Cases.CreateSimple(robapp.Project.Structure.Cases.FreeNumber, _
casdecharge, typecharge, I_CAT_STATIC_LINEAR)
    Set recs = cas.Records
    
' pression uniforme horizontale appliquée au contour
' définition des contours
    i = recs.New(I_LRT_IN_CONTOUR)
    
' création d'une nouvel enregistrement
    Set rec_1 = recs.Get(i)
    
' définition du plan de charge
    rec_1.Objects.FromText "1"
    rec_1.SetValue I_ICRV_PX1, 0
    rec_1.SetValue I_ICRV_PY1, 0
    rec_1.SetValue I_ICRV_PZ1, -valeurcharge
    rec_1.SetValue I_ICRV_PX2, 0#
    rec_1.SetValue I_ICRV_PY2, 0#
    rec_1.SetValue I_ICRV_PZ2, -valeurcharge
    rec_1.SetValue I_ICRV_PX3, 0#
    rec_1.SetValue I_ICRV_PY3, 0#
    rec_1.SetValue I_ICRV_PZ3, -valeurcharge
    
    ' sens de projection des efforts
    rec_1.SetValue I_ICRV_PROJECTION, 1

    ' nombre de points composant le contour
    rec_1.SetValue I_ICRV_NPOINTS, 4
    rec_1.SetValue I_ICRV_LOCAL, 0

    ' définition des points sur le panneau
    rec_1.SetPoint 1, 0, 0, 0
    rec_1.SetPoint 2, 1, 1, 0
    rec_1.SetPoint 3, 1, 0, 0

    rec_1.SetContourPoint 1, x_1, y_1, z_1
    rec_1.SetContourPoint 2, x_2, y_2, z_2
    rec_1.SetContourPoint 3, x_3, y_3, z_3
    rec_1.SetContourPoint 4, x_4, y_4, z_4
    
    rec_1.SetVector 0, 0, 1

    Set recs = Nothing
    Set rec_1 = Nothing
    Set cas = Nothing
  
End Sub

 

44 REPLIES 44
Message 2 of 45
mateaus
in reply to: mateaus

For the 

 rec_1.SetValue I_ICRV_PZ1, valeurcharge * 1000

Problem solved (it's because I had to multiply by 1000)

 

For the selection of panels

 

My problem is that it's not a selection automatic (of panels).

 

I think the command I need it's like 

 

rec_1.Objects.???? 'automatic

Message 3 of 45
Rafal.Gaweda
in reply to: mateaus

Some bugs should be corected as shown below :

 

Public typecharge As Integer

 

Sub chargement_panneau_contour()

Set RobApp = New RobotApplication    ' or activate somewhere else robotapplication

 

rec_1.Objects.FromText "30to36"



Rafal Gaweda
Message 4 of 45
Rafal.Gaweda
in reply to: mateaus


@mateaus wrote:

For the 

 rec_1.SetValue I_ICRV_PZ1, valeurcharge * 1000

Problem solved (it's because I had to multiply by 1000)

 

Keep in mind - you are using SI units (N,m) in API dirrectly 


 

For the selection of panels

 

My problem is that it's not a selection automatic (of panels).

 

I think the command I need it's like 

 

rec_1.Objects.???? 'automatic

 

 

 only:  rec_1.Objects.FromText "all"       

/ if french  robot version used please use french text syntax:     rec_1.Objects.FromText "tous"

ALL selects all objects



Rafal Gaweda
Tags (1)
Message 5 of 45
mateaus
in reply to: Rafal.Gaweda

Ok thank you,

 

I have 3 combinations number 20 21 22 and I want to have the max and the min of moments :

 

for example Mxx+ and Myy-

 

example

 

What is the code to display it ?

 

 

Message 6 of 45
mateaus
in reply to: mateaus

up

Message 7 of 45
Rafal.Gaweda
in reply to: mateaus

Display on Map or just find  to have it for further use?



Rafal Gaweda
Message 8 of 45
mateaus
in reply to: Rafal.Gaweda

Display on map please

Message 9 of 45
Rafal.Gaweda
in reply to: mateaus

Unfortunatelly it is not posible to dispplay only max \ min on map thru API

 

mavueRobot.ParamsFeMap.WithDescription = True  ' this is the only one settings for maps description



Rafal Gaweda
Message 10 of 45
mateaus
in reply to: Rafal.Gaweda

Can we select many combinations in the same time and ask for a display of Mxx+ for example ?

 

It will display the maximum normally ?

Message 11 of 45
Rafal.Gaweda
in reply to: mateaus

mavueRobot.Selection.Get(I_OT_CASE).FromText ("101")

write here selection (list) of cases

 

 



Rafal Gaweda
Message 12 of 45
mateaus
in reply to: Rafal.Gaweda

Is it possible to write this and ask MXX+?

 

Ps : Can you answer to my message on your private box?

 

mavueRobot.Selection.Get(I_OT_CASE).FromText ("101 102 103")
Message 13 of 45
Rafal.Gaweda
in reply to: mateaus


mateaus wrote:

Is it possible to write this and ask MXX+?

 

As a default top envelope is displayed automatically

 

Ps : Can you answer to my message on your private box?

 

Answered

 



Rafal Gaweda
Message 14 of 45
mateaus
in reply to: Rafal.Gaweda

I would like to create a load on a line on my slab like :

 

linear load

 

I would like the same macro like this one but in order to create a linear load

 

Sub chargement_panneau_contour()
 
'définit les cas de charges
Dim Loads As RobotCaseServer
Set Loads = robapp.Project.Structure.Cases

    Dim cas As RobotSimpleCase
    Dim recs As RobotLoadRecordMngr
    Dim rec_1 As RobotLoadRecordInContour
    Set cas = Loads.Get(nocasdecharge)
'creer un nouveau cas :
'    Set cas = robapp.Project.Structure.Cases.CreateSimple(robapp.Project.Structure.Cases.FreeNumber, _
casdecharge, typecharge, I_CAT_STATIC_LINEAR)
    Set recs = cas.Records
    
' pression uniforme horizontale appliquée au contour
' définition des contours
    i = recs.New(I_LRT_IN_CONTOUR)
    
' création d'une nouvel enregistrement
    Set rec_1 = recs.Get(i)
    
' définition du plan de charge
rec_1.Objects.FromText "tous"
    rec_1.SetValue I_ICRV_PX1, 0
    rec_1.SetValue I_ICRV_PY1, 0
    rec_1.SetValue I_ICRV_PZ1, -valeurcharge * 1000
    rec_1.SetValue I_ICRV_PX2, 0#
    rec_1.SetValue I_ICRV_PY2, 0#
    rec_1.SetValue I_ICRV_PZ2, -valeurcharge * 1000
    rec_1.SetValue I_ICRV_PX3, 0#
    rec_1.SetValue I_ICRV_PY3, 0#
    rec_1.SetValue I_ICRV_PZ3, -valeurcharge * 1000
    
    ' sens de projection des efforts
    rec_1.SetValue I_ICRV_PROJECTION, 1

    ' nombre de points composant le contour
    rec_1.SetValue I_ICRV_NPOINTS, 4
    rec_1.SetValue I_ICRV_LOCAL, 0

    ' définition des points sur le panneau
    rec_1.SetPoint 1, 0, 0, 0
    rec_1.SetPoint 2, 1, 1, 0
    rec_1.SetPoint 3, 1, 0, 0

    rec_1.SetContourPoint 1, x_1, y_1, z_1
    rec_1.SetContourPoint 2, x_2, y_2, z_2
    rec_1.SetContourPoint 3, x_3, y_3, z_3
    rec_1.SetContourPoint 4, x_4, y_4, z_4
    
    rec_1.SetVector 0, 0, 1

    Set recs = Nothing
    Set rec_1 = Nothing
    Set cas = Nothing
  
End Sub

 Can you help me ?

Message 15 of 45
Rafal.Gaweda
in reply to: mateaus

Adjust this code :

 

Dim cas As RobotSimpleCase
Dim recs As RobotLoadRecordMngr
Dim rec_1 As RobotLoadRecordLinear3D

Set cas = robapp.Project.Structure.Cases.CreateSimple(robapp.Project.Structure.Cases.FreeNumber _
, "Case_2", I_CN_PERMANENT, I_CAT_STATIC_LINEAR)

Set recs = cas.Records

i = recs.New(I_LRT_LINEAR_3D)


Set rec_1 = recs.Get(i)

rec_1.SetValue I_L3DRV_PX1, 0
rec_1.SetValue I_L3DRV_PY1, 0
rec_1.SetValue I_L3DRV_PZ1, -100
rec_1.SetValue I_L3DRV_MX1, 0
rec_1.SetValue I_L3DRV_MY1, 0
rec_1.SetValue I_L3DRV_MZ1, 0

rec_1.SetValue I_L3DRV_PX2, 0
rec_1.SetValue I_L3DRV_PY2, 0
rec_1.SetValue I_L3DRV_PZ2, 0
rec_1.SetValue I_L3DRV_MX2, 0
rec_1.SetValue I_L3DRV_MY2, 0
rec_1.SetValue I_L3DRV_MZ2, 0


rec_1.SetValue I_L3DRV_LOCAL, 0


rec_1.SetPoint 1, 0.75, 1, 0  ' set coordinates here
rec_1.SetPoint 2, 0.75, 5, 0  ' set coordinates here


Set recs = Nothing
Set rec_1 = Nothing

Set cas = Nothing



Rafal Gaweda
Message 16 of 45
mateaus
in reply to: Rafal.Gaweda

Ok great, it's working,

 

Yet, it's the most difficult load to programm : a convoy

 

convoi

 

I think I have a lot of input data like :

 

define the polyline

the name of convoy

the direction of load

the type of load (uniform surface)

the value of load (P)

the loads geometry (x, y, dx, dy)

and the convoy dimensions

 

Would you mind give me an example like previous macros ?

Message 17 of 45
Rafal.Gaweda
in reply to: mateaus

It is only possible to define Symmetric Vehicel using API.

Are you still interested ?

 

Some example code how to define vehicle attached

 

 

-          Define vehicles as many as you want with as many records as you want in the same way as shown in attached xls (one below another)

These texts should be used in column C : Vehicle name, linear load, concentrated force, surface load

 



Rafal Gaweda
Message 18 of 45
mateaus
in reply to: Rafal.Gaweda

Yes still interested,

 

For my example the loads are not symmetric. Maybe we can use a convoy saved in a catalog by myself ? But I don't know how to call the saved convoy in a catalog by API ?

 

Any solution ?

Message 19 of 45
Rafal.Gaweda
in reply to: mateaus

Creating moving load case with vehicle loaded from database:

 

Dim Cas As RobotMobileCase
Dim Route As RobotMobileCaseRoute
Dim VData As RobotVehicleData

 

 ' route is a polyline  - creating polyline here

Dim PlineGeometry As RobotGeoPolyline
Set PlineGeometry = Robapp.CmpntFactory.Create(I_CT_GEO_POLYLINE)


Dim Segment As RobotGeoSegment
Dim Object As RobotObjObject

 

 ' create as many segments (= characteristic points of polyline) as you like in the way shown below

Set Segment = Robapp.CmpntFactory.Create(I_CT_GEO_SEGMENT_LINE)
Segment.P1.Set 0, 2, 0

PlineGeometry.Add Segment
PlineGeometry.Initialize

 

Set Segment = Robapp.CmpntFactory.Create(I_CT_GEO_SEGMENT_LINE)
Segment.P1.Set 10, 2, 0

PlineGeometry.Add Segment
PlineGeometry.Initialize

 

RouteNumber = 13

 

 ' creating object from polyline

Set Object = Robapp.Project.Structure.Objects.Create(RouteNumber)
Object.Main.Geometry = PlineGeometry
Object.Initialize
Object.Update

 

 ' creating moving load case 

Set Cas = Robapp.Project.Structure.Cases.CreateMobile(Robapp.Project.Structure.Cases.FreeNumber, "Moving Load Case", I_CN_PERMANENT)

 

 ' assigning route and route parameters to case
Set Route = Cas.GetRoute

Route.Geometry = RouteNumber

 

Dim Fac As RobotMobileCaseSegmentFactors
Set Fac = Route.GetFactors(1)
Fac.VL = 1
Fac.VR = 1
Route.SetFactors 1, Fac


Route.LoadDirection.Set 0, 0, -1
Route.Step = 1
Cas.SetRoute Route

 

 ' assign vehicle to case

Set VLabel = Robapp.Project.Structure.Labels.Create(I_LT_VEHICLE, "Pojazd S - klasa E") ' select vehicle name
Set VData = VLabel.Data


VData.LoadFromDBase "Pojazd S - klasa E", "PN1030"  ' select vehicle name and database name
Robapp.Project.Structure.Labels.Store VLabel

Cas.Vehicle = "Pojazd S - klasa E" ' assign vehicle to case



Rafal Gaweda
Message 20 of 45
mateaus
in reply to: Rafal.Gaweda

I have created a convoy which name is "TS".

 

If I understand your macro, I just have to replace "PN1030" by "TS" :

 

VData.LoadFromDBase "Pojazd S - klasa E", "TS"

 

I have created a catalog to save my convoy. I don't know how to save it otherwise.

 

catalog

 

Will it working with your macro ?

 

I have an annex question :

 

I would like to create a convoy's library in order to share it whith my colleagues but I don't know where it is save in the computer and what I have to copy in their computer.

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

Post to forums  

Autodesk Design & Make Report