admesh / python-admesh Goto Github PK
View Code? Open in Web Editor NEWCython wrapper around admesh
License: GNU General Public License v2.0
Cython wrapper around admesh
License: GNU General Public License v2.0
So people can catch it explicitly.
Python2 binding is working fine. The problem is with python3:
python3 -c'from admesh import Stl; stl = Stl("block.stl")'
Traceback (most recent call last):
File "", line 1, in
File "admesh.pyx", line 21, in admesh.Stl.cinit (admesh.c:1394)
File "admesh.pyx", line 25, in admesh.Stl.open (admesh.c:1466)
TypeError: expected bytes, str found
block.stl is from admesh source tarball
https://github.com/admesh/admesh/blob/master/block.stl
Thanks
This is a question and/or a feature request.
Currently I use python-admesh for loading a mesh from a named file:
admesh.Stl("filename.stl")
In order to support other input methods (e.g. download via http), I would like to read data from a stream (i.e. something that supports the "read" method):
# fictional code
open_file = open("filename.stl", "rb")
mesh = admesh.Stl()
mesh.read_from(open_file)
Additionally I would like to export a mesh as an STL file. This mesh consists of facets, that I am using (and processing) inside of my application. Thus I would appreciate something like this:
# fictional code
mesh = admesh.Stl()
for vertices, normal in my_facets:
mesh.add_facet(vertices, normal)
Both approaches are currently not possible with python-admesh - correct?
Would these operations be within admesh's scope? If yes: do you have suggestions, how to implement these?
Attempting to make a deep copy and modify it
from copy import deepcopy
stl = admesh.Stl('hellskull.stl')
stl_copy = deepcopy(stl)
stl_copy.rotate_z(5)
results in admesh.AdmeshError: STL not opened
.
The file is missing -> tests won't run.
There is a problem with compiling the latest version. It fails with the following message:
cythoning admesh.pyx to admesh.c
Error compiling Cython file:
------------------------------------------------------------
...
def __next__(self):
if self._iterindex >= len(self):
raise StopIteration
self._iterindex += 1
return self._c_stl_file.facet_start[self._iterindex - 1]
^
------------------------------------------------------------
admesh.pyx:41:43: Cannot convert 'stl_facet' to Python object
Error compiling Cython file:
------------------------------------------------------------
...
def facet_stats(self, facet, first):
"""stl_facet_stats"""
if not self._opened:
raise AdmeshError('STL not opened')
stl_facet_stats(&self._c_stl_file, facet, first)
^
------------------------------------------------------------
admesh.pyx:419:48: Cannot convert Python object to 'stl_facet'
building 'admesh' extension
Hi,
I installed python-admesh 0.98.2 on Mac OS X Yosemite. I tried to get the size and volume of an still file from python but all I get is None
I ran following code in python:
from admesh import Stl
stl = Stl('test/block.stl')
print stl.get_size()
print stl.calculate_volume()
However I get the stats when I run admesh test/block.stl
no problem.
Am I missing something here?
Thanks
ADMesh stl_file
consists of several components including stats and the array of facets. Those are hidden in python-admesh and unreachable from Python.
Thanks for the bindings, love it !
It seems that the surface area is missing from the ctypedef hence not accessible through the admesh.Stl objects
See: https://github.com/admesh/python-admesh/blob/v0.98.5/_cadmesh.pxd#L43
Should I create a pull request ?
Hi,
i had a problem with installation on my mac. It looks like method get_header from autogen.py doesn't work with clang (it could not find cc1 command).
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.