<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Uniform moment in bar in local coordinate system with API in Robot Structural Analysis Forum</title>
    <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/uniform-moment-in-bar-in-local-coordinate-system-with-api/m-p/11668531#M7966</link>
    <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/585410"&gt;@LuisCRodrigues&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here after an example to set local loads (uniform and moment distributed moments)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Stephanekapetanovic_0-1673361705544.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1160807i16AED6636E0B89A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Stephanekapetanovic_0-1673361705544.png" alt="Stephanekapetanovic_0-1673361705544.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub CreateBarsUniformAndMomentLocalLoad()
  Dim RobApp As IRobotApplication: Set RobApp = New RobotApplication
  If Not (RobApp.Visible = -1 And RobApp.Project.IsActive = -1) Then
    Set RobApp = Nothing: Exit Sub
  End If
  
  Dim CasSel As RobotSelection, CasCol As RobotCaseCollection, Cas As IRobotCase, FirstAvailableCase As RobotSimpleCase
  Dim Bars As RobotBarServer, Bar As RobotBar, TbForces() As Double: mtx(0 To 2, 0 To 2) As Double
  With RobApp.Project.Structure
    Set Bars = .Bars
    Set CasSel = .Selections.CreatePredefined(I_PS_CASE_SIMPLE_CASES)
    Set CasCol = .Cases.GetMany(CasSel)
  End With
  
  For i = 1 To CasCol.Count
    Set Cas = CasCol.Get(i)
    If Cas.AnalizeType &amp;lt;&amp;gt; I_CAT_DYNAMIC_MODAL Then
      Set FirstAvailableCase = Cas
      With FirstAvailableCase.Records.Create(I_LRT_BAR_UNIFORM)
        .Description = "New Uniform Load": .Objects.FromText "1 2": .SetValue IRobotBarUniformRecordValues.I_BURV_PY, -5000: .SetValue I_BURV_LOCAL, 1
      End With
      With FirstAvailableCase.Records.Create(I_LRT_BAR_MOMENT_DISTRIBUTED)
        .Description = "New Distributed Moment Load": .Objects.FromText "3 4": .SetValue IRobotBarMomentDistributedRecordValues.I_BMDRV_MX, -5000
      End With
      
      TbBarNos = Array(5, 6)
      For j = 0 To UBound(TbBarNos)
        BarNo = TbBarNos(j): Set Bar = Bars.Get(BarNo)
        Bar.GetLocalMtx mtx(0, 0), mtx(0, 1), mtx(0, 2), mtx(1, 0), mtx(1, 1), mtx(1, 2), mtx(2, 0), mtx(2, 1), mtx(2, 2)
        TbForces = SetForces(0, 0, 0, -5000, 0, 0): Transform TbForces, Invert(mtx)
        With FirstAvailableCase.Records.Create(I_LRT_BAR_MOMENT_DISTRIBUTED)
          .Description = "New Distributed Moment Load - Local": .Objects.FromText Str(BarNo)
          .SetValue I_BMDRV_MX, TbForces(3): .SetValue I_BMDRV_MY, TbForces(4): .SetValue I_BMDRV_MZ, TbForces(5)
        End With
      Next j
      Exit For
    End If
  Next i
  Set RobApp = Nothing
End Sub&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;Function SetForces(Fx As Double, Fy As Double, Fz As Double, Mx As Double, My As Double, Mz As Double) As Double()
  Dim TbForces(0 To 5) As Double: Tb = Array(Fx, Fy, Fz, Mx, My, Mz)
  For I = 0 To 5: TbForces(I) = Tb(I): Next
  SetForces = TbForces
End Function&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;Function Invert(m() As Double) As Double()
  Dim rm(0 To 2, 0 To 2) As Double
  For I = 0 To 2
    For j = 0 To 2: rm(I, j) = m(j, I): Next j
  Next
  Invert = rm
End Function&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;Sub Transform(v() As Double, m() As Double)
  Dim vt(0 To 5) As Double
  For I = 0 To 2
    For j = 0 To 2
      cm = m(I, j): vt(I) = vt(I) + v(j) * cm: vt(I + 3) = vt(I + 3) + v(j + 3) * cm
    Next j
  Next I
  For I = 0 To 5: v(I) = vt(I): Next I
End Sub&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;Function GetLocalMtx(x_ As RobotGeoPoint3D, y_ As RobotGeoPoint3D, z_ As RobotGeoPoint3D) As Double()
  Dim m(0 To 2, 0 To 2) As Double
  m(0, 0) = x_.X: m(0, 1) = x_.Y: m(0, 2) = x_.Z: m(1, 0) = y_.X: m(1, 1) = y_.Y: m(1, 2) = y_.Z: m(2, 0) = z_.X: m(2, 1) = z_.Y: m(2, 2) = z_.Z
  GetLocalMtx = m
