Sub bohrung_erstellen() ' Set a reference to the part component definition. ' This assumes that a part document is active. Dim oCompDef As PartComponentDefinition Set oCompDef = ThisApplication.ActiveDocument.ComponentDefinition ' Get the first face of the model. This sample assumes a simple ' model where at least the first face is a plane. (A box is a good ' test case.) 'Dim oFace As Face Set oFace = oCompDef.WorkPlanes.Item("Arbeitsebene1") ' Create a new sketch. The second argument specifies to include ' the edges of the face in the sketch. Dim oSketch As PlanarSketch Set oSketch = oCompDef.Sketches.Add(oFace, True) ' Set a reference to the transient geometry object. Dim oTransGeom As TransientGeometry Set oTransGeom = ThisApplication.TransientGeometry ' Obtain the active document, this assumes ' that a part document is active in Inventor. Dim oPartDoc As Inventor.PartDocument Set oPartDoc = ThisApplication.ActiveDocument ' Obtain the Parameters collection Dim oParams As Parameters Set oParams = oPartDoc.ComponentDefinition.Parameters ' Create a new object collection for the hole center points. Set oHoleCenters = ThisApplication.TransientObjects.CreateObjectCollection ' Add one points as hole centers. oHoleCenters.Add oSketch.SketchPoints.Add(oTransGeom.CreatePoint2d(oParams.Item(5).Value, oParams.Item(6).Value)) Dim Durchmesser As Double Durchmesser = (oParams.Item(7).Value * 100) MsgBox (Durchmesser) Dim Tiefe As Double If Durchmesser = 62 Then Tiefe = 57 Else Tiefe = 47 MsgBox (Tiefe) Dim Bohrtiefe As String Bohrtiefe = (Tiefe / 10) & "mm" Dim Bohrtiefe1 As String Bohrtiefe1 = ((Tiefe + 1) / 10) & "mm" MsgBox (Bohrtiefe) MsgBox (Bohrtiefe1) ' Create the hole feature. Call oCompDef.Features.HoleFeatures.AddCBoreByDistanceExtent( _ oHoleCenters, "0,3cm", Bohrtiefe1, kPositiveExtentDirection, "0,35cm", Bohrtiefe, True) End Sub