Hi,
There was a small error in the STEPReader included in the OCC.Utils. The reading method was
artificially multiplying the number of shapes included in the STEP file. The modification proposed
below seems to be Ok.
Fabien
---------------------------------------------------------------------------------------------------
def read_file(self):
"""
Read the STEP file and stores the result in a _shapes list
"""
if not self._filename:
print "ReadFile Error: first set the filename."
return False
aReader = STEPControl_Reader()
status = aReader.ReadFile(self._filename)
if status==IFSelect_RetDone:
failsonly = False
aReader.PrintCheckLoad(failsonly, IFSelect_ItemsByEntity)
nbr = aReader.NbRootsForTransfer()
print "%i root(s)"%nbr
aReader.PrintCheckTransfer(failsonly, IFSelect_ItemsByEntity)
for n in range(1,nbr+1):
ok = aReader.TransferRoot(n)
_nbs = aReader.NbShapes()
if _nbs == 0:
print "At least one shape in STEP cannot be transfered"
elif (nbr==1 and _nbs==1):
aResShape = aReader.Shape(1)
if aResShape.IsNull():
print "At least one shape in STEP cannot be transferred"
self._shapes.append(aResShape)
else:
for i in range(1,_nbs+1):
aShape = aReader.Shape(i)
if aShape.IsNull():
print "At least one shape in STEP cannot be transferred"
else:
self._shapes.append(aShape)
return True
else:
print "Error: can't read file %s"%self._filename
return False
return False
_______________________________________________
Pythonocc-users mailing list
[email protected]
https://mail.gna.org/listinfo/pythonocc-users