End Function&lt;/LI-CODE&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
    <pubDate>Sat, 27 Sep 2025 10:00:09 GMT</pubDate>
    <dc:creator>Stephane.kapetanovic</dc:creator>
    <dc:date>2025-09-27T10:00:09Z</dc:date>
    <item>
      <title>Uniform moment in bar in local coordinate system with API</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/uniform-moment-in-bar-in-local-coordinate-system-with-api/m-p/11667550#M7965</link>
      <description>&lt;P&gt;Hi all,&lt;BR /&gt;I'm trying to generate uniform loads and uniform moments in bars with API.&lt;BR /&gt;For uniform loads, the member "I_BURV_LOCAL" defines if the loads values refer to the global or local coordinate system.&lt;BR /&gt;For uniform moments, it seems we can only create load records in the global coordinate system with API.&lt;BR /&gt;Does anyone know how to impose the local coordinate system?&lt;BR /&gt;&lt;BR /&gt;Thanks in advance.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 09 Jan 2023 22:20:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/uniform-moment-in-bar-in-local-coordinate-system-with-api/m-p/11667550#M7965</guid>
      <dc:creator>LuisCRodrigues</dc:creator>
      <dc:date>2023-01-09T22:20:33Z</dc:date>
    </item>
    <item>
      <title>Re: Uniform moment in bar in local coordinate system with API</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/uniform-moment-in-bar-in-local-coordinate-system-with-api/m-p/11668531#M7966</link>
      <description>&lt;P&gt;hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/585410"&gt;@LuisCRodrigues&lt;/a&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;here after an example to set local loads (uniform and moment distributed moments)&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Stephanekapetanovic_0-1673361705544.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1160807i16AED6636E0B89A3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Stephanekapetanovic_0-1673361705544.png" alt="Stephanekapetanovic_0-1673361705544.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Sub CreateBarsUniformAndMomentLocalLoad()
  Dim RobApp As IRobotApplication: Set RobApp = New RobotApplication
  If Not (RobApp.Visible = -1 And RobApp.Project.IsActive = -1) Then
    Set RobApp = Nothing: Exit Sub
  End If
  
  Dim CasSel As RobotSelection, CasCol As RobotCaseCollection, Cas As IRobotCase, FirstAvailableCase As RobotSimpleCase
  Dim Bars As RobotBarServer, Bar As RobotBar, TbForces() As Double: mtx(0 To 2, 0 To 2) As Double
  With RobApp.Project.Structure
    Set Bars = .Bars
    Set CasSel = .Selections.CreatePredefined(I_PS_CASE_SIMPLE_CASES)
    Set CasCol = .Cases.GetMany(CasSel)
  End With
  
  For i = 1 To CasCol.Count
    Set Cas = CasCol.Get(i)
    If Cas.AnalizeType &amp;lt;&amp;gt; I_CAT_DYNAMIC_MODAL Then
      Set FirstAvailableCase = Cas
      With FirstAvailableCase.Records.Create(I_LRT_BAR_UNIFORM)
        .Description = "New Uniform Load": .Objects.FromText "1 2": .SetValue IRobotBarUniformRecordValues.I_BURV_PY, -5000: .SetValue I_BURV_LOCAL, 1
      End With
      With FirstAvailableCase.Records.Create(I_LRT_BAR_MOMENT_DISTRIBUTED)
        .Description = "New Distributed Moment Load": .Objects.FromText "3 4": .SetValue IRobotBarMomentDistributedRecordValues.I_BMDRV_MX, -5000
      End With
      
      TbBarNos = Array(5, 6)
      For j = 0 To UBound(TbBarNos)
        BarNo = TbBarNos(j): Set Bar = Bars.Get(BarNo)
        Bar.GetLocalMtx mtx(0, 0), mtx(0, 1), mtx(0, 2), mtx(1, 0), mtx(1, 1), mtx(1, 2), mtx(2, 0), mtx(2, 1), mtx(2, 2)
        TbForces = SetForces(0, 0, 0, -5000, 0, 0): Transform TbForces, Invert(mtx)
        With FirstAvailableCase.Records.Create(I_LRT_BAR_MOMENT_DISTRIBUTED)
          .Description = "New Distributed Moment Load - Local": .Objects.FromText Str(BarNo)
          .SetValue I_BMDRV_MX, TbForces(3): .SetValue I_BMDRV_MY, TbForces(4): .SetValue I_BMDRV_MZ, TbForces(5)
        End With
      Next j
      Exit For
    End If
  Next i
  Set RobApp = Nothing
