<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Modify 3D polyline in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6202782#M137434</link>
    <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello Kent&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;THANKS it works like a charm !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks to your PEDIT solution which keeps XDATAs &amp;amp; ODs ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards, Patrice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2016 16:33:46 GMT</pubDate>
    <dc:creator>braudpat</dc:creator>
    <dc:date>2016-03-07T16:33:46Z</dc:date>
    <item>
      <title>Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5874304#M137416</link>
      <description>&lt;P&gt;Hello how are you.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;I need help modify 3D polyline.&lt;BR /&gt;In the attachment it is what I want to achieve.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Oct 2015 21:28:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5874304#M137416</guid>
      <dc:creator>carlos_m_gil_p</dc:creator>
      <dc:date>2015-10-22T21:28:15Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5875386#M137417</link>
      <description>&lt;P&gt;Based on your lisp...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;;;; by Carlos Gil
;;; carlos.m.gil.p@gmail.com

;;;
;;; Funcion que renumera cantidad de vertices en una Polyline o Polyline 3d
;;;

(defun c:xxx (/ cgp-seleccion cgp-cant-vert)
  (vl-load-com)
  (cmd-entrar)
  (cmd-seleccion-polylineas)
  (princ)
)

;;;
;;; Funcion de entrada
;;;

(defun cmd-entrar (/)
  ;; Documento
  (setq cgp-adoc (vla-get-activedocument (vlax-get-acad-object)))
  (setq cgp-activelayspace (vla-get-block (vla-get-activelayout cgp-adoc)))
  ;;
)

;;;
;;; Seleccion de polilineas
;;;

(defun cmd-seleccion-polylineas   (/)
  ;; Seleccion
  (setq cgp-seleccion (entsel "\nEspecifique objeto: "))
  ;; Conversion de seleccion a objeto
  (if cgp-seleccion
    (setq cgp-objeto (vlax-ename-&amp;gt;vla-object (car cgp-seleccion)))
  )
  ;; Especifico cantidad de vertices
  (while (&amp;lt; cgp-cant-vert 2)
    (setq cgp-cant-vert
        (getint
          (strcat "\nEspecifique cantidad de vertices &amp;lt; "
              (itoa (vlax-ldata-get
                "CANTIDAD-VERTICES"
                "cgp-cant-vert"
              )
              )
              " &amp;gt;: "
          )
        )
    )
    (if (= cgp-cant-vert nil)
      (progn (setq cgp-cant-vert
              (vlax-ldata-get
                "CANTIDAD-VERTICES"
                "cgp-cant-vert"
            )
          )
          (vlax-ldata-put
            "CANTIDAD-VERTICES"
            "cgp-cant-vert"
            cgp-cant-vert
          )
      )
    )
    (if   (&amp;lt; cgp-cant-vert 2)
      (princ
      "\nLa cantidad de vertices no puede ser menor de dos."
      )
    )
    (if   cgp-cant-vert
      (vlax-ldata-put
      "CANTIDAD-VERTICES"
      "cgp-cant-vert"
      cgp-cant-vert
      )
    )
  )
  ;; Distancia a dividir objeto
  (setq cgp-distancia (/ (ax-longtotal cgp-objeto) (1- cgp-cant-vert)))
  (while (&amp;lt; (length (ax-gradua cgp-objeto cgp-distancia)) cgp-cant-vert)
    (setq cgp-distancia (* 0.99 cgp-distancia))
  )
  ;; Tipo de objeto y funcion a ejecutar
  (cond 
      ((= (vla-get-objectname cgp-objeto) "AcDb2dPolyline")
      (cmd-addpolyline)
      )
      ((= (vla-get-objectname cgp-objeto) "AcDbPolyline")
      (cmd-addlightweightpolyline)
      )
      ((= (vla-get-objectname cgp-objeto) "AcDb3dPolyline")
      (cmd-add3dpoly)
      )
  )
  ;; Eliminar objeto antiguo
  (vla-delete cgp-objeto)
  ;; Regenera pantalla
  (vla-regen cgp-adoc acactiveviewport)
)

;;;
;;; Creacion de 2d polyline
;;;

