You are previewing CATIA V5 Macro Programming with Visual Basic Script.
O'Reilly logo
CATIA V5 Macro Programming with Visual Basic Script

Book Description

Write powerful, custom macros for CATIA V5CATIA V5 Macro Programming with Visual Basic Script shows you, step by step, how to create your own macros that automate repetitive tasks, accelerate design procedures, and automatically generate complex geometries.

Table of Contents

  1. Cover 
  2. About the Author
  3. Title Page
  4. Copyright Page
  5. Contents 
  6. Preface
  7. 1. Basics
    1. 1.1 Definition of CATScript and CATVBS
    2. 1.2 Definition of Nomenclature
    3. 1.3 Definition of Object, Class, and Object Path
      1. 1.3.1 Object and Class
      2. 1.3.2 Object Path
      3. 1.3.3 Root Class and Base Classes
    4. 1.4 Basic Example of a Macro
    5. 1.5 Selecting a Macro Editor
    6. 1.6 Storage of a Macro
      1. 1.6.1 Storage in a CATIA Document
      2. 1.6.2 Storage in a Separate File
    7. 1.7 Starting a Macro from a Button
      1. 1.7.1 Assigning a Macro to a Button
      2. 1.7.2 Creating a Toolbar
      3. 1.7.3 Assigning a Button to a Toolbar
    8. 1.8 Blocks of a Macro
      1. 1.8.1 Head of a Macro
      2. 1.8.2 Declaration of Global Variables and Objects
      3. 1.8.3 CATMain, Subroutines, and Functions
    9. 1.9 Branches and Loops
      1. 1.9.1 If-Then-Else
      2. 1.9.2 Select-Case-Else
      3. 1.9.3 For-Next
      4. 1.9.4 Do-While
      5. 1.9.5 Do Until
    10. 1.10 Anchor Objects of CATScript
      1. 1.10.1 CATIA-Application
      2. 1.10.2 CATIA Documents “CATPart” and “CATProduct”
      3. 1.10.3 Geometry Containers in CATParts
      4. 1.10.4 Structural Information and Metadata
    11. 1.11 Using the Macro Recorder
    12. 1.12 Additional Information
  8. 2. Communicating with the Environment
    1. 2.1 Screen Output and Input
      1. 2.1.1 Screen Output
      2. 2.1.2 Screen Input
    2. 2.2 Create, Load, and Save CATIA Documents
      1. 2.2.1 Creating Documents
      2. 2.2.2 Loading Documents
      3. 2.2.3 Saving Documents
    3. 2.3 User Selection of CATIA Elements
      1. 2.3.1 Selection before Starting a Macro
      2. 2.3.2 Selection during the Execution of a Macro
    4. 2.4 Searching and Recognizing Elements
      1. 2.4.1 Search
      2. 2.4.2 Recognize
    5. 2.5 Color and Hide Elements
      1. 2.5.1 Coloring Elements
      2. 2.5.2 Hiding Elements
    6. 2.6 Reading and Writing Data
      1. 2.6.1 Create or Declare a File
      2. 2.6.2 Reading Data
      3. 2.6.3 Writing Data
    7. 2.7 Executing External Programs and CATScripts
      1. 2.7.1 External Program
      2. 2.7.2 External CATScript
    8. 2.8 Reading Environment Variables
  9. 3. Components of CATParts
    1. 3.1 Attributes
      1. 3.1.1 Standard Attributes
      2. 3.1.2 Custom Attributes
    2. 3.2 Origin Elements
    3. 3.3 Bodies, Geometrical Sets, and Ordered Geometrical Sets
      1. 3.3.1 Bodies
      2. 3.3.2 Geometrical Sets
      3. 3.3.3 Ordered Geometrical Sets
      4. 3.3.4 Boolean Operations between Bodies
    4. 3.4 Parameters and Relations
      1. 3.4.1 Parameter
      2. 3.4.2 Design Table
      3. 3.4.3 Formulas
    5. 3.5 References
      1. 3.5.1 References to Geometry
      2. 3.5.2 References to Objects
      3. 3.5.3 References to Object Names
      4. 3.5.4 References to the Name of the Boundary Representation
    6. 3.6 Direction Definition
      1. 3.6.1 Direction Defined by a Vector
      2. 3.6.2 Direction Defined by an Object
  10. 4. Components of CATProducts
    1. 4.1 Attributes
    2. 4.2 Parameters and Formulas
    3. 4.3 Assembly Structure
      1. 4.3.1 Analyzing an Existing Structure
      2. 4.3.2 Adding Elements
      3. 4.3.3 Replacing Elements
      4. 4.3.4 Deleting Elements
    4. 4.4 Constraints
  11. 5. 2D Wireframe Geometry
    1. 5.1 Sketch References and Sketch Objects
    2. 5.2 Creating Sketch Geometry
    3. 5.3 Defining Construction Elements and the Rotation Axis
    4. 5.4 Creating Constraints
  12. 6. 3D Wireframe Geometry and Surfaces
    1. 6.1 General Procedure
    2. 6.2 Points
      1. 6.2.1 Methods for Creating Points
      2. 6.2.2 Case Studies: Points
    3. 6.3 Lines
      1. 6.3.1 Methods for Creating Lines
      2. 6.3.2 Case Studies: Lines
    4. 6.4 Planes
      1. 6.4.1 Methods for Creating Planes
      2. 6.4.2 Case Studies: Planes
    5. 6.5 Curves
      1. 6.5.1 Methods for Creating Curves
      2. 6.5.2 Case Studies: Curves
    6. 6.6 Surfaces
      1. 6.6.1 Methods for Creating Surfaces
      2. 6.6.2 Case Studies: Surfaces
    7. 6.7 Transformations
      1. 6.7.1 Methods for Creating Transformations
      2. 6.7.2 Case Studies: Transformations
    8. 6.8 Operations
      1. 6.8.1 Methods for Creating Operations
      2. 6.8.2 Case Studies: Operations
  13. 7. Solids
    1. 7.1 General Procedure
    2. 7.2 Sketch-Based Solids
      1. 7.2.1 Methods for Creating Sketch-Based Solids
      2. 7.2.2 Case Studies: Sketch-Based Solids
    3. 7.3 Surface-Based Solids
      1. 7.3.1 Methods for Creating Surface-Based Solids
      2. 7.3.2 Case Studies: Surface-Based Solids
    4. 7.4 Transformation-Based Solids
      1. 7.4.1 Methods for Creating Transformation-Based Solids
      2. 7.4.2 Case Studies: Transformation-Based Solids
    5. 7.5 Operations
      1. 7.5.1 Methods for Creating Operations on Solids
      2. 7.5.2 Case Studies: Operations
  14. 8. Featured Object Classes
    1. 8.1 Add
    2. 8.2 Angle
    3. 8.3 AngularRepartition
    4. 8.4 AnyObject
    5. 8.5 Application
    6. 8.6 Assemble
    7. 8.7 Axis2D
    8. 8.8 Bodies
    9. 8.9 Body
    10. 8.10 BooleanShape
    11. 8.11 BoolParam
    12. 8.12 CATBaseDispatch
    13. 8.13 Chamfer
    14. 8.14 Circle2D
    15. 8.15 CircPattern
    16. 8.16 CloseSurface
    17. 8.17 Collection
    18. 8.18 ConstRadEdgeFillet
    19. 8.19 Constraint
    20. 8.20 Constraints
    21. 8.21 ControlPoint2D
    22. 8.22 Curve2D
    23. 8.23 DesignTable
    24. 8.24 Dimension
    25. 8.25 Document
    26. 8.26 Documents
    27. 8.27 Draft
    28. 8.28 DraftDomain
    29. 8.29 DraftDomains
    30. 8.30 DressUpShape
    31. 8.31 EdgeFillet
    32. 8.32 Ellipse2D
    33. 8.33 FaceFillet
    34. 8.34 Factory
    35. 8.35 Factory2D
    36. 8.36 File
    37. 8.37 FileComponent
    38. 8.38 Files
    39. 8.39 FileSystem
    40. 8.40 Fillet
    41. 8.41 Folder
    42. 8.42 Folders
    43. 8.43 Formula
    44. 8.44 GeometricElement
    45. 8.45 GeometricElements
    46. 8.46 Geometry2D
    47. 8.47 Groove
    48. 8.48 Hole
    49. 8.49 HybridBodies
    50. 8.50 HybridBody
    51. 8.51 HybridShape
    52. 8.52 HybridShape3DCurveOffset
    53. 8.53 HybridShapeAffinity
    54. 8.54 HybridShapeAssemble
    55. 8.55 HybridShapeAxisLine
    56. 8.56 HybridShapeAxisToAxis
    57. 8.57 HybridShapeBlend
    58. 8.58 HybridShapeBoundary
    59. 8.59 HybridShapeCircle
    60. 8.60 HybridShapeCircle2PointsRad
    61. 8.61 HybridShapeCircle3Points
    62. 8.62 HybridShapeCircleBitangentPoint
    63. 8.63 HybridShapeCircleBitangentRadius
    64. 8.64 HybridShapeCircleCenterAxis
    65. 8.65 HybridShapeCircleCenterTangent
    66. 8.66 HybridShapeCircleCtrPt
    67. 8.67 HybridShapeCircleCtrRad
    68. 8.68 HybridShapeCircleExplicit
    69. 8.69 HybridShapeCircleTritangent
    70. 8.70 HybridShapeCombine
    71. 8.71 HybridShapeConic
    72. 8.72 HybridShapeConnect
    73. 8.73 HybridShapeCorner
    74. 8.74 HybridShapeCurveExplicit
    75. 8.75 HybridShapeCurvePar
    76. 8.76 HybridShapeCurveSmooth
    77. 8.77 HybridShapeCylinder
    78. 8.78 HybridShapeDirection
    79. 8.79 HybridShapeExtract
    80. 8.80 HybridShapeExtractMulti
    81. 8.81 HybridShapeExtrapol
    82. 8.82 HybridShapeExtremum
    83. 8.83 HybridShapeExtremumPolar
    84. 8.84 HybridShapeExtrude
    85. 8.85 HybridShapeFactory
    86. 8.86 HybridShapeFill
    87. 8.87 HybridShapeFilletBiTangent
    88. 8.88 HybridShapeFilletTriTangent
    89. 8.89 HybridShapeHelix
    90. 8.90 HybridShapeIntegratedLaw
    91. 8.91 HybridShapeIntersection
    92. 8.92 HybridShapeInverse
    93. 8.93 HybridShapeLawDistProj
    94. 8.94 HybridShapeLineAngle
    95. 8.95 HybridShapeLineBisecting
    96. 8.96 HybridShapeLineBiTangent
    97. 8.97 HybridShapeLineExplicit
    98. 8.98 HybridShapeLineNormal
    99. 8.99 HybridShapeLinePtDir
    100. 8.100 HybridShapeLinePtPt
    101. 8.101 HybridShapeLineTangency
    102. 8.102 HybridShapeLoft
    103. 8.103 HybridShapeNear
    104. 8.104 HybridShapeOffset
    105. 8.105 HybridShapePlane1Curve
    106. 8.106 HybridShapePlane1Line1Pt
    107. 8.107 HybridShapePlane2Lines
    108. 8.108 HybridShapePlane3Points
    109. 8.109 HybridShapePlaneAngle
    110. 8.110 HybridShapePlaneEquation
    111. 8.111 HybridShapePlaneExplicit
    112. 8.112 HybridShapePlaneMean
    113. 8.113 HybridShapePlaneNormal
    114. 8.114 HybridShapePlaneOffset
    115. 8.115 HybridShapePlaneOffsetPt
    116. 8.116 HybridShapePlaneTangent
    117. 8.117 HybridShapePointBetween
    118. 8.118 HybridShapePointCenter
    119. 8.119 HybridShapePointCoord
    120. 8.120 HybridShapePointExplicit
    121. 8.121 HybridShapePointOnCurve
    122. 8.122 HybridShapePointOnPlane
    123. 8.123 HybridShapePointOnSurface
    124. 8.124 HybridShapePointTangent
    125. 8.125 HybridShapePolyline
    126. 8.126 HybridShapePositionTransfo
    127. 8.127 HybridShapeProject
    128. 8.128 HybridShapeReflectLine
    129. 8.129 HybridShapeRevol
    130. 8.130 HybridShapeRotate
    131. 8.131 HybridShapes
    132. 8.132 HybridShapeScaling
    133. 8.133 HybridShapeSection
    134. 8.134 HybridShapeSphere
    135. 8.135 HybridShapeSpine
    136. 8.136 HybridShapeSpiral
    137. 8.137 HybridShapeSpline
    138. 8.138 HybridShapeSplit
    139. 8.139 HybridShapeSurfaceExplicit
    140. 8.140 HybridShapeSweep
    141. 8.141 HybridShapeSweepCircle
    142. 8.142 HybridShapeSweepConic
    143. 8.143 HybridShapeSweepExplicit
    144. 8.144 HybridShapeSweepLine
    145. 8.145 HybridShapeSymmetry
    146. 8.146 HybridShapeThickness
    147. 8.147 HybridShapeTranslate
    148. 8.148 HybridShapeTrim
    149. 8.149 Hyperbola2D
    150. 8.150 Intersect
    151. 8.151 IntParam
    152. 8.152 KnowledgeObject
    153. 8.153 KnowledgeActivateObject
    154. 8.154 Length
    155. 8.155 Limit
    156. 8.156 Line
    157. 8.157 Line2D
    158. 8.158 LinearRepartition
    159. 8.159 Loft
    160. 8.160 Mirror
    161. 8.161 OrderedGeometricalSet
    162. 8.162 OrderedGeometricalSets
    163. 8.163 OriginElements
    164. 8.164 Pad
    165. 8.165 Parabola2D
    166. 8.166 Parameter
    167. 8.167 Parameters
    168. 8.168 Part
    169. 8.169 PartDocument
    170. 8.170 Pattern
    171. 8.171 Plane
    172. 8.172 Pocket
    173. 8.173 Point
    174. 8.174 Point2D
    175. 8.175 Prism
    176. 8.176 Product
    177. 8.177 ProductDocument
    178. 8.178 Products
    179. 8.179 RealParam
    180. 8.180 RectPattern
    181. 8.181 Reference
    182. 8.182 References
    183. 8.183 Relation
    184. 8.184 Relations
    185. 8.185 Remove
    186. 8.186 RemoveFace
    187. 8.187 Repartition
    188. 8.188 ReplaceFace
    189. 8.189 Revolution
    190. 8.190 Rib
    191. 8.191 Rotate
    192. 8.192 Scaling
    193. 8.193 Scaling2
    194. 8.194 SelectedElement
    195. 8.195 Selection
    196. 8.196 SewSurface
    197. 8.197 Shaft
    198. 8.198 Shape
    199. 8.199 ShapeFactory
    200. 8.200 Shapes
    201. 8.201 Shell
    202. 8.202 Sketch
    203. 8.203 SketchBasedShape
    204. 8.204 Sketches
    205. 8.205 Slot
    206. 8.206 SolidCombine
    207. 8.207 Spline2D
    208. 8.208 Split
    209. 8.209 Stiffener
    210. 8.210 StrParam
    211. 8.211 SurfaceBasedShape
    212. 8.212 Sweep
    213. 8.213 Symmetry
    214. 8.214 SystemService
    215. 8.215 TextStream
    216. 8.216 Thickness
    217. 8.217 ThickSurface
    218. 8.218 Thread
    219. 8.219 TransformationShape
    220. 8.220 Translate
    221. 8.221 Trim
    222. 8.222 TritangentFillet
    223. 8.223 UserPattern
    224. 8.224 VarRadEdgeFillet
    225. 8.225 VisPropertySet
  15. 9. Featured VBScript Commands
    1. 9.1 Abs
    2. 9.2 Asc
    3. 9.3 Boolean
    4. 9.4 Byte
    5. 9.5 CBool
    6. 9.6 CByte
    7. 9.7 CDate
    8. 9.8 CDbl
    9. 9.9 Chr
    10. 9.10 CInt
    11. 9.11 CLng
    12. 9.12 Const
    13. 9.13 Cos
    14. 9.14 CSng
    15. 9.15 CStr
    16. 9.16 Date
    17. 9.17 Day
    18. 9.18 Dim
    19. 9.19 Dim ()
    20. 9.20 Double
    21. 9.21 Do-Until
    22. 9.22 Do-While
    23. 9.23 Empty
    24. 9.24 End
    25. 9.25 Err
    26. 9.26 Exit
    27. 9.27 Exp
    28. 9.28 Fix
    29. 9.29 For-Next
    30. 9.30 Function
    31. 9.31 Hour
    32. 9.32 If-Then-Else
    33. 9.33 InputBox
    34. 9.34 InStr
    35. 9.35 Int
    36. 9.36 Integer
    37. 9.37 IsDate
    38. 9.38 IsEmpty
    39. 9.39 IsNull
    40. 9.40 IsNumeric
    41. 9.41 Join
    42. 9.42 LCase
    43. 9.43 Left
    44. 9.44 Len
    45. 9.45 Log
    46. 9.46 Long
    47. 9.47 LTrim
    48. 9.48 Mid
    49. 9.49 Minute
    50. 9.50 Mod
    51. 9.51 Month
    52. 9.52 MsgBox
    53. 9.53 Now
    54. 9.54 Null
    55. 9.55 On Error Resume Next
    56. 9.56 Randomize
    57. 9.57 ReDim
    58. 9.58 Rem
    59. 9.59 Right
    60. 9.60 Rnd
    61. 9.61 RTrim
    62. 9.62 Second
    63. 9.63 Select Case
    64. 9.64 Set
    65. 9.65 Sin
    66. 9.66 Single
    67. 9.67 Sgn
    68. 9.68 Sqr
    69. 9.69 StrReverse
    70. 9.70 String
    71. 9.71 Sub
    72. 9.72 Tan
    73. 9.73 Time
    74. 9.74 Timer
    75. 9.75 TimeValue
    76. 9.76 Trim
    77. 9.77 UCase
    78. 9.78 Year
  16. Index