cancel
Showing results for 
Search instead for 
Did you mean: 

Moving Tecnomatix information and exporting to Teamcenter

Siemens Pioneer Siemens Pioneer
Siemens Pioneer

Question:

 

I am working towards a solution of taking existing information from Tecnomatix and exporting it to our TeamCenter.

 

I am able to access the information needed from Process Designer, but the operation takes a long time, and in order to get the information that I need, the objects need to be selected from the viewer.

 

For instance,

I am trying to acquire the information from the field "web3DFile". I'm finding I have two ways of doing it.

  1. Retrieve the planning object  to retrieve web3DFile, then I have to do the same from that object to get "file", and then "fileName".
  2. attach to the FieldSet event and then parse from there.

 

I would assume that there is a much easier way to retrieve all of this information because the operation for this takes a long time, and I would just like to query the database for the information needed, and I’m performing a read only operation and not attempting to manipulate any of the data.

 

 

Answer:

 

assuming that a study is loaded, the objects may not be necessarily selected in the Product or Resources Viewer.

 

Example, take all loaded components in the study:

TxObjectList children = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(new TxTypeFilter(typeof(ITxComponent)));

This will return all direct children of the cell, which appear in the Object Tree, Product Tree, Resource Tree and MFG Viewer. The GetDirectDescendants and GetAllDescendants take a parameter of type ITxTypeFilter. So the user can query objects of specific type using that methods.

 

  1. To access attributes values of objects, it is better first to import that values in the cache as attributes are cached on demand. This way all necessary field values will be imported with one call to the server.
  2. After the attributes are cached, there is a traversal mechanism that takes a path of reference properties.

 

Example that takes the file name of the 3D file of the prototype.

//local members of a class

  TxEmsTraversalManager traversalManager = new TxEmsTraversalManager();
    TxEmsCacheManager cacheManger = new TxEmsCacheManager();
    public object GetValue()
    {
        object value = null;
        TxObjectList children = TxApplication.ActiveDocument.PhysicalRoot.GetAllDescendants(new TxTypeFilter(typeof(ITxComponent)));
        TxObjectList planingList = children.PlanningRepresentations;
        if (planingList.Count > 0)
        {
            //you can check if the planning type is of specific eMS type
            ITxPlanningObject planning = planingList[0] as ITxPlanningObject;
            cacheManger.Clear();
            cacheManger["test"].SetRootObject(planning);
            cacheManger["test"].SetPath("prototype", "threeDRep", "file");
            cacheManger["test"].SetAttributes("fileName");

            traversalManager["test"].SetRootObject(planning);
            traversalManager["test"].SetPath("prototype", "threeDRep", "file");//threeDRep, web3DFile
            traversalManager["test"].SetAttributes("fileName");
            try
            {
                cacheManger.CacheData();
                traversalManager.Traverse();
            }
            catch
            {
                ...
            }

            if (traversalManager["test"].Traversed)
            {
                TxEmsTraversalObjectResultData data = traversalManager["test"].GetTraversalObjectData(planning);
                ArrayList results = data.GetAttributeValues("fileName");
                value = results[0];
            }
        }
        return value;