How Does the Fill Command Create a Face, and How do I Delete Them?

needhelp
needhelp Member Posts: 4
First Comment
**

Background

Over the last month, I have tried to answer my own question and just can't. What I could really use help with is directions or resources to fix the issue that exists.

The Problem

I have a complex geometry where many (approximately 300) odd shaped pores exist inside of 10mm circle and outside of a smaller circle of 3.5mm. My goal is to fill the whole area inside of the circle and then delete the faces inside those odd shapes. So far, all I can figure out is...

*select using a polygon which looks like,

selection=Selection.Create(Curve26,Curve...,
  • I think then I would merge faces with the outside circle and those faces already filled and use select and facets to delete? Please see my example code for a far simpler example where I do just this.

  • The issue I run into with this is, because it is really complex and filled with tons of shapes, it is hard to merge everything well.

  • I feel like the easiest way would be to sequentially create faces, merge them, and then delete only the relevant ones.

If anyone could help, that would be awesome. I really need to scale a solution to this larger problem.

Example Code

# Sketch Circle
origin = Point2D.Create(MM(0), MM(0))
result = SketchCircle.Create(origin, MM(5.3851648071345))

baseSel = SelectionPoint.Create(CurvePoint35)
targetSel = SelectionPoint.Create(DatumLine2)

result = Constraint.CreateCoincident(baseSel, targetSel)

baseSel = SelectionPoint.Create(CurvePoint35)
targetSel = SelectionPoint.Create(DatumLine3)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Sketch Circle
origin = Point2D.Create(MM(0), MM(0))
result = SketchCircle.Create(origin, MM(20.6155281280883))

baseSel = SelectionPoint.Create(CurvePoint36)
targetSel = SelectionPoint.Create(DatumPoint2)

result = Constraint.CreateCoincident(baseSel, targetSel)

baseSel = Curve19
targetSel = Curve20
result = Constraint.CreateConcentric(baseSel, targetSel)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(-13), MM(11))
end = Point2D.Create(MM(-13), MM(7))
result = SketchLine.Create(start, end)

curveSelList = Curve21
result = Constraint.CreateVertical(curveSelList)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(-13), MM(7))
end = Point2D.Create(MM(-5), MM(7))
result = SketchLine.Create(start, end)

baseSel = SelectionPoint.Create(CurvePoint37)
targetSel = SelectionPoint.Create(CurvePoint38)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(-5), MM(7))
end = Point2D.Create(MM(-4), MM(10.7320508075689))
result = SketchLine.Create(start, end)

baseSel = SelectionPoint.Create(CurvePoint39)
targetSel = SelectionPoint.Create(CurvePoint40)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(-4), MM(10.7320508075689))
end = Point2D.Create(MM(-13), MM(11))
result = SketchLine.Create(start, end)

baseSel = SelectionPoint.Create(CurvePoint41)
targetSel = SelectionPoint.Create(CurvePoint42)

result = Constraint.CreateCoincident(baseSel, targetSel)

baseSel = SelectionPoint.Create(CurvePoint43)
targetSel = SelectionPoint.Create(CurvePoint44)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(10), MM(11))
end = Point2D.Create(MM(6.53589838486224), MM(5))
result = SketchLine.Create(start, end)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(6.53589838486224), MM(5))
end = Point2D.Create(MM(14), MM(3))
result = SketchLine.Create(start, end)

baseSel = SelectionPoint.Create(CurvePoint45)
targetSel = SelectionPoint.Create(CurvePoint46)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(14), MM(3))
end = Point2D.Create(MM(14), MM(8))
result = SketchLine.Create(start, end)

baseSel = SelectionPoint.Create(CurvePoint47)
targetSel = SelectionPoint.Create(CurvePoint48)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(14), MM(8))
end = Point2D.Create(MM(10), MM(11))
result = SketchLine.Create(start, end)

baseSel = SelectionPoint.Create(CurvePoint49)
targetSel = SelectionPoint.Create(CurvePoint50)

result = Constraint.CreateCoincident(baseSel, targetSel)

baseSel = SelectionPoint.Create(CurvePoint51)
targetSel = SelectionPoint.Create(CurvePoint52)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(9), MM(-4))
end = Point2D.Create(MM(6), MM(-11))
result = SketchLine.Create(start, end)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(6), MM(-11))
end = Point2D.Create(MM(15), MM(-9))
result = SketchLine.Create(start, end)

baseSel = SelectionPoint.Create(CurvePoint53)
targetSel = SelectionPoint.Create(CurvePoint54)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(15), MM(-9))
end = Point2D.Create(MM(16.2589844124411), MM(-5))
result = SketchLine.Create(start, end)

baseSel = SelectionPoint.Create(CurvePoint55)
targetSel = SelectionPoint.Create(CurvePoint56)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(16.2589844124411), MM(-5))
end = Point2D.Create(MM(9), MM(-4))
result = SketchLine.Create(start, end)

baseSel = SelectionPoint.Create(CurvePoint57)
targetSel = SelectionPoint.Create(CurvePoint58)

result = Constraint.CreateCoincident(baseSel, targetSel)

