Ejemplo n.º 1
0
        public override void OnSetAction()
        {
            base.TitleId      = "Constr.BSpline";
            base.ActiveObject = bSpline;
            BooleanInput bi = new BooleanInput("Constr.BSpline.Mode", "Constr.BSpline.Mode.Values");

            // bi Anzeige: open ist true!
            bi.GetBooleanEvent += new CADability.Actions.ConstructAction.BooleanInput.GetBooleanDelegate(OnGetClosed);
            bi.SetBooleanEvent += new CADability.Actions.ConstructAction.BooleanInput.SetBooleanDelegate(OnSetClosed);
            MultiPointInput mi = new MultiPointInput(this);

            mi.ResourceId = "Constr.BSpline.Points";
            base.SetInput(mi, bi);
            base.ShowAttributes = true;

            base.OnSetAction();
        }
Ejemplo n.º 2
0
        public override void OnSetAction()
        {   // wird beim Start der Aktion aufgerufen
            // hier wird der Inhalt des ControlCenters zusammengesetzt und bestimmt, welche Eingaben für diese Aktion
            // notwendig sind.
            base.ActiveObject = block;
            base.TitleId      = "SnapObjects";
            copyObject        = ConstrDefaults.DefaultCopyObjects;
            feedBackLine      = Line.Construct(); // Feedback während eine Verbindung zwischen Quellpunkt und Zielpunkt hergestellt wird
            Color backColor = base.Frame.GetColorSetting("Colors.Feedback", Color.DarkGray);

            feedBackLine.ColorDef = new ColorDef("", backColor);
            base.FeedBack.Add(feedBackLine);
            base.SetCursor(SnapPointFinder.DidSnapModes.DidNotSnap, "ScaleSnap");
            // Punktepaare
            srcP1 = new GeoPointInput("SnapObjects.Source1");
            srcP1.SetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.SetGeoPointDelegate(SetSourcePoint1);
            srcP1.MouseClickEvent  += new MouseClickDelegate(SourcePoint1OnMouseClick);
            dstP1 = new GeoPointInput("SnapObjects.Destination1");
            dstP1.SetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.SetGeoPointDelegate(SetDestPoint1);
            srcP2 = new GeoPointInput("SnapObjects.Source2");
            srcP2.SetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.SetGeoPointDelegate(SetSourcePoint2);
            srcP2.MouseClickEvent  += new MouseClickDelegate(SourcePoint2OnMouseClick);
            dstP2 = new GeoPointInput("SnapObjects.Destination2");
            dstP2.SetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.SetGeoPointDelegate(SetDestPoint2);
            srcP3 = new GeoPointInput("SnapObjects.Source3");
            srcP3.SetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.SetGeoPointDelegate(SetSourcePoint3);
            srcP3.MouseClickEvent  += new MouseClickDelegate(SourcePoint3OnMouseClick);
            dstP3 = new GeoPointInput("SnapObjects.Destination3");
            dstP3.SetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.SetGeoPointDelegate(SetDestPoint3);
            // Verzerrung
            BooleanInput distort = new BooleanInput("ScaleObjects.Distort", "ScaleObjects.Distort.Values");

            distort.DefaultBoolean   = ConstrDefaults.DefaultScaleDistort;
            distort.SetBooleanEvent += new CADability.Actions.ConstructAction.BooleanInput.SetBooleanDelegate(SetDistort);
            // Kopie
            BooleanInput copy = new BooleanInput("Modify.CopyObjects", "YesNo.Values");

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

            // die Eingabeobjekte festlegen
            base.SetInput(srcP1, dstP1, srcP2, dstP2, distort, srcP3, dstP3, copy);
            // wichtig: Basisimplementierung aufrufen
            base.OnSetAction();
        }
Ejemplo n.º 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();
        }
Ejemplo n.º 4
0
        public override void OnSetAction()
        {
            line               = Line.Construct();
            lineLength         = ConstrDefaults.DefaultLineLength;
            lineDir            = ConstrDefaults.DefaultLineDirection;
            linePositionMiddle = ConstrDefaults.DefaultLinePosition;
            startPoint         = new GeoPoint(0.0, 0.0, 0.0);
            endPoint           = startPoint + lineLength * lineDir;
            line.SetTwoPoints(startPoint, endPoint);
            base.ActiveObject = line;
            tangCurves        = new ICurve[0];

            base.TitleId = "Constr.Line.TangentAngle";

            curveInput                             = new CurveInput("Constr.Line.Tangent.Object");
            curveInput.Decomposed                  = true; // nur Einzelelemente, auch bei Polyline und Pfad
            curveInput.MouseOverCurvesEvent       += new CADability.Actions.ConstructAction.CurveInput.MouseOverCurvesDelegate(inputTangCurves);
            curveInput.CurveSelectionChangedEvent += new CADability.Actions.ConstructAction.CurveInput.CurveSelectionChangedDelegate(inputTangCurvesChanged);

            LengthInput len = new LengthInput("Line.Length");

            len.DefaultLength         = ConstrDefaults.DefaultLineLength;
            len.SetLengthEvent       += new ConstructAction.LengthInput.SetLengthDelegate(OnSetLength);
            len.CalculateLengthEvent += new LengthInput.CalculateLengthDelegate(CalculateLength);
            len.ForwardMouseInputTo   = curveInput;

            GeoVectorInput dir = new GeoVectorInput("Line.Direction");

            dir.DefaultGeoVector    = ConstrDefaults.DefaultLineDirection;
            dir.SetGeoVectorEvent  += new CADability.Actions.ConstructAction.GeoVectorInput.SetGeoVectorDelegate(SetGeoVector);
            dir.IsAngle             = true;
            dir.ForwardMouseInputTo = curveInput;

            BooleanInput position = new BooleanInput("Constr.Line.Tangent.Position", "Constr.Line.Tangent.Position.Values");

            position.DefaultBoolean   = ConstrDefaults.DefaultLinePosition;
            position.SetBooleanEvent += new BooleanInput.SetBooleanDelegate(SetPosition);
            //            position.GetBooleanEvent += new BooleanInput.GetBooleanDelegate(GetPosition);

            base.SetInput(curveInput, len, dir, position);
            base.ShowAttributes = true;

            base.OnSetAction();
        }
