Exemple #1
0
        public override void OnDone()
        {
            if (!Precision.IsNull(param1) || !Precision.IsNull(param2))
            {
                using (base.Frame.Project.Undo.UndoFrame)
                { //  also nur bei realer Verlängerung nach oben oder unten und offen
                    if ((param1 > (1 + 1e-8) || param1 < -1e-8) && !iCurve1.IsClosed)
                    {
                        if (param1 < 0.5)
                        {
                            iCurve1.StartPoint = iCurve1.PointAt(param1);
                        }
                        else
                        {
                            iCurve1.EndPoint = iCurve1.PointAt(param1);
                        }
                    }

                    if ((param2 > (1 + 1e-8) || param2 < -1e-8) && !iCurve2.IsClosed)
                    {
                        if (param2 < 0.5)
                        {
                            iCurve2.StartPoint = iCurve2.PointAt(param2);
                        }
                        else
                        {
                            iCurve2.EndPoint = iCurve2.PointAt(param2);
                        }
                    }
                }
            }
            base.OnDone();
        }
Exemple #2
0
 private void OnSetHeight(LengthProperty sender, double l)
 {
     if (!Precision.IsNull(l))
     {
         polyline.RectangleHeight = l;
     }
 }
Exemple #3
0
 private void OnSetWidthParallel(LengthProperty sender, double l)
 {
     if (!Precision.IsNull(l))
     {
         polyline.ParallelogramWidth = l;
     }
 }
Exemple #4
0
 private void OnSetWidth(LengthProperty sender, double l)
 {
     if (!Precision.IsNull(l))
     {
         polyline.RectangleWidth = l;
     }
 }
Exemple #5
0
 double CalculateHeight(GeoPoint MousePosition)
 {
     if (!planeMode)
     { // Zeichnungsebene als Bezug
         double h = base.ActiveDrawingPlane.Distance(MousePosition);
         if (!Precision.IsNull(h))
         {
             return(h);
         }
     }
     return(height);
 }
 bool SetHeight(double Length)
 {
     if (Precision.IsNull(Length))
     {
         return(false);
     }
     height = Length;
     if (!planeMode)
     { // Zeichnungsebene als Bezug
         vector = Length * base.ActiveDrawingPlane.Normal;
     }
     //            VectorOrHeight = false; // merken, ob Extrudier-Vektor oder Höhe
     extrudeMode = 1; // merken, ob Extrudier-Vektor oder Höhe
     optionalOrg();
     return(extrudeOrg());
 }
Exemple #7
0
        private bool SetFactor3(double val)
        {       // zunächst: Block zurücksetzen
            for (int i = 0; i < originals.Count; ++i)
            {
                block.Item(i).CopyGeometry(originals[i]);
            }
            ModOp m;

            m = ModOp.Scale(base.BasePoint, base.ActiveDrawingPlane.DirectionX, faktorX) * ModOp.Scale(base.BasePoint, base.ActiveDrawingPlane.DirectionY, faktorY) * ModOp.Scale(base.BasePoint, base.ActiveDrawingPlane.Normal, val);
            if (Precision.IsNull(Math.Abs(m.Determinant)))
            {
                return(false);
            }
            block.Modify(m);
            faktorZ = val;
            return(true);
        }
