fix: activate fixture project in script preparation
This commit is contained in:
@@ -2,6 +2,8 @@ using System.Text.Json;
|
||||
using Autodesk.AutoCAD.ApplicationServices;
|
||||
using Autodesk.AutoCAD.DatabaseServices;
|
||||
using Autodesk.AutoCAD.Runtime;
|
||||
using Autodesk.ProcessPower.PlantInstance;
|
||||
using Autodesk.ProcessPower.ProjectManager;
|
||||
using AcadApplication = Autodesk.AutoCAD.ApplicationServices.Application;
|
||||
|
||||
namespace PRecAnnot.Plant3D2026;
|
||||
@@ -36,6 +38,10 @@ internal static class ScriptDrivenFirstApplyAutomation
|
||||
fixture.CommandEnded += OnEnded;
|
||||
fixture.CommandFailed += OnFailed;
|
||||
fixture.CommandCancelled += OnCancelled;
|
||||
var projectXml = Path.Combine(Path.GetDirectoryName(config.FixtureMarkerPath)!, "Project.xml");
|
||||
if (!File.Exists(projectXml)) throw new InvalidOperationException("AUTOMATION_PROJECT_XML_MISSING");
|
||||
var project = PlantProject.LoadProject(projectXml, false, string.Empty, string.Empty);
|
||||
PlantApplication.SetCurrentProject(project, true);
|
||||
var context = new PlantRuntimeContextReader().ReadCurrentContext(fixture);
|
||||
if (!context.HasPlantProject || !context.IsOrthoDrawing || context.Viewports.Count != 1)
|
||||
throw new InvalidOperationException("AUTOMATION_ORTHO_CONTEXT_INVALID");
|
||||
|
||||
Reference in New Issue
Block a user