#python #vector #surface #plane #opencascade
Вопрос:
При отладке с предыдущего кода Python (2.7) по (3.7) появлялись сообщения об ошибках. (от pythonocc-core==0.18.1 до pythonocc-core=7.4.1) Сначала я применил 2to3.py, но код нуждался в дальнейшей отладке. Следующий код вызвал ошибку в «plane = OCC.Core.Geom.Geom_Plane(поверхность)» Как я могу решить эту проблему?
код:
for idx, ElementPolygon in enumerate(Polygons):
# The space boundary must have a corresponding building element.
if self.IfcFile.by_guid(CurrentSpace).BoundedBy[idx].RelatedBuildingElement!=None:
# Generate the pythonOCC face corresponding to the geometric representation of the space boundary
ElementFace = self.__CreateFaceAndRemoveOpenings(ElementPolygon, Polygons, CurrentSpace, idx,RelatedBuildingElement)
# Identify the normal vector to the face
Surface = OCC.Core.BRep.BRep_Tool.Surface(ElementFace)
plane = OCC.Core.Geom.Geom_Plane(Surface) #TODO check OCC documentation for changes (downcast no longer needed, error handling: surface need not be a plane ?)
face_bbox = OCC.Core.Bnd.Bnd_Box()
OCC.Core.BRepBndLib.brepbndlib_Add(ElementFace, face_bbox)
face_center = get_bounding_box_center(face_bbox).XYZ()
vv = face_center - SpaceBoxCenter.XYZ()
face_normal = plane.Axis().Direction().XYZ()
if face_normal.Dot(vv)>=0:
face_normal = face_normal
else:
face_normal = plane.Axis().Direction().XYZ().Reversed()
сообщение об ошибке:
File "C:0_PhDDevifc2modelicaEnvelopCreateNetworkEnvelop.py", line 586, in CreateNetwork
plane = OCC.Core.Geom.Geom_Plane(Surface) #TODO check OCC documentation for changes (downcast no longer needed, error handling: surface need not be a plane ?)
File "C:WorkdirProgramsAnaconda3envspy37_64libsite-packagesOCCCoreGeom.py", line 7941, in __init__
_Geom.Geom_Plane_swiginit(self, _Geom.new_Geom_Plane(*args))
TypeError: Wrong number or type of arguments for overloaded function 'new_Geom_Plane'.
Possible C/C prototypes are:
Geom_Plane::Geom_Plane(gp_Ax3 const amp;)
Geom_Plane::Geom_Plane(gp_Pln const amp;)
Geom_Plane::Geom_Plane(gp_Pnt const amp;,gp_Dir const amp;)
Geom_Plane::Geom_Plane(Standard_Real const,Standard_Real const,Standard_Real const,Standard_Real const)