You confused me so much that I can not understand what you need.
I see what you would do:
1. exe-file has to run AutoCAD and load the dll-file in the AutoCAD command NETLOAD
2. dll-to interact with the exe-file and receive data from it. How you do it - I do not know.
Problem of the interaction of two processes unrelated to programming in AutoCAD .NET API
For example: http://www.codeproject.com/Articles/138290/Program
3. exe-file does not need to refer to dll-file.
Ok I just want to know it this is possible:
1. I have a .dll that gets called by an exe, that will launch AutoCad ( that part works)
2. I want it to accept an array argument so that it can create some graphics in the AutoCad session that is now open.
Can an exe file pass a dll an argument? If so, how?
The exe is a standalone, and the dll is basically an AutoCad dll.
>>Ok I just want to know it this is possible:
>>1. I have a .dll that gets called by an exe, that will launch AutoCad ( that part works)
Why do you need dll-file, if exe-file itself can run AutoCAD? You put me in a deadlock.
>>2. I want it to accept an array argument so that it can create some graphics in the AutoCad session that is now open.
The easiest way:
1) write down your’s array to a “file with a specific name” from exe-file.
2) register with dll-file new command in AutoCAD (for example, with name “StartTransArray”)
3) start command “StartTransArray” with exe-file
4) function which registered as command handler read “file with a specific name” and draw graphics to AutoCAD based on this file content.
Although Alex has replyed...
Yes, you can have a DLL, that is called from EXE, to start AutoCAD (but why, I'd ask as Alex asked? Is launching AutoCAD via COM that complicated to deserve a separate DLL project?). In this ccase, the DLL IS PART of the process of the EXE. Thus, you CANNOT use AutoCAD ObjectARX .NET assemblies (acdbmgd/acmgd.dll).
Here's the thing; we are going to use a web application that will launch a dll and pass it an array.
That dll will launch AutoCad and run the program using the array as the information it will use to set the variables in the program.
It was not my call to do it this way.
The web app developer that is creating the web app is out right now, so I don't have his web app to use to test my code. So, I was just trying to create a simple exe file to use in it's place until they came back. They will be gone for 3 weeks and the project needs to be finished in about 4 weeks. Yay for me :-(
That's why I needed the exe to launch the dll which in turn would launch AutoCad and run using the variables passed to it.
Not sure how you 'launch' a dll, but I am not familiar how but there might be a way to create an entry point for a dll.
If you have to ship it very soon and just need to get it going the first hack that comes to mind is to serialize the data to the same location as the dll, and have a static initializer in the class of the first method called that will deserialize the data.
Sounds and feels pretty hackish, but maybe searching for "C# dll main" or "Class Library entry point" might turn up some results.
Thank you for your help (on this and stuff in the past). Ok we've decided to go another route. We're going to stick to the text file that the dll will read and get all it's info. So I've updated the code and all is wonderful, but now they also want me to save and exit AutoCad when the drawing is complete.
I have the save part down, but I cannot quit AutoCad as the program was "netloaded".
Can you please tell me how to launch AutoCad, create graphics, save and then close AutoCad? I've read a bunch of things and I know you can launch AutoCad from a dll, but the problem happens when you try to create graphic objects because the launching program doesn't like having a reference to "acdbmgd".
This is some of the code I'm using to launch:
Public Sub POD()
Const progID As String = "AutoCAD.Application.18" Dim acApp As AcadApplication = Nothing Try ' Get a running instance of AutoCad acApp = DirectCast(Marshal.GetActiveObject(progID), AcadApplication) Catch 'ex As Exception Try Dim acType As Type = Type.GetTypeFromProgID(progID) acApp = DirectCast(Activator.CreateInstance(acType, True), AcadApplication) Catch 'ex2 As Exception If IsProcessRunning("acad") = False Then MsgBox("Cannot create object of type """ & progID & """") Else acApp = DirectCast(Marshal.GetActiveObject(progID), AcadApplication) End If End Try End Try ' AutoCad should be running If acApp IsNot Nothing Then acApp.Visible = True
I've always used netload, but I know some people can launch AutoCad, do stuff in the drawings, then close the drawings and exit AutoCad. Can you show me how to do that? I want to expand past "just netloading".
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register
Start with some of our most frequented solutions to get help installing your software.