/// <Summary> /// Start the CAD of the Local Machine and browse the DWG diagram in the CAD. /// </Summary> /// <Param name = "path"> Cad.exe location </Param> /// <Param name = "dwgfile"> Full path of dwgfile </Param> Public Void Startcad2004 ( String Path, String Dwgfile) {PROCESS p = New Process (); p. startinfo. filename = Path; // Start CAD of the Local Machine P. startinfo. Arguments = Dwgfile ;//Set the DWG file to be opened by CADP. Start ();////Start CAD of the Local Machine} /// <Summary> /// Obtain the CAD path /// </Summary> /// <Param name = "path"> CAD location read from the Registry </Param> /// <Returns> </returns> Public Bool Getcadpath ( Out String Path) {path = "" ; Registrykey key_localmachine = Registry. localmachine; // Registrykey key_cad = key_localmachine.opensubkey ("Software \ Autodesk \ AutoCAD \ r16.2 \ ACAD-4001: 804 \", false ); // Cad2006 Registry address // Registrykey key_cad = key_localmachine.opensubkey ("Software \ Autodesk \ AutoCAD \ r16.0 \ ACAD-201: 804 \", false ); // Cad2004 Registry address // Any version of CAD is startedProgram /* This value features "EXE" "DWG file "* */ Registrykey key_cad = Key_localmachine.opensubkey ( " Software \ Classes \ applications \ acad.exe \ shell \ open \ command " , False ); If (Key_cad! =Null ){ String Cadpath = key_cad.getvalue ( "" ). Tostring (); // Get startup path Matchcollection MC = RegEx. Matches (cadpath, " \"(? <Cadpath> .*)\" " ); // Only the first acad.exe path is obtained. Cadpath = mc [ 0 ]. Groups [ " Cadpath " ]. Value; Path = Cadpath; Return True ;} Return False ;}