Search found 39 matches

Go to advanced search

by clel
Fri Feb 28, 2020 3:41 pm
Forum: Python scripting and macros
Topic: STL (Mesh) voxelization to Array
Replies: 6
Views: 329

Re: STL (Mesh) voxelization to Array

Thanks, that hint for GitHub was actually useful, although there do not seem to be much useful implementations in Python. There are pretty performant ones in C++, though. Unfortunately some require manual building which I am not capable of on my current machine, some only convert the shell of an obj...
by clel
Wed Feb 26, 2020 4:12 pm
Forum: Python scripting and macros
Topic: Convert STL to obj
Replies: 11
Views: 262

Re: Convert STL to obj

I meant why it seemed faster to convert with Mesh.export() compared to Mesh.Mesh().write(), not STL compared to obj. That is really much faster writing STL. Mesh.export() cannot be faster than Mesh.Mesh().write() because internally it has a much bigger overhead and it uses the same functions to wri...
by clel
Wed Feb 26, 2020 11:30 am
Forum: Python scripting and macros
Topic: Convert STL to obj
Replies: 11
Views: 262

Re: Convert STL to obj

I run the code from GUI. How do I invoke it from commandline? Start FreeCADCmd and try it with your biggest STL file. Copy&paste then the code (set the path names before!) to the terminal window import Mesh import time start = time.time() mesh = Mesh.Mesh() mesh.read("Set here the abs. path to the ...
by clel
Tue Feb 25, 2020 4:48 pm
Forum: Python scripting and macros
Topic: Convert STL to obj
Replies: 11
Views: 262

Re: Convert STL to obj

Ok. Then it probably seemed just faster because the test file was smaller. The code for the OBJ export seems to have much more iterations and writing probably due to the said ASCII conversion that is needed. Do you think that writing small chunks all the time to the drive is causing this or just the...
by clel
Tue Feb 25, 2020 4:05 pm
Forum: Python scripting and macros
Topic: Convert STL to obj
Replies: 11
Views: 262

Re: Convert STL to obj

Obviously this isn't the complete script but according to the function calls "Mesh" in your script is apparently the Mesh module and not an instance of the Mesh type. So, yes your script is somewhat inefficient because it creates a document, creates a mesh feature and copies the loaded mesh object....
by clel
Fri Feb 21, 2020 12:56 pm
Forum: Python scripting and macros
Topic: Convert STL to obj
Replies: 11
Views: 262

Convert STL to obj

I am looking for an efficient way to convert STL files to .obj. I plan to do this as a batch operation on a bunch of files. Unfortunately I did not find a fast way to do that. ------------ Edit: That code does not work. for entry in os.scandir(inputDir): importPath = entry.path if ".stl" in importPa...
by clel
Wed Dec 18, 2019 3:34 pm
Forum: Python scripting and macros
Topic: STL (Mesh) voxelization to Array
Replies: 6
Views: 329

Re: STL (Mesh) voxelization to Array

Thanks for mentioning it. Unfortunately that seems to be too far away for me to achieve, since it is not exposed to Python and also I don't have an idea how to use it for grid generation from Mesh files and afterwards storing its values to an Array. Probably a method like used in the thread I linked...
by clel
Wed Dec 18, 2019 3:25 pm
Forum: Python scripting and macros
Topic: Using the API
Replies: 25
Views: 1098

Re: Using the API

The problem is probably that this is not what I meant with Python documentation. But good to know that it is not lacking entirely. However it seems that all inherited classes from C classes are not there unfortunately, while I showed you that the documentation itself is present at a different place....
by clel
Fri Dec 06, 2019 10:47 am
Forum: Python scripting and macros
Topic: Using the API
Replies: 25
Views: 1098

Re: Using the API

... Then I misunderstood it when I read that. It is rather frustrating not to have any documentation available online for those generated Python classes. I think it is important to have it, since it is needed for Python scripting. There is no way that I know to easily find out the corresponding C++...
by clel
Thu Dec 05, 2019 2:25 pm
Forum: Python scripting and macros
Topic: STL (Mesh) voxelization to Array
Replies: 6
Views: 329

STL (Mesh) voxelization to Array

I am looking into ways to process CAD data with neural networks. One way would be to voxelize the data and save it into a (numpy) array that can then be used as an input for a Keras 3D convolutional layer (for example). I thought about writing a little script that takes the input data (STL) and iter...

Go to advanced search