Comments (28)
from sverchok.nodes.generator.torus import torus_verts, torus_edges, torus_polygons
from svrx.util.geom import vectorize
from svrx.util.smesh import SMesh
@vectorize
def make_torus(R, r, N1, N2, rPhase, sPhase):
v = torus_verts(R, r, N1, N2, rPhase, sPhase, False)[0]
e = torus_edges(N1, N2)
f = torus_polygons(N1, N2)
return SMesh.from_pydata(v, e, f).as_rxdata
@node_script
def sn_torus(
R: Float = 2.0, r: Float = 0.6,
N1: Int = 22, N2: Int = 15,
rPhase: Float = 0.0,
sPhase: Float = 0.0) -> ([Vertices], [Edges], [Faces]):
return list(make_torus(R, r, N1, N2, rPhase, sPhase))
hahaha :)
from sverchok.
almost..
from sverchok.nodes.generator.sphere import sphere_verts, sphere_edges, sphere_faces
from svrx.util.geom import vectorize
from svrx.util.mesh import rxdata_from_pydata
@vectorize
def make_sphere(U, V, Radius):
v = sphere_verts(U, V, Radius, False)
e = sphere_edges(U, V)
f = sphere_faces(U, V)
return rxdata_from_pydata(v, e, f)
@node_script
def sn_sphere(U: Int = 12, V: Int = 10, Radius: Float = 1.0) -> ([Vertices], [Edges], [Faces]):
return list(make_sphere(U, V, Radius))
from sverchok.
Absolutely needed.
from sverchok.
I really need to sort out the generator pattern.
Otherwise I will have a check at it tomorrow.
from sverchok.
For sn it works quite well to import from Sverchok, nice touch :)
from sverchok.
I keep getting called away.. can barely finish thoughts :/ but it seems SN is showing Int / Float as property names instead of U..V..Radius.. now?
from sverchok.
from sverchok.
Most have messed up then. Will take look at that.
from sverchok.
edges (even though they would be skipped with this example's full polygon count) gives an error
File "svrx\util\mesh.py", line 47, in bmesh_from_pydata
if not edges is None and len(edges):
TypeError: object of type 'SvEdges' has no len()
does SvEdges
need a def __len__
or what
from sverchok.
Ok I see what I did, not to clever.
from sverchok.
Yes for that to work, that len check feels a bit redundant
from sverchok.
agreed
from sverchok.
from sverchok.
Fixed the name issue in master
from sverchok.
a ha!
def rxdata_from_pydata(verts, edges=None, faces=None):
# v = SvVertices.from_pydata(verts)
# e = SvEdges.from_pydata(edges)
# f = SvPolygon.from_pydata(faces)
# return v, e, f
rxm = SMesh.from_pydata(verts, edges, faces)
return rxm.vertices, rxm.edges, rxm.faces
from sverchok.
how about SMesh.from_pydata(verts, edges, faces).as_rxdata
from sverchok.
seems to work :) but i'm sure i've not dealt well with the scenario of empty lists...
from sverchok.
The empty scenario is a tricky scenario...
A property makes sense since it is basically not any heavy computed data but free.
from sverchok.
we need to be strict with Generators that land in SvRx. They must be numpy only. else it's a scriptnode.
from sverchok.
or we give them a prefix to the bl_idname/label ..
from sverchok.
Initially we should be strict with everything while we test out what works and what doesn't.
Tomorrow I will tackle the generator pattern, it feels like a clean solution could be done quite easily.
from sverchok.
(had copy paste mistake in above snippet)
from sverchok.
OK. that's enough for now. let me know if you want to merge the PR. #34
from sverchok.
Done
from sverchok.
I really miss the opengl viewer, thinking about a quick hack to port it.
Or even just abusing the sverchok built in one via import for now...
from sverchok.
..and indexviewer... but as it was originally made .. not with the extra baking, placing screen text on verts/edges/faces should be its own node.
from sverchok.
@zeffii @ly29
openGL viewer need to be different, + 2.8 blender will be with other BGL
Maybe to include in new version osl or something. shading+lighting in bgl, as i wanted long ago.
PS
where is 2.8 BGL to see?
from sverchok.
@nortikin
For 2.8 yes, but it will be some time before that happens. For 2.78b where we are now and 2.79 bgl will still be there.
from sverchok.
Related Issues (20)
- Documentation HOT 8
- Int and Float socket can be limited HOT 2
- BMesh nodes HOT 10
- Dynamic Socket Issues HOT 3
- API to simplify mesh creation HOT 3
- The great namning debacle HOT 18
- Node wishlist HOT 48
- stethoscope v2 HOT 44
- startup error message HOT 1
- Timings HOT 74
- .foreach mesh out HOT 15
- torus np scriptnode HOT 39
- Rx Bridges (remakes of real bridges) HOT 1
- Texture script node HOT 52
- Index Viewer HOT 70
- Linspace and arrange HOT 16
- Some refactoring going on HOT 5
- OpenGL viwers HOT 39
- vectorization concept HOT 2
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 sverchok.