Ejemplo n.º 5
0
        public override void OnSetAction()
        {
            Boolean useRadius = Frame.GetBooleanSetting("Formatting.Radius", true);

            arc = Ellipse.Construct();
            double dir;

            if (ConstrDefaults.DefaultArcDirection)
            {
                dir = 1.5 * Math.PI;
            }
            else
            {
                dir = -1.5 * Math.PI;
            }
            arc.SetArcPlaneCenterRadiusAngles(base.ActiveDrawingPlane, ConstrDefaults.DefaultStartPoint, ConstrDefaults.DefaultArcRadius, 0.0, dir);

            base.ActiveObject = arc;
            base.TitleId      = "Constr.Arc.CenterRadius";

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

            centerInput = new GeoPointInput("Constr.Arc.Center");
            centerInput.DefaultGeoPoint   = ConstrDefaults.DefaultArcCenter;
            centerInput.DefinesBasePoint  = true;
            centerInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(Center);

            radInput = new LengthInput("Constr.Arc.Radius");
            radInput.SetLengthEvent += new ConstructAction.LengthInput.SetLengthDelegate(SetArcRadius);
            radInput.GetLengthEvent += new ConstructAction.LengthInput.GetLengthDelegate(GetArcRadius);
            if (!useRadius)
            {
                radInput.Optional = true;
            }
            radInput.DefaultLength       = ConstrDefaults.DefaultArcRadius;
            radInput.ForwardMouseInputTo = centerInput;

            diamInput = new LengthInput("Constr.Arc.Diameter");
            diamInput.SetLengthEvent       += new ConstructAction.LengthInput.SetLengthDelegate(SetArcDiameter);
            diamInput.GetLengthEvent       += new ConstructAction.LengthInput.GetLengthDelegate(GetArcDiameter);
            diamInput.CalculateLengthEvent += new LengthInput.CalculateLengthDelegate(CalculateDiameter);
            if (useRadius)
            {
                diamInput.Optional = true;
            }
            diamInput.DefaultLength       = ConstrDefaults.DefaultArcDiameter;
            diamInput.ForwardMouseInputTo = centerInput;


            startDirInput = new GeoVectorInput("Constr.Arc.CenterRadius.StartAngle");
            startDirInput.SetGeoVectorEvent += new CADability.Actions.ConstructAction.GeoVectorInput.SetGeoVectorDelegate(StartDir);
            startDirInput.IsAngle            = true;

            GeoVectorInput endDirInput = new GeoVectorInput("Constr.Arc.CenterRadius.EndAngle");

            endDirInput.GetGeoVectorEvent += new CADability.Actions.ConstructAction.GeoVectorInput.GetGeoVectorDelegate(GetEndDir);
            endDirInput.SetGeoVectorEvent += new CADability.Actions.ConstructAction.GeoVectorInput.SetGeoVectorDelegate(EndDir);
            endDirInput.IsAngle            = true;

            BooleanInput dirInput = new BooleanInput("Constr.Arc.Direction", "Constr.Arc.Direction.Values");

            dirInput.DefaultBoolean   = ConstrDefaults.DefaultArcDirection;
            dirInput.SetBooleanEvent += new CADability.Actions.ConstructAction.BooleanInput.SetBooleanDelegate(SetDirection);
            if (useRadius)
            {
                base.SetInput(centerInput, radInput, diamInput, startDirInput, endDirInput, dirInput);
            }
            else
            {
                base.SetInput(centerInput, diamInput, radInput, startDirInput, endDirInput, dirInput);
            }


            base.ShowAttributes = true;
            base.OnSetAction();
        }
        public override void OnSetAction()
        {
            ellipse        = Ellipse.Construct();
            ellipse.Plane  = base.ActiveDrawingPlane;
            ellipse.Center = ConstrDefaults.DefaultEllipseCenter;
            //            elliCenter = ellipse.Center;
            ellipse.MajorRadius = ConstrDefaults.DefaultEllipseMajorRadius;
            //            elliPoint1 = elliCenter + ellipse.MajorRadius * base.ActiveDrawingPlane.DirectionX;
            ellipse.MinorRadius = ConstrDefaults.DefaultEllipseMinorRadius;
            //            elliPoint2 = elliCenter + ellipse.MinorRadius * base.ActiveDrawingPlane.DirectionY;
            ellipse.StartParameter = 0.0;
            if (ConstrDefaults.DefaultArcDirection)
            {
                ellipse.SweepParameter = 1.5 * Math.PI;
            }
            else
            {
                ellipse.SweepParameter = -1.5 * Math.PI;
            }
            base.ActiveObject = ellipse;
            base.TitleId      = "Constr.EllipseArc.CenterRadius";

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

            GeoPointInput elliCenter = new GeoPointInput("Constr.Ellipse.CenterRadius.Center");

            elliCenter.DefaultGeoPoint   = ConstrDefaults.DefaultEllipseCenter;
            elliCenter.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(Center);

            GeoPointInput elliPointInput = new GeoPointInput("Constr.Ellipse.CenterRadius.Point");

            elliPointInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(Point1);

            GeoPointInput elliPoint2 = new GeoPointInput("Constr.Ellipse.CenterRadius.Point2");

            //			elliMinRad.DefaultLength = ConstrDefaults.DefaultEllipseMinorRadius;
            elliPoint2.SetGeoPointEvent   += new ConstructAction.GeoPointInput.SetGeoPointDelegate(Point2);
            elliPoint2.ForwardMouseInputTo = elliCenter;

            LengthInput elliMaxRad = new LengthInput("Constr.Ellipse.CenterRadius.MajorRadius");

            elliMaxRad.SetLengthEvent     += new CADability.Actions.ConstructAction.LengthInput.SetLengthDelegate(SetMajorRadius);
            elliMaxRad.GetLengthEvent     += new ConstructAction.LengthInput.GetLengthDelegate(GetMajorRadius);
            elliMaxRad.DefaultLength       = ConstrDefaults.DefaultEllipseMajorRadius;
            elliMaxRad.ForwardMouseInputTo = elliCenter;
            elliMaxRad.Optional            = true;

            elliMinRad = new LengthInput("Constr.Ellipse.CenterRadius.MinorRadius");
            elliMinRad.DefaultLength       = ConstrDefaults.DefaultEllipseMinorRadius;
            elliMinRad.SetLengthEvent     += new ConstructAction.LengthInput.SetLengthDelegate(MinorRadius);
            elliMinRad.GetLengthEvent     += new ConstructAction.LengthInput.GetLengthDelegate(GetMinorRadius);
            elliMinRad.ForwardMouseInputTo = elliCenter;
            elliMinRad.Optional            = true;

            GeoVectorInput elliDir = new GeoVectorInput("Constr.Ellipse.CenterRadius.Angle");

            elliDir.SetGeoVectorEvent += new CADability.Actions.ConstructAction.GeoVectorInput.SetGeoVectorDelegate(ElliDir);
            elliDir.GetGeoVectorEvent += new CADability.Actions.ConstructAction.GeoVectorInput.GetGeoVectorDelegate(GetElliDir);
            elliDir.Optional           = true;
            elliDir.IsAngle            = true;


            GeoVectorInput startDir = new GeoVectorInput("Constr.EllipseArc.StartAngle");

            startDir.SetGeoVectorEvent += new CADability.Actions.ConstructAction.GeoVectorInput.SetGeoVectorDelegate(StartDir);
            startDir.IsAngle            = true;

            GeoVectorInput endDir = new GeoVectorInput("Constr.EllipseArc.EndAngle");

            endDir.SetGeoVectorEvent += new CADability.Actions.ConstructAction.GeoVectorInput.SetGeoVectorDelegate(EndDir);
            endDir.GetGeoVectorEvent += new CADability.Actions.ConstructAction.GeoVectorInput.GetGeoVectorDelegate(GetEndDir);
            endDir.IsAngle            = true;

            BooleanInput dirInput = new BooleanInput("Constr.Arc.Direction", "Constr.Arc.Direction.Values");

            dirInput.DefaultBoolean   = ConstrDefaults.DefaultArcDirection;
            dirInput.SetBooleanEvent += new CADability.Actions.ConstructAction.BooleanInput.SetBooleanDelegate(SetDirection);

            base.SetInput(elliCenter, elliPointInput, elliPoint2, startDir, endDir, elliMaxRad, elliMinRad, dirInput);
            base.ShowAttributes = true;
            base.OnSetAction();
        }
