pythonocc-utils
pythonocc-utils copied to clipboard
OCCUtils, Common, point_in_solid Function Issue
Hello everyone, and hope for your well-being.
I faced a problem when I tried to use the point_in_solid function from OCCUtils. Actually, sometimes when I use this function with a shape (indeed it is an IfcSpace) and a point (which I know is inside the shape), it returns "False" (as the point is not in the shape!!).
Does anyone know what the problem is? Actually, I test this function with several points and several shapes and I do not know why it returns erroneous values. One more thing; what is the geometry data that defines a TopoDS_Shape?! Is that a Mesh that surrounds the shape? Thank you.
import ifcopenshell
import ifcopenshell.geom
import OCC.Core
from OCCUtils.Common import point_in_solid
from OCC.Core.gp import gp_Pnt, gp_Vec, gp_Trsf
ifc_file = ifcopenshell.open(r'C:\Users\PATH\MyProject3.ifc')
space = ifc_file.by_guid('1YaheuayH6kBI6D9$zc5YL')
settings = ifcopenshell.geom.settings()
settings.set(settings.USE_PYTHON_OPENCASCADE, True)
product = ifcopenshell.geom.create_shape(settings, space)
aShape = OCC.Core.TopoDS.TopoDS_Shape(product.geometry)
thePoint = gp_Pnt(2.6644,-0.5839,15)
print(point_in_solid(aShape, thePoint)) ### Should return True, but returns False!
Here is the out put of the code: