If you have any question you would like to be answered in private mode, please send an email to Thomas Paviot, project leader at tpaviot_at_gmail_dot_com.
Contact Development Team
– March 11, 2010Posted in: Contact/ML
If you have any question you would like to be answered in private mode, please send an email to Thomas Paviot, project leader at tpaviot_at_gmail_dot_com.
hi Mr
i have a problem with the execution,they demand a ‘backen’ and i had insert it.so what should i do?
here is my program:
#-*- coding:cp1252 -*-
from OCC.Display.SimpleGui import *
import keyring.backend
set_backend(‘WX’)
display, start_display, add_menu, add_function_to_menu = init_display()
def simple_test(event=None):
display.Test()
def simple_cylinder(event=None):
from OCC.BRepPrimAPI import BRepPrimAPI_MakeCylinder
s = BRepPrimAPI_MakeCylinder(60, 200)
display.DisplayShape(s.Shape())
add_menu(‘simpletest’)
add_function_to_menu(‘simpletest’,simple_test)
add_function_to_menu(‘simpletest’,simple_cylinder)
display.View_Iso()
display.FitAll()
start_display()
The string passed to the set_backend function is case sensitive. Use:
set_backend(‘wx’)
Hi,
I want to ask if there are any planes to edit pythonOCC for python 3.1
Thanks
The development of pythonOCC is currently performed mostly on 2.X python releases, especially 2.5 or 2.6. Support for Python3 has not been ever tested but it should work : the SWIG wrapper generator is Python3k compliant since the 1.3.37 release. Any feedback dealing with that topic is welcome.
thank you, I will try it
Hi Thomas,
it seems pythonOCC has a problem to create a TopoDS Face with the BRepBuilder if the supplied wire has edges other than straight lines. If the edges are e.g. BSplines the border of the face seems not to be recognized correctly. Do you know about an issue with this (or am I doing something wrong maybe).
By the way: thanks for your great Python-port of the OCC-Library!
I don’t know any issue related to the BRep_Builder class and BSpline edges. Can you provide an simple example that reproduces the error?
Hi Thomas,
following some code that seems to produce a correct wire but no face (at least none is displayed).
ptary = TColgp_Array1OfPnt2d(1, 3)
ptary.SetValue(1, gp_Pnt2d(0.0, 0.0))
ptary.SetValue(2, gp_Pnt2d(1.0, 0.0))
ptary.SetValue(3, gp_Pnt2d(1.0, 1.0))
spline = Geom2dAPI_PointsToBSpline(ptary)
origin = gp_Pnt(0.0, 0.0, 0.0)
normal = gp_Dir(gp_XYZ(0.0, 0.0, 1.0))
plane = gp_Pln(origin, normal)
geom_plane = Geom_Plane(plane)
edge = BRepBuilderAPI_MakeEdge(spline.Curve(), geom_plane.GetHandle())
trim_start = Geom2dAPI_ProjectPointOnCurve(gp_Pnt2d(0.0, 0.0), spline.Curve()).LowerDistanceParameter()
trim_end = Geom2dAPI_ProjectPointOnCurve(gp_Pnt2d(1.0, 1.0), spline.Curve()).LowerDistanceParameter()
trim_edge = BRepBuilderAPI_MakeEdge(spline.Curve(), geom_plane.GetHandle(), trim_start, trim_end)
spline_points = GCPnts_UniformAbscissa(BRepAdaptor_Curve(trim_edge.Edge()), 5)
line = Geom2d_Line(gp_Pnt2d(0.0, 0.0), gp_Dir2d(gp_Pnt2d(1.0, 1.0).XY()))
line_qualified = Geom2dGcc_QualifiedCurve(Geom2dAdaptor_Curve(line.GetHandle()), GccEnt_unqualified)
fillet_trimparam_start = Geom2dAPI_ProjectPointOnCurve(gp_Pnt2d(0.0, 0.0), line.GetHandle()).LowerDistanceParameter ()
fillet_trimparam_end = Geom2dAPI_ProjectPointOnCurve(gp_Pnt2d(1.0, 1.0), line.GetHandle()).LowerDistanceParameter ()
line_edge = BRepBuilderAPI_MakeEdge(line.GetHandle(), geom_plane.GetHandle(),fillet_trimparam_start,fillet_trimparam_end )
wire = ShapeExtend_WireData()
wire.Add(trim_edge.Edge())
wire.AddOriented(line_edge.Edge(),0)
wire.ComputeSeams()
face = BRepBuilderAPI_MakeFace(plane, wire.Wire())
display.SetModeShaded()
display.EraseAll()
display.DisplayShape(wire.Wire())
display.DisplayShape(face.Shape())
display.Repaint()
start_display()
Hello Jochen,
PythonOCC is much more fun than you think it is!
Its impressive to see how deep you went into the OCC API in a short time.
Are you familiar with it ( perhaps from a C++ perspective )?
I was able to reduce your code to the following:
=============================================
from OCC.Utils.Construct import *
from OCC.Utils.Common import *
from OCC.Display.SimpleGui import init_display
display, start_display, add_menu, add_function_to_menu = init_display()
pnts = [gp_Pnt(0.0, 0.0, 0),
gp_Pnt(1.0, 0.0, 0),
gp_Pnt(1.0, 1.0, 0),
]
spline = points_to_bspline(pnts)
spl_edge = make_edge(spline)
line_edge = make_edge(gp_Pnt(0,0,0), gp_Pnt(1,1,0))
wi = make_wire([line_edge, spl_edge])
fa = make_face(wi)
display.DisplayShape([wi,fa])
display.DisplayShape(map(make_vertex, pnts))
start_display()
=============================================
Doesn’t that look much more appealing to you?
( at some point, fewer lines would make the above more difficult to understand
The objective of the pythonocc project is twofold. We’re making an effort to do more than “just” offer you a CAD API, we try to make it pythonic.
Thanks for your interest in pythonocc,
-jelle
Hi all !
I’m trying to use pythonOCC on my ubuntu 10.04 but I have a strange error :
Display3d class initialization starting …
Graphic device created.
Xw_Window created.
Viewer created.
Erreur de segmentation
If I look into syslog I found :
kernel: [ 3869.619578] python[13439]: segfault at 38 ip b71835c0 sp bfcbbfa0 error 4 in i965_dri.so[b7149000+29d000]
I think it’s more an intel bug than pythonocc one but if I try to use freecad (which depend on opencascade too) it’s works !
So, maybe there’s something missing in pythonocc ?
Hi Sébastien,
This problem has been discussed on the ml (see the related thread on mail-archive.com).
I think it’s something related to the graphic driver, and recently updated the code. You should checkout/compile the svn trunk to check whether or not the problem is solved.