Hi Dojo,
Does someone has some sample code for assigning a visual to a view from in a script? I had a look in the Class Library but couldn't find a method/property on the IDmsView class.
Jens Vandewalle [SLC] [DevOps Enabler] Selected answer as best 24th April 2023
Hi Jens,
Response of Klaas should do it. I'll post a snippet from our RT manager framework, on behalf of completeness: how to create a Visio file + how to set active page on Visio file
private void CreateAndAssignVisioFile(IEngine engine, int viewId, string VisioFile) { if (CreateVisioFile(engine, $@"C:\\RTManager\\TestDependencies\{VisioFile}", VisioFile)) { var assignRequest = new AssignVisualToViewRequestMessage(viewId, VisioFile) { ActiveValue = "Active", Page = "1", }; // There is no way of knowing if this succeeded engine.SendSLNetSingleResponseMessage(assignRequest); } } private bool CreateVisioFile(IEngine engine, string filePath, string VisioFile) { CreateProtocolFileMessage createProtocolFileMessage = new CreateProtocolFileMessage { What = 7, Ba = new BA(System.IO.File.ReadAllBytes(filePath)), Sa = new SA(new string[1] { VisioFile }) }; CreateProtocolFileResponse createProtocolFileResponse = engine.SendSLNetSingleResponseMessage(createProtocolFileMessage) as CreateProtocolFileResponse; if (createProtocolFileResponse == null || createProtocolFileResponse.ErrorCode != 0) { engine.ExitFail("Could not upload visio file. " + ((createProtocolFileResponse == null) ? "response was null" : $"errocode was {createProtocolFileResponse.ErrorCode}")); return false; } return true; }
Matthias Declerck [SLC] [DevOps Enabler] Answered question 21st April 2023