Author Topic: launch command from exe not loaded in cad  (Read 6907 times)

0 Members and 1 Guest are viewing this topic.

BlackBox

  • King Gator
  • Posts: 3770
Re: launch command from exe not loaded in cad
« Reply #15 on: March 08, 2013, 02:42:16 PM »
I know that when CadWORX is being loaded up with AutoCAD it's done via command line arguments which are embedded in the shortcut that launches.  Is this just an argument that gets passed to the commandline?

I am not familiar with CadWORX product, but if it is being initialized via application icon, then methinks their using a Startup Switch to load (/ld) their plug-in(s)... Which is not to be confused with a stand alone EXE which is an entirely different Process altogether (the System.Diagnostics Class, not an actual procedure).
"How we think determines what we do, and what we do determines what we get."

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: launch command from exe not loaded in cad
« Reply #16 on: March 08, 2013, 06:15:42 PM »
Thanks for pointing to that info!

The CadWORX shortcut has the following:

Target: "C:\Program Files\AutoCAD 2010\acad.exe" /P CADWorx_Plant_2010

Start in: "C:\CADWorx 2010\Plant"


From looking at the link you supplied our extraterrestrial friend could load his lsp files with a script that he calls with "/b"?

BlackBox

  • King Gator
  • Posts: 3770
Re: launch command from exe not loaded in cad
« Reply #17 on: March 08, 2013, 06:21:54 PM »
A script call could be used, yes... But it loads after Acad.lsp and AcadDoc.lsp at the end of the startup sequence, and it's not exactly the most maintainable method, never mind capable. Consider post #3 of this thread.
"How we think determines what we do, and what we do determines what we get."

WILL HATCH

  • Bull Frog
  • Posts: 450
Re: launch command from exe not loaded in cad
« Reply #18 on: March 08, 2013, 11:26:12 PM »
I was just keeping in mind that he doesn't want this to be automatically loaded in case someone else jumps on the machine.

Since I don't know defun from da fun in the lisp world... What is so significant about when Acad.lsp and AcadDoc.lsp load?  Thanks

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: launch command from exe not loaded in cad
« Reply #19 on: March 09, 2013, 10:04:10 PM »
Thanks a mill gents... this is what i ended up using.
Code: [Select]
        private void button1_Click(object sender, EventArgs e)
        {
           
            const string progID = "AutoCAD.Application";
            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)
            {
                acApp.Visible = true;
                acApp.ActiveDocument.SendCommand("(load \"nameof.lsp\")" + "\n");
            }
        }

BlackBox

  • King Gator
  • Posts: 3770
Re: launch command from exe not loaded in cad
« Reply #20 on: March 10, 2013, 05:01:55 AM »
I was just keeping in mind that he doesn't want this to be automatically loaded in case someone else jumps on the machine.

Since I don't know defun from da fun in the lisp world... What is so significant about when Acad.lsp and AcadDoc.lsp load?  Thanks

If the LISP was loaded by the Script, and the Script were being loaded from the /b switch In the application icon's Target Property, then anyone who uses that application icon gains access to said LISP.

As for Acad.lsp, and AcadDoc.lsp, these are user-defined files which are automatically loaded at startup, and drawing open respectively (by default) if found within the SFSP.
"How we think determines what we do, and what we do determines what we get."

nobody

  • Swamp Rat
  • Posts: 861
  • .net stuff
Re: launch command from exe not loaded in cad
« Reply #21 on: March 10, 2013, 07:28:27 AM »
I actually am less concerned about access to the lisp than the fact that I've changed the alias for almost every basic command lol... they'd be screwed hehe

I was just keeping in mind that he doesn't want this to be automatically loaded in case someone else jumps on the machine.

Since I don't know defun from da fun in the lisp world... What is so significant about when Acad.lsp and AcadDoc.lsp load?  Thanks

If the LISP was loaded by the Script, and the Script were being loaded from the /b switch In the application icon's Target Property, then anyone who uses that application icon gains access to said LISP.

As for Acad.lsp, and AcadDoc.lsp, these are user-defined files which are automatically loaded at startup, and drawing open respectively (by default) if found within the SFSP.