Author Topic: Adding polyline vertices in fixed intervals  (Read 2092 times)

0 Members and 1 Guest are viewing this topic.

Lupo76

  • Bull Frog
  • Posts: 343
Adding polyline vertices in fixed intervals
« on: August 20, 2020, 11:45:29 AM »
Hi,
I found this lisp which adds vertices along a polyline at a predetermined distance:
https://www.cadforum.cz/cadforum_en/adding-polyline-vertices-in-fixed-intervals-tip10091

It works fine if there are no edges, otherwise the result is incorrect :-(

Unfortunately on this occasion I don't have time to make a new lisp :embarrassed:
Do you have which lisp ready to do this?

Thanks in advance!

Lupo76

  • Bull Frog
  • Posts: 343
Re: Adding polyline vertices in fixed intervals
« Reply #1 on: August 21, 2020, 03:16:55 AM »
Sorry,
laziness seems like a bad disease that clouds the brain.
Here is the solution:

Code: [Select]
(defun c:demo2 ()
 (if (and (setq pline (car (entsel "\nSelect Polyline:")))
          (eq (cdr (assoc 0 (entget pline))) "LWPOLYLINE")
          (setq int (getdist "\nEnter Interval:"))
          (setq in int)
    )
    (while (setq pt (vlax-curve-getPointAtDist pline int))
      (progn
        (command "_break" pline pt pt)
        (command "_pedit" pline "_j" (entlast) "" "")
       ;--
       (setq int (+ int in))
      )
    )
 )
)

BIGAL

  • Swamp Rat
  • Posts: 1411
  • 40 + years of using Autocad
Re: Adding polyline vertices in fixed intervals
« Reply #2 on: August 21, 2020, 11:55:08 PM »
Google pedit add vertice better than break and join.
A man who never made a mistake never made anything

xdcad

  • Bull Frog
  • Posts: 486
The code I wrote uses XDRX-API,which can be downloaded from github.com and is updated at any time.
===================================
https://github.com/xdcad
https://sourceforge.net/projects/xdrx-api-zip/
http://bbs.xdcad.net