1. #1
    Senior Member User Gallery
    Join Date
    May 2007
    Location
    Raleigh NC
    Posts
    476

    Default Mesh XY dimensions

    Is there a way to get the X,Y dimensions of ALL the Subtools in a Tool? Basically the total height and width of a mesh?

    I messed around some with [Mesh3DGet,2] but I honestly don't really understand the values it returns. Is that canvas position?

  2. #2
    Moderator User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    8,553

    Default

    What results are you getting (and how)? I always get an 'inputs out of range' error when trying that particular property with Mesh3DGet.

  3. #3
    Senior Member User Gallery
    Join Date
    May 2007
    Location
    Raleigh NC
    Posts
    476

    Default

    Huh... I didn't save it and I am getting the same 'out of range' error when I just tried it again. I swear it was returning some numbers before. Maybe I had the wrong property number before.

  4. #4
    Moderator User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    8,553

    Default

    What are you trying to do? There may be a way but it depends on how much accuracy you need.

  5. #5
    Senior Member User Gallery
    Join Date
    May 2007
    Location
    Raleigh NC
    Posts
    476

    Default



    I am making something like a "Tiled Mesh Helper" that arrays the mesh for you. I wanted to add a function that you could check how the mesh tiled. I know there are multiple ways to do this... but I am not sure how best to do it via script. There is probably an easier way that I just can't think of. I am not super experienced with the 2D tools in ZB.

    My first thought was just basically the "pattern fill" in Photoshop. I make the canvas smaller and take a snapshot, then restore the doc size and then fill the canvas with that texture. BUT when you fill the canvas ZB stretches the texture to fit the canvas.

    My next thought was just to drop the mesh to the canvas over and over again with an offset equal to the X/Y dimensions.

    I also thought about using the 2D layers offset because it may be faster and manipulating a mesh...

    Spotlight basically has this feature... but it's not scriptable that I know of? I also don't know if you can get the tiled texture out of spotlight without painting it on something. Bah! Ramblings!

  6. #6
    Moderator User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    8,553

    Default

    If you reduce the size of the canvas, then use Transform>Fit to fit the mesh, you can grab the scale from the TransformGet values. Then scale your document back up and use TransformSet to set the scale and position, using Transform>Snapshot for each iteration.

    Note: as the 'Fit' tends to make the model a bit large you may want to adjust the scale a bit, or give the user some means to do so.

  7. #7
    Senior Member User Gallery
    Join Date
    May 2007
    Location
    Raleigh NC
    Posts
    476

    Default

    That is a great idea! I will try it out.

  8. #8
    Senior Member User Gallery
    Join Date
    May 2007
    Location
    Raleigh NC
    Posts
    476

    Default

    So I tried that and maybe I am missing something.

    When I resize the canvas it drops the tool to the canvas. I am not sure how to add the tool again in the same orientation via script?

  9. #9
    Moderator User Gallery
    Join Date
    Jun 2004
    Location
    UK
    Posts
    8,553

    Default

    [CODE][IButton,"Resize Canvas","Resize canvas and reposition model",
    [If,[IsEnabled,Transform:Edit],//if there's a 3D tool selected
    [If,[IGet,Transform:Edit],//and if it's in Edit mode
    //get the transform values of the model
    [TransformGet,xPos,yPos,zPos,xScale,yScale,zScale,x Rotate,yRotate,zRotate]
    //resize the document - the keypress stops warning message appearing
    [IKeyPress,13,[IPress,Document:Half]]
    [IPress,Layer:Clear]
    //redraw the model
    [IClick,1004,10,10,10,50,10,100]
    [IPress,Transform:Edit]
    //reposition
    [TransformSet,xPos,yPos,zPos,xScale,yScale,zScale,x Rotate,yRotate,zRotate]
    [IPress,Transform:Fit]
    [TransformGet,xPos,yPos,zPos,xScale,yScale,zScale,x Rotate,yRotate,zRotate]
    //reduce scale slightly
    [TransformSet,xPos,yPos,zPos,xScale*0.9,yScale*0.9, zScale*0.9,xRotate,yRotate,zRotate]
    ]//end if
    ]//end if
    ][/CODE]

    I've used the Document:Half for simplicity but you can turn off 'Pro' and set the doc size to what you want before pressing 'Resize'.

    HTH,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •