Copying multiple axis to a part file
Copying multiple axis to a part file
(OP)
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 :)
regards
Alan
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 :)
regards
Alan





RE: Copying multiple axis to a part file
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.
regards,
LWolf
RE: Copying multiple axis to a part file
indocti discant et ament meminisse periti
RE: Copying multiple axis to a part file
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
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
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.
regards
Alan
RE: Copying multiple axis to a part file
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.
regards,
LWolf
RE: Copying multiple axis to a part file
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
regards,
LWolf
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.
regards
Alan
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
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
'sSel.Delete
'---set/get target for paste----
?
'----------------------
RE: Copying multiple axis to a part file
RE: Copying multiple axis to a part file
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.
cheers
Alan
RE: Copying multiple axis to a part file
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:
https://www.youtube.com/watch?v=BKMIsmYl598
And about multiple selection:
https://www.youtube.com/watch?v=LJ6ueJ1FLFQ
I can also make vide how to copy with link from one part to another
RE: Copying multiple axis to a part file
I'll take a look :)
regards
Alan