Add load to cladding through api

Add load to cladding through api

tiromos
Contributor Contributor
127 Views
5 Replies
Message 1 of 6

Add load to cladding through api

tiromos
Contributor
Contributor

I have  developed the following code which generates a cladding in vba

 

Option Explicit

Sub DrawCladdings_Skeleton()

Dim RobApp As New RobotApplication
'Check if Robot is running
If RobApp.Visible = False Then '
MsgBox ("OPEN ROBOT FIRST!")
Exit Sub
End If
RobApp.Project.New I_PT_SHELL
RobApp.Interactive = False

'Draw the claddings

Dim monobjet As RobotObjObject
Dim moncontour As New RobotGeoContour
Dim monsegment() As New RobotGeoSegmentLine

'Start of loop
ReDim monsegment(1 To 4)
monsegment(1).P1.Set 0, 0, 0
moncontour.Add monsegment(1)
monsegment(2).P1.Set 1, 0, 0
moncontour.Add monsegment(2)
monsegment(3).P1.Set 1, 1, 0
moncontour.Add monsegment(3)
monsegment(4).P1.Set 0, 1, 0
moncontour.Add monsegment(4)

moncontour.Initialize

Set monobjet = RobApp.Project.Structure.Objects.Create(1)
monobjet.Main.Geometry = moncontour
monobjet.Main.Attribs.Meshed = False
monobjet.Main.Attribs.DirZ = 0 ' axe local
monobjet.Main.Attribs.SetDirX I_OLXDDT_CARTESIAN, 1, 0, 0

monobjet.Initialize
monobjet.Update

Dim rbar As Variant
Set rbar = RobApp.Project.Structure.Bars.Get(1)
rbar.SetLabel RobotOM.IRobotLabelType.I_LT_CLADDING, "Two-way"
moncontour.Clear

Set monobjet = Nothing
Set moncontour = Nothing
ReDim monsegment(1 To 1)
Set monsegment(1) = Nothing
'End of loop

RobApp.Interactive = True
End Sub

 

I want to apply a uniform load, but I couldn't find something similar. Any help would be greatly appreciated. Thanks in advance.

 

0 Likes
Accepted solutions (1)
128 Views
5 Replies
Replies (5)
Message 2 of 6

Stephane.kapetanovic
Mentor
Mentor

salut  @tiromos 

Vous pouvez trouver des exemples similaires dans le guide de démarrage de l'API Robot dans le répertoire SDK

Stephanekapetanovic_0-1756394395006.png

Sub CreateCladding()
  Dim RobApp As RobotApplication: Set RobApp = New RobotApplication
  If RobApp.Visible <> -1 Then
    MsgBox ("OPEN ROBOT FIRST!"): Set RobotApp = Nothing: Exit Sub
  End If

  Dim points As RobotPointsArray
  Set points = RobApp.CmpntFactory.Create(I_CT_POINTS_ARRAY)
  points.SetSize 4
  With points
    .Set 1, 0, 0, 0
    .Set 2, 1, 0, 0
    .Set 3, 1, 1, 0
    .Set 4, 0, 1, 0
  End With
  
  RobApp.Project.New I_PT_SHELL
  With RobApp.Project.Structure.Objects
    .CreateContour 1, points
    With .Get(1)
      .SetLabel I_LT_CLADDING, "Two-way"
      .Update
    End With
  End With
  
  Dim CaseLive As RobotSimpleCase
  Set CaseLive = RobApp.Project.Structure.Cases.CreateSimple(1, "Live", I_CN_EXPLOATATION, I_CAT_STATIC_LINEAR)
  With CaseLive.Records.Create(I_LRT_UNIFORM)
    .SetValue I_URV_PZ, -10000
    .Objects.FromText 1
  End With
   
  Set RobApp = Nothing
End Sub

 Cordialement

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
0 Likes
Message 3 of 6

tiromos
Contributor
Contributor

The key word being "similar", I have already tried to use the related code from getting started:

 

Dim LoadRecord As RobotLoadRecord
Dim CaseLive As RobotSimpleCase
Set CaseLive = str.Cases.CreateSimple(2, "Live", I_CN_EXPLOATATION,
I_CAT_STATIC_LINEAR)
Uniform = CaseLive.Records.New(I_LRT_UNIFORM)
Set LoadRecord = CaseLive.Records.Get(Uniform)
LoadRecord.SetValue I_URV_PX, 0
LoadRecord.SetValue I_URV_PY, 0
LoadRecord.SetValue I_URV_PZ, -10000
LoadRecord.Objects.FromText (1)'

 

But couldn't make it work

0 Likes
Message 4 of 6

Stephane.kapetanovic
Mentor
Mentor
Accepted solution

try my code first as it is consistent and concise

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
Message 5 of 6

tiromos
Contributor
Contributor

1. Yes, it does work, thank you very much. Could you please add one more load and one combination to the code?

2. try my code first as it is consistent and concise -> truth be told, my code seemed like black magic to me. 

0 Likes
Message 6 of 6

Stephane.kapetanovic
Mentor
Mentor

1 - What loads?  (API) Load Combinations , Contour Loads , Linear Load 2P 
2 - Your code creates a panel as well except the cladding label. Don't worry. If it's a panel without curves, the CreateContour method is simpler and faster.

Stéphane Kapetanovic

Did you find this post helpful? If it gave you one or more solutions,
don't forget to accept the solution and leave a < like !
EESignature
0 Likes