×
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

CATIA MACRO HELP NEEDED

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 smile just need it quicker smile

Thanks in adavnce

RE: CATIA MACRO HELP NEEDED

Hi

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 Sub 

Regards
Fernando

https://picasaweb.google.com/102257836106335725208 - Romania
https://picasaweb.google.com/103462806772634246699... - EU

RE: CATIA MACRO HELP NEEDED

(OP)
OH your are wonderfull!!!!!! I've just done a sample plate, slapped a load of holes all over it. Edited one hole with a macro recording so it can give me the code. Copied and pasted bits, and bam it's done!!!

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

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