Jump to content

REDUCE THE VERTIX OF RECTANGLE TO MINIMUM (4 VIRTIX ONLY).


Recommended Posts

Posted (edited)

PLS....... I WANT A LISP, FOR REDUCING THE VERTEX POINTS ON A POLYLINE RECTANGLE TO MINIMUM (4 VIRTIX ONLY) TO GET FOR EXAMPLE ONE DIMENSION OF EACH SIDE OF RECTANGLE , WHEN I PICKED IT NOT TWO OR THREE IN CASE OF THERE IS MORE VIRTIX ..I TRY SOME LISP AND COMMAND LIKE OVERKILL ITS LEAVE ONE VERTIX  ..AND IT'S NOT EFFECTIVE ..I PREFER TO MAKE SELECTION TO MANY RECTANGLES AT SAME TIME.. .AND THANKS FOR ANYONE HELPING ME..

Edited by adeladel
Posted (edited)

When posting if you use capitals it is known as speaking loudly.

 

Post a sample dwg or at least an image so we can see what you want.

Edited by BIGAL
  • Like 1
Posted

I attach the dwg file there is a lot of vertix in the rectangle ..and thanks for help, and I speak slowly now..(I apologize I don't know this role because this is not my mother language..)

new blockrec.dwg

Posted

'Diet' might be what you are looking for:

 

 

  • Like 1
Posted

This can help you?

(defun c:remove-vertex ( / ss n objent area_ori vertexlist v_list epoint cnt newlist index indexlist)
  (setq ss (ssget '((0 . "LWPOLYLINE"))))
  (cond
    (ss
      (repeat (setq n (sslength ss))
        (and
          (setq
            objent (vlax-ename->vla-object (ssname ss (setq n (1- n))))
            area_ori (vla-get-area objent)
            vertexlist (vlax-get objent "Coordinates")
            v_list vertexlist
          )
          (not (zerop area_ori))
          (repeat (/ (length v_list) 2)
            (setq
              epoint (list (car v_list) (cadr v_list))
              cnt 0
              newlist '()
              index (* 2 (fix (+ 0.5 (vlax-curve-getparamatpoint objent epoint))))
              indexlist (list index (1+ index))
            )
            (foreach ordinate vertexlist
              (if (not (vl-position cnt indexlist))
                (setq newlist (cons ordinate newlist))
              )
              (setq cnt (1+ cnt))
            )
            (not
              (vl-catch-all-apply 'vlax-put
                (list objent "Coordinates" (reverse newlist))
              )
            )
            (if (equal (vla-get-area objent) area_ori 1E-08)
              (setq vertexlist (vlax-get objent "Coordinates"))
              (not
                (vl-catch-all-apply 'vlax-put
                  (list objent "Coordinates" vertexlist)
                )
              )
            )
            (setq v_list (cddr v_list))
          )
        )
      )
    )
  )
)

 

  • Agree 1
Posted

Thanks a lot for help , Its worked and solve my problem and will save a lot off time for me..I am very grateful to you and I appreciate your time and effort for helping me..

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...