<?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 add a new shapre frame with code? in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-add-a-new-shapre-frame-with-code/m-p/14064474#M100520</link>
    <description>&lt;P&gt;You can 'explore' the structure of the GUI to find what code is executed when you press the button to add a new shape to an object.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-03-24 082519.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1628188iBBAE6C41233697CD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-03-24 082519.png" alt="Screenshot 2026-03-24 082519.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can mostly use the code as is. One the "objectFocus" and "shapeFocus" nodes need to be defined differently. Those point to the "shape" node and the currently active shape (which is either the shape node itself or a subnode of it).&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Object owner = Model.find("Queue1");
treenode objectFocus = shape(owner);
treenode shapeFocus;
int frameIndex = owner.find("&amp;gt;visual").subnodes.assert("frame", 0).value;
if(frameIndex == 0) {
	shapeFocus = objectFocus;
}
else {
	shapeFocus = objectFocus.subnodes[frameIndex];
}&lt;/LI-CODE&gt;</description>
    <pubDate>Tue, 24 Mar 2026 09:03:00 GMT</pubDate>
    <dc:creator>FelixMoehlmann</dc:creator>
    <dc:date>2026-03-24T09:03:00Z</dc:date>
    <item>
      <title>How to add a new shapre frame with code?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-add-a-new-shapre-frame-with-code/m-p/14064192#M100514</link>
      <description>&lt;P&gt;&lt;SPAN&gt;I have a model with a lot of 3D details, and I am trying to add a second shape frame for all the objects. I want to use that frame as a "work view" and later switch back to the original frame. I attempted to add a subnode to the visuals &amp;gt; IndexShape node and a "frame" node to the object visuals, but it doesn't seem to be working.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Object obj = Model.find("Processor4");&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;treenode newnode = Model.find("Processor4").find("&amp;gt;visual/shapeindex").subnodes.add();&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;newnode.value=1;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;treenode x = Model.find("Processor4").find("&amp;gt;visual").subnodes.assert("frame",0);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;return x;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Is it possible to add that new frame just with code or the only way is to do it from the properties?&lt;/P&gt;</description>
      <pubDate>Tue, 24 Mar 2026 01:19:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-add-a-new-shapre-frame-with-code/m-p/14064192#M100514</guid>
      <dc:creator>diana_ceballos6XXWT</dc:creator>
      <dc:date>2026-03-24T01:19:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to add a new shapre frame with code?</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/how-to-add-a-new-shapre-frame-with-code/m-p/14064474#M100520</link>
      <description>&lt;P&gt;You can 'explore' the structure of the GUI to find what code is executed when you press the button to add a new shape to an object.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2026-03-24 082519.png" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1628188iBBAE6C41233697CD/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2026-03-24 082519.png" alt="Screenshot 2026-03-24 082519.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;You can mostly use the code as is. One the "objectFocus" and "shapeFocus" nodes need to be defined differently. Those point to the "shape" node and the currently active shape (which is either the shape node itself or a subnode of it).&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Object owner = Model.find("Queue1");
treenode objectFocus = shape(owner);
treenode shapeFocus;
int frameIndex = owner.find("&amp;gt;visual").subnodes.assert("frame", 0).value;
if(frameIndex == 0) {
	shapeFocus = objectFocus;
}
else {
	shapeFocus = objectFocus.subnodes[frameIndex];
}&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 24 Mar 2026 09:03:00 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/how-to-add-a-new-shapre-frame-with-code/m-p/14064474#M100520</guid>
      <dc:creator>FelixMoehlmann</dc:creator>
      <dc:date>2026-03-24T09:03:00Z</dc:date>
    </item>
  </channel>
</rss>

