<?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: error: Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.DrawingCurveSegment'. After 2024.2 update in Inventor Programming Forum</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12420747#M15995</link>
    <description>&lt;P&gt;seems to work now, thank you for the help !&lt;/P&gt;</description>
    <pubDate>Tue, 05 Dec 2023 13:06:56 GMT</pubDate>
    <dc:creator>Nicholasm4Z8CU</dc:creator>
    <dc:date>2023-12-05T13:06:56Z</dc:date>
    <item>
      <title>error: Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.DrawingCurveSegment'. After 2024.2 update</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12418497#M15989</link>
      <description>&lt;P&gt;Good day,&amp;nbsp;&lt;/P&gt;&lt;P&gt;we have some legacy code in our company used to add some custom section symbols onto the inventor default section line.&amp;nbsp;&lt;/P&gt;&lt;P&gt;After updating to 2024.2, I have been getting an error:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;Error on line 84 in rule: # Section Symbol Wizard_Copy, in document: 339255-100 TO XXX - MILL 4 TROUGH.idw&lt;/P&gt;&lt;P&gt;Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.DrawingCurveSegment'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{EEE9F58F-FD0B-4862-AE21-BAE203DFE23E}' failed due to the following error: No such interface supported (Exception from HRESULT: 0x80004002 (E_NOINTERFACE)).&lt;/P&gt;&lt;P&gt;"&lt;/P&gt;&lt;P&gt;I tried to google this error and didn't have any luck finding something that applied to our issue.&lt;/P&gt;&lt;P&gt;I have attached the code for reference. Unfortunately I am a novice when it comes to coding illogic and the person who originally created the code hasn't worked with us for years now.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 15:33:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12418497#M15989</guid>
      <dc:creator>Nicholasm4Z8CU</dc:creator>
      <dc:date>2023-12-04T15:33:15Z</dc:date>
    </item>
    <item>
      <title>Re: error: Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.DrawingCurveSegment'. After 2024.2 update</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12418636#M15990</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/10707775"&gt;@Nicholasm4Z8CU&lt;/a&gt;.&amp;nbsp; That type of error generally just means that there is a Type mismatch, and the system could not convert the one Type of object to the other Type of object to make it work.&amp;nbsp; In this case, I see that Line 84 contains the following line of code:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;oDLine = oCommandMgr.Pick(SelectionFilterEnum.kDrawingCurveSegmentFilter, "Select the LINE")&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;...then when I scroll up from that position to find where that 'oDLine' variable was 'declared', I find that on Line 49, as follows:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;Dim oDLine As DrawingCurveSegment&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;That variable's Type appears to be compatible to me, and the spelling in both cases appears to be correct.&amp;nbsp; So, I do not know why it would be having a problem at that line yet.&amp;nbsp; Was this code used within something like an Inventor.ApplicationAddIn?&amp;nbsp; I noticed that it contains multiple Class blocks of code, which contain pretty much all the code, except for a single Sub Main block of code that creates a new 'instance' of one of those Classes.&amp;nbsp; That combined with how it is getting the Inventor.Application seem to indicate that it is being used externally, instead of simply within an iLogic rule.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit:&amp;nbsp; Also, when I copy that code over into a new iLogic rule to review it, then attempt to 'save' it, I get an error saying that it could not find the library mentioned in Line 1. (X:\CAD Library\iLogic\SectionSymToolBox.dll).&amp;nbsp; That is perfectly normal on my end, because I do not have that referenced DLL file on my computer, like you have on yours.&amp;nbsp; But I can not be sure if there may be something about that DLL file that may need to be updated either.&amp;nbsp; But that does not seem likely at this point.&amp;nbsp; The &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=GUID-DrawingCurveSegment" target="_blank" rel="noopener"&gt;DrawingCurveSegment&lt;/A&gt; Type was established back in version 11, and the &lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=CommandManager_Pick" target="_blank" rel="noopener"&gt;Pick&lt;/A&gt; method was established in 2011.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 16:34:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12418636#M15990</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-12-04T16:34:23Z</dc:date>
    </item>
    <item>
      <title>Re: error: Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.DrawingCurveSegment'. After 2024.2 update</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12418666#M15991</link>
      <description>&lt;P&gt;Thanks for the reply,&lt;/P&gt;&lt;P&gt;As far as I know this code is used in the drawing environment.&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;i'm not sure if there would have been a&amp;nbsp;&amp;nbsp;Inventor.ApplicationAddIn .&amp;nbsp; The code has worked fine for years up until this latest inventor&amp;nbsp;update. some of my colleagues haven't&amp;nbsp;updated yet and the code works for them.&amp;nbsp;&amp;nbsp; Perhaps there is an add in that no longer exist in this new update?&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 16:34:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12418666#M15991</guid>
      <dc:creator>Nicholasm4Z8CU</dc:creator>
      <dc:date>2023-12-04T16:34:46Z</dc:date>
    </item>
    <item>
      <title>Re: error: Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.DrawingCurveSegment'. After 2024.2 update</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12418780#M15992</link>
      <description>i am able to access this .dll file, but it appears that this forum doesn't allow me to attach .dll files.&lt;BR /&gt;is there a another way i can send it, or a way i can check if that is giving me the issues?</description>
      <pubDate>Mon, 04 Dec 2023 17:28:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12418780#M15992</guid>
      <dc:creator>Nicholasm4Z8CU</dc:creator>
      <dc:date>2023-12-04T17:28:46Z</dc:date>
    </item>
    <item>
      <title>Re: error: Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.DrawingCurveSegment'. After 2024.2 update</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12418829#M15993</link>
      <description>&lt;P&gt;Not sure.&amp;nbsp; It may be possible through a private message (hover your mouse over someone else's username, then click Send Private Message).&amp;nbsp; But I may not actually be able to inspect that type of file properly anyways.&amp;nbsp; Those types of files are often created through an application such as &lt;A href="https://visualstudio.microsoft.com/" target="_blank" rel="noopener"&gt;Microsoft Visual Studio&lt;/A&gt;, and they often can not be reviewed or edited by common text editors.&amp;nbsp; I do have an installation of VS 2019 Community, but I am not experienced with DLL file creation/editing, or creating Inventor add-ins, which is often what DLL's are used for in this context.&amp;nbsp; Maybe one of the other super helpful members here on the forum would be able to help out on this case better than I can.&amp;nbsp; Sorry.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Dec 2023 17:42:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12418829#M15993</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2023-12-04T17:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: error: Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.DrawingCurveSegment'. After 2024.2 update</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12420686#M15994</link>
      <description>&lt;P&gt;I look at your code and there are few strange parts.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1) The main breaking change in 2024.2 is different picked entity when you pick section line. Before 2024.2 it was &lt;EM&gt;&lt;STRONG&gt;DrawingCurveSegment&lt;/STRONG&gt;&lt;/EM&gt;, now it is &lt;EM&gt;&lt;STRONG&gt;SketchLine&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;- I add new handling method for this and keep the previous too. You can use this code for all versions (tested 2022, 2024.2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2) In the iLogic rules avoid to use&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;Marshal.GetActiveObject&lt;/STRONG&gt;&lt;/EM&gt; and &lt;EM&gt;&lt;STRONG&gt;CreateInstance&lt;/STRONG&gt;&lt;/EM&gt;. Always use the appropriate entry-point provided by iLogic. In this case it is variable &lt;EM&gt;&lt;STRONG&gt;ThisApplication&lt;/STRONG&gt;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;- I comment out the class&amp;nbsp;&lt;EM&gt;&lt;STRONG&gt;CL_InventorApp&lt;/STRONG&gt;&lt;/EM&gt; and replace this part of code in the constructor. I need to pass &lt;EM&gt;&lt;STRONG&gt;ThisApplication&lt;/STRONG&gt;&lt;/EM&gt; variable from main rule to class instance as the parameter &lt;EM&gt;&lt;STRONG&gt;inventorApp&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3) Avoid to call any "business logic" code from constructor. Always add this code to separate &lt;EM&gt;&lt;STRONG&gt;Sub&lt;/STRONG&gt;&lt;/EM&gt; or &lt;EM&gt;&lt;STRONG&gt;Function&lt;/STRONG&gt;&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;- I move the business logic to separate method &lt;EM&gt;&lt;STRONG&gt;Start()&lt;/STRONG&gt;&lt;/EM&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;4) External DLL library contains only simple dialog from point of view of this rule. For testing purposes I need to create new one.&lt;/P&gt;&lt;P&gt;- I add full definition of this form as a part of the rule. You can use my implementation without reference to the external DLL or remove the last class and use your original implementation from DLL&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I hope it helps&lt;/P&gt;&lt;P&gt;Thanks to the&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7812054"&gt;@WCrihfield&lt;/a&gt;&amp;nbsp; for notification.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 12:59:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12420686#M15994</guid>
      <dc:creator>Michael.Navara</dc:creator>
      <dc:date>2023-12-05T12:59:13Z</dc:date>
    </item>
    <item>
      <title>Re: error: Unable to cast COM object of type 'System.__ComObject' to interface type 'Inventor.DrawingCurveSegment'. After 2024.2 update</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12420747#M15995</link>
      <description>&lt;P&gt;seems to work now, thank you for the help !&lt;/P&gt;</description>
      <pubDate>Tue, 05 Dec 2023 13:06:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-forum/error-unable-to-cast-com-object-of-type-system-comobject-to/m-p/12420747#M15995</guid>
      <dc:creator>Nicholasm4Z8CU</dc:creator>
      <dc:date>2023-12-05T13:06:56Z</dc:date>
    </item>
  </channel>
</rss>

