Hi
For those who might be interested I am attaching xls file with macro for objects geometry modifications.
One button to import geometry (characteriscic points coordinates) of selected objects (lines, polylines, arc, circles, panels), second - to update their geometry basing on data in Excell.
NOTE: modify only cells with coordinates.
Solved! Go to Solution.
Solved by Rafal.Gaweda. Go to Solution.
Hi @Anonymous
What do you mean by "generic"?
This was example for concrete beam section.
Cells(2, 10) = RBSCRD.GetValue(I_BSCDV_BEAM_H)
@Rafal.Gaweda Concrete beam section is generic for me!!!
But still does not work something...
Dim RLabel As RobotLabel Dim RBSD As RobotBarSectionData Dim RBSCRD As RobotBarSectionConcreteData Dim LabelName As String Set RBSD = RLabel.Data Set RBSCRD = RBSD.Concrete Cells(10, 10) = RBSCRD.GetValue(I_BSCDV_BEAM_B) Cells(11, 10) = RBSCRD.GetValue(I_BSCDV_BEAM_H)
why do I get always a beam 30 x 50? Also I do not understand why this row:
Set RLabel = RobApp.Project.Structure.Labels.Get(I_LT_BAR_SECTION, "B 30x50")
the bar section can have whatever dimensions.
Hi @Anonymous
This was JUST EXAMPLE.
Replace "B ...." by labelname \ string.
@Rafal.Gaweda I have tried but...still problem
Set RLabel = RobApp.Project.Structure.Labels.Get(I_LT_BAR_SECTION, "Labelname") Set Labelname = String
@Anonymous
Dim Labelname as String Labelname = "B 30x50" ' here you have to give \ input real section name Set RLabel = RobApp.Project.Structure.Labels.Get(I_LT_BAR_SECTION, Labelname)
Thanks @Rafal.Gaweda for you patience!
What I do not understand if it is mandatory to write a Labelname (e.g. "B 30x50") or is it possible to skip it. Because like this I need to know, before importing dimensions into excel, the labelname of the section. I cannot import dimensions without know the labelname, nevertheless each time I have to change LabelName in the code.
For example, if you want to get thickness value for panels, you do not need to know the panel's thickness name.
the code is:
Set THData = Obj.GetLabel(I_LT_PANEL_THICKNESS).Data If (THData.ThicknessType = I_TT_HOMOGENEOUS) Then Set HomoThickData = THData.Data If (HomoThickData.Type = I_THT_CONSTANT) Then Cells(Row, 2) = HomoThickData.ThickConst
Now, is it a code where I can get bar section dimensions directly as we do for panel?
Hi @Anonymous
Sure you can do it in similar way.
Example code :
Dim Bar As RobotBar Dim SectionLabel As RobotLabel Dim RBSD As RobotBarSectionData Dim RBSCRD As RobotBarSectionConcreteData Set Bar = RobApp.Project.Structure.Bars.Get(1) Set SectionLabel = Bar.GetLabel(I_LT_BAR_SECTION) Set RBSD = SectionLabel.Data If (RBSD.ShapeType = I_BSST_CONCR_BEAM_RECT) Then Set RBSCRD = RBSD.Concrete Cells(1, 1) = RBSCRD.GetValue(I_BSCDV_BEAM_B) Cells(2, 1) = RBSCRD.GetValue(I_BSCDV_BEAM_H) End If
Hi @Anonymous
Do you have bar number 1 in your model?
The example code works for bar with number 1.
@Anonymous
Do you have such line in your code:
Dim Bar As RobotBar
or
Dim Bar As IRobotBar
Can It works for any bar?
Because If i do not put any bars number between brackets I do not get value
Set Bar = RobApp.Project.Structure.Bars.Get()
Hi @Anonymous
If "any" means every RC Beam with rectangular section :
Dim Bar As RobotBar Dim SectionLabel As RobotLabel Dim RBSD As RobotBarSectionData Dim RBSCRD As RobotBarSectionConcreteData Dim BarCollection As RobotBarCollection Set BarCollection = RobApp.Project.Structure.Bars.GetAll Row = 1 For I = 1 To BarCollection.Count Set Bar = BarCollection.Get(I) Set SectionLabel = Bar.GetLabel(I_LT_BAR_SECTION) Set RBSD = SectionLabel.Data If (RBSD.ShapeType = I_BSST_CONCR_BEAM_RECT) Then Set RBSCRD = RBSD.Concrete Cells(Row, 1) = RBSCRD.GetValue(I_BSCDV_BEAM_B) Cells(Row, 2) = RBSCRD.GetValue(I_BSCDV_BEAM_H) Row = Row + 1 End If Next I
Thank so much @Rafal.Gaweda,
if you could do the last effort would be great!
Is it possible to import only bars that are selected in Robot, instead of importing all of them please?
Hi @Anonymous
Have fun:
Dim BarSelection As RobotSelection Dim BarCollection As RobotBarCollection Set BarSelection = RobApp.Project.Structure.Selections.Get(I_OT_BAR) Set BarCollection = RobApp.Project.Structure.Bars.GetMany(BarSelection)
Sorry, I have a problem.
When i click in Update objects appears:
What I do?
Thanks.
Hi @Anonymous
My guess is You are running more than 1 Robot at the same time while using this macro .
API macros \ addins work fine only while 1 Robot is running.
Thanks for your answer.
I only have one robot running.
The version of robot is 2016, have any problem?
Can't find what you're looking for? Ask the community or share your knowledge.