Ejemplo n.º 7
0
        public override void OnSetAction()
        {
            base.ActiveObject = Face.Construct();
            DefaultLength l = new DefaultLength(ConstructAction.DefaultLength.StartValue.ViewWidth8);

            if (vector.IsNullVector())
            {
                vector = l * base.ActiveDrawingPlane.Normal;
            }
            if (height == 0.0)
            {
                height = l;
            }
            ;
            //           if (!VectorOrHeight)
            if (extrudeMode < 2)
            {
                vector = height * base.ActiveDrawingPlane.Normal;
            }
            base.TitleId = "Constr.Face.PathExtrude";

            curveInput = new CurveInput("Constr.Face.PathExtrude.Path");
            curveInput.MouseOverCurvesEvent       += new CurveInput.MouseOverCurvesDelegate(curveInputPath);
            curveInput.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(curveInputPathChanged);
            if (selectedMode)
            {
                curveInput.Fixed = true;
            }

            heightInput = new LengthInput("Constr.Face.PathExtrude.Height");
            heightInput.SetLengthEvent     += new LengthInput.SetLengthDelegate(SetHeight);
            heightInput.GetLengthEvent     += new LengthInput.GetLengthDelegate(GetHeight);
            heightInput.ForwardMouseInputTo = curveInput;
            if (selectedMode)
            {
                extrudeOrg();               //schonmal berechnen und markieren!
            }
            planeInput = new BooleanInput("Constr.Face.PathExtrude.Plane", "Constr.Face.PathExtrude.Plane.Values", planeMode);
            planeInput.SetBooleanEvent += new BooleanInput.SetBooleanDelegate(SetPlaneMode);

            vectorInput = new GeoVectorInput("Constr.Face.PathExtrude.Vector", vector);
            vectorInput.SetGeoVectorEvent += new GeoVectorInput.SetGeoVectorDelegate(SetVector);
            vectorInput.GetGeoVectorEvent += new GeoVectorInput.GetGeoVectorDelegate(GetVector);
            //            vectorInput.DefaultGeoVector = ConstrDefaults.DefaultExtrudeDirection;
            vectorInput.ForwardMouseInputTo = curveInput;

            heightOffsetInput = new LengthInput("Constr.Face.PathExtrude.HeightOffset");
            heightOffsetInput.SetLengthEvent     += new LengthInput.SetLengthDelegate(SetHeightOffset);
            heightOffsetInput.GetLengthEvent     += new LengthInput.GetLengthDelegate(GetHeightOffset);
            heightOffsetInput.ForwardMouseInputTo = curveInput;
            heightOffsetInput.Optional            = true;

            vectorOffsetInput = new GeoVectorInput("Constr.Face.PathExtrude.VectorOffset", vectorOffset);
            vectorOffsetInput.SetGeoVectorEvent  += new GeoVectorInput.SetGeoVectorDelegate(SetVectorOffset);
            vectorOffsetInput.GetGeoVectorEvent  += new GeoVectorInput.GetGeoVectorDelegate(GetVectorOffset);
            vectorOffsetInput.ForwardMouseInputTo = curveInput;
            vectorOffsetInput.Optional            = true;

            pipeInput = new CurveInput("Constr.Face.PathExtrude.Pipe");
            pipeInput.MouseOverCurvesEvent       += new CurveInput.MouseOverCurvesDelegate(pipeInputCurves);
            pipeInput.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(pipeInputCurveChanged);

            optionalOrg();

            SeparatorInput separatorHeight = new SeparatorInput("Constr.Face.PathExtrude.SeparatorHeight");
            SeparatorInput separatorVector = new SeparatorInput("Constr.Face.PathExtrude.SeparatorVector");
            SeparatorInput separatorPipe   = new SeparatorInput("Constr.Face.PathExtrude.SeparatorPipe");

            //            if (selectedMode)
            //                base.SetInput( heightInput, heightOffsetInput, separatorVector, vectorInput, vectorOffsetInput, separatorPipe, pipeInput, planeInput);
            //             else base.SetInput(curveInput,separatorHeight, heightInput, heightOffsetInput,separatorVector,vectorInput, vectorOffsetInput,separatorPipe,pipeInput, planeInput);
            base.SetInput(curveInput, separatorHeight, heightInput, heightOffsetInput, planeInput, separatorVector, vectorInput, vectorOffsetInput, separatorPipe, pipeInput);
            base.ShowAttributes = true;
            base.OnSetAction();
        }
