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: 

C# API help v2

5 REPLIES 5
SOLVED
Reply
Message 1 of 6
pipu123
715 Views, 5 Replies

C# API help v2

1)  How Rotate a bar

    Gamma for RobotBar   

     //IRobotObjOperationType obrot = IRobotObjOperationType.I_OOT_ROTATE;

                    IRobotObjOperation obrot;

                    IRobotObjOperRotation rotacja;

                    rotacja.Angle 90;

 

      private IRobotApplication robApp;

      private RobotProjectPreferences ProjectPrefs;

      private RobotMeshParams MeshParams;

      private IRobotStructure str;

      private RobotLabelServer labels;

      private IRobotLabel label;

      private RobotSelection SelectionNodes;

      private RobotNodeSupportData footData;

      private RobotSectionDatabaseList steelSections;

 

      string StrSlup = "HEB 240";  // nazwy z odstępem

      string StrRygiel = "IPE 180";

      string StrScianaSrodek = "UPE 80";

      string StrScianaGora = "UPE 80";

 

      string klasaStal = "S355";

 

 

           robApp = new RobotApplicationClass();

           str = robApp.Project.Structure;

           labels = robApp.Project.Structure.Labels;

 

           IRobotLabel Section;

           IRobotBarSectionData SData;

           IRobotNodeServer inds = robApp.Project.Structure.Nodes;

           IRobotBarServer ibars = robApp.Project.Structure.Bars;

           RobotSelection iselSlup = robApp.Project.Structure.Selections.Create(IRobotObjectType.I_OT_BAR);

 

               inds.Create(1,0,0, 0);

               inds.Create(2, 5,5, 0);

 

               ibars.Create(1, 1, 2); //slup

               iselSlup.AddOne(1);

 

               ibars.SetLabel(iselSlup, IRobotLabelType.I_LT_MATERIAL, klasaStal);              

               Section = robApp.Project.Structure.Labels.Create(IRobotLabelType.I_LT_BAR_SECTION, StrSlup);

               SData = (IRobotBarSectionData)Section.Data;

               SData.LoadFromDBase(StrSlup);

               robApp.Project.Structure.Labels.Store(Section);

               str.Bars.SetLabel(iselSlup, IRobotLabelType.I_LT_BAR_SECTION, StrSlup);

 

 

On a link “setting gamma using the API”  there is

IRobotBar bar;

Bar = …       please write this line using above code  

bar.Gamma = 90;

 I don’t know how to add created bar  ibars.Create(1, 1, 2);   to IRobotBar method

 

2)    How to set local system as axis of a bar ( 3 points) ?

I want to set a local system   parallel to axis in a bar to do an offset for another bar

IRobotGeoCoordinateSystem.I_GCS_LOCAL_ORIGINAL;

 

 

3)       

How to add all bars from construction

I would like    TempLato involves to all bars in a construction

 

 private IRobotStructure structure;

        RobotSimpleCase TempLato, TempZima;

            TempLato = structure.Cases.CreateSimple(7, "TmpLato", IRobotCaseNature.I_CN_TEMPERATURE,

                    IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR);

            TempLato.Records.New(IRobotLoadRecordType.I_LRT_BAR_THERMAL);

 

            LoadRecord = (RobotLoadRecord)TempLato.Records.Get(1);

            LoadRecord.SetValue(Convert.ToInt16(IRobotBarThermalRecordValues.I_BTRV_TX), obcTmpLato);

            LoadRecord.SetValue(Convert.ToInt16(IRobotBarThermalRecordValues.I_BTRV_TY), 0);

            LoadRecord.SetValue(Convert.ToInt16(IRobotBarThermalRecordValues.I_BTRV_TZ), 0);

 

 

4)      How to divide bar into “ n parts”

 number of segments :   4

Edit  divide    (division )

 

DivideBar (_bar_number : long, _div_points : IRobotValuesArray, _relative : bool) :

IRobotNumbersArray

5 REPLIES 5
Message 2 of 6
pipu123
in reply to: pipu123

I am learning api c# for robot and I meet some difficulties. Please write a tip or solution. 

Message 3 of 6
Rafal.Gaweda
in reply to: pipu123

