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
2311 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 41 of 45
mateaus
in reply to: Rafal.Gaweda


@rg_Adsk wrote:


Ok is it possible to do it automaticaly. Is there a file default to copy ?


So you already know where the database file is located.

Add database to job preferences as shown in previous post, then save preferences:

File named ...cov will be saved in path which can be checked in the field marked by green rectagle below

Then copy it to different computers to similar folder, besides copying database file.

 

cov.jpg


Hi,

 

when I generate a new model the data base is not the default one I want. I have to load the catalog by myself. That's why I have no moving loads on the slab. I have replaced the file DEFAULTS.cov in :

C:\Users\xxxx\AppData\Roaming\Autodesk\Autodesk Robot Structural Analysis 2012\CfgUsr

but it's not working.

 

convois defauts param.PNG

 

Is that possible to load the catalog by default automatically ?

 

preferences de l'affaire.PNG

Message 42 of 45
mateaus
in reply to: mateaus


@mateaus wrote:

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

 


Is that possible to set value of coordinates of this contour

 

    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

by something which import coordinates of nodes that exist already in the model like :

 

x_1 = x of point 1 in the model

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

What does not work?

 

This is what I see running your code:

 

contloads.jpg



Rafal Gaweda
Message 44 of 45
mateaus
in reply to: mateaus

Yes it's working but I want to add something.

I have created points in the model. And I want to set the coordinates of the point of the model to the points of the macro.

For exemple :

You select point number 1
You import his coordonates
And you set the values in x1 y1 z1
....
Message 45 of 45
Rafal.Gaweda
in reply to: mateaus

Example attached



Rafal Gaweda

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

Post to forums  

Autodesk Design & Make Report