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: 

How to do boundarypatch on 3Dsketch circles in VBA?

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
fleece.design
809 Views, 3 Replies

How to do boundarypatch on 3Dsketch circles in VBA?

Hi,

 

I want to select all circles in the design to patch them. How do I do this in VBA? Drawing the circles is no problem.

 

Kind regards,

Bart

 

ScreenShot004.png

3 REPLIES 3
Message 2 of 4

Could you please test this sample code. It works for me.

Private Sub BoundaryPatch_SketchCircle3D()

  Dim oDoc As PartDocument
  Set oDoc = ThisApplication.ActiveDocument
  Dim oDef As PartComponentDefinition
  Set oDef = oDoc.ComponentDefinition
  
  'reference to 3d sketch
  Dim oSketch3d As Sketch3D
  Set oSketch3d = oDef.Sketches3D.Item(1)

  'create Boundary Patch Definition
  Dim oBoundaryPatchDef As BoundaryPatchDefinition
  Set oBoundaryPatchDef = oDef.Features _
        .BoundaryPatchFeatures.CreateBoundaryPatchDefinition
  
  'Add all 3D circles to Boundary Patch Definition
  'using Path object
  Dim oCircle3d As SketchCircle3D
  Dim oPath As Path
  For Each oCircle3d In oSketch3d.SketchCircles3D
    Set oPath = oDef.Features.CreatePath(oCircle3d)
    Call oBoundaryPatchDef.BoundaryPatchLoops.Add(oPath)
  Next

  ' Create the boundary patch feature based on the definition.
  Dim oBoundaryPatch As BoundaryPatchFeature
  Set oBoundaryPatch = oDef.Features _
        .BoundaryPatchFeatures.Add(oBoundaryPatchDef)
  
End Sub

 Cheers,


Vladimir Ananyev
Developer Technical Services
Autodesk Developer Network

Message 3 of 4

Thanks a lot! That works perfectly the way I wanted!

Message 4 of 4
roooe
in reply to: Vladimir.Ananyev

Hello, 

 

would this be possible to do with a 3D sketch that is made up of triangles (check screenshot)? What do I have to pass to the boundary patch object for it to create the boundary patches, where these triangles are?

 

fwrf.JPG

 

Thanks

Omar

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

Post to forums  

Autodesk Design & Make Report