<?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 回复： create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8844361#M22190</link>
    <description>&lt;P&gt;The reason that I want to call the DLL from VBA is so that I can integrate it into a larger, existing VBA application. The CreateExtrudedSolid function in AutoCAD.Net provides a very succinct way to create an extrusion between any two points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I read your first link previously but took a closer look. The page and links did not lead to a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added the code in your second link to catch the AssemblyResolve event but the build fails so the code does not get a chance to run.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your replies.&lt;/P&gt;</description>
    <pubDate>Tue, 11 Jun 2019 12:15:59 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2019-06-11T12:15:59Z</dc:date>
    <item>
      <title>create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8842698#M22187</link>
      <description>&lt;P&gt;I am trying to create a DLL which includes AutoCAD.Net functionality that is callable from VBA within AutoCAD.&lt;BR /&gt;To start off I created a simple DLL that contained no AutoCAD functionality that works by checking "Make assembly COM-visible" and "Register for COM interop".&lt;/P&gt;&lt;P&gt;I then created a DLL with some AUOCAD.Net functionality (CreateExtrudedSolid) but I get the following error&lt;BR /&gt;during the build:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could not load file or assembly 'accoremgd, Version=23.0.0.0, Culture=neutral, PublicKeyToken=null'&lt;BR /&gt;or one of its dependencies. The system cannot find the file specified.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using Windows 10, .Net Framework 4.7.1, Visual Stuio 2017, AutoCAD 2019 and by class imports the following:&lt;/P&gt;&lt;P&gt;Autodesk.AutoCAD.ApplicationServices&lt;BR /&gt;Autodesk.AutoCAD.DatabaseServices&lt;BR /&gt;Autodesk.AutoCAD.Geometry&lt;BR /&gt;Autodesk.AutoCAD.Runtime&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have added the following references&lt;/P&gt;&lt;P&gt;accoremgd.dll&lt;BR /&gt;acdbmgd.dll&lt;BR /&gt;acmgd.dll&lt;BR /&gt;AcWindows.dll&lt;BR /&gt;Autodesk.AutoCADInterop.dll&lt;BR /&gt;Autodesk.AutoCADInterop.Common.dll&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How do I make this work?&lt;/P&gt;&lt;P&gt;Thanks for your help.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Jun 2019 16:51:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8842698#M22187</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-10T16:51:50Z</dc:date>
    </item>
    <item>
      <title>回复： create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8843642#M22188</link>
      <description>&lt;P&gt;Excuse me , why you need it "callable from VBA"? I mean, you can run a dll directly without VBA&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 04:48:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8843642#M22188</guid>
      <dc:creator>TiStars</dc:creator>
      <dc:date>2019-06-11T04:48:37Z</dc:date>
    </item>
    <item>
      <title>回复： create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8843665#M22189</link>
      <description>&lt;P&gt;I just googled your error message then got these 2, hope they are helpful.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;btw, I think the way you call it is unusual.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://forums.autodesk.com/t5/net/could-not-load-file-or-assembly-accoremgd-dll-or-one-of-its/m-p/3616886#M31123" target="_blank"&gt;https://forums.autodesk.com/t5/net/could-not-load-file-or-assembly-accoremgd-dll-or-one-of-its/m-p/3616886#M31123&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://stackoverflow.com/questions/39658086/could-not-load-file-or-assembly-accoremgd-version-20-0-0-0-culture-neutral-pu" target="_blank"&gt;https://stackoverflow.com/questions/39658086/could-not-load-file-or-assembly-accoremgd-version-20-0-0-0-culture-neutral-pu&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 05:10:23 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8843665#M22189</guid>
      <dc:creator>TiStars</dc:creator>
      <dc:date>2019-06-11T05:10:23Z</dc:date>
    </item>
    <item>
      <title>回复： create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8844361#M22190</link>
      <description>&lt;P&gt;The reason that I want to call the DLL from VBA is so that I can integrate it into a larger, existing VBA application. The CreateExtrudedSolid function in AutoCAD.Net provides a very succinct way to create an extrusion between any two points.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I read your first link previously but took a closer look. The page and links did not lead to a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I added the code in your second link to catch the AssemblyResolve event but the build fails so the code does not get a chance to run.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your replies.&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 12:15:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8844361#M22190</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-11T12:15:59Z</dc:date>
    </item>
    <item>
      <title>回复： create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8845845#M22191</link>
      <description>&lt;P&gt;I tried with AutoCAD 2018 and VS2017 and do not think the result would be different for AutoCAD 2019. In my case, I do not get compiling error as you described. Here is what I did:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1. Create AutoCAD .NET Add-in DLL project, add references to AutoCAD .NET assemblies (accoremgd/acdbmgd/acmgd.dll)&lt;/P&gt;
