taxpon / openpyscad

Python library to generate OpenSCAD source code. This library provides intuitive interface when you handle 3D data.
https://pypi.org/project/openpyscad/
MIT License
117 stars 21 forks source link

How do I read graphic data in a python recognized type? #20

Open Frank-bool opened 4 years ago

Frank-bool commented 4 years ago
a = ops.Cube([10,10,10])
b = ops.Cube([4,4,4]).translate([4,4,4])

c = a & b

For example, how do I read data from c in a format that python recognizes,such as math, np.array and so on.

Or how do I know if A is empty? The A here is the graph after the combination of graphics logic. Since I need to perform logical operation on the created graph, I want to know whether the graph is intersected by logical operation.

I couldn't find an operation to convert the data from solidpython into a type recognized by python.

Thank you very much!

taxpon commented 4 years ago

@Frank-bool This tool does generate scad text source code. This doesn't calculate any mathematical stuff, which should be done in OpenSCAD itself. You can just get values you put in, but that's it.

>>> a = ops.Cube([10,10,10])
>>> print(a.size)
[10, 10, 10]
>>> b = ops.Cube([4,4,4]).translate([4,4,4])
>>> print(b.v)
[4, 4, 4]

Or how do I know if A is empty? Sorry I am not sure what do you mean by A.