editor.GetAngle cancel automaticaly

editor.GetAngle cancel automaticaly

reithinger
Advocate Advocate
261 Views
0 Replies
Message 1 of 1

editor.GetAngle cancel automaticaly

reithinger
Advocate
Advocate

Hi,

I have modified my form.

My form load a c# usercontrol and when i click to my save button, the editor.GetAngle cancel automaticaly (i touch nothing) and give cancel as Result.

I don't unterstand what happens. 

Before i have all in one Form and it doesn't have any Problem.

Here my fonction: Problem is by PromptDoubleResult pdr = ed.GetAngle(angleOptions);, this make automaticaly cancel as result.

Waht can I do ?

 

Thanks

 

public bool SelectPosition(ref double scale, out double x, out double y, out double rotation)
      {
         bool success = false;
         scale = (scale > 0) ? scale : 1;
         x = 0;
         y = 0;
         rotation = 0;

         Document doc = Application.DocumentManager.MdiActiveDocument;

         Application.MainWindow.Focus();

         Database db = doc.Database;
         Editor ed = doc.Editor;

         //--------------------------------------------------
         // Position bestimmen
         PromptPointOptions pointOptions = new PromptPointOptions("\nBitte Einfügepunkt wählen");
         pointOptions.AllowNone = false;
         PromptPointResult ppr = ed.GetPoint(pointOptions);
         if (ppr.Status == PromptStatus.OK)
         {
            // ID 48171 hier fehlt Umrechnung in WCS
            double xUcs = ppr.Value.X;
            double yUcs = ppr.Value.Y;
            Matrix3d ucs = Application.DocumentManager.MdiActiveDocument.Editor.CurrentUserCoordinateSystem;
            Vector3d wcsVecTemp = new Vector3d(xUcs, yUcs, 0);
            wcsVecTemp = wcsVecTemp.TransformBy(ucs);
            x = wcsVecTemp.X + ucs[0, 3];
            y = wcsVecTemp.Y + ucs[1, 3];


            //--------------------------------------------------
            // Winkel bestimmen
            PromptAngleOptions angleOptions = new PromptAngleOptions("\nBitte Winkel wählen");
            Point3d pos = new Point3d(xUcs, yUcs, 0);
            angleOptions.BasePoint = pos;
            angleOptions.DefaultValue = 0.0;
            angleOptions.UseBasePoint = true;
            angleOptions.UseDefaultValue = true;
            angleOptions.UseDashedLine = true;
            angleOptions.AllowZero = true;
            angleOptions.AllowNone = true;
            try
            {
               PromptDoubleResult pdr = ed.GetAngle(angleOptions);


               if (pdr.Status == PromptStatus.OK)
               {
                  rotation = pdr.Value;

                  //--------------------------------------------------
                  // Skalierung bestimmen
                  PromptDoubleOptions doubleOptions = new PromptDoubleOptions("\nBitte Skalierung eingeben");
                  doubleOptions.AllowNegative = false;
                  doubleOptions.AllowNone = true;
                  doubleOptions.AllowZero = false;
                  //doubleOptions.DefaultValue = 1.0;
                  doubleOptions.DefaultValue = scale;//geändert für mehrere Zeichnen gleichzeit zeichnen
                  doubleOptions.UseDefaultValue = true;
                  pdr = ed.GetDouble(doubleOptions);
                  if (pdr.Status == PromptStatus.OK)
                  {
                     scale = pdr.Value;
                     success = true;
                  }
               }
            }
            catch(Exception ex)
            {

            }
         }

         return success;
      }

 

 

0 Likes
262 Views
0 Replies
Replies (0)