<?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: Module SDK - Flowitem positioning problem in FlexSim Forum</title>
    <link>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541743#M48319</link>
    <description>&lt;P&gt;You are using getitemvar(item, 1). Did you set that variable to something?&lt;/P&gt;&lt;P&gt;The itemvars are variables set by the fixed resource per item. Like labels that can be used by your object to track info per item.&lt;/P&gt;&lt;P&gt;If you didn't set it, then it will be whatever value the previous object set it to. If you want it set to something particular, set it.&lt;/P&gt;</description>
    <pubDate>Fri, 06 Mar 2020 20:13:30 GMT</pubDate>
    <dc:creator>philboboADSK</dc:creator>
    <dc:date>2020-03-06T20:13:30Z</dc:date>
    <item>
      <title>Module SDK - Flowitem positioning problem</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541742#M48318</link>
      <description>&lt;P&gt;&lt;I&gt;[ FlexSim 20.0.3 ]&lt;/I&gt;&lt;/P&gt;&lt;P&gt;
	I am working on a module and have created two objects, one that creates and destroys flowitens, and another one that works like a path where flowitens move through.&lt;/P&gt;&lt;P&gt;
	The problem I am facing is when I connect my object that creates flowitems with a queue and them with my path object, the flowitem position is updated correctly! But when I remove my queue and connect the two objects directly, my flowitem starts to move in the middle of the object.&lt;/P&gt;&lt;P&gt;
	I found out that the problem happens when updateLocations is executed, because I set the initial position of the flowitem on the onReceive method of my path object, and when I comment the updateLocations code, it stays at the start position in both cases.&lt;/P&gt;&lt;P&gt;
	Any suggestion on what I could be doing wrong? Should I be implementing another method like getPickOffset or getPlaceOffset?&lt;/P&gt;&lt;P&gt;
	That's my updateLocations method content.&lt;/P&gt;&lt;PRE&gt;if (currentState == STATE_BUSY)
{
	if (time() != lastTimeRecorded)
	{
		treenode item = holder-&amp;gt;subnodes[1];
		setloc(item, 
			holder-&amp;gt;find("&amp;gt;spatial/spatialsx")-&amp;gt;value / crossingTime * (time() - getitemvar(item, 1)),
			yloc(item),
			zloc(item));
		lastTimeRecorded = time();
	}
}
return 0;
&lt;/PRE&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 12:32:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541742#M48318</guid>
      <dc:creator>pedro_o</dc:creator>
      <dc:date>2020-03-06T12:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: Module SDK - Flowitem positioning problem</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541743#M48319</link>
      <description>&lt;P&gt;You are using getitemvar(item, 1). Did you set that variable to something?&lt;/P&gt;&lt;P&gt;The itemvars are variables set by the fixed resource per item. Like labels that can be used by your object to track info per item.&lt;/P&gt;&lt;P&gt;If you didn't set it, then it will be whatever value the previous object set it to. If you want it set to something particular, set it.&lt;/P&gt;</description>
      <pubDate>Fri, 06 Mar 2020 20:13:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541743#M48319</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2020-03-06T20:13:30Z</dc:date>
    </item>
    <item>
      <title>Re: Module SDK - Flowitem positioning problem</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541744#M48320</link>
      <description>&lt;P&gt;I did set its value to model time at the onReceive method.&lt;/P&gt;&lt;PRE&gt;setitemvar(item, 1, time());&lt;BR /&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 09 Mar 2020 12:10:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541744#M48320</guid>
      <dc:creator>pedro_o</dc:creator>
      <dc:date>2020-03-09T12:10:50Z</dc:date>
    </item>
    <item>
      <title>Re: Module SDK - Flowitem positioning problem</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541745#M48321</link>
      <description>&lt;P&gt;We can't tell what is wrong from your description. You would need to post your module solution so that we can replicate it to debug it for you.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 14:58:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541745#M48321</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2020-03-09T14:58:25Z</dc:date>
    </item>
    <item>
      <title>Re: Module SDK - Flowitem positioning problem</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541746#M48322</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;/P&gt;&lt;P&gt;I did some debug myself and found out that the setitemvar method is not working when I have my two objects connected, but it works well when I have the Queue connected.&lt;/P&gt;&lt;P&gt;At my first updateLocation execution i get value 0 when I should be getting 3, and then the getitemvar is not called anymore.&lt;/P&gt;&lt;P&gt;Unfortunately i can't post my module solution, sorry about that.&lt;/P&gt;&lt;P&gt;Is it possible to know the reason why my set/getitemvar is not working properly?&lt;/P&gt;&lt;P&gt;I have this piece on code at the onReceive method: &lt;/P&gt;&lt;PRE&gt;setitemvar(item, 1, time());&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;And then i have this code at updateLocation:&lt;/P&gt;&lt;PRE&gt;setloc(item,
				(b_spatialsx / crossingTime * (time() - getitemvar(item, 1)) - xsize(item)),
				yloc(item),
				zloc(item));&lt;BR /&gt;&lt;/PRE&gt;&lt;P&gt;Thanks for the help!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 18:27:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541746#M48322</guid>
      <dc:creator>pedro_o</dc:creator>
      <dc:date>2020-03-09T18:27:09Z</dc:date>
    </item>
    <item>
      <title>Re: Module SDK - Flowitem positioning problem</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541747#M48323</link>
      <description>&lt;P&gt;I switched the setitemvar for a class variable, and now it works both ways! The problem was with the itemvars as you figured from start.&lt;/P&gt;&lt;P&gt;Thanks for the help &lt;A rel="user" href="https://answers.flexsim.com/users/206/phil.b.html" nodeid="206"&gt;@phil.bobo&lt;/A&gt;!&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 19:08:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541747#M48323</guid>
      <dc:creator>pedro_o</dc:creator>
      <dc:date>2020-03-09T19:08:40Z</dc:date>
    </item>
    <item>
      <title>Re: Module SDK - Flowitem positioning problem</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541748#M48324</link>
      <description>&lt;P&gt;You probably just needed to add an initItem() call before calling setItemVar() the first time in order to initialize the item variables.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 19:18:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541748#M48324</guid>
      <dc:creator>philboboADSK</dc:creator>
      <dc:date>2020-03-09T19:18:44Z</dc:date>
    </item>
    <item>
      <title>Re: Module SDK - Flowitem positioning problem</title>
      <link>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541749#M48325</link>
      <description>&lt;P&gt;Good to know, I will try it that way, seems more correct.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 09 Mar 2020 19:19:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/flexsim-forum/module-sdk-flowitem-positioning-problem/m-p/13541749#M48325</guid>
      <dc:creator>pedro_o</dc:creator>
      <dc:date>2020-03-09T19:19:42Z</dc:date>
    </item>
  </channel>
</rss>

