<?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: Trying to fix a warning using the inventor API in vb.net in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11379918#M141771</link>
    <description>&lt;P&gt;You are correct, this is a addin, and this is indeed the function I made &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7B4B80143EBEB4F250CEEC82342F6CA1/emoticons/1f609.png" alt=":winking_face:" title=":winking_face:" /&gt;&lt;/P&gt;&lt;P&gt;I did not use 'byref or byval oOcc as ComponentOccurrence', but adding this to the sub argument does not fix the warning.&lt;/P&gt;&lt;P&gt;this might help:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kclement_0-1661408784670.png" style="width: 909px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1107819i6B18C0A0AAEDC52C/image-dimensions/909x100?v=v2" width="909" height="100" role="button" title="Kclement_0-1661408784670.png" alt="Kclement_0-1661408784670.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 25 Aug 2022 06:31:07 GMT</pubDate>
    <dc:creator>K.clement</dc:creator>
    <dc:date>2022-08-25T06:31:07Z</dc:date>
    <item>
      <title>Trying to fix a warning using the inventor API in vb.net</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11375431#M141683</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;When using the 'CreateGeometryProxy' function of the inventor API in VB.Net,&lt;/P&gt;&lt;P&gt;Visual studio gives you this warning:&lt;/P&gt;&lt;P&gt;&lt;A href="https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/error-messages/implicit-conversion-from-typename1-to-typename2-in-copying?f1url=%3FappId%3Droslyn%26k%3Dk(BC41999)" target="_blank"&gt;https://docs.microsoft.com/en-us/dotnet/visual-basic/language-reference/error-messages/implicit-conversion-from-typename1-to-typename2-in-copying?f1url=%3FappId%3Droslyn%26k%3Dk(BC41999)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea on how i avoid this?&lt;/P&gt;&lt;P&gt;Code example:&lt;/P&gt;&lt;P&gt;oOcc.CreateGeometryProxy(oOccXZPlane, oOccXZPlane)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 11:26:11 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11375431#M141683</guid>
      <dc:creator>K.clement</dc:creator>
      <dc:date>2022-08-23T11:26:11Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fix a warning using the inventor API in vb.net</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11375643#M141688</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/9816493"&gt;@K.clement&lt;/a&gt;.&amp;nbsp; It would be difficult to diagnose without seeing more of the code, but based on the error link, it seems to be trying to convert one object type to another, and that won't work.&amp;nbsp; I know that specific function is designed to set the value of the second input variable (a pre-existing variable that is supposed to be defined as one of the 'proxy' type objects).&amp;nbsp; It looks to me like you are supplying the same variable for both input variables of the function, which it was not designed for.&amp;nbsp; The first variable is for the source object that it is to get/create a proxy for, and the second variable is to hold the new proxy object that was retrieved/created from the first variable.&amp;nbsp; If dealing with WorkPlane object, the first input variable can be either a WorkPlane or a WorkPlaneProxy, but the second input variable should be pre-defined as a WorkPlaneProxy Type object.&amp;nbsp; Technically, the WorkPlaneProxy Class is derived from the WorkPlane Class, so it may not normally throw an error when directly converting between the two within the iLogic environment, but I'm not sure about within the Visual Studio / VB.NET environment.&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 12:51:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11375643#M141688</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2022-08-23T12:51:39Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fix a warning using the inventor API in vb.net</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11375696#M141689</link>
      <description>&lt;P&gt;a bigger example:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oADef As ComponentDefinition = g_inventorApplication.ActiveDocument.ComponentDefinition&lt;BR /&gt;Dim oAsmXYPlane As WorkPlane = oADef.WorkPlanes.Item(3) 'Assembly XY Plane&lt;BR /&gt;Dim oAsmZAxis As WorkAxis = oADef.WorkAxes.Item(3) 'Assembly Z Axis&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim oODef As ComponentDefinition = oOcc.Definition&lt;BR /&gt;Dim oOccXYPlane As WorkPlane = oODef.WorkPlanes.Item(3) 'Occurrence XY Plane&lt;BR /&gt;Dim oOccZAxis As WorkAxis = oODef.WorkAxes.Item(3) 'Occurrence Z Axis&lt;BR /&gt;oOcc.CreateGeometryProxy(oOccXYPlane, oOccXYPlane)&lt;BR /&gt;oOcc.CreateGeometryProxy(oOccZAxis, oOccZAxis)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This is a bigger example, do note that :&lt;/P&gt;&lt;P&gt;- This Code works, (it only gives a annoying warning)&lt;/P&gt;&lt;P&gt;- Defining:&amp;nbsp; Dim x as workplaneproxy&amp;nbsp; /&amp;nbsp;&amp;nbsp;oOcc.CreateGeometryProxy(oOccXYPlane, x) gives the same warning:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Aug 2022 13:04:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11375696#M141689</guid>
      <dc:creator>K.clement</dc:creator>
      <dc:date>2022-08-23T13:04:23Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fix a warning using the inventor API in vb.net</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11379174#M141760</link>
      <description>&lt;P&gt;Looking at the code I expect this is not an iLogic rule. (But an addin?) Anyway, I guess that your function looks something like this:&lt;/P&gt;
