+ Reply to Thread
Results 1 to 3 of 3
  1. #1
    Full Member
    Discipline
    Electrical
    btraemoore's Discipline Details
    Occupation
    Electrical Designer
    Discipline
    Electrical
    Using
    AutoCAD 2012
    Join Date
    Apr 2012
    Location
    Houston
    Posts
    60

    Default simple simple... connecting to 2006 via interop

    Registered forum members do not see this ad.

    okay, im trying to get a connection to 2006 and im having problems. i used keen(through the interface) example and its throwing a COM exception, BUT it is creating the instance of autocad. I dont think it is connected to it, but it creates it.

    NOW, when i downloaded the objectARX for 2006 there where no interop.dll's just the 3 "acdbmgd" variations... im just learing how to work with c#. Can some one throw me a little bone here here is my code.

    Code:
    public MainForm() {
    			InitializeComponent();
    			IMessageFilter oldFilter = default(IMessageFilter);
    			CoRegisterMessageFilter(this, oldFilter);
    			
    			AcadApplication acApp = GetAcApp("AutoCAD.Application.16.2");
    			
    		}
    		
    		public AcadApplication GetAcApp(string progID){
    		AcadApplication acApp = null;
    		try {
    			acApp = (AcadApplication)Marshal.GetActiveObject(progID);
    		} catch {
    			try {
    				Type acType = Type.GetTypeFromProgID(progID);
    				acApp = (AcadApplication)Activator.CreateInstance(acType,true);
    		
    			} catch {
    				MessageBox.Show("Cannot create object of type \"" + progID + "\"");
    			}
    		}
    		if (acApp != null) {
    			// By the time this is reached AutoCAD is fully
    			// functional and can be interacted with through code
    			acApp.Visible = true;
    			return acApp;
    		}
    		return null;
    	}

  2. #2
    Luminous Being BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    2 x 240GB Samsung EVO SSD (RAID 0)
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Discipline
    Civil
    BlackBox's Discipline Details
    Occupation
    Senior Civil Designer
    Discipline
    Civil
    Details
    Public/Private Land Development, Transportation, and Utilities.
    Using
    Civil 3D 2016
    Join Date
    Nov 2009
    Posts
    5,282

    Default

    It sounds like you're attempting to create a stand-alone EXE, in lieu of a plug-in (an assembly that is loaded into an active session of AutoCAD), is this correct?

    If instead you're after a plug-in, and you're already coding in C#, why not just use the .NET API (AcDbMgd.dll, AcMgd.dll) in lieu of COM?
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Exchange Apps ~ Autoloader ~ AutoCAD Security

  3. #3
    Full Member
    Discipline
    Electrical
    btraemoore's Discipline Details
    Occupation
    Electrical Designer
    Discipline
    Electrical
    Using
    AutoCAD 2012
    Join Date
    Apr 2012
    Location
    Houston
    Posts
    60

    Default

    Registered forum members do not see this ad.

    I would like to learn both using the .NET API and COM. I have had a really hard time finding some good examples that explain verbosely about both. If you know where i can find any i would be very appreciative.

Similar Threads

  1. Simple program. Simple answer
    By Hasan Faruk in forum AutoLISP, Visual LISP & DCL
    Replies: 6
    Last Post: 24th Apr 2013, 02:58 pm
  2. simple one
    By alijahed in forum AutoCAD General
    Replies: 2
    Last Post: 23rd Oct 2008, 12:56 am
  3. simple hopefully
    By russell84 in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 9th May 2008, 03:13 am
  4. A simple way to do this?
    By George Duls in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 6th Dec 2007, 03:27 pm
  5. Simple simple, huh? rectangles how are they built?
    By Anna_here in forum AutoCAD Beginners' Area
    Replies: 6
    Last Post: 2nd Aug 2006, 09:18 pm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts