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!

Copy & paste macro

Status
Not open for further replies.

Alan Lowbands

Aerospace
May 17, 2017
274
GB
Hi Gents,
I was looking at this bit of code before Christmas and couldn't get it working.
I have found the 'PasteSpecial("CATPrtResult")' command that seems to paste the axis systems into the last selected part.
What it wont do is copy all the axis systems from any multiple instance parts.

ie.

top product
one.catpart
two.catpat
two.catpar
three.catpart
three.catpart
three.catpart
copied axis part.catpart

The last part has a copy of the last instance only.

Can anyone tell me what I'm missing please. (code below)
regards
Alan
---------------------------------------------------------------------------

Dim sSel 'As Selection
Set sSel = CATIA.ActiveDocument.Selection
sSel.Search "CATGmoSearch.AxisSystem,sel"
icount = sSel.Count
MsgBox icount

Dim i 'As Integer
For i = 1 To sSel.Count
sSel.Item(i).Value.Name = sSel.Item(i).Value.Name&i

sSel.Copy()

sSel.PasteSpecial("CATPrtResult")
sSel.Clear
Next
End sub
-------------------------------------------------------------




































Sub CATMain()

Dim sSel 'As Selection
Set sSel = CATIA.ActiveDocument.Selection
sSel.Search "CATGmoSearch.AxisSystem,sel"
icount = sSel.Count
MsgBox icount
Dim i 'As Integer
For i = 1 To sSel.Count
sSel.Item(i).Value.Name = sSel.Item(i).Value.Name&i
sSel.Copy()
sSel.PasteSpecial("CATPrtResult")
sSel.Clear
Next
End sub



'----------------------
 
Replies continue below

Recommended for you

Here are the results of running the code.
Thought it might help to show.

Results_gesshp.jpg
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top