Пример #1
0
        public override void OnSetAction()
        {
            //            base.ActiveObject = Polyline.Construct();
            base.TitleId     = "Constr.PlaneIntersection";
            plane            = base.ActiveDrawingPlane;
            feedBackPolyLine = Polyline.Construct();
            Rectangle rect = Frame.ActiveView.DisplayRectangle; // sinnvolles Standardrechteck

            width             = Frame.ActiveView.Projection.DeviceToWorldFactor * rect.Width / 2.0;
            height            = Frame.ActiveView.Projection.DeviceToWorldFactor * rect.Height / 2.0;
            base.ActiveObject = feedBackPolyLine;

            PlaneInput planeInput = new PlaneInput("Constr.Plane");

            planeInput.SetPlaneEvent += new PlaneInput.SetPlaneDelegate(SetPlaneInput);

            base.SetInput(planeInput);
            base.ShowAttributes = true;

            feedBackplane         = new FeedBackPlane(plane, width, height);
            base.ShowActiveObject = false;
            base.OnSetAction();
            RecalcFeedbackPolyLine();
            base.Frame.SnapMode |= SnapPointFinder.SnapModes.SnapToFaceSurface;
        }
Пример #2
0
        public override void OnSetAction()
        {
            //            base.ActiveObject = Polyline.Construct();
            base.TitleId     = "Constr.PlaneIntersection";
            plane            = base.ActiveDrawingPlane;
            feedBackPolyLine = Polyline.Construct();
            BoundingCube ext = toSplit.GetBoundingCube();

            width             = ext.DiagonalLength;
            height            = ext.DiagonalLength;
            base.ActiveObject = feedBackPolyLine;

            PlaneInput planeInput = new PlaneInput("Constr.Plane");

            planeInput.SetPlaneEvent += new PlaneInput.SetPlaneDelegate(SetPlaneInput);

            base.SetInput(planeInput);
            base.ShowAttributes = true;

            feedBackplane         = new FeedBackPlane(plane, width, height);
            base.ShowActiveObject = false;
            base.OnSetAction();
            RecalcFeedbackPolyLine();
            base.Frame.SnapMode |= SnapPointFinder.SnapModes.SnapToFaceSurface;
        }
Пример #3
0
        public override void OnSetAction()
        {
            base.ActiveObject = block;
            base.TitleId      = "ReflectObjects";
            copyObject        = ConstrDefaults.DefaultCopyObjects;

            GeoPointInput reflectPoint = new GeoPointInput("ReflectObjects.Point");

            //           reflectPoint.GetGeoPointEvent += new GeoPointInput.GetGeoPointDelegate(GetReflectPoint);
            reflectPoint.SetGeoPointEvent += new GeoPointInput.SetGeoPointDelegate(SetReflectPoint);
            reflectPoint.Optional          = true;

            reflectLine                             = new CurveInput("ReflectObjects.Line");
            reflectLine.Decomposed                  = true; // nur Einzelelemente, auch bei Polyline und Pfad
            reflectLine.MouseOverCurvesEvent       += new CurveInput.MouseOverCurvesDelegate(ReflectLine);
            reflectLine.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(ReflectLineChanged);

            PlaneInput reflectPlane = new PlaneInput("ReflectObjects.Plane");

            reflectPlane.SetPlaneEvent += new PlaneInput.SetPlaneDelegate(SetReflectPlane);
            //            reflectPlane.GetPlaneEvent += new PlaneInput.GetPlaneDelegate(GetReflectPlane);
            reflectPlane.Optional = true;

            BooleanInput copy = new BooleanInput("Modify.CopyObjects", "YesNo.Values");

            copy.DefaultBoolean   = ConstrDefaults.DefaultCopyObjects;
            copy.SetBooleanEvent += new CADability.Actions.ConstructAction.BooleanInput.SetBooleanDelegate(SetCopy);


            base.SetInput(reflectPoint, reflectLine, reflectPlane, copy);
            BoundingCube result = BoundingCube.EmptyBoundingCube;

            foreach (IGeoObject go in originals)
            {
                result.MinMax(go.GetBoundingCube());
            }
            GeoPoint blockCenter = result.GetCenter();

            block.RefPoint    = blockCenter;
            base.BasePoint    = blockCenter;
            reflectModOp      = ModOp.ReflectPlane(new Plane(base.BasePoint, base.ActiveDrawingPlane.Normal, base.ActiveDrawingPlane.DirectionY));
            reflectModOpStart = reflectModOp;
            block.Modify(reflectModOp);
            base.OnSetAction();
        }
