예제 #1
0
        public override void OnSetAction()
        {
            dim            = Dimension.Construct();
            dim.DimType    = Dimension.EDimType.DimAngle;
            dim.DimLineRef = ConstrDefaults.DefaultDimPoint;
            dim.Normal     = base.ActiveDrawingPlane.Normal;
            dim.AddPoint(new GeoPoint(0.0, 0.0, 0.0));
            dim.AddPoint(new GeoPoint(0.0, 0.0, 0.0));
            dim.AddPoint(new GeoPoint(0.0, 0.0, 0.0));
            base.ActiveObject     = dim;
            base.ShowActiveObject = false;


            base.TitleId = "Constr.Dimension.Direction.Objects";

            curveInput                             = new CurveInput("Constr.Dimension.Direction.Object1");
            curveInput.Decomposed                  = true; // nur Einzelelemente, auch bei Polyline und Pfad
            curveInput.MouseOverCurvesEvent       += new CADability.Actions.ConstructAction.CurveInput.MouseOverCurvesDelegate(inputDimCurves);
            curveInput.CurveSelectionChangedEvent += new CADability.Actions.ConstructAction.CurveInput.CurveSelectionChangedDelegate(inputDimCurvesChanged);

            curve2Input                             = new CurveInput("Constr.Dimension.Direction.Object2");
            curve2Input.Decomposed                  = true; // nur Einzelelemente, auch bei Polyline und Pfad
            curve2Input.MouseOverCurvesEvent       += new CADability.Actions.ConstructAction.CurveInput.MouseOverCurvesDelegate(input2DimCurves);
            curve2Input.CurveSelectionChangedEvent += new CADability.Actions.ConstructAction.CurveInput.CurveSelectionChangedDelegate(input2DimCurvesChanged);

            dimLocationInput = new GeoPointInput("Constr.Dimension.Location");
            dimLocationInput.DefaultGeoPoint   = ConstrDefaults.DefaultDimPoint;
            dimLocationInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(SetDimLocation);

            base.SetInput(curveInput, curve2Input, dimLocationInput);
            base.ShowAttributes = true;
            base.OnSetAction();
        }
예제 #2
0
        public void InsertGeoPoint(int Index, GeoPoint ThePoint)
        {
            if (dim.PointCount >= 2)
            {   // nach dem 2.Punkt ist keine Änderung der Methode mehr möglich!
                dimMethod.ReadOnly = true;
                // Testen, ob eine Bemassung getroffen wurde
                GeoObjectList li = base.GetObjectsUnderCursor(base.CurrentMousePoint);
                if (Settings.GlobalSettings.GetBoolValue("Dimension.AutoExtend", true)) // eingeführt am 30.08.2016
                {
                    for (int i = 0; i < li.Count; ++i)
                    {
                        if (li[i] is Dimension)
                        { // die getroffene Bem. nutzen
                            Dimension dimTemp = (li[i] as Dimension);
                            // nur wenn die Typen stimmen!
                            if ((dimTemp.DimType == Dimension.EDimType.DimPoints) | (dimTemp.DimType == Dimension.EDimType.DimCoord))
                            {
                                int ind; // wo getroffen?
                                Dimension.HitPosition hi = dimTemp.GetHitPosition(base.Frame.ActiveView.Projection, base.ProjectedPoint(CurrentMousePoint), out ind);
                                if ((hi & Dimension.HitPosition.DimLine) != 0)
                                { // jetzt also: neuen Punkt einfügen, der kommt aus dim.
                                    dimTemp.AddPoint(dim.GetPoint(0));
                                    base.ActiveObject = null;
                                    base.OnDone();
                                    dimTemp.SortPoints();
                                    dimTemp.Recalc();
                                    return;
                                }
                            }
                        }
                    }
                }
            }
            if ((dim.PointCount == 2) & (methodSelect == 0))
            {   // ZweiPunktBemassung: Jetzt ist Schluss!
                mi.Fixed = true;
                if (!dimLocationInput.Fixed)
                {
                    CADability.GeoObject.Point gPoint1 = ActionFeedBack.FeedbackPoint(base.Frame, PointSymbol.Cross);
                    gPoint1.Location = ThePoint;
                    base.FeedBack.Add(gPoint1);
                    base.SetFocus(dimLocationInput, true);
                }
                else
                {
                    base.OnDone();
                }
                return;
            }
            dim.AddPoint(ThePoint);

            CADability.GeoObject.Point gPoint = ActionFeedBack.FeedbackPoint(base.Frame, PointSymbol.Cross);
            gPoint.Location = ThePoint;
            base.FeedBack.Add(gPoint);
        }
