Home Technical Talk

Is anyone up for a scripting challenge?

I have no experience whatsoever with max scripting and try to avoid code as much as possible. However, there is a feature that I'd really love to see in Max, and if I knew how to, I'd code it. But I don't, so hopefully someone here with the skills would see the same benefits in it.

I've mentioned the feature before. In Graphite - Loop Tools - There are Curvature features - Straight and Curve (see Vid at 1:10 onwards)

http://www.youtube.com/v/ZrrzWntz0FA

There isn't a setting to constrain these actions to edge, face etc., like there is in Edit Poly - Constraints. It would be really useful when modeling hard surface objects, especially high poly, to constrain it. I've been modeling HP vehicles and to be able to easily arrange lineflow would be such a time saver and would make things a lot easier.

Can anyone do this?

Replies

  • Eric Chadwick
    Options
    Offline / Send Message
    Pictures would really help. Constrain how?

    Also would help to name your thread better. Something more like "3ds Max Graphite curvature = constrain?" or something.
  • renderhjs
    Options
    Offline / Send Message
    renderhjs sublime tool
    Not clear, post screens or mockups
  • Playdo
    Options
    Offline / Send Message
    I hope this explains it clearly. I don't know how useful it would be on Curvature but I'd find it very useful on Straighten (both example GIFs are Straighten).

    Unconstrained Straighten creates the shortest path between the two end vertices. Constraints - Edge - Straighten would constrain it to the surface's edges.

    In the examples, it would be easy to constrain and scale the vertices to straighten them, then rotate if needed. But I've come across a lot of times, where scaling and rotating changes the surface, that this would really be useful. In the same way that Make Planar (X,Y,Z) can restrict to edge, you could do the same with this but not be restricted to X,Y,Z.

    If a Mod wants to change the name of the thread please go ahead.

    Loop-Tools-Constraint-01.gif

    Loop-Tools-Constraint-02.gif
  • mortalhuman
    Options
    Offline / Send Message
    I want that so bad.
  • kary
    Options
    Offline / Send Message
    kary polycounter lvl 18
    What if you run crazybutcher's straighten script with constraints to face, and then use set flow? That got the right result... on a sphere with a partial loop selection :|
  • Playdo
    Options
    Offline / Send Message
    Thanks for the link Kary. Set flow reshapes the geometry, which is unwanted. I need to straighten the curve between the two end vertices whilst constraining to edge. Does it do this?

    I haven't been able to get it working to try it. I'm running Max 2010. I've opened a new script in Max, copied and pasted the Script, then saved. I've then run the script. What do I do next?

    http://www.luxinia.de/index.php/ArtTools/3dsmax
  • kary
    Options
    Offline / Send Message
    kary polycounter lvl 18
    Just assign it to a hotkey, should be under CB's category in the hotkey list.

    I used it in conjunction with setflow for this and a few other little tests. They worked... but spheres and cubes aren't real working conditions :|

    And now for the unneccesarily huge image:


    CBScriptIEForPC.jpg
  • Playdo
    Options
    Offline / Send Message
    Unfortunately, it doesn't work as hoped. The action also pushes the vertices in the other axis which changes the geometry too much in the cases I've tried it with.

    The reason it's worked cleanly in your example with the sphere is because you used Set Flow, which perfectly corrected the geometry of the sphere (you could have done this without using the Straighten Script). But thanks anyway.
  • kary
    Options
    Offline / Send Message
    kary polycounter lvl 18
    Yep tried it this morning on a real world example and it worked as expected (in that it didn't work). Sorry about that, it would be brilliant to have what you're describing.
  • airbrush
    Options
    Offline / Send Message
    airbrush polycounter lvl 13
    In your examples what you want can be achieved by just using the make planar buttons under edit geometry...as long as its on that plane of course. Loop select, convert to verts, deselect the end verts, make planar, vertex snap back to the end verts.
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    that wont work at an angle
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    Ok this script is VERY VERY preliminary. Select 1 loop and execute the script.
    it will straighten it with respect to the direction of the surrounding edges.
    High curvatures are a problem for this script so if it doesn't work select a subsection of the edge and try again.

    www.robertfletcher.org/public_files/Scripts/edge_straighten.ms

    Give it a go and perhaps it can be made more robust with some noodling
  • Playdo
    Options
    Offline / Send Message
    Hi Rob, sorry for the late reply. I gave the script a go and it wasn't quite working out - but good effort - thanks. After doing some more searching I came across this script http://www.scriptspot.com/3ds-max/scripts/straighten-edge.

    It straightens loops whilst constraining to edge. The problem is that it's not been implemented well, making it tricky to work with at times. You need to select the loop, apply the script and then click on the two end vertices. Doing this whilst rotating the view isn't easy.

    Does anyone know how to change this code so that you only need to select the loop and then apply the script (without having to select the two end vertices)? So it would be just like Graphite Tools - Loop Tools - Straight. Rob I think this is similar to how you approached it.
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    Im working on another method for doing this. If that doesn't work ill modify that script. finding the start and end vert of and edgeloop is very easy. If you fancy trying it yourself in the mean time you just need to cycle through the selected verts and find which ones only have 1 edge in the selection.
  • Playdo
    Options
    Offline / Send Message
    Bringing this back in hope that it's been solved. I'd really love this tool. Any luck Rob? Or anyone else know of a script or how to modify it?
  • r_fletch_r
    Options
    Offline / Send Message
    r_fletch_r polycounter lvl 9
    no luck im afraid. I tried to do it by creating a transformation matrix from the normal of a triangle derived from the first, second and middle vertex and then flattening all the verts in that coordinate space but it wasn't consistant(my math isnt great so im not sure if my logic or code is faulty.). after that I started my current job and havent had the time to look at it further.
  • Playdo
    Options
    Offline / Send Message
    That's a shame. Thanks for trying though. Can anyone crack this? I just realised that there's a forum over at ScriptSpot so I'll post it there too.
  • Eric Chadwick
    Options
    Offline / Send Message
    Doesn't SyncViews have something like this in his toolset?
    http://www.illusioncatalyst.com/ic_shape_intro.php
  • Playdo
    Options
    Offline / Send Message
    Thanks Eric. I haven't had time to install it but l looked through the documentation and couldn't see it in there. Has anyone used it?
  • Playdo
    Options
    Offline / Send Message
    I couldn't find it in there.

    I've been looking for a solution for edge/face constraint for Straighten but it would also be a very useful addition for Curve too. So if anyone does attempt to code it at some point, if it's possible, then I'd say that the best implementation would be via the Editable Poly - Edit Geometry - Constraints checkboxes.
Sign In or Register to comment.