Hi Jens,

The materials lab at the Fraunhofer must be a cool place to work!
Happy to hear you like PythonOCC!

Regarding the shell issue, I don't really get it... perhaps Thomas ( who's
the STEP expert! ) has an idea?
Anyway, happy you're able to generate the shapes you need!
Still, I do think its important to be able to see what you're doing ;)

Take care,

-jelle

On Mon, Oct 11, 2010 at 11:44 AM, Jens Cornelis <
jens.corne...@iwm.fraunhofer.de> wrote:

> Hi Jelle,
>
> thanks for your reply. At first: i work as a student research assistant
> and i came across PyOCC just yesterday when i searched for libraries to
> create step format files, when i realized that PyOCC is much, much more.
> I am enrolled in a masters program for computer science and i doing the
> programming tasks for a department focusing on materials research.  It
> is very cool and i like very much, what i have seen so far. Thanks a lot
> for your great work!
>
> Actually, the file is still imported as a Shell, but not as a solid.
> This is what the skript looks like (without diplay instructions as i
> have no TK installed):
> ____________
> from OCC.Utils.Construct import *
> from OCC.Utils.Common import *
> from OCC.Utils.DataExchange.STEP import STEPExporter
> from OCC.KBE.TypesLookup import *
>
> faces = {}
> p1,p2,p3,p4 = gp_Pnt(0,0,0),gp_Pnt(-5,-5,-5),gp_Pnt(5,-5,-5),gp_Pnt(0,0,0)
> faces[0] = make_face(make_polygon((p1,p2,p3,p4)))
>
> p1,p2,p3,p4 = gp_Pnt(0,0,0),gp_Pnt(-5,-5,-5),gp_Pnt(-5,5,-5),gp_Pnt(0,0,0)
> faces[1] = make_face(make_polygon((p1,p2,p3,p4)))
>
> p1,p2,p3,p4 = gp_Pnt(0,0,0),gp_Pnt(-5,5,-5),gp_Pnt(5,5,-5),gp_Pnt(0,0,0)
> faces[2] = make_face(make_polygon((p1,p2,p3,p4)))
>
> p1,p2,p3,p4 = gp_Pnt(0,0,0),gp_Pnt(5,5,-5),gp_Pnt(5,-5,-5),gp_Pnt(0,0,0)
> faces[3] = make_face(make_polygon((p1,p2,p3,p4)))
>
> p1,p2,p3,p4,p5 =
> gp_Pnt(-5,-5,-5),gp_Pnt(-5,5,-5),gp_Pnt(5,5,-5),gp_Pnt(5,-5,-5),
> gp_Pnt(-5,-5,-5)
>
> poly = make_polygon([p1,p2,p3,p4,p5])
> faces[4] = make_face(poly)
>
> sewing = sew_shapes(faces.values())
> sewing = fix_shape(sewing)
> stt = ShapeToTopology()
> solid = make_solid(stt(sewing))
>
> # Export to STEP
> my_step_exporter = STEPExporter("pyramid.stp")
> my_step_exporter.AddShape(solid)
> my_step_exporter.WriteFile()
> _________
>
> And this is what the console says:
> _________
> n degenerated shapes 0
> n deleted faces: 0
> n free edges 0
> n multiple edges: 0
>
> *******************************************************************
> ******        Statistics on Transfer (Write)                 ******
>
> *******************************************************************
> ******        Transfer Mode = 0  I.E.  As Is       ******
> ******        Transferring Shape, ShapeType = 2                      ******
> ** WorkSession : Sending all data
>  Step File Name : vogon.stp(245 ents)  Write  Done
> STEP transfer successful
> ____________
>
> Seems as if everything worked fine. As you can see on the screenshots,
> the pyramid is imported without any errors (except the message, that it
> is imported as shell instead of solid).
>
> If i cut the Pyramid, you can see that it is hollow. Using Abaqus to
> "Create Solid from Shell" creates a solid. This just works fine, but i
> don't see, why it is not imported as a solid in the first step. When i
> export the solid from Abaqus and import this file once again, it is
> imported as solid.
>
> Any ideas? Maybe i still am doing something wrong.  Oh, btw.: even using
> make_polygon from OCC.Utils.Construct i have to repeat the last vertex.
> Otherwise everything fix_shape is informing me about free edges.
>
> JC
> > Hi Jens,
> >
> > This is probably due to the fact that your faces were not correctly
> > oriented ( see screenshot, you see a pyramid in the fixed version ).
> > I use "fix_shape" to produce a shape with well oriented faces.
> > Also, I suggest you use the OCC.Utils.Construct module, saves a lot of
> > time building geometry and produces insightful messages when things go
> > wrong. ( make_polygon has a "closed" flag, let's you not repeat the
> > last vertex ;)
> >
> > Finally, a great idea is to use the ipdb module.
> > This way, you can just "import ipdb; ipdb.set_trace()" in your code,
> > and you have an interactive (!!!!) viewer and terminal to step through
> > your code. This way it super easy to see what you're doing and what's
> > going wrong.
> >
> > So cool folks from the Fraunhofer are interested in pythonocc!
> > Can I ask for what research you use PyOCC Jens?
> > Please let us know whether this fixes the issue.
> >
> > Best,
> >
> > -jelle
> >
> > On Mon, Oct 11, 2010 at 9:54 AM, Jens Cornelis
> > <jens.corne...@iwm.fraunhofer.de
> > <mailto:jens.corne...@iwm.fraunhofer.de>> wrote:
> >
> >     Hi,
> >
> >     i use pythonOCC to create .stp files in order to import them in
> >     Abaqus CAE.
> >
> >     Somehow, i seem to not manage to export my example as a solid. When
> >     importing in Abaqus, it says that it is imported as shell instead
> >     of solid.
> >
> >     Any ideas why? What am i doing wrong?
> >
> >     Here's the example code:
> >     ______________
> >     def make_face(p1, p2, p3, p4):
> >        poly = BRepBuilderAPI_MakePolygon()
> >        map(poly.Add, [p1,p2,p3,p4])
> >        poly.Build()
> >
> >        wire = poly.Wire()
> >        face = BRepBuilderAPI_MakeFace(wire)
> >        return face
> >
> >
> >     faces = {}
> >     p1,p2,p3,p4 =
> >     gp_Pnt(0,0,0),gp_Pnt(-5,-5,-5),gp_Pnt(5,-5,-5),gp_Pnt(0,0,0)
> >     faces[0] = make_face(p1,p2,p3,p4).Shape()
> >
> >     p1,p2,p3,p4 =
> >     gp_Pnt(0,0,0),gp_Pnt(-5,-5,-5),gp_Pnt(-5,5,-5),gp_Pnt(0,0,0)
> >     faces[1] = make_face(p1,p2,p3,p4).Shape()
> >
> >     p1,p2,p3,p4 =
> >     gp_Pnt(0,0,0),gp_Pnt(-5,5,-5),gp_Pnt(5,5,-5),gp_Pnt(0,0,0)
> >     faces[2] = make_face(p1,p2,p3,p4).Shape()
> >
> >     p1,p2,p3,p4 =
> >     gp_Pnt(0,0,0),gp_Pnt(5,5,-5),gp_Pnt(5,-5,-5),gp_Pnt(0,0,0)
> >     faces[3] = make_face(p1,p2,p3,p4).Shape()
> >
> >     p1,p2,p3,p4,p5 = gp_Pnt(-5,-5,-5),gp_Pnt(-5,5,-5),gp_Pnt(5,5,-5),
> >     gp_Pnt(5,-5,-5), gp_Pnt(-5,-5,-5)
> >     poly = BRepBuilderAPI_MakePolygon()
> >     map(poly.Add, [p1,p2,p3,p4,p5])
> >     poly.Build()
> >
> >     wire = poly.Wire()
> >     faces[4] = BRepBuilderAPI_MakeFace(wire).Shape()
> >
> >     sewing = BRepBuilderAPI_Sewing()
> >
> >     for i in range(5):
> >        sewing.Add(faces[i])
> >
> >     sewing.Perform()
> >     sewed_shape = sewing.SewedShape()
> >
> >     tds = TopoDS()
> >     solid = BRepBuilderAPI_MakeSolid(tds.Shell(sewed_shape))
> >
> >     # Export to STEP
> >     my_step_exporter = STEPExporter("vogon.stp")
> >     my_step_exporter.SetTolerance()
> >     my_step_exporter.AddShape(solid.Solid())
> >     my_step_exporter.WriteFile()
> >     ____________
> >
> >     Thanks a lot in advance!
> >
> >     Cheers,
> >
> >     JC
> >
> >
> >     _______________________________________________
> >     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
>
>
> --
>
> Jens Cornelis
> Fraunhofer-Institut fuer Werkstoffmechanik IWM
> Woehlerstr. 11
> 79108 Freiburg
> Telefon +49 761 5142-280
> Fax +49 761 5142-110
> jens.corne...@iwm.fraunhofer.de
> www.iwm.fraunhofer.de
>
>
> _______________________________________________
> 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