&lt;P&gt;2. Add public classes of business domain as needed in the project;&lt;/P&gt;
&lt;P&gt;3. In the Project's "Properties" window page, make sure these:&lt;/P&gt;
&lt;P&gt;a. "Application": I choose to target .NET4.7x (but .NET4.6x should be find for my Acad2018)&lt;/P&gt;
&lt;P&gt;b. "Application": click "Assembly Information..." button, and select "Make assembly COM-Visible";&lt;/P&gt;
&lt;P&gt;c. "Build": MAKE SURE to set "Platform target" to "&lt;FONT color="#FF0000"&gt;&lt;STRONG&gt;x64&lt;/STRONG&gt;&lt;/FONT&gt;" (since it is to be used as COM, it must be either 32, or 64 bit, not "Any CPU");&lt;/P&gt;
&lt;P&gt;d. "Build": select "Register for COM interop";&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Note, I run VS2017 as "Administrator", otherwise, after compiling, my regular user account is not allowed to register COM component.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Then, I do not have problem compile the DLL (and upon building completion, a COM class "[MyNetDll.MyClass]" is registered in Windows registry (I can find/browse it with RegEdt32.exe).&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I do not have access to Acad2019. but I may verify it with my Acad2020 later, but I do not expect to see the building error as you described.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 11 Jun 2019 22:02:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8845845#M22191</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2019-06-11T22:02:47Z</dc:date>
    </item>
    <item>
      <title>回复： create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8847010#M22192</link>
      <description>&lt;P&gt;I tried your suggestions and still get the accoremgd.dll error.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;One thing you said got me thinking though ... I wonder if our IT department have implemented some kind of security measure to prevent me from registering the COM component (yes, I've reached the paranoia stage of trouble shooting).&amp;nbsp; They say that they have not but I am going to try this at home and see if it works.&amp;nbsp; I'll let you know how I make out tomorrow.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks very much for your time.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Jun 2019 12:42:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8847010#M22192</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-12T12:42:25Z</dc:date>
    </item>
    <item>
      <title>回复： create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8849687#M22193</link>
      <description>&lt;P&gt;I tried your suggestions at home and the build still failed with the following message:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Could not load file or assembly 'accoremgd, Version=23.0.0.0, Culture=neutral, PublicKeyToken=null'&lt;BR /&gt;or one of its dependencies. The system cannot find the file specified.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a summary of the steps I have taken and the results:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1.&amp;nbsp; start Visual Studio 2017 as administrator&lt;BR /&gt;2.&amp;nbsp; start a new Visual Basic class library project&lt;BR /&gt;3.&amp;nbsp; set project properties&lt;BR /&gt;4.&amp;nbsp; set target framework = .Net Framework 4.7.1&lt;BR /&gt;5.&amp;nbsp; Make assembly COM-Visible = check&lt;BR /&gt;6.&amp;nbsp; set Target CPU = x64&lt;BR /&gt;7.&amp;nbsp; Register for COM interop = check&lt;BR /&gt;8.&amp;nbsp; Start action = Start project&lt;BR /&gt;9.&amp;nbsp; References (all in&amp;nbsp;C:\Program Files\Autodesk\AutoCAD 2019)&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; accoremgd.dll&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acdbmgd.dll&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; acmgd.dll&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AcWindows.dll&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Autodesk.AutoCAD.Interop.dll&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Autodesk.AutoCAD.Interop.Common.dll&lt;/P&gt;&lt;P&gt;10.&amp;nbsp; added code (see code below )&lt;/P&gt;&lt;P&gt;11.&amp;nbsp; in VS select build - build&lt;/P&gt;&lt;P&gt;12.&amp;nbsp; get error noted above&lt;/P&gt;&lt;P&gt;13.&amp;nbsp; the following files were created in "C:\custom\ccTools\ccTools\bin\x64\Debug"&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; acmgd.dll&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ccTools.dll&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ccTools.pdb&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; ccTools.xml&lt;/P&gt;&lt;P&gt;14.&amp;nbsp; nothing was added to the registry&lt;/P&gt;&lt;P&gt;15.&amp;nbsp; ccTools runs successfully in AutoCAD using NetLoad as the command line&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;code --------------------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Imports Autodesk.AutoCAD.ApplicationServices&lt;BR /&gt;Imports Autodesk.AutoCAD.DatabaseServices&lt;BR /&gt;Imports Autodesk.AutoCAD.Geometry&lt;BR /&gt;Imports Autodesk.AutoCAD.Runtime&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Class SolidsCLS&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;lt;CommandMethod("Test123")&amp;gt;&lt;BR /&gt;Public Sub ExtrudeRegionTest()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; Dim pStartPoint As Point3d&lt;BR /&gt;&amp;nbsp; &amp;nbsp; Dim pEndPoint As Point3d&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Dim pDiameter As Double&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pStartPoint = New Point3d(100, 200, 300)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pEndPoint = New Point3d(200, 300, 400)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; pDiameter = 10&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CylinderExtrude(pStartPoint, pEndPoint, pDiameter)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;End Sub&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Public Function CylinderExtrude(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ByVal iStartpoint As Point3d,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ByVal iEndPoint As Point3d,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ByVal iDiameter As Double&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; ) As Solid3d&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim pDirectionVector = New Vector3d(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iEndPoint.X - iStartpoint.X,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iEndPoint.Y - iStartpoint.Y,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iEndPoint.Z - iStartpoint.Z&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim pCircle As New Circle(iStartpoint, pDirectionVector, iDiameter / 2)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim pDBObjColl As DBObjectCollection = New DBObjectCollection()&lt;BR /&gt;pDBObjColl.Add(pCircle)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim pRegionColl As DBObjectCollection = New DBObjectCollection()&lt;BR /&gt;pRegionColl = Autodesk.AutoCAD.DatabaseServices.Region.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CreateFromCurves(pDBObjColl)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim pRegion As Region = pRegionColl(0)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim myTransMan As Autodesk.AutoCAD.ApplicationServices.TransactionManager&lt;BR /&gt;Dim myTrans As Transaction&lt;BR /&gt;Dim myDWG As Document&lt;BR /&gt;Dim myBT As BlockTable&lt;BR /&gt;Dim myBTR As BlockTableRecord&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myDWG = Autodesk.AutoCAD.ApplicationServices.Application.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DocumentManager.MdiActiveDocument&lt;BR /&gt;Dim myLock As DocumentLock&lt;BR /&gt;myLock = myDWG.LockDocument&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myDWG = Autodesk.AutoCAD.ApplicationServices.Application.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DocumentManager.MdiActiveDocument&lt;BR /&gt;myTransMan = myDWG.TransactionManager&lt;BR /&gt;myTrans = myTransMan.StartTransaction&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myBT = myDWG.Database.BlockTableId.GetObject(OpenMode.ForRead)&lt;BR /&gt;myBTR = myBT(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForWrite)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim pSolid As Solid3d&lt;BR /&gt;pSolid = New Autodesk.AutoCAD.DatabaseServices.Solid3d&lt;BR /&gt;pSolid.RecordHistory = True&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Dim DirectionVector = New Vector3d(&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iEndPoint.X - iStartpoint.X,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iEndPoint.Y - iStartpoint.Y,&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; iEndPoint.Z - iStartpoint.Z&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; )&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Dim mySweepOptions As New SweepOptions()&lt;BR /&gt;pSolid.CreateExtrudedSolid(pRegion, DirectionVector, mySweepOptions)&lt;BR /&gt;myBTR.AppendEntity(pSolid)&lt;BR /&gt;myTrans.AddNewlyCreatedDBObject(pSolid, True)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;myTrans.Commit()&lt;BR /&gt;myTrans.Dispose()&lt;BR /&gt;myTransMan.Dispose()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Return pSolid&lt;BR /&gt;myLock.Dispose()&lt;BR /&gt;Autodesk.AutoCAD.ApplicationServices.Application.&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DocumentManager.MdiActiveDocument.Editor.Regen()&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;End Function&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;End Class&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;code --------------------------------------------&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your help so far and if you could take a look a look at this again I would very much appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fred&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 13:26:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8849687#M22193</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-13T13:26:57Z</dc:date>
    </item>
    <item>
      <title>回复： create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8850022#M22194</link>
      <description>&lt;P&gt;OK, I repeated all the steps as you described, and indeed the build was failed with error. However, you failed provide the FULL ERROR message: it is NOT ONLY "Could not load file or assembly 'accoremdg,....', BUT ALSO the error message starts as"Cannot register assembly ".....\[theDll].dll".&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Obviously, the DLL assembly can be compiled, but registering it as COM component fails because of certain functionality in accoremgd.dll cannot be used for COM exposure, namely, they are CommandClassAttribute and CommandMethodAttribute, at least.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But think about it, if the COM DLL is to be used in VBA, there is no reason to have CommandClass/Method in it. The DLL should only contains classes with properties/methods that can be called by other COM-able code/VBA code.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want to test your COM-able .NET DLL with CommandClass/Method, you should wrap up the CommandClass/Method in another separate project that reference this DLL project. This way, the DLL project can be used by both .NET add-in, or be exposed as COM-able.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 15:16:49 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8850022#M22194</guid>
      <dc:creator>norman.yuan</dc:creator>
      <dc:date>2019-06-13T15:16:49Z</dc:date>
    </item>
    <item>
      <title>回复： create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8850085#M22195</link>
      <description>&lt;P&gt;Thank you very, very, very much.&amp;nbsp; Removing the&amp;nbsp;CommandMethod line fixed the problem.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Again, thanks.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Fred&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2019 15:36:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/8850085#M22195</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2019-06-13T15:36:02Z</dc:date>
    </item>
    <item>
      <title>回复： create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/12140078#M22196</link>
      <description>&lt;P&gt;Hi all&lt;BR /&gt;I've just started on my .Net journey and I've been battling with the very same issue.&lt;BR /&gt;From my side, just want to say thank you very, very much too.&lt;BR /&gt;Derrick&lt;/P&gt;</description>
      <pubDate>Tue, 01 Aug 2023 02:01:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/12140078#M22196</guid>
      <dc:creator>derrickw603S7WA</dc:creator>
      <dc:date>2023-08-01T02:01:10Z</dc:date>
    </item>
    <item>
      <title>Re: create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/12712666#M22197</link>
      <description>&lt;P&gt;I also am trying to add some functionality to an existing VBA application.&amp;nbsp; After I build my application, the JCK_VBA_Pipetools seems to be registered, but I'm unable to access the defined functions.&amp;nbsp; Does anyone know what I'm doing wrong?&amp;nbsp;&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="jklinkeB8EEG_0-1713289837678.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1350584iCAFAE02BCAD0C57A/image-size/medium?v=v2&amp;amp;px=400" role="button" title="jklinkeB8EEG_0-1713289837678.png" alt="jklinkeB8EEG_0-1713289837678.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.EditorInput
Imports Autodesk.Civil
Imports Autodesk.Civil.ApplicationServices

Public Class Class1
    Public Function getarea(x As Double, y As Double) As Double
        Return x * y
    End Function
    Public Function PipeHGL_HandleGet(HandEnt As String) As String ' This method can have any name
        PipeHGL_HandleGet = "No Pipe Exists"
        Try
            'Get Civil 3D application, document and database
            Dim CivDoc As CivilDocument = CivilApplication.ActiveDocument
            ' Dim JuncLoss = Us_HGMax - Us_HG
            Dim Doc As Document = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument
            'MsgBox("Working Here:2")
            Using lock As DocumentLock = Doc.LockDocument
                Dim db As Database = Doc.Database
                Dim ed As Editor = Doc.Editor
                Dim MyPipe As DatabaseServices.Pipe = Nothing
                Dim MyStr As DatabaseServices.Structure = Nothing
                Dim tr As Transaction = Doc.TransactionManager.StartTransaction()
                Try

                    Dim ln As Long = Convert.ToInt64(HandEnt, 16)
                    Dim hn As Handle = New Handle(ln)
                    ' And attempt to get an ObjectId for the Handle
                    Dim id As ObjectId = db.GetObjectId(False, hn, 0)
                    Dim obj As DBObject = tr.GetObject(id, OpenMode.ForWrite)
                    Try
                        Dim xy(0 To 2) As Double
                        Dim oPipe As DatabaseServices.Pipe
                        If TypeOf obj Is DatabaseServices.Pipe Then
                            oPipe = obj
                            PipeHGL_HandleGet = oPipe.HydraulicGradeLineDown.ToString &amp;amp; ":" &amp;amp; oPipe.HydraulicGradeLineUp.ToString &amp;amp; ":" &amp;amp; (oPipe.HydraulicGradeLineUp + oPipe.JunctionLoss).ToString
                        End If
                        tr.Commit()
                    Catch ex As Autodesk.AutoCAD.Runtime.Exception
                        ed.WriteMessage(ex.Message)
                        'tr.Abort()
                        MsgBox("The Pipe With Handle: " &amp;amp; HandEnt.ToString &amp;amp; vbLf &amp;amp; "Was Not Found")
                    Finally
                        'tr.Dispose()
                    End Try
                Catch ex As Autodesk.AutoCAD.Runtime.Exception
                    ed.WriteMessage(ex.Message)
                    tr.Abort()
                    MsgBox("The Pipe With Handle: " &amp;amp; HandEnt.ToString &amp;amp; vbLf &amp;amp; "Was Not Found")
                Finally
                    tr.Dispose()
                End Try

            End Using
        Catch 'ex As Exception
            MsgBox("Something went wrong, you may want to audit your drawing and try again")
        Finally

        End Try

    End Function
End Class&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 17:53:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/12712666#M22197</guid>
      <dc:creator>jklinkeB8EEG</dc:creator>
      <dc:date>2024-04-16T17:53:57Z</dc:date>
    </item>
    <item>
      <title>Re: create a DLL with AutoCAD.Net functionality to be used in AutoCAD VBA</title>
      <link>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/12713255#M22198</link>
      <description>&lt;P&gt;Making your code accessible via COM requires a bit more than simply checking "Register for COM interop".&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would suggest you &lt;A href="https://learn.microsoft.com/en-us/dotnet/framework/interop/exposing-dotnet-components-to-com" target="_blank" rel="noopener"&gt;start here&lt;/A&gt; to learn the basics of the process, paying special attention to topic that introduces the [ClassInterface] attribute.&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 00:37:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/create-a-dll-with-autocad-net-functionality-to-be-used-in/m-p/12713255#M22198</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2024-04-17T00:37:57Z</dc:date>
    </item>
  </channel>
</rss>

