Discussion Groups

Robot Structural Analysis

Reply
Distinguished Contributor
mateaus
Posts: 117
Registered: ‎10-10-2011

Re: VBA loads

03-07-2012 08:09 AM in reply to: Rafal.Gaweda

Ok it's working,

 

Do you have an example of VBA code to create a trapezoidal load (2p) on a bar like this one ?

 

trapez load 2p

Please use plain text.
Product Support
Posts: 4,426
Registered: ‎04-26-2010

Re: VBA loads

03-07-2012 08:19 AM in reply to: mateaus

Set Recs = SimpleCase.Records

I = Recs.New(I_LRT_BAR_TRAPEZOIDALE)
Set Rec = Recs.Get(I)
Rec.Objects.FromText BarNumber


 Rec.SetValue I_BTRV_LOCAL, -1 ' or global


Rec.SetValue I_BTRV_RELATIVE, -1 ' or real

 

'Select Case Direction

'Case "fx"
Rec.SetValue I_BTRV_PX1, value_x1
Rec.SetValue I_BTRV_X1, pos_x1
Rec.SetValue I_BTRV_PX2, value_x2
Rec.SetValue I_BTRV_X2, pos_x2
'Case "fy"
Rec.SetValue I_BTRV_PY1, value_y1
Rec.SetValue I_BTRV_X1, pos_x1
Rec.SetValue I_BTRV_PY2, value_y2
Rec.SetValue I_BTRV_X2, pos_x2
'Case "fz"
Rec.SetValue I_BTRV_PZ1, value_z1
Rec.SetValue I_BTRV_X1, pos_x1
Rec.SetValue I_BTRV_PZ2, value_z2
Rec.SetValue I_BTRV_X2, pos_x2
'End Select



Rafal Gaweda
Please use plain text.
Distinguished Contributor
mateaus
Posts: 117
Registered: ‎10-10-2011

Re: VBA loads

03-07-2012 08:32 AM in reply to: Rafal.Gaweda

and this one : Load on bar ?

Please use plain text.
Product Support
Posts: 4,426
Registered: ‎04-26-2010

Re: VBA loads

03-08-2012 12:49 AM in reply to: mateaus

mateaus wrote:

and this one : Load on bar ?


 

Set Recs = SimpleCase.Records

I = Recs.New(I_LRT_BAR_FORCE_CONCENTRATED)
Set Rec = Recs.Get(I)
Rec.Objects.FromText BarNumber

 Rec.SetValue I_BFCRV_LOC, -1 ' or global

 Rec.SetValue I_BFCRV_REL, -1 ' or real

'Select Case Direction
'Case "fx"
Rec.SetValue I_BFCRV_FX, value
'Case "fy"
Rec.SetValue I_BFCRV_FY, value
'Case "fz"
Rec.SetValue I_BFCRV_FZ, value
'Case "mx"
Rec.SetValue I_BFCRV_CX, value
'Case "my"
Rec.SetValue I_BFCRV_CY, value
'Case "mz"
Rec.SetValue I_BFCRV_CZ, value
'End Select

Rec.SetValue I_BFCRV_X, pos_x  'position  

 

I have not used all properties (all shown below) of this kind of load in the example above.

If you need them use them accordingly.

 

vbaconcload.jpg



Rafal Gaweda
Please use plain text.
Distinguished Contributor
mateaus
Posts: 117
Registered: ‎10-10-2011

Re: VBA loads

03-27-2012 07:40 AM in reply to: Rafal.Gaweda

Hi,

 

I would like to program linear supports :

 

appuis linéaires.PNG

 

Can you give me a code to do that with VBA ?

Please use plain text.
Product Support
Posts: 4,426
Registered: ‎04-26-2010

Re: VBA loads

03-27-2012 07:45 AM in reply to: mateaus

