Skip to Content

How to checkout a model from repository via csharp?

Hi,
I want to connect to repository and checkout a PDM model into a variable in my c# script. How can I do that?

Let me give an example: I want to get the model "SA17Demo" under "MyFolder" in the repository.

1) When I use "FindChildByPath" method for the complete path to the model, m is null:

PdPDM.Model m = conn.FindChildByPath("MyFolder/SA17Demo", (int)PdPDM.PdPDM_Classes.cls_BasePhysicalModel) as PdPDM.Model;

2) When I use "FindChildByPath" method for the upper folder with foreach clause:

PdRMG.RepositoryFolder folder = conn.FindChildByPath("MyFolder", (int)PdRMG.PdRMG_Classes.cls_RepositoryFolder) as PdRMG.RepositoryFolder;

foreach (PdRMG.StoredObject childObject in folder.ChildObjects)
{
  if(childObject.Name.Equals("SA17Demo"))
  {
    // The following line gives error message "System.InvalidCastException";
    modelRep = (PdPDM.Model)childObject;
  }
}

Thanks,

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

0 Answers