コード例 #1
0
        public override bool Execute(UICommandContext ctx)
        {
            ctx.Document.Undo();
            ctx.RequestUpdate();

            return(true);
        }
コード例 #2
0
        public override bool Execute(UICommandContext ctx)
        {
            var dlg = new OpenFileDialog();

            dlg.Filter = "IGES Files(*.iges;*.igs)|*.iges;*.igs";
            if (dlg.ShowDialog() == DialogResult.OK)
            {
                var shape = IgesIO.Open(dlg.FileName);
                if (shape != null)
                {
                    var transaction = new UndoTransaction(ctx.Document);
                    transaction.Start(this.Name);

                    var shapeElement = new ShapeElement();
                    shapeElement.SetName(ImportStepCommand.ExtractName(dlg.SafeFileName));
                    ctx.Document.AddElement(shapeElement);
                    shapeElement.SetMaterialId(ctx.DefaultMaterialId);
                    shapeElement.SetShape(shape);
                    ctx.ShowElement(shapeElement);
                    transaction.Commit();

                    ctx.RequestUpdate();
                }
            }
            return(true);
        }
コード例 #3
0
        public void ResetDocument(Document doc)
        {
            mDocument = doc;
            mRootSceneNode.SetDocument(mDocument);
            mDbView = DbView.Cast(mDocument.FindElement(mDocument.GetActiveDbViewId()));

            mContext.RequestUpdate();
            mRenderCtrl.ZoomAll(0.8f);
        }
コード例 #4
0
        public override bool Execute(UICommandContext ctx)
        {
            var transaction = new UndoTransaction(ctx.Document);

            transaction.Start(this.Name);

            var element = SphereElementSchema.Create(ctx.Document);

            ctx.ShowElement(element);

            transaction.Commit();

            ctx.RequestUpdate();

            return(true);
        }
コード例 #5
0
ファイル: AddTagCommand.cs プロジェクト: lanicon/RapidCAX
        public override bool Execute(UICommandContext ctx)
        {
            //创建事务
            var transaction = new UndoTransaction(ctx.Document);

            transaction.Start(this.Name);

            var text = new MyTextElement();

            text.Text     = "这是一个好引擎!";
            text.Position = new Vector3(100, 100, 100);

            text.AddElement(ctx.Document);

            text.Show(ctx.RenderView.GetScene());


            //提交事务
            transaction.Commit();

            ctx.RequestUpdate();

            return(true);
        }
コード例 #6
0
        /// <summary>
        /// 换个文档显示
        /// </summary>
        /// <param name="doc"></param>
        public void ResetDocument(Document doc)
        {
            mDocument = doc;
            mRootSceneNode.SetDocument(mDocument);
            mDbView = DbView.Cast(mDocument.FindElement(mDocument.GetActiveDbViewId()));

            var table   = mDocument.FindTable("UserElement");
            var userIds = table.GetIds();
            var scene   = mContext.RenderView.GetScene();

            foreach (var id in userIds)
            {
                var element = mDocument.FindElement(id);
                if (MyTextElement.IsKindOf(element))
                {
                    var text = new MyTextElement();
                    text.Load(UserElement.Cast(element));
                    text.Show(scene);
                }
            }

            mContext.RequestUpdate();
            mRenderCtrl.ZoomAll(0.8f);
        }