Dassault Systemes Vba 7.1 Better -

' Create sketch on XY plane Dim originElements As OriginElements Set originElements = part1.OriginElements Dim xyPlane As Reference Set xyPlane = originElements.PlaneXY

If Not lengthParam Is Nothing Then lengthParam.Value = 150.0 part.Update End If End Sub Sub SelectFace() Dim sel As Selection Set sel = CATIA.ActiveDocument.Selection sel.Clear ' Status returns "Normal" or "Cancel" Dim status As String status = sel.SelectElement("Face", "Select a face", False)

' In UserForm1 with TextBox1, CommandButton1 Private Sub CommandButton1_Click() GlobalHeight = CDbl(TextBox1.Text) Unload Me End Sub ' In main module Public GlobalHeight As Double dassault systemes vba 7.1

' Your automation logic here ' ...

Dim sketch As Sketch Set sketch = shapeFactory.AddNewSketch(xyPlane) sketch.OpenEdition ' Create sketch on XY plane Dim originElements

Dim catiaApp As Application Set catiaApp = GetObject(, "CATIA.Application") If catiaApp Is Nothing Then MsgBox "Start CATIA first" Exit Sub End If

sketch.CloseEdition

' Create a circle (Factory2D methods) Dim circleCenter As Point2D Set circleCenter = sketch.Factory2D.AddPoint(0, 0) Dim circle As Circle2D Set circle = sketch.Factory2D.AddCircle(0, 0, 20) ' radius 20mm