feat: drive Preview automation through AutoCAD script

This commit is contained in:
codex
2026-08-04 10:07:03 +03:00
parent 8a2ca2daa6
commit 115f44fcb9
3 changed files with 21 additions and 4 deletions
+8 -1
View File
@@ -16,7 +16,14 @@ public sealed class StartupScriptBuilder : IStartupScriptBuilder
{
public string BuildNetloadScript(string root, string entry)
{ var full = Path.GetFullPath(Path.Combine(root, entry)); if (!full.StartsWith(Path.GetFullPath(root) + Path.DirectorySeparatorChar, StringComparison.OrdinalIgnoreCase) || !File.Exists(full)) throw new InvalidOperationException("UNTRUSTED_ENTRY_PATH"); return $"_.NETLOAD\n\"{full.Replace("\"", "\\\"")}\"\n"; }
public string BuildAutomationScript(string root, string entry) => BuildNetloadScript(root, entry) + "PHP_REC_AUTOMATION_START\n";
public string BuildAutomationScript(string root, string entry, string fixtureOrthoDwg)
{
var fixture = Path.GetFullPath(fixtureOrthoDwg);
if (!File.Exists(fixture)) throw new InvalidOperationException("AUTOMATION_FIXTURE_NOT_FOUND");
var quote = (string value) => "\"" + value.Replace("\"", "\\\"") + "\"";
return "_.OPEN\n" + quote(fixture) + "\n" + BuildNetloadScript(root, entry) +
"PHP_REC_AUTOMATION_PREPARE\nPXP-OA\nPXP-OA\nPHP_REC_AUTOMATION_FINALIZE\n";
}
}
public sealed class DryRunAutodeskProcessLauncher : IAutodeskProcessLauncher
{