Prototype name (name of *.co or *.cojt): kr2210l150_2
The resource name is the instance name, isn't it?
I tried something with Tecnomatix.Planning, but it obviously doesn't work in offline.
Maybe there is an approach with the library path, or with Manipulator type.
This is how to get it on eMS:
// get prototype ITxPlanningObject oRobotProto = TxRobot.PlanningRepresentation.GetField("prototype") as ITxPlanningObject; if (oRobotProto == null) return null; // get 3D representation ITxPlanningObject r3d = oRobotProto.GetField("threeDRep") as ITxPlanningObject; if (r3d == null) return null; // get 3D file ITxPlanningObject pmFile = r3d.GetField("file") as ITxPlanningObject; if (pmFile == null) return null; string sPrototypeFile = pmFile.GetField("fileName") as string; // combine it with SYSROOT sPrototypeFile = sPrototypeFile.TrimStart('#', '\\', '/'); return Path.Combine(TxApplication.SystemRootDirectory, sPrototypeFile);
I do not know if there is a solution in Disconnected mode or on TeamCenter.
i saw this solution, but for me in disconnected mode it is not working !
When my app comes to
ITxPlanningObject r3d = value.GetField("threeDRep") as ITxPlanningObject;
it crashes with error :
Tecnomatix.Engineering.TxPlanningObjectFieldNotLoadedException: error in application.
at Tecnomatix.Engineering.Implementation.TxRose.PlanningObjectGetField(TxPlanningObjectImpl assignment, String fieldName)
at Tecnomatix.Planning.TxPlanningObject.GetField(String fieldName)
so my question is, maybe in PS 11.1 there is a new name for "threeDRep" ?
or how could i get a list of fieldNames in GetField method ?
when i try GetFields method with a string array, PS crashed completly !
Thanks in advance
Thanks for your answer,
your solution works good with connected to database.
OK, now i have a new way to get that information i want, but i need the path and name of the .psz file, that is actually opened in process simulate disconnected.
Do you know a way to get that over the api ?
Thanks in advance
you can get the path with
string systemroot = Tecnomatix.Engineering.TxApplication.SystemRootDirectory;
and the studyname with
string studyname = TxApplication.ActiveDocument.CurrentStudy.Name;
some other strings
string platform = TxApplication.PlatformType.ToString();
string physicalroot = TxApplication.ActiveDocument.PhysicalRoot.Name;
string logicalroot = TxApplication.ActiveDocument.LogicalRoot.Name;
Thank you for your answer,
but that is not what i am looking for.
TxApplication.ActiveDocument.CurrentStudy.Name (or .caption) is only the internal name shown in PS, but not the name of the study.psz file.
Tecnomatix.Engineering.TxApplication.SystemRootDirectory is just the system root, where you put the components and has nothing to do with the study file itself.
I see it is just another thing, only possible in Online Mode and not in Disconnected !
OK the name of the study i can get with Getwindowtext (Win api function call), but for the path to the file i have to search and that is not what i want, because some of our collegues are in huge networks and that would cause a lot of traffic !
I don't understand, why my simple tasks are such a problem, because PS should give me that information also in offline mode !
Everything i need is in the psz file ! (and now i just need the path to that)
Just when i look the documentation and find something, i get only a access violation or SoD and have to look another way !
So i keep on searching ...
Wish you all merry christmas !!!!
Enjoy your time with family