Ejemplo n.º 8
0
        public override void OnSetAction()
        {
            base.ActiveObject = block;
            base.TitleId      = "ScaleObjects";
            dis          = ConstrDefaults.DefaultScaleDistort;
            copyObject   = ConstrDefaults.DefaultCopyObjects;
            feedBackLine = Line.Construct();
            Color backColor = base.Frame.GetColorSetting("Colors.Feedback", Color.DarkGray);

            feedBackLine.ColorDef = new ColorDef("", backColor);
            base.SetCursor(SnapPointFinder.DidSnapModes.DidNotSnap, "Size");
            clickandPress = false;

            GeoPointInput fixPoint = new GeoPointInput("Objects.FixPoint", base.BasePoint);

            fixPoint.Optional          = true;
            fixPoint.DefinesHotSpot    = true;
            fixPoint.HotSpotSource     = "Hotspots.png:0";
            fixPoint.SetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.SetGeoPointDelegate(SetfixPoint);
            fixPoint.GetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.GetGeoPointDelegate(GetfixPoint);
            // dieser Punkt mit dem Fixpunkt dient zur Faktor-Bestimmung, "1" läßt ihn unverändert, "2" verdoppelt seine Entfernung vom Fixpunkt
            startPointInput                   = new GeoPointInput("Objects.StartPoint");
            startPointInput.Optional          = true;
            startPointInput.SetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.SetGeoPointDelegate(SetStartPoint);
            startPointInput.GetGeoPointEvent += new CADability.Actions.ConstructAction.GeoPointInput.GetGeoPointDelegate(GetStartPoint);

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

            fac                       = new DoubleInput("ScaleObjects.Factor", faktor);
            fac.ReadOnly              = dis;
            fac.Optional              = dis;
            fac.SetDoubleEvent       += new CADability.Actions.ConstructAction.DoubleInput.SetDoubleDelegate(SetFactor);
            fac.GetDoubleEvent       += new CADability.Actions.ConstructAction.DoubleInput.GetDoubleDelegate(GetFactor);
            fac.CalculateDoubleEvent += new CADability.Actions.ConstructAction.DoubleInput.CalculateDoubleDelegate(CalculateFactor);
            fac.MouseClickEvent      += new MouseClickDelegate(facOnMouseClick);
            // Verzerrung
            BooleanInput distort = new BooleanInput("ScaleObjects.Distort", "ScaleObjects.Distort.Values");

            distort.DefaultBoolean   = ConstrDefaults.DefaultScaleDistort;
            distort.SetBooleanEvent += new CADability.Actions.ConstructAction.BooleanInput.SetBooleanDelegate(SetDistort);
            fac1                       = new DoubleInput("ScaleObjects.FactorX");
            fac1.ReadOnly              = !dis;
            fac1.Optional              = !dis;
            fac1.SetDoubleEvent       += new CADability.Actions.ConstructAction.DoubleInput.SetDoubleDelegate(SetFactor1);
            fac1.GetDoubleEvent       += new CADability.Actions.ConstructAction.DoubleInput.GetDoubleDelegate(GetFactor1);
            fac1.CalculateDoubleEvent += new CADability.Actions.ConstructAction.DoubleInput.CalculateDoubleDelegate(CalculateFactor);
            fac1.MouseClickEvent      += new MouseClickDelegate(facOnMouseClick);
            fac2                       = new DoubleInput("ScaleObjects.FactorY");
            fac2.ReadOnly              = !dis;
            fac2.Optional              = !dis;
            //			fac2.Optional = true;
            fac2.SetDoubleEvent       += new CADability.Actions.ConstructAction.DoubleInput.SetDoubleDelegate(SetFactor2);
            fac2.GetDoubleEvent       += new CADability.Actions.ConstructAction.DoubleInput.GetDoubleDelegate(GetFactor2);
            fac2.CalculateDoubleEvent += new CADability.Actions.ConstructAction.DoubleInput.CalculateDoubleDelegate(CalculateFactor2);

            fac3          = new DoubleInput("ScaleObjects.FactorZ");
            fac3.ReadOnly = !dis;
            fac3.Optional = !dis;
            //			fac2.Optional = true;
            fac3.SetDoubleEvent       += new CADability.Actions.ConstructAction.DoubleInput.SetDoubleDelegate(SetFactor3);
            fac3.GetDoubleEvent       += new CADability.Actions.ConstructAction.DoubleInput.GetDoubleDelegate(GetFactor3);
            fac3.CalculateDoubleEvent += new CADability.Actions.ConstructAction.DoubleInput.CalculateDoubleDelegate(CalculateFactor3);

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

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

            // erstmal wird das umgebende Rechteck bestimmt
            cube = BoundingCube.EmptyBoundingCube;
            foreach (IGeoObject go in originals)
            {
                cube.MinMax(go.GetBoundingCube());
            }
            GeoPoint blockCenter = cube.GetCenter();

            block.RefPoint = blockCenter;
            // im Basepoint steht der Fixpunkt der Skalierung
            base.BasePoint = blockCenter;
            base.SetInput(fixPoint, fac, startPointInput, endPointInput, distort, fac1, fac2, fac3, copy);
            base.OnSetAction();
        }