예제 #3
0
        private bool showDim()
        {
            if ((dimCurve == null) | (dim2Curve == null) | (dimCurve == dim2Curve))
            {
                return(false);
            }
            Plane pl;

            if (Curves.GetCommonPlane(dimCurve, dim2Curve, out pl))
            {
                ICurve2D l2D1 = dimCurve.GetProjectedCurve(pl);
                if (l2D1 is Path2D)
                {
                    (l2D1 as Path2D).Flatten();
                }
                ICurve2D l2D2 = dim2Curve.GetProjectedCurve(pl);
                if (l2D2 is Path2D)
                {
                    (l2D2 as Path2D).Flatten();
                }
                GeoPoint2D dim2DP1, dim2DP2, dimLoc;
                dimLoc = pl.Project(objectPoint);
                double dist = Curves2D.SimpleMinimumDistance(l2D1, l2D2, dimLoc, out dim2DP1, out dim2DP2);
                if (dist > 0)
                {   // eine gültige Bemassung kann gemacht werden
                    GeoPoint dimP1 = pl.ToGlobal(dim2DP1);
                    GeoPoint dimP2 = pl.ToGlobal(dim2DP2);
                    dim.DimLineDirection = new GeoVector(dimP1, dimP2);
                    if (!dimLocationInput.Fixed)
                    {
                        dim.DimLineRef = new GeoPoint(dimP1, dimP2);
                    }
                    if (dim.PointCount == 0)
                    {
                        dim.AddPoint(dimP1);
                        dim.AddPoint(dimP2);
                    }
                    else
                    {
                        dim.SetPoint(0, dimP1);
                        dim.SetPoint(1, dimP2);
                    }
                    base.ShowActiveObject = true;
                    return(true);
                }
            }
            base.ShowActiveObject = false;
            return(false);
        }
        public override void OnSetAction()
        {
            base.TitleId   = "Constr.Dimension.Direction.4Points";
            dim            = Dimension.Construct();
            dim.DimType    = Dimension.EDimType.DimAngle;
            dim.DimLineRef = ConstrDefaults.DefaultDimPoint;
            dim.Normal     = base.ActiveDrawingPlane.Normal;
            dim.AddPoint(new GeoPoint(0.0, 0.0, 0.0));
            dim.AddPoint(new GeoPoint(0.0, 0.0, 0.0));
            dim.AddPoint(new GeoPoint(0.0, 0.0, 0.0));

            gPoint1 = ActionFeedBack.FeedbackPoint(base.Frame);
            gPoint2 = ActionFeedBack.FeedbackPoint(base.Frame);
            gPoint3 = ActionFeedBack.FeedbackPoint(base.Frame);
            gPoint4 = ActionFeedBack.FeedbackPoint(base.Frame);
            base.FeedBack.Add(gPoint1);
            base.FeedBack.Add(gPoint2);
            base.FeedBack.Add(gPoint3);
            base.FeedBack.Add(gPoint4);

            base.ActiveObject = dim;

            dimPoint1Input = new GeoPointInput("Constr.Dimension.Direction.4Points.Point1");
            dimPoint1Input.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(SetDimPoint1);
            dimPoint2Input = new GeoPointInput("Constr.Dimension.Direction.4Points.Point2");
            dimPoint2Input.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(SetDimPoint2);
            dimPoint3Input = new GeoPointInput("Constr.Dimension.Direction.4Points.Point3");
            dimPoint3Input.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(SetDimPoint3);
            dimPoint4Input = new GeoPointInput("Constr.Dimension.Direction.4Points.Point4");
            dimPoint4Input.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(SetDimPoint4);

            dimLocationInput = new GeoPointInput("Constr.Dimension.Location");
            dimLocationInput.DefaultGeoPoint   = ConstrDefaults.DefaultDimPoint;
            dimLocationInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(SetDimLocation);

            base.SetInput(dimPoint1Input, dimPoint2Input, dimPoint3Input, dimPoint4Input, dimLocationInput);
            base.ShowAttributes = true;
            base.OnSetAction();
        }
예제 #5
0
 private void DimLocationOnMouseClick(bool up, GeoPoint MousePosition, IView View)
 {
     if ((up & (dimAddTo != null)))
     {     // also: er will einen Punkt (dim.GetPoint(0)) zu einer bestehenden Label-Bem. (dimAddTo) zufügen
         if ((dimMethodPoint & curveInput.Fixed) | (!dimMethodPoint & dimPointInput.Fixed))
         { // nur, wenn der Punkt auf die ein oder andere Weise bestimmt ist
             dimAddTo.AddPoint(dim.GetPoint(0));
             // jetzt: schnell raus aus allem!
             base.ActiveObject = null;
             base.OnDone();
             return;
         }
     }
 }
예제 #6
0
 public void InsertGeoPoint(int Index, GeoPoint ThePoint)
 {
     if (Index == -1)
     {
         dimension.AddPoint(ThePoint);
     }
     else
     {
         throw new NotImplementedException("Dimension: InsertGeoPoint");
     }
     Opened(false);
     Init();
     propertyPage.Refresh(this);
     propertyPage.OpenSubEntries(points, true);
 }
