<?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: offset more then 1 polyline in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462792#M95458</link>
    <description>&lt;P&gt;@Anonymous,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;(defun c:r4test (/ ent pt i)
  (setq ent (car (entsel "\nSelect polyline to offset: "))
	pt (getpoint "\nSelect side to offset: "))
  (foreach i '(1 2 3)
    (command "._offset" i ent pt "")
    ;; if i is odd, change color to magenta
    (if (/= 0 (rem i 2)) ; is i an even number
      (command "CHPROP" (entlast) "" "C" "6" "")
      )
    )
  (princ)
  )&lt;/PRE&gt;
&lt;P&gt;This changes every other offset line to color 6, leaving the original entity alone. Did you want the selected pline changed to magenta?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, this code only offsets in one direction.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 12 Dec 2018 13:44:30 GMT</pubDate>
    <dc:creator>clindner</dc:creator>
    <dc:date>2018-12-12T13:44:30Z</dc:date>
    <item>
      <title>offset more then 1 polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462706#M95456</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;i have an issue i want to make a lisp command to offset 2 polylines as an example i have a picture below.&lt;/P&gt;
&lt;P&gt;the first are the polylines i need to offset. the second part is what i can get with a lisp i found online and the third picture is what i actually want.&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lisp.PNG" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/580495i3C757E7C878CC75F/image-size/large?v=v2&amp;amp;px=999" role="button" title="lisp.PNG" alt="lisp.PNG" /&gt;&lt;/span&gt;the lisp i use for the bottom part is as follows:&lt;/P&gt;
&lt;P&gt;(defun c:r4test ( / savesnap)&lt;BR /&gt; (setq ent (car (entsel "\nSelect polyline to offset: "))&lt;BR /&gt; pt (getpoint "\nSelect side to offset: "))&lt;BR /&gt; (foreach i '(distance 1 distance 2&amp;nbsp;distance 3 (command "._offset" i ent pt "")))&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;because i don't really know how to write these lisps i tried to add some for the line at the top. It seems not to be working and i cant really find an answer so far.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;could someone explain what i would need to add to this lisp to also offset the top polyline?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 13:19:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462706#M95456</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-12T13:19:53Z</dc:date>
    </item>
    <item>
      <title>Re: offset more then 1 polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462778#M95457</link>
      <description>&lt;P&gt;Ok, those purple ones, are they just different in color or on a different layer?&lt;/P&gt;
&lt;P&gt;Always post a dwg&amp;nbsp;then we don't need to ask these ridiculous questions.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Edit: Ok, you might not be able to. Then post on some other public cloud and post just a link.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 13:41:31 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462778#M95457</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2018-12-12T13:41:31Z</dc:date>
    </item>
    <item>
      <title>Re: offset more then 1 polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462792#M95458</link>
      <description>&lt;P&gt;@Anonymous,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this:&lt;/P&gt;
&lt;PRE&gt;(defun c:r4test (/ ent pt i)
  (setq ent (car (entsel "\nSelect polyline to offset: "))
	pt (getpoint "\nSelect side to offset: "))
  (foreach i '(1 2 3)
    (command "._offset" i ent pt "")
    ;; if i is odd, change color to magenta
    (if (/= 0 (rem i 2)) ; is i an even number
      (command "CHPROP" (entlast) "" "C" "6" "")
      )
    )
  (princ)
  )&lt;/PRE&gt;
&lt;P&gt;This changes every other offset line to color 6, leaving the original entity alone. Did you want the selected pline changed to magenta?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Also, this code only offsets in one direction.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;HTH.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 13:44:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462792#M95458</guid>
      <dc:creator>clindner</dc:creator>
      <dc:date>2018-12-12T13:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: offset more then 1 polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462796#M95459</link>
      <description>&lt;P&gt;Sorry i am new to this forum the purple lines are just a different colour.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 13:45:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462796#M95459</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-12T13:45:01Z</dc:date>
    </item>
    <item>
      <title>Re: offset more then 1 polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462828#M95460</link>
      <description>&lt;P&gt;Thanks i tried your code it does change the colours but not the&amp;nbsp; right polylines. i do have to say thats not the main issue is wanted to solve. but i appreciate the help.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;This is the first time i am trying to create a lisp so I can't say i know excactly what i am doing but as far as i have it now it works perfectly for the offsets at the bottom polyline.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 13:53:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462828#M95460</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-12T13:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: offset more then 1 polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462874#M95461</link>
      <description>&lt;P&gt;The first one.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun c:r2b ( / ensel)

  (if (and (setq ensel (entsel "\nSelect polyline to offset: "))
	   (or *2rb-dist*
	       (setq *2rb-dist* (abs (getvar 'OFFSETDIST))))
	   (setq *2rb-dist* (cond ((getdist (strcat "\nSpecify distance &amp;lt;" (rtos *2rb-dist*) "&amp;gt;:")))
				  (*2rb-dist*)))
	   )
    (command "_.offset" *2rb-dist*
	     (car ensel) (polar (cadr ensel) (* pi 0.5) *2rb-dist*)
	     (car ensel) (polar (cadr ensel) (* pi 1.5) *2rb-dist*)
	     ""
	     "_.chprop" (car ensel) "" "_C" "Magenta" ""))
  (princ)
)&lt;/PRE&gt;</description>
      <pubDate>Wed, 12 Dec 2018 14:05:01 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462874#M95461</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2018-12-12T14:05:01Z</dc:date>
    </item>
    <item>
      <title>Re: offset more then 1 polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462890#M95462</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;Thanks i tried your code it does change the colours but not the&amp;nbsp; right polylines.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Ok, maybe this will.&lt;/P&gt;
&lt;PRE&gt;(defun c:r4test (/ ent pt i)
  (setq ent (car (entsel "\nSelect polyline to offset: "))
	pt (getpoint "\nSelect side to offset: "))
  (foreach i '(1 2 3)
    (command "._offset" i ent pt "")
    ;; if i is odd, change color to magenta
    (if (= 0 (rem i 2)) ; is i an even number
      (command "CHPROP" (entlast) "" "C" "6" "")
      )
    )
  (command "CHPROP" ent "" "C" "6" "")
  (princ)
  )&lt;/PRE&gt;
&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;BLOCKQUOTE&gt;@Anonymous&amp;nbsp;wrote:&lt;BR /&gt;
&lt;P&gt;i do have to say thats not the main issue is wanted to solve&amp;nbsp;&amp;nbsp;&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;&amp;nbsp;Maybe we should start there! &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; What is the "main issue"?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The code I've provided will generate the results shown on the bottom right of your screenshot. If you also want the option to generate what's shown in the top right, then we need to consider how the user will choose which one they want.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 14:08:42 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462890#M95462</guid>
      <dc:creator>clindner</dc:creator>
      <dc:date>2018-12-12T14:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: offset more then 1 polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462955#M95463</link>
      <description>&lt;P&gt;I will try to explain what I think the lisp should do.&lt;/P&gt;
&lt;P&gt;I have 2 polylines 1 above the other.&lt;/P&gt;
&lt;P&gt;The bottom polyline has to offset 20 42.5 and 65 mm down&lt;/P&gt;
&lt;P&gt;and the top polyline has to offset 22.5 up and down.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;The part of the bottom polyline is working fine. I need to add code for the top polyline.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 14:22:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8462955#M95463</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-12T14:22:21Z</dc:date>
    </item>
    <item>
      <title>Re: offset more then 1 polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8463030#M95464</link>
      <description>&lt;PRE&gt;(defun c:R4 ( / *error* osm pt1 pt2 ss)
  
  (defun *error* (errmsg)
    (if (not (wcmatch errmsg "Function cancelled,quit / exit abort,console break,end"))
      (princ (strcat "\nError: " errmsg)))
    (if osmode (setvar 'OSMODE))
    (princ))
  
  (setq osm (getvar 'OSMODE))
  (setvar 'OSMODE 0)
  
  (if (and (setq pt1 (getpoint "\nSpecify point below bottom: "))
	   (setq pt2 (getcorner pt1 "\nSpecify point above upper: "))
	   (setq ss (ssget "_F" (list pt1 pt2)))
	   )
    (command "_.offset" 22.5
	     (ssname ss 1) pt1
	     (ssname ss 1) pt2
	     ""
	     "_.chprop" (ssname ss 1) "" "_C" "Magenta" ""
	     "._offset" 20 (ssname ss 0) pt1 ""
	     "._offset" 42.5 (ssname ss 0) pt1 ""
	     "_.chprop" "_Last" "" "_C" "Magenta" ""
	     "._offset" 65 (ssname ss 0) pt1 ""
	     "_.chprop" (ssname ss 0) "" "_C" "Magenta" ""))
  (*error* "end")
  )&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;STRONG&gt;&lt;FONT color="#FF0000"&gt;Edit:&lt;/FONT&gt;&lt;/STRONG&gt; Routine was turning off osnaps&amp;nbsp;and never get it back. Fixed now.&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 14:59:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8463030#M95464</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2018-12-12T14:59:45Z</dc:date>
    </item>
    <item>
      <title>Re: offset more then 1 polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8463039#M95465</link>
      <description>&lt;P&gt;That helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's definitely doable but would require a little more time that I can commit for developing at this point. Sorry.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm anxious to see what solution you end up with.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 14:44:06 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8463039#M95465</guid>
      <dc:creator>clindner</dc:creator>
      <dc:date>2018-12-12T14:44:06Z</dc:date>
    </item>
    <item>
      <title>Re: offset more then 1 polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8463073#M95466</link>
      <description>&lt;P&gt;Hello BeekeeCZ,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thank you very much it looks like this is excactly what i needed. I will run some tests with it later.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Kind regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Bas&lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 14:52:50 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8463073#M95466</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2018-12-12T14:52:50Z</dc:date>
    </item>
    <item>
      <title>Re: offset more then 1 polyline</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8463876#M95467</link>
      <description>&lt;P&gt;Actually, you haven't fixed it correctly...&lt;/P&gt;
&lt;P&gt;In error handler, it should be instead of :&lt;/P&gt;
&lt;PRE&gt;(if osmode (setvar 'OSMODE))&lt;/PRE&gt;
&lt;P&gt;like this :&lt;/P&gt;
&lt;PRE&gt;(if osm (setvar 'OSMODE osm))&lt;/PRE&gt;
&lt;P&gt;Regards, M.R. &lt;/P&gt;</description>
      <pubDate>Wed, 12 Dec 2018 19:21:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/offset-more-then-1-polyline/m-p/8463876#M95467</guid>
      <dc:creator>marko_ribar</dc:creator>
      <dc:date>2018-12-12T19:21:59Z</dc:date>
    </item>
  </channel>
</rss>

