Login

View Full Version : Excel VBA with ROS



kibe
2010-09-06, 12:17 PM
Hi
I'm searching anybody with some experience with Excel VBA with robot open standard (ROS).
I find only very limited information on the ROS language. So far I'm familiar with http://www.robobat.com/n/ros/
However I find this very old, looks like the pages haven't been updated since 2008.
The problems i'm dealing with is amongst others, defining bar releases for 2d frame model, adding default material to a section and telling the structural component that it is a truss..
I hereby give you some extract of what i'm dealing with:
( the sections are defined on forehand as well as the material has been defined in a priori.
please write if you have any clues of how to master this 'properties'.
Kristian


'-----------------------------------------------------
'--- Create structural bars ------
'-----------------------------------------------------
Private Sub CreateBars()
'Declare and create the main object representing the Robot application.
Dim robapp As IRobotApplication
Set robapp = New RobotApplication

On Error Resume Next
'Allocating
Dim row, j, elStartNode, elEndNode As Integer, elBarNum As Long, elSection, elMaterial, _
elReleases, elTrussbar As String
'Number of rows
Set row = ET.Range("H2")

'Loop for element topology
For j = 1 To row Step 1
'Create the new bar
elBarNum = ET.Cells(3 + (j - 1), 1)
elStartNode = ET.Cells(3 + (j - 1), 2)
elEndNode = ET.Cells(3 + (j - 1), 3)
'elSection = ET.Cells(3 + (j - 1), 4)
'elMaterial = ET.Cells(3 + (j - 1), 5)
elReleases = ET.Cells(3 + (j - 1), 6)
'elTrussbar = ET.Cells(3 + (j - 1), 7)

With robapp.Project.Structure.Bars
.Create elBarNum, elStartNode, elEndNode
'.SetTrussBar , Truss
End With

'SetStructuralType(_bar_sel As String, _str_type As IRobotObjectStructuralType)
'SetTrussBar(_bars As String, _truss_bar As Boolean)


Next
'Applying sections and Marterials
'-----------------------------------------------------------------
'Here we set the section on all bars
Dim selectionBars As IRobotSelection
Set selectionBars = robapp.Project.Structure.Selections.Get(I_OT_BAR)
selectionBars.FromText Tunnel_input.Range("G28")

Dim LiningSection As IRobotSectionDatabaseList
Set LiningSection = robapp.Project.Preferences.SectionsActive
If LiningSection.Add("RCAT") = False Then
Output.AddItem ("Section base RCAT not found...")
End If
'Dim label As IRobotLabel
'Set label = robapp.Project.Structure.labels.Create(I_LT_BAR_SECTION, Tunnel_input.Range("C28"))
'robapp.Project.Structure.labels.Store label
With robapp.Project.Structure.Bars
.SetLabel selectionBars, I_LT_BAR_SECTION, Tunnel_input.Range("C28")
.SetLabel selectionBars, I_LT_BAR_MATERIAL, Tunnel_input.Range("C34")
.Update
'.SetStructuralType selectionBars, I_OST_BEAM
'.SetTrussBar selectionBars, False
End With


'-----------------------------------------------------------------
selectionBars.FromText Tunnel_input.Range("G29")
Set LiningSection = robapp.Project.Preferences.SectionsActive
If LiningSection.Add("RCAT") = False Then
Output.AddItem ("Section base RCAT not found...")
End If
'Set label = robapp.Project.Structure.labels.Create(I_LT_BAR_SECTION, Tunnel_input.Range("C29"))
'robapp.Project.Structure.labels.Store label
With robapp.Project.Structure.Bars
.SetLabel selectionBars, I_LT_BAR_SECTION, Tunnel_input.Range("C29")
.SetLabel selectionBars, I_LT_BAR_MATERIAL, Tunnel_input.Range("C35")
'.SetTrussBar selectionBars, True
End With

MsgBox "Elements are implemented with success!"
If Err Then MsgBox "An error occured!", vbCritical
''-----------------------------------------------------------------
''Applying section type (Truss bar)
''-----------------------------------------------------------------
'Set selectionBars = robapp.Project.Structure.Selections.Get(I_OT_BAR)
'selectionBars.FromText Tunnel_input.Range("G28")
'robapp.Project.Structure.Bars
''-----------------------------------------------------
'Set selectionBars = robapp.Project.Structure.Selections.Get(I_OT_BAR)
'selectionBars.FromText Tunnel_input.Range("G29")
'robapp.Project.Structure.Bars.SetTrussBar selectionBars, True


End Sub