Private Sub CreateButton_Click() 'Define Variables Dim CenterRadiusO As Double Dim CenterRadiusI As Double Dim DistanceExtent As Double 'Set variables from values in edit boxes CenterRadiusO = OuterDiameter / 2 CenterRadiusI = Innerdiameter / 2 DistanceExtend = Pipelength ' error message if innererdurchmesser is greater than assendurchmesser If Innerdiameter > OuterDiameter Then CreateButton.Enabled = False MsgBox (" Inner Diameter must be smaller Value than Outer Diameter.") Exit Sub End If 'Create new part document Dim oDoc As PartDocument Set oDoc = ThisApplication.Documents.Add(kPartDocumentObject) 'Get Component definition from part document Dim oCompDef As ComponentDefinition Set oCompDef = oDoc.ComponentDefinition 'Create a new Sketch on the X-Y Plane Dim Sketch1 As PlanarSketch Set Sketch1 = oCompDef.Sketches.Add(oCompDef.WorkPlanes.Item(3)) 'Set a referance to the transient geometry objekt. Dim oTransGeom As TransientGeometry Set oTrabsGeom = ThisApplication.TransientGeometry 'Draw Circles on the Sketch Dim OuterCircle As SketchCircle Set OuterCircle = Sketch1.SketchCircles.AddByCenterRadius(oTransGeom.CreatePoint2d(0, 0), CenterRadiusO) Dim InnerCircle As SketchCircle Set InnerCircle = Sketch1.SketchCircles.AddByCenterRadius(oTransGeom.CreatePoint2d(0, 0), CenterRadiusI) 'Create a profile Dim Profile As Profile Set Profile = Sketch1.Profiles.AddForSolid 'Create a solid extrusion Dim Extrusion1 As ExtrudeFeature Set Extrusion1 = oCompDef.Features.ExtrudeFeatures.AddByDistanceExtent(Profile, 3, kSymmetricExtentDirection) 'close dialog End End Sub Private Sub ExitButton_Click() End End Sub