Part Design

Creating Pad


This macro shows you how to create a pad from a sketch.

This macro opens the CAAPriPad.CATPart document that contains a sketch only. 
It creates Pad object from a Sketch object with a ShapeFactory method and a update it.

CAAPriPad is launched in CATIA [1]. No open document is needed.

CAAPriPad.CATScript is located in the CAAScdPriUseCases module. Execute macro (windows only).

 

CAAPriPad includes the following steps:

  1. Prolog
  2. Creating the Pad
  3. Modifying the Pad First Limit
  4. Mirroring the Pad

Prolog

The macro first loads CAAPriPad.CATPart that contains a sketch: Sketch.1 

This object have been created with the Sketcher workbench. 

  ...
' ------------
' Get the part
' ------------
Dim oPart As Part
Set oPart = CATIA.ActiveDocument.Part

' ------------
' Get the part body in the part
' ------------
Dim oBody As Body
Set oBody = oPart.Bodies.Item  ( "PartBody" ) 

' ------------
' Get the sketch in the body
' ------------
Dim oSketch As Sketch
Set oSketch = oBody.Sketches.Item  ( "Sketch.1" ) 
   ...

Once the part document has been loaded, the oPart, oBody and oSketch variables are declared to receive the instance of the part, the partbody and the sketch.

Creating the Pad

...
' ------------
' Create the pad with a default first limit
' ------------
MsgBox "Click OK to create the pad."
Dim oPad As Pad
Set oPad = oPart.ShapeFactory.AddNewPad  ( oSketch, 20.000000 ) 

' ------------
' Update the part
' ------------
oPart.Update 
...

The Pad object is created from the oSketch object with a default first limit of 20mm. The Pad object is created using the AddNewPad method of the ShapeFactory object.

The Pad is then updated with the following result.

Modifying the pad first limit

...
' ------------
' Define the pad first limit
' ------------
MsgBox "Click OK to set the pad first limit to 40mm."
oPad.FirstLimit.Dimension.Value = 40.000000

' ------------
' Update the part
' ------------
oPart.Update 
  ...

The FirstLimit property of the Pad object is set to 40mm.

Mirroring the pad

...
' ------------
' Define the pad to be symmetric relative to the sketch plane
' ------------
MsgBox "Click OK to mirror the extrusion offset."
oPad.IsSymmetric = True

' ------------
' Update the part
' ------------
oPart.Update 
  ...

The IsSymmetric property of the Pad object is set to 40mm.

[Top]


In Short

This use case has shown how to create and modify a pad using macros.

[Top]


References

[1] Replaying a macro
[Top]

Copyright © 2001, Dassault Systèmes. All rights reserved.