How to do boundarypatch on 3Dsketch circles in VBA?

How to do boundarypatch on 3Dsketch circles in VBA?

Anonymous
Not applicable
987 Views
3 Replies
Message 1 of 4

How to do boundarypatch on 3Dsketch circles in VBA?

Anonymous
Not applicable

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

0 Likes
Accepted solutions (1)
988 Views
3 Replies
Replies (3)
Message 2 of 4

Vladimir.Ananyev
Alumni
Alumni
Accepted solution

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

Anonymous
Not applicable

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

0 Likes
Message 4 of 4

Anonymous
Not applicable

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

0 Likes