nortikin / sverchok

Sverchok
http://nortikin.github.io/sverchok/
GNU General Public License v3.0
2.23k stars 232 forks source link

Lathe Node (bmesh.spin) #203

Closed zeffii closed 10 years ago

zeffii commented 10 years ago

Probably time to make a lathe Node, similar to Screw modifier or Spin tool. I already have workhorse code written just need to relocate it.

input (optional arguments have defaults and will use last provided if found)

  • points
  • (optional) edges [default=(0,0,0)]
  • (optional) rotation center [default=(0,0,0)]
  • (optional) rotation axis [default=(0,0,1)]
  • (optional) rotation delta vector [default=(0,0,0)] (used to translate each next segment)
  • (optional) rotation angle [default=360]
  • (optional) steps [default=20]

Ui switches

  • Merge, ticked means remove doubles

output

  • new verts
  • new edges

No ETA, but probably today

zeffii commented 9 years ago

I wrote an image decomposer a while back for Sverchok, so the tricky bit is solved already.. it just won't be very fast. It might be faster to call a javascript routine from Sverchok and read the output as a 1D array, which we can reshape to a 2D array of grayscale values.

ghost commented 9 years ago

Paper.js , CAD_utils and image decomposer. too many awesome staff to digest in such late hour :) difenetly will try all of them tomorrow. Again Thank you for what you are doing here, respect.

zeffii commented 9 years ago

image

heres a SN1 script for a spiral

import math

def sv_main(num=3100, radius=8.95):
    verts_out = []

    in_sockets = [
        ['s', 'num', num],
        ['s', 'radius', radius]
    ]

    out_sockets = [
        ['v', 'verts', verts_out]
    ]

    c = 0.1 # scale factor
    av = verts_out.append
    for i in range(0, num):
        r = c * math.sqrt(i) * radius
        theta = i * math.radians(137.5/(r+0.001))
        amp = r / 6
        av((math.cos(theta) * amp, math.sin(theta) * amp, 0.0))

    return in_sockets, out_sockets
ghost commented 9 years ago

Thanks, i will try it, actually i managed to do it with Line node and Rotation Node, but this will be much easier i think .

ghost commented 9 years ago

By the way, how can i read the existing nodes script to fork it ? i will learn faster by reading those scripts than manuals.

zeffii commented 9 years ago

i'm not sure I follow, you want to be able to fork a loaded SN script, and load the fork automatically? Not a bad idea, but not currently implemented. I doubt we will implement a version control system in the near future, mostly because it's not the way I work with SN and I doubt the others of the group do either. If we want to preserve a file in TextEditor, simply make a copy of the good one and paste it into a new bpy.data.text, and go back to the file you copied from and continue to work on that file. It's rare that I do that, but it does happen, a forking mechanism would be useful

If you load Scripts using the built in drop-down, those scripts are loaded from disk into bpy.data.texts[] you never actually overwrite them if you make changes, if you were afraid of persistent changes.

zeffii commented 9 years ago

A short term solution would be to add an operator to 'duplicate current text into a new bpy.data.text' and keep showing the current text. Before duplication i would then write as a comment at the top of the good file something like "this version works" .. and then remove it again after the duplication so as to not get confused between what works and what doesn't .

ghost commented 9 years ago

I was asking how can i read the actual scripts of the implemented nodes, (line, circles, vectors in ... etc.) so i can learn about scripting faster, so may i will be able to create my own nodes in the future.

For instance, i would like to read the Line Node script to figure ot if i can adjust it to take different inputs : ( length, divisions) , as i think this is more useful.

zeffii commented 9 years ago

Ok, start a new issue with that question "how to study the code of nodes".