Cancel
Showing results for 
Search instead for 
Did you mean: 

Create EquipmentInsatnce from EquipmentPrototyxpe

Pioneer
Pioneer

Hi!

 

I need to create an EquipmentInsatnce in a Study using an specified over a parameter EquimpentPrototype Object. The EquipmentPrototype is specified as ITxPlaningObject.

I have tried to accomplish this task with InsertComponent method and specifying the Prototype property in the TxInsertComponentCreationData. But this works just for ToolPrototype, the specifying of EquipmentPrototype causes the internal application error.

 

Is there any way to accomplish this Task programmatically?

 

Thanks in advance,

Witalij.

9 REPLIES

Betreff: Create EquipmentInsatnce from EquipmentPrototyxpe

Legend
Legend

Hi,

I am not quite sure if I undestand correctly. Can you provide a code snippet please?

 

Betreff: Create EquipmentInsatnce from EquipmentPrototyxpe

Pioneer
Pioneer

Hi, Markus!

 

Something like this:

 

Dim prototype As Tecnomatix.Planning.ITxPlanningObject =

TxApplication.ActiveSelection.GetPlanningItems()(0)

Dim insertComponentData As New TxInsertComponentCreationData("newInstance", String.Empty)

 

insertComponentData.Prototype = prototype

Dim component As ITxComponent = TxApplication.ActiveDocument.PhysicalRoot.InsertComponent(insertComponentData)

 

If I have selected in the Navigation Tree a ToolPrortype, that was loaded in the study, the code works fine. If I have selected an EquipmentPrototype - it fails.

It also fails if the selected ToolPrototype was not loaded in the study.

Is there any way to do this?  

Betreff: Create EquipmentInsatnce from EquipmentPrototyxpe

Legend
Legend

Hi!

To be honest I really don't know what you want to achieve.

Of course the code fails if the equipment is not loaded in the study because there is nothing to insert.

What error messages does the debugger give you if you try this code on an equipment?

I create an equipment instance with this code

private TxComponent ep;
private TxPhysicalRoot root;

private void createEquipmentPrototypeInstance()
{
    try
    {
        TxLocalComponentCreationData equipmentPrototypeCreationData = new TxLocalComponentCreationData("EpInstance");
        ep = root.CreateEquipment(equipmentPrototypeCreationData);
    }
    catch (TxInvalidObjectException ex)
    {
        //Error handling
    }
}

Betreff: Create EquipmentInsatnce from EquipmentPrototyxpe

Pioneer
Pioneer

Markus,

 

I want to be able to provide GUI, that helps maintain the resources tree according to requirements of OEM and our internal standards. This includes not just maintaining the structure in the resource tree, but also creation of required frames in the study, that is used for process simulation. The requirement to create frames can be fulfilled just in the study.

Therefore, is the question how to get an equipment prototype, e.g. for a fixture or a robot with cables and pipes, from the library and create an instance of it in the active study.

There is one additional requirement: the study is quite large and the loading it takes up to 5 minutes. Therefore, it is not possible to adjust the structure data over EMServer and then load the study.

You code will create a new equipment prototype without any relation to the library.

 

Best regards,

Witalij

Betreff: Create EquipmentInsatnce from EquipmentPrototyxpe

Legend
Legend

TxInsertComponentCreationData requires a name of the instance and the path in the filesystem.

In your code snippet the path variable is empty. So how should PS know from where to load the component in the library. What happens if you provide a valid library path to the equipment?

Betreff: Create EquipmentInsatnce from EquipmentPrototyxpe

Pioneer
Pioneer

PS can get this data from the EquipmentPrototype specified via Prototype property. EMServer has all necessary data about underlying cojt and all children, including underlying children cojts.

Betreff: Create EquipmentInsatnce from EquipmentPrototyxpe

Siemens Creator Siemens Creator
Siemens Creator

Hi Witalij,

 

Which Process Simulate version do you use?

The code that you wrote should work since version 14.0.

 

Since 14.0 version InsertComponent function we added support for EquipmentPrototype.

 

Thanks,

AdiAvron

Betreff: Create EquipmentInsatnce from EquipmentPrototyxpe

Pioneer
Pioneer

Hello AdiAvron,

 

if i try to load an equipment prototype into a standalone study, i'll get an "Error in the Application" Exception.

Is there a special method to load the EP without that Error?

 

Snippet i've used:

static private ITxComponent loadToStudy2(string path)

{

TxInsertComponentCreationData insertData = new TxInsertComponentCreationData("test", path);

ITxComponent comp = TxApplication.ActiveDocument.PhysicalRoot.InsertComponent(insertData);

return comp;

 

}

 

best reards

Betreff: Create EquipmentInsatnce from EquipmentPrototyxpe

Pioneer
Pioneer

Hi, AdiAvron.

 

I use PS 13.0.1 - the last from Volkswagen accepted version.

I thought this question has died... Sory for a delay.

 

Best regards

Witalij