예제 #7
0
        public override void OnSetAction()
        {
            dim = Dimension.Construct();
            if (dimArcType == DimArcType.Radius)
            {
                idString    = "Constr.Dimension.Arc.Radius";
                dim.DimType = Dimension.EDimType.DimRadius;
            }
            else
            {
                idString    = "Constr.Dimension.Arc.Diameter";
                dim.DimType = Dimension.EDimType.DimDiameter;
            }
            dim.DimLineRef = ConstrDefaults.DefaultDimPoint;
            dim.Normal     = base.ActiveDrawingPlane.Normal;
            dim.AddPoint(new GeoPoint(0.0, 0.0, 0.0));

            base.TitleId      = idString;
            base.ActiveObject = dim;

            CurveInput curveInput = new CurveInput("Constr.Dimension.Arc.Object");

            curveInput.Decomposed                  = true; // nur Einzelelemente, auch bei Polyline und Pfad
            curveInput.MouseOverCurvesEvent       += new CADability.Actions.ConstructAction.CurveInput.MouseOverCurvesDelegate(inputDimCurves);
            curveInput.CurveSelectionChangedEvent += new CADability.Actions.ConstructAction.CurveInput.CurveSelectionChangedDelegate(inputDimCurvesChanged);

            GeoPointInput dimLocationInput = new GeoPointInput("Constr.Dimension.Location");

            dimLocationInput.DefaultGeoPoint   = ConstrDefaults.DefaultDimPoint;
            dimLocationInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(SetDimLocation);


            base.SetInput(curveInput, dimLocationInput);
            base.ShowAttributes   = true;
            base.ShowActiveObject = false;
            base.OnSetAction();
        }
예제 #8
0
        public override void OnSetAction()
        {
            dim = Dimension.Construct();
            if (dimLabelType == DimLabelType.Point)
            {
                idString       = "Constr.Dimension.Point";
                pointString    = "Constr.Dimension.Point.Point";
                objectString   = "Constr.Dimension.Point.Object";
                locationString = "Constr.Dimension.Location";
                dim.DimType    = Dimension.EDimType.DimLocation;
            }
            else
            {
                idString       = "Constr.Dimension.Labeling";
                pointString    = "Constr.Dimension.Labeling.Point";
                objectString   = "Constr.Dimension.Labeling.Object";
                locationString = "Constr.Dimension.Labeling.Location";
                dim.DimType    = Dimension.EDimType.DimLocation;
            }
            dim.DimLineRef = ConstrDefaults.DefaultDimPoint;
            dim.Normal     = base.ActiveDrawingPlane.Normal;
            dim.AddPoint(new GeoPoint(0.0, 0.0, 0.0));

            dimMethodPoint = ConstrDefaults.DefaultDimensionPointMethod;

            base.TitleId                           = idString;
            base.ActiveObject                      = dim;
            base.ShowActiveObject                  = false;
            curveInput                             = new CurveInput(objectString);
            curveInput.Decomposed                  = true; // nur Einzelelemente, auch bei Polyline und Pfad
            curveInput.ReadOnly                    = !dimMethodPoint;
            curveInput.Optional                    = !dimMethodPoint;
            curveInput.MouseOverCurvesEvent       += new CADability.Actions.ConstructAction.CurveInput.MouseOverCurvesDelegate(inputDimCurves);
            curveInput.CurveSelectionChangedEvent += new CADability.Actions.ConstructAction.CurveInput.CurveSelectionChangedDelegate(inputDimCurvesChanged);

            dimPointInput                   = new GeoPointInput(pointString);
            dimPointInput.ReadOnly          = dimMethodPoint;
            dimPointInput.Optional          = dimMethodPoint;
            dimPointInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(SetDimPoint);

            dimLocationInput = new GeoPointInput(locationString);
            dimLocationInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(SetDimLocation);
            dimLocationInput.MouseClickEvent  += new MouseClickDelegate(DimLocationOnMouseClick);

            dimStringInput = new StringInput("Constr.Dimension.Labeling.Point.Text");
            dimStringInput.SetStringEvent += new CADability.Actions.ConstructAction.StringInput.SetStringDelegate(SetDimString);
            dimStringInput.GetStringEvent += new CADability.Actions.ConstructAction.StringInput.GetStringDelegate(GetDimString);

            dimMethod = new BooleanInput("Constr.Dimension.Point.Method", "Constr.Dimension.Point.Method.Values");
            dimMethod.DefaultBoolean   = ConstrDefaults.DefaultDimensionPointMethod;
            dimMethod.SetBooleanEvent += new CADability.Actions.ConstructAction.BooleanInput.SetBooleanDelegate(SetMethod);


            if (dimLabelType == DimLabelType.Point)
            {
                base.SetInput(curveInput, dimPointInput, dimLocationInput, dimMethod);
            }
            else
            {
                base.SetInput(curveInput, dimPointInput, dimLocationInput, dimStringInput, dimMethod);
            }
            base.ShowAttributes = true;
            base.OnSetAction();
        }