(defun cmd-addpolyline (/)
  ;; Listado de vertices sobre objeto
  (setq cgp-lista-vert-inicial
      (vl-remove
        nil
        (ax-gradua cgp-objeto cgp-distancia)
      )
  )
  (setq cgp-tmp nil)
  (setq cgp-lista-vert-original
      (foreach x cgp-lista-vert-inicial
        (setq
          cgp-tmp (cons (trans x 1 0) cgp-tmp)
        )
      )
  )
  ;; Listado de vertices unidos
  (setq cgp-lista-vert nil)
  (foreach cgp-vert cgp-lista-vert-original
    (setq cgp-lista-vert (append cgp-vert cgp-lista-vert))
  )
  ;; Array de puntos
  (setq cgp-puntos
    (vlax-safearray-fill
      (vlax-make-safearray
        vlax-vbdouble
        (cons 0 (1- (length cgp-lista-vert)))
      )
      cgp-lista-vert
    )
  )
  ;; create a 3d polyline in model space
  (setq cgp-polyline-obj (vla-addpolyline cgp-activelayspace cgp-puntos))
  ;; Cambia elevacion para dejar la actual
  (vla-put-elevation
    cgp-polyline-obj
    (vla-get-elevation cgp-objeto)
  )
  ;;
)

;;;
;;; Creacion de lwpolyline
;;;

(defun cmd-addlightweightpolyline (/)
  ;; Listado de vertices sobre objeto
  (setq cgp-lista-vert-inicial
    (reverse
      (vl-remove
        nil
        (ax-gradua cgp-objeto cgp-distancia)
      )
    )
  )
  (setq cgp-tmp nil)
  (setq cgp-lista-vert-original
    (reverse
      (mapcar '3d-&amp;gt;2d
         (foreach x cgp-lista-vert-inicial
           (setq cgp-tmp
             (cons (trans x 0 1) cgp-tmp)
           )
         )
      )
    )
  )
  ;; Listado de vertices unidos
  (setq cgp-lista-vert nil)
  (foreach cgp-vert cgp-lista-vert-original
    (setq cgp-lista-vert (append cgp-vert cgp-lista-vert))
  )
  ;; Array de puntos
  (setq cgp-puntos
    (vlax-safearray-fill
      (vlax-make-safearray
        vlax-vbdouble
        (cons 0 (1- (length cgp-lista-vert)))
      )
      cgp-lista-vert
    )
  )
  ;; Create a 3d polyline in model space
  (setq cgp-polyline-obj
    (vla-addlightweightpolyline
      cgp-activelayspace
      cgp-puntos
    )
  )
  ;; Cambia elevacion para dejar la actual
  (vla-put-elevation
    cgp-polyline-obj
    (vla-get-elevation cgp-objeto)
  )
  ;;
)

;;;
;;; Creacion de polyline 3d
;;;

(defun cmd-add3dpoly (/)
  ;; Listado de vertices sobre objeto
  (setq cgp-lista-vert-original
    (reverse
      (vl-remove
        nil
        (ax-gradua cgp-objeto cgp-distancia)
      )
    )
  )
  ;; Listado de vertices unidos
  (setq cgp-lista-vert nil)
  (foreach cgp-vert cgp-lista-vert-original
    (setq cgp-lista-vert (append cgp-vert cgp-lista-vert))
  )
  ;; Array de puntos
  (setq cgp-puntos
    (vlax-safearray-fill
      (vlax-make-safearray
        vlax-vbdouble
        (cons 0 (1- (length cgp-lista-vert)))
      )
      cgp-lista-vert
    )
  )
  ;; create a 3d polyline in model space
  (setq cgp-polyline-obj (vla-add3dpoly cgp-activelayspace cgp-puntos))
  ;;
)

;;;
;;; Listado 10.27. Función auxiliar 3d-&amp;gt;2d
;;; Togores
;;;

(defun 3d-&amp;gt;2d (punto) (list (car punto) (cadr punto)))

;;;
;;; Listado 15.14. Calcular puntos a distancias fijas
;;; Togores
;;; Mod by Carlos Gil
;;; Mod by M.R.
;;;

