Exemple #1
0
 private bool Radius1(double length)
 {
     if (length > Precision.eps)
     {  // Ringradius=torusRadius2 angleichen
         if (!radius2.Fixed)
         {
             torusRadius2 = length / 5.0;
         }
         else
         { // wenn torusRadius2 schon bestimmt: torusRadius1 muss immer kleiner sein!
             if (torusRadius1 <= torusRadius2)
             {
                 return(false);
             }
         }
         torusRadius1 = length;
         torus        = Make3D.MakeTorus(torusCenterPoint, torusNormal, torusRadius1, torusRadius2);
         if (torus == null)
         {
             return(false);
         }
         torus.CopyAttributes(base.ActiveObject);
         base.ActiveObject = torus;
         return(true);
     }
     return(false);
 }
Exemple #2
0
 private void CenterPoint(GeoPoint p)
 {
     torusCenterPoint = p;
     torus            = Make3D.MakeTorus(torusCenterPoint, torusNormal, torusRadius1, torusRadius2);
     torus.CopyAttributes(base.ActiveObject);
     base.ActiveObject = torus;
 }
Exemple #3
0
 private void EndPoint(GeoPoint p)
 { // definiert die Achse des Torus
     if (!Precision.IsEqual(p, torusCenterPoint))
     {
         torusNormal = new GeoVector(torusCenterPoint, p);
         torus       = Make3D.MakeTorus(torusCenterPoint, torusNormal, torusRadius1, torusRadius2);
         torus.CopyAttributes(base.ActiveObject);
         base.ActiveObject = torus;
     }
 }
Exemple #4
0
 private bool Radius2(double length)
 {
     if ((length > Precision.eps) && (length < torusRadius1))
     {   // Neue Torus
         torusRadius2 = length;
         torus        = Make3D.MakeTorus(torusCenterPoint, torusNormal, torusRadius1, torusRadius2);
         if (torus == null)
         {
             return(false);
         }
         torus.CopyAttributes(base.ActiveObject);
         base.ActiveObject = torus;
         return(true);
     }
     return(false);
 }
Exemple #5
0
        public override void OnSetAction()
        {
            torus            = Solid.Construct();
            base.BasePoint   = ConstrDefaults.DefaultStartPoint;
            torusCenterPoint = base.BasePoint;
            torusRadius1     = ConstrDefaults.DefaultArcRadius;
            torusRadius2     = ConstrDefaults.DefaultArcRadius / 5;
            torusNormal      = base.ActiveDrawingPlane.Normal;
            torus            = Make3D.MakeTorus(torusCenterPoint, torusNormal, torusRadius1, torusRadius2);

            base.ActiveObject = torus;
            base.TitleId      = "Constr.Torus";

            centerPointInput = new GeoPointInput("Constr.Torus.Center");
            centerPointInput.DefaultGeoPoint   = ConstrDefaults.DefaultStartPoint;
            centerPointInput.DefinesBasePoint  = true;
            centerPointInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(CenterPoint);

            endPointInput = new GeoPointInput("Constr.Torus.EndPoint");
            endPointInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(EndPoint);
            endPointInput.Optional          = true;

            radius1 = new LengthInput("Constr.Torus.Radius1");
            radius1.DefaultLength         = ConstrDefaults.DefaultArcRadius;
            radius1.SetLengthEvent       += new ConstructAction.LengthInput.SetLengthDelegate(Radius1);
            radius1.GetLengthEvent       += new LengthInput.GetLengthDelegate(GetRadius1);
            radius1.CalculateLengthEvent += new CADability.Actions.ConstructAction.LengthInput.CalculateLengthDelegate(Radius1Calculate);


            radius2 = new LengthInput("Constr.Torus.Radius2");
            radius2.SetLengthEvent       += new ConstructAction.LengthInput.SetLengthDelegate(Radius2);
            radius2.GetLengthEvent       += new LengthInput.GetLengthDelegate(GetRadius2);
            radius2.CalculateLengthEvent += new CADability.Actions.ConstructAction.LengthInput.CalculateLengthDelegate(Radius2Calculate);

            base.SetInput(centerPointInput, endPointInput, radius1, radius2);
            base.ShowAttributes = true;

            base.OnSetAction();
        }