&lt;LI-CODE lang="visual-basic"&gt;Public Sub YourFunction(oOcc As ComponentOccurrence)
	Dim oADef As ComponentDefinition = g_inventorApplication.ActiveDocument.ComponentDefinition
	Dim oAsmXYPlane As WorkPlane = oADef.WorkPlanes.Item(3) 'Assembly XY Plane
	Dim oAsmZAxis As WorkAxis = oADef.WorkAxes.Item(3) 'Assembly Z Axis


	Dim oODef As ComponentDefinition = oOcc.Definition
	Dim oOccXYPlane As WorkPlane = oODef.WorkPlanes.Item(3) 'Occurrence XY Plane
	Dim oOccZAxis As WorkAxis = oODef.WorkAxes.Item(3) 'Occurrence Z Axis
	oOcc.CreateGeometryProxy(oOccXYPlane, oOccXYPlane)
	oOcc.CreateGeometryProxy(oOccZAxis, oOccZAxis)
End Sub&lt;/LI-CODE&gt;
&lt;P&gt;What I understand from the Microsoft link that you send is that your function is not defined correctly.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Did you try using the keywords ByVal or ByRef? Something like this:&lt;/P&gt;
&lt;LI-CODE lang="visual-basic"&gt;Public Sub YourFunction(ByVal oOcc As ComponentOccurrence)&lt;/LI-CODE&gt;
&lt;P&gt;or&lt;/P&gt;
&lt;LI-CODE lang="visual-basic"&gt;Public Sub YourFunction(ByRef oOcc As ComponentOccurrence)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 24 Aug 2022 20:05:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11379174#M141760</guid>
      <dc:creator>JelteDeJong</dc:creator>
      <dc:date>2022-08-24T20:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fix a warning using the inventor API in vb.net</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11379918#M141771</link>
      <description>&lt;P&gt;You are correct, this is a addin, and this is indeed the function I made &lt;img class="lia-deferred-image lia-image-emoji" src="https://forums.autodesk.com/html/@7B4B80143EBEB4F250CEEC82342F6CA1/emoticons/1f609.png" alt=":winking_face:" title=":winking_face:" /&gt;&lt;/P&gt;&lt;P&gt;I did not use 'byref or byval oOcc as ComponentOccurrence', but adding this to the sub argument does not fix the warning.&lt;/P&gt;&lt;P&gt;this might help:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Kclement_0-1661408784670.png" style="width: 909px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1107819i6B18C0A0AAEDC52C/image-dimensions/909x100?v=v2" width="909" height="100" role="button" title="Kclement_0-1661408784670.png" alt="Kclement_0-1661408784670.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 06:31:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11379918#M141771</guid>
      <dc:creator>K.clement</dc:creator>
      <dc:date>2022-08-25T06:31:07Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to fix a warning using the inventor API in vb.net</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11379933#M141772</link>
      <description>&lt;P&gt;i figured it out, there is no mistake here, but this gets rid of the warning&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Dim objWorkPlane As Object&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;firstCompOcc.CreateGeometryProxy(nativeWorkPlane, objWorkPlane)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If TypeOf (objWorkPlane) Is WorkPlaneProxy Then&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Dim proxyWorkPlane As WorkPlaneProxy&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;proxyWorkPlane = CType(objWorkPlane, WorkPlaneProxy)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;End If&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 25 Aug 2022 06:38:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/trying-to-fix-a-warning-using-the-inventor-api-in-vb-net/m-p/11379933#M141772</guid>
      <dc:creator>K.clement</dc:creator>
      <dc:date>2022-08-25T06:38:06Z</dc:date>
    </item>
  </channel>
</rss>

