AnsweredAssumed Answered

C# Water mark not set on drawing when promoting using SolidWorks EPDM Api changestate3

Question asked by Vaibhav Nara on Sep 23, 2020

I have created a state called MIGRATED with Transition MIGRATION.In transition I have added settings to update variable Wasserzeichen(watermark) to value "targetstate with timestamp".

When I manually promote it from solidworksPDM a value is set to variable and as a result watermark is shown on drawing. But when promoting using EPDM Api this variable is not set and as a result watermark on drawing is not set. My code is:

 

 

IEdmFile13 aFile = (IEdmFile13)vault.GetObject(EdmObjectType.EdmObject_File, int.Parse(cadModel.Id));
var folderPos = aFile.GetFirstFolderPosition();
var folderId = -1;
var folder = (IEdmFolder5)default;
if (!folderPos.IsNull)
{
folder = aFile.GetNextFolder(folderPos);
folderId = folder.ID;
}
Console.WriteLine($" promoting > [{messageElements[1]}] folder {folderId} folder {folder.LocalPath}");
if (!aFile.CurrentState.Name.Equals("MIGRATED", StringComparison.InvariantCultureIgnoreCase))
{
aFile.ChangeState3("MIGRATED", "MIGRATION", folderId, "The file is Migrated.", 0, (int)EdmStateFlags.EdmState_Simple, "*******");
Console.WriteLine($" > [{aFile.GetLocalPath(folderId)}] file is promoted to Migrated in EPDM");
}

 

only difference in manual and code process is that : during manual transition both model and drawing are promoted at once but in code first Model is promoted to Migrated and after that Drawing. Can this be the issue? or something else?

 

Appreciate any help related to this issue

Outcomes