Exemple #8
0
        private bool SetFactor(double val)
        {       // zunächst: Block zurücksetzen
            for (int i = 0; i < originals.Count; ++i)
            {
                block.Item(i).CopyGeometry(originals[i]);
            }
            ModOp m;

            m = ModOp.Scale(base.BasePoint, val);
            if (Precision.IsNull(Math.Abs(m.Determinant)))
            {
                return(false);
            }
            faktorX = val;
            faktorY = val;
            faktorZ = val;
            block.Modify(m);
            faktor = val;
            return(true);
        }
 public override void OnDone()
 {
     if (base.ShowActiveObject == true)
     {   // es soll ein shape eingefügt werden
         using (base.Frame.Project.Undo.UndoFrame)
         {
             for (int i = 0; i < selectedObjectsList.Count; i++) // geht durch die komplette Liste
             {
                 if (shapeList[i] != null)                       // nur hier was machen!
                 {
                     if (Precision.IsNull(angleOffsetRotation) && Frame.GetBooleanSetting("Construct.3D_Delete2DBase", false))
                     {
                         if (geoObjectOrgList[i] != null) // evtl. Einzelobjekt (Object oder Path) als Original rauslöschen
                         {
                             ownerList[i].Remove(geoObjectOrgList[i] as IGeoObject);
                         }
                         else
                         { // die Einzelelemente des CreateFromModel identifizieren
                             for (int j = 0; j < pathCreatedFromModelList[i].Count; ++j)
                             {
                                 IGeoObject obj = null;
                                 if ((pathCreatedFromModelList[i].Curve(j) as IGeoObject).UserData.ContainsData("CADability.Path.Original"))
                                 {
                                     obj = (pathCreatedFromModelList[i].Curve(j) as IGeoObject).UserData.GetData("CADability.Path.Original") as IGeoObject;
                                 }
                                 if (obj != null && obj.Owner != null)
                                 {
                                     obj.Owner.Remove(obj);                                   // löschen
                                 }
                             }
                         }
                     }
                 }
             }
             base.DisassembleBlock = true; // da das ActiveObject aus einem Block besteht: Nur die Einzelteile einfügen!
             base.OnDone();
         }
     }
     base.OnDone();
 }
Exemple #10
0
 public override void OnDone()
 {
     // ist die Shift Taste gehalten, so werden Kopien gemacht, d.h. der die Elemente
     // des blocks werden eingefügt. Ansonsten werden die original-Objekte verändert
     // TODO: Feedback über Cursor bei Shift-Taste fehlt noch
     // TODO: die neuen oder veränderten Objekte sollten markiert sein.
     using (Frame.Project.Undo.UndoFrame)
     {
         ModOp m;
         if (!dis)
         {
             m = ModOp.Scale(base.BasePoint, faktor);       // ein faktor für alle!
         }
         else
         {       // 3 Faktoren für 3 Achsen
             m = ModOp.Scale(base.BasePoint, base.ActiveDrawingPlane.DirectionX, faktorX) * ModOp.Scale(base.BasePoint, base.ActiveDrawingPlane.DirectionY, faktorY) * ModOp.Scale(base.BasePoint, base.ActiveDrawingPlane.Normal, faktorZ);
         }
         if (!Precision.IsNull(Math.Abs(m.Determinant)))
         {
             if (((Frame.UIService.ModifierKeys & Keys.Shift) != 0) || copyObject)
             {
                 GeoObjectList cloned = new GeoObjectList();
                 foreach (IGeoObject go in originals)
                 {
                     IGeoObject cl = go.Clone();
                     cl.Modify(m);
                     cloned.Add(cl);
                 }
                 base.Frame.Project.GetActiveModel().Add(cloned);
             }
             else
             {
                 originals.Modify(m);
             }
         }
     }
     base.ActiveObject = null; // damit es nicht gleich eingefügt wird
     base.OnDone();
 }
