public override bool Execute(UICommandContext ctx) { ctx.Document.Undo(); ctx.RequestUpdate(); return(true); }
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); }
public void ResetDocument(Document doc) { mDocument = doc; mRootSceneNode.SetDocument(mDocument); mDbView = DbView.Cast(mDocument.FindElement(mDocument.GetActiveDbViewId())); mContext.RequestUpdate(); mRenderCtrl.ZoomAll(0.8f); }
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); }
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); }
/// <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); }