<?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: How to enter Robot API through Python in Robot Structural Analysis Forum</title>
    <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/7997752#M32495</link>
    <description>&lt;P&gt;Thank you, I've read it (as any other on this forum with Python tag:).&lt;/P&gt;&lt;P&gt;This topic does not help much. e.g. why&amp;amp;when in Python brackets should be deleted? - user in last post uses command&lt;/P&gt;&lt;PRE&gt;RobApp.Project.Structure.Nodes.FreeNumber&lt;/PRE&gt;&lt;DIV class="lia-message-author-rank lia-component-author-rank"&gt;&amp;nbsp;While in API, this command has '()'&amp;nbsp;&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Apiforum.PNG" style="width: 914px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/499721iC4875C6DDFCF2121/image-size/large?v=v2&amp;amp;px=999" role="button" title="Apiforum.PNG" alt="Apiforum.PNG" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;but in this case (Python):&lt;BR /&gt;&lt;PRE&gt;# Connect to the running instance of Robot Structural Analysis
application = RobotApplicationClass()&lt;/PRE&gt;brackets appear.&lt;/DIV&gt;</description>
    <pubDate>Sat, 12 May 2018 19:25:49 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2018-05-12T19:25:49Z</dc:date>
    <item>
      <title>How to enter Robot API through Python</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/7997653#M32493</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I'm looking for (kind of) guidelines/tutorial on how to translate Robot API commands into Python script.&lt;/P&gt;&lt;P&gt;What are main &lt;SPAN class="short_text"&gt;&lt;SPAN class=""&gt;principles, what rules to follow etc.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;This forum is rich of API content but there's only few threads about Python. I've read them all and found few information: how to add references or create bars/nodes/labels.&lt;/P&gt;&lt;P&gt;I see its similar e.g.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;Dim robapp As New RobotApplication
Dim section As RobotLabel
Set section = robapp.Project.Structure.Labels.Create(I_LT_BAR_SECTION, "pipe")&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;in Python equals to:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;robapp = RobotApplicationClass()
section = robapp.Project.Structure.Labels.Create(&lt;STRONG&gt;IRobotLabelType.&lt;/STRONG&gt;I_BAR_SECTION, "VALUE")&lt;/PRE&gt;&lt;P&gt;but why&amp;nbsp; IRobotLabelType. jumps into brackets?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;And how to translate the rest API script:&lt;/P&gt;&lt;PRE&gt;Dim sectionData As RobotBarSectionData
Set sectionData = section.Data
sectionData.ShapeType = I_BSST_USER_CIRC_FILLED
sectionData.Type = I_BST_NS_TUBE
Dim ns As RobotBarSectionNonstdData
Set ns = sectionData.CreateNonstd(0)
ns.SetValue I_BSNDV_TUBE_D, 0.3
sectionData.CalcNonstdGeometry
robapp.Project.Structure.Labels.Store section&lt;/PRE&gt;&lt;P&gt;Python:&lt;/P&gt;&lt;PRE&gt;section.Data.ShapeType = I_BSST_USER_CIRC_FILLED
section.Data.Type = I_BST_NS_TUBE
ns = section.Data.CreateNonstd(0)
ns.SetValue(IRobotBarSectionNonstd(0).I_BSNDV_TUBE_D, 0.3)
section.Data.CalcNonstdGeometry
labels.Store section&lt;/PRE&gt;&lt;P&gt;?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Python allows me to use Dynamo/Robot&amp;nbsp;cooperability much more effective than "Structural Analysis" package.&lt;/P&gt;&lt;P&gt;So.. what to start with ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;BR /&gt;Marcin&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 12 May 2018 17:32:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/7997653#M32493</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-12T17:32:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to enter Robot API through Python</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/7997723#M32494</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous,&lt;/P&gt;
&lt;P&gt;Maybe this topic will help&amp;nbsp;&lt;A href="https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/7221364" target="_blank"&gt;https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/7221364&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 12 May 2018 18:37:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/7997723#M32494</guid>
      <dc:creator>Romanich</dc:creator>
      <dc:date>2018-05-12T18:37:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to enter Robot API through Python</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/7997752#M32495</link>
      <description>&lt;P&gt;Thank you, I've read it (as any other on this forum with Python tag:).&lt;/P&gt;&lt;P&gt;This topic does not help much. e.g. why&amp;amp;when in Python brackets should be deleted? - user in last post uses command&lt;/P&gt;&lt;PRE&gt;RobApp.Project.Structure.Nodes.FreeNumber&lt;/PRE&gt;&lt;DIV class="lia-message-author-rank lia-component-author-rank"&gt;&amp;nbsp;While in API, this command has '()'&amp;nbsp;&amp;nbsp; &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;BR /&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Apiforum.PNG" style="width: 914px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/499721iC4875C6DDFCF2121/image-size/large?v=v2&amp;amp;px=999" role="button" title="Apiforum.PNG" alt="Apiforum.PNG" /&gt;&lt;/span&gt;&lt;BR /&gt;&lt;BR /&gt;but in this case (Python):&lt;BR /&gt;&lt;PRE&gt;# Connect to the running instance of Robot Structural Analysis
