Notifications
Clear all

[Closed] polyop.cutVert issues

does the following code return undefined in your version of max ? (it does in 10 & 15)


(
   startface = 41
   sedge = 76
   t = 0.94175172

   vertcuts = #([-19.876751,-18.037935,0],[-30.444326,-24.018017,0],[-38.988945,-29.212503,0],
      [-43.878300,-34.400970,0],[-43.480061,-40.362999,0],[-36.161911,-47.878136,0],[-24.235403,-54.898308,0],
      [-11.438067,-58.902786,0],[1.7234473,-59.962196,0],[14.742468,-58.147175,0],[27.112368,-53.528370,0],
      [38.326477,-46.176407,0],[47.878139,-36.161911,0],[54.898312,-24.235405,0],[58.902786,-11.438068,0],
      [59.962196,1.7234473,0],[58.147171,14.742475,0],[53.528366,27.112370,0],[46.176399,38.326485,0],
      [36.161903,47.878139,0],[26.931747,52.861786,0],[21.088142,51.614174,0],[17.434790,45.492157,0],
      [14.775401,35.852604,0],[11.913665,24.052366,0],[7.6532907,11.448313,0],[0.79796982,-0.60269737,0],
      [-8.9185448,-10.492684,0]);
      
   fn CutPoly poly startedge t cutpoints = 
   (      
      newvert = polyop.divideEdge poly startedge t; 
      for cp = 1 to 16 do newvert = polyop.cutVert poly newvert cutpoints[cp] [0,0,-1];
   )   
   
   delete geometry;
   delete helpers;
   poly = ConverttoPoly(Plane length:200 width:200 pos:[0,0,0] isSelected:off lengthsegs:9 widthsegs:9);
   CutPoly poly sedge t vertcuts;
   Point pos:vertcuts[17];
   polyop.cutVert poly 129 vertcuts[17] [0,0,-1];
)

4 Replies

neither my 2014 has polyop.InsertVertinEdge nor google knows anything bout it.

sorry try it now

yep, listener says undefined
max 2014

thanks, seems to be an issue where the “new” vert being cut is in a direct line (or very close 3.99292e-5) between the cut start vert and one of the corner verts of the face the new vert is being placed in (though I can’t replicated it in a general case). Ho Hum

theres a nasty hack to fix it (I thought at first it made 2 cuts in the edge but it adds the new point at the edge (with the correct “offset”) so looking like the routine fails in some kind of barycoord calculation)


(
    startface = 41
    sedge = 76
    t = 0.94175172

    vertcuts = #([-19.876751,-18.037935,0],[-30.444326,-24.018017,0],[-38.988945,-29.212503,0],
        [-43.878300,-34.400970,0],[-43.480061,-40.362999,0],[-36.161911,-47.878136,0],[-24.235403,-54.898308,0],
        [-11.438067,-58.902786,0],[1.7234473,-59.962196,0],[14.742468,-58.147175,0],[27.112368,-53.528370,0],
        [38.326477,-46.176407,0],[47.878139,-36.161911,0],[54.898312,-24.235405,0],[58.902786,-11.438068,0],
        [59.962196,1.7234473,0],[58.147171,14.742475,0],[53.528366,27.112370,0],[46.176399,38.326485,0],
        [36.161903,47.878139,0],[26.931747,52.861786,0],[21.088142,51.614174,0],[17.434790,45.492157,0],
        [14.775401,35.852604,0],[11.913665,24.052366,0],[7.6532907,11.448313,0],[0.79796982,-0.60269737,0],
        [-8.9185448,-10.492684,0]);
        
    fn CutPoly poly startedge t cutpoints = 
    (        
        newvert = polyop.divideEdge  poly startedge t; 
        for cp = 1 to cutpoints.count do 
        (
            newvert = polyop.cutVert poly newvert cutpoints[cp] [0,0,-1];
            if newvert == undefined do
            (
                newvert = polyop.getnumverts poly;
                polyop.setvert poly    newvert cutpoints[cp];
            )
        )    
    )    
    
    delete geometry;
    delete helpers;
    poly = ConverttoPoly(Plane length:200 width:200 pos:[0,0,0] isSelected:off lengthsegs:9 widthsegs:9);
    CutPoly poly sedge t vertcuts;
)