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: 

(API) VBA ROS - running steel code calculation

21 REPLIES 21
Reply
Message 1 of 22
Adamchuk_Nicolay
1578 Views, 21 Replies

(API) VBA ROS - running steel code calculation

Hi,

please help me with next problem:

how running calculation for steel members using VBA (Robot Open Standart).

 

Unfortunatly not any example for this case.

21 REPLIES 21
Message 2 of 22

Nicolay,

 

Check pdf in message 2 here: http://forums.autodesk.com/t5/Autodesk-Robot-Structural/Manual-Calculations-for-Steel-Design-using-A...

 

Example from page 95

 

Two small examples of creating steel design groups and geting steel design ratio attached



Rafal Gaweda
Message 3 of 22
Rafal.Gaweda
in reply to: Rafal.Gaweda

example of creating steel design label for bars



Rafal Gaweda
Message 4 of 22
Rafal.Gaweda
in reply to: Rafal.Gaweda
Message 5 of 22
rdrmolina
in reply to: Rafal.Gaweda

Hi,
How can I create a Code group, and specify the sections list and code parameters to use by each group using Robot API.

thanks
Message 6 of 22
Rafal.Gaweda
in reply to: rdrmolina

Example in message 2 of this thread.
Code parameters are assigned to bars , not design group


Rafal Gaweda
Message 7 of 22

Hi,
I'm so sorry, but I didn't understand how to specify Section database and section families in your code. I saw how to include or exclude a member in Code Grup if you define all the parameters before. In my case I want to create a Code group at the first time without any definition before. Cold you help me?
thanks.

Message 8 of 22
Rafal.Gaweda
in reply to: rdrmolina

Code update for previous example

 

Dim RDMServer As RDimServer
    Dim RDMStream As RDimStream
    Dim RDMGrps As RDimGroups
    Dim RDMGrp1 As RDimGroup
    Dim RDmGrpProfs As RDimGrpProfs
    
    Set RDMServer = RobApp.Kernel.GetExtension("RDimServer")
    RDMServer.Mode = I_DSM_STEEL
    
    Set RDMGrps = RDMServer.GroupsService
    idx = 0
    While Cells(2 + idx, 1) <> Empty
    
        usrgr = Int(Cells(2 + idx, 1))
    
        Set RDMGrp1 = RDMGrps.Get(usrgr)
        RDMGrp1.Name = Cells(2 + idx, 2)
        Set RDMStream = RDMServer.Connection.GetStream
        RDMGrp1.GetMembList RDMStream
        RDMStream.Clear
        RSelection.FromText Cells(2 + idx, 3)
        Cells(2 + idx, 3) = RSelection.ToText
        RDMStream.WriteText RSelection.ToText
        RDMGrp1.SetMembList RDMStream
        
        Set RDmGrpProfs = RDMServer.Connection.GetGrpProfs
        RDmGrpProfs.Clear
        RDMStream.Clear
        RDMStream.WriteText ("IPE")           ' family of profiles
        RDMStream.WriteText ("HEA")           ' family of profiles
        RDmGrpProfs.SetFamilies "SIMPL", RDMStream ' section database
        RDMGrp1.SetProfs RDmGrpProfs

        RDMGrps.Save RDMGrp1
        idx = idx + 1
    Wend

 



Rafal Gaweda
Message 9 of 22
rdrmolina
in reply to: Rafal.Gaweda

Thanks Rafal,
Again you were extremely efficient and attentive with me.
Message 10 of 22
rdrmolina
in reply to: rdrmolina

Private Sub CommandButton2_Click()

On Error GoTo err
Set RobApp = New RobotApplication

If Not RobApp.Visible Then
Set RobApp = Nothing
MsgBox "Open Robot and load model", vbOKOnly, "ERROR"
Exit Sub
End If

Dim RSelection As RobotSelection
Set RSelection = RobApp.Project.Structure.Selections.Create(I_OT_BAR)

Dim RDMServer As RDimServer ' Resultados
Dim RDMStream As RDimStream ' vetor com os parametros
Dim RDMGrps As RDimGroups ' De todos os grupos
Dim RDMGrp1 As RDimGroup ' Grupo em questão
Dim RDmGrpProfs As RDimGrpProfs

Set RDMServer = RobApp.Kernel.GetExtension("RDimServer")
RDMServer.Mode = I_DSM_STEEL

Set RDMGrps = RDMServer.GroupsService
idx = 0
While Cells(2 + idx, 1) <> Empty

usrgr = Int(Cells(2 + idx, 1)) ' Captura o valor do nome do grupo na primeira coluna da planilha

Set RDMGrp1 = RDMGrps.Get(usrgr) ' Seleciona qual grupo se pretende capturar as informações
RDMGrp1.Name = Cells(2 + idx, 2) ' Seta o nome do grupo com o valor da segunda coluna da planilha
Set RDMStream = RDMServer.Connection.GetStream ' vetor de parâmetros
RDMGrp1.GetMembList RDMStream ' Aloca as informções do grupo selecionado no vetor RDMStream
RDMStream.Clear ' Limpa o vetor
RSelection.FromText Cells(2 + idx, 3) ' Faz a seleção conforme preeechimento da 3 coluna da planilha
Cells(2 + idx, 3) = RSelection.ToText
RDMStream.WriteText RSelection.ToText
RDMGrp1.SetMembList RDMStream

Set RDmGrpProfs = RDMServer.Connection.GetGrpProfs
RDmGrpProfs.Clear
RDMStream.Clear
RDMStream.WriteText ("CW") ' family of profiles
RDMStream.WriteText ("CWN") ' family of profiles
RDmGrpProfs.SetFamilies "AISI", RDMStream ' section database
RDMGrp1.SetProfs RDmGrpProfs