Ejemplo n.º 9
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();
        }
Ejemplo n.º 10
0
        /// <summary>
        /// Overrides ConstructAction.OnSetAction. Provides the input fields and some initialsation
        /// </summary>
        public override void OnSetAction()
        {
            base.TitleId         = "Constr.Picture";
            widthValue           = 1; // default value
            heightValue          = 1; // default value
            keepAspectRatioValue = true;
            rectangularValue     = true;

            // Create and initialize the filename input field
            fileNameInput = new StringInput("Picture.Object"); // Resource ID must be defined in StringTable
            fileNameInput.IsFileNameInput = true;              // to enable the openfile dialog
            fileNameInput.InitOpenFile    = true;
            fileNameInput.FileNameFilter  = StringTable.GetString("Picture.Open.Filter");
            // you may also wnat to set fileNameInput.FileNameFilter
            fileNameInput.GetStringEvent += new StringInput.GetStringDelegate(OnGetFileName);
            fileNameInput.SetStringEvent += new StringInput.SetStringDelegate(OnSetFileName);
            fileName = ""; // initial filename is empty

            // Create and initialize the position input field
            positionInput = new GeoPointInput("Picture.Location"); // Resource ID must be defined in StringTable
            positionInput.GetGeoPointEvent   += new GeoPointInput.GetGeoPointDelegate(OnGetPosition);
            positionInput.SetGeoPointExEvent += new GeoPointInput.SetGeoPointExDelegate(OnSetPosition);
            positionInput.DefinesBasePoint    = true;

            // Create and initialize the scaling factor input field
            scalingFactorInput = new DoubleInput("Picture.Scale"); // Resource ID must be defined in StringTable
            scalingFactorInput.GetDoubleEvent       += new DoubleInput.GetDoubleDelegate(OnGetScalingFactor);
            scalingFactorInput.SetDoubleEvent       += new DoubleInput.SetDoubleDelegate(OnSetScalingFactor);
            scalingFactorInput.CalculateDoubleEvent += new DoubleInput.CalculateDoubleDelegate(CalculateScalingFactorEvent);
            // scalingFactorInput.Optional = true; // optinal input
            // scalingFactorInput.ForwardMouseInputTo = positionInput; // no mouse input, forward to position input
            scalingFactor = 1.0; // default scaling factor


            width = new LengthInput("Picture.Width");
            width.GetLengthEvent     += new ConstructAction.LengthInput.GetLengthDelegate(OnGetWidth);
            width.SetLengthEvent     += new ConstructAction.LengthInput.SetLengthDelegate(OnSetWidth);
            width.Optional            = true;          // optinal input
            width.ForwardMouseInputTo = positionInput; // no mouse input, forward to position input


            height = new LengthInput("Picture.Height");
            height.GetLengthEvent     += new LengthInput.GetLengthDelegate(OnGetHeight);
            height.SetLengthEvent     += new LengthInput.SetLengthDelegate(OnSetHeight);
            height.Optional            = true;          // optinal input
            height.ForwardMouseInputTo = positionInput; // no mouse input, forward to position input

            GeoVectorInput dirWidth = new GeoVectorInput("Picture.DirWidth");

            dirWidth.GetGeoVectorEvent += new GeoVectorInput.GetGeoVectorDelegate(OnGetDirWidth);
            dirWidth.SetGeoVectorEvent += new GeoVectorInput.SetGeoVectorDelegate(OnSetDirWidth);
            dirWidth.Optional           = true;

            GeoVectorInput dirHeight = new GeoVectorInput("Picture.DirHeight");

            dirHeight.GetGeoVectorEvent += new GeoVectorInput.GetGeoVectorDelegate(OnGetDirHeight);
            dirHeight.SetGeoVectorEvent += new GeoVectorInput.SetGeoVectorDelegate(OnSetDirHeight);
            dirHeight.Optional           = true;

            BooleanInput keepAspectRatio = new BooleanInput("Picture.KeepAspectRatio", "YesNo.Values", keepAspectRatioValue);

            keepAspectRatio.SetBooleanEvent += new ConstructAction.BooleanInput.SetBooleanDelegate(OnKeepAspectRatioChanged);

            BooleanInput rectangular = new BooleanInput("Picture.Rectangular", "YesNo.Values", rectangularValue);

            rectangular.SetBooleanEvent += new ConstructAction.BooleanInput.SetBooleanDelegate(OnRectangularChanged);

            // picture must exist prior to SetInput
            // because picture.Location is required by positionInput
            picture = Picture.Construct();

            // Define the input fields for the ConstructAction
            base.SetInput(fileNameInput, positionInput, scalingFactorInput, width, height, dirWidth, dirHeight, keepAspectRatio, rectangular);
            base.OnSetAction(); // Default implementation must be called

            // force the snapmode to include SnapToFaceSurface
            base.Frame.SnapMode |= SnapPointFinder.SnapModes.SnapToFaceSurface;
        }
