×
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

Split selected items

Split selected items

Split selected items

(OP)
THis is waht I am doing to copy and paste bodies

Selection1 = Call obj1.SelectElement3(Array("HybridBody", "Body"), "SELECT BODIES & GEO SETS ", False, 2, True)
then I select more than 2 (say for example i.Body1 ii. Body2 )

selection1.Copy

‘when I paste

Call selection1.PasteSpecial("CATPrtResultWithOutLink") ‘ all bodies gets pasted at a time

‘WHAT I AM LOOKING DO IS THAT WHEN I PASTE

‘first i) Body1 to get pasted…….. ( Can I use some thing like Selection1.item(1) to get pasted)
‘After some operations

‘ii) Body2 to get pasted

How can I split items from array selected elements and paste when ever I require one ?

RE: Split selected items

Instead of copying, you need to store your selected items. You should always post the language you are working in too. You can do something like this:

In VBA you can store them in a collection:
Dim cInputs as new collection
oSelection.Clear
'Use your code to manually select elements
'Loop through selection object and add to collection
For i = 1 to to oSelection.count
cInputs.add oSelection.item(i).Value
Next
oSelection.add cInputs.Item(1)
oSelection.copy
oSelection.clear
'Paste first item
'Code to work on first pasted item

oSelection.add cInputs.Item(2)
oSelection.copy
oSelection.clear
'Paste second item
'Code to work on second pasted item

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@

If you are writing in vbscript you can add selected objects to an array:
Dim aInputs()
oSelection.Clear
'Use your code to manually select elements
'Loop through selection object and add to array
iSize = oSelection.count - 1
Redim aInputs(iSize)
For i = 1 to to oSelection.count
aInputs(i-1) = oSelection.Item(i).Value
Next
oSelection.add aInputs.Item(0)
oSelection.copy
oSelection.clear
'Paste first item
'Code to work on first pasted item

oSelection.add cInputs.Item(1)
oSelection.copy
oSelection.clear
'Paste second item
'Code to work on second pasted item

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