- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Please see the code below. I am just creating a circular profile extrude in the code, please change it as per your requirement. Make sure you are in edit state inside the assembly within the part and then run this code.
Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.ActiveEditDocument
'Set Component Definition
Dim oCompDef As PartComponentDefinition
oCompDef = oPartDoc.ComponentDefinition
'Create a sketch on XY Plane
Dim oSketch As PlanarSketch
oSketch = oCompDef.Sketches.Add(oCompDef.WorkPlanes.Item(3))
'Draw a Circle
Call oSketch.SketchCircles.AddByCenterRadius(ThisApplication.TransientGeometry.CreatePoint2d(0, 0), 10)
Dim oProfile As Profile
oProfile = oSketch.Profiles.AddForSolid
'Create an Extrusion
Dim oExtrude As ExtrudeFeature
oExtrude = oCompDef.Features.ExtrudeFeatures.AddByDistanceExtent(oProfile, 10, kSymmetricExtentDirection, kNewBodyOperation)
Also if you want to detect whether the in-place edit session is active or not. Check the below link, it has some quite useful information.
https://adndevblog.typepad.com/manufacturing/2013/01/detect-in-place-edit-session-in-inventor.html
Hope this will be helpful.
Regards,
Dutt Thakar