×
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

Automating with CATIA macro

Automating with CATIA macro

Automating with CATIA macro

(OP)
I am a fairly comfortable user with CATIA V5, operating on V12.4.15.  I am trying to write a macro that which will take a group of selected surfaces and create pads with them.  Here's the hitch: the surfaces may not be named exactly the same every time this macro is run, and the number of surfaces vary, so recording is not an option.  The best way I can think of to do this is to read the names of all the surfaces into an array, then using a Do loop, create a Part Body and a pad as it cycles through each array value.  Therein lies the problem:  I don't know how to get the macro to read names of arbitrarily named surfaces. The CATIA online documentation doesn't cover this topic, relying on recording macros as opposed to programming them.  If no one knows the answer to this, maybe you'd know the name of a book of macro programming techniques that I can reference?  Thanks.

RE: Automating with CATIA macro

Hi,

first define in which Geometrical set you work in:

dim oHB as HybridBody
set oHB = CATIA.ActiveDocument.Part.HybridBodies.item (x)

Then get the yth element :

dim oSurface as HydridShape
set oSurface = oHB.HybridShapes.Item(y)

then check the name:

if oSurface.Name = "Random" then BINGO !

Eric N.
indocti discant et ament meminisse periti

RE: Automating with CATIA macro

BTW  this code is for R14...   ;)

Eric N.
indocti discant et ament meminisse periti

RE: Automating with CATIA macro

If all of your surfaces are in a single Geometric Set (aka Open Body or HybridBody), then they are already in an array, and you only need to loop thru the HybridBody.  If the user has selected them, you can also loop thru the selection array.  Look to the collection, and Item number (i.e. HybridShapes.Item(i))

RE: Automating with CATIA macro

(OP)
Thanks guys.  I appreciate the quick help.

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