Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations KootK on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Automating with CATIA macro

Status
Not open for further replies.

mvangild

Automotive
Dec 5, 2005
5
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.
 
Replies continue below

Recommended for you

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
 
BTW this code is for R14... ;)

Eric N.
indocti discant et ament meminisse periti
 
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))
 
Thanks guys. I appreciate the quick help.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor