It required some reading and testing, but it seems it works :-)
But be aware it's a proof of concept, not nice, polished and stable code...
Option Explicit Declare Function mdlKISolid_elementToBody Lib "stdkisolid.dll" (ByRef bodyPP As Long, ByVal edP As Long, ByVal modelRef As Long) As Long Declare Function mdlKISolid_sweepBodyAxis Lib "stdkisolid.dll" (ByVal bodyP As Long, ByRef revolveAxisP As Point3d, ByRef radialAxisP As Point3d, ByVal angle As Double, ByVal shell As Double, ByVal draftAngle As Double, ByVal closeOpenProfiles As Long) As Long Declare Function mdlKISolid_isSheetBody Lib "stdkisolid.dll" (ByVal bodyP As Long) As Long Declare Function mdlKISolid_bodyToElementD Lib "stdkisolid.dll" (ByRef edPP As Long, ByVal bodyP As Long, ByVal wireframe As Long, ByVal nIsoParametrics As Long, ByVal templateP As Long, ByVal modelRef As Long, ByVal threeD As Long) As Long Public Sub TestRevolveProfile() ' Get existing shape element Dim shp As ShapeElement Set shp = ActiveModelReference.GetElementByID(DLongFromLong(621)) ' Convert shape to brep (KIBODY) Dim bodyPP As Long Dim edP As Long edP = shp.MdlElementDescrP Dim modelRef As Long modelRef = ActiveModelReference.MdlModelRefP Dim statusInt As Long statusInt = mdlKISolid_elementToBody(bodyPP, edP, modelRef) ' Should be tested for 0 ' Test if the result is really a sheet body (not used now) Dim isSheetBody As Long isSheetBody = mdlKISolid_isSheetBody(bodyPP) ' Revolve the sheet body Dim statusSweep As Long Dim revolveAxisP As Point3d revolveAxisP = Point3dFromXYZ(0, 0, 1) Dim radialAxisP As Point3d radialAxisP = Point3dFromXYZ(0, 0, 0) Dim angle As Double angle = 2 * Pi statusSweep = mdlKISolid_sweepBodyAxis(bodyPP, revolveAxisP, radialAxisP, angle, 0#, 0, 0) 'Should be tested for 0 ' Convert the result brep body to MicroStation element Dim statusBodyToElement As Long Dim edPP As Long statusBodyToElement = mdlKISolid_bodyToElementD(edPP, bodyPP, 1, -1, 0, modelRef, 1) 'Should be tested for 0 ' Create VBA object based on element descriptor and add it to active model Dim smartSolidEl As SmartSolidElement Set smartSolidEl = MdlCreateElementFromElementDescrP(edPP) ActiveModelReference.AddElement smartSolidEl End Sub
With regards,
Jan