Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

(VBScript)Copy & Paste Special Problem from Another Part Bodies

Status
Not open for further replies.

tpalsl125

Automotive
Apr 24, 2015
44
DE
Hello, All

I made the script to copy & paste special a body. It works very good only in same part.

I'd like to do from another part bodies.

Also I have no idea this : "Selected element(s) not allowed for this operation.".

Could you explain me what is wrong?

I recorded my problem and uploaded on Youtube.

Link to Youtube

1111_tfb5mr.jpg
 
Replies continue below

Recommended for you

Hi Ferdo. Thank you for your answer.

But I'm sorry to not understand your reply.

Could you explain again with my script?
Code:
Dim InputObjectType(0)
Dim InputDocType(0)
Dim ActDocSel

Set ActiveDoc = CATIA.ActiveDocument
Set ActDocSel = ActiveDoc.Selection

ActDocSel.Clear
InputObjectType(0)= "Body"
Status = ActDocSel.SelectElement2(InputObjectType, "Select a Body.", True)
  If (Status = "Cancel") or (Status = "Undo") then Exit Sub

ActDocSel.Copy

InputDocType(0) = "Part"
Result = ActDocSel.SelectElement2(InputDocType, "Select a CATPart.", True)
  If (Status = "Cancel") or (Status = "Undo") then Exit Sub
Set SelectedPart = ActDocSel.Item(1).Value

Set WorkDoc = CATIA.Documents.Item(SelectedPart.name+".CATPart")

'ActDocSel.PasteSpecial "CATPrtResult"
ActDocSel.PasteSpecial "CATPrtResultWithOutLink"
 
Hi,

You have to activate the target CATPart, after copying your body....


Set partDocument1 = documents1.Item("The_name_of_your_target.CATPart")

Dim editPart
Set editPart = partDocument1

CATIA.StartWorkbench("PrtCfg")
editPart.Activate()' '''''make the part active (highlight blue colour)

selection1.PasteSpecial "CATPrtResult" ' ----- Perform Paste As Result With Link


Regards
Fernando

- Romania
- EU
 
Hi, Ferdo,

Thank you for your reply.

It works very well!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Top