private bool Radius1(double length) { if (length > Precision.eps) { coneRadius1 = length; coneDirX = coneRadius1 * coneDirX.Normalized; cone = Make3D.MakeCone(coneStartPoint, coneDirX, coneDirZ, coneRadius1, coneRadius2); if (cone == null) { return(false); } cone.CopyAttributes(base.ActiveObject); if (startPointInput.Fixed && !endPointInput.Fixed) { // er will also einen Kegel senkrecht auf der drawingplane endPointInput.Optional = true; height.Optional = false; height.ForwardMouseInputTo = new object[0]; // den forward abschalten coneDirX = coneRadius1 * base.ActiveDrawingPlane.DirectionX; coneDirZ = coneHeight * (base.ActiveDrawingPlane.DirectionX ^ base.ActiveDrawingPlane.DirectionY); } base.ActiveObject = cone; return(true); } return(false); }
private void EndPoint(GeoPoint p) { if (!Precision.IsEqual(p, coneStartPoint)) { coneDirZ = new GeoVector(coneStartPoint, p); if (height.Fixed) // die schon bestimmte Höhe benutzen! { coneDirZ = coneHeight * coneDirZ.Normalized; } else { coneHeight = coneDirZ.Length; } // coneDirX muss irgendwie senkrecht auf coneDirZ stehen. Hier: Hilfsvektor definieren mit der kleinsten Komponente von coneDirZ GeoVector vT = new GeoVector(1, 0, 0); // x am kleinsten if (Math.Abs(coneDirZ.y) < Math.Abs(coneDirZ.x)) { vT = new GeoVector(0, 1, 0); // y am kleinsten } if ((Math.Abs(coneDirZ.x) > Math.Abs(coneDirZ.z)) && (Math.Abs(coneDirZ.y) > Math.Abs(coneDirZ.z))) { vT = new GeoVector(0, 0, 1); // z am kleinsten } coneDirX = coneRadius1 * (vT ^ coneDirZ).Normalized; cone = Make3D.MakeCone(coneStartPoint, coneDirX, coneDirZ, coneRadius1, coneRadius2); cone.CopyAttributes(base.ActiveObject); base.ActiveObject = cone; } }
private void StartPoint(GeoPoint p) { coneStartPoint = p; // die Höhe berechnet sich als Abstand von diesem Punkt height.SetDistanceFromPoint(coneStartPoint); cone = Make3D.MakeCone(coneStartPoint, coneDirX, coneDirZ, coneRadius1, coneRadius2); cone.CopyAttributes(base.ActiveObject); base.ActiveObject = cone; }
public override void OnSetAction() { cone = Solid.Construct(); base.BasePoint = ConstrDefaults.DefaultStartPoint; coneStartPoint = base.BasePoint; coneRadius1 = ConstrDefaults.DefaultArcRadius; coneRadius2 = ConstrDefaults.DefaultArcRadius / 2; coneHeight = ConstrDefaults.DefaultBoxHeight; coneDirX = coneRadius1 * base.ActiveDrawingPlane.DirectionX; coneDirZ = coneHeight * (base.ActiveDrawingPlane.DirectionX ^ base.ActiveDrawingPlane.DirectionY); cone = Make3D.MakeCone(coneStartPoint, coneDirX, coneDirZ, coneRadius1, coneRadius2); base.ActiveObject = cone; base.TitleId = "Constr.Cone"; startPointInput = new GeoPointInput("Constr.Cone.StartPoint"); startPointInput.DefaultGeoPoint = ConstrDefaults.DefaultStartPoint; startPointInput.DefinesBasePoint = true; startPointInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(StartPoint); endPointInput = new GeoPointInput("Constr.Cone.EndPoint"); // endPointInput.DefaultGeoPoint = ConstrDefaults.DefaultStartPoint; endPointInput.SetGeoPointEvent += new ConstructAction.GeoPointInput.SetGeoPointDelegate(EndPoint); radius1 = new LengthInput("Constr.Cone.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.Cone.Radius2"); radius2.SetLengthEvent += new ConstructAction.LengthInput.SetLengthDelegate(Radius2); radius2.GetLengthEvent += new LengthInput.GetLengthDelegate(GetRadius2); radius2.CalculateLengthEvent += new CADability.Actions.ConstructAction.LengthInput.CalculateLengthDelegate(Radius2Calculate); height = new LengthInput("Constr.Cone.Height"); height.DefaultLength = ConstrDefaults.DefaultBoxHeight; height.SetLengthEvent += new ConstructAction.LengthInput.SetLengthDelegate(Height); height.GetLengthEvent += new LengthInput.GetLengthDelegate(GetHeight); height.Optional = true; height.ForwardMouseInputTo = endPointInput; base.SetInput(startPointInput, endPointInput, radius1, radius2, height); base.ShowAttributes = true; base.OnSetAction(); }
private bool Height(double length) { if (length > Precision.eps) { coneHeight = length; coneDirZ = coneHeight * coneDirZ.Normalized; cone = Make3D.MakeCone(coneStartPoint, coneDirX, coneDirZ, coneRadius1, coneRadius2); if (cone == null) { return(false); } cone.CopyAttributes(base.ActiveObject); base.ActiveObject = cone; return(true); } return(false); }