When I load the cui file,CAD pop an error that can not find the file.
I am searching for a long time on net. But no use.Please help me.
Document doc = Application.DocumentManager.MdiActiveDocument;
object oldCmdEcho = Application.GetSystemVariable("CMDECHO");
object oldFileDia = Application.GetSystemVariable("FILEDIA");
Application.SetSystemVariable("CMDECHO", 0);
Application.SetSystemVariable("FILEDIA", 0);
doc.SendStringToExecute("_.cuiload " + cuiFile + " ", false, false, false);
doc.SendStringToExecute("(setvar \"FILEDIA\" " + oldFileDia.ToString() + ")(princ) ", false, false, false);
doc.SendStringToExecute("(setvar \"CMDECHO\" " + oldCmdEcho.ToString() + ")(princ) ", false, false, false);
Ive tried multiple variations of this, but none of them seem to work. Any ideas? Please comment to help me.
At the moment, if the filename cuiFile
includes spaces, then the string passed to doc.SendStringToExecute
probably isn't treating your filename as a single string. So just like you have with the setvar
calls, wrap the filename in quotes:
doc.SendStringToExecute("_.cuiload \"" + cuiFile + "\" ", false, false, false);
This should result in the filename being passed as a single string, something like : _.cuiload "C:\\Program Files\\srctrunk\\srcTrunk\\srcTrunk\\Debug32\\TX_Menu.cuix"