If you check the COMPOUND it is likely to contain one or more shells. If it only contains faces, you will have to construct SHELL(s) from these first, then SOLID(s).
- Frank

On 08/12/2011 5:43 PM, Jayesh Salvi wrote:
Hi Frank,

That sounds right, but sewing tools doesn't exactly create TopoDS_SHELL. From the documentation it can create a Shape object or as in the code I've written (derived from STLReader code), it can create a Compound. I don't know how to create Shell from these objects.

--
Jayesh


On Thu, Dec 8, 2011 at 10:23 PM, Frank Conradie <fr...@qfin.net <mailto:fr...@qfin.net>> wrote:

    Hi Jayesh

    If I remember correctly, the sewing tool only creates shells, and
    you have to manually "wrap" them in solids. Here is some code I've
    used to do this in the past:

    # Note that shells is a Python list of shell(s), and it is assumed
    that if there
    # are more than 1 shells, the 1st is the outer shell and the rest
    are inner shells.
    def MakeSolidFromShells(shells):
        # Create new empty solid
        ms = BRepBuilderAPI_MakeSolid()
        # Add outer shell to new solid
        ms.Add(tds_.shell(shells[0]))
        # Add inner shells (holes)
        for innerSh in shells[1:]:
            ms.Add(tds_.shell(innerSh))
        so = ms.Solid()
        return so

    - Frank


    On 08/12/2011 3:35 AM, Jayesh Salvi wrote:
    Thomas,

    I guess the way to do "cast" in pythonOCC is as follows:

    unionop = BRepAlgoAPI_Fuse(TopoDS().solid(aShape), box)

    [as seen in the routine ShapeToTopology that you have written
    somewhere]

    But that doesn't help either. I get.

    RuntimeError: Standard_TypeMismatch
    TopoDS::Solid

    Did you mean any other way of casting to TopoDS_SOLID?
    --
    Jayesh


    On Thu, Dec 8, 2011 at 4:30 PM, Thomas Paviot <tpav...@gmail.com
    <mailto:tpav...@gmail.com>> wrote:

        Did you try to cast the compound to a TopoDS-Solid?

        Thomas
        - sent from my Android phone

        Le 8 déc. 2011, 10:07 AM, "Jayesh Salvi"
        <jayeshsa...@gmail.com <mailto:jayeshsa...@gmail.com>> a
        écrit :


        After more investigation of why NotDone is thrown, I have
        found some info.

        The Fuse operation has ErrorStatus() function on it. I found
        that it returns the error code 110.

        Then I looked into OCC code to find out what 110 stands for.
        I think these two locations in code can throw that error [1
        
<https://github.com/tpaviot/oce/blob/master/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx#L315>]
        and [2
        
<https://github.com/tpaviot/oce/blob/master/src/BRepAlgoAPI/BRepAlgoAPI_BooleanOperation.cxx#L390>]

        The actual error code is 10. Further digging for it, I found
        that there are two locations that throw that error code. [1
        
<https://github.com/tpaviot/oce/blob/master/src/BOP/BOP_ShellSolid.cxx#L145>]
        and [2
        
<https://github.com/tpaviot/oce/blob/master/src/BOP/BOP_WireSolid.cxx#L90>]

        Both are caused by issues with type of the shape that is
        passed as arguments.

        It looks like the code has problem if one shape is of type
        TopAbs_SHELL and other is TopAbs_SOLID. In our case I tried
        to find out the ShapeType's of the two shapes we pass. One
        of them (box created by BRepPrimAPI_MakeBox) is TopAbs_SOLID
        and the other (that we constructed by hand) is
        TopAbs_COMPOUND. This confuses me because arg type checking
        code has no condition that mentions COMPOUND shape type.

        Any ideas are welcome.
        --
        Jayesh

        On Thu, Dec 8, 2011 at 12:56 PM, Jayesh Salvi
        <jayeshsa...@gmail.com <mailto:jayeshsa...@gmail.com>>
        wrote: > > Hi, > > I tried ...


        _______________________________________________
        Pythonocc-users mailing list
        Pythonocc-users@gna.org <mailto:Pythonocc-users@gna.org>
        https://mail.gna.org/listinfo/pythonocc-users


        _______________________________________________
        Pythonocc-users mailing list
        Pythonocc-users@gna.org <mailto:Pythonocc-users@gna.org>
        https://mail.gna.org/listinfo/pythonocc-users




    _______________________________________________
    Pythonocc-users mailing list
    Pythonocc-users@gna.org  <mailto:Pythonocc-users@gna.org>
    https://mail.gna.org/listinfo/pythonocc-users

    _______________________________________________
    Pythonocc-users mailing list
    Pythonocc-users@gna.org <mailto:Pythonocc-users@gna.org>
    https://mail.gna.org/listinfo/pythonocc-users




_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users
_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to