AutoCAD Map 3D Developer
Welcome to Autodesk’s AutoCAD Map 3D Developer Forums. Share your knowledge, ask questions, and explore popular AutoCAD Map 3D Developer topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Editor.command

4 REPLIES 4
Reply
Message 1 of 5
giskumar
2723 Views, 4 Replies

Editor.command

Hi All,

 

Below code is working fine for me

 

[CommandMethod("T")]
        public void T()
        {
            Autodesk.AutoCAD.ApplicationServices.Document doc =
                   Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;

            List<ObjectId> oidlist = GlobalFunction.SS.ClsSelection.GetEntsOnScreen("*", "*");

            PromptPointResult ppr = ed.GetPoint("");
            Point3d pt1 = ppr.Value;
            ppr = ed.GetPoint("");
            Point3d pt2 = ppr.Value;
            ppr = ed.GetPoint("");
            Point3d pt3 = ppr.Value;
            ppr = ed.GetPoint("");
            Point3d pt4 = ppr.Value;

            try
            {
                ed.Command("_.ALIGN", oidlist[0], "", pt1, pt2, pt3, pt4, "", "Y");
            }
            catch (System.Exception ex)
            {
                MessageBox.Show(ex.Message);
            }

            MessageBox.Show("Hi");
            
            ed.Command("_.Circle", new Point3d(), 1.0);
        }

But when i call below line from form button click, it is throwing error invalid input.

ed.Command("_.ALIGN", oidlist[0], "", pt1, pt2, pt3, pt4, "", "Y");

Any one plese help me where i am doing mistake.

 

Thanks,

Kumar. 

4 REPLIES 4
Message 2 of 5
hence_the_name
in reply to: giskumar

just Google it - you will find plenty of examples such as

 

http://stackoverflow.com/questions/29371567/calling-autocad-commands-from-c-net

http://raumpatrouille3d.blogspot.ch/
Message 3 of 5
norman.yuan
in reply to: giskumar

What kind of form? modeless form/PaletteSet, which is usually shown from a session command? Or modal form?

 

Keep in mind, Editor.Command() only works in document context, not in application context.

Norman Yuan

Drive CAD With Code

EESignature

Message 4 of 5
giskumar
in reply to: norman.yuan

Hi,

 

Thanks for the reply.

 

What kind of form? modeless form/PaletteSet, which is usually shown from a session command? Or modal form?

It's a pallet set shown from a session command.

 

Thanks & Regards,

Kumar.

Message 5 of 5
norman.yuan
in reply to: giskumar

Therefore, you cannot use Editor.Command().

 

However, you can use Document.SendStringToExecute(....), where the Document is Application.DocumentManager.MdiActiveDocument.

Norman Yuan

Drive CAD With Code

EESignature

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost