<?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: Robot&amp;amp;IronPython in Robot Structural Analysis Forum</title>
    <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/11940890#M43986</link>
    <description>&lt;P&gt;@Anonymous&amp;nbsp; Is this working? I'm getting the following error .please comment&lt;/P&gt;&lt;LI-CODE lang="general"&gt; clr.AddReferenceToFileAndPath('C:\Program Files\Autodesk\Robot Structural Analysis Professional 2023\Exe\Interop.RobotOM.dll')
AttributeError: module 'clr' has no attribute 'AddReferenceToFileAndPath'&lt;/LI-CODE&gt;</description>
    <pubDate>Thu, 04 May 2023 09:31:14 GMT</pubDate>
    <dc:creator>ArunNDinesh</dc:creator>
    <dc:date>2023-05-04T09:31:14Z</dc:date>
    <item>
      <title>Robot&amp;IronPython</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/7221364#M43981</link>
      <description>&lt;P&gt;Help to connect to the Robot COM, what to write here where the question marks?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;app = System.Runtime.InteropServices.Marshal.GetActiveObject(???)&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jul 2017 06:31:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/7221364#M43981</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-12T06:31:45Z</dc:date>
    </item>
    <item>
      <title>Re: Robot&amp;IronPython</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/7221596#M43982</link>
      <description>&lt;P&gt;Hi&amp;nbsp;@Anonymous&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;&lt;BR /&gt;
