Skip to content

Commit

Permalink
Merge branch 'fix/env_meshlib_python_version' into wip/pip_build
Browse files Browse the repository at this point in the history
  • Loading branch information
oitel committed Jul 9, 2024
2 parents feeadea + f3ed860 commit 50c6e5b
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 6 deletions.
4 changes: 2 additions & 2 deletions source/MRMesh/MRPython.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ MR_ADD_PYTHON_CUSTOM_DEF( moduleName, name##_inst_, [] ( pybind11::module_& modu
* @endcode
* See also \ref MR_ADD_PYTHON_VEC and \ref MR_ADD_PYTHON_MAP macros for customized class definition examples.
*/
#define MR_ADD_PYTHON_CUSTOM_CLASS( moduleName, name, type ) \
MR_ADD_PYTHON_CUSTOM_CLASS_DECL( moduleName, name, type ) \
#define MR_ADD_PYTHON_CUSTOM_CLASS( moduleName, name, ... ) \
MR_ADD_PYTHON_CUSTOM_CLASS_DECL( moduleName, name, __VA_ARGS__ ) \
MR_ADD_PYTHON_CUSTOM_CLASS_INST( moduleName, name )

#define MR_ADD_PYTHON_VEC( moduleName, name, type) \
Expand Down
24 changes: 20 additions & 4 deletions source/mrmeshpy/MRPythonBooleanExposing.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,29 @@
#include "MRMesh/MRMeshBoolean.h"
#include "MRMesh/MRUniteManyMeshes.h"
#include "MRMesh/MRId.h"

#include <pybind11/functional.h>

#include <variant>

MR_ADD_PYTHON_CUSTOM_CLASS( mrmeshpy, EdgeTri, MR::EdgeTri )

MR_ADD_PYTHON_CUSTOM_CLASS( mrmeshpy, VariableEdgeTri, MR::VariableEdgeTri, MR::EdgeTri )

MR_ADD_PYTHON_CUSTOM_CLASS( mrmeshpy, OneMeshIntersection, MR::OneMeshIntersection )

MR_ADD_PYTHON_CUSTOM_CLASS( mrmeshpy, OneMeshContour, MR::OneMeshContour )

MR_ADD_PYTHON_CUSTOM_DEF( mrmeshpy, MeshIntersectinosTypes, [] ( pybind11::module_& m )
{
pybind11::class_<MR::EdgeTri>( m, "EdgeTri", "edge from one mesh and triangle from another mesh" ).
MR_PYTHON_CUSTOM_CLASS( EdgeTri ).doc() =
"edge from one mesh and triangle from another mesh";
MR_PYTHON_CUSTOM_CLASS( EdgeTri ).
def( pybind11::init<>() ).
def_readwrite( "edge", &MR::EdgeTri::edge ).
def_readwrite( "tri", &MR::EdgeTri::tri );

pybind11::class_<MR::VariableEdgeTri, MR::EdgeTri>( m, "VariableEdgeTri" ).
MR_PYTHON_CUSTOM_CLASS( VariableEdgeTri ).
def( pybind11::init<>() ).
def_readwrite( "isEdgeATriB", &MR::VariableEdgeTri::isEdgeATriB );

Expand All @@ -31,7 +43,9 @@ MR_ADD_PYTHON_CUSTOM_DEF( mrmeshpy, MeshIntersectinosTypes, [] ( pybind11::modul
def( "getEdge", [] ( const OneMeshIntersectionVariant& self ) { return std::get<MR::EdgeId>( self ); } ).
def( "getVert", [] ( const OneMeshIntersectionVariant& self ) { return std::get<MR::VertId>( self ); } );

pybind11::class_<MR::OneMeshIntersection>( m, "OneMeshIntersection", "Simple point on mesh, represented by primitive id and coordinate in mesh space" ).
MR_PYTHON_CUSTOM_CLASS( OneMeshIntersection ).doc() =
"Simple point on mesh, represented by primitive id and coordinate in mesh space";
MR_PYTHON_CUSTOM_CLASS( OneMeshIntersection ).
def( pybind11::init<>() ).
def_readwrite( "primitiveId", &MR::OneMeshIntersection::primitiveId ).
def_readwrite( "coordinate", &MR::OneMeshIntersection::coordinate );
Expand All @@ -55,7 +69,9 @@ MR_ADD_PYTHON_VEC( mrmeshpy, vectorOneMeshIntersection, MR::OneMeshIntersection

MR_ADD_PYTHON_CUSTOM_DEF( mrmeshpy, MeshIntersectinosTypes2, [] ( pybind11::module_& m )
{
pybind11::class_<MR::OneMeshContour>( m, "OneMeshContour", "One contour on mesh" ).
MR_PYTHON_CUSTOM_CLASS( OneMeshContour ).doc() =
"One contour on mesh";
MR_PYTHON_CUSTOM_CLASS( OneMeshContour ).
def( pybind11::init<>() ).
def_readwrite( "intersections", &MR::OneMeshContour::intersections ).
def_readwrite( "closed", &MR::OneMeshContour::closed );
Expand Down

0 comments on commit 50c6e5b

Please sign in to comment.