public override void Run(RenderControl render) { var paramCurve = Sketch2dBuilder.MakeLine(new GPnt2d(0, 0), new GPnt2d(Math.PI * 20, 20)); // curve one cone { var cone = ShapeBuilder.MakeCone(GP.XOY(), 1, 10, 20, 0); var coneFace = cone.FindChild(EnumTopoShapeType.Topo_FACE, 0); var curveOnConeSurface = SketchBuilder.MakeCurveOnSurface(paramCurve, coneFace); var material = LineDashedMaterial.Create("my.dashed.material"); material.SetColor(ColorTable.Hex(0x0FFAA)); var node = BrepSceneNode.Create(curveOnConeSurface, null, material); node.ComputeLineDistances(); // Enable dashed line style. render.ShowSceneNode(node); } // curve one cylinder { var cylinder = ShapeBuilder.MakeCylinder(GP.XOY(), 2, 20, 0); var cylinderFace = cylinder.FindChild(EnumTopoShapeType.Topo_FACE, 0); var curveOnCylinderSurface = SketchBuilder.MakeCurveOnSurface(paramCurve, cylinderFace); var node2 = BrepSceneNode.Create(curveOnCylinderSurface, null, null); render.ShowSceneNode(node2); } }
public override void Run(RenderControl render) { RedMaterial = MeshPhongMaterial.Create("phong.color"); RedMaterial.SetColor(Vector3.Red); GrayMaterial = MeshPhongMaterial.Create("phong.color"); GrayMaterial.SetColor(Vector3.LightGray); GrayMaterial.SetTransparent(true); GrayMaterial.SetOpacity(0.5f); var tube = ShapeBuilder.MakeTube(new GPnt(0, 0, 5), GP.DZ(), 10, 2, 50); TubeNode = BrepSceneNode.Create(tube, RedMaterial, null); var cylinder = ShapeBuilder.MakeCylinder(GP.XOY(), 10, 60, 0); CylinderNode = BrepSceneNode.Create(cylinder, GrayMaterial, null); render.ShowSceneNode(TubeNode); render.ShowSceneNode(CylinderNode); var cone = ShapeBuilder.MakeCone(GP.YOZ(), 5, 0, 10, 0); var bs = new BufferShape(cone, RedMaterial, null, 0.1); bs.Build(); ConeNode1 = new BrepSceneNode(bs); ConeNode2 = new BrepSceneNode(bs); render.ShowSceneNode(ConeNode1); render.ShowSceneNode(ConeNode2); }
public override void Run(RenderControl render) { var material = MeshStandardMaterial.Create("workpiece"); material.SetColor(new Vector3(0.9f)); material.SetFaceSide(EnumFaceSide.DoubleSide); var shape = ShapeBuilder.MakeCylinder(GP.YOZ(), 5, 50, 0); mWorkpiece = BrepSceneNode.Create(shape, material, null); render.ShowSceneNode(mWorkpiece); var coord = new GAx2(new GPnt(0, 0, 5), GP.DZ()); var toolShape = ShapeBuilder.MakeCone(coord, 0, 2, 5, 0); var toolNode = render.ShowShape(toolShape, ColorTable.Blue); render.ShowSceneNode(mMotionTrail); // Initialize Animation mAnimation = new RigidAnimation(); var rotation = Matrix4.makeRotationAxis(new Vector3(1, 0, 0), (float)Math.PI); var trf = Matrix4.makeTranslation(-50, 0, 0) * rotation; mAnimation.Add(new MatrixAnimationClip(mWorkpiece, mWorkpiece.GetTransform(), trf, 0, 10)); mAnimation.Add(new MatrixAnimationClip(toolNode, toolNode.GetTransform(), trf, 10, 15)); mAnimation.Add(new RotateAnimationClip(toolNode, Vector3.UNIT_Z, (float)Math.PI * 4, 16, 20)); }
public override void Run(RenderControl render) { var material = MeshStandardMaterial.Create("workpiece"); material.SetColor(new Vector3(0.9f)); material.SetFaceSide(EnumFaceSide.DoubleSide); var shape = ShapeBuilder.MakeCylinder(GP.YOZ(), 5, 50, 0); mWorkpiece = BrepSceneNode.Create(shape, material, null); render.ShowSceneNode(mWorkpiece); { var coord = new GAx2(new GPnt(0, 0, 5), GP.DZ()); var toolShape = ShapeBuilder.MakeCone(coord, 0, 2, 5, 0); render.ShowShape(toolShape, Vector3.Blue); } render.ShowSceneNode(mMotionTrail); mLength = 0; mTheta = 0; }
public override void Run(RenderControl render) { var paramCurve = Sketch2dBuilder.MakeLine(new GPnt2d(0, 0), new GPnt2d(Math.PI * 20, 20)); // curve one cone var cone = ShapeBuilder.MakeCone(GP.XOY(), 1, 10, 20, 0); var coneFace = cone.FindChild(EnumTopoShapeType.Topo_FACE, 0); var curveOnConeSurface = SketchBuilder.MakeCurveOnSurface(paramCurve, coneFace); render.ShowShape(curveOnConeSurface, Vector3.Blue); // curve one cylinder var cylinder = ShapeBuilder.MakeCylinder(GP.XOY(), 2, 20, 0); var cylinderFace = cylinder.FindChild(EnumTopoShapeType.Topo_FACE, 0); var curveOnCylinderSurface = SketchBuilder.MakeCurveOnSurface(paramCurve, cylinderFace); render.ShowShape(curveOnCylinderSurface, Vector3.Green); }