.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Autocad Civil form and ucs option

0 REPLIES 0
Reply
Message 1 of 1
nono77
276 Views, 0 Replies

Autocad Civil form and ucs option

I want to check how works very basic program. I want to use command in autocad, to open form. On this form there is one button, which try to run command "._UCS". I tried many different methods, but it's looks, that Autocad send this method to command line, and then turn on the form. He doesn't wait, when this command will be finished. When i closed this form, then i see, that ucs command is active.

I tried to use: EditorUserInteraction and i tried to check systemvariable, which should get value 1, when command is running. I tried to send some

commands in lisp, but doesn't work, too.

 

I used Autocad Civil 2015, Visual Studio 2013.

 

Thank you very much if you help me, because i already spend a lot of time, and now i had no ideas, how it should be done.

Regards

Przemek

 

 

 

 

//Class with command, which runs everything.

 

using Autodesk.AutoCAD.Runtime;
using Autodesk.Civil.ApplicationServices;
using Application = Autodesk.AutoCAD.ApplicationServices.Application;


namespace _01_AC2015Basic
{
    public class Class1 : IExtensionApplication
    {

        [CommandMethod("HelloWorld")]
        public void HelloWorld()
        {
            using (
                Autodesk.AutoCAD.ApplicationServices.DocumentLock locker =
                    Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.LockDocument())
            {

                CivilDocument doc = CivilApplication.ActiveDocument;


                // perform any document / database modifications here
                // CivilApplication.ActiveDocument.Settings.DrawingSettings.AmbientSettings.Station.Precision.Value = 2;
                Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nStart of program\n");
                Form1 form1 = new Form1();
                Application.ShowModalDialog(form1);

                Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage("\nEnd of program\n");
            }

        }

        void IExtensionApplication.Initialize()
        {
            // throw new System.Exception("The method or operation is not implemented.");
        }

        void IExtensionApplication.Terminate()
        {
            // throw new System.Exception("The method or operation is not implemented.");
        }

    }
}

 

 

//Button click event, which should sent this command to autocad civil command line, and should wait for end of this command.

        private void button1_Click(object sender, EventArgs e)
        {
            
            using (EditorUserInteraction preventFlikkering = Application.DocumentManager.MdiActiveDocument.Editor.StartUserInteraction(this))
            {
           
                Application.DocumentManager.MdiActiveDocument.SendStringToExecute("._UCS ", true, false, false);
                Application.DocumentManager.MdiActiveDocument.Editor.Regen();
                preventFlikkering.End();
                this.Visible = true;
            }
            
        }

 

 

0 REPLIES 0

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

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost