Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Developing new interesting macros in catia

Status
Not open for further replies.

AWMM24

Mechanical
Feb 15, 2020
7
IN
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
 
Replies continue below

Recommended for you

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!
 
Hi little cthulhu,

Can you be more elaborate
what do you mean by adjustable point
I am curious
 
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.
 
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:
[URL unfurl="true"]https://www.eng-tips.com/viewthread.cfm?qid=473924[/url]

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.
 
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.

Saludos!
 
Juan R, that is fairly easy with a recursive loop. Did you try searching the forum?
thread560-368840 is similar, finding part names.

regards,
LWolf
 
jzecha...
here are my premises:
[ol 1]
[li]I have a set with points called HoleCenterPoints, located directly under part.[/li]
[li]I have an empty body called Holes (holes will end up here)[/li]
[li]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).[/li]
[li]My surface is a dead one, i.e. a parameter... called InputSurface (I tested the script on a sphere)[/li]
[li]Parameters of the holes are metric, you will need to change it according to your needs.[/li]
[/ol]

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.Clear
Sel.Add hybridShapePlaneNormal1
Sel.Add hybridShapeLineNormal1
Set visPropertySet1 = Sel.VisProperties
visPropertySet1.SetShow 1
Next

End Sub



regards,
LWolf
 
how the collection of Geometric set data is so important
can anyone tell me what is its important
 
Are there any nice macros in part especially
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top