- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
HI all guys
I want to create the feature in the ActiveEditDocument link in the attached picture
But I use the same code to create features in IPT, but when I edit 1 component in Assembly, I call the same code but it not work
Do any people know about this, please help me
Thank you so much !!!!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Are you looking for something like this?
Regards,
Dutt Thakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
- 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
HI @dutt.thakar
I couldn't use the Thicken function in ActveEditDocument
but I also try with Combine function and it works
Do you have any advice for me. Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have created the code in VBA for a test and it works perfectly, Check out the below screencast and code as well. The code is in VBA, so please note that you need to convert it to make it work in VB.Net or C#.
Dim oPartDoc As PartDocument
Set oPartDoc = ThisApplication.ActiveEditDocument
Dim oCompDef As PartComponentDefinition
Set oCompDef = oPartDoc.ComponentDefinition
Dim oFeat As PartFeature
FCount = 1
Dim oFaceCol As FaceCollection
Set oFaceCol = ThisApplication.TransientObjects.CreateFaceCollection
For Each oFeat In oCompDef.Features
If InStr((oFeat.Name), "Patch") Then
oFaceCol.Clear
For Each oFace In oFeat.SurfaceBodies.Item(1).Faces
Call oFaceCol.Add(oFace)
Dim oThickFeat As ThickenFeature
Set oThickFeat = oCompDef.Features.ThickenFeatures.Add(oFaceCol, "0.4", kSymmetricExtentDirection, kNewBodyOperation, True)
oThickFeat.Name = "Thicken-Partition" & FCount
FCount = FCount + 1
Next
End If
Next
End Sub
Regards,
Dutt Thakar