Exemple #11
0
        //public override void AutoRepeated()
        //{
        //    sourceCurve = sourceCurveSave; // sourceCurve auf den Instanzübergreifenden Wert gesetzt
        //}


        private bool showObject()
        {
            double[] cutPlace;
            base.FeedBack.ClearSelected();
            if ((iCurve2 != null) && !iCurve2.IsClosed && (iCurve1 != null) && !iCurve1.IsClosed && (iCurve1 != iCurve2))
            {
                //                Plane pl;
                //                if (Curves.GetCommonPlane(iCurve1, iCurve2, out pl))
                //                {
                //                    ICurve2D curve1_2D = iCurve1.GetProjectedCurve(pl); // die 2D-Kurven
                //                    ICurve2D curve2_2D = iCurve2.GetProjectedCurve(pl);
                //                    if (curve1_2D is Path2D) (curve1_2D as Path2D).Flatten();
                //                    if (curve2_2D is Path2D) (curve2_2D as Path2D).Flatten();
                //                    // hier die Schnittpunkte bestimmen und den ObjectPoint auf den nächsten Schnittpunt setzen
                //                    GeoPoint2DWithParameter[] intersectPoints = curve1_2D.Intersect(curve2_2D);
                //                    GeoPoint position = new GeoPoint(objectPoint1, objectPoint2);
                //                    double distS = double.MaxValue; // Entfernung des Pickpunkts zu den Schnittpunkten
                //                    for (int i = 0; i < intersectPoints.Length; ++i)
                //                    {
                ////                        double distLoc = Geometry.Dist(intersectPoints[i].p, pl.Project(position));
                //                        double distLoc = Geometry.Dist(intersectPoints[i].p, pl.Project(objectPoint2));
                //                        if (distLoc < distS)
                //                        {
                //                            distS = distLoc;
                //                            param1 = intersectPoints[i].par1;
                //                            param2 = intersectPoints[i].par2;
                //                        }
                //                    }
                //                }

                cutPlace = Curves.Intersect(iCurve1, iCurve2, false);
                GeoPoint position = new GeoPoint(objectPoint1, objectPoint2);
                if (cutPlace.Length > 0)
                {
                    pos1 = iCurve1.PositionOf(position);
                    //                    pos1 = iCurve1.PositionOf(objectPoint1);
                    double dist = double.MaxValue;
                    for (int i = 0; i < cutPlace.Length; ++i)
                    {
                        double distLoc = Geometry.Dist(position, iCurve1.PointAt(cutPlace[i]));
                        //                        double distLoc = Geometry.Dist(objectPoint1, iCurve1.PointAt(cutPlace[i]));
                        if (distLoc < dist)
                        {
                            //                            dist = Math.Abs(pos1 - cutPlace[i]);
                            dist   = distLoc;
                            param1 = cutPlace[i];
                            //                            k1 = 2;
                        }
                    }
                }
                cutPlace = Curves.Intersect(iCurve2, iCurve1, false);
                if (cutPlace.Length > 0)
                {
                    pos2 = iCurve2.PositionOf(position);
                    //                    pos2 = iCurve2.PositionOf(objectPoint2);
                    double dist = double.MaxValue;
                    for (int i = 0; i < cutPlace.Length; ++i)
                    {
                        double distLoc = Geometry.Dist(position, iCurve2.PointAt(cutPlace[i]));
                        //                        double distLoc = Geometry.Dist(objectPoint2, iCurve2.PointAt(cutPlace[i]));
                        if (distLoc < dist)
                        {
                            dist   = distLoc;
                            param2 = cutPlace[i];
                        }
                    }
                }
                if (!Precision.IsNull(param1) || !Precision.IsNull(param2))// was gefunden
                {
                    base.FeedBack.ClearSelected();
                    bool connect = false;
                    if ((param1 > (1 + 1e-8) || param1 < -1e-8))
                    {  //  also nur bei realer Verlängerung nach oben oder unten und offen
                        newCurve = iCurve1.Clone();
                        if (param1 < 0.5)
                        {
                            newCurve.StartPoint = iCurve1.PointAt(param1);
                        }
                        else
                        {
                            newCurve.EndPoint = iCurve1.PointAt(param1);
                        }
                        (newCurve as IGeoObject).CopyAttributes(iCurve1 as IGeoObject);
                        base.FeedBack.AddSelected(newCurve as IGeoObject);// erste Linie einfügen
                        connect = true;
                    }
                    if ((param2 > (1 + 1e-8) || param2 < -1e-8))
                    { //  also nur bei realer Verlängerung nach oben oder unten und offen
                        newCurve = iCurve2.Clone();
                        if (param2 < 0.5)
                        {
                            newCurve.StartPoint = iCurve2.PointAt(param2);
                        }
                        else
                        {
                            newCurve.EndPoint = iCurve2.PointAt(param2);
                        }
                        (newCurve as IGeoObject).CopyAttributes(iCurve2 as IGeoObject);
                        base.FeedBack.AddSelected(newCurve as IGeoObject);// letzte Linie einfügen
                        connect = true;
                    }
                    if (connect)
                    {
                        return(true);
                    }
                }
            }
            param1 = 0.0;
            param2 = 0.0;
            return(false);
        }