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!

*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

Developing new interesting macros in catia

Developing new interesting macros in catia

Developing new interesting macros in catia

Hi all,

I am planing to make some tools in CATIA like customized macros or automating something

Can someone please suggest me some ideas

Thank in advance

RE: Developing new interesting macros in catia

Make fully adjustable point exporter/importer for Excel.

RE: Developing new interesting macros in catia

Click 1 button to perform all of my design duties during the week. Also include a toggle for overtime. Be sure to share the code. Thanks!

RE: Developing new interesting macros in catia

Hi little cthulhu,

Can you be more elaborate
what do you mean by adjustable point
I am curious

RE: Developing new interesting macros in catia

Exporting/importing points using Excel is a common request. But for obvious reasons each customer has slightly different spreadsheet format and maybe even point naming rules.

So the goal is to create a universal macro that can be easily adjusted (with configuration files for example) to work for any customer.

RE: Developing new interesting macros in catia

Exporting/Importing points is pretty easy.

I actually got a really good one for free from my Catia supplier Inceptra.

If you are taking requests I'd love for you to figure this out:

I design a lot of Mill Fixtures and Drill Fixtures where this would come in handy instead of putting in 100s of the same hole in every design.

RE: Developing new interesting macros in catia

HI AWM 24's!

I want to know how extract a geometrical set name from a CATPart.(all geometrical sets that the part contain, no matter the quantity of GS or even if the GS have another one inside(no matter how many have) and export it to Excel file.


RE: Developing new interesting macros in catia

here are my premises:
  1. I have a set with points called HoleCenterPoints, located directly under part.
  2. I have an empty body called Holes (holes will end up here)
  3. I have an empty set called Hole_References (line normal to surface and plane normal to curve will be added here for each HoleCenterPoint-point).
  4. My surface is a dead one, i.e. a parameter... called InputSurface (I tested the script on a sphere)
  5. Parameters of the holes are metric, you will need to change it according to your needs.
Sub CATMain()

Dim partDocument1 As PartDocument
Set partDocument1 = CATIA.ActiveDocument

Dim Sel As Selection
Set Sel = partDocument1.Selection

Dim part1 As Part
Set part1 = partDocument1.Part

Dim hybridBodies1 As hybridBodies
Set hybridBodies1 = part1.hybridBodies

Dim hybridBody1 As HybridBody
Set hybridBody1 = hybridBodies1.item("Hole_References")

part1.InWorkObject = hybridBody1

Dim hybridShapeFactory1 As HybridShapeFactory
Set hybridShapeFactory1 = part1.HybridShapeFactory

Dim parameters1 As Parameters
Set parameters1 = part1.Parameters

Dim hybridShapeSurfaceExplicit1 As HybridShapeSurfaceExplicit
Set hybridShapeSurfaceExplicit1 = parameters1.item("InputSurface")

Dim hybridBody2 As HybridBody
Set hybridBody2 = hybridBodies1.item("HoleCenterPoints")

Dim myHybridShape As HybridShape

Dim coord(2)

Dim bodies1 As Bodies
Set bodies1 = part1.Bodies

Dim body1 As Body
Set body1 = bodies1.item("Holes")

For Each myHybridShape In hybridBody2.HybridShapes

myHybridShape.GetCoordinates coord

Dim hybridShapeLineNormal1 As HybridShapeLineNormal
Set hybridShapeLineNormal1 = hybridShapeFactory1.AddNewLineNormal(hybridShapeSurfaceExplicit1, myHybridShape, 0, 20, False)

Dim hybridShapePlaneNormal1 As HybridShapePlaneNormal
Set hybridShapePlaneNormal1 = hybridShapeFactory1.AddNewPlaneNormal(hybridShapeLineNormal1, myHybridShape)

hybridBody1.AppendHybridShape hybridShapePlaneNormal1

part1.InWorkObject = hybridShapePlaneNormal1
part1.UpdateObject hybridShapePlaneNormal1

part1.InWorkObject = body1

Dim shapeFactory1 As ShapeFactory
Set shapeFactory1 = part1.ShapeFactory

Dim hole1 As Hole
Set hole1 = shapeFactory1.AddNewHoleFromPoint(coord(0), coord(1), coord(2), hybridShapePlaneNormal1, 10)

hole1.Type = catSimpleHole
hole1.AnchorMode = catExtremPointHoleAnchor
hole1.BottomType = catVHoleBottom

Dim limit1 As Limit
Set limit1 = hole1.BottomLimit
limit1.LimitMode = catOffsetLimit

Dim length1 As Length
Set length1 = hole1.Diameter
length1.Value = 10

Dim angle1 As Angle
Set angle1 = hole1.BottomAngle
angle1.Value = 120

hole1.SetDirection hybridShapeLineNormal1
hole1.ThreadingMode = catSmoothHoleThreading
hole1.ThreadSide = catRightThreadSide
part1.UpdateObject hole1

Sel.Add hybridShapePlaneNormal1
Sel.Add hybridShapeLineNormal1
Set visPropertySet1 = Sel.VisProperties
visPropertySet1.SetShow 1

End Sub


RE: Developing new interesting macros in catia

how the collection of Geometric set data is so important
can anyone tell me what is its important

RE: Developing new interesting macros in catia

Are there any nice macros in part especially

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! Already a Member? Login


eBook - The Future of Product Development is Here
Looking to make the design and manufacturing of your products more agile? For engineering and manufacturing organizations, the need for digital transformation of product development processes just became more urgent than ever so we wanted to share an eBook that will help you build a practical roadmap for your journey. Download Now

Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close