Пример #1
0
 private void StartPoint(GeoPoint p)
 {
     boxStartPoint = p;
     box           = Make3D.MakeBox(boxStartPoint, boxDirX, boxDirY, boxDirZ);
     box.CopyAttributes(base.ActiveObject);
     base.ActiveObject = box;
 }
Пример #2
0
 private bool Height(double length)
 {
     if (length > Precision.eps)
     {
         boxLengthZ = length;
         boxDirZ    = boxLengthZ * boxDirZ.Normalized;
         box        = Make3D.MakeBox(boxStartPoint, boxDirX, boxDirY, boxDirZ);
         box.CopyAttributes(base.ActiveObject);
         base.ActiveObject = box;
         return(true);
     }
     return(false);
 }
Пример #3
0
 private bool Length(double length)
 {
     //            if (Math.Abs(length) > Precision.eps) geht nicht in MakeBox
     if (length > Precision.eps)
     {
         boxLengthX = length;
         boxDirX    = boxLengthX * boxDirX.Normalized;
         box        = Make3D.MakeBox(boxStartPoint, boxDirX, boxDirY, boxDirZ);
         box.CopyAttributes(base.ActiveObject);
         base.ActiveObject = box;
         return(true);
     }
     return(false);
 }
Пример #4
0
 private bool ZVector(GeoVector v)
 {
     if (!v.IsNullVector())
     {
         if (!Precision.SameDirection(v, boxDirX, false) && !Precision.SameDirection(v, boxDirY, false))
         {
             boxDirZ    = v;
             boxLengthZ = boxDirZ.Length;
             box        = Make3D.MakeBox(boxStartPoint, boxDirX, boxDirY, boxDirZ);
             box.CopyAttributes(base.ActiveObject);
             base.ActiveObject = box;
             boxOrg(3);
             return(true);
         }
     }
     return(false);
 }
Пример #5
0
        private double HeightCalculate(GeoPoint MousePosition)
        {  // falls die Höhe über einen Punkt im Raum über der jetzigen Box bestimmt wird:
            // der Lotfußpunkt von MousePosition auf die Ebene X-Y
            Plane  pl = new Plane(boxStartPoint, boxDirX, boxDirY);
            double l  = pl.ToLocal(MousePosition).z;

            //            if (Math.Abs(l) > Precision.eps) geht nicht in MakeBox
            if (l > Precision.eps)
            {   // Neue Box
                boxLengthZ = l;
                box        = Make3D.MakeBox(boxStartPoint, boxDirX, boxDirY, boxLengthZ * boxDirZ.Normalized);
                box.CopyAttributes(base.ActiveObject);
                base.ActiveObject = box;
                // nun die Länge zurückliefern
                return(boxLengthZ);
            }
            return(0);
        }
Пример #6
0
        public override void OnSetAction()
        {
            box            = Solid.Construct();
            base.BasePoint = ConstrDefaults.DefaultStartPoint;
            boxLengthX     = ConstrDefaults.DefaultRectWidth;
            boxLengthY     = ConstrDefaults.DefaultRectHeight;
            boxLengthZ     = ConstrDefaults.DefaultBoxHeight;
            boxDirX        = boxLengthX * base.ActiveDrawingPlane.DirectionX;
            boxDirY        = boxLengthY * base.ActiveDrawingPlane.DirectionY;
            boxDirZ        = boxLengthZ * (base.ActiveDrawingPlane.DirectionX ^ base.ActiveDrawingPlane.DirectionY);
            box            = Make3D.MakeBox(ConstrDefaults.DefaultStartPoint, boxDirX, boxDirY, boxDirZ);

            base.ActiveObject = box;
            base.TitleId      = "Constr.Box";

            GeoPointInput startPointInput = new GeoPointInput("Constr.Box.StartPoint");

            startPointInput.DefaultGeoPoint   = ConstrDefaults.DefaultStartPoint;
            startPointInput.DefinesBasePoint  = true;
            startPointInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(StartPoint);

            length = new LengthInput("Constr.Box.Length");
            length.DefaultLength         = ConstrDefaults.DefaultRectWidth;
            length.SetLengthEvent       += new ConstructAction.LengthInput.SetLengthDelegate(Length);
            length.GetLengthEvent       += new LengthInput.GetLengthDelegate(GetLength);
            length.CalculateLengthEvent += new CADability.Actions.ConstructAction.LengthInput.CalculateLengthDelegate(LengthCalculate);
            length.ForwardMouseInputTo   = startPointInput;

            width = new LengthInput("Constr.Box.Width");
            width.DefaultLength         = ConstrDefaults.DefaultRectHeight;
            width.SetLengthEvent       += new ConstructAction.LengthInput.SetLengthDelegate(Width);
            width.GetLengthEvent       += new LengthInput.GetLengthDelegate(GetWidth);
            width.CalculateLengthEvent += new CADability.Actions.ConstructAction.LengthInput.CalculateLengthDelegate(WidthCalculate);
            width.ForwardMouseInputTo   = startPointInput;

            height = new LengthInput("Constr.Box.Height");
            height.DefaultLength         = ConstrDefaults.DefaultBoxHeight;
            height.SetLengthEvent       += new ConstructAction.LengthInput.SetLengthDelegate(Height);
            height.GetLengthEvent       += new LengthInput.GetLengthDelegate(GetHeight);
            height.CalculateLengthEvent += new CADability.Actions.ConstructAction.LengthInput.CalculateLengthDelegate(HeightCalculate);
            height.ForwardMouseInputTo   = startPointInput;


            xVectorInput = new GeoVectorInput("Constr.Box.X-Direction");
            xVectorInput.SetGeoVectorEvent  += new ConstructAction.GeoVectorInput.SetGeoVectorDelegate(XVector);
            xVectorInput.GetGeoVectorEvent  += new GeoVectorInput.GetGeoVectorDelegate(GetXVector);
            xVectorInput.ForwardMouseInputTo = startPointInput;
            xVectorInput.Optional            = true;

            yVectorInput = new GeoVectorInput("Constr.Box.Y-Direction");
            yVectorInput.SetGeoVectorEvent  += new ConstructAction.GeoVectorInput.SetGeoVectorDelegate(YVector);
            yVectorInput.GetGeoVectorEvent  += new GeoVectorInput.GetGeoVectorDelegate(GetYVector);
            yVectorInput.ForwardMouseInputTo = startPointInput;
            yVectorInput.Optional            = true;

            zVectorInput = new GeoVectorInput("Constr.Box.Z-Direction");
            zVectorInput.SetGeoVectorEvent  += new ConstructAction.GeoVectorInput.SetGeoVectorDelegate(ZVector);
            zVectorInput.GetGeoVectorEvent  += new GeoVectorInput.GetGeoVectorDelegate(GetZVector);
            zVectorInput.ForwardMouseInputTo = startPointInput;
            zVectorInput.Optional            = true;

            SeparatorInput separatorLengths    = new SeparatorInput("Constr.Box.SeparatorLengths");
            SeparatorInput separatorDirections = new SeparatorInput("Constr.Box.SeparatorDirections");


            base.SetInput(startPointInput, separatorLengths, length, width, height, separatorDirections, xVectorInput, yVectorInput, zVectorInput);
            base.ShowAttributes = true;

            base.OnSetAction();
        }