Home Technical Talk

[MAX] Middle seam closing.

polycounter lvl 16
Offline / Send Message
BeatKitano polycounter lvl 16
First, don't worry I don't plan to make a thread about my maxscripts needs everyday :)

Now, I was working with a small model today and wanted to know if there was a way in maxscript to shut mirror center seam ?

I'm using align to x to make sure my selection is alright, and want to move it to x=0 (without changing the yz position).
The align thing is no brainer, but I can't get my head around making my selection move to x=0 without changing the other positions.

move command is expecting a "x y z" argument while I can only provide x.

Is there a way to do that ?

Thank you in advance.

Replies

  • BeatKitano
    Options
    Offline / Send Message
    BeatKitano polycounter lvl 16
    Ok, I got it, I looked at this script and copied the part I wanted.

    Thanks to the author, I'm a noob with maxscript I would never have found it otherwise.
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    you need to go a bit lower level for this i think. polyOps are called for :)
    aSelectedVerts = (polyop.getVertSelection $) as array
    nSelectedVerts = aSelectedVerts.count
    
    for i = 1 to nSelectedVerts do
    (
    	vertPosition = polyop.getVert $ aSelectedVerts[i]
    	vertPosition.x = 0.0
    	polyop.setVert $ aSelectedVerts[i] vertPosition
    	
    )
    

    edit - beaten to it. Oh well :)
  • BeatKitano
    Options
    Offline / Send Message
    BeatKitano polycounter lvl 16
    Thank you it's still a good thing you answered I will look at your code and try to understand it, copy pasting stuff is not the way to go. I prefer yours since it's only doing what I want so I can understand it better.
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    get an array of the currently selected vertices, polyop ops dont return arrays for this sort of thing, they return whats called a bitArray. because of this we use 'as array' to convert it into an array.
    aSelectedVerts = (polyop.getVertSelection $) as array
    
    we find how many verts are selected
    nSelectedVerts = aSelectedVerts.count
    
    we start a for loop from 1 to the number of selected verts
    for i = 1 to nSelectedVerts do
    (
    
    we vertex index stored at position i in the array, and then use a polyOp to get that vertexs position.
    	vertPosition = polyop.getVert $ aSelectedVerts[i]
    
    we explicitly set the x position stored in vertPosition to 0.
    	vertPosition.x = 0.0
    
    Then we update the position of the vert
    	polyop.setVert $ aSelectedVerts[i] vertPosition
    
    )
  • BeatKitano
    Options
    Offline / Send Message
    BeatKitano polycounter lvl 16
    OK thank you for the breakdown. Most of the time when trying simple scripts like that, I understand the functions, but have problems inputing the correct data type. (plugin an array instead of a integer for example).

    That's my issue most of the time :/ Practices makes perfect I guess. But it will take a while I think. At least I'm more confident now than I was with mel scripting at the begining.
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    best thing to do is look up the max script help. check the data type functions return and expect as input and then read their help.

    if you have a variable and you want to know its data type or class
    type
    classOf variable
  • BeatKitano
    Options
    Offline / Send Message
    BeatKitano polycounter lvl 16
    Thanks for your help, I've a lot to learn here, but the possibilities are enormous. I think I'm starting to understand Perna about the importance of max customization to fix autodesk mistakes :>

    It's a great tool in fact it's just so dry at first contact (well before ribbon tools that is)
  • monster
    Options
    Offline / Send Message
    monster polycounter
    I may be misunderstanding, but after you align your verts on on the X, can't you just type a zero into the X value beneath the viewport?
  • BeatKitano
    Options
    Offline / Send Message
    BeatKitano polycounter lvl 16
    I could, but I'm lazy and want to be able to do all that with a hotkey (I don't need to align now as x=0 absolutely). Besides in expert mode that bar is invisible and I like my ui very simple :)
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    hit f12 to bring it up as a floater
Sign In or Register to comment.