public override bool Run(FeatureContext context)
        {
            TopoShape box = GlobalInstance.BrepTools.MakeBox(Vector3.ZERO, Vector3.UNIT_Z, new Vector3(100, 2, 200));

            {
                SceneNode node = context.ShowGeometry(box);
                FaceStyle fs   = new FaceStyle();
                fs.SetColor(new ColorValue(0.5f, 0.5f, 1.0f, 0.5f));
                fs.SetTransparent(true);
                node.SetFaceStyle(fs);
            }
            context.RequestDraw();


            OpenFileDialog dlg = new OpenFileDialog();

            dlg.Filter = "Texture File (*.jpg;*.png)|*.jpg;*png||";
            if (DialogResult.OK == dlg.ShowDialog())
            {
                SceneNode node2 = context.ShowGeometry(box);
                node2.SetTransform(GlobalInstance.MatrixBuilder.MakeTranslate(new Vector3(0, 50, 0)));
                FaceStyle fs2 = new FaceStyle();
                Texture   tex = new Texture();
                tex.SetName(dlg.SafeFileName);
                tex.SetFilePath(new Path(dlg.FileName));

                fs2.SetTexture(0, tex);

                node2.SetFaceStyle(fs2);
            }

            return(true);
        }
Ejemplo n.º 2
0
        public override bool Run(FeatureContext context)
        {
            TopoShape        box    = GlobalInstance.BrepTools.MakeBox(Vector3.ZERO, Vector3.UNIT_Z, new Vector3(10, 10, 10));
            RenderableEntity entity = GlobalInstance.TopoShapeConvert.ToEntity(box, 0);

            for (int ii = 0; ii < 10; ++ii)
            {
                EntitySceneNode node = new EntitySceneNode();
                node.SetEntity(entity);
                Matrix4 trf = GlobalInstance.MatrixBuilder.MakeTranslate(new Vector3(11 * ii, 0, 0));
                node.SetTransform(trf);

                context.ShowSceneNode(node);
            }
            context.RequestDraw();

            SceneNodeIterator itr = context.RenderView.SceneManager.NewSceneNodeIterator();
            String            msg = "Node Ids: ";

            while (itr.More())
            {
                SceneNode node = itr.Next();
                msg += String.Format(" {0}", node.GetId().AsInt());
            }

            MessageBox.Show(msg);

            return(true);
        }
Ejemplo n.º 3
0
        public override bool Run(FeatureContext context)
        {
            {
                TopoShape cone = GlobalInstance.BrepTools.MakeDish(100, 30, Vector3.ZERO);
                SceneNode node = context.ShowGeometry(cone);
                node.SetName("My Cone");
                context.RenderView.SceneManager.SelectNode(node);

                context.RequestDraw();
            }

            SelectedEntityQuery query = new SelectedEntityQuery();

            context.RenderView.QuerySelection(query);
            SceneNode node2 = query.GetRootNode();

            if (node2 != null)
            {
                MessageBox.Show(String.Format("Selected Node: {0}", node2.GetName()));
            }


            return(true);
        }
Ejemplo n.º 4
0
        public override bool Run(FeatureContext context)
        {
            {
                ArrowWidget arrow = new ArrowWidget();
                context.ShowSceneNode(arrow);
                context.RenderView.FitAll();
                context.RequestDraw();
            }


            ElementId id = context.CurrentId;

            MessageBox.Show("Remove Node");

            SceneManager sceneMgr = context.RenderView.SceneManager;
            SceneNode    node     = sceneMgr.FindNode(id);

            if (node != null)
            {
                sceneMgr.RemoveNode(node);
            }

            return(true);
        }