&lt;P&gt;Help to connect to the Robot COM, what to write here where the question marks?&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;app = System.Runtime.InteropServices.Marshal.GetActiveObject(???)&lt;/PRE&gt;
&lt;P&gt;“Robot.Application”&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a sample code which I hope should &amp;nbsp;create a node label using IronPython&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;import clr&lt;/P&gt;
&lt;P&gt;# add Robot Structural Analysis API reference&lt;/P&gt;
&lt;P&gt;clr.AddReferenceToFileAndPath(path to &amp;nbsp;interop.RobotOM.dll")&lt;/P&gt;
&lt;P&gt;# add needed import to be able to use Robot Structural Analysis objects&lt;/P&gt;
&lt;P&gt;from RobotOM import *&lt;/P&gt;
&lt;P&gt;from System import Object&lt;/P&gt;
&lt;P&gt;# Connect to the running instance of Robot Structural Analysis&lt;/P&gt;
&lt;P&gt;application = RobotApplicationClass()&lt;/P&gt;
&lt;P&gt;# Get a reference of the current project&lt;/P&gt;
&lt;P&gt;project = application.Project&lt;/P&gt;
&lt;P&gt;# Get a reference of the current model&lt;/P&gt;
&lt;P&gt;structure = project.Structure&lt;/P&gt;
&lt;P&gt;# Get a reference of the label server&lt;/P&gt;
&lt;P&gt;labels = structure.Labels&lt;/P&gt;
&lt;P&gt;nodeSupportName &amp;nbsp;= ”testName”&lt;/P&gt;
&lt;P&gt;# create a new label of type support node with the name&lt;/P&gt;
&lt;P&gt;out = labels.Create(IRobotLabelType.I_LT_NODE_SUPPORT, nodeSupportName)&lt;/P&gt;
&lt;P&gt;# assign the node support definition to the Robot Structural Analysis object&lt;/P&gt;
&lt;P&gt;out.Data.UX = false&lt;/P&gt;
&lt;P&gt;out.Data.UY = false&lt;/P&gt;
&lt;P&gt;out.Data.UZ = false&lt;/P&gt;
&lt;P&gt;out.Data.RX = false&lt;/P&gt;
&lt;P&gt;out.Data.RY = false&lt;/P&gt;
&lt;P&gt;out.Data.RZ = false&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;# store the new created label in the open document&lt;/P&gt;
&lt;P&gt;labels.Store(out)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;EM&gt;If you find your post answered press the Accept as Solution button please. This will help other users to find solutions much faster. Thank you.&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 08:37:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/7221596#M43982</guid>
      <dc:creator>Artur.Kosakowski</dc:creator>
      <dc:date>2017-07-12T08:37:51Z</dc:date>
    </item>
    <item>
      <title>Re: Robot&amp;IronPython</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/7221636#M43983</link>
      <description>&lt;P&gt;Don`t work&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;import System
app = System.Runtime.InteropServices.Marshal.GetActiveObject(“Robot.Application”)

print app&lt;/PRE&gt;
&lt;P&gt;&lt;EM&gt;Traceback (most recent call last):&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; File "I:\PythonScripts\WORK\0022 RobotVariants.py", line 6, in &amp;lt;module&amp;gt;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;EnvironmentError: System.Runtime.InteropServices.COMException (0x800401E3):&lt;/EM&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 08:51:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/7221636#M43983</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-12T08:51:34Z</dc:date>
    </item>
    <item>
      <title>Re: Robot&amp;IronPython</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/7221665#M43984</link>
      <description>&lt;P&gt;But this is not a problem, because you showed me how to connect to the open ROBOT project. Thank you very much!&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jul 2017 09:05:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/7221665#M43984</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-12T09:05:57Z</dc:date>
    </item>
    <item>
      <title>Re: Robot&amp;IronPython</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/7222388#M43985</link>
      <description>&lt;P&gt;My first Python script for Robot&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;import clr
# add Robot Structural Analysis API reference
clr.AddReferenceToFileAndPath("c:/Program Files/Autodesk/Autodesk Robot Structural Analysis Professional 2016/System/Exe/Interop.RobotOM.dll")
# add needed import to be able to use Robot Structural Analysis objects
from RobotOM import *
# Connect to the running instance of Robot Structural Analysis
Robapp = RobotApplicationClass()
# Get a reference of the current project
Robproj = Robapp.Project
# Get a reference of the current model
rStruct = Robproj.Structure
n1 = rStruct.Nodes.FreeNumber
rStruct.Nodes.Create(n1,0.0,0.0,0.0)
for i in range(5):
	nn = rStruct.Nodes.FreeNumber
	rStruct.Nodes.Create(nn,5.0,0.40*i,0.0)
	nb = rStruct.bars.FreeNumber
	rStruct.bars.Create(nb, n1, nn)&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Jul 2017 13:54:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/7222388#M43985</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2017-07-12T13:54:36Z</dc:date>
    </item>
    <item>
      <title>Re: Robot&amp;IronPython</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/11940890#M43986</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp; Is this working? I'm getting the following error .please comment&lt;/P&gt;&lt;LI-CODE lang="general"&gt; clr.AddReferenceToFileAndPath('C:\Program Files\Autodesk\Robot Structural Analysis Professional 2023\Exe\Interop.RobotOM.dll')
AttributeError: module 'clr' has no attribute 'AddReferenceToFileAndPath'&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 04 May 2023 09:31:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/11940890#M43986</guid>
      <dc:creator>ArunNDinesh</dc:creator>
      <dc:date>2023-05-04T09:31:14Z</dc:date>
    </item>
    <item>
      <title>Re: Robot&amp;IronPython</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/12275534#M43987</link>
      <description>&lt;P&gt;There seems to be multiple clr modules and it could be, that you aren't using the correct module. Have you tried the following:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;pip uninstall clr
pip install pythonnet&lt;/LI-CODE&gt;&lt;P&gt;Then import clr as you have been (strange, I know).&amp;nbsp;Using the clr from pip install clr and printing the directories:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;print(dir(clr))

['StyleBuilder', '__builtins__', '__cached__', '__doc__', '__file__', '__loader__', '__module__', '__name__', '__package__', '__path__', '__spec__', '_styles', 'black', 'blue', 'bold', 'cyan', 'dim', 'green', 'hidden', 'inverse', 'italic', 'key', 'light_black', 'light_blue', 'light_cyan', 'light_green', 'light_magenta', 'light_red', 'light_white', 'light_yellow', 'magenta', 'on_black', 'on_blue', 'on_cyan', 'on_green', 'on_light_black', 'on_light_blue', 'on_light_cyan', 'on_light_green', 'on_light_magenta', 'on_light_red', 'on_light_white', 'on_light_yellow', 'on_magenta', 'on_red', 'on_white', 'on_yellow', 'red', 'strikethrough', 'style_builder', 'sys', 'underline', 'value', 'white', 'yellow']&lt;/LI-CODE&gt;&lt;P&gt;Then uninstalling clr and installing pythonnet:&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import clr
print(dir(clr))

['AddReference', 'FindAssembly', 'GetClrType', 'ListAssemblies', '__class__', '__doc__', '__file__', '__loader__', '__name__', '__package__', '__spec__', '__version__', '_add_pending_namespaces', '_available_namespaces', '_extras', '_load_clr_module', 'clrmethod', 'clrproperty', 'getPreload', 'loader', 'setPreload']&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It seems the function name has changed to AddReference(). However, this should work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Let me know!&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 15:44:38 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/12275534#M43987</guid>
      <dc:creator>bjoern_steinhagen8PD9X</dc:creator>
      <dc:date>2023-09-29T15:44:38Z</dc:date>
    </item>
    <item>
      <title>Re: Robot&amp;IronPython</title>
      <link>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/12275591#M43988</link>
      <description>&lt;P&gt;How is this library being called in Python? I don't know of the System.Runtime. ... in Python? What library / module is that? &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Sep 2023 16:07:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/robot-structural-analysis-forum/robot-amp-ironpython/m-p/12275591#M43988</guid>
      <dc:creator>bjoern_steinhagen8PD9X</dc:creator>
      <dc:date>2023-09-29T16:07:48Z</dc:date>
    </item>
  </channel>
</rss>

