Hi Bism
I think I can help you in regards to placing zspheres based upon canvas coordinates. My zsphere scripts are based on this
rough algorithm off the top of my head since I don’t have code with me at work.
in zscript code
-
create root zsphere at center of canvas x = 320 y = 240
-
Size the Zsphere to 100x100x100 using transformset (object cords are based upon unity factor of 1)
[Transformset,320,240,0,100,100,100,0,0,0]
-
Root global loc: gx=320 gy=240 gz=0
-
Object cords of root are always ox=0 oy=0 oz=0
-
example, you wish to connect a new Zsphere node to the root at canvas cordinates of gx1=420 gy1=340 gz1=0
-
the xyz location of the zsphere should be
to get the offset from the root sphere do this
nx = (gx1-gx).01 for example (420-320).01
ny = (gy1-gy).01 for example (340-240).01
nz = (gz1-gz) *.01 for example (0-0) *.01
- use zsphereadd to add the new node using nx, ny, and nz. With the zsphere mesh sized to 100 the new node should be placed at the canvas cordinates of 420x340x0
Hope this helps and I have explained it in a legible manner