cancel
Showing results for 
Search instead for 
Did you mean: 

how to get cojt folder path in the OLP code?

Creator
Creator

Hi all:

   I want add a version information file in the cojt folder while inserting component.

1.png

2.png

 

But, I donot know how to  find the cojt folder in the code.

 

I think the class Tecnomatix.Engineering.TxLibraryStorage may be work, as show:

 

    public sealed class TxLibraryStorage : TxStorage
    {
        public string FullPath { get; }
        public bool HasDetailedRepresentation { get; }
        [Obsolete("For getting component path use the new FullPath property")]
        public TxLibraryData LibraryData { get; }

        public TxLocalStorage CopyToLocal();
        public void Reload(TxRepresentationLevel representationType);
    }

 

But I dont know wether this class is I need, and also dont how to use this class!

Can somebody give me some tips?

thank you ! 

3 REPLIES

Betreff: how to get cojt folder path in the OLP code?

Legend
Legend

Hi,

what do you mean with OLP code?

 

With API you can use the Full path property of TxLibraryStorage.

Have a look to the Tecnomatix Developer Forum Smiley Wink

Betreff: how to get cojt folder path in the OLP code?

Creator
Creator

MarkusH wrote:

Hi,

what do you mean with OLP code?

 

With API you can use the Full path property of TxLibraryStorage.

Have a look to the Tecnomatix Developer Forum Smiley Wink


Thx for your reply!

 

OLP is one module of tecomatix. 

 

I found the TxLibraryStorage API , but I dont know how to use?

 

I also find a post on another question, as :

 

ITxObject obj = TxApplication.ActiveSelection.GetItems()[0];
ITxStorable storableObj = obj as ITxStorable;

if (storableObj != null)
{
    TxLibraryStorage libraryStorageObject = storableObj.StorageObject as TxLibraryStorage;
    if ((libraryStorageObject != null) && libraryStorageObject.HasDetailedRepresentation)
    {
        try
        {
            if ((obj as ITxComponent).RepresentationType == TxRepresentationType.United)//if the representation type is Detailed, then it is already in entity level.
            {
                libraryStorageObject.Reload(TxRepresentationLevel.Detailed);
            }
        }
        catch (Exception e)
        {
            ...
        }
    }
}

 

But I got  storableObj is null. 

Betreff: how to get cojt folder path in the OLP code?

Siemens Phenom Siemens Phenom
Siemens Phenom

I'm not good in C#, but how about this:

 

private string GetObjectsCojtPath(ITxObject obj)
{
   TxLibraryStorage stor = obj.StorageObject as TxLibraryStorage;
   if (stor != null)

   {
      if (stor.FullPath != null)
      return stor.FullPath;
   }
return "";
}