Starting from Tecnomatix V13.0.2, Tecnomatix .NET API provides new methods to create a TuneData.xml under a .cojt folder.
Here is an example that creates a new component with 3D, saves it to a valid .cojt and then imports it in the study.
//1. Create a local component TxLocalComponentCreationData creationData = new TxLocalComponentCreationData("comp1", new TxTransformation()); TxComponent comp1 = TxApplication.ActiveDocument.PhysicalRoot.CreateLocalComponent(creationData); //2. Add geometry TxBoxCreationData boxData = new TxBoxCreationData("box1", new TxTransformation(), new TxVector(500, 500, 500)); comp1.CreateSolidBox(boxData); //3. Save it to .cojt string compFileName = "comp1.cojt"; TxLocalStorage localStorage = comp1.StorageObject as TxLocalStorage; localStorage.SaveToLibrary(new TxLibraryData(TxApplication.SystemRootDirectory, compFileName)); comp1.Delete(); //4. Create prototype data file string path = TxApplication.SystemRootDirectoryNormalized + compFileName; TxTunePmDocumentManager pmDocManager = new TxTunePmDocumentManager(); TxTunePmDocumentPrototypeData data = pmDocManager.CreatePrototypeData("PmToolPrototype"); pmDocManager.SavePrototypeDataToDocument(path, data); //5. Import the new component TxInsertComponentCreationData insertData = new TxInsertComponentCreationData("comp1", path); ITxComponent comp = TxApplication.ActiveDocument.PhysicalRoot.InsertComponent(insertData);
what is the ressource for
TxTunePmDocumentManager and TxTunePmDocumentPrototypeData
I don't find any information about that on the .net help.
They are both from Tecnomatix.Engineering.dll.
The namespace of TxTunePmDocumentManager is Tecnomatix.Engineering.Utilities and the namespace of TxTunePmDocumentPrototypeData is Tecnomatix.Engineering.DataTypes.
These classes are avalable as of Tecnomatix V13.0.2
Is it possible to dave a compound part using the method? We need to create compound parts or compound resources from individual JTs. Do you happen to have a sample code for that? Any caveats?
We have a manual procedure for creation of equipment prototypes (for example dressed robots, complex fixtures, etc.).
We need to automate the procedure. Parts to assembly the equipment prototypes are either .cojt or jt files. At this point it is mostly JT files.
To create an equipment use that code:
//1. Create the equipment TxPhysicalRoot root = TxApplication.ActiveDocument.PhysicalRoot; TxLocalComponentCreationData epData = new TxLocalComponentCreationData("equipment1"); TxComponent eq = root.CreateEquipment(epData); //2. Copy/Paste components under the equipment - components can be created as described in the example or if they are .cojt, you need to only insert them //3. If needed create kinematics for the equipment using the ITxKinematicsModellable interface that is implemented by TxComponent //4. End modeling the equipment eq.EndModeling(eqPath);
We are still using version 12.1 and:
TxComponent eq = root.CreateEquipment(epData); -- no such method
eq.EndModeling(eqPath); -- no such method
the minimum version is 12.1.1
Look in the .Net helpfile:
The following items are new in version 12.1.1:
The ability to set a selected component as modeling scope was added to ITxComponent .
The ability to end modeling and store a modeled object was added to ITxComponent .
The ability to create equipment was added to TxPhysicalRoot and TxComponent .