CATIA MACRO HELP NEEDED
CATIA MACRO HELP NEEDED
(OP)
Good Afternoon,
Ok so I'm after some help please. I have a catpart which is quite large (in file size approx 50mb) i have a load of holes in it, which I've put the wrong length of thread in, so I need to make them longer. I've recorded a macro, trimmed it down and then edited it. I have very little experience with macros, and to be honest probably dropped lucky following this one through. Basically there are holes number 100 - 258 (or something like that) so i've edited the macro to selct the hole number 100 change it then update it, select hole 101 change it update it, select hole 102 change it update it and so on. I'm aware you can 'loop' the commands, so how would i loop the command and add 1 to the hole number each time?
I appreciate the attached has a couple of holes missing, but fot the purpose of this we'll assume they run up in 1's. Someone into macro's please don't laugh at what i've done, it works and it's doing it for me now
just need it quicker 
Thanks in adavnce
Ok so I'm after some help please. I have a catpart which is quite large (in file size approx 50mb) i have a load of holes in it, which I've put the wrong length of thread in, so I need to make them longer. I've recorded a macro, trimmed it down and then edited it. I have very little experience with macros, and to be honest probably dropped lucky following this one through. Basically there are holes number 100 - 258 (or something like that) so i've edited the macro to selct the hole number 100 change it then update it, select hole 101 change it update it, select hole 102 change it update it and so on. I'm aware you can 'loop' the commands, so how would i loop the command and add 1 to the hole number each time?
I appreciate the attached has a couple of holes missing, but fot the purpose of this we'll assume they run up in 1's. Someone into macro's please don't laugh at what i've done, it works and it's doing it for me now
Thanks in adavnce





RE: CATIA MACRO HELP NEEDED
Please read the comment inside code, maybe you can do some improvements. Also, is useful to upload a CATPart sample if possible, something simple in order to test...
CODE --> catvbs
Language="VBSCRIPT" Sub CATMain() Set partDocument1 = CATIA.ActiveDocument Set part1 = partDocument1.Part Set bodies1 = part1.Bodies Set body1 = bodies1.Item("PartBody") Set shapes1 = body1.Shapes Set selection1 = partDocument1.Selection selection1.Search "Type=Hole,all" ''you can change search criteria here according to your needs - maybe a specific diameter ot hole type For i=1 To selection1.Count '~ Set hole1 = shapes1.Item("Hole.153") ''replaced by next line which will do the loop Set hole1 = selection1.Item(i).Value hole1.ThreadingMode = catThreadedHoleThreading hole1.ThreadSide = catRightThreadSide Set length1 = hole1.ThreadDepth length1.Value = 7.000000 Next part1.Update End SubRegards
Fernando
https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU
RE: CATIA MACRO HELP NEEDED
Thank you so much. I'll have a play with this now and make up some edits for use. We do sometimes get this type of job where holes get modified so this will be a real time saver!
Thanks again