Hi Thomas

OK - noted. In any case, there is where my focus has been.

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
Patrick


On 13 May 2010 15:48, Thomas Paviot <tpav...@gmail.com> wrote:

> Patrick,
>
> You should *not* refer to the OpenCascade API doxygen documentation. There
> are many (small) differences between the C++ API and the python wrapper that
> could confuse you in using pythonOCC.
>
> The *only* official documentation for the pythonOCC API can be found here:
> http://api.pythonocc.org
>
> Regards,
>
> Thomas
>
>
> 2010/5/13 Patrick Janssen <patr...@janssen.name>
>
>> Hi Jelle,
>>
>> Thanks -
>> So the make_edge function wraps BRepBuilderAPI_MakeEdge
>> And looking at the source of make_edge, I see that you need to use the
>> Edge() method to get the edge
>> So to do it the longer way round again:
>>
>> def line3():
>>
>>     ''' Test a line segment'''
>>     display, start_display, add_menu, add_function_to_menu =
>> init_display()
>>
>>     from OCC.gp import gp_Pnt
>>     from OCC.BRepBuilderAPI import BRepBuilderAPI_MakeEdge
>>     p1 = gp_Pnt(0,0,0)
>>     p2 = gp_Pnt(9,9,0)
>>     my_line = BRepBuilderAPI_MakeEdge(p1, p2).Edge()
>>
>>     display.DisplayShape(my_line)
>>
>>     display.View_Iso()
>>     display.FitAll()
>>     start_display()
>>
>> So there is no need to call he Build() method?
>> That method confused me as well - what does it do? (see my first example)
>>
>> ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>>  Patrick
>>
>>
>>
>> On 13 May 2010 14:54, Jelle Feringa <jelleferi...@gmail.com> wrote:
>>
>>> Hi Patrick,
>>>
>>> The API can be a bit daunting indeed.
>>> However, most topology constructors can accept its arguments in quite a
>>> few ways.
>>> For example; make_edge accepts a (gp_Pnt, gp_Lin), but (gp_Pnt, gp_Pnt)
>>> is fine too.
>>> ( so can be done in 5 lines too ;')
>>>
>>> from OCC.Display.SimpleGui import *
>>> display, start_display, add_menu, add_function_to_menu = init_display()
>>> from OCC.Utils.Construct import make_edge
>>> display.DisplayShape(make_edge(gp_Pnt(), gp_Pnt(1,1,0)))
>>> start_display()
>>>
>>> -jelle
>>>
>>> See the doxygen documentation of OCC:
>>>
>>>  Standard_EXPORT  BRepBuilderAPI_MakeEdge () Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const TopoDS_Vertex &V1, const TopoDS_Vertex
>>> &V2) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const gp_Pnt &P1, const
>>> gp_Pnt &P2) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const gp_Lin 
>>> &L)Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const gp_Lin &L, const Standard_Real p1, const
>>> Standard_Real p2) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const gp_Lin
>>> &L, const gp_Pnt &P1, const gp_Pnt &P2) Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const gp_Lin &L, const TopoDS_Vertex &V1, const
>>> TopoDS_Vertex &V2) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const
>>> gp_Circ &L) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const gp_Circ &L,
>>> const Standard_Real p1, const Standard_Real p2) Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const gp_Circ &L, const gp_Pnt &P1, const
>>> gp_Pnt &P2) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const gp_Circ &L,
>>> const TopoDS_Vertex &V1, const TopoDS_Vertex &V2) Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const gp_Elips &L) Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const gp_Elips &L, const Standard_Real p1,
>>> const Standard_Real p2) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const
>>> gp_Elips &L, const gp_Pnt &P1, const gp_Pnt &P2) Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const gp_Elips &L, const TopoDS_Vertex &V1,
>>> const TopoDS_Vertex &V2) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const
>>> gp_Hypr &L) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const gp_Hypr &L,
>>> const Standard_Real p1, const Standard_Real p2) Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const gp_Hypr &L, const gp_Pnt &P1, const
>>> gp_Pnt &P2) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const gp_Hypr &L,
>>> const TopoDS_Vertex &V1, const TopoDS_Vertex &V2) Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const gp_Parab &L) Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const gp_Parab &L, const Standard_Real p1,
>>> const Standard_Real p2) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const
>>> gp_Parab &L, const gp_Pnt &P1, const gp_Pnt &P2) Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const gp_Parab &L, const TopoDS_Vertex &V1,
>>> const TopoDS_Vertex &V2) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const
>>> Handle(Geom_Curve)&L) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const
>>> Handle(Geom_Curve)&L, const Standard_Real p1, const Standard_Real p2)
>>> Standard_EXPORT  BRepBuilderAPI_MakeEdge (const Handle(Geom_Curve)&L,
>>> const gp_Pnt &P1, const gp_Pnt &P2) Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const Handle(Geom_Curve)&L, const TopoDS_Vertex
>>> &V1, const TopoDS_Vertex &V2) Standard_EXPORT  BRepBuilderAPI_MakeEdge 
>>> (const
>>> Handle(Geom_Curve)&L, const gp_Pnt &P1, const gp_Pnt &P2, const
>>> Standard_Real p1, const Standard_Real p2) Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const Handle(Geom_Curve)&L, const TopoDS_Vertex
>>> &V1, const TopoDS_Vertex &V2, const Standard_Real p1, const
>>> Standard_Real p2) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const
>>> Handle(Geom2d_Curve)&L, const Handle(Geom_Surface)&S) Standard_EXPORT
>>> BRepBuilderAPI_MakeEdge (const Handle(Geom2d_Curve)&L, const
>>> Handle(Geom_Surface)&S, const Standard_Real p1, const Standard_Real p2)
>>> Standard_EXPORT  BRepBuilderAPI_MakeEdge (const Handle(Geom2d_Curve)&L,
>>> const Handle(Geom_Surface)&S, const gp_Pnt &P1, const gp_Pnt &P2)
>>> Standard_EXPORT  BRepBuilderAPI_MakeEdge (const Handle(Geom2d_Curve)&L,
>>> const Handle(Geom_Surface)&S, const TopoDS_Vertex &V1, const
>>> TopoDS_Vertex &V2) Standard_EXPORT  BRepBuilderAPI_MakeEdge (const
>>> Handle(Geom2d_Curve)&L, const Handle(Geom_Surface)&S, const gp_Pnt &P1,
>>> const gp_Pnt &P2, const Standard_Real p1, const Standard_Real p2)
>>> Standard_EXPORT  BRepBuilderAPI_MakeEdge (const Handle(Geom2d_Curve)&L,
>>> const Handle(Geom_Surface)&S, const TopoDS_Vertex &V1, const
>>> TopoDS_Vertex &V2, const Standard_Real p1, const Standard_Real p2)
>>>
>>>
>>>
>>> On May 13, 2010, at 8:44 AM, Patrick Janssen wrote:
>>>
>>> Hi Thomas,
>>>
>>> Thanks for the quick reply - and thanks for the hard work on wrapping occ
>>> - I think it is going to be really useful for my work.
>>>
>>> By simple, I was thinking of higher level APIs - like you get with boxes
>>> and cylinders (BRepPrimAPI_MakeBox, BRepPrimAPI_MakeCylinder). I have come
>>> across GC_MakeSegment, but am not sure how to use it - I am still struggling
>>> with the fundamental concepts, especially working with these handles. I was
>>> trying this, but it gives an error:
>>>
>>> def line2():
>>>     ''' Test a line segment'''
>>>     display, start_display, add_menu, add_function_to_menu =
>>> init_display()
>>>
>>>     from OCC.gp import gp_Pnt
>>>     from OCC.GC import GC_MakeSegment
>>>     from OCC.BRepBuilderAPI import BRepBuilderAPI_MakeEdge
>>>     p1 = gp_Pnt(0,0,0)
>>>     p2 = gp_Pnt(9,9,0)
>>>     my_line = GC_MakeSegment(p1, p2).Value()
>>>     my_line = BRepBuilderAPI_MakeEdge(my_line)
>>>     my_line.Build()
>>>     my_line = my_line.Shape()
>>>     display.DisplayShape(my_line)
>>>
>>>     display.View_Iso()
>>>     display.FitAll()
>>>     start_display()
>>>
>>>
>>> ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>>> Patrick
>>>
>>> On 13 May 2010 14:11, Thomas Paviot <tpav...@gmail.com> wrote:
>>>
>>>> 2010/5/13 Patrick Janssen <patr...@janssen.name>
>>>>
>>>> I am just getting started, and have been looking at some of the exampls
>>>>> etc... So to draw a line, you would do this:
>>>>>
>>>>> def test5():
>>>>>     ''' Test creating a line segment''
>>>>>     display, start_display, add_menu, add_function_to_menu =
>>>>> init_display()
>>>>>
>>>>>     from OCC.gp import gp_Pnt, gp_Dir
>>>>>     from OCC.Geom import Geom_Line
>>>>>     from OCC.BRepBuilderAPI import BRepBuilderAPI_MakeEdge
>>>>>     p1 = gp_Pnt(0,0,0)
>>>>>     line_dir = gp_Dir(1,1,0)
>>>>>     my_line = Geom_Line(p1, line_dir).Lin()
>>>>>     my_line = BRepBuilderAPI_MakeEdge(my_line)
>>>>>     my_line.Build()
>>>>>     my_line = my_line.Shape()
>>>>>     display.DisplayShape(my_line)
>>>>>
>>>>>     display.View_Iso()
>>>>>     display.FitAll()
>>>>>     start_display()
>>>>>
>>>>>
>>>>> Is there a simpler way?
>>>>> ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>>>>> Patrick
>>>>>
>>>>>
>>>> Hi Patrick,
>>>>
>>>> In only 14 lines of python code, you manage to display a line in a 3D
>>>> window. I think it's not bad! What do you mean exactly with 'simpler'? Do
>>>> you mean 'less lines'? Whatever the alternative solution could be, you will
>>>> always have to :
>>>> * import python modules/packages,
>>>> * define two points (or a point and a direction),
>>>> * create the line from these two points,
>>>> * send the line to the renderer.
>>>>
>>>> You can use for instance high level wrappers to generate the edges from
>>>> the line:
>>>>
>>>> from OCC.Display.SimpleGui import *
>>>> display, start_display, add_menu, add_function_to_menu = init_display()
>>>> from OCC.gp import gp_Pnt, gp_Dir
>>>> from OCC.Geom import Geom_Line
>>>> from OCC.Utils.Construct import make_edge
>>>>
>>>> p1 = gp_Pnt(0,0,0)
>>>> line_dir = gp_Dir(1,1,0)
>>>> my_line = Geom_Line(p1, line_dir).Lin()
>>>>
>>>> display.DisplayShape(make_edge(my_line))
>>>>
>>>> start_display()
>>>>
>>>> This sample is 11 lines, I would not say it's simpler but smaller.
>>>>
>>>> Thomas
>>>>
>>>> _______________________________________________
>>>> 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
>>>
>>>
>>>
>>
>> _______________________________________________
>> 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
>
>
_______________________________________________
Pythonocc-users mailing list
Pythonocc-users@gna.org
https://mail.gna.org/listinfo/pythonocc-users

Reply via email to