End Sub&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;Function SetForces(Fx As Double, Fy As Double, Fz As Double, Mx As Double, My As Double, Mz As Double) As Double()
  Dim TbForces(0 To 5) As Double: Tb = Array(Fx, Fy, Fz, Mx, My, Mz)
  For I = 0 To 5: TbForces(I) = Tb(I): Next
  SetForces = TbForces
End Function&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;Function Invert(m() As Double) As Double()
  Dim rm(0 To 2, 0 To 2) As Double
  For I = 0 To 2
    For j = 0 To 2: rm(I, j) = m(j, I): Next j
  Next
  Invert = rm
End Function&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;Sub Transform(v() As Double, m() As Double)
  Dim vt(0 To 5) As Double
  For I = 0 To 2
    For j = 0 To 2
      cm = m(I, j): vt(I) = vt(I) + v(j) * cm: vt(I + 3) = vt(I + 3) + v(j + 3) * cm
    Next j
  Next I
  For I = 0 To 5: v(I) = vt(I): Next I
End Sub&lt;/LI-CODE&gt;&lt;LI-CODE lang="general"&gt;Function GetLocalMtx(x_ As RobotGeoPoint3D, y_ As RobotGeoPoint3D, z_ As RobotGeoPoint3D) As Double()
  Dim m(0 To 2, 0 To 2) As Double
  m(0, 0) = x_.X: m(0, 1) = x_.Y: m(0, 2) = x_.Z: m(1, 0) = y_.X: m(1, 1) = y_.Y: m(1, 2) = y_.Z: m(2, 0) = z_.X: m(2, 1) = z_.Y: m(2, 2) = z_.Z
  GetLocalMtx = m
End Function&lt;/LI-CODE&gt;
&lt;P&gt;Best Regards&lt;/P&gt;</description>
      <pubDate>Sat, 27 Sep 2025 10:00:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/uniform-moment-in-bar-in-local-coordinate-system-with-api/m-p/11668531#M7966</guid>
      <dc:creator>Stephane.kapetanovic</dc:creator>
      <dc:date>2025-09-27T10:00:09Z</dc:date>
    </item>
    <item>
      <title>Re: Uniform moment in bar in local coordinate system with API</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/uniform-moment-in-bar-in-local-coordinate-system-with-api/m-p/11668658#M7967</link>
      <description>&lt;P&gt;Hi&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6876621"&gt;@Stephane.kapetanovic&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a very interesting approach.&lt;BR /&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 10:58:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/uniform-moment-in-bar-in-local-coordinate-system-with-api/m-p/11668658#M7967</guid>
      <dc:creator>LuisCRodrigues</dc:creator>
      <dc:date>2023-01-10T10:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Uniform moment in bar in local coordinate system with API</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/uniform-moment-in-bar-in-local-coordinate-system-with-api/m-p/11669179#M7968</link>
      <description>&lt;P&gt;msg 2 updated&lt;/P&gt;</description>
      <pubDate>Mon, 05 Jun 2023 14:28:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/uniform-moment-in-bar-in-local-coordinate-system-with-api/m-p/11669179#M7968</guid>
      <dc:creator>Stephane.kapetanovic</dc:creator>
      <dc:date>2023-06-05T14:28:34Z</dc:date>
    </item>
    <item>
      <title>Re: Uniform moment in bar in local coordinate system with API</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/uniform-moment-in-bar-in-local-coordinate-system-with-api/m-p/11669322#M7969</link>
      <description>&lt;P&gt;I understand you corrected how the moments in the local coordinate system are translated to the global coordinate system. I was precisely working in the same direction.&lt;BR /&gt;Thank you for your time. This will be very helpful.&lt;/P&gt;&lt;P&gt;It's just a workaround, but the real question is why the API can't set the load as local as it does for others.&lt;/P&gt;&lt;P&gt;To be seen by Autodesk Team? Maybe &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/589195"&gt;@Rafal.Gaweda&lt;/a&gt; could comment.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jan 2023 16:14:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/uniform-moment-in-bar-in-local-coordinate-system-with-api/m-p/11669322#M7969</guid>
      <dc:creator>LuisCRodrigues</dc:creator>
      <dc:date>2023-01-10T16:14:34Z</dc:date>
    </item>
  </channel>
</rss>