Ejemplo n.º 11
0
        // Update is called once per frame
        void Update()
        {
            if (triggerButton == KeyCode.None)
            {
                enabled = false;
                return;
            }

            BooleanInput buttonAction = null;

            if (triggerButton == (KeyCode)IndexButton.LeftInnerFace)
            {
                buttonAction = _leftAAction;
            }
            else if (triggerButton == (KeyCode)IndexButton.RightInnerFace)
            {
                buttonAction = _rightAAction;
            }
            else if (triggerButton == (KeyCode)IndexButton.LeftTrackpadPress)
            {
                buttonAction = _leftTrackpadAction;
            }
            else if (triggerButton == (KeyCode)IndexButton.RightTrackpadPress)
            {
                buttonAction = _rightTrackpadAction;
            }
            else
            {
                return;
            }

            if (triggerButton == (KeyCode)ViveButton.LeftTrigger || triggerButton == (KeyCode)ViveButton.RightTrigger)
            {
                var triggerAction = (triggerButton == (KeyCode)ViveButton.LeftTrigger) ? _leftTriggerAction : _rightTriggerAction;
                if (!triggerAction.isActive)
                {
                    return;
                }
                float triggerValue = triggerAction.value;
                Console.WriteLine("triggerValue : " + triggerValue);

                if (triggerValue > 0.5f)
                {
                    //GetKeyDown
                    if (!triggerPressed)
                    {
                        Console.WriteLine(triggerAction.name + " is down");
                        triggerPressed   = true;
                        checkDoubleClick = (Time.time - pressTime <= interval);
                        pressTime        = Time.time;
                        OnPress();
                        checkLongClick = true;
                        checkClick     = false;
                    }
                    //GetKey
                    OnHold();
                    if (checkLongClick && Time.time - pressTime >= longClickInterval)
                    {
                        Console.WriteLine(triggerAction.name + " is longClicked");
                        checkLongClick = false;
                        OnLongClick();
                        longClicked = true;
                    }
                }
                if (triggerPressed && triggerValue < 0.1f)
                {
                    Console.WriteLine(triggerAction.name + " is up");
                    //GetKeyUp
                    triggerPressed = false;
                    releaseTime    = Time.time;
                    OnRelease();
                    if (longClicked)
                    {
                        OnReleaseAfterLongClick();
                        longClicked = false;
                    }
                    if (releaseTime - pressTime <= interval)
                    {
                        if (checkDoubleClick)
                        {
                            OnDoubleClick();
                        }
                        else
                        {
                            checkClick = true;
                        }
                    }
                }
                if (checkClick && Time.time - releaseTime > interval)
                {
                    checkClick = false;
                    OnClick();
                }
            }
            else
            {
                if (buttonAction.activeChange)
                {
                    //Console.WriteLine(buttonAction.name + " is pressed");
                    checkDoubleClick = (Time.time - pressTime <= interval);
                    pressTime        = Time.time;
                    OnPress();
                    checkLongClick = true;
                    checkClick     = false;
                }
                if (buttonAction.state)
                {
                    //Console.WriteLine(buttonAction.name + " is hold");
                    OnHold();
                    if (checkLongClick && Time.time - pressTime >= longClickInterval)
                    {
                        //Console.WriteLine(buttonAction.name + " is longClicked");
                        checkLongClick = false;
                        OnLongClick();
                        longClicked = true;
                    }
                }
                if (buttonAction.inactiveChange)
                {
                    //Console.WriteLine(buttonAction.name + " is up");
                    releaseTime = Time.time;
                    OnRelease();
                    if (longClicked)
                    {
                        OnReleaseAfterLongClick();
                        longClicked = false;
                    }
                    //Debug.Log("GetKeyUp : releaseTime - pressTime = " + (releaseTime - pressTime));
                    if (releaseTime - pressTime <= interval)
                    {
                        if (checkDoubleClick)
                        {
                            OnDoubleClick();
                        }
                        else
                        {
                            checkClick = true;
                        }
                    }
                }
                if (checkClick && Time.time - releaseTime > interval)
                {
                    checkClick = false;
                    OnClick();
                }
            }
        }
