Description

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:

image

and has no python api for bmesh.

Now this wrapper is used by a Blender addon Sverchok for a node "quadriflow":

image

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.

Dependency

This project has dependency of https://github.com/satabol/quadriflow and to build this library you have to build quadriflow library first.

Build for Windows

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

image

Now open this project with Visual Studio 2022 and check some dependencies of the project and correct these settings to you paths:

image

Now you can build the project:

image

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...

Build for Linux

Clone this repository to some linux folder:

git clone https://github.com/satabol/pyQuadriFlow.git

image

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

image

Result

Now you have two libraries for the Python package pyQuadriFlow. Copy them into the package clib folder:

image

Your python package is ready.

Test in Sverchok

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 .

image

Now start the Blender and try to import this package:

import pyQuadriFlow

image

Now lets try use a node quadriflow in Sverchok:

image

One yet example:

image

WARNING

This function is a very time consumer!!! So apply this carefully.