<?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: Javascript - SetProposalName function in InfraWorks Forum</title>
    <link>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6383657#M20057</link>
    <description>I know my code isn't complete. I couldn't figure out how to get it to do what I wanted. I used the print function as a check to make sure I was on the right track with iterating through the proposals collection.&lt;BR /&gt;&lt;BR /&gt;I'll take a look at what you did later. Maybe I can hack something to work.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
    <pubDate>Tue, 14 Jun 2016 22:09:31 GMT</pubDate>
    <dc:creator>Matt__W</dc:creator>
    <dc:date>2016-06-14T22:09:31Z</dc:date>
    <item>
      <title>Javascript - SetProposalName function</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6382699#M20055</link>
      <description>&lt;P&gt;I've got some JS code (see below) that is bugging me (pun intended). I'm probably overlooking something stupid simple but... I'm trying to cycle throught the proposals and set each one at a time as the active proposal. I can't get the SetProposalName function to work.&amp;nbsp;I'm looking at the SetProposalName function and I'm not 100% sure if that means set a new name for a proposal or set a proposal current based on a name. Can someone shed some light on this for me and point me in the right direction?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// Get the active document
var doc = app.ActiveDocument();

// Get all proposals in the model, cycle through them &amp;amp; print them to the debug panel
var varProps = doc.GetAllProposals("");
for (x in varProps) {
   print (varProps[x]);
}&lt;/PRE&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2016 14:58:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6382699#M20055</guid>
      <dc:creator>Matt__W</dc:creator>
      <dc:date>2016-06-14T14:58:07Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - SetProposalName function</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6383607#M20056</link>
      <description>&lt;P&gt;I think there's a piece missing here? From looking at your .js, it seems like you only end up printing the names of proposals to the debug window..For example, when you change a storyboard name, there's another step:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;1&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="tx"&gt;// Get the active document&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;2&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="tx"&gt;var&lt;/SPAN&gt;&lt;SPAN class="tx"&gt;&amp;nbsp;doc = app.ActiveDocument();&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;3&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;4&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="tx"&gt;// Get current storyboard&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;5&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="tx"&gt;var&lt;/SPAN&gt;&lt;SPAN class="tx"&gt;&amp;nbsp;currentStoryboard = doc.Timeline.GetCurrentStoryboard();&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;6&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;7&lt;/SPAN&gt;&lt;SPAN class="tx"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="tx"&gt;// Change the name of a storyboard&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;8&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="tx"&gt;currentStoryboard.Name =&amp;nbsp;&lt;/SPAN&gt;&lt;SPAN class="tx"&gt;"My Storyboard with a new Name"&lt;/SPAN&gt;&lt;SPAN class="tx"&gt;;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;When I test out your code, the script executes, but there's still more to be done.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;Here's what I see when I run your code (below). The script has executed the Get of ALL proposals.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/247654iD1AB8AE5AFB7B11E/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="JS.jpg" title="JS.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;But, if I do some tweaks, I can then print AllProposals. You can see that the console printed out the names of the 3 proposals in my model (master, proposal1, and Proposal2). Interestingly, it looks like Proposal2 is printed out first, which is coincedentally also the active proposal.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN class="tx"&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/247655i000E4E93529E8F89/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="moreJS.jpg" title="moreJS.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But&amp;nbsp;if I change my JS a bit, I can&amp;nbsp;instead print the name of the current, aka active proposal.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var doc = app.ActiveDocument();
