2010/4/29 Tobias Mueller <i...@calcing.de> > Dear Jelle, > > as a new user of pythonocc I installed it on suse-linux and would like to > try > your example regarding the spline approximation, but with you code I got > the > following error message (your code is included in the file 'naca.py'): > > Could you please give me a hint for exporting the spline into a step file - > my > goal would be the creation of a 3D-type structure like Marcos is trying for > ? > > tmuel...@linux-tmueller:~/work/PythonOCC/Examples/PAF> python naca.py > Traceback (most recent call last): > File "naca.py", line 2, in <module> > from OCC.Utils.Common import interpolate_points_to_spline_no_tangency > File "/usr/lib/python2.6/site-packages/OCC/Utils/__init__.py", line 2, in > <module> > from Topology import Topo > File "/usr/lib/python2.6/site-packages/OCC/Utils/Topology.py", line 2 > seq.append(topo_to_add) occ_iterator.Next() return > iter(seq) self.done = True def ordered_edges(self): return > self._loop_topo(edges=True) def ordered_vertices(self): > return > self._loop_topo(edges=False)class Topo(object): ''' sketch for a > pythonic topology wrapper note that `myShape` should be self, which is > in > return a occ.TopoShape with this ''' def __init__(self, myShape): > # assert isinstance( myShape, occ.TopoShape), '% is not a TopoShape > instance' > % (myShape.__class__) self.myShape = myShape def _loop_topo(self, > topologyType, topologicalEntity=None, topologyTypeToAvoid=None): ''' > this could be a faces generator for a python TopoShape class that > way > you can just do: for face in srf.faces: processFace(face) > ''' tds = TopoDS.TopoDS() topoTypes = { TopAbs_VERTEX: > tds.Vertex, TopAbs_EDGE: tds.Edge, > TopAbs_FACE: tds.Face, TopAbs_WIRE: > tds.Wire, TopAbs_SHELL: tds.Shell, > TopAbs_SOLID: tds.Solid, TopAbs_COMPOUND: > tds.Compound, TopAbs_COMPSOLID: tds.CompSolid, > } assert topologyType in topoTypes.keys(), '%s not one of %s' > %( > topologyType, topoTypes.keys() ) self.topExp = > TopExp_Explorer() > # use self.myShape if nothing is specified if topologicalEntity is None > and > topologyTypeToAvoid is None: self.topExp.Init(self.myShape, > topologyType) elif topologicalEntity is None and > topologyTypeToAvoid is not None: self.topExp.Init(self.myShape, > topologyType, topologyTypeToAvoid) elif > topologyTypeToAvoid > is None: self.topExp.Init(topologicalEntity, topologyType ) > elif topologyTypeToAvoid: self.topExp.Init(topologicalEntity, > topologyType, topologyTypeToAvoid) topo_set = set() > ^ > IndentationError: unexpected indent > > > Hi Tobias,
The Topology.py module included in the OpenSuse package seems to be corrupted due to bad line-ending. Try to replace /site-packages/OCC/Utils/Topology.py with the one attached and run the example again. Regards, Thomas
Topology.py
Description: Binary data
_______________________________________________ Pythonocc-users mailing list Pythonocc-users@gna.org https://mail.gna.org/listinfo/pythonocc-users