<?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: Custom property in OPM in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3857003#M50087</link>
    <description>&lt;P&gt;No problmem. Thank you guys for helping people like me... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still don't understand. According to comments in Kean's blog, this DLL runs on 32bit systems (which is my case, too).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Besides, I have no errors when I run the C#-version of the code, only in VB.net (using the same machine, the same environnement, the same AutoCAD-version...)&lt;/P&gt;&lt;P&gt;Amazing ?!??&lt;/P&gt;</description>
    <pubDate>Thu, 11 Apr 2013 18:32:10 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2013-04-11T18:32:10Z</dc:date>
    <item>
      <title>Custom property in OPM</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3840980#M50080</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to translate the C# code from &lt;A href="http://through-the-interface.typepad.com/through_the_interface/2009/03/exposing-autocads-properties-palette-functionality-to-net---part-2.html" target="_blank"&gt;this post&lt;/A&gt; to VB.NET.&lt;/P&gt;&lt;P&gt;It's about exposing an ObjectARX module to .NET.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I've ever tried converting by hand, or even with online converters. In both case, I've no syntax errors, but when I run the VB.NET code, I get a singular&amp;nbsp;&lt;SPAN&gt;"TypeLoadException: &lt;EM&gt;Signature&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;of the body and&amp;nbsp;&lt;/SPAN&gt;&lt;EM&gt;declaration&lt;/EM&gt;&lt;SPAN&gt;&amp;nbsp;in a method implementation do not match.&lt;/SPAN&gt;" during the &lt;SPAN&gt;MyEntryPoint.&lt;/SPAN&gt;Initialize method.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I don't get this exception when I run the C# code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I'm using AutoCAD 2012 32bits.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;So what's wrong ? Could a guru here help me, please ?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;Public Class EntryPoint
        Implements IExtensionApplication

        Private custProp As CustomProp = Nothing

        Public Sub Initialize() Implements IExtensionApplication.Initialize
            Dim folderPath As String = System.IO.Path.GetDirectoryName(Reflection.Assembly.GetExecutingAssembly.Location)
            Dim assemblyPath = System.IO.Path.Combine(folderPath, "asdkOPMNetExt.dll")
            Reflection.Assembly.LoadFrom(&lt;SPAN&gt;asdkOPMNetExt.dll&lt;/SPAN&gt;&lt;SPAN&gt;)&lt;BR /&gt;'Add the Dynamic Property&lt;BR /&gt;Dim classDict As Dictionary = SystemObjects.ClassDictionary&lt;BR /&gt;Dim lineDesc As RXClass = DirectCast(classDict.At("AcDbLine"), RXClass)&lt;BR /&gt;Dim pPropMan As IPropertyManager2 = DirectCast(xOPM.xGET_OPMPROPERTY_MANAGER(lineDesc), IPropertyManager2)&lt;BR /&gt;&lt;/SPAN&gt;custProp = New CustomProp() pPropMan.AddProperty(DirectCast(custProp, Object))&lt;BR /&gt;End Sub&lt;BR /&gt;&lt;BR /&gt;Public Sub Terminate() Implements IExtensionApplication.Terminate&lt;BR /&gt;' Remove the Dynamic Property&lt;BR /&gt;Dim classDict As Dictionary = SystemObjects.ClassDictionary&lt;BR /&gt;Dim lineDesc As RXClass = DirectCast(classDict.At("AcDbLine"), RXClass)&lt;BR /&gt;Dim pPropMan As IPropertyManager2 = DirectCast(xOPM.xGET_OPMPROPERTY_MANAGER(lineDesc), IPropertyManager2)&lt;BR /&gt;pPropMan.RemoveProperty(DirectCast(custProp, Object))&lt;BR /&gt;custProp = Nothing&lt;BR /&gt;End Sub&lt;BR /&gt;End Class&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt; &amp;lt;Guid("F60AE3DA-0373-4d24-82D2-B2646517ABCB"), ProgId("OPMNetSample.CustomProperty.1"), ClassInterface(ClassInterfaceType.None), ComDefaultInterface(GetType(IDynamicProperty2)), ComVisible(True)&amp;gt; _
    Public Class CustomProp
        Implements IDynamicProperty2
        Private m_pSink As IDynamicPropertyNotify2 = Nothing

        ' Unique property ID

        Public Sub GetGUID(ByRef propGUID As Guid) Implements IDynamicProperty2.GetGUID
            propGUID = New Guid("F60AE3DA-0373-4d24-82D2-B2646517ABCB")
        End Sub

        ' Property display name

        Public Sub GetDisplayName(ByRef szName As String) Implements IDynamicProperty2.GetDisplayName
            szName = "My integer property"
        End Sub

        ' Show/Hide property in the OPM, for this object instance

        Public Sub IsPropertyEnabled(pUnk As Object, ByRef bEnabled As Integer) Implements IDynamicProperty2.IsPropertyEnabled
            bEnabled = 1
        End Sub

        ' Is property showing but disabled

        Public Sub IsPropertyReadOnly(ByRef bReadonly As Integer) Implements IDynamicProperty2.IsPropertyReadOnly
            bReadonly = 0
        End Sub

        ' Get the property description string

        Public Sub GetDescription(ByRef szName As String) Implements IDynamicProperty2.GetDescription
            szName = "This property is an integer"
        End Sub

        ' OPM will typically display these in an edit field
        ' optional: meta data representing property type name,
        ' ex. ACAD_ANGLE

        Public Sub GetCurrentValueName(ByRef szName As String) Implements IDynamicProperty2.GetCurrentValueName
            Throw New System.NotImplementedException()
        End Sub

        ' What is the property type, ex. VT_R8

        Public Sub GetCurrentValueType(ByRef varType As UShort) Implements IDynamicProperty2.GetCurrentValueType
            ' The Property Inspector supports the following data
            ' types for dynamic properties:
            ' VT_I2, VT_I4, VT_R4, VT_R8,VT_BSTR, VT_BOOL
            ' and VT_USERDEFINED.

            varType = 3
            ' VT_I4
        End Sub

        ' Get the property value, passes the specific object
        ' we need the property value for.

        Public Sub GetCurrentValueData(pUnk As Object, ByRef pVarData As Object) Implements IDynamicProperty2.GetCurrentValueData
            ' TODO: Get the value and return it to AutoCAD

            ' Because we said the value type was a 32b int (VT_I4)
            pVarData = CInt(4)
        End Sub

        ' Set the property value, passes the specific object we
        ' want to set the property value for

        Public Sub SetCurrentValueData(pUnk As Object, varData As Object) Implements IDynamicProperty2.SetCurrentValueData
            ' TODO: Save the value returned to you

            ' Because we said the value type was a 32b int (VT_I4)
            Dim myVal As Integer = CInt(varData)
        End Sub

        ' OPM passes its implementation of IDynamicPropertyNotify, you
        ' cache it and call it to inform OPM your property has changed

        Public Sub Connect(pSink As Object) Implements IDynamicProperty2.Connect
            m_pSink = DirectCast(pSink, IDynamicPropertyNotify2)
        End Sub

        Public Sub Disconnect() Implements IDynamicProperty2.Disconnect
            m_pSink = Nothing
        End Sub
    End Class&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2013 17:25:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3840980#M50080</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-08T17:25:20Z</dc:date>
    </item>
    <item>
      <title>Re: Custom property in OPM</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3841347#M50081</link>
      <description>&lt;P&gt;Why are you trying to convert it? It's just a waste of time &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; Just reference the code&amp;nbsp;(via a C# DLL) from your VB.NET code and be done?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2013 22:14:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3841347#M50081</guid>
      <dc:creator>fenton_webb</dc:creator>
      <dc:date>2013-04-08T22:14:22Z</dc:date>
    </item>
    <item>
      <title>Re: Custom property in OPM</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3841356#M50082</link>
      <description>&lt;P&gt;Hi Fenton,&lt;/P&gt;&lt;P&gt;Thanks for your reply,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, of course... &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But I &lt;EM&gt;would like&lt;/EM&gt;&amp;nbsp;to undestand why it does work in VB...?! Any idea ?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Also, thinking about referencing it, how could i add more custom properties : would I have to duplicate this C# code n-times ?...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In fact, the goal was to write some "generic code", something like an abstract class...&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2013 22:22:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3841356#M50082</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-08T22:22:35Z</dc:date>
    </item>
    <item>
      <title>Re: Custom property in OPM</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3841369#M50083</link>
      <description>&lt;P&gt;If you send me a build able "ready to go" project, I'll take a look for ya...&lt;/P&gt;</description>
      <pubDate>Mon, 08 Apr 2013 22:37:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3841369#M50083</guid>
      <dc:creator>fenton_webb</dc:creator>
      <dc:date>2013-04-08T22:37:49Z</dc:date>
    </item>
    <item>
      <title>Re: Custom property in OPM</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3841526#M50084</link>
      <description>&lt;P&gt;The project is here...&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 09 Apr 2013 05:56:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3841526#M50084</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-09T05:56:52Z</dc:date>
    </item>
    <item>
      <title>Re: Custom property in OPM</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3848940#M50085</link>
      <description>&lt;P&gt;Hi Fenton,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you had time for looking at these files ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2013 06:36:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3848940#M50085</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-11T06:36:02Z</dc:date>
    </item>
    <item>
      <title>Re: Custom property in OPM</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3856955#M50086</link>
      <description>&lt;P&gt;Sorry for the delay.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The problem is that, as with all mixed mode DLLs, you need a specific 32bit and 64bit versions to target both 32bit and 64bit versions of AutoCAD. You are referencing the 64bit version and running it on a 32bit version of AutoCAD.&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2013 18:05:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3856955#M50086</guid>
      <dc:creator>fenton_webb</dc:creator>
      <dc:date>2013-04-11T18:05:41Z</dc:date>
    </item>
    <item>
      <title>Re: Custom property in OPM</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3857003#M50087</link>
      <description>&lt;P&gt;No problmem. Thank you guys for helping people like me... &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I still don't understand. According to comments in Kean's blog, this DLL runs on 32bit systems (which is my case, too).&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Besides, I have no errors when I run the C#-version of the code, only in VB.net (using the same machine, the same environnement, the same AutoCAD-version...)&lt;/P&gt;&lt;P&gt;Amazing ?!??&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2013 18:32:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3857003#M50087</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-11T18:32:10Z</dc:date>
    </item>
    <item>
      <title>Re: Custom property in OPM</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3857033#M50088</link>
      <description>&lt;P&gt;try building your app as x86 rather than Any CPU&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2013 18:49:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3857033#M50088</guid>
      <dc:creator>fenton_webb</dc:creator>
      <dc:date>2013-04-11T18:49:55Z</dc:date>
    </item>
    <item>
      <title>Re: Custom property in OPM</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3857039#M50089</link>
      <description>&lt;P&gt;I tried, it did not change anything ...&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2013 18:55:16 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3857039#M50089</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-11T18:55:16Z</dc:date>
    </item>
    <item>
      <title>Re: Custom property in OPM</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3857244#M50090</link>
      <description>&lt;P&gt;I compiled these 2 DLLs - one for 32bit and one for 64bit&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2013 22:18:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3857244#M50090</guid>
      <dc:creator>fenton_webb</dc:creator>
      <dc:date>2013-04-11T22:18:45Z</dc:date>
    </item>
    <item>
      <title>Re: Custom property in OPM</title>
      <link>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3857263#M50091</link>
      <description>&lt;P&gt;...thank you Fenton, I've just tried the 32bits-dll, but it doesn't work. &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Still the same error...&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;And as Kean's DLL, yours only works for C# code.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Have you tried running my own code ? Have you like me the issue with the same TypeLoadException ?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 11 Apr 2013 22:46:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/custom-property-in-opm/m-p/3857263#M50091</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2013-04-11T22:46:34Z</dc:date>
    </item>
  </channel>
</rss>