var currentProposal = doc.GetActiveProposal();
print(currentProposal)&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/247660i99C7CDD6FEC6D740/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="activeJS.jpg" title="activeJS.jpg" /&gt;&lt;/PRE&gt;
&lt;P&gt;I know this doesn't completely answer your questions, but hopefully this helps! (Sorry, I'm not a JS expert, just guesstimating some of these things).&lt;/P&gt;
&lt;P&gt;I think you may need to return doc.GetAllProposals as an array, and then somehow cycle through all Proposals, setting them active one at a time... if that is your intended result?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;
&lt;P&gt;Elliott&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 14 Jun 2016 21:32:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6383607#M20056</guid>
      <dc:creator>elliott.rosenfeld</dc:creator>
      <dc:date>2016-06-14T21:32:33Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - SetProposalName function</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6383657#M20057</link>
      <description>I know my code isn't complete. I couldn't figure out how to get it to do what I wanted. I used the print function as a check to make sure I was on the right track with iterating through the proposals collection.&lt;BR /&gt;&lt;BR /&gt;I'll take a look at what you did later. Maybe I can hack something to work.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Tue, 14 Jun 2016 22:09:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6383657#M20057</guid>
      <dc:creator>Matt__W</dc:creator>
      <dc:date>2016-06-14T22:09:31Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - SetProposalName function</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6384482#M20058</link>
      <description>&lt;P&gt;So I was messing around with my code and going through the JS documentation and I don't know how I missed them but there are ChangeProposal and ActiveProposal functions, both of which I can't figure out how to actually apply them. The follow code will run without any issues but nothing seems to happen. To give you a little background of my model I have two proposals: master and Test01. When I have Test01 active and run the code, the proposal doesn't change. I can't figure out how to commit the change and actually update&amp;nbsp;the current proposal. Got any thoughts?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;// Current proposal is 'Test01'&lt;BR /&gt;&lt;BR /&gt;var doc = app.ActiveDocument();
doc.ChangeProposal = "master";
doc.ActiveProposal = "master";&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 11:53:04 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6384482#M20058</guid>
      <dc:creator>Matt__W</dc:creator>
      <dc:date>2016-06-15T11:53:04Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - SetProposalName function</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6384491#M20059</link>
      <description>&lt;P&gt;JS documentation says this about the ChangeProposal function.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;IMG src="https://forums.autodesk.com/t5/image/serverpage/image-id/247794i81315278D7CFF91F/image-size/original?v=v2&amp;amp;px=-1" border="0" alt="IW_ChangeProposal.PNG" title="IW_ChangeProposal.PNG" /&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it's not switching.&amp;nbsp;&lt;img id="smileysad" class="emoticon emoticon-smileysad" src="https://forums.autodesk.com/i/smilies/16x16_smiley-sad.png" alt="Smiley Sad" title="Smiley Sad" /&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 11:57:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6384491#M20059</guid>
      <dc:creator>Matt__W</dc:creator>
      <dc:date>2016-06-15T11:57:10Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - SetProposalName function</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6385524#M20060</link>
      <description>&lt;P&gt;Took me a while to figure it out, but this seems to work:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;var doc = app.ActiveDocument();
doc.ChangeProposal("master");&lt;/PRE&gt;</description>
      <pubDate>Wed, 15 Jun 2016 17:56:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6385524#M20060</guid>
      <dc:creator>elliott.rosenfeld</dc:creator>
      <dc:date>2016-06-15T17:56:22Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - SetProposalName function</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6385532#M20061</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/1960481"&gt;@elliott.rosenfeld﻿&lt;/a&gt;!! I knew it had to be something stupid simple!&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:02:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6385532#M20061</guid>
      <dc:creator>Matt__W</dc:creator>
      <dc:date>2016-06-15T18:02:52Z</dc:date>
    </item>
    <item>
      <title>Re: Javascript - SetProposalName function</title>
      <link>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6385547#M20062</link>
      <description>&lt;P&gt;No problem Matt, it was fun to mess&amp;nbsp;around with&amp;nbsp;some scripts. It does always come down to that, huh &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:05:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/infraworks-forum/javascript-setproposalname-function/m-p/6385547#M20062</guid>
      <dc:creator>elliott.rosenfeld</dc:creator>
      <dc:date>2016-06-15T18:05:15Z</dc:date>
    </item>
  </channel>
</rss>

