4
$\begingroup$

If I have a list of vectors, is it possible to create an object (e.g. a cube) centred on each vector in the list, using Sverchok? If so, how can this be done?

$\endgroup$
7
$\begingroup$

There is a lot of steps to make this happen, but it is pretty simple, so here it goes:

  1. Make sure that you put your list in a .txt file - for this example call it PointList.txt, and it will use the CSV format.

  2. Load this file into Blender.
    Note: In this format every line in the file is one point location in X,Y,Z:

    Point List

  3. In the 3D Viewport Add a Cube - Shift+A >> Mesh >> Cube.

  4. In the Node Editor Add a Text Input Node - Shift+A >> Text >> Text in.

  5. Set your Text Input Node to have the following settings & Click Load:

    Example of click on Load
    Csv, User defined Dialect, "," Delimiter, "." Decimalmark

  6. Next Add a Vectors In Node - Shift+A >> Vector >> Vector in and connect your Text Input Node to like the following:

    Connected Vector Node
    Col 0 -> X, Col 1 -> Y, Col 2 -> Z

  7. Next Add a Matrix In Node - Shift+A >> Matrix >> Matrix in and connect your Vectors Output of your Vectors In Node to Matrix In Node at its Location socket:

    Added Matrix In Node

  8. Next Add a Sv Instancer Node - Shift+A >> Scene >> Mesh instancer. Then ensure that your Object Name is set to the name of the Cube that you added in Step 3. above, click "use" and connect the two Matrix Sockets between the Nodes like the following:

    SV Instancer Node hints

Result:

Working example


To help you convert your data format, here is a screenshot of how to convert the format that you have shown in your comment:

Python Console Screenshot for conversion

$\endgroup$
  • $\begingroup$ Hrm... this totally doesn't work for me. I don't know why. The output of Vectors In (using a stethoscope is [[(0,0,0), (5,0,0),... ]]1. I have the cube at the origin. I see some alpha objects in the outliner view, but not in the 3D view.. $\endgroup$ – naught101 Mar 25 '16 at 9:34
  • $\begingroup$ Oooh, cool, I found another way to do it. Cube -> Object In -> Viewer Draw, and then route the matrix to the Viewer Draw as well. i.e. not using an instancer node. $\endgroup$ – naught101 Mar 25 '16 at 10:30
  • $\begingroup$ Hrm.. I think I would like to get the instancer working though - it seems like your method generates actual blender objects, where the viewer-draw method just generates Sverchok "Ghosts", which have to be baked before they can be rendered... $\endgroup$ – naught101 Mar 26 '16 at 0:26
  • $\begingroup$ @naught101 - Look at the end of my answer, as it will help you get your data points converted to the "CSV" format of my answer. $\endgroup$ – Rick Riggs Mar 26 '16 at 23:43
  • $\begingroup$ That wasn't the problem (If you put a stethoscope after your vectors in, you'll see the format is correct). I have no idea why it wasn't working, but I just re-did it from scratch, and it worked this time... $\endgroup$ – naught101 Mar 27 '16 at 3:57
1
$\begingroup$

You just wanted to have instance duplications?

I usually use Viewer Draw to see the preview. And the "Matrix" input is what you want to use for this.

Provide the Mesh Data and the Matrix (transform) will be where the duplication or instances will be placed. If you have list of Vectors already, whether it is via Text Input or being generated using another node, you just plug in the Vector List into the Matrix In.

enter image description here

If you want "real objects" in 3D View right away, you can use BMesh MK2 Viewer node. That will generate actual objects.

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.