<?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: Rack 3D creation flexscript in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486584#M4996</link>
    <description>&lt;P&gt;I don't understand the complication. Use the following code to change the rotation the same way you changed the location:&lt;/P&gt;&lt;PRE&gt;obj.rotation.z = 90;&lt;BR /&gt;&lt;/PRE&gt;</description>
    <pubDate>Thu, 06 Dec 2018 20:14:37 GMT</pubDate>
    <dc:creator>philboboADSK</dc:creator>
    <dc:date>2018-12-06T20:14:37Z</dc:date>
    <item>
      <title>Rack 3D creation flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486578#M4990</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 18.2.2 ]&lt;/I&gt;&lt;/P&gt;&lt;P&gt;I am trying to create racks using code and the model is hanging repeatedly while doing it. The hardware is not an issue as I have a pretty loaded computer. Please see the code below. The length of the Global Table is 11000 rows. So essentially I am trying to create 11000 rack objects. How do I go about doing this? &lt;/P&gt;
&lt;PRE&gt;int number = 11000;//gettablerows("GlobalTable1"); int numBays = 2; int numLevels = 5; double bayWidth =48; double levelHeight = 6; for(int i = 1; i &amp;lt;= number; i++) { Object obj = createinstance(library().find("?Rack"), model()); function_s(node("/?Rack", library()), "BasicRefreshTable", obj,numLevels,numBays, levelHeight,bayWidth); obj.name = "Rack" + numtostring(i); obj.location.x = gettablenum("GlobalTable1",i,2)-bayWidth; obj.location.y = gettablenum("GlobalTable1",i,3); } Object source = createinstance(library().find("?Source"),model()); source.name = "Source_1"; source.location.x = -10; source.location.y = -10; //contextdragconnection(node("MODEL:/Source_1"),model().find(gettablestr("GlobalTable1",1,1)),"A"); //contextdragconnection(node("MODEL:/Source_1"),model().find(gettablestr("GlobalTable1",2,1)),"A");&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Dec 2018 18:11:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486578#M4990</guid>
      <dc:creator>sunada_c</dc:creator>
      <dc:date>2018-12-06T18:11:29Z</dc:date>
    </item>
    <item>
      <title>Re: Rack 3D creation flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486579#M4991</link>
      <description>&lt;P&gt;your code would be easier to go through if you posted it with better formatting like below&lt;/P&gt;
&lt;PRE&gt;for (int i=0;i&amp;lt;10;i++)
{
	print(i);
}
&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Dec 2018 18:22:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486579#M4991</guid>
      <dc:creator>joshua_s</dc:creator>
      <dc:date>2018-12-06T18:22:01Z</dc:date>
    </item>
    <item>
      <title>Re: Rack 3D creation flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486580#M4992</link>
      <description>&lt;PRE&gt;int number = gettablerows("GlobalTable1");
int numBays = 2;
int numLevels = 5;
double bayWidth =48;
double levelHeight = 6;
for(int i = 1; i &amp;lt;= number; i++) {
 Object obj = createinstance(library().find("?Rack"), model());
 function_s(node("/?Rack", library()), "BasicRefreshTable", obj,numLevels,numBays, levelHeight,bayWidth);
 obj.name = "Rack" + numtostring(i);
 obj.location.x = gettablenum("GlobalTable1",i,2)-bayWidth;
 obj.location.y = gettablenum("GlobalTable1",i,3);
}
Object source = createinstance(library().find("?Source"),model());
source.name = "Source_1";
source.location.x = -10;
source.location.y = -10;
//contextdragconnection(node("MODEL:/Source_1"),model().find(gettablestr("GlobalTable1",1,1)),"A");
//contextdragconnection(node("MODEL:/Source_1"),model().find(gettablestr("GlobalTable1",2,1)),"A");&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Dec 2018 18:25:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486580#M4992</guid>
      <dc:creator>sunada_c</dc:creator>
      <dc:date>2018-12-06T18:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: Rack 3D creation flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486581#M4993</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/8187/joshuas.html" nodeid="8187"&gt;@Joshua S&lt;/A&gt; : I would also like to automatically rotate them in the RZ axis by -90 degrees. I am trying to do that using the view table and selecting the group and rotate but it keeps hanging. &lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 18:26:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486581#M4993</guid>
      <dc:creator>sunada_c</dc:creator>
      <dc:date>2018-12-06T18:26:29Z</dc:date>
    </item>
    <item>
      <title>Re: Rack 3D creation flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486582#M4994</link>
      <description>&lt;P&gt;The main issue is that createinstance() gives the object a unique name. As the size of the model increases, the code to verify that the name is unique takes longer and longer.&lt;/P&gt;&lt;P&gt;You can get around this issue by just creating the first object with createinstance() and then using createcopy() to create the other ones.&lt;/P&gt;&lt;P&gt;Also, the "?" syntax in a node path causes a recursive string search. You are doing this 22000 times when you only need to do it once if you save the pointer to that object as a local variable.&lt;/P&gt;&lt;P&gt;You also don't need to adjust the size of each rack if you change the first one before making copies.&lt;/P&gt;&lt;PRE&gt;int number = 11000;
