<?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: polinha with two parameters in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830998#M68367</link>
    <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp; it works!!!&lt;BR /&gt;was trying to use &lt;STRONG&gt;ssadd&lt;/STRONG&gt; select and then join.&lt;/P&gt;&lt;P&gt;very good thank you.&lt;/P&gt;</description>
    <pubDate>Wed, 28 Oct 2020 20:06:31 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2020-10-28T20:06:31Z</dc:date>
    <item>
      <title>polinha with two parameters</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830848#M68362</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to create a routine where my polyline gets two parameters:&lt;BR /&gt;the first is the consistency between the verticies&lt;BR /&gt;the second is the maximum total length&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;how to make my polyline close while maintaining the preview of its design?&lt;BR /&gt;why doesn't my overall length work?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:foo ( )
  (setq tot_ '())
  (setq maximum_limit_between_vertices 90.0)
  (setq total_maximum_limit 4000.0)
  (setq pnt (getpoint "\nSpecify first point: "))
  (while
    (setq pnt_2 (getpoint pnt "\nSpecify next point: "))
    (if (&amp;gt; (setq dis_ (distance  pnt pnt_2)) maximum_limit_between_vertices)
      (alert "total limit exceeded.")
      (progn
        (command "_.Pline" pnt pnt_2 "")
        ;**polylines not closing!
        (setq pnt pnt_2)
        (setq tot_ (append (list dis_) tot_))
        (if (&amp;gt; (apply '+ tot_) total_maximum_limit)
          (alert "total general limit exceeded.")          
        )
      )
    )
  )
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 18:45:57 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830848#M68362</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-28T18:45:57Z</dc:date>
    </item>
    <item>
      <title>Re: polinha with two parameters</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830883#M68363</link>
      <description>&lt;P&gt;ad 1, see below&lt;/P&gt;
&lt;P&gt;ad 2, it does.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun c:foo ( )
  (setq tot_ '())
  (setq maximum_limit_between_vertices 90.0)
  (setq total_maximum_limit 200.0)
  (setq pnt_0 (getpoint "\nSpecify first point: ")
	pnt pnt_0)
  (while
    (setq pnt_2 (getpoint pnt "\nSpecify next point: "))
    (if (&amp;gt; (setq dis_ (distance  pnt pnt_2)) maximum_limit_between_vertices)
      (alert "total limit exceeded.")
      (progn
        (command "_.Pline" pnt pnt_2 "")
        ;**polylines not closing!
        (setq pnt pnt_2)
        (setq tot_ (append (list dis_) tot_))
        (if (&amp;gt; (apply '+ tot_) total_maximum_limit)
          (alert "total general limit exceeded.")          
        )
      )
    )
  )
  (command "_.pline" "" pnt_0 "")
)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 28 Oct 2020 19:02:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830883#M68363</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2020-10-28T19:02:07Z</dc:date>
    </item>
    <item>
      <title>Re: polinha with two parameters</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830892#M68364</link>
      <description>&lt;P&gt;This is almost like leaving a single "JOIN" polyline, as you did it remains separate.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 19:08:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830892#M68364</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-28T19:08:12Z</dc:date>
    </item>
    <item>
      <title>Re: polinha with two parameters</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830972#M68365</link>
      <description>&lt;P&gt;Try like this&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(defun c:foo ( )
;(setq tot_ '())
(setq tot_ 0.0)
(setq maximum_limit_between_vertices 90.0)
(setq total_maximum_limit 4000.0)
(setq pnt (getpoint "\nSpecify first point: ")
	  pnt_0 pnt)
  (while (&amp;lt;= tot_ total_maximum_limit)
    (setq pnt_2 (getpoint pnt "\nSpecify next point: "))
    (if (&amp;gt; (setq dis_ (distance  pnt pnt_2)) maximum_limit_between_vertices)
      (alert "total limit exceeded.")
      (progn
        (command "_.Pline" pnt pnt_2 "")
        ;**polylines not closing!
        (setq pnt pnt_2)
        ;(setq tot_ (append (list dis_) tot_))
		(setq tot_ (+ dis_ tot_))
        ;(if (&amp;gt; (apply '+ tot_) total_maximum_limit)
		(if (&amp;gt; tot_ total_maximum_limit)
          (alert "total general limit exceeded.")
        )
      )
    )
  )
  (command "_.pline" "" pnt_0 "")
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 19:57:07 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830972#M68365</guid>
      <dc:creator>dbhunia</dc:creator>
      <dc:date>2020-10-28T19:57:07Z</dc:date>
    </item>
    <item>
      <title>Re: polinha with two parameters</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830994#M68366</link>
      <description>&lt;P&gt;I have a feeling, from Message 3, that you mean the single-segment Polylines are not &lt;EM&gt;joining&lt;/EM&gt;&amp;nbsp; into one Polyline as you go, rather than that they are not &lt;EM&gt;closing&lt;/EM&gt;.&amp;nbsp; If that's correct, try this [very lightly tested]:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;(defun c:foo (/ pnt pnt_2 dis_ tot_ pltotal)
  (setq maximum_limit_between_vertices 90.0)
  (setq total_maximum_limit 4000.0)
  (setq pnt (getpoint "\nSpecify first point: "))
  (while (setq pnt_2 (getpoint pnt "\nSpecify next point or &amp;lt;end&amp;gt;: "))
    (if (&amp;gt; (setq dis_ (distance  pnt pnt_2)) maximum_limit_between_vertices)
      (alert "segment limit exceeded."); then
      (progn ; else
        (setq tot_ (append (list dis_) tot_))
        (if (&amp;gt; (apply '+ tot_) total_maximum_limit)
          (progn ; then
            (alert "total general limit exceeded.")
            (setq tot_ (cdr tot_)); take latest added distance off
          ); progn
          (progn ; else
            (command "_.Pline" pnt pnt_2 "")
            (if pltotal
              (command "_.pedit" pltotal "_join" (entlast) "" ""); then
              (setq pltotal (entlast)); else [first one]
            ); if
            (setq pnt pnt_2)
          ); progn
        ); if
      ); progn
    ); if
  ); while
  (princ)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If you want an option to Close the Polyline, that could be added, but it would have to account again, using the start point this time rather than a picked point, for whether the closing segment &lt;EM&gt;and&lt;/EM&gt;&amp;nbsp; the closed total are too long.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 20:08:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830994#M68366</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2020-10-28T20:08:09Z</dc:date>
    </item>
    <item>
      <title>Re: polinha with two parameters</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830998#M68367</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/69526"&gt;@Kent1Cooper&lt;/a&gt;&amp;nbsp; it works!!!&lt;BR /&gt;was trying to use &lt;STRONG&gt;ssadd&lt;/STRONG&gt; select and then join.&lt;/P&gt;&lt;P&gt;very good thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 20:06:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9830998#M68367</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2020-10-28T20:06:31Z</dc:date>
    </item>
    <item>
      <title>Re: polinha with two parameters</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9831037#M68368</link>
      <description>&lt;P&gt;Here's another example removing all command calls:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;(defun c:foo (/ d maxd maxv p1 p2 r vl)
  ;; RJP » 2020-10-28
  (setq d 0)
  (setq maxd 4000.)
  (setq maxv 90.)
  (while (and (or p1 (and (setq p1 (getpoint "\nSpecify start point: ")) (setq r (cons p1 r))))
	      (setq p2 (getpoint p1 "\nSpecify next point: "))
	 )
    (cond ((&amp;gt; (+ d (distance p1 p2)) maxd) (alert "MAX DISTANCE REACHED!"))
	  ((&amp;gt; (distance p1 p2) maxv) (alert "SEGMENT TOO LONG!"))
	  ((setq d (+ d (distance p1 p2)))
	   (grvecs (append (setq vl (append vl (list p1 p2))) '(1)))
	   (setq r (cons (setq p1 p2) r))
	   (princ (strcat "\rRunning total: " (rtos d)))
	  )
    )
  )
  (if r
    (entmakex (append (list '(0 . "LWPOLYLINE")
			    '(100 . "AcDbEntity")
			    ;; Create your layername here
			    '(8 . "MaxDistancePolyline")
			    '(100 . "AcDbPolyline")
			    (cons 90 (length r))
			    ;; Change this to 1 to close the polyline
			    '(70 . 0)
		      )
		      (mapcar (function (lambda (x) (list 10 (car x) (cadr x)))) (reverse r))
	      )
    )
  )
  (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 20:34:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9831037#M68368</guid>
      <dc:creator>ronjonp</dc:creator>
      <dc:date>2020-10-28T20:34:42Z</dc:date>
    </item>
    <item>
      <title>Re: polinha with two parameters</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9831125#M68369</link>
      <description>&lt;P&gt;@Anonymous&amp;nbsp; hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;check this one. first it collects all points and only at end draw the pline.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;enjoy&lt;/P&gt;&lt;P&gt;moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:foo (/ askpoint main_exe ; local functions
                MAX_VERTEX_LENGTH MAX_PLINE_LENGTH dis_ tot_ pnt_0 pnt_1 pnt_2 n flag points_)

 (defun askpoint ()
  (setq n (1+ n))
   
  (cond
   ((= n 0)
    (getpoint "\nSpecify first point: ")
   )
   ((= n 1)
    (getpoint pnt_1 "\nSpecify next point: ")
   )
   ( t
    (initget "Close")
    (getpoint pnt_1 "\nSpecify next point or [Close]: ")
   )
  ); cond
 ); askpoint


 (defun main_exe (p1 p2)
  (cond
   ((&amp;gt; (setq dis_ (distance p1 p2)) MAX_VERTEX_LENGTH)
    (alert "total limit exceeded.")
   ); case
   ( t
    (setq tot_ (append (list dis_) tot_))
    (if (&amp;gt; (apply '+ tot_) MAX_PLINE_LENGTH)
     (alert "total general limit exceeded.")
     (progn 
      (grdraw p1 p2 7) 
       p2 ; retun p2 to caller
     )
    )
   ); case 
  ); cond
 ); main_exe


 ; here start c:foo 
 (setvar "cmdecho" 0)
 (command "._undo" "_begin")
  
 (setq MAX_VERTEX_LENGTH  90.0)
 (setq MAX_PLINE_LENGTH  4000.0)

 (setq tot_ '() n -1 points '())
  
 (if (setq pnt_0 (setq pnt_1 (askpoint)))
  (progn 
   (while (and (not flag) (setq pnt_2 (askpoint)))
    (if (eq pnt_2 "Close")
     (progn
      (setq points_ (append points_ (list "_Close"))) 
      (setq flag (main_exe pnt_1 pnt_0))
     ); progn
     (if (setq tmp (main_exe pnt_1 pnt_2))
      (setq points_ (append points_ (list (setq pnt_1 tmp))))
     )
    ); if 
   ); while

   (if (&amp;gt; (length (cons pnt_0 points_)) 1)
    (progn 
     (command "._pline" pnt_0 "w" 0 0)
     (foreach pt (reverse (cdr (reverse points_)))
      (command pt)
     )

     (if (eq (last points_) "_Close")
      (command (last points_))
      (command (last points_) "") 
     )
    ); progn
   ); if
   
  ); progn
 ); if


 (command "._undo" "_end")
 (setvar "cmdecho" 1)
  
 (princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 28 Oct 2020 21:37:05 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9831125#M68369</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2020-10-28T21:37:05Z</dc:date>
    </item>
    <item>
      <title>Re: polinha with two parameters</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9831640#M68370</link>
      <description>&lt;P&gt;Good Morning&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;had a small bug so here is the fix. note that it allows the Close option&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Moshe&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:foo (/ askpoint main_exe ; local functions
                MAX_VERTEX_LENGTH MAX_PLINE_LENGTH dis_ tot_ pnt_0 pnt_1 pnt_2 n flag points_)

 (defun askpoint ()
  (setq n (1+ n))
   
  (cond
   ((= n 0)
    (getpoint "\nSpecify first point: ")
   )
   ((= n 1)
    (getpoint pnt_1 "\nSpecify next point: ")
   )
   ( t
    (initget "Close")
    (getpoint pnt_1 "\nSpecify next point or [Close]: ")
   )
  ); cond
 ); askpoint


 (defun main_exe (p1 p2)
  (cond
   ((&amp;gt; (setq dis_ (distance p1 p2)) MAX_VERTEX_LENGTH)
    (alert "total limit exceeded.")
   ); case
   ( t
    (setq tot_ (append (list dis_) tot_))
    (if (&amp;gt; (apply '+ tot_) MAX_PLINE_LENGTH)
     (alert "total general limit exceeded.")
     (progn 
      (grdraw p1 p2 7) 
       p2 ; retun p2 to caller
     )
    )
   ); case 
  ); cond
 ); main_exe


 ; here start c:foo 
 (setvar "cmdecho" 0)
 (command "._undo" "_begin")
  
 (setq MAX_VERTEX_LENGTH  90.0)
 (setq MAX_PLINE_LENGTH  400.0)

 (setq tot_ '() n -1 points '())
  
 (if (setq pnt_0 (setq pnt_1 (askpoint)))
  (progn 
   (while (and (not flag) (setq pnt_2 (askpoint)))
    (cond
     ((eq pnt_2 "Close")
      (if (setq flag (main_exe pnt_1 pnt_0))
       (setq points_ (append points_ (list "_Close")))
      )
     ); case
     ( t
      (if (setq tmp (main_exe pnt_1 pnt_2))
       (setq points_ (append points_ (list (setq pnt_1 tmp))))
      )
     ); case
    ); cond 
   ); while

   (redraw)
   
   (if (&amp;gt; (length (cons pnt_0 points_)) 1)
    (progn 
     (command "._pline" pnt_0 "w" 0 0)
     (foreach pt (reverse (cdr (reverse points_)))
      (command pt)
     )

     (if (eq (last points_) "_Close")
      (command (last points_))
      (command (last points_) "") 
     )
    ); progn
   ); if
   
  ); progn
 ); if


 (command "._undo" "_end")
 (setvar "cmdecho" 1)
  
 (princ)
)
&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 29 Oct 2020 06:41:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/polinha-with-two-parameters/m-p/9831640#M68370</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2020-10-29T06:41:44Z</dc:date>
    </item>
  </channel>
</rss>

