Not applicable
01-17-2020
11:30 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello,
I've been trying to create a script that opens a dwg file, performs the flatten command, and saves a copy of the file with "_TOP" appended to the original file name. Right now I am just trying to get one file to work. I can get a file to open but cannot seem to call the flatten command before lDoc.Save(); I know from some research that SendStringToExecute runs async to the given process, but is there a way to force to to run synchronously with other functions?
Any help would be appreciated, thank you!
var lFileName = "C:\\Users\\KDhyne\\Desktop\\DWG Testing\\4821410SA2.dwg" var lNewName = $"{Path.GetFileNameWithoutExtension(lFilePath)}_TOP.dwg"; var lDoc = ACAD.DocumentManager.Open(lFileName, false); using (DocumentLock docLock = lDoc.LockDocument()) { lDoc.SendStringToExecute("zoom all ", true, false, true); Common.ExecuteString("flatten all Y ", true, false, true); }
lDoc.CloseAndSave(lNewName);
Solved! Go to Solution.