<?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: Selection Input in Fusion API and Scripts Forum</title>
    <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/selection-input/m-p/10585912#M19390</link>
    <description>&lt;P&gt;Dear kandennti&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Thank you so much for your help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Your code runs perfectly and is also much neater than my original script! I am grateful for your generous support.&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 30 Aug 2021 22:49:06 GMT</pubDate>
    <dc:creator>2way3dtext</dc:creator>
    <dc:date>2021-08-30T22:49:06Z</dc:date>
    <item>
      <title>Selection Input</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/selection-input/m-p/6535981#M19387</link>
      <description>&lt;P&gt;Hi all, I'm having problems with a multiple selection of curves from&amp;nbsp;an Command&amp;nbsp;Dialog.&lt;/P&gt;&lt;P&gt;I din not find any example on the forum or in the documentation so I am asking some help or some example code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;These are extracts from the Add-in&amp;nbsp;I'm trying to write:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inside the &amp;nbsp;SampleCommandCreatedHandler I have this code&lt;/P&gt;&lt;P&gt;.....................&lt;/P&gt;&lt;P&gt;# Create selection input&lt;/P&gt;&lt;P&gt;curve_input = inputs.addSelectionInput('curve_input', 'Select', 'Select curve')&lt;/P&gt;&lt;P&gt;# select only curves&lt;/P&gt;&lt;P&gt;curve_input.addSelectionFilter('SketchCurves')&lt;/P&gt;&lt;P&gt;# I can select more than one curve&lt;/P&gt;&lt;P&gt;curve_input.setSelectionLimits(0)&lt;/P&gt;&lt;P&gt;.....................&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Inside the&amp;nbsp;SampleCommandExecuteHandler&amp;nbsp;I have this code&lt;/P&gt;&lt;P&gt;.....................&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# count the number of curves selected&lt;/P&gt;&lt;P&gt;n_selection = inputs.itemById('curve_input').selectionCount&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# get the curve selected and call helix()&lt;/P&gt;&lt;P&gt;for i in range (0, n_selection &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;cur = inputs.itemById('curve_input').selection(i)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;curve = cur.entity&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;# call a&amp;nbsp;function&amp;nbsp;witn the curve selected&lt;/P&gt;&lt;P&gt;helix( curve )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I do not understand the reason why I receve this error&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="err_screenshot.PNG" style="width: 416px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/268931i08E7A661D665D375/image-size/large?v=v2&amp;amp;px=999" role="button" title="err_screenshot.PNG" alt="err_screenshot.PNG" /&gt;&lt;/span&gt;﻿&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If I&amp;nbsp;select 3&amp;nbsp;curves and use the following instruction&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;cur = inputs.itemById('curve_input').selection(0)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;cur = inputs.itemById('curve_input').selection(1)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;or&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;cur = inputs.itemById('curve_input').selection(2)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;they do not provide error&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Someone can help me ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Many Thanks&lt;/P&gt;&lt;P&gt;Dino&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Sep 2016 07:55:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/selection-input/m-p/6535981#M19387</guid>
      <dc:creator>dinocoglitore</dc:creator>
      <dc:date>2016-09-01T07:55:20Z</dc:date>
    </item>
    <item>
      <title>Re: Selection Input</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/selection-input/m-p/6537171#M19388</link>
      <description>&lt;P&gt;Selections are somewhat fragile and doing something that changes the database in any way will usually clear any current selections.&amp;nbsp; I believe that's the problem you're running into here. Whatever your helix command is doing is also having the side effect of clearing the current selection so when you try to get the next entity in the selection it fails.&amp;nbsp; To work around that you can first get everything from the selection and then do the processing, like shown below.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;curves = []
for i in range (0, n_selection ):
    curves.append( inputs.itemById('curve_input').selection(i).entity )

for curve in curves:
    helix( curve )&lt;/PRE&gt;</description>
      <pubDate>Thu, 01 Sep 2016 16:48:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/selection-input/m-p/6537171#M19388</guid>
      <dc:creator>ekinsb</dc:creator>
      <dc:date>2016-09-01T16:48:28Z</dc:date>
    </item>
    <item>
      <title>Re: Selection Input</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/selection-input/m-p/6538337#M19389</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;STRONG&gt;Brian, thank you very much for your answer. It obviously solved my problem and make me climb another rung in the kwnoledge of API and Python.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Thanks&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Dino&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 02 Sep 2016 05:30:36 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/selection-input/m-p/6538337#M19389</guid>
      <dc:creator>dinocoglitore</dc:creator>
      <dc:date>2016-09-02T05:30:36Z</dc:date>
    </item>
    <item>
      <title>Re: Selection Input</title>
      <link>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/selection-input/m-p/10585912#M19390</link>
      <description>&lt;P&gt;Dear kandennti&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Thank you so much for your help!&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="login-bold"&gt;Your code runs perfectly and is also much neater than my original script! I am grateful for your generous support.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 30 Aug 2021 22:49:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/fusion-api-and-scripts-forum/selection-input/m-p/10585912#M19390</guid>
      <dc:creator>2way3dtext</dc:creator>
      <dc:date>2021-08-30T22:49:06Z</dc:date>
    </item>
  </channel>
</rss>

