Maxscript: get/set position of verts/egdes/faces/knots/objects/...

polycounter lvl 11
Online / Send Message
SimonT polycounter lvl 11
Hi friends!

I wrote a small script in the past which could copy/paste the position of a spline-knot. Nothing special. BUT i want to improve the script that makes it possible to copy paste a position of any object/subobject in 3Ds Max.

The question i have: Is it possible to grab/set transformation values independet from the current selection type?

For example for knots of splines you have to do it with:
setKnotPoint ...

and for standard objects you can use
object.position

and i would like to avoid a lot of if-loops to get/set transformation values for every type - maybe there is a "global" way to do this?!

THX!

Replies

  • miauu
    Offline / Send Message
    miauu polycounter lvl 6
    You can get/set position only for verts, so you have to check the subobject level and convert edges/faces to verts and then get/set the position.
    To avoid if-loops try with "case of" statement:
    (
        case subobjectlevel of
        (
            1: (vertPos = for v in (polyop.getVertSelection selection[1]) collect (polyop.getVert selection[1] v))
            2:
            (
                edgeList = polyop.getEdgeSelection selection[1]
                edgeVerts = polyop.getVertsUsingEdge selection[1] edgeList
                vertPos = for v in edgeVerts collect (polyop.getVert selection[1] v)
            )
            4:
            (
                faceList = polyop.getFaceSelection selection[1]
                faceVerts = polyop.getVertsUsingFace selection[1] faceList
                vertPos = for v in faceVerts collect (polyop.getVert selection[1] v)
    
            )
        )
    )
    
  • SimonT
    Online / Send Message
    SimonT polycounter lvl 11
    yeah if or case doesn't matter :D i just dont like them both for this issue :D but the selection stuff seems pretty cool. for splines i have to do it in a seperate way i think.

    damn. just thought maybe there is a controler which sits on top of the selection - independ of its type - and allows access to the transformation :(
Sign In or Register to comment.