Example #1
0
        public void UpdateGeometry()
        {
            if (_VisibleNode == null)
            {
                _VisibleNode = new GroupSceneNode();
                FaceStyle fs = new FaceStyle();
                fs.SetColor(new ColorValue(0, 0, 1.0f, 0.5f));
                fs.SetTransparent(true);
                _VisibleNode.SetFaceStyle(fs);
            }

            _VisibleNode.ClearAll();

            Path.BuildGeometry();

            TopoShape start = GlobalInstance.BrepTools.Extrude(Path.Section, Tool.ZStart, Vector3.UNIT_Z);
            TopoShape end   = GlobalInstance.BrepTools.Extrude(Path.Section, Tool.ZEnd, Vector3.UNIT_Z);

            _VisibleNode.AddNode(GlobalInstance.TopoShapeConvert.ToEntityNode(start, 0.1f));
            _VisibleNode.AddNode(GlobalInstance.TopoShapeConvert.ToEntityNode(end, 0.1f));

            Matrix4 trf = GlobalInstance.MatrixBuilder.MakeTranslate(Tool.Position);

            _VisibleNode.SetTransform(trf);
        }
        GroupSceneNode CreateGeometry()
        {
            var shapeNode = new GroupSceneNode();

            shapeNode.SetPickable(false);

            PhongMaterial material = GlobalInstance.Application.FindSystemMaterial("obsidian");
            FaceStyle     fs       = new FaceStyle();

            fs.SetMaterial(material);
            shapeNode.SetFaceStyle(fs);

            float     bottomHeight = 10;
            TopoShape bottom       = GlobalInstance.BrepTools.MakeCylinder(Vector3.ZERO, Vector3.UNIT_Z, 5, bottomHeight, 0);
            TopoShape top          = GlobalInstance.BrepTools.MakeCylinder(new Vector3(0, 0, bottomHeight), Vector3.UNIT_Z, 10, 15, 0);

            shapeNode.AddNode(GlobalInstance.TopoShapeConvert.ToEntityNode(bottom, 0.1f));
            shapeNode.AddNode(GlobalInstance.TopoShapeConvert.ToEntityNode(top, 0.1f));



            return(shapeNode);
        }