Page 1 of 3 123 LastLast
Results 1 to 15 of 34

Thread: How to weld points to average but without welding

  1. #1
    Super Member Boris Goreta's Avatar
    Join Date
    Aug 2003
    Location
    Zagreb, Croatia
    Posts
    1,357

    How to weld points to average but without welding

    Hi, I would like to move points to their average position. There is a weld to average command but I don't want the points to be welded, just moved to their average position based on some threshold value.

    Click image for larger version. 

Name:	Sketch.png 
Views:	78 
Size:	196.5 KB 
ID:	134751

  2. #2
    Only thing that comes to mind is to select the group of 4, and just size it down, using "AC:Selection" as the action center.

    In some cases I imagine Point Normal Move could be used to scale many sets of 4 at the same time.

  3. #3
    Super Member Boris Goreta's Avatar
    Join Date
    Aug 2003
    Location
    Zagreb, Croatia
    Posts
    1,357
    I know but I need to do this massively on the entire model, this would be too time consuming.

    Point normal move would work if all points were at the same distance from their averaged center, but this is not the case.

  4. #4
    www.Digitawn.co.uk rustythe1's Avatar
    Join Date
    Feb 2006
    Location
    england
    Posts
    1,279
    if you could create a spline at the centre of it with a point in the middle of each of the 4 points in the back ground (you would probably have to make a copy of the object then hand weld average each set of 4 so maybe still a bit of time needed) and then I think "shrink wrap" has a nearest point option that may work
    Intel i9 7980xe, Asus Rampage Vi extreme, 2x NVIDIA GTX1070ti, 64GB DDR4 3200 corsair vengeance,
    http://digitawn.co.uk https://www.shapeways.com/shops/digi...ction=Cars&s=0

  5. #5

    UVing a Tree...?

    maybe there is a plugin for it?

    there is the plugin Edge Opener, but that works the other way around
    https://www.youtube.com/watch?v=AUI_reeGeKE

    (hmm, Edge Opener is 32bit only it seems, even though DStorm page says 32/64)
    Last edited by erikals; 10-12-2016 at 09:39 AM.
    LW vidz   DPont donate   LightWiki   RHiggit   IKBooster   My vidz

  6. #6
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,522
    Does this require anything special, like it has to respect islands of points (as in, you've selected multiple islands, and need each one to collapse, or is it the simple case, where your selecting a large group of points to collapse into a single point (but not weld)? The solution, for lscript, is trivial.
    Code:
    @script modeler
    @warnings off
    @name Snap to Avg.
    
    main
    {
        //debug();
        totPntVal = < 0, 0, 0>;
        selmode(DIRECT);
        pntCnt = pointcount();
        if(pntCnt == 0)
        {
            error("No points selected!"”);
        }
        editbegin();
        for(currPnt = 1; currPnt <= pntCnt; currPnt++)
        {
            currPntVal = pointinfo(points[currPnt]);
            totPntVal = totPntVal + currPntVal;
        }
        pntAvgPos = <totPntVal.x / pntCnt, totPntVal.y/pntCnt, totPntVal.z/pntCnt>;
    
        for(currPnt = 1; currPnt <= pntCnt; currPnt++)
        {
            pointmove(points[currPnt],pntAvgPos);
        }
        editend();
    }
    Cut and Paste this to a text editor, then save it as <filename>.ls. You can add it as a plugin via Lightwave, and then give it a button via the menu editor.

    This is an old script, and I can't even take credit for it. A good portion of the code is shared between weld, weld pairs, weld average, and weld average pairs scripts, the main difference is in how the points get moved before being merged.

    Hope this at least (partly) helps.
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  7. #7
    Member
    Join Date
    Oct 2003
    Location
    Near Edinburgh
    Posts
    246
    Why not just select the points, weld averge then unweld unless you don't want them exactly at the same point.

  8. #8
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,732
    Kryslin, is native WELD AVERAGE a script??
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  9. #9
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,522
    No, it's an actual compiled plugin. However, it is easily duplicated in lscript. The redone weld/weld avg/weld pairs/weld pairs avg scripts all come from the original lscript documentation, about how one can get rid of the pesky message box that used to pop up every time you used weld.

    The lscript versions do have a small problem - if there is any difference between the points being welded (like morph maps), it won't weld them. Move them, yes, but not weld them.

    I think Iain_r's suggestion, however, might be faster for large numbers of points.
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  10. #10

    not sure if this could be of help,...

    LW vidz   DPont donate   LightWiki   RHiggit   IKBooster   My vidz

  11. #11
    Quote Originally Posted by Kryslin View Post

    ...The lscript versions do have a small problem - if there is any difference between the points being welded (like morph maps), it won't weld them. Move them, yes, but not weld them....
    .
    That sounds exactly like what the Original poster wanted.


    Erikals, I don't think anybody is talking about UVs... Iain's suggestion might not work because you are merging 4 points that come from quads but they turn into triangles, so unwelding gives you triangles not quads. (I'm not sure what the OP had in mind but my guess is that he needed to stay in quads)

  12. #12

    That sounds exactly like what the Original poster wanted.
    yep, think that is the solution.

    regarding UV's, it looks like from the original picture he is UV mapping a tree? ...not quite sure.
    LW vidz   DPont donate   LightWiki   RHiggit   IKBooster   My vidz

  13. #13
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,732
    Quote Originally Posted by Kryslin View Post
    No, it's an actual compiled plugin. However, it is easily duplicated in lscript. The redone weld/weld avg/weld pairs/weld pairs avg scripts all come from the original lscript documentation, about how one can get rid of the pesky message box that used to pop up every time you used weld.

    The lscript versions do have a small problem - if there is any difference between the points being welded (like morph maps), it won't weld them. Move them, yes, but not weld them.
    That is NOT a bug, that's a definite FEATURE: I use a m.map named "NO_MERGE" to preserve points from inadvertant merging.
    I think Iain_r's suggestion, however, might be faster for large numbers of points.
    I rather moderated my question because iain_r's method was the first that occurred to me, if there were simple LScript commands for WELD_AVERAGE immediately followed by UNWELD. I'm not sure what the OP's application for this routine is, but the illustration seemed to indicate a desire to collapse branches or tentacular-type meshes to a central spline. This I think would require a threshold value to avoid collapsing far-distant points, although a real pro routine would also avoid re-curve situations.

    Hmmmm... do we already have a tool that would step down via NEXT LOOP a mesh, collapsing subsequent loops??? That might be pretty convenient for use with tree structures.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

  14. #14
    Super Member Kryslin's Avatar
    Join Date
    Feb 2009
    Location
    Prescott, IA
    Posts
    1,522
    Quote Originally Posted by jeric_synergy View Post
    That is NOT a bug, that's a definite FEATURE: I use a m.map named "NO_MERGE" to preserve points from inadvertant merging.

    I rather moderated my question because iain_r's method was the first that occurred to me, if there were simple LScript commands for WELD_AVERAGE immediately followed by UNWELD. I'm not sure what the OP's application for this routine is, but the illustration seemed to indicate a desire to collapse branches or tentacular-type meshes to a central spline. This I think would require a threshold value to avoid collapsing far-distant points, although a real pro routine would also avoid re-curve situations.

    Hmmmm... do we already have a tool that would step down via NEXT LOOP a mesh, collapsing subsequent loops??? That might be pretty convenient for use with tree structures.
    Ok, now someone's got me curious. I think it could be done. I think next loop and previous loop are CMDSEQ operations (and can be called from lscript), but the problem I forsee is detecting when the operation fails. I'll have to read up on cmdseq() and see if it returns a value or not... Drat, cmdseq() is one way. You can invoke another plugin, but not get information back...
    --------
    My Scripts for Lightwave
    Intel Core i7 960 @3.20 Ghz, 24 GB ram, EVGA 6GB GTX980Ti "Classified" driving 2 x HP LA2405.

  15. #15
    Axes grinder- Dongle #99
    Join Date
    Jul 2003
    Location
    Seattle
    Posts
    14,732
    Quote Originally Posted by Kryslin View Post
    ... Drat, cmdseq() is one way. You can invoke another plugin, but not get information back...
    Well, the WELD_AVERAGE code is, as you've demonstrated, no big deal, so you wouldn't have to invoke another plugin. That would be elegant, but is apparently not to be.

    I'd think (for certain low values of 'think') that branching would be more of an issue: it'd be slick as hell if you could collapse a whole tree to a series of splines, but I smell recursion in the air, so I'm running away.....

    But, a little bit of user interaction can go a long way, so as long as any given branch/tentacle got collapsed, it'd still be a worthy addition to the toolbox.
    They only call it 'class warfare' when we fight back.
    Praise to Buddha! #resist
    Chard's Credo-"Documentation is PART of the Interface"
    Film the cops. Always FILM THE COPS. Use this app.

Page 1 of 3 123 LastLast

Bookmarks

Posting Permissions

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