Take a look at reservior_test.xls example you have.

 

 Dim monobjet As RobotObjObject
   Dim moncote As RobotObjEdge
   Dim sup As IRobotLabel
   Dim sup_data As IRobotNodeSupportData
   
   Set sup = robapp.Project.Structure.Labels.Create(I_LT_SUPPORT, "mon_appuis_1")
   Set sup_data = sup.Data
 
 ' definition des appuis
 
    sup_data.SetFixed I_NSFD_UX, True
    sup_data.SetFixed I_NSFD_UY, False
    sup_data.SetFixed I_NSFD_UZ, False
    sup_data.SetFixed I_NSFD_RX, False
    sup_data.SetFixed I_NSFD_RY, True
    sup_data.SetFixed I_NSFD_RZ, True

   robapp.Project.Structure.Labels.Store sup
      
    Set monobjet = robapp.Project.Structure.Objects.Get(2)
    Set moncote = monobjet.Main.Edges.Get(4)
    moncote.SetLabel I_LT_SUPPORT, "mon_appuis_1"
    monobjet.Update
      

 



Rafal Gaweda
Please use plain text.
Distinguished Contributor
mateaus
Posts: 117
Registered: ‎10-10-2011

Re: VBA loads

03-28-2012 12:57 AM in reply to: Rafal.Gaweda

RG_Adsk wrote:

Take a look at reservior_test.xls example you have.

 

 Dim monobjet As RobotObjObject
   Dim moncote As RobotObjEdge
   Dim sup As IRobotLabel
   Dim sup_data As IRobotNodeSupportData
   
   Set sup = robapp.Project.Structure.Labels.Create(I_LT_SUPPORT, "mon_appuis_1")
   Set sup_data = sup.Data
 
 ' definition des appuis
 
    sup_data.SetFixed I_NSFD_UX, True
    sup_data.SetFixed I_NSFD_UY, False
    sup_data.SetFixed I_NSFD_UZ, False
    sup_data.SetFixed I_NSFD_RX, False
    sup_data.SetFixed I_NSFD_RY, True
    sup_data.SetFixed I_NSFD_RZ, True

   robapp.Project.Structure.Labels.Store sup
      
    Set monobjet = robapp.Project.Structure.Objects.Get(2)
    Set moncote = monobjet.Main.Edges.Get(4)
    moncote.SetLabel I_LT_SUPPORT, "mon_appuis_1"
    monobjet.Update
      

 


Ok I saw the file reservoir but my macro is not working. I have this error message :

 

message erreur appuis.PNG

 

erreur macro ligne appui.PNG

 

The variable moncote is declared but it's not work anyway.

 

I don't know how to solv it ?

Please use plain text.
Product Support
Posts: 4,426
Registered: ‎04-26-2010

Re: VBA loads

03-28-2012 01:05 AM in reply to: mateaus

Do you have object no17 in model? Has it edge no 3 ?

If so send me model and macro.



Rafal Gaweda
Please use plain text.
Distinguished Contributor
mateaus
Posts: 117
Registered: ‎10-10-2011

Re: VBA loads

03-28-2012 01:57 AM in reply to: Rafal.Gaweda

Macro :

 

Public Sub appuis_robot()

 Dim monobjet As RobotObjObject
   Dim moncote As RobotObjEdge
   Dim sup As IRobotLabel
   Dim sup_data As IRobotNodeSupportData
   
   Set sup = Robapp.Project.Structure.Labels.Create(I_LT_SUPPORT, "appuis_entretoises")
   Set sup_data = sup.Data
 
 ' definition des appuis
 
    sup_data.SetFixed I_NSFD_UX, True
    sup_data.SetFixed I_NSFD_UY, False
    sup_data.SetFixed I_NSFD_UZ, False
    sup_data.SetFixed I_NSFD_RX, False
    sup_data.SetFixed I_NSFD_RY, True
    sup_data.SetFixed I_NSFD_RZ, True

   Robapp.Project.Structure.Labels.Store sup
      
    Set monobjet = Robapp.Project.Structure.Objects.Get(3)
    Set moncote = monobjet.Main.Edges.Get(17)
    moncote.SetLabel I_LT_SUPPORT, "appuis_entretoises"
    monobjet.Update

   Robapp.Project.Structure.Labels.Store sup
    Set sup_data = Nothing
    Set sup = Nothing
    Set monobjet = Nothing
    Set moncote = Nothing

End Sub

 

Please use plain text.
Product Support
Posts: 4,426
Registered: ‎04-26-2010

Re: VBA loads

03-28-2012 04:01 AM in reply to: mateaus

You have object 3 edge 17.

 

Object 17 , edge 3 - below

 

Set monobjet = RobApp.Project.Structure.Objects.Get(17)
Set moncote = monobjet.Main.Edges.Get(3)



Rafal Gaweda
Please use plain text.