static CsgObject DialGaugeMount() { // CSG object is a Constructive Solid Geometry Object (a basic part in our system for doing boolean operations). CsgObject dialGauge; // the csg object we will use as the master part. CsgObject frontBarRide = new Box(50, xCarriageBarWidth + 4, xCarriageBarWidth / 2 + 4); CsgObject barGroove = new Cylinder(xCarriageBarWidth / 2, frontBarRide.XSize + .2, Alignment.x); barGroove = new Translate(barGroove, 0, 0, -barGroove.ZSize / 2); frontBarRide -= barGroove; dialGauge = frontBarRide; CsgObject backBarRide = frontBarRide.NewMirrorAccrossY(); backBarRide = new Translate(backBarRide, 0, xCarriageSeparation, 0); dialGauge += backBarRide; CsgObject frontSideWall = new Box(frontBarRide.XSize, wallWidth, wallHeight); frontSideWall = new Align(frontSideWall, Face.Front | Face.Top, frontBarRide, Face.Back | Face.Top, offsetY: -.02); // offset it to ensure good stl geometry dialGauge += frontSideWall; CsgObject backSideWall = new Box(frontBarRide.XSize, wallWidth, wallHeight); backSideWall = new Align(backSideWall, Face.Back | Face.Top, backBarRide, Face.Front | Face.Top, offsetY: .02); // offset it to ensure good stl geometry dialGauge += backSideWall; // make the plate on the bottom double distanceAccrossBottom = backSideWall.GetAxisAlignedBoundingBox().minXYZ.y - frontSideWall.GetAxisAlignedBoundingBox().maxXYZ.y; CsgObject dialBase = new Box(frontBarRide.XSize, distanceAccrossBottom + .02, wallWidth); // make it bigger so it is manifold dialBase = new Align(dialBase, Face.Front | Face.Bottom, frontSideWall, Face.Back | Face.Bottom, offsetY: .01); dialGauge += dialBase; // an some side walls for strength CsgObject leftSideWall = new Box(wallWidth, dialBase.YSize, frontSideWall.ZSize, "#leftsidewall"); leftSideWall = new Align(leftSideWall, Face.Left | Face.Bottom | Face.Front, dialBase, Face.Left | Face.Bottom | Face.Front); dialGauge += leftSideWall; CsgObject rightSideWall = new Box(wallWidth, dialBase.YSize, frontSideWall.ZSize, "#rightsidewall"); rightSideWall = new Align(rightSideWall, Face.Right | Face.Bottom | Face.Front, dialBase, Face.Right | Face.Bottom | Face.Front); dialGauge += rightSideWall; CsgObject dialGaugeHole = new Cylinder(diameterOfDialGaugeBar / 2, dialBase.ZSize + .02, Alignment.z); dialGaugeHole = new SetCenter(dialGaugeHole, dialBase.GetCenter() + new Vector3(0, dialGaugeBarOffsetFromCenter, 0)); dialGauge -= dialGaugeHole; CsgObject bridgeSupport = new Box(dialBase.XSize, dialBase.YSize, .5, "#test"); bridgeSupport = new SetCenter(bridgeSupport, dialBase.GetCenter()); bridgeSupport = new Align(bridgeSupport, Face.Top, dialBase, Face.Top); dialGauge += bridgeSupport; return(dialGauge); }
static CsgObject StepArm() { CsgObject totalMount; // the csg object we will use as the master part. CsgObject pivotHole = new Cylinder(pivotHoleRadius / 2, pivotHeight + .1); CsgObject pivotMount = new Cylinder(pivotRingRadius / 2, pivotHeight); pivotMount = new Align(pivotMount, Face.Bottom, pivotHole, Face.Bottom, offsetZ: .02); totalMount = pivotMount; CsgObject holdArm = new Box(armLength, pivotRingRadius, wallWidth); holdArm = new Align(holdArm, Face.Left | Face.Front | Face.Bottom, pivotMount, Face.Left | Face.Front | Face.Bottom, offsetX: pivotRingRadius / 2); totalMount += holdArm; CsgObject bracingWall = new Box(wallWidth, wallWidth, pivotMount.ZSize - wallWidth); bracingWall = new SetCenter(bracingWall, holdArm.GetCenter()); bracingWall = new Align(bracingWall, Face.Right | Face.Top, pivotMount, Face.Right | Face.Top); totalMount += bracingWall; CsgObject bracingArm = new Box(armLength, wallWidth, wallWidth); bracingArm = new SetCenter(bracingArm, holdArm.GetCenter()); bracingArm = new Align(bracingArm, Face.Bottom | Face.Left, holdArm, Face.Top | Face.Left, offsetZ: -.1); totalMount += bracingArm; totalMount += Round.CreateFillet(bracingWall, Face.Right, bracingArm, Face.Top, 3); //totalMount += Round.CreateFillet(bracingArm, Face.Right, holdArm, Face.Top, wallWidth); double toothSelectorSize = 4; double diagonalSize = Math.Sqrt(toothSelectorSize * toothSelectorSize / 2); CsgObject toothSelectorBack = new Box(diagonalSize * 2, diagonalSize * 2, wallWidth * 2); toothSelectorBack = new Align(toothSelectorBack, Face.Right | Face.Front | Face.Bottom, totalMount, Face.Right | Face.Front | Face.Bottom); totalMount += toothSelectorBack; CsgObject toothSelector = new Box(toothSelectorSize, toothSelectorSize, wallWidth * 2); toothSelector = new Rotate(toothSelector, 0, 0, MathHelper.Tau / 8); toothSelector = new Align(toothSelector, Face.Right | Face.Front | Face.Bottom, totalMount, Face.Right | Face.Front | Face.Bottom, offsetY: -diagonalSize); totalMount += toothSelector; totalMount -= pivotHole; return(totalMount); }
static CsgObject SpoolBarHolderM90() { CsgObject total; CsgObject centerSupport = new Box(mendal90FrameWidth + wallWidth * 2, clipLengthY, wallWidth); total = centerSupport; CsgObject clipWallLeft = new Box(wallWidth, clipLengthY, clipReachZDown); clipWallLeft = new Align(clipWallLeft, Face.Left | Face.Top, centerSupport, Face.Left | Face.Top); CsgObject attachHole = new Cylinder(attacheHoleDiameter / 2, wallWidth + .2, Alignment.x); attachHole = new Align(attachHole, Face.Top, centerSupport, Face.Bottom, offsetZ: -attachHoleOffsetZ); attachHole = new SetCenter(attachHole, clipWallLeft.GetCenter(), onY: false, onZ: false); clipWallLeft -= attachHole; total += clipWallLeft; CsgObject clipWallRight = clipWallLeft.NewMirrorAccrossX(); total += clipWallRight; Box spoolHoldBox = new Box(wallWidth, rodDiameter * 3, clipReachZUp); //spoolHoldBox.BevelEdge(Face.Front | Face.Top, rodDiameter/2); //spoolHoldBox.BevelEdge(Face.Back | Face.Top, rodDiameter / 2); CsgObject spoolHold = spoolHoldBox; spoolHold -= new Align(new Cylinder(rodDiameter / 2, wallWidth + 2, Alignment.x), Face.Top, spoolHold, Face.Top); spoolHold -= new Align(new Box(wallWidth + 2, rodDiameter, rodDiameter / 2), Face.Top, spoolHold, Face.Top, offsetZ: .1); total += new Align(spoolHold, Face.Bottom, centerSupport, Face.Bottom); total += Round.CreateFillet(spoolHold, Face.Left, centerSupport, Face.Top, 2); total += Round.CreateFillet(spoolHold, Face.Right, centerSupport, Face.Top, 2); total -= Round.CreateBevel(centerSupport, Edge.LeftTop, 2); total -= Round.CreateBevel(centerSupport, Edge.RightTop, 2); return(total); }
static CsgObject Render() { // CSG object is a Constructive Solid Geometry Object (a basic part in our system for doing boolean operations). CsgObject totalMount; // the csg object we will use as the master part. CsgObject pivotHole = new Cylinder(pivotHoleRadius / 2, pivotHeight + .1); CsgObject pivotMount = new Cylinder(pivotRingRadius / 2, pivotHeight); pivotMount = new Align(pivotMount, Face.Bottom, pivotHole, Face.Bottom, offsetZ: .02); totalMount = pivotMount; CsgObject holdArm = new Box(armLength, wallWidth * 2, wallWidth); holdArm = new Align(holdArm, Face.Left | Face.Front | Face.Bottom, pivotMount, Face.Left | Face.Front | Face.Bottom, offsetX: pivotRingRadius / 2); totalMount += holdArm; CsgObject switchMount = new Box(switchHeight, switchWidth, wallWidth); switchMount -= new Translate(new Cylinder(switchHoleDiameter / 2, switchMount.ZSize + .1), new Vector3(0, switchHoleSeparation / 2, 0)); switchMount -= new Translate(new Cylinder(switchHoleDiameter / 2, switchMount.ZSize + .1), new Vector3(0, -switchHoleSeparation / 2, 0)); switchMount = new Align(switchMount, Face.Left | Face.Front | Face.Bottom, holdArm, Face.Right | Face.Front | Face.Bottom, offsetX: -.02, offsetY: -5); totalMount += switchMount; CsgObject magnetAttractor = new Box(wallWidth + magnetAttractorHoleRadius, magnetAttractorYSize, wallWidth * 3); // align it from the pivot point magnetAttractor = new Align(magnetAttractor, Face.Left | Face.Front | Face.Bottom, pivotMount, Face.Left | Face.Front | Face.Bottom, offsetX: magnetHoldOffset); totalMount += magnetAttractor; CsgObject bracingWall = new Box(wallWidth, wallWidth, pivotMount.ZSize - wallWidth); bracingWall = new SetCenter(bracingWall, holdArm.GetCenter()); bracingWall = new Align(bracingWall, Face.Right | Face.Top, pivotMount, Face.Right | Face.Top); totalMount += bracingWall; CsgObject bracingArm = new Box(armLength - wireClearence, wallWidth, wallWidth); bracingArm = new SetCenter(bracingArm, holdArm.GetCenter()); bracingArm = new Align(bracingArm, Face.Bottom | Face.Left, holdArm, Face.Top | Face.Left, offsetZ: -.1); totalMount += bracingArm; totalMount += Round.CreateFillet(bracingWall, Face.Right, bracingArm, Face.Top, 3); totalMount += Round.CreateFillet(bracingArm, Face.Right, holdArm, Face.Top, wallWidth); totalMount += Round.CreateFillet(holdArm, Face.Back, switchMount, Face.Left, wallWidth); totalMount += Round.CreateFillet(holdArm, Face.Front, switchMount, Face.Left, wallWidth); totalMount -= pivotHole; CsgObject magnetAttractorHole = new Cylinder(magnetAttractorHoleRadius / 2, magnetAttractor.YSize + .1, Alignment.y); magnetAttractorHole = new SetCenter(magnetAttractorHole, magnetAttractor.GetCenter() + new Vector3(0, 0, -magnetAttractorHoleRadius)); totalMount -= magnetAttractorHole; CsgObject magnetAttractorHole2 = new Cylinder(magnetAttractorHoleRadius / 2, magnetAttractor.YSize + .1, Alignment.y); magnetAttractorHole2 = new SetCenter(magnetAttractorHole2, magnetAttractor.GetCenter() + new Vector3(0, 0, magnetAttractorHoleRadius)); totalMount -= magnetAttractorHole2; return(totalMount); }
static CsgObject MountMount() { Vector3 magnetSize = new Vector3(10, 5, 2.5); CsgObject total; CsgObject baseBox = new Box(37, 26, wallWidth * 2); Round baseBevels = new Round(baseBox.Size); baseBevels.RoundEdge(Edge.LeftFront, 4); baseBevels.RoundEdge(Edge.LeftBack, 4); baseBox -= baseBevels; CsgObject fakeXCarriage = new Translate(baseBox, 0.5); total = fakeXCarriage; double pivotRingYOffset = -pivotHeight / 2 - wallWidth / 2 - .5; CsgObject pivotRingFront = new Cylinder(pivotRingRadius / 2, wallWidth, Alignment.y); CsgObject pivotFrontWall = new Box(pivotRingRadius, wallWidth, mountPivotHeight); pivotFrontWall = new Translate(pivotFrontWall, 0, 0, -mountPivotHeight / 2); CsgObject pivotSupportFront = pivotRingFront + pivotFrontWall; CsgObject pivotHole = new Cylinder(pivotHoleRadius / 2, pivotRingFront.YSize + .1, Alignment.y); pivotHole = new SetCenter(pivotHole, pivotRingFront.GetCenter()); pivotSupportFront -= pivotHole; pivotSupportFront = new Translate(pivotSupportFront, 0, pivotRingYOffset, mountPivotHeight); pivotSupportFront += Round.CreateFillet(pivotSupportFront, Face.Back, fakeXCarriage, Face.Top, 3); pivotSupportFront += Round.CreateFillet(pivotSupportFront, Face.Front, fakeXCarriage, Face.Top, 3); total += pivotSupportFront; CsgObject pivotSupportBack = pivotSupportFront.NewMirrorAccrossY(); total += pivotSupportBack; CsgObject backMagnetHolder = new Box(wallWidth * 2, magnetSize.x + wallWidth, backMagnetHeight); backMagnetHolder = new Align(backMagnetHolder, Face.Bottom | Face.Right, fakeXCarriage, Face.Top | Face.Right, 0, 0, -.1); CsgObject backMagnetHole = new Box(magnetSize.z, magnetSize.x, magnetSize.y); backMagnetHole = new SetCenter(backMagnetHole, backMagnetHolder.GetCenter()); backMagnetHole = new Align(backMagnetHole, Face.Left | Face.Top, backMagnetHolder, Face.Left | Face.Top, -.1, 0, -wallWidth / 2); total += Round.CreateFillet(backMagnetHolder, Face.Front, fakeXCarriage, Face.Top, 3); total += Round.CreateFillet(backMagnetHolder, Face.Back, fakeXCarriage, Face.Top, 3); total += Round.CreateFillet(backMagnetHolder, Face.Left, fakeXCarriage, Face.Top, 3); backMagnetHolder -= backMagnetHole; total += backMagnetHolder; CsgObject baseMagnetHolder = new Box(wallWidth * 2, magnetSize.x + wallWidth, baseMagnetHeight); baseMagnetHolder = new Align(baseMagnetHolder, Face.Bottom, fakeXCarriage, Face.Top, -14, 0, -.1); CsgObject baseMagnetHole = new Box(magnetSize.y, magnetSize.x, magnetSize.z); baseMagnetHole = new SetCenter(baseMagnetHole, baseMagnetHolder.GetCenter()); baseMagnetHole = new Align(baseMagnetHole, Face.Top, baseMagnetHolder, Face.Top, 0, 0, .1); baseMagnetHolder -= baseMagnetHole; total += baseMagnetHolder; return(total); }