<?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: Create conveyor system in code in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/create-conveyor-system-in-code/m-p/13487540#M5784</link>
    <description>&lt;P&gt;After you add a photo eye or a decision point you need to call the finalizeSpatialChanges function on the thing you just added and not on the conveyor. So change these lines:&lt;/P&gt;&lt;PRE&gt;** Just added a Photo Eye **
function_s(newConveyor,"finalizeSpatialChanges");

** Just added a Decision Point **
function_s(newConveyor,"finalizeSpatialChanges");&lt;/PRE&gt;&lt;P&gt;To these:&lt;/P&gt;&lt;PRE&gt;** Just added a Photo Eye **
function_s(photoEye,"finalizeSpatialChanges");

** Just added a Decision Point **
function_s(decisionPoint,"finalizeSpatialChanges");&lt;/PRE&gt;</description>
    <pubDate>Mon, 06 Jun 2016 15:26:57 GMT</pubDate>
    <dc:creator>Matthew_Gillespie</dc:creator>
    <dc:date>2016-06-06T15:26:57Z</dc:date>
    <item>
      <title>Create conveyor system in code</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/create-conveyor-system-in-code/m-p/13487539#M5783</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 16.0.1 ]&lt;/I&gt;&lt;/P&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am creating a conveyor system consisting of a straight conveyor with a photo eye and a decision point on it. There are multiple of these conveyors next to each other. I manage to create the conveyors and the photo eyes and decision points, but only the first that is created of the photo eyes/decision points works correctly. For the first I create the photo eye into the conveyor using createinstance and Flexsim moves the photo eye to the same rank level as the conveyor and creates the link between them. For the other ones the objects remain inside the conveyor and thus the rest of the code does not work as it should. Also, when stepping through the code with the debugger so that I put breakpoints on the rows where the decision points, photo eyes and before the connections from and to the conveyor are created then the code works as it should, probably due to some timing issue.&lt;/P&gt;&lt;P&gt;Anyone that has a clue on how to fix this problem? See the attached model where the problem is replicated.&lt;/P&gt;&lt;P&gt;Call the createConveyorSystem user command from the script window as I have defined it there to see what happens.&lt;/P&gt;&lt;P&gt;&lt;A href="https://answers.flexsim.com/storage/attachments/452-20160606-buildingconveyorsystemwithcode.fsm"&gt;20160606-buildingconveyorsystemwithcode.fsm&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jun 2016 07:26:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/create-conveyor-system-in-code/m-p/13487539#M5783</guid>
      <dc:creator>axel_kohonen</dc:creator>
      <dc:date>2016-06-06T07:26:58Z</dc:date>
    </item>
    <item>
      <title>Re: Create conveyor system in code</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/create-conveyor-system-in-code/m-p/13487540#M5784</link>
      <description>&lt;P&gt;After you add a photo eye or a decision point you need to call the finalizeSpatialChanges function on the thing you just added and not on the conveyor. So change these lines:&lt;/P&gt;&lt;PRE&gt;** Just added a Photo Eye **
function_s(newConveyor,"finalizeSpatialChanges");

** Just added a Decision Point **
function_s(newConveyor,"finalizeSpatialChanges");&lt;/PRE&gt;&lt;P&gt;To these:&lt;/P&gt;&lt;PRE&gt;** Just added a Photo Eye **
function_s(photoEye,"finalizeSpatialChanges");

** Just added a Decision Point **
function_s(decisionPoint,"finalizeSpatialChanges");&lt;/PRE&gt;</description>
      <pubDate>Mon, 06 Jun 2016 15:26:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/create-conveyor-system-in-code/m-p/13487540#M5784</guid>
      <dc:creator>Matthew_Gillespie</dc:creator>
      <dc:date>2016-06-06T15:26:57Z</dc:date>
    </item>
    <item>
      <title>Re: Create conveyor system in code</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/create-conveyor-system-in-code/m-p/13487541#M5785</link>
      <description>&lt;A href="https://answers.flexsim.com/storage/temp/478-20160606-buildingconveyorsystemwithcode-v2.fsm"&gt;20160606-buildingconveyorsystemwithcode-v2.fsm&lt;/A&gt;&lt;P&gt;Thank you Matthew! So finalizeSpatialChanges obviously always needs to be called for the object that you have made changes to. Weird that it worked to call it for the conveyor though when the breakpoints were set in the spots described above. &lt;/P&gt;&lt;P&gt;The corrected model is attached.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;Axel&lt;/P&gt;</description>
      <pubDate>Tue, 07 Jun 2016 05:12:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/create-conveyor-system-in-code/m-p/13487541#M5785</guid>
      <dc:creator>axel_kohonen</dc:creator>
      <dc:date>2016-06-07T05:12:45Z</dc:date>
    </item>
  </channel>
</rss>

