• Industries
  • Products
  • Buy
  • Services & Support
  • Communities
  • Autodesk Robot Structural Analysis

    Reply
    Product Support
    Posts: 2,507
    Registered: ‎04-26-2010

    Re: VBA loads

    02-28-2012 07:58 AM in reply to: mateaus

    mateaus wrote:

    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 ?

     

     ' assign vehicle to case

    Set VLabel = Robapp.Project.Structure.Labels.Create(I_LT_VEHICLE, "your_vehicle_name") select vehicle name
    Set VData = VLabel.Data


    VData.LoadFromDBase "your_vehicle_name", "PRO"  ' PRO is the name of your database
    Robapp.Project.Structure.Labels.Store VLabel

    Cas.Vehicle = "your_vehicle_name"

     



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Product Support
    Posts: 2,507
    Registered: ‎04-26-2010

    Re: VBA loads

    02-28-2012 08:10 AM in reply to: mateaus

    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.



    The database file is created in:

     

    "c:\Users\<USER>\AppData\Roaming\Autodesk\Structural\Common Data\2012" 

     

    as V_...xml file. In your case V_PRO.xml file

    copy it to similar location on other computers.



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Distinguished Contributor
    mateaus
    Posts: 117
    Registered: ‎10-10-2011

    Re: VBA loads

    02-28-2012 09:09 AM in reply to: RG_Adsk

    RG_Adsk wrote:

    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.



    The database file is created in:

     

    "c:\Users\<USER>\AppData\Roaming\Autodesk\Structural\Common Data\2012" 

     

    as V_...xml file. In your case V_PRO.xml file

    copy it to similar location on other computers.


    It doesn't work. I have copied the file but there is nothing when I open Robot : 

    library

     

     

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

    Re: VBA loads

    02-29-2012 01:07 AM in reply to: mateaus

    Add this database to project:

     

    veh.jpg



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Distinguished Contributor
    mateaus
    Posts: 117
    Registered: ‎10-10-2011

    Re: VBA loads

    02-29-2012 01:56 AM in reply to: RG_Adsk

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

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

    Re: VBA loads

    02-29-2012 03:14 AM in reply to: mateaus


    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



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Distinguished Contributor
    mateaus
    Posts: 117
    Registered: ‎10-10-2011

    Re: VBA loads

    02-29-2012 05:38 AM in reply to: RG_Adsk

    RG_Adsk wrote:

    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


    I've modified the macro but it's not working if I want to select a case which already exist :

     

    'définit les cas de charges
    Dim Loads As RobotCaseServer
    Set Loads = Robapp.Project.Structure.Cases
    
    Dim Cas As RobotMobileCase
    Set Cas = Loads.Get(nocasdecharge)

     

    Sub generation_charges_roulantes()
    
    'définit les cas de charges
    Dim Loads As RobotCaseServer
    Set Loads = Robapp.Project.Structure.Cases
    
    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 x_1, y_1, z_1
    PlineGeometry.Add Segment
    PlineGeometry.Initialize
     
    Set Segment = Robapp.CmpntFactory.Create(I_CT_GEO_SEGMENT_LINE)
    Segment.P1.Set x_2, y_2, z_2
    PlineGeometry.Add Segment
    PlineGeometry.Initialize
     
     ' 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 = Loads.Get(nocasdecharge)
    '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
    Route.LoadDirection.Set 0, 0, -1
    'définit le pas (non paramétré)
    Route.Step = 1
    Cas.SetRoute Route
     
     ' assign vehicle to case
    Set VLabel = Robapp.Project.Structure.Labels.Create(I_LT_VEHICLE, Vehicle_name) ' select vehicle name
    Set VData = VLabel.Data
    
    'Pour charger un vehicule enregistrer dans la bibliothèque (cmd non utilisé)
    'VData.LoadFromDBase Vehicle_name, "PRO"  ' PRO is the name of your database ; select vehicle name and database name
    Robapp.Project.Structure.Labels.Store VLabel
    
    Cas.Vehicle = Vehicle_name ' assign vehicle to case
    
    End Sub

     

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

    Re: VBA loads

    02-29-2012 07:20 AM in reply to: mateaus

    Mateaus 

    I've modified the macro but it's not working if I want to select a case which already exist :

     

    It is not possible. Moving load case is different case type, even if you make it manually in Robot you do it in different way.  Do it this way:

    - get simple case number

    - delete this simple case

    - create moving load case with this number



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.
    Distinguished Contributor
    mateaus
    Posts: 117
    Registered: ‎10-10-2011

    Re: VBA loads

    03-01-2012 05:51 AM in reply to: RG_Adsk

    When I generate the moving loads with API even if I load from data or create a new one I can't see the value of loads in the view.

     

    Is there a solution ?

     

    view moving loads

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

    Re: VBA loads

    03-02-2012 03:09 AM in reply to: mateaus

    mateaus wrote:

    When I generate the moving loads with API even if I load from data or create a new one I can't see the value of loads in the view.

     

    Add this green code. If loads are not displayed please run Model Generation or Calculations

     

     ' 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
    'définit le pas (non paramétré)
    Route.Step = 1
    Cas.SetRoute Route

     



    Rafal Gaweda
    Product Support
    Autodesk, Inc.
    Please use plain text.