Dim comp As Object Dim oAssDoc As Object comp = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kAssemblyOccurrenceFilter, "Selecteer een component") oAssDoc = comp If TypeOf oOccurrence Is ComponentOccurrenceProxy Then Prop = iProperties.Value(oAssDoc.NativeObject.Name, "Project", "Description") Else Prop = iProperties.Value(oAssDoc.Name, "Project", "Description") End If Dim oAssDef As AssemblyComponentDefinition = oAssDoc.Definition Dim oFace As Face oFace = ThisApplication.CommandManager.Pick (SelectionFilterEnum.kAllPlanarEntities,"Selecteer een vlak") ' make sure it Is a planar face If oFace.SurfaceType = SurfaceTypeEnum.kPlaneSurface Then oPlanarSurface = oFace.Geometry 'add a sketch oSketch = oAssDef.Sketches.Add(oFace) 'trying to choose an appropriate point 'assume this planar face has one edge loop only oEdgeLoop = oFace.EdgeLoops(1) oMinPt = oEdgeLoop.RangeBox.MinPoint oMaxPt = oEdgeLoop.RangeBox.MaxPoint CenterPt = oAssDef.TransientGeometry.CreatePoint((oMaxPt.X + oMinPt.X) / 2#, (oMaxPt.Y + oMinPt.Y) / 2#, (oMaxPt.Z + oMinPt.Z) / 2#) 'get one point on the face and transform to the point2d on the sketch 'oTextPt = oSketch.ModelToSketchSpace(oPlanarSurface.RootPoint) oTextPt = oSketch.ModelToSketchSpace(CenterPt) 'add the textbox oSketchText = oSketch.TextBoxes.AddFitted(oTextPt, "" & Prop & "") Else MsgBox( "Selecteer een vlak, en geen ronding, aub!") End If