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


Copying multiple axis to a part file

Copying multiple axis to a part file

Copying multiple axis to a part file

Hi Gents,
I'm trying to find a way to copy the axis systems from each of the parts in a product and put them in a single part file and rename each with the instance name.
I haven't had a go at any batch macro's yet so any pointer would be a big help.
I'm not even sure this can be done so don't laugh :)


RE: Copying multiple axis to a part file

IMHO it is possible-you should probably deal with the parts recursively (Generally speaking you don't know the depth of your product structure).
Even your Axis systems do not necessarily exist in the AxisSystems node, but I guess a search within a part will do. Appending an instance name after copy-paste shouldn't be a problem.


RE: Copying multiple axis to a part file

instead of the axis you might want to consider the position of the instance... depends what you need. Absolute Axis in V5 or V6/3DX is not like V4 absolute axis (which was at (0,0,0) and could not be moved).

Eric N.
indocti discant et ament meminisse periti

RE: Copying multiple axis to a part file

I have to take the axis from each part (and instance) and copy them to a 'Skeleton' part in the product. Each axis has to be named as the instance.
Products inside that product would be positioned on the Absolute axis so don't need to be added.
It's just a pain when you have a load of parts & fasteners that need to be added.
I'll start with creating a new part and then look at what I can find in the portable script center or the net.

cheers guys

RE: Copying multiple axis to a part file

This is so far beyond my abilities lol
If any of you guys have something along those lines that I could try and modify I would be grateful.
I'm trying to mod the instance rename code from PS Center but getting nowhere

RE: Copying multiple axis to a part file

I've spent a while on this and realise I don't understand enough to do it.
In other words I have gotten nowhere.
Does anyone have something that explains how the code would work through the part files.
I'm not asking for anyone to write the code for me, just to give me a nudge in the right direction.


RE: Copying multiple axis to a part file

I'd start by managing to copy ALL axis systems (if they only reside in the Axis Systems node, then you can access them directly (Part.AxisSystems), but if some of them are in GeoSets, then you need to "selection.search" for those--just as you would do with Ctrl+F functionality in CATIA ('Generative Shape Design'.'Axis System';all)) from one part to a new one (Paste Special as Result).
Once you have this working, I'd try to understand how to retrieve a part's instance name.
And then how to loop through all parts of the assembly--independent on how many nested sub assys there are, i.e recursively.


RE: Copying multiple axis to a part file

Thanks LWolf,
All the Axis systems are in the Axis system nodes.
I was hoping to use a loop to run through each part in the product.
on each loop it would copy the axis system to "File-1", rename the axis system with the part instance name then got to the next part and loop the code again.
I'm probably being naïve thinking it could be that simple.

RE: Copying multiple axis to a part file

yupp, that's what I've outlined in my previous post, albeit a little bit closer to the actual script :)


RE: Copying multiple axis to a part file


I have found this code that selects all the axis systems. I have also used the same code to count the selected parts so I can check there is only one axis in each part.
After that I'm stuck lol
I'm assuming that this code would allow me to copy the axis systems one at a time into another part but how? I've been searching the net all day and got nowhere.
Probably because I don't know what i'm actually looking for.
Could someone please give me a pointer.


Dim objSel 'As Selection
Set objSel =CATIA.ActiveDocument.Selection
objSel.Search ("CATGmoSearch.AxisSystem,sel")
objcount = objSel.count

Dim i 'As Integer

For i = 1 to objSel.Count
objSel.Item(i).Value.Name = objSel.Item(i).Value.Name&i

Next i

RE: Copying multiple axis to a part file

I give up lol

RE: Copying multiple axis to a part file

I've been playing around with the code below and actually got the axis systems to be deleted.
I couldn't figure out how the selection worked but this seems too.
What I can't figure is how to point the paste option to a target file?
I have tried recording it but the resulting code dosen't seem to work.
I have also just got the course from Emmet Ross but need the time to do it properly.
So if someone could help it would be appreciated.

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

'---set/get target for paste----



RE: Copying multiple axis to a part file

Those Axis in parts does they have same name or different?

RE: Copying multiple axis to a part file

They are all in named parts but are all called absolute axis system.
When copied to the collector part they will be renamed with the part name. (or part of the part name).
The collector will be called Skel.1 and I will be creating that manually. The code above seems to work ok deleting the files so I was hoping it would do the same copying. I just cant sus out how to point the copy to the Skel file.
There doesn't seem much info on how you point to files or directories when doing macros.
That's probably because its basic and second nature to you guys.


RE: Copying multiple axis to a part file

I m not sure only if u copy those Axis are they gonna be in the absolute axis system
or in the place where part is, because you constraint it, i must check it.

What you want to do is to select first this skeleton part, then lets say you choose one
assemble and select all part from that assembly, you mast Use array to store this parts
and you must use For loop, and this Array will control the loop. In the array you have
all information which u need for rename those Axis.

For the beginning try to make macro which will copy Axis system from one part to another, if
you do it right just array now and for loop and u solve it.

Here is video about single selection:

And about multiple selection:

I can also make vide how to copy with link from one part to another

RE: Copying multiple axis to a part file

thanks for the reply.
I'll take a look :)


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!


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close