Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.

@Khoa_NguyenDang 

 

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.

 

 

If this answer has solved your problem please ACCEPT SOLUTION and hit like if you found it helpful..!


Regards,
Dutt Thakar
LinkedIn