Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Cutting hole in a Surface

3 REPLIES 3
Reply
Message 1 of 4
Anonymous
407 Views, 3 Replies

Cutting hole in a Surface

Create a Surface by Open profile Extruded.
Create a Solid Cylinder by Circle extruded.
Can we cut a hole in the Surface using the Cylinder?

This is not possible interactively.

Can we use TransientBrep? ImprintBodies?

Tags (1)
3 REPLIES 3
Message 2 of 4
Vladimir.Ananyev
in reply to: Anonymous

This is possible interactively:

 

Intersection_1.pngIntersection_2.png

 

Intersection_3.png

I used Trim operation.

 

 


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 4
Anonymous
in reply to: Vladimir.Ananyev

Thanks a lot.

 

I could get programmatic equivalent as well....as below ..see if its ok/correct (or can it be better)

 

Sub Split()


    Dim oDoc As PartDocument
    oDoc = _invApp.ActiveDocument
    Dim oCompDef As PartComponentDefinition
    oCompDef = oDoc.ComponentDefinition

 

    'arguments
   Dim oWS1 As WorkSurface
   oWS1 = oCompDef.WorkSurfaces(1)
   Dim cntws As Integer = oCompDef.WorkSurfaces.Count

 

    Dim oObjColl As ObjectCollection
    oObjColl = _invApp.TransientObjects.CreateObjectCollection()

 

    Dim cntsrf As Integer = oCompDef.SurfaceBodies.Count

    Dim oSurface As SurfaceBody 'WorkSurface
    oSurface = oCompDef.Features.ExtrudeFeatures.Item("ExtrusionSrf1").SurfaceBodies.Item(1)

    Dim cntsrffa As Integer = oSurface.Faces.Count

 

    Dim oSolid As SurfaceBody 'Cylinder
    oSolid = oCompDef.SurfaceBodies.Item(1)

 

    Dim oFace As Face
    For Each oFace In oSurface.Faces
        oObjColl.Add(oFace)
    Next


    Dim oSplit As SplitFeature
    oSplit = oCompDef.Features.SplitFeatures.SplitFaces(oSolid, False, oObjColl)

 

    Dim oFaceColl As FaceCollection
    oFaceColl = _invApp.TransientObjects.CreateFaceCollection

 

    Dim orFace As Face = oSurface.Faces.Item(1) ' hardcoded for test
    oFaceColl.Add(orFace)

 

    ' can I avoid following extra feature call

    Dim oDeleteFace As DeleteFaceFeature
    oDeleteFace = oCompDef.Features.DeleteFaceFeatures.Add(oFaceColl)
    oCompDef.SurfaceBodies.Item(1).Visible = False


End Sub

 

Message 4 of 4
adam.nagy
in reply to: Anonymous

Shame it does not seem possible to create a TrimFeature (that Vladimir used in the UI) through the API.

 

If you go with SplitFeature, I guess you'll have to delete the face by yourself, as you are doing it now.



Adam Nagy
Autodesk Platform Services

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report