如何使 c# window 形式的 AutoCAD 插件和 AutoCAD 本身同时可用
how to make c# window form of AutoCAD plugin and AutoCAD itself available simultaneously
我已经为 AutoCAD 创建了一个基本插件。在我的插件中,一些任务是通过 c# windows 形式完成的。我的最终用户需要在 windows 表单打开时访问 autocad。当前,如果 c# windows 表单打开,则无法访问 AutoCAD。要使用 AutoCAD,用户必须先关闭表单。
有没有办法同时访问 autocad 和 windows 表单?
是的,您可以使用无模式表单:
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog
但它不是很直观,我建议使用一个托管用户控件的 PaletteSet。
Autodesk.AutoCAD.Windows.PaletteSet ps; // declare as a STATIC variable, avoid duplicate
ps.Add("Name here", userCtrl);
ps.Visible = true;
我更喜欢模态方式,在需要用户在绘图上select某些内容的按钮内,使用 EditorUserInteraction 对象
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
using (EditorUserInteraction userIt = ed.StartUserInteraction())
{
// this will close the form and go to the model space, once finished, the form gets back
}
我已经为 AutoCAD 创建了一个基本插件。在我的插件中,一些任务是通过 c# windows 形式完成的。我的最终用户需要在 windows 表单打开时访问 autocad。当前,如果 c# windows 表单打开,则无法访问 AutoCAD。要使用 AutoCAD,用户必须先关闭表单。
有没有办法同时访问 autocad 和 windows 表单?
是的,您可以使用无模式表单:
Autodesk.AutoCAD.ApplicationServices.Application.ShowModelessDialog
但它不是很直观,我建议使用一个托管用户控件的 PaletteSet。
Autodesk.AutoCAD.Windows.PaletteSet ps; // declare as a STATIC variable, avoid duplicate
ps.Add("Name here", userCtrl);
ps.Visible = true;
我更喜欢模态方式,在需要用户在绘图上select某些内容的按钮内,使用 EditorUserInteraction 对象
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
using (EditorUserInteraction userIt = ed.StartUserInteraction())
{
// this will close the form and go to the model space, once finished, the form gets back
}