双击 cui
//改变属性块的双击事件//将菜单文件中的双击改一下,退出时还原文件 acad.bak.cui 改这个名字 每次用这个更新为新的 acad.cui进行修改
//退出时再用 acad.bak.cui还原acad.cui
public static void ChangeCuiForDoubleChick(string cmd)
{
string cuiPath =
@"C:\Documents and Settings\Administrator\Application Data\Autodesk\AutoCAD 2007\R17.0\chs\Support\acad.cui";
Autodesk.AutoCAD.Customization.CustomizationSection cs = new CustomizationSection(cuiPath, "ACAD"); ;
string mgName = "HoulinboMenuGroups";//宏组
string mmName = "HoulinboDblblockMacro";//宏
string command = cmd; //对应属性块编辑查看宏命令
string dblclickEID = "ID_VFHoulinboForDoubleChick";
//菜单宏
MenuMacro oMenuMacro1 = cs.FindMenuMacro(mmName);
if (oMenuMacro1 == null)
{
//先自定义宏组
MacroGroup oMacroGroup = cs.MenuGroup.FindMacroGroup(mgName);
if (oMacroGroup == null)
oMacroGroup = new MacroGroup(mgName, cs.MenuGroup);
oMenuMacro1 = new MenuMacro(oMacroGroup, mmName, command, dblclickEID, MacroType.Any);
}
foreach (DoubleClickAction dc in cs.MenuGroup.DoubleClickActions)
{
if (dc.DxfName.Equals("ATTBLOCKREF"))
{
dc.DoubleClickCmd.MacroID = dblclickEID;
cs.SaveAs(cuiPath);
return;
}
}
}
页:
[1]