Secondary Development of CAD and Secondary Development of cad
The Secondary Development of CAD can be implemented by writing extended DLL. The DLL function can be called by CAD.
However, you must use the netload command to load the dll to CAD before calling.
You can modify the Registry. When the CAD software is started, the extended DLL is automatically loaded.
To this end, I wrote a function to easily modify the Registry to automatically load the dll!
This function supports various versions of cad.
1 // strCadRegKey = "HLD_CAD_Import"; // unique registration ID available company name and program name 2 // strDll file path 3 private bool WriteRegistryKey (string strDll, string strCadRegKey) 4 {5 try 6 {7 RegistryKey localMachine = Registry. localMachine; 8 RegistryKey SOFTWARE = localMachine. openSubKey ("SOFTWARE", true); 9 RegistryKey Autodesk = SOFTWARE. openSubKey ("Autodesk", true); 10 RegistryKey AutoCAD = Autodesk. openSubKey ("AutoCAD", true ); 11 12 int result = 0; 13 foreach (string subDir in GetRegSubDir (AutoCAD, "R") 14 {15 try16 {17 RegistryKey CadVersion = AutoCAD. openSubKey (subDir, true); 18 19 string AcadVersion = GetRegSubDir (CadVersion, "ACAD -"). firstOrDefault (); 20 RegistryKey ACAD = CadVersion. openSubKey (AcadVersion, true); 21 22 RegistryKey Applications = ACAD. openSubKey ("Applications", true); 23 24 // Delete the old record 25 try26 {27 Applica Tions. deleteSubKeyTree (strCadRegKey); 28} 29 catch (Exception ex) 30 {} 31 32 RegistryKey MXCAD = Applications. createSubKey (strCadRegKey); 33 MXCAD. setValue ("LOADCTRLS", 0x02); 34 MXCAD. setValue ("LOADER", strDll); 35 MXCAD. setValue ("MANAGED", 0x01); 36 result ++; 37} 38 catch (Exception ex) 39 {40 if (showMessage) 41 System. windows. forms. messageBox. show (string. format ("error during registration! {0} ", ex. message); 42} 43} 44 45 if (result> 0 & showMessage) 46 System. windows. forms. messageBox. show (string. format ("registration successful! "); 47 return true; 48} 49 catch (Exception ex) 50 {51 52 return false; 53} 54}
Technical contact qq 13712486