Пример #4
0
        public override void OnSetAction()
        {
            //			base.ActiveObject = block;
            base.TitleId = "RotateObjects";
            copyObject   = ConstrDefaults.DefaultCopyObjects;
            axisVector   = base.ActiveDrawingPlane.Normal;

            feedBackEllipse = Ellipse.Construct();
            feedBackEllipse.SetEllipseCenterAxis(GeoPoint.Origin, GeoVector.XAxis, GeoVector.YAxis); // damit nicht alles 0
            Color backColor = base.Frame.GetColorSetting("Colors.Feedback", Color.DarkGray);

            feedBackEllipse.ColorDef = new ColorDef("", backColor);
            base.FeedBack.Add(feedBackEllipse);
            base.SetCursor(SnapPointFinder.DidSnapModes.DidNotSnap, "RotateSmall");

            //--> diese Inputs werden gebraucht
            GeoPointInput refPointInput = new GeoPointInput("Objects.RefPoint");

            refPointInput.Optional          = true;
            refPointInput.SetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.SetGeoPointDelegate(SetRefPoint);
            refPointInput.GetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.GetGeoPointDelegate(GetRefPoint);
            refPointInput.DefinesHotSpot    = true;
            refPointInput.HotSpotSource     = "Hotspots.png:0";

            rotAngleInput = new AngleInput("RotateObjects.Angle");
            rotAngleInput.SetAngleEvent       += new CADability.Actions.ConstructAction.AngleInput.SetAngleDelegate(OnSetRotationAngle);
            rotAngleInput.GetAngleEvent       += new CADability.Actions.ConstructAction.AngleInput.GetAngleDelegate(OnGetRotationAngle);
            rotAngleInput.CalculateAngleEvent += new CADability.Actions.ConstructAction.AngleInput.CalculateAngleDelegate(OnCalculateRotationAngle);
            rotAngleInput.MouseClickEvent     += new MouseClickDelegate(OnMouseClickRotationAngle);

            startPointInput                   = new GeoPointInput("Objects.StartPoint");
            startPointInput.Optional          = true;
            startPointInput.SetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.SetGeoPointDelegate(OnSetStartPoint);
            startPointInput.GetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.GetGeoPointDelegate(OnGetStartPoint);

            endPointInput                   = new GeoPointInput("Objects.EndPoint");
            endPointInput.Optional          = true;
            endPointInput.SetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.SetGeoPointDelegate(OnSetEndPoint);
            endPointInput.GetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.GetGeoPointDelegate(OnGetEndPoint);

            rotateLineInput                             = new CurveInput("Constr.Rotate.AxisLine");
            rotateLineInput.Decomposed                  = true; // nur Einzelelemente, auch bei Polyline und Pfad
            rotateLineInput.MouseOverCurvesEvent       += new CurveInput.MouseOverCurvesDelegate(RotateLine);
            rotateLineInput.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(RotateLineChanged);
            rotateLineInput.Optional                    = true;

            srcPlane = new PlaneInput("Constr.Rotate.SourcePlane");
            srcPlane.SetPlaneEvent += SrcPlane_OnSetPlane;
            srcPlane.GetPlaneEvent += SrcPlane_OnGetPlane;
            srcPlane.Optional       = true;

            trgPlane = new PlaneInput("Constr.Rotate.TargetPlane");
            trgPlane.SetPlaneEvent += TrgPlane_OnSetPlane;
            trgPlane.GetPlaneEvent += TrgPlane_OnGetPlane;
            trgPlane.Optional       = true;

            offset                 = new MultipleChoiceInput("Constr.Rotate.Offset", "Constr.Rotate.Offset.Values");
            offset.Optional        = true;
            offsetVal              = 0;
            offset.GetChoiceEvent += OnGetOffset;
            offset.SetChoiceEvent += OnSetOffset;

            BooleanInput copy = new BooleanInput("Modify.CopyObjects", "YesNo.Values");

            copy.DefaultBoolean   = ConstrDefaults.DefaultCopyObjects;
            copy.SetBooleanEvent += new CADability.Actions.ConstructAction.BooleanInput.SetBooleanDelegate(SetCopy);

            base.SetInput(refPointInput, rotAngleInput, startPointInput, endPointInput, rotateLineInput, srcPlane, trgPlane, offset, copy);

            BoundingCube result = BoundingCube.EmptyBoundingCube;

            foreach (IGeoObject go in originals)
            {
                result.MinMax(go.GetBoundingCube());
            }
            GeoPoint blockCenter = result.GetCenter();

            block.RefPoint = blockCenter;
            refPoint       = blockCenter;
            base.BasePoint = blockCenter;                        // für die Winkelberechnung
            base.OnSetAction();
            rotateLineInput.SetContextMenu("MenuId.Axis", this); // kann man erst hier machen, zuvor gibts die Property noch nicht
        }