/// <summary> /// ремешок с перфорацие /// </summary> /// <param name="WatchData">информация о часах</param> /// <returns>Модель часов</returns> public Solid3d BuildStrapWithPerforations(WatchData WatchData) { //модель ремешка с перфор. Solid3d StrapWithPerforations = new Solid3d(); StrapWithPerforations.CreateBox(Length / 2, Width, 3); //сглаживаем углы. Solid3d StrapSmoother = new Solid3d(); StrapSmoother.CreateFrustum(Width, _params[ParNames.StrapTransformByY], _params[ParNames.StrapTransformByY], _params[ParNames.StrapTransformByY]); StrapSmoother.TransformBy(Matrix3d.Rotation(Math.PI / 2, new Vector3d(1, 0, 0), Point3d.Origin)); StrapSmoother.TransformBy(Matrix3d.Displacement(new Vector3d(Length / 4, 0, 0))); StrapWithPerforations.BooleanOperation(BooleanOperationType.BoolUnite, StrapSmoother.Clone() as Solid3d); StrapSmoother.CreateFrustum(Width, _params[ParNames.StrapTransformByY], _params[ParNames.StrapTransformByY], _params[ParNames.StrapTransformByY]); StrapSmoother.TransformBy(Matrix3d.Rotation(Math.PI / 2, new Vector3d(1, 0, 0), Point3d.Origin)); StrapSmoother.TransformBy(Matrix3d.Displacement(new Vector3d(-Length / 4, 0, 0))); StrapWithPerforations.BooleanOperation(BooleanOperationType.BoolUnite, StrapSmoother.Clone() as Solid3d); //проделываем перфорации Solid3d HoleMaker = new Solid3d(); for (int i = 0; i < NumberOfPerforations; i++) { HoleMaker.CreateFrustum(3, PerforationRadius, PerforationRadius, PerforationRadius); HoleMaker.TransformBy(Matrix3d.Displacement(new Vector3d((Length / 4 - 10) - (Length / 3) / NumberOfPerforations * i, 0, 0))); StrapWithPerforations.BooleanOperation(BooleanOperationType.BoolSubtract, HoleMaker.Clone() as Solid3d); } StrapWithPerforations.TransformBy(Matrix3d.Displacement(new Vector3d(WatchData.BodyDiameter + WatchData.BootstrapLength + (Length / 4) - 0.5, 0, 0))); return(StrapWithPerforations); }
/// <summary> /// построить ремешок часов /// </summary> /// <param name="WatchData">информация о часах</param> public void Build(WatchData WatchData) { //выставляем параметры Length = WatchData.StrapLength; Width = WatchData.StrapWidth; PerforationRadius = WatchData.StrapPerforationRadius; NumberOfPerforations = WatchData.NumberOfPerforations; //строим Builder.BuildModelInAcad(BuildStrapWithPerforations(WatchData)); Builder.BuildModelInAcad(BuildStrapWithLocker(WatchData)); }
/// <summary> /// ремешок с замком /// </summary> /// <param name="WatchData">информация о часах</param> /// <returns>модель ремешка</returns> public Solid3d BuildStrapWithLocker(WatchData WatchData) { //модель ремешка с замком Solid3d StrapWithLocker = new Solid3d(); StrapWithLocker.CreateBox(Length / _params[ParNames.StrapTransformByX], Width, 3); //сглаживания ремешка Solid3d StrapSmoother = new Solid3d(); StrapSmoother.CreateFrustum(Width, _params[ParNames.StrapTransformByY], _params[ParNames.StrapTransformByY], _params[ParNames.StrapTransformByY]); StrapSmoother.TransformBy(Matrix3d.Rotation(Math.PI / _params[ParNames.StrapTransformByX], new Vector3d(1, 0, 0), Point3d.Origin)); StrapSmoother.TransformBy(Matrix3d.Displacement(new Vector3d(Length / 4, 0, 0))); StrapWithLocker.BooleanOperation(BooleanOperationType.BoolUnite, StrapSmoother.Clone() as Solid3d); StrapSmoother.CreateFrustum(Width, _params[ParNames.StrapTransformByY], _params[ParNames.StrapTransformByX], _params[ParNames.StrapTransformByY]); StrapSmoother.TransformBy(Matrix3d.Rotation(Math.PI / _params[ParNames.StrapTransformByX], new Vector3d(1, 0, 0), Point3d.Origin)); StrapSmoother.TransformBy(Matrix3d.Displacement(new Vector3d(-Length / 4, 0, 0))); StrapWithLocker.BooleanOperation(BooleanOperationType.BoolUnite, StrapSmoother.Clone() as Solid3d); //замок ремешка Solid3d Locker = new Solid3d(); Locker.CreateBox(20, Width + _params[ParNames.StrapTransformByX], 4); Solid3d LockerHole = new Solid3d(); LockerHole.CreateBox(18, Width, 4); LockerHole.TransformBy(Matrix3d.Displacement(new Vector3d(4, 0, 0))); Locker.BooleanOperation(BooleanOperationType.BoolSubtract, LockerHole.Clone() as Solid3d); //Дерджатель на замке Solid3d LockerPin = new Solid3d(); LockerPin.CreateBox(20, WatchData.StrapPerforationRadius, _params[ParNames.StrapTransformByX]); Locker.BooleanOperation(BooleanOperationType.BoolUnite, LockerPin.Clone() as Solid3d); //передвигаем ремешок Locker.TransformBy(Matrix3d.Displacement(new Vector3d((-Length / 4) - 5, 0, 0))); StrapWithLocker.BooleanOperation(BooleanOperationType.BoolUnite, Locker.Clone() as Solid3d); StrapWithLocker.TransformBy(Matrix3d.Displacement(new Vector3d(-(WatchData.BodyDiameter + WatchData.BootstrapLength + (Length / 4) - 0.5), 0, 0))); //возвращаем модель ремешка return(StrapWithLocker); }
/// <summary> /// Построить часы в акаде /// </summary> /// <param name="WatchData">Параметры часов</param> public void Build(WatchData WatchData) { Diameter = WatchData.BodyDiameter; Height = WatchData.BodyHeight; Crown.Diameter = WatchData.CrownDiameter; Crown.Height = WatchData.CrownHeight; HasChronograph = WatchData.HasChronograph; BootstrapLength = WatchData.BootstrapLength; //Строим корпус Builder.BuildModelInAcad(BuildBody(WatchData)); //Строим Стрелки Builder.BuildModelInAcad(BuildArrows(WatchData)); //Цифры на корпусе CreateDigits(); //Заводная головка Crown.Build(WatchData); }
/// <summary> /// Построить 3д солид-модель /// </summary> /// <param name="WatchData">Параметры часов</param> /// <returns>3Д - солид модель</returns> public Solid3d BuildCrown(WatchData WatchData) { //заводная головка Solid3d CrownPart = new Solid3d(); CrownPart.CreateFrustum(Height, Diameter, Diameter, Diameter); //низ заводной головки Solid3d CrownBottom = new Solid3d(); CrownBottom.CreateFrustum(1, Diameter, Diameter, Diameter - _pararameters[ParNames.CrownBottomHeight]); CrownBottom.TransformBy(Matrix3d.Displacement(new Point3d(0, 0, Height / _pararameters[ParNames.CrownTransformByZ] + _pararameters[ParNames.CrownTopHeight]) - Point3d.Origin)); CrownPart.BooleanOperation(BooleanOperationType.BoolUnite, CrownBottom.Clone() as Solid3d); //вверх зав.головки Solid3d CrownTop = new Solid3d(); CrownBottom.CreateFrustum(_pararameters[ParNames.CrownTopHeight], Diameter - _pararameters[ParNames.CrownTopHeight], Diameter - _pararameters[ParNames.CrownTopHeight], Diameter); CrownBottom.TransformBy(Matrix3d.Displacement(new Point3d(0, 0, -Height / _pararameters[ParNames.CrownTransformByZ] - 0.25) - Point3d.Origin)); CrownPart.BooleanOperation(BooleanOperationType.BoolUnite, CrownBottom.Clone() as Solid3d); CrownBottom.CreateFrustum(_pararameters[ParNames.CrownTopHeight], Diameter - _pararameters[ParNames.CrownTopHeight], Diameter - _pararameters[ParNames.CrownTopHeight], Diameter - 1); CrownBottom.TransformBy(Matrix3d.Displacement(new Point3d(0, 0, -Height / _pararameters[ParNames.CrownTransformByZ] - _pararameters[ParNames.CrownTopHeight]) - Point3d.Origin)); CrownPart.BooleanOperation(BooleanOperationType.BoolSubtract, CrownBottom.Clone() as Solid3d); //вырезаем цилиндры по радиусу зав. головки Solid3d CrownCutter = new Solid3d(); CrownCutter.CreateFrustum(Height + _pararameters[ParNames.CrownBottomHeight], Diameter / _pararameters[ParNames.CrownCutterCount], Diameter / _pararameters[ParNames.CrownCutterCount], Diameter / _pararameters[ParNames.CrownCutterCount]); for (int i = 0; i < _pararameters[ParNames.CrownCutterCylinder]; i++) { CrownCutter.TransformBy(Matrix3d.Displacement(new Vector3d(Diameter * Math.Cos(Math.PI / 12 * i), Diameter * Math.Sin(Math.PI / 12 * i), 0))); CrownPart.BooleanOperation(BooleanOperationType.BoolSubtract, CrownCutter.Clone() as Solid3d); CrownCutter.TransformBy(Matrix3d.Displacement(new Vector3d(-Diameter * Math.Cos(Math.PI / 12 * i), -Diameter * Math.Sin(Math.PI / 12 * i), 0))); } CrownPart.TransformBy(Matrix3d.Rotation(Math.PI / 2, new Vector3d(1, 0, 0), Point3d.Origin)); CrownPart.TransformBy(Matrix3d.Displacement(new Vector3d(0, WatchData.BodyDiameter + Height / _pararameters[ParNames.CrownTransformByZ] + _pararameters[ParNames.CrownBottomHeight], 0))); return(CrownPart); }
/// <summary> /// Строим стрелки /// </summary> /// <param name="WatchData">Информация о часах</param> /// <returns>модель стрелок</returns> private Solid3d BuildArrows(WatchData WatchData) { //стрелки Solid3d Arrows = new Solid3d(); //база Solid3d Base = new Solid3d(); //первая часть базы Base.CreateFrustum(_params[ParNames.BodyTransformByX] / 2, _params[ParNames.BodyTransformByZ], _params[ParNames.BodyTransformByZ], _params[ParNames.BodyTransformByZ]); Base.TransformBy(Matrix3d.Displacement(new Vector3d(0, 0, Height / 2 + _params[ParNames.BodyTransformByX] / 4))); Arrows.BooleanOperation(BooleanOperationType.BoolUnite, Base.Clone() as Solid3d); //вторая часть бызы Base.CreateFrustum(_params[ParNames.BodyTransformByX] / 2, _params[ParNames.BodyTransformByY], _params[ParNames.BodyTransformByY], _params[ParNames.BodyTransformByY]); Base.TransformBy(Matrix3d.Displacement(new Vector3d(0, 0, Height / 2 + _params[ParNames.BodyTransformByX] / 4 * 3))); Arrows.BooleanOperation(BooleanOperationType.BoolUnite, Base.Clone() as Solid3d); //часовая стрелка Solid3d Arrow = new Solid3d(); Arrow.CreateBox(Diameter / 2, _params[ParNames.BodyTransformByY], _params[ParNames.BodyTransformByX] / 4); Arrow.TransformBy(Matrix3d.Displacement(new Vector3d(-(Diameter / 4), 0, Height / 2 + _params[ParNames.BodyTransformByX] / 4))); double TrueHour = System.DateTime.Now.Hour + ((double)System.DateTime.Now.Minute / 60); Arrow.TransformBy(Matrix3d.Rotation(-(Math.PI / 6 * TrueHour), new Vector3d(0, 0, 1), Point3d.Origin)); Arrows.BooleanOperation(BooleanOperationType.BoolUnite, Arrow.Clone() as Solid3d); //минутная стрелка Arrow.CreateBox(Diameter / 2 + _params[ParNames.BodyTopTransformByY], _params[ParNames.BodyTransformByX] + _params[ParNames.BodyTransformByX] / 5, _params[ParNames.BodyTransformByX] / 5); Arrow.TransformBy(Matrix3d.Displacement(new Vector3d(-(Diameter / 4), 0, Height / 2 + _params[ParNames.BodyTransformByX] / 4 * 3))); Arrow.TransformBy(Matrix3d.Rotation(-(Math.PI / 30 * System.DateTime.Now.Minute), new Vector3d(0, 0, 1), Point3d.Origin)); Arrows.BooleanOperation(BooleanOperationType.BoolUnite, Arrow.Clone() as Solid3d); //секундная стрелка Arrow.CreateBox(Diameter / 2 + _params[ParNames.BodyBottomHeight], _params[ParNames.BodyTransformByX] / 2, _params[ParNames.BodyTransformByX] / 5); Arrow.TransformBy(Matrix3d.Displacement(new Vector3d(-(Diameter / _params[ParNames.BodyTopTransformByX]), 0, Height / 2 + _params[ParNames.BodyTransformByX] + _params[ParNames.BodyTransformByX] / 10))); Arrow.TransformBy(Matrix3d.Rotation(-(Math.PI / 30 * System.DateTime.Now.Second), new Vector3d(0, 0, 1), Point3d.Origin)); Arrows.BooleanOperation(BooleanOperationType.BoolUnite, Arrow.Clone() as Solid3d); return(Arrows); }
/// <summary> /// Построить модель корпуса /// </summary> /// <param name="WatchData">параметры часов</param> /// <returns>3д модель корпуса</returns> private Solid3d BuildBody(WatchData WatchData) { //корпус часов Solid3d Body = new Solid3d(); Body.CreateFrustum(Height, Diameter, Diameter, Diameter); //Верхняя часть корпуса Solid3d BodyTop = new Solid3d(); BodyTop.CreateFrustum(_params[ParNames.BodyTransformByY], Diameter, Diameter, Diameter - _params[ParNames.BodyTransformByZ]); BodyTop.TransformBy(Matrix3d.Displacement(new Point3d(0, 0, Height / _params[ParNames.BodyTransformByY] + _params[ParNames.BodyTransformByX]) - Point3d.Origin)); Body.BooleanOperation(BooleanOperationType.BoolUnite, BodyTop.Clone() as Solid3d); //Нижняя часть корпуса Solid3d BodyBottom = new Solid3d(); BodyBottom.CreateFrustum(_params[ParNames.BodyTransformByX], Diameter - _params[ParNames.BodyTopTransformByY], Diameter - _params[ParNames.BodyTopTransformByY], Diameter - _params[ParNames.BodyTransformByY]); BodyBottom.TransformBy(Matrix3d.Displacement(new Point3d(0, 0, -(Height / 2 + _params[ParNames.BodyTransformByX] / 2)) - Point3d.Origin)); Body.BooleanOperation(BooleanOperationType.BoolUnite, BodyBottom.Clone() as Solid3d); //Вырез на корпусе, сверху BodyTop = new Solid3d(); BodyTop.CreateFrustum(_params[ParNames.BodyTransformByY], Diameter - _params[ParNames.BodyBottomTransformByX], Diameter - _params[ParNames.BodyBottomTransformByX], Diameter - _params[ParNames.BodyTopTransformByY]); BodyTop.TransformBy(Matrix3d.Displacement(new Point3d(0, 0, Height / _params[ParNames.BodyTransformByY] + _params[ParNames.BodyTransformByX]) - Point3d.Origin)); Body.BooleanOperation(BooleanOperationType.BoolSubtract, BodyTop.Clone() as Solid3d); //ушки на корпусе Solid3d Bootstrap = new Solid3d(); Bootstrap.CreateBox(BootstrapLength * _params[ParNames.BodyTransformByY] + Diameter * _params[ParNames.BodyTransformByY], _params[ParNames.BodyTopTransformByY], _params[ParNames.BodyTopTransformByY]); Vector3d BootsrapPosition; Solid3d ArcPart = new Solid3d(); ArcPart.CreateFrustum(_params[ParNames.BodyTopTransformByY], _params[ParNames.BodyTopTransformByY] / 2, _params[ParNames.BodyTopTransformByY] / 2, _params[ParNames.BodyTopTransformByY] / 2); ArcPart.TransformBy(Matrix3d.Rotation(Math.PI / 2, new Vector3d(1, 0, 0), Point3d.Origin)); ArcPart.TransformBy(Matrix3d.Displacement(new Vector3d(Diameter + BootstrapLength, 0, 0))); //Держатели на ушках Solid3d StrapHolder = new Solid3d(); StrapHolder.CreateFrustum(WatchData.StrapWidth + _params[ParNames.BodyTopTransformByX], _params[ParNames.BodyTransformByX] / _params[ParNames.BodyTransformByY], _params[ParNames.BodyTransformByX] / _params[ParNames.BodyTransformByY], _params[ParNames.BodyTransformByX] / _params[ParNames.BodyTransformByY]); StrapHolder.TransformBy(Matrix3d.Rotation(Math.PI / _params[ParNames.BodyTransformByY], new Vector3d(1, 0, 0), Point3d.Origin)); StrapHolder.TransformBy(Matrix3d.Displacement(new Vector3d(Diameter + BootstrapLength, -WatchData.StrapWidth / 2 - _params[ParNames.BodyTransformByY], 0))); ArcPart.BooleanOperation(BooleanOperationType.BoolUnite, StrapHolder.Clone() as Solid3d); Bootstrap.BooleanOperation(BooleanOperationType.BoolUnite, ArcPart.Clone() as Solid3d); //сглаженные углы на ушках ArcPart.CreateFrustum(_params[ParNames.BodyTopTransformByY], _params[ParNames.BodyTopTransformByY] / _params[ParNames.BodyTransformByY], _params[ParNames.BodyTopTransformByY] / 2, _params[ParNames.BodyTopTransformByY] / 2); ArcPart.TransformBy(Matrix3d.Rotation(Math.PI / _params[ParNames.BodyTransformByY], new Vector3d(1, 0, 0), Point3d.Origin)); ArcPart.TransformBy(Matrix3d.Displacement(new Vector3d(-(Diameter + BootstrapLength), 0, 0))); StrapHolder.CreateFrustum(WatchData.StrapWidth + _params[ParNames.BodyTopTransformByX], _params[ParNames.BodyTransformByX] / 2, _params[ParNames.BodyTransformByX] / 2, _params[ParNames.BodyTransformByX] / 2); StrapHolder.TransformBy(Matrix3d.Rotation(Math.PI / 2, new Vector3d(1, 0, 0), Point3d.Origin)); StrapHolder.TransformBy(Matrix3d.Displacement(new Vector3d(-(Diameter + BootstrapLength), -WatchData.StrapWidth / 2 - _params[ParNames.BodyTransformByY], 0))); ArcPart.BooleanOperation(BooleanOperationType.BoolUnite, StrapHolder.Clone() as Solid3d); Bootstrap.BooleanOperation(BooleanOperationType.BoolUnite, ArcPart.Clone() as Solid3d); BootsrapPosition = new Vector3d(0, WatchData.StrapWidth / _params[ParNames.BodyTransformByY] + _params[ParNames.BodyTransformByZ], 0); Bootstrap.TransformBy(Matrix3d.Displacement(BootsrapPosition)); Body.BooleanOperation(BooleanOperationType.BoolUnite, Bootstrap.Clone() as Solid3d); Bootstrap = new Solid3d(); Bootstrap.CreateBox(BootstrapLength * _params[ParNames.BodyTransformByY] + Diameter * _params[ParNames.BodyTransformByY], _params[ParNames.BodyTopTransformByY], _params[ParNames.BodyTopTransformByY]); ArcPart = new Solid3d(); ArcPart.CreateFrustum(_params[ParNames.BodyTopTransformByY], _params[ParNames.BodyTopTransformByY] / 2, _params[ParNames.BodyTopTransformByY] / _params[ParNames.BodyTransformByY], _params[ParNames.BodyTopTransformByY] / _params[ParNames.BodyTransformByY]); ArcPart.TransformBy(Matrix3d.Rotation(Math.PI / _params[ParNames.BodyTransformByY], new Vector3d(1, 0, 0), Point3d.Origin)); ArcPart.TransformBy(Matrix3d.Displacement(new Vector3d(Diameter + BootstrapLength, 0, 0))); Bootstrap.BooleanOperation(BooleanOperationType.BoolUnite, ArcPart.Clone() as Solid3d); ArcPart.CreateFrustum(_params[ParNames.BodyTopTransformByY], _params[ParNames.BodyTopTransformByY] / _params[ParNames.BodyTransformByY], _params[ParNames.BodyTopTransformByY] / 2, _params[ParNames.BodyTopTransformByY] / _params[ParNames.BodyTransformByY]); ArcPart.TransformBy(Matrix3d.Rotation(Math.PI / _params[ParNames.BodyTransformByY], new Vector3d(1, 0, 0), Point3d.Origin)); ArcPart.TransformBy(Matrix3d.Displacement(new Vector3d(-(Diameter + BootstrapLength), 0, 0))); Bootstrap.BooleanOperation(BooleanOperationType.BoolUnite, ArcPart.Clone() as Solid3d); BootsrapPosition = new Vector3d(0, -(WatchData.StrapWidth / _params[ParNames.BodyTransformByY] + _params[ParNames.BodyTransformByZ]), 0); Bootstrap.TransformBy(Matrix3d.Displacement(BootsrapPosition)); //соеденяем все вместе Body.BooleanOperation(BooleanOperationType.BoolUnite, Bootstrap.Clone() as Solid3d); //если есть хронограф, то выполняем if (HasChronograph) { //первая кнопка хронографа Solid3d ChronoButtonTop = new Solid3d(); ChronoButtonTop.CreateFrustum(_params[ParNames.BodyTopTransformByX], _params[ParNames.BodyTopTransformByX], _params[ParNames.BodyTopTransformByX], _params[ParNames.BodyTopTransformByX]); ChronoButtonTop.TransformBy(Matrix3d.Rotation(Math.PI / 2, new Vector3d(1, 0, 0), Point3d.Origin)); ChronoButtonTop.TransformBy(Matrix3d.Displacement(new Vector3d(0, Diameter, 0))); ChronoButtonTop.TransformBy(Matrix3d.Rotation(Math.PI / 6, new Vector3d(0, 0, 1), Point3d.Origin)); Body.BooleanOperation(BooleanOperationType.BoolUnite, ChronoButtonTop.Clone() as Solid3d); //вторая кнопка хронографа Solid3d ChronoButtonBottom = new Solid3d(); ChronoButtonBottom.CreateFrustum(_params[ParNames.BodyTopTransformByY], _params[ParNames.BodyTopTransformByY], _params[ParNames.BodyTopTransformByY], _params[ParNames.BodyTopTransformByY]); ChronoButtonBottom.TransformBy(Matrix3d.Rotation(Math.PI / 2, new Vector3d(1, 0, 0), Point3d.Origin)); ChronoButtonBottom.TransformBy(Matrix3d.Displacement(new Vector3d(0, Diameter, 0))); ChronoButtonBottom.TransformBy(Matrix3d.Rotation(-Math.PI / 6, new Vector3d(0, 0, 1), Point3d.Origin)); Body.BooleanOperation(BooleanOperationType.BoolUnite, ChronoButtonBottom.Clone() as Solid3d); } return(Body); }
/// <summary> /// Построить модель /// </summary> /// <param name="WatchData">Параметры часов</param> public void Build(WatchData WatchData) { //Для каждой части вызываем построитель _parts.ForEach(part => part.Build(WatchData)); }
/// <summary> /// Построить модель в акаде /// </summary> /// <param name="WatchData">Параметры часов</param> public void Build(WatchData WatchData) { //строим зав. головку Builder.BuildModelInAcad(BuildCrown(WatchData)); }