baseSel = SelectionPoint.Create(CurvePoint59)
targetSel = SelectionPoint.Create(CurvePoint60)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(-11), MM(-3))
end = Point2D.Create(MM(-12), MM(-9))
result = SketchLine.Create(start, end)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(-12), MM(-9))
end = Point2D.Create(MM(-5), MM(-12.1845262184354))
result = SketchLine.Create(start, end)

baseSel = SelectionPoint.Create(CurvePoint61)
targetSel = SelectionPoint.Create(CurvePoint62)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(-5), MM(-12.1845262184354))
end = Point2D.Create(MM(-5), MM(-5))
result = SketchLine.Create(start, end)

baseSel = SelectionPoint.Create(CurvePoint63)
targetSel = SelectionPoint.Create(CurvePoint64)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Sketch Line
start = Point2D.Create(MM(-5), MM(-5))
end = Point2D.Create(MM(-11), MM(-3))
result = SketchLine.Create(start, end)

baseSel = SelectionPoint.Create(CurvePoint65)
targetSel = SelectionPoint.Create(CurvePoint66)

result = Constraint.CreateCoincident(baseSel, targetSel)

baseSel = SelectionPoint.Create(CurvePoint67)
targetSel = SelectionPoint.Create(CurvePoint68)

result = Constraint.CreateCoincident(baseSel, targetSel)
# EndBlock

# Fill
selection = Curve20
secondarySelection = Selection.Empty()
options = FillOptions()
result = Fill.Execute(selection, secondarySelection, options, FillMode.Layout, Info10)
# EndBlock

# Fill
selection = Selection.Create(Curve21, Curve22, Curve23, Curve24, Curve25, Curve26, Curve27, Curve28, Curve29, Curve30, Curve31, Curve32, Curve33, Curve34, Curve35, Curve36)
secondarySelection = Selection.Empty()
options = FillOptions()
result = Fill.Execute(selection, secondarySelection, options, FillMode.Layout, Info11)
# EndBlock

# Fill
selection = Curve19
secondarySelection = Selection.Empty()
options = FillOptions()
result = Fill.Execute(selection, secondarySelection, options, FillMode.Layout, Info12)
# EndBlock

# Solidify Sketch
mode = InteractionMode.Solid
result = ViewHelper.SetViewMode(mode, Info13)
# EndBlock

# Create New Face
selection = Face1
result = ReplaceFacesWithFace.Execute(selection)
# EndBlock

# Delete Selection
selection = Face3
result = Delete.Execute(selection)
# EndBlock

# Delete Selection
selection = Face4
result = Delete.Execute(selection)
# EndBlock

# Delete Selection
selection = Face5
result = Delete.Execute(selection)
# EndBlock

# Delete Selection
selection = Face2
result = Delete.Execute(selection)
# EndBlock

# Set Sketch Plane
sectionPlane = Plane.PlaneXY
result = ViewHelper.SetSketchPlane(sectionPlane, Info14)
# EndBlock

Comments

  • NickFL
    NickFL Member Posts: 8
    First Anniversary Name Dropper First Comment
    **

    Hello needhelp,

    A couple of things here: I recommend using Index Variables instead of Intelligent Variables as it gives you better reproducibility. When I try to follow your code, I don't have a CurvePoint35 for example.

    Sorry I did not see your replies in the reqest here: https://discuss.ansys.com/discussion/4690/help-with-fill-command . It doesn’t appear that the forum sends emails out when someone replies to a topic (or the email blocks them, they aren’t in SPAM). The approach I used there was to grab all the faces on one plane. Using a loop, I then compare the Bounding Box of each of the faces. Of course, the Bounding Box of the outer face will be larger than that of an inner face and this is the test that is used in the findOuter routine.

    If you need direct help, you should be able to find my contact information at the following webpage: https://www.tu-chemnitz.de/chemie/tech/mitarbeiter.php

    • Nick F. L.
  • NickFL
    NickFL Member Posts: 8
    First Anniversary Name Dropper First Comment
    **

    Create your sketch on a plane. Then you should be able to run the following to create a Surface Body.

    ``` # Python Script, API Version = V23

    Fills between all the curves, everything in at one surface body

    selection = Selection.Create(GetRootPart().DatumPlanes[-1].Curves[:])
    secondarySelection = Selection.Empty()
    options = FillOptions()
    options.AutoExtendFillArea = False
    options.PatchBlend = False
    options.ZipLaminarEdges = False
    options.GapAngle = DEG(10)
    options.GapDistance = MM(0.1)
    options.UntrimSingleFace = True
    options.AllowMultiFacePatch = False
    result = Fill.Execute(selection, secondarySelection, options, FillMode.Layout, None)

    EndBlock

    This Keeps your Sketch

    selection = Selection.Create(GetRootPart().DatumPlanes[0].GetChildrenIDocObject[-1])
    result = SketchHelper.SetSketchLayout(selection, True)

    EndBlock

    Returns to 3D mode

    mode = InteractionMode.Solid
    result = ViewHelper.SetViewMode(mode, None)

    EndBlock

    ```