This project is a Python wrapper (https://pypi.org/project/pyQuadriFlow/) of https://github.com/Satabol/QuadriFlow (is a fork of https://github.com/hjwdzh/QuadriFlow with minor). Quadriflow used in Blender:
and has no python api for bmesh.
Now this wrapper is used by a Blender addon Sverchok for a node "quadriflow":
but you can use it apart of Blender:
pip install pyQuadriFlow
Usage:
import pyQuadriFlow
pyquadriflow(
faces, # How many faces you need
seed, # random seed
mesh_vertices, # mesh vertices [ [x0,y0,z0], [x1,y1,z1], ...]
face_indexes, # list of face indices as triangles: [[0,1,2],[1,2,3],...]
flag_preserve_sharp,
flag_preserve_boundary,
flag_adaptive_scale,
flag_aggresive_sat,
flag_minimum_cost_flow
)
If you use this function apart of Blender you have to do triangulation before call this function. But Blender node quadrimesh do traingulation before call this function.
This project has dependency of https://github.com/satabol/quadriflow and to build this library you have to build quadriflow library first.
After a build of https://github.com/satabol/quadriflow you can continue build this repository. Clone this repository to some folder:
git clone https://github.com/satabol/pyQuadriFlow.git
Now open this project with Visual Studio 2022 and check some dependencies of the project and correct these settings to you paths:
Now you can build the project:
If all good you get a file with a name ctypes_QuadriFlow.dll It is a first file for package.
Now lets build a library static file (ctypes_QuadriFlow.so) for Linux...
Clone this repository to some linux folder:
git clone https://github.com/satabol/pyQuadriFlow.git
Run command to build library:
g++ ctypes_QuadriFlow.cpp -L/opt/github.com/quadriflow/build -l:libquadriflow.a -I /opt/github.com/quadriflow/src -I /opt/github.com/eigen/build/include/include/eigen3 -o ctypes_QuadriFlow.so -fPIC -shared
Now you have two libraries for the Python package pyQuadriFlow. Copy them into the package clib folder:
Your python package is ready.
To install this package into the Blender python package repository:
"E:\install\Blender\blender-3.6.12-windows-x64\3.6\python\Scripts\pip.exe" install .
Now start the Blender and try to import this package:
import pyQuadriFlow
Now lets try use a node quadriflow in Sverchok:
One yet example:
This function is a very time consumer!!! So apply this carefully.