Comments (8)
Thanks! FWIW, here's a working version of my example recast per the new functions and classes. The last little hurdle was to realize that Python crashes if you attempt to iterate on meshlib.mrmeshpy.vectorEdgePath and meshlib.mrmeshpy.Contour3f objects, rather than index them based on their size.
import numpy as np
import meshlib.mrmeshpy as mm
import meshlib.mrmeshnumpy as mmnp
faces = np.ndarray(shape=(2,3), dtype=np.int32, buffer=np.array([[0,1,2],[0,2,3]], dtype=np.int32))
verts = np.ndarray(shape=(4,3), dtype=np.float32, buffer=np.array([[0.0,0.0,0.0],[1.0,0.0,0.0],[1.0,1.0,0.0],[0.0,1.0,0.0]], dtype=np.float32))
mesh = mmnp.meshFromFacesVerts(faces, verts)
mesh_vector_edge_pathing = mm.findRightBoundary(mesh.topology)
poly_rings = []
for i in range(mesh_vector_edge_pathing.size()):
poly_ring = mm.Polyline3()
poly_ring_first_edge = poly_ring.addFromEdgePath(mesh, mesh_vector_edge_pathing[i])
ring_pts = poly_ring.points.vec
poly_rings.append([(ring_pts[i].x, ring_pts[i].y, ring_pts[i].z) for i in range(ring_pts.size())])
from meshlib.
Ah, that makes sense -- thanks for investigating / much appreciated!
from meshlib.
Hello!
findBoundary
functoin is depricated now, there is new function
---mesh_boundary_vector_edge_path = mesh.topology.findBoundary()
+++mesh_boundary_vector_edge_path = mm.findRightBoundary( mesh.topology )
You can find this command helpful (it will show all available functions and classes)
help( mm )
from meshlib.
Thanks for feedback, we wiil have a look into iterating over internal vector structures
from meshlib.
I have jsut try simple iteration:
mesh_vector_edge_pathing = mm.findRightBoundary(mesh.topology)
assert (mesh_vector_edge_pathing.size() == len(mesh_vector_edge_pathing) )
for edgePath in mesh_vector_edge_pathing:
print(edgePath)
and it worked.
Can you please show how to reproduce crash?
from meshlib.
Thanks for looking into this. I tried a similar simple iteration and it worked. Retracing my prior tests, I see now that it is only if I include an import of pymeshlab would attempts at the same iteration crashes Python. Following your example, the [one] edgePath prints followed by a few second delay and a crash of Python. The version involved is PyMeshLab 2022.2.post4 based on MeshLab 2022.02d:
Python 3.9.18 | packaged by conda-forge | (main, Aug 30 2023, 03:40:31) [MSC v.1929 64 bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import numpy as np
>>> import meshlib.mrmeshpy as mm
>>> import meshlib.mrmeshnumpy as mmnp
>>> import pymeshlab as ml # including this creates Python crash problem for meshlib iteration
>>> faces = np.ndarray(shape=(2,3), dtype=np.int32, buffer=np.array([[0,1,2],[0,2,3]], dtype=np.int32))
>>> verts = np.ndarray(shape=(4,3), dtype=np.float32, buffer=np.array([[0.0,0.0,0.0],[1.0,0.0,0.0],[1.0,1.0,0.0],[0.0,1.0,0.0]], dtype=np.float32))
>>> mesh = mmnp.meshFromFacesVerts(faces, verts)
>>> mesh_vector_edge_pathing = mm.findRightBoundary(mesh.topology)
>>> for edgePath in mesh_vector_edge_pathing:
... print(edgePath)
...
vectorEdges[1, 9, 7, 3]
<Python crash>
from meshlib.
Very interesting, thanks for update
from meshlib.
I have investigated a little bit and here is what I've found:
pymeshlab
requires msvc-runtime (from pymeshlab) (14.34.31931)
but we build our binaries with newer version of MSVC that is distributed with our modules
looks like import pymeshlab
links older MSVCP140.dll
that overrides some functions from our linked dll.
I've swapped import lines and it worked without crash
>>> import numpy as np
>>> import pymeshlab as ml # including this creates Python crash problem for meshlib iteration
>>> import meshlib.mrmeshpy as mm
>>> import meshlib.mrmeshnumpy as mmnp
>>> faces = np.ndarray(shape=(2,3), dtype=np.int32, buffer=np.array([[0,1,2],[0,2,3]], dtype=np.int32))
>>> verts = np.ndarray(shape=(4,3), dtype=np.float32, buffer=np.array([[0.0,0.0,0.0],[1.0,0.0,0.0],[1.0,1.0,0.0],[0.0,1.0,0.0]], dtype=np.float32))
>>> mesh = mmnp.meshFromFacesVerts(faces, verts)
>>> mesh_vector_edge_pathing = mm.findRightBoundary(mesh.topology)
>>> for edgePath in mesh_vector_edge_pathing:
... print(edgePath)
...
vectorEdges[1, 9, 7, 3]
from meshlib.
Related Issues (20)
- Expose RelaxKeepVolume HOT 5
- VSCode Autocompletion of `.so` files HOT 6
- line self-intersection HOT 2
- Local setup HOT 5
- Error while showing numpad keys in F1 menu
- Negative offsetting in offsetMesh HOT 1
- Negative offset in thickenMesh results in incorrect filling of mesh HOT 3
- Readme installation steps are incorrect for Linux HOT 4
- Installation on Linux when sudo privileges are not available HOT 1
- Python Meshlib DistanceMap Interpolation Issue HOT 2
- meshlib.mrmeshpy.uniteCloseVertices does not exist in Python HOT 4
- Plane cut HOT 2
- Minkowski Sum in python HOT 2
- Problems in refine in cylinder mesh HOT 1
- add possibility to support rectangular planes
- setup z scale as ( ScaleX + ScaleY ) / 2 for plane feature HOT 1
- Creating grid meshes based on arbitrary shape input HOT 29
- Create a 3D Mesh from a list of vertices and faces. HOT 3
- Hole & Boundary edge length in Python HOT 5
- The Angle between two vectors is 0 to pi, why not 0-2pi HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from meshlib.