Cancel
Showing results for 
Search instead for 
Did you mean: 

How to relocate and copy an existing object?

Creator
Creator

Hello, 

 

Is there a way to relocate an object, and at the same time create an exact copy the object (a kinematic device for example) using the .net API?

 

Thanks

Jinglin

1 REPLY

Re: How to relocate and copy an existing object?

Phenom
Phenom

Hello @Jinglin

 

You can relocate objects by changing the AbsoluteLocation property of the object. For example: If you want to relocate obj1 to obj2, you can do it as follow:

 

 

TxTransformation transformation = obj2.AbsoluteLocation;
obj1.AbsoluteLocation = transformation;

 

And to paste an object, you'll need to implement an ITxObjectCollection to only then paste the object in it. The object to be paste needs to be inside a TxObjectList. For example, paste a location "loc" inside an operation "op":

 

private void CopyLocationInOp(TxObjectList loc, TxWeldOperation op)
        {
            ITxObjectCollection newOp = op as ITxObjectCollection;
            newOp.Paste(loc);
        }