I tried your suggestions at home and the build still failed with the following message:
Could not load file or assembly 'accoremgd, Version=23.0.0.0, Culture=neutral, PublicKeyToken=null'
or one of its dependencies. The system cannot find the file specified.
Here is a summary of the steps I have taken and the results:
1. start Visual Studio 2017 as administrator
2. start a new Visual Basic class library project
3. set project properties
4. set target framework = .Net Framework 4.7.1
5. Make assembly COM-Visible = check
6. set Target CPU = x64
7. Register for COM interop = check
8. Start action = Start project
9. References (all in C:\Program Files\Autodesk\AutoCAD 2019)
accoremgd.dll
acdbmgd.dll
acmgd.dll
AcWindows.dll
Autodesk.AutoCAD.Interop.dll
Autodesk.AutoCAD.Interop.Common.dll
10. added code (see code below )
11. in VS select build - build
12. get error noted above
13. the following files were created in "C:\custom\ccTools\ccTools\bin\x64\Debug"
acmgd.dll
ccTools.dll
ccTools.pdb
ccTools.xml
14. nothing was added to the registry
15. ccTools runs successfully in AutoCAD using NetLoad as the command line
code --------------------------------------------
Imports Autodesk.AutoCAD.ApplicationServices
Imports Autodesk.AutoCAD.DatabaseServices
Imports Autodesk.AutoCAD.Geometry
Imports Autodesk.AutoCAD.Runtime
Public Class SolidsCLS
<CommandMethod("Test123")>
Public Sub ExtrudeRegionTest()
Dim pStartPoint As Point3d
Dim pEndPoint As Point3d
Dim pDiameter As Double
pStartPoint = New Point3d(100, 200, 300)
pEndPoint = New Point3d(200, 300, 400)
pDiameter = 10
CylinderExtrude(pStartPoint, pEndPoint, pDiameter)
End Sub
Public Function CylinderExtrude(
ByVal iStartpoint As Point3d,
ByVal iEndPoint As Point3d,
ByVal iDiameter As Double
) As Solid3d
Dim pDirectionVector = New Vector3d(
iEndPoint.X - iStartpoint.X,
iEndPoint.Y - iStartpoint.Y,
iEndPoint.Z - iStartpoint.Z
)
Dim pCircle As New Circle(iStartpoint, pDirectionVector, iDiameter / 2)
Dim pDBObjColl As DBObjectCollection = New DBObjectCollection()
pDBObjColl.Add(pCircle)
Dim pRegionColl As DBObjectCollection = New DBObjectCollection()
pRegionColl = Autodesk.AutoCAD.DatabaseServices.Region.
CreateFromCurves(pDBObjColl)
Dim pRegion As Region = pRegionColl(0)
Dim myTransMan As Autodesk.AutoCAD.ApplicationServices.TransactionManager
Dim myTrans As Transaction
Dim myDWG As Document
Dim myBT As BlockTable
Dim myBTR As BlockTableRecord
myDWG = Autodesk.AutoCAD.ApplicationServices.Application.
DocumentManager.MdiActiveDocument
Dim myLock As DocumentLock
myLock = myDWG.LockDocument
myDWG = Autodesk.AutoCAD.ApplicationServices.Application.
DocumentManager.MdiActiveDocument
myTransMan = myDWG.TransactionManager
myTrans = myTransMan.StartTransaction
myBT = myDWG.Database.BlockTableId.GetObject(OpenMode.ForRead)
myBTR = myBT(BlockTableRecord.ModelSpace).GetObject(OpenMode.ForWrite)
Dim pSolid As Solid3d
pSolid = New Autodesk.AutoCAD.DatabaseServices.Solid3d
pSolid.RecordHistory = True
Dim DirectionVector = New Vector3d(
iEndPoint.X - iStartpoint.X,
iEndPoint.Y - iStartpoint.Y,
iEndPoint.Z - iStartpoint.Z
)
Dim mySweepOptions As New SweepOptions()
pSolid.CreateExtrudedSolid(pRegion, DirectionVector, mySweepOptions)
myBTR.AppendEntity(pSolid)
myTrans.AddNewlyCreatedDBObject(pSolid, True)
myTrans.Commit()
myTrans.Dispose()
myTransMan.Dispose()
Return pSolid
myLock.Dispose()
Autodesk.AutoCAD.ApplicationServices.Application.
DocumentManager.MdiActiveDocument.Editor.Regen()
End Function
End Class
code --------------------------------------------
Thanks for your help so far and if you could take a look a look at this again I would very much appreciate it.
Fred