//选择csv导入信息
[CommandMethod("setdata")]
//本程序在AutoCAD的快捷命令是"DLLLOAD"
public void setdata()
{
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.DefaultExt = ".csv";
// Display OpenFileDialog by calling ShowDialog method
Nullable<bool> result = dlg.ShowDialog();
//判断确认按钮
if (result == true)
{
//选择的文件路径
string file_dir = dlg.FileName;
}
}
使用Microsoft.Win32.OpenFileDialog注意需要引用 PresentationFramework.dll控件
[CommandMethod("setdata")]
public void SetData()
{
// 选择CSV文件
Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
dlg.DefaultExt = ".csv";
Nullable<bool> result = dlg.ShowDialog();
if (result != true)
return;
// 获取当前文档和数据库
Document doc = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument;
Database db = d

最低0.47元/天 解锁文章
1455

被折叠的 条评论
为什么被折叠?