Ad 1

 

robApp = new RobotApplicationClass();
           str = robApp.Project.Structure;
           labels = robApp.Project.Structure.Labels;
 
           IRobotLabel Section;
           IRobotBarSectionData SData;
           IRobotNodeServer inds = robApp.Project.Structure.Nodes;
           IRobotBarServer ibars = robApp.Project.Structure.Bars;
           RobotSelection iselSlup = robApp.Project.Structure.Selections.Create(IRobotObjectType.I_OT_BAR);
 
               inds.Create(1,0,0, 0);
               inds.Create(2, 5,5, 0);

               int BarNumber = 2;

               ibars.Create(BarNumber, 1, 2); //slup
               iselSlup.AddOne(1);
 
               ibars.SetLabel(iselSlup, IRobotLabelType.I_LT_MATERIAL, klasaStal);              
               Section = robApp.Project.Structure.Labels.Create(IRobotLabelType.I_LT_BAR_SECTION, StrSlup);
               SData = (IRobotBarSectionData)Section.Data;
               SData.LoadFromDBase(StrSlup);
               robApp.Project.Structure.Labels.Store(Section);
               str.Bars.SetLabel(iselSlup, IRobotLabelType.I_LT_BAR_SECTION, StrSlup);

               IRobotBar Bar = (IRobotBar)ibars.Get(BarNumber);
               Bar.Gamma = 12;

 



Rafal Gaweda
Message 4 of 6
Rafal.Gaweda
in reply to: pipu123

 

2)    How to set local system as axis of a bar ( 3 points) ?

I want to set a local system   parallel to axis in a bar to do an offset for another bar

 

LCS of bars is created automatically accordding to these rules:

http://docs.autodesk.com/RSA/2013/ENU/filesROBOT/GUID-E6C19973-6864-4E67-9659-6F43579E2DB8.htm?highl...

 

You can rotate it around local X using   Bar.Gamma = 



Rafal Gaweda
Message 5 of 6
Rafal.Gaweda
in reply to: pipu123

3)       

How to add all bars from construction

I would like    TempLato involves to all bars in a construction

 

 

            robApp = new RobotApplicationClass();
            IRobotStructure structure = robApp.Project.Structure;
            RobotSimpleCase TempLato, TempZima;
            TempLato = structure.Cases.CreateSimple(7, "TmpLato", IRobotCaseNature.I_CN_TEMPERATURE,
                    IRobotCaseAnalizeType.I_CAT_STATIC_LINEAR);
            TempLato.Records.New(IRobotLoadRecordType.I_LRT_BAR_THERMAL);

            double obcTmpLato = 21;
            RobotLoadRecord LoadRecord = (RobotLoadRecord)TempLato.Records.Get(1);
            LoadRecord.SetValue(Convert.ToInt16(IRobotBarThermalRecordValues.I_BTRV_TX), obcTmpLato);
            LoadRecord.SetValue(Convert.ToInt16(IRobotBarThermalRecordValues.I_BTRV_TY), 0);
            LoadRecord.SetValue(Convert.ToInt16(IRobotBarThermalRecordValues.I_BTRV_TZ), 0);
            LoadRecord.Objects.AddText("wsz"); // in english replace string by "all"

 

 



Rafal Gaweda
Message 6 of 6
Rafal.Gaweda
in reply to: pipu123

4)      How to divide bar into “ n parts”

 number of segments :   4

 

Example of dividing bar number 1 into 4 pieces by 3 points located 2,4,5 meters from the begining:

 

 

IRobotApplication robApp;

RobotValuesArray DivPoints = new RobotValuesArray();
RobotNumbersArray RobotNumberAr = new RobotNumbersArray();

robApp = new RobotApplication();
            
DivPoints.SetSize(3);
DivPoints.Set(1,2);
DivPoints.Set(2,4);
DivPoints.Set(3,5);

RobotNumberAr.SetSize(4);
int barnumber = 1;
RobotNumberAr = (RobotNumbersArray)robApp.Project.Structure.Edit.DivideBar(barnumber,DivPoints,false);

 

 



Rafal Gaweda

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

Post to forums  

Autodesk Design & Make Report