- UID
- 14
- 积分
- 8264
- 精华
- 贡献
-
- 威望
-
- 活跃度
-
- D豆
-
- 在线时间
- 小时
- 注册时间
- 2002-1-4
- 最后登录
- 1970-1-1
|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
×
Modifying AutoCAD support Path through .NETBy Virupaksha Aithal
You can use AutoCAD ActiveX API to manipulate the AutoCAD support path. Refer below code. As usual below code uses late binding technique while accessing ActiveX API.
- [CommandMethod("AddSupportPath")]
- static public void AddSupportPath()
- {
- object acadObject = Application.AcadApplication;
- object preferences =
- acadObject.GetType().InvokeMember("Preferences",
- BindingFlags.GetProperty,
- null, acadObject, null);
- //get the files
- object files =
- preferences.GetType().InvokeMember("Files",
- BindingFlags.GetProperty,
- null, preferences, null);
- //get the support path SupportPath
- string supportPath =
- (string)files.GetType().InvokeMember("SupportPath",
- BindingFlags.GetProperty,
- null, files, null);
- Document doc = Application.DocumentManager.MdiActiveDocument;
- Editor ed = doc.Editor;
- if (!supportPath.Contains("C:\\BatchPublish"))
- {
- supportPath = supportPath + ";" + "C:\\BatchPublish";
- object[] dataArry = new object[1];
- dataArry[0] = supportPath;
- files.GetType().InvokeMember("SupportPath",
- BindingFlags.SetProperty,
- null, files, dataArry);
- ed.WriteMessage(supportPath + "\n");
- }
- else
- {
- ed.WriteMessage("Support path already present\n");
- }
- }
|
评分
-
查看全部评分
|