Ejemplo n.º 12
0
        public override void OnSetAction()
        {
            arc       = Ellipse.Construct();
            arcCenter = new GeoPoint(0.0, 0.0, 0.0);
            arcRad    = base.WorldViewSize / 20;
            startAng  = 0.0;
            arcDir    = ConstrDefaults.DefaultArcDirection;
            if (arcDir)
            {
                endAng = 1.5 * Math.PI;
            }
            else
            {
                endAng = -1.5 * Math.PI;
            }


            arcPlane = base.ActiveDrawingPlane;

            arc.SetArcPlaneCenterRadiusAngles(arcPlane, arcCenter, arcRad, startAng, endAng);

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

            base.ActiveObject = arc;
            base.TitleId      = "Constr.Arc.CenterStartEnd";

            arcCenterInput = new GeoPointInput("Constr.Arc.Center");
            arcCenterInput.DefaultGeoPoint   = ConstrDefaults.DefaultArcCenter;
            arcCenterInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(Center);
            arcStartPointInput = new GeoPointInput("Constr.Arc.StartPoint");
            arcStartPointInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(StartPoint);
            arcEndPointInput = new GeoPointInput("Constr.Arc.EndPoint");
            arcEndPointInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(EndPoint);
            BooleanInput dirInput = new BooleanInput("Constr.Arc.Direction", "Constr.Arc.Direction.Values");

            dirInput.DefaultBoolean   = ConstrDefaults.DefaultArcDirection;
            dirInput.SetBooleanEvent += new CADability.Actions.ConstructAction.BooleanInput.SetBooleanDelegate(SetDirection);

            LengthInput arcRadius = new LengthInput("Constr.Arc.Radius");

            arcRadius.GetLengthEvent += new ConstructAction.LengthInput.GetLengthDelegate(ArcRadius);
            arcRadius.Optional        = true;
            arcRadius.ReadOnly        = true;

            /*
             *          GeoVectorInput startDir = new GeoVectorInput("Constr.Arc.CenterRadius.StartAngle");
             *          startDir.Optional = true;
             *          startDir.ReadOnly = true;
             *          startDir.OnGetGeoVector +=new Condor.Actions.ConstructAction.GeoVectorInput.GetGeoVector(StartDir);
             *
             *          GeoVectorInput endDir = new GeoVectorInput("Constr.Arc.CenterRadius.EndAngle");
             *          endDir.Optional = true;
             *          endDir.ReadOnly = true;
             *          endDir.OnGetGeoVector +=new Condor.Actions.ConstructAction.GeoVectorInput.GetGeoVector(EndDir);
             *          base.SetInput(arcCenterInput,arcStartPointInput,arcEndPointInput,dirInput,arcRadius,startDir,endDir);
             */
            base.SetInput(arcCenterInput, arcStartPointInput, arcEndPointInput, dirInput, arcRadius);
            base.ShowAttributes = true;


            base.OnSetAction();
        }
        /// <summary>
        /// Overrides ConstructAction.OnSetAction. Provides the input fields and some initialsation
        /// </summary>
        public override void OnSetAction()
        {
            base.TitleId         = "Constr.Picture.RefPointWidthHeight";
            widthValue           = 1; // default value
            heightValue          = 1; // default value
            keepAspectRatioValue = true;
            rectangularValue     = true;
            isOnPlane            = false;

            // Create and initialize the filename input field
            fileNameInput = new StringInput("Picture.Object"); // Resource ID must be defined in StringTable
            fileNameInput.IsFileNameInput = true;              // to enable the openfile dialog
            fileNameInput.InitOpenFile    = true;
            fileNameInput.FileNameFilter  = StringTable.GetString("Picture.Open.Filter");
            // you may also wnat to set fileNameInput.FileNameFilter
            fileNameInput.GetStringEvent += new StringInput.GetStringDelegate(OnGetFileName);
            fileNameInput.SetStringEvent += new StringInput.SetStringDelegate(OnSetFileName);
            fileName = ""; // initial filename is empty

            // Create and initialize the position input field
            positionInput = new GeoPointInput("Picture.Location"); // Resource ID must be defined in StringTable
            positionInput.GetGeoPointEvent   += new GeoPointInput.GetGeoPointDelegate(OnGetPosition);
            positionInput.SetGeoPointExEvent += new GeoPointInput.SetGeoPointExDelegate(OnSetPosition);
            positionInput.DefinesBasePoint    = true;

            width = new LengthInput("Picture.Width");
            width.GetLengthEvent += new ConstructAction.LengthInput.GetLengthDelegate(OnGetWidth);
            width.SetLengthEvent += new ConstructAction.LengthInput.SetLengthDelegate(OnSetWidth);
            //width.Optional = true; // optinal input
            //width.ReadOnly = true;
            // width.ForwardMouseInputTo = positionInput; // no mouse input, forward to position input


            height = new LengthInput("Picture.Height");
            height.GetLengthEvent += new LengthInput.GetLengthDelegate(OnGetHeight);
            height.Optional        = true; // optinal input
            //height.ReadOnly = true;
            height.SetLengthEvent       += new LengthInput.SetLengthDelegate(OnSetHeight);
            height.CalculateLengthEvent += new LengthInput.CalculateLengthDelegate(height_CalculateLengthEvent);
            // height.ForwardMouseInputTo = positionInput; // no mouse input, forward to position input

            // the input is the direction
            GeoVectorInput dir = new GeoVectorInput("Picture.Direction");

            // dir.DefaultGeoVector = ConstrDefaults.DefaultLineDirection;
            dir.SetGeoVectorEvent += new CADability.Actions.ConstructAction.GeoVectorInput.SetGeoVectorDelegate(SetAngle);
            dir.GetGeoVectorEvent += new GeoVectorInput.GetGeoVectorDelegate(GetAngle);
            dir.IsAngle            = true;
            dir.Optional           = true;
            // during angle-input the mouseinput goes to startPointInput, if it isn´t fixed
            dir.ForwardMouseInputTo = positionInput;



            BooleanInput keepAspectRatio = new BooleanInput("Picture.KeepAspectRatio", "YesNo.Values", keepAspectRatioValue);

            keepAspectRatio.SetBooleanEvent += new ConstructAction.BooleanInput.SetBooleanDelegate(OnKeepAspectRatioChanged);

            BooleanInput rectangular = new BooleanInput("Picture.Rectangular", "YesNo.Values", rectangularValue);

            rectangular.SetBooleanEvent += new ConstructAction.BooleanInput.SetBooleanDelegate(OnRectangularChanged);



            // picture must exist prior to SetInput
            // because picture.Location is required by positionInput
            picture = Picture.Construct();

            // Define the input fields for the ConstructAction
            base.SetInput(fileNameInput, positionInput, width, height, dir, keepAspectRatio, rectangular);
            base.OnSetAction(); // Default implementation must be called

            // force the snapmode to include SnapToFaceSurface
            // base.Frame.SnapMode |= SnapPointFinder.SnapModes.SnapToFaceSurface;
        }
Ejemplo n.º 14
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
        }
