×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

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

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

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

(OP)
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

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

(OP)
Hi Ferdo. Thank you for your answer.

But I'm sorry to not understand your reply.

Could you explain again with my script?

CODE --> VBScript

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" 

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

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

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

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

(OP)
Hi, Ferdo,

Thank you for your reply.

It works very well!!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources