looo wrote: ↑Fri Jun 24, 2022 9:39 am
What functionality do you need from pythocc. Maybe you can make a feature request so Freecad-developers can add this functionality.
I use it in the following code for my most important project:
Code: Select all
from OCC.Core.BRepProj import BRepProj_Projection
from OCC.Core.gp import gp_Dir
def project(curve, surface, direction):
"""Cylindrical projection of a curve onto a surface.
Parameters
----------
curve : Part.Wire
Curve to be projected.
surface : Part.Face
Surface to project onto.
direction : tuple of float
Direction vector of the projection, tuple of three numbers.
Returns
-------
Part.Compound
A compound object, containing the parts of the projected curve.
Raises
------
Exception
If the projection algorithm of OpenCASCADE fails. This typically happens if the
projected curve would not lie on the surface.
Notes
-----
This function is a wrapper around the cylindrical projection functionality available in
OpenCASCADE. For details, see its documentation:
https://dev.opencascade.org/doc/refman/html/class_b_rep_proj___projection.html
"""
curve = Part.__toPythonOCC__(curve)
surface = Part.__toPythonOCC__(surface)
projection_direction = gp_Dir(*direction)
proj = BRepProj_Projection(curve, surface, projection_direction)
if not proj.IsDone():
raise Exception('Projection failed.')
return Part.__fromPythonOCC__(proj.Shape())
I have other, less important, projects where I use OCC here and there. It would be nice if it was shipped with FreeCAD, so the users would not need to manually compile it or fetch the binaries from conda.