RDMGrps.Save RDMGrp1
idx = idx + 1

Wend
Exit Sub



err:
If err.Number = 91 Then MsgBox "One of group number does not exist in model.Please check"

End Sub


I tested the code but it didn't work. On this example I was trying change the actual database to "AISI" and section families to "CW" and "CWN", but the code always Stop in this line

RDmGrpProfs.SetFamilies "AISI", RDMStream

What am I doing wrong?

thanks
Message 11 of 22
Rafal.Gaweda
in reply to: rdrmolina

Try this (add this line to code, add database to list):

 

aisi.jpg



Rafal Gaweda
Message 12 of 22
rdrmolina
in reply to: Rafal.Gaweda

It's working now. Thank you.
Sorry for asking so much things, but how can I list all Database and section families defined?.
Thanks again.

Message 13 of 22
Rafal.Gaweda
in reply to: Rafal.Gaweda
Message 14 of 22
rdrmolina
in reply to: Rafal.Gaweda

I did this code to list all my section Database

 

Dim teste As IRobotSectionDatabaseList

Set teste = RobApp.Project.Preferences.SectionsFound

Dim sec_data As IRobotSectionDatabase


For I = 1 To teste.Count
Cells(16 + I, 1) = teste.Get(I)
Cells(16 + I, 2) = teste.GetDatabase(I).FullName

Next I

 

It appears more database than defined in my job preferences.
How it is possible? How can I select only steel and timber sections?

Thanks

Message 15 of 22
Rafal.Gaweda
in reply to: rdrmolina

I think you are looking for:

SectionsActive ( see page 1232) The list of active (selected) section databases .


Rafal Gaweda
Message 16 of 22
rdrmolina
in reply to: Rafal.Gaweda

Where can I find this Document?
I'm using Robot Open Standard 6.0 and there are only 452 pages.
Thanks

 

Message 17 of 22
rdrmolina
in reply to: rdrmolina

Thanks.

Now it´s working.
Message 18 of 22
rdrmolina
in reply to: Rafal.Gaweda

I created this code to list the material and section database.

public void MaterialComboBox()
{

RobotNamesArray ListaMaterial;
RobotClass.Robot.Project.Preferences.Materials.Load ("American");
ListaMaterial = RobotClass.Robot.Project.Preferences.Materials.Get(IRobotMaterialType.I_MT_STEEL);

for (int i = 1; i <= ListaMaterial.Count; i++)
{
comboBox1.Items.Add(ListaMaterial.Get(i));
}

}

public void SecoesListComboBox()
{
IRobotSectionDatabaseList SecDataBase=RobotClass.Robot.Project.Preferences.SectionsActive;
ArrayList Catalogo = new ArrayList();

for (int i = 1; i <= SecDataBase.Count; i++)
{
checkedListBox1.Items.Add(SecDataBase.GetDatabase(i).FullName);
Catalogo.Add(SecDataBase.Get(i));
}

}

I didn't find how to list Families sections for each Database section.

Could you help me?

Thanks
Message 19 of 22
Rafal.Gaweda
in reply to: Rafal.Gaweda

robapp.Project.Preferences.SetCurrentDatabase I_DT_SECTIONS, "AISI"
Dim SDL As RobotSectionDatabaseList
Set SDL = robapp.Project.Preferences.SectionsActive
Dim RSD As RobotSectionDatabase

For I = 1 To SDL.Count
    If SDL.GetDatabase(I).Name = "AISI" Then
        Set RSD = SDL.GetDatabase(I)
    End If
Next I

Dim Sections As RobotNamesArray
Set Sections = RSD.GetAll
Row = 10
Dim Familyname As String
Familyname = ""
For j = 1 To Sections.Count

If Familyname <> Left(Sections.Get(j), InStr(Sections.Get(j), " ") - 1) Then
    Familyname = Left(Sections.Get(j), InStr(Sections.Get(j), " ") - 1)
    Cells(Row, 1) = Familyname
    Row = Row + 1
    End If
Next j

 



Rafal Gaweda
Message 20 of 22
rdrmolina
in reply to: Rafal.Gaweda

Hi Rafal,

I'm having problems in the following part. The error is attached.

Could you help me again?

 

//Definições das variáveis

RDimServer RDMServer; // Resultados
RDimStream RDMStream ; // vetor com os parametros
RDimGroups RDMGrps; // De todos os grupos
RDimGroup RDMGrp1; // Grupos atuais
RDimGroup RDMGrp2; // Grupo que será criado
IRDimGrpProfs RDmGrpProfs; // Code grups
RobotBar Elemento;
int num_elemento;

//Pega os elementos da linha do formulario

RobotSelection ElemSelecionado = RobotClass.Robot.Project.Structure.Selections.Create(IRobotObjectType.I_OT_BAR);
ElemSelecionado.FromText(textBox1.Text);
RobotBarCollection ElemColecao = (RobotBarCollection)RobotClass.Robot.Project.Structure.Bars.GetMany(ElemSelecionado);

//Checa se a seleção e valores de entradas

if (!ChecaSelecaoElemento(ElemSelecionado)) return; // Seleção de elementos

//Processo de criação dos grupos

RDMServer = RobotClass.Robot.Kernel.GetExtension("RDimServer");
RDMServer.Mode = IRDimServerMode.I_DSM_STEEL;
RDmGrpProfs = RDMServer.Connection.GetGrpProfs;    
RDmGrpProfs.Clear();

 

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

Post to forums  

Autodesk Design & Make Report