int numBays = 2;
int numLevels = 5;
double bayWidth = 48;
double levelHeight = 6;
treenode libraryRack = library().find("?Rack");
Object firstRack = createinstance(libraryRack, model());
function_s(libraryRack, "BasicRefreshTable", firstRack, numLevels, numBays, levelHeight, bayWidth);
for(int i = 2; i &amp;lt;= number; i++) {
	Object obj = createcopy(firstRack, model(), 1, 0, 1, 0);
	obj.name = "Rack" + numtostring(i);
	obj.location.x = 0;
	obj.location.y = i;
}
&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Dec 2018 18:51:43 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486582#M4994</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2018-12-06T18:51:43Z</dc:date>
    </item>
    <item>
      <title>Re: Rack 3D creation flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486583#M4995</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/206/phil.b.html" nodeid="206"&gt;@phil.bobo&lt;/A&gt; : Thank you. Additionally, I am trying to rotate all of these racks by 90 degrees along Z axis. How do I do that. I tried creating groups and then rotating it but it hangs up again&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 20:11:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486583#M4995</guid>
      <dc:creator>sunada_c</dc:creator>
      <dc:date>2018-12-06T20:11:19Z</dc:date>
    </item>
    <item>
      <title>Re: Rack 3D creation flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486584#M4996</link>
      <description>&lt;P&gt;I don't understand the complication. Use the following code to change the rotation the same way you changed the location:&lt;/P&gt;&lt;PRE&gt;obj.rotation.z = 90;&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 06 Dec 2018 20:14:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486584#M4996</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2018-12-06T20:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Rack 3D creation flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486585#M4997</link>
      <description>&lt;P&gt;&lt;A rel="user" href="https://answers.flexsim.com/users/206/phil.b.html" nodeid="206"&gt;@phil.bobo&lt;/A&gt; &lt;BR /&gt;&lt;BR /&gt;I set-up a source and a queue in the 3-D model and then I use the script to set the connection between the Queue and the Rack. In the source I am using a schedule source and in the queue I am doing send to port (By global table lookup). For some reason when I run the simulation it just deletes the rack in the 3D model and the flow items do not move from the queue to the rack. Please see the model attached below. Your input would be helpful.&lt;/P&gt;
&lt;P&gt;&lt;A id="16276" href="https://answers.flexsim.com/storage/temp/16276-rack-storage-doubt.fsm"&gt;rack-storage-doubt.fsm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 07 Dec 2018 18:59:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486585#M4997</guid>
      <dc:creator>sunada_c</dc:creator>
      <dc:date>2018-12-07T18:59:59Z</dc:date>
    </item>
    <item>
      <title>Re: Rack 3D creation flexscript</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486586#M4998</link>
      <description>&lt;P&gt;Set its destroyonreset flag to 0:&lt;/P&gt;&lt;PRE&gt;switch_destroyonreset(obj, 0);&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 07 Dec 2018 19:17:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/rack-3d-creation-flexscript/m-p/13486586#M4998</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2018-12-07T19:17:25Z</dc:date>
    </item>
  </channel>
</rss>