application = RobotApplicationClass()&lt;/PRE&gt;brackets appear.&lt;/DIV&gt;</description>
      <pubDate>Sat, 12 May 2018 19:25:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/7997752#M32495</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-12T19:25:49Z</dc:date>
    </item>
    <item>
      <title>Re: How to enter Robot API through Python</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/7998020#M32496</link>
      <description>&lt;P&gt;I would not recommend to delete&amp;nbsp;the nodes using API&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/robot-structural-analysis-forum/api-nodes-freenumber-after-nodes-deletemany-or-nodes-delete/td-p/7755065" target="_blank"&gt;https://forums.autodesk.com/t5/robot-structural-analysis-forum/api-nodes-freenumber-after-nodes-deletemany-or-nodes-delete/td-p/7755065&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 13 May 2018 03:55:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/7998020#M32496</guid>
      <dc:creator>Romanich</dc:creator>
      <dc:date>2018-05-13T03:55:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to enter Robot API through Python</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/7998152#M32497</link>
      <description>&lt;P&gt;hey &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/559029"&gt;@Romanich&lt;/a&gt;, you missed the point. I don't want to use this particular command, I mention this example to show difference in code between Python/API&amp;nbsp;&amp;nbsp; - brackets.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;The issue is still up to date, anyone with Python/API experience is very welcome to share his knowledge.&lt;/P&gt;</description>
      <pubDate>Sun, 13 May 2018 08:49:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/7998152#M32497</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-05-13T08:49:21Z</dc:date>
    </item>
    <item>
      <title>Re: How to enter Robot API through Python</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/9495789#M32498</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am also encountering a similar problem. I managed to use part of &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/705292"&gt;@Artur.Kosakowski&lt;/a&gt;'s code as per post above, but after calling the API it is not possible to go further.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I posted a similar query here:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/robot-structural-analysis-forum/api-new-project-creation-python/m-p/9490299#M81448" target="_blank" rel="noopener"&gt;https://forums.autodesk.com/t5/robot-structural-analysis-forum/api-new-project-creation-python/m-p/9490299#M81448&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;as it looks like the API is connected but further operations are not allowed. It would be very helpful to get some feedback on this topics, I agree with&amp;nbsp;@Anonymous&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance!&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 11:22:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/9495789#M32498</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-05-06T11:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to enter Robot API through Python</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/9496542#M32499</link>
      <description>&lt;P&gt;Python's syntax requires brackets for any function call. I've put a sample function I wrote recently to help understand how it works.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;def createRelease(name, start, end):
    struct =  rb.Project.Structure
    if not struct: return None
    
    start = strToReleaseParams(start) if isinstance(start, str) else start
    end = strToReleaseParams(end) if isinstance(end, str) else end
    

    start_release = {
        "UX": start[0],
        "UY": start[1],
        "UZ": start[2],
        "RX": start[3],
        "RY": start[4],
        "RZ": start[5],
    }

    end_release = {
        "UX": end[0],
        "UY": end[1],
        "UZ": end[2],
        "RX": end[3],
        "RY": end[4],
        "RZ": end[5]
    }

    release_values = {
        True: IRobotBarEndReleaseValue.I_BERV_STD,
        False: IRobotBarEndReleaseValue.I_BERV_NONE
    }

    labels = struct.Labels

    release = IRobotLabel(labels.Create(IRobotLabelType.I_LT_BAR_RELEASE, name))
    data = IRobotBarReleaseData(release.Data)
    start_data, end_data = IRobotBarEndReleaseData(data.StartNode), IRobotBarEndReleaseData(data.EndNode)

    for data, input in zip([start_data, end_data], [start_release, end_release]):
        for dof, val in input.items():
            setattr(data, dof, release_values[bool(val)])

    labels.StoreWithName(release, name)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 06 May 2020 15:17:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/how-to-enter-robot-api-through-python/m-p/9496542#M32499</guid>
      <dc:creator>JacquesGaudin</dc:creator>
      <dc:date>2020-05-06T15:17:06Z</dc:date>
    </item>
  </channel>
</rss>