Ejemplo n.º 15
0
        /// <summary>
        /// Overrides <see cref="CADability.Actions.ConstructAction.OnSetAction ()"/>
        /// </summary>
        public override void OnSetAction()
        {
            base.ActiveObject = Face.Construct();
            DefaultLength l = new DefaultLength(ConstructAction.DefaultLength.StartValue.ViewWidth8);

            if (vector.IsNullVector())
            {
                vector = l * base.ActiveDrawingPlane.Normal;
            }
            if (height == 0.0)
            {
                height = l;
            }
            ;
            //           if (!VectorOrHeight)
            if (extrudeMode < 2)
            {
                vector = height * base.ActiveDrawingPlane.Normal;
            }
            base.TitleId = "Constr.Solid.FaceExtrude";

            geoObjectInput = new GeoObjectInput("Constr.Solid.FaceExtrude.Path");
            geoObjectInput.MouseOverGeoObjectsEvent       += new GeoObjectInput.MouseOverGeoObjectsDelegate(geoObjectInputFace);
            geoObjectInput.GeoObjectSelectionChangedEvent += new GeoObjectInput.GeoObjectSelectionChangedDelegate(geoObjectInputFaceChanged);
            if (selectedMode)
            {
                geoObjectInput.Fixed = true;               // schon fertig, da Werte reingekommen sind
            }
            //geoObjectInput.MultipleInput = true;
            //geoObjectInput.Optional = true;

            innerPointInput = new GeoPointInput("Constr.Solid.FaceExtrude.InnerPoint");
            innerPointInput.SetGeoPointEvent += new GeoPointInput.SetGeoPointDelegate(SetInnerPointInput);
            innerPointInput.MouseClickEvent  += new MouseClickDelegate(innerPointInputMouseClickEvent);
            innerPointInput.Optional          = true;

            heightInput = new LengthInput("Constr.Face.PathExtrude.Height");
            heightInput.SetLengthEvent       += new LengthInput.SetLengthDelegate(SetHeight);
            heightInput.GetLengthEvent       += new LengthInput.GetLengthDelegate(GetHeight);
            heightInput.CalculateLengthEvent += new LengthInput.CalculateLengthDelegate(CalculateHeight);
            heightInput.ForwardMouseInputTo   = geoObjectInput;

            planeInput = new BooleanInput("Constr.Face.PathExtrude.Plane", "Constr.Face.PathExtrude.Plane.Values", planeMode);
            planeInput.SetBooleanEvent += new BooleanInput.SetBooleanDelegate(SetPlaneMode);

            vectorInput = new GeoVectorInput("Constr.Face.PathExtrude.Vector", vector);
            vectorInput.SetGeoVectorEvent += new GeoVectorInput.SetGeoVectorDelegate(SetVector);
            vectorInput.GetGeoVectorEvent += new GeoVectorInput.GetGeoVectorDelegate(GetVector);
            //            vectorInput.DefaultGeoVector = ConstrDefaults.DefaultExtrudeDirection;
            vectorInput.ForwardMouseInputTo = geoObjectInput;

            heightOffsetInput = new LengthInput("Constr.Face.PathExtrude.HeightOffset");
            heightOffsetInput.SetLengthEvent     += new LengthInput.SetLengthDelegate(SetHeightOffset);
            heightOffsetInput.GetLengthEvent     += new LengthInput.GetLengthDelegate(GetHeightOffset);
            heightOffsetInput.ForwardMouseInputTo = geoObjectInput;
            heightOffsetInput.Optional            = true;

            vectorOffsetInput = new GeoVectorInput("Constr.Face.PathExtrude.VectorOffset", vectorOffset);
            vectorOffsetInput.SetGeoVectorEvent  += new GeoVectorInput.SetGeoVectorDelegate(SetVectorOffset);
            vectorOffsetInput.GetGeoVectorEvent  += new GeoVectorInput.GetGeoVectorDelegate(GetVectorOffset);
            vectorOffsetInput.ForwardMouseInputTo = geoObjectInput;
            vectorOffsetInput.Optional            = true;

            pipeInput = new CurveInput("Constr.Face.PathExtrude.Pipe");
            pipeInput.MouseOverCurvesEvent       += new CurveInput.MouseOverCurvesDelegate(pipeInputCurves);
            pipeInput.CurveSelectionChangedEvent += new CurveInput.CurveSelectionChangedDelegate(pipeInputCurveChanged);

            optionalOrg();

            MultipleChoiceInput insertMode = new MultipleChoiceInput("Constr.Solid.SolidInsertMode", "Constr.Solid.SolidInsertMode.Values");

            insertMode.GetChoiceEvent += new MultipleChoiceInput.GetChoiceDelegate(GetInsertMode);
            insertMode.SetChoiceEvent += new CADability.Actions.ConstructAction.MultipleChoiceInput.SetChoiceDelegate(SetInsertMode);

            SeparatorInput separatorHeight = new SeparatorInput("Constr.Face.PathExtrude.SeparatorHeight");
            SeparatorInput separatorVector = new SeparatorInput("Constr.Face.PathExtrude.SeparatorVector");
            SeparatorInput separatorPipe   = new SeparatorInput("Constr.Face.PathExtrude.SeparatorPipe");
            SeparatorInput separatorInsert = new SeparatorInput("Constr.Face.PathExtrude.SeparatorInsert");


            base.SetInput(geoObjectInput, innerPointInput, separatorHeight, heightInput, heightOffsetInput, planeInput, separatorVector, vectorInput, vectorOffsetInput, separatorPipe, pipeInput, separatorInsert, insertMode);
            base.ShowAttributes   = true;
            base.ShowActiveObject = false;
            base.OnSetAction();
            if (selectedMode)
            {
                extrudeOrg();               //schonmal berechnen und markieren!
            }
        }