Пример #1
0
 private void ShowAnyRobot()
 {
     //this.treeViewStp.Nodes.Clear();
     //this.renderView.ClearScene();
     for (int part_i = 0; part_i < any_robot.partList.Count; part_i++)
     {
         GroupSceneNode onePartNode = new GroupSceneNode();
         //Console.Write(onePartNode.GetTransform().GetTranslation().ToString());
         for (int geo_i = 0; geo_i < any_robot.partList[part_i].geometryPathList.Count; geo_i++)
         {
             string relPath = any_robot.partList[part_i].geometryPathList[geo_i];
             string absPath = relPath;
             if (relPath.Contains(":"))
             {
                 absPath = relPath;
             }
             else
             {
                 absPath = path + relPath;
             }
             TopoShape geo        = GlobalInstance.BrepTools.LoadFile(new AnyCAD.Platform.Path(absPath));
             SceneNode oneGeoNode = renderView.ShowGeometry(geo, part_i);
             float[]   oneGeoPq   = new float[7];
             for (int i = 0; i < 7; i++)
             {
                 oneGeoPq[i] = any_robot.partList[part_i].geometryPQ_List[i + geo_i * 7];
                 // oneGeoPq[i] = any_robot.partList[part_i].partPQ_initial[i];
             }
             oneGeoNode.SetTransform(QuaternionToTransform(oneGeoPq));
             renderView.RequestDraw();
             geoNodeList.Add(oneGeoNode);
             onePartNode.AddNode(oneGeoNode);
             renderView.SceneManager.RemoveNode(oneGeoNode);
         }
         float[] onePartPq = new float[7];
         for (int j = 0; j < 7; j++)
         {
             onePartPq[j] = any_robot.partList[part_i].partPQ_initial[j];
         }
         onePartNode.SetTransform(QuaternionToTransform(onePartPq));
         renderView.SceneManager.AddNode(onePartNode);
         partNodeList.Add(onePartNode);
     }
     renderView.SceneManager.AddNode(robot_node);
     robot_node.SetPickable(false);
     renderView.RequestDraw();
     robotLoadCompleted = true;
     for (int k = 0; k < partNodeList.Count; k++)
     {
         Console.WriteLine("part" + k + partNodeList[k].GetTransform().GetTranslation().ToString());
     }
     for (int k = 0; k < geoNodeList.Count; k++)
     {
         Console.WriteLine("geo" + k + geoNodeList[k].GetTransform().GetTranslation().ToString());
     }
 }
Пример #2
0
        public override bool Load()
        {
            AnyCAD.Exchange.DxfReader reader  = new AnyCAD.Exchange.DxfReader();
            SectionReaderContextDXF   context = new SectionReaderContextDXF();

            if (!reader.Read(FileName, context, true))
            {
                return(false);
            }

            if (context.Section.Count < 1)
            {
                return(false);
            }

            Section    = context.Section;
            VisualNode = new GroupSceneNode();
            VisualNode.SetPickable(false);

            UpdateGeometry();

            return(true);
        }
Пример #3
0
        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);
        }