Hi,
Just to report the MultiSelect2 method does not accept the AddComponents3 method result.
I have to cast COM object array into a IComponent2 object array before.
<p>var <span style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;">components</span> = <span style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;">(object[])</span>assembly.AddComponents3(names, transforms, coordSystemNames);</p><p></p><p>var count = docExtension.MultiSelect2(<span style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;">components</span>, false, null); // Select no component and returns 0</p>
To fix it:
<p><span style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;">var <span style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;">components</span> = (object[])assembly.AddComponents3(names, transforms, coordSystemNames);</span></p><p></p><p><span style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;">// FIX</span></p><p>var array = new Component2[components.Length];</p><p>for (var i = 0; i < components.Length; i += 1)</p><p> array[i] = (Component2)components[i];</p><p></p><p>var <span style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;">count</span> = docExtension.MultiSelect2(<span style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;">array</span>, false, null); // Select all components and returns <span style="color: rgba(0, 0, 0, 0); font-family: Consolas, 'Courier New', Courier, mono, serif; font-size: 12px;">components</span>.Length</p>
Is it a normal behavior or an API problem ?
Best regards,
Alexandre
SolidworksApi macros