(defun ax-gradua (obj distancia / longitud tmp k r avance dist avdist)
  (setq longitud (ax-longtotal obj)
   tmp (list (vlax-curve-getstartpoint cgp-objeto))
  )
  (while (&amp;lt; (if (null k) (setq k 0) (setq k (1+ k))) (vlax-curve-getendparam cgp-objeto)) (setq r (cons k r)))
  (foreach segdist (mapcar '(lambda (par) (- (vlax-curve-getdistatparam cgp-objeto (1+ par)) (vlax-curve-getdistatparam cgp-objeto par))) (reverse r)) 
    (setq avance (/ segdist (fix (/ segdist distancia))))
    (if (null dist) (setq dist segdist) (setq dist (+ dist segdist)))
    (if (null avdist) (setq avdist 0.0))
    (while (&amp;lt; (+ avdist 1e-6) dist)
      (if (/= avdist 0.0)
        (setq tmp (cons (vlax-curve-getpointatdist obj avdist) tmp))
      )
      (setq avdist (+ avdist avance))
    )
  )
  (if (equal (nth 0 tmp) (vlax-curve-getendpoint cgp-objeto) 1e-6)
    (reverse tmp)
    (reverse (cons (vlax-curve-getendpoint cgp-objeto) tmp))
  )
)

;;;
;;; Listado 15.1. Determinación de la longitud total de una curva
;;; Togores
;;;

(defun ax-longtotal (objcurva)
  (vlax-curve-getdistatparam
    objcurva
    (vlax-curve-getendparam objcurva)
  )
)&lt;/PRE&gt;&lt;P&gt;HTH, M.R.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 14:29:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5875386#M137417</guid>
      <dc:creator>marko_ribar</dc:creator>
      <dc:date>2015-10-23T14:29:44Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5876013#M137418</link>
      <description>&lt;P&gt;Hello Brother.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Again thank you very much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Stay perfect.&lt;/P&gt;</description>
      <pubDate>Fri, 23 Oct 2015 20:03:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5876013#M137418</guid>
      <dc:creator>carlos_m_gil_p</dc:creator>
      <dc:date>2015-10-23T20:03:42Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5912031#M137419</link>
      <description>&lt;P&gt;Hello Brother how are you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to apply the lisp that you modified.&lt;/P&gt;&lt;P&gt;But it does not work.&lt;/P&gt;&lt;P&gt;I'm trying to remunerate 26 vertices.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I enclose dwg and lisp, I am using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 15:57:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5912031#M137419</guid>
      <dc:creator>carlos_m_gil_p</dc:creator>
      <dc:date>2015-11-17T15:57:44Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5912120#M137420</link>
      <description>&lt;P&gt;Hi, check attachments... On some cases it won't work, so you have to find alternate solutions...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;M.R.&lt;/P&gt;</description>
      <pubDate>Tue, 17 Nov 2015 16:38:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5912120#M137420</guid>
      <dc:creator>marko_ribar</dc:creator>
      <dc:date>2015-11-17T16:38:42Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5913816#M137421</link>
      <description>&lt;P&gt;Hello Brother how are you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;There will be some solution to make direct and not piecemeal.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 14:59:14 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5913816#M137421</guid>
      <dc:creator>carlos_m_gil_p</dc:creator>
      <dc:date>2015-11-18T14:59:14Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5914032#M137422</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/940934"&gt;@marko_ribar&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;Hi, check attachments... On some cases it won't work, so you have to find alternate solutions...&lt;/P&gt;
&lt;P&gt;.....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2573929"&gt;@carlos_m_gil_p&lt;/a&gt;, is the idea that if you say you want 26 vertices, you want the &lt;EM&gt;overall&lt;/EM&gt; original Polyline divided up with added vertices, rounding the subdivision lengths to divide evenly into&amp;nbsp;the lengths of existing segments, so that existing vertices remain where they are? &amp;nbsp;The latest example drawing from marko_ribar divided only the &lt;EM&gt;one longest&lt;/EM&gt; segment, and left the others, ending up with &lt;EM&gt;30&lt;/EM&gt; vertices overall. &amp;nbsp;If the &lt;EM&gt;overall&lt;/EM&gt;&amp;nbsp;original length should be subdivided into 25ths, then the left-most segment is long enough that it should have had a vertex added in the middle of it. &amp;nbsp;Am I understanding correctly? &amp;nbsp;[Sorry, I don't speak whatever language the code is written in -- Portuguese? Spanish?]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[I'm getting a divide-by-zero error when I try to use the latest XXX command in the latest drawing.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Another question: &amp;nbsp;Would they ever be &lt;EM&gt;closed&lt;/EM&gt; Polylines? &amp;nbsp;If so, should the User be asked how many &lt;EM&gt;segments&lt;/EM&gt; they want, or how many &lt;EM&gt;vertices&lt;/EM&gt;? &amp;nbsp;26 vertices in an &lt;EM&gt;open&lt;/EM&gt; Polyline is &lt;EM&gt;25&lt;/EM&gt; segments, but in a &lt;EM&gt;closed&lt;/EM&gt; one, &lt;EM&gt;26&lt;/EM&gt;.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 16:30:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5914032#M137422</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-11-18T16:30:51Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5914441#M137423</link>
      <description>&lt;P&gt;Hi How Are you.&lt;/P&gt;&lt;P&gt;Thanks also for your help.&lt;BR /&gt;I apologize for my English, this is a google translator. I only speak Spanish.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You have understood correctly what I want to achieve.&lt;/P&gt;&lt;P&gt;Deputy DWG the original and as it should be and it is as you say.&lt;/P&gt;&lt;P&gt;A vertex is added to the left side.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;They will never be closed polylines. (Not closed)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Herewith the lisp file.&lt;BR /&gt;Removing the dictionary.&lt;BR /&gt;Indeed the lisp fails with the example sent.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 18 Nov 2015 19:51:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5914441#M137423</guid>
      <dc:creator>carlos_m_gil_p</dc:creator>
      <dc:date>2015-11-18T19:51:15Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5915716#M137424</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2573929"&gt;@carlos_m_gil_p&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You have understood correctly what I want to achieve.&lt;/P&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Herewith the lisp file.&lt;BR /&gt;....&lt;BR /&gt;Indeed the lisp fails with the example sent.&lt;/P&gt;
&lt;P&gt;.....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;The divide-by-zero error is coming from this line:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; (setq avance (/ segdist &lt;FONT color="#FF0000"&gt;(fix &lt;FONT color="#0000FF"&gt;(/ segdist distancia)&lt;/FONT&gt;)&lt;/FONT&gt;))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;When it gets to a segment whose 'segdist' variable value&amp;nbsp;is &lt;EM&gt;shorter&lt;/EM&gt; than the 'distancia' variable,&amp;nbsp;&lt;SPAN&gt;&lt;FONT color="#0000FF"&gt;(/ segdist distancia)&lt;/FONT&gt; returns &lt;EM&gt;less than 1&lt;/EM&gt;, and applying &lt;FONT color="#FF0000"&gt;(fix)&lt;/FONT&gt; to that returns &lt;EM&gt;zero&lt;/EM&gt;. &amp;nbsp;When used on a Polyline &lt;EM&gt;without&lt;/EM&gt; any segments shorter than the eventual vertex spacing, it works, because that value is never zero.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;If you REPLACE that with this:&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;&amp;nbsp; (setq avance (/ segdist &lt;FONT color="#FF0000"&gt;&lt;FONT color="#008000"&gt;&lt;STRONG&gt;(max&lt;/STRONG&gt;&lt;/FONT&gt;&lt;FONT color="#000000"&gt; (&lt;/FONT&gt;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;f&lt;/FONT&gt;ix (/ segdist distancia)) &lt;FONT color="#008000"&gt;&lt;STRONG&gt;1)&lt;/STRONG&gt;&lt;/FONT&gt;))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;it will force the number to be at least 1, and it works for me in limited testing. &amp;nbsp;&lt;EM&gt;However&lt;/EM&gt;, I think something needs to be adjusted about some calculation [maybe that one, maybe something else -- I didn't dig very deeply because of the language issue]. &amp;nbsp;When I use that in your sample drawing, and ask for &lt;EM&gt;26&lt;/EM&gt; vertices, the result has&amp;nbsp;&lt;EM&gt;28&lt;/EM&gt;. &amp;nbsp;But at least it functions, and you can probably adjust it from there.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 14:30:52 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5915716#M137424</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-11-19T14:30:52Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5916125#M137425</link>
      <description>&lt;P&gt;Hello brother, how are you, thank you very much for your help.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Modify the line that you indicated to me.&lt;BR /&gt;The result is 28 vertices in this example.&lt;BR /&gt;Deputy lisp again translated into English&lt;BR /&gt;If that helps you&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You do not have to use my lisp specifically.&lt;BR /&gt;If you have another that meets the task, it would be very good&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have always divide such polylines and do it manually it becomes very complicated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As you can help, I appreciate it.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Excuse my English.&amp;nbsp;I hope you can understand.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 16:46:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5916125#M137425</guid>
      <dc:creator>carlos_m_gil_p</dc:creator>
      <dc:date>2015-11-19T16:46:55Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5916300#M137426</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2573929"&gt;@carlos_m_gil_p&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Modify the line that you indicated to me.&lt;BR /&gt;The result is 28 vertices in this example....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I think that must be because of the segments in the original Polyline that are &lt;EM&gt;very short&lt;/EM&gt; compared to the overall length. &amp;nbsp;It give the&amp;nbsp;correct&amp;nbsp;number of vertices&amp;nbsp;for me on a Polyline that does &lt;EM&gt;not&lt;/EM&gt; have such short segments, and it works without making that correction. &amp;nbsp;I have not explored it in great detail, and I am not acquainted with&amp;nbsp;some of the functions it uses, but I &lt;EM&gt;think&lt;/EM&gt; this is what it does:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;1) &amp;nbsp;Finds the overall length of the Polyline.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) &amp;nbsp;Divides that by the number of segments it will have with the requested number of vertices, to find the average length of a segment in the end result.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) &amp;nbsp;Calculates how many of those fit into each initial segment, rounding to the nearest integer, to determine how many new segments that initial segment should be divided into&amp;nbsp;in the end result.&amp;nbsp; [For any initial segments that are very short, it will be 1, meaning &lt;EM&gt;don't&lt;/EM&gt; add any vertices within that segment.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;4) &amp;nbsp;Adds vertices within each segment that's long enough to need it, to get that many smaller segments within it.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;What I &lt;EM&gt;think&lt;/EM&gt; it needs to do before step 4) above&amp;nbsp;is:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;3A) &amp;nbsp;Add up the &lt;EM&gt;total number&lt;/EM&gt; of new segments it calculated for each initial segment. &amp;nbsp;Those that are &lt;EM&gt;too short&lt;/EM&gt;&amp;nbsp;add 1 to this, even though they do &lt;EM&gt;not&lt;/EM&gt; add vertices -- that is where I think the problem is.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3B) &amp;nbsp;If that total&amp;nbsp;is &lt;EM&gt;more&lt;/EM&gt; than the end result should have, &lt;EM&gt;reduce&lt;/EM&gt;&amp;nbsp;the number of segments somewhere, for the correct total. &amp;nbsp;The too-short segments mean that the average new segment length, within segments that &lt;EM&gt;do&lt;/EM&gt; get subdivided, needs to be &lt;EM&gt;longer&lt;/EM&gt; than the length calculated by dividing the &lt;EM&gt;overall&lt;/EM&gt; length into the right number of segments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;In your example, it would obviously be the &lt;EM&gt;longest&lt;/EM&gt; segment that should be divided into &lt;EM&gt;fewer&lt;/EM&gt; segments than the original calculation for it. &amp;nbsp;But in some cases, it may be better to adjust the subdivision of &lt;EM&gt;more than one&lt;/EM&gt; initial segment. &amp;nbsp;It may not be easy to find a way to do that, or to decide &lt;EM&gt;whether&lt;/EM&gt; that should be done.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I think I will leave it to&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/940934"&gt;@marko_ribar&lt;/a&gt;&amp;nbsp;to further alter his&amp;nbsp;code, since he understands better than I do how it works. &amp;nbsp;It could be that the calculation that results in 0 for a short segment, which I suggested a correction to, needs to be kept with its zero result for purposes of adding up how many new segments each initial segment gets divided into, with a separate variable of some kind used in a different calculation to avoid the divide-by-zero error.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Or maybe all&amp;nbsp;initial segments should be evaluated for length&amp;nbsp;&lt;EM&gt;first&lt;/EM&gt;, and &lt;EM&gt;only&lt;/EM&gt; the lengths of those that are &lt;EM&gt;long enough&lt;/EM&gt; to need new vertices within them should be included in the calculation of the overall length to be divided, and therefore of the average new segment length to divide them into.&lt;/P&gt;</description>
      <pubDate>Thu, 19 Nov 2015 18:09:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5916300#M137426</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-11-19T18:09:34Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5918625#M137427</link>
      <description>&lt;P&gt;I played around with this, and came up with the attached &lt;STRONG&gt;DivPLVerts.lsp&lt;/STRONG&gt; with its &lt;STRONG&gt;DPV&lt;/STRONG&gt; command, which takes a different approach to several aspects of the problem, and which&amp;nbsp;[in limited testing]:&lt;/P&gt;
&lt;P&gt;1) &amp;nbsp;results in the right total number of vertices whether or not there are initial segments short enough not to need vertices added within them;&lt;/P&gt;
&lt;P&gt;2) &amp;nbsp;works on lightweight and heavy [both 2D &amp;amp; 3D] Polylines;&lt;/P&gt;
&lt;P&gt;3) &amp;nbsp;works in any Coordinate System, and on Polylines drawn in any [same or other] Coordinate System;&lt;/P&gt;
&lt;P&gt;4) &amp;nbsp;remembers your choice of how many vertices you want, and offers it as default on subsequent use;&lt;/P&gt;
&lt;P&gt;5) &amp;nbsp;preserves Polyline width if present [though with some alteration if it has&amp;nbsp;&lt;EM&gt;varying&lt;/EM&gt; width];&lt;/P&gt;
&lt;P&gt;6) &amp;nbsp;is quite a bit shorter.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Read the comments at the top of the file. &amp;nbsp;It does it by PEDITing the existing Polyline, adding vertices at calculated distances along the segments within it, rather than making another one. &amp;nbsp;So it doesn't need to concern itself with what function to use&amp;nbsp;to make it, what space you're in, its elevation, or any of that stuff, and it remains on its&amp;nbsp;Layer on with all its&amp;nbsp;other properties intact.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[It will "work" on Polylines with &lt;EM&gt;arc&lt;/EM&gt; segments, though that results in&amp;nbsp;some peculiarities because of how PEDIT handles them.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;You may well run into some peculiar situation I didn't test, in which it doesn't get it right -- if so, let me know, and I'll try to figure out how to fix it.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Nov 2015 23:10:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5918625#M137427</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2015-11-20T23:10:53Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5921055#M137428</link>
      <description>&lt;P&gt;Hello, how are you.&lt;/P&gt;&lt;P&gt;Thanks for the help.&lt;/P&gt;&lt;P&gt;It works well.&lt;/P&gt;&lt;P&gt;In case of an error, I will inform you.&lt;/P&gt;&lt;P&gt;Regards.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Nov 2015 16:34:33 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/5921055#M137428</guid>
      <dc:creator>carlos_m_gil_p</dc:creator>
      <dc:date>2015-11-23T16:34:33Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6200965#M137429</link>
      <description>&lt;P&gt;Hello Brother how are you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Using routine today.&lt;BR /&gt;I found a new error.&lt;BR /&gt;When the polyline has curve is drawn wrong.&lt;/P&gt;&lt;P&gt;Please could you check.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you and excuse my English, I only speak Spanish.&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2016 05:58:41 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6200965#M137429</guid>
      <dc:creator>carlos_m_gil_p</dc:creator>
      <dc:date>2016-03-06T05:58:41Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6201459#M137430</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2573929"&gt;@carlos_m_gil_p&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;.... When the polyline has curve is drawn wrong. ....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Yes, that is what I was referring to in [the sentence in brackets] in Post 12.&amp;nbsp; Since the Subject of the thread is about &lt;EM&gt;3D&lt;/EM&gt; Polylines, which &lt;EM&gt;can't have&lt;/EM&gt; arc segments, I only mentioned that in passing, but described&amp;nbsp;the routine&amp;nbsp;as working on 2D Polylines [lightweight or heavy], because the approach it takes &lt;EM&gt;does&lt;/EM&gt; work on them,&amp;nbsp;and just as expected when they are &lt;EM&gt;like&lt;/EM&gt; 3D Polylines in having only line segments.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To get it to work on &lt;EM&gt;arc&lt;/EM&gt; segments would require some different approach than PEDIT, because the problem is just a part of the way PEDIT adds vertices when arc segments are involved.&amp;nbsp; It may require constructing a &lt;EM&gt;new&lt;/EM&gt; Polyline, rather than &lt;EM&gt;changing&lt;/EM&gt; the&amp;nbsp;selected one.&amp;nbsp; I will have to think about that....&lt;/P&gt;</description>
      <pubDate>Sun, 06 Mar 2016 22:08:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6201459#M137430</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2016-03-06T22:08:31Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6201589#M137431</link>
      <description>&lt;P&gt;Hello how are you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for your answer.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll try seeing how I can solve it better.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Greetings.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 01:54:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6201589#M137431</guid>
      <dc:creator>carlos_m_gil_p</dc:creator>
      <dc:date>2016-03-07T01:54:34Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6202346#M137432</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello Kent&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) I like your DPV routine whick keeps XDATAs &amp;amp; ODs (Object Data of MAP/CIVIL) !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Could you confirm that the original vertex are maintained ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Please is it possible to get a NEW version able to run on N PLines simultaneously ?&lt;/P&gt;
&lt;P&gt;First the question about the number of vertex and THEN the selection ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks in advance, Regards, Patrice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 13:59:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6202346#M137432</guid>
      <dc:creator>braudpat</dc:creator>
      <dc:date>2016-03-07T13:59:34Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6202732#M137433</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/291579"&gt;@braudpat&lt;/a&gt; wrote:&lt;BR /&gt;
&lt;P&gt;....&amp;nbsp;&lt;/P&gt;
&lt;P&gt;1) I like your DPV routine whick keeps XDATAs &amp;amp; ODs (Object Data of MAP/CIVIL) !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) Could you confirm that the original vertex are maintained ?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) Please is it possible to get a NEW version able to run on N PLines simultaneously ?&lt;/P&gt;
&lt;P&gt;First the question about the number of vertex and THEN the selection ...&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;1) &amp;nbsp;That's an added benefit that I hadn't thought of, in addition to what I was thinking about&amp;nbsp;[keeping Layer, linetype, color, width, etc.].&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) &amp;nbsp;Yes, since it uses PEDIT and only Inserts vertices in that, it doesn't do anything to the existing ones -- have you had it do otherwise?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;3) &amp;nbsp;Attached is a version edited for multiple-Polyline selection. &amp;nbsp;I tested it rather lightly [just to confirm that it works on multiple objects, and adding the reporting of &lt;EM&gt;how many&lt;/EM&gt; it left alone in place of the &lt;EM&gt;single&lt;/EM&gt; reporting when one already has enough vertices], without trying it against all imaginable circumstances. &amp;nbsp;I left the file name and command name as they were, so if anyone has reason to want &lt;EM&gt;both&lt;/EM&gt; varieties, they should change those for one of them.&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 16:14:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6202732#M137433</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2016-03-07T16:14:10Z</dc:date>
    </item>
    <item>
      <title>Re: Modify 3D polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6202782#M137434</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Hello Kent&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;THANKS it works like a charm !&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks to your PEDIT solution which keeps XDATAs &amp;amp; ODs ...&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards, Patrice&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 16:33:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/modify-3d-polyline/m-p/6202782#M137434</guid>
      <dc:creator>braudpat</dc:creator>
      <dc:date>2016-03-07T16:33:46Z</dc:date>
    </item>
  </channel>
</rss>

