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.
just Google it - you will find plenty of examples such as
http://stackoverflow.com/questions/29371567/calling-autocad-commands-from-c-net
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
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.
Therefore, you cannot use Editor.Command().
However, you can use Document.SendStringToExecute(....), where the Document is Application.DocumentManager.MdiActiveDocument.
Norman Yuan