cancel
Showing results for 
Search instead for 
Did you mean: 

Copy an Operation into specific location

Creator
Creator

Hello everyone,

 

Here i am with another question that need an answer. I have been looking for some time on how to copy a operation into a specific location in the operation tree. i know how to copy to the base level on the operationRoot, by using:

......
 TxObjectList operationsCopies = null;
 if (operartionRoot.CanPasteList(operationsToCopy))
      operationsCopies = operartionRoot.Paste(operationsToCopy);


// from https://community.plm.automation.siemens.com/t5/Tecnomatix-Developer-Forum/Copy-amp-manipulate-operation/m-p/349172/highlight/true#M19

But how to copy that operation into a specific location, lets say inside of a compound operation that is inside another compound operation(assuming that the operation can be copied)

Operation root
  Compund operation
    Compound operation
        .......
        .......
        .......
        Copy here

 

 

Thanks for your help.

3 REPLIES

Re: Copy an Operation into specific location

Siemens Legend Siemens Legend
Siemens Legend

Hi Lucas_SWE,

 

If your compound operation implements ITxOrderedObjectCollection interface, then after you copy the operation under the compound parent, you can use the MoveChildAfter method to reorder the children and put it at the right place.

 

Best Regards,

DianaG

Re: Copy an Operation into specific location

Creator
Creator

Thanks for your answer Diana. So what you propose is that i use that copying method that i suggested on top  and then use  ITxOrderedObjectCollection to move the child to where ever i need it.

 

What happens if the operation i am copying needs to be place in the first position? MoveChildAfter looks like doesnt allowed to copy on the first position, as you need to refer the position naming the previous operation and if you set it as null it will through back an exception.

 

Any ideas on how to copy in the first position? like this:

 

Operation root
  Compund operation
     ...........
    Generic operation
        .......
        .......
        .......
        operation to copy
        .......
    Generic operation
       Copy here(first position)
        .......
        .......
        .......
        .......

Re: Copy an Operation into specific location

Siemens Legend Siemens Legend
Siemens Legend

You need to set null for the prevChild parameter (the second parameter of MoveChildAfter method), then your operation will go on first place.

 

Best Regards,

DianaG