<?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: Wrong line coordinates in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8756965#M89338</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;;------------------------------------------
(defun hpromptr (textq default_value / tmp)
(initget 6)
(setq tmp (cond ( (getreal (strcat "\n" textq " &amp;lt;" (rtos default_value) "&amp;gt; : "))) (default_value)))
)
;-------------------------------------------
;-------------------------------------------
;-------------------------------------------
;-------------------------------------------

(defun c:ooo(/ osm stp w p1 p2 nw xd y1 y2 p3 p4)
; (hinit)
; (hlayer "_Grid")
(cond ( (/= (getvar 'osmode) 0) (setq osm (getvar 'osmode)) (setvar 'osmode 0)))

(setq stp (hpromptr "Step" 100.0 ))
(setq w (hpromptr "Frame Width" 0.1))


(setq p1 (getpoint "\nPick first point: "))
(setq p2 (getcorner p1 "\nPick second point: "))
;(command "rectang" "w" w p1 p2)
(command "rectang" "w" w p1 p2)

(setq nw (fix (/ (- (car p2) (car p1)) stp)))

;(p nw)

(setq xd (car p1))
(setq y1 (cadr p1))
(setq y2 (cadr p2))

(repeat nw
  (setq xd (+ xd stp))
  (setq p3 (list xd y1 0.0))
  (setq p4 (list xd y2 0.0))
  (command "line" p3 p4 "")
)

(if osm (setvar 'osmode osm))
; (hprev_layer)
; (hend)
)
&lt;/PRE&gt;</description>
    <pubDate>Sat, 27 Apr 2019 08:30:26 GMT</pubDate>
    <dc:creator>dlanorh</dc:creator>
    <dc:date>2019-04-27T08:30:26Z</dc:date>
    <item>
      <title>Wrong line coordinates</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8756887#M89336</link>
      <description>&lt;P&gt;Hello there,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I wrote the following lsp to make a grid of vertical lines and bounding box with an input stp.&lt;/P&gt;
&lt;P&gt;My problem is the lines not in correct position,lthough I printed point coordinates p3, p4 to make sure calculations are correct. they appear to be so.&lt;/P&gt;
&lt;P&gt;here is my lsp. Any help??&lt;/P&gt;
&lt;P&gt;thank you&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;;------------------------------------------&lt;BR /&gt;(defun hpromptr (textq default_value)&lt;BR /&gt;(setq tmp (getreal ( strcat "\n" textq "[" (rtos default_value) "]" )))&lt;BR /&gt;(if (= tmp nil) (setq tmp default_value))&lt;BR /&gt;(setq tmp tmp)&lt;BR /&gt;)&lt;BR /&gt;;-------------------------------------------&lt;BR /&gt;;-------------------------------------------&lt;BR /&gt;;-------------------------------------------&lt;BR /&gt;;-------------------------------------------&lt;/P&gt;
&lt;P&gt;(defun c:ooo(/ i nw xd stp p1 p2 p3 p4 w width &lt;BR /&gt;x1 y1 x2 y2 pp)&lt;BR /&gt;; (hinit)&lt;BR /&gt;; (hlayer "_Grid")&lt;/P&gt;
&lt;P&gt;(setq stp (hpromptr "Step:" 100.0 ))&lt;BR /&gt;(setq w (hpromptr "Fram Width:" 0.1))&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;(setq p1 (getpoint "\nPick first point: "))&lt;BR /&gt;(setq p2 (getcorner p1 "\nPick second point: "))&lt;BR /&gt;(command "rectang" "w" w p1 p2)&lt;BR /&gt;(command "rectang" "w" w p1 p2)&lt;/P&gt;
&lt;P&gt;(setq width (- (car p2) (car p1)))&lt;BR /&gt;(setq nw (fix (/ width stp)))&lt;/P&gt;
&lt;P&gt;(p nw)&lt;/P&gt;
&lt;P&gt;(setq xd (car p1))&lt;BR /&gt;(setq i 0)&lt;BR /&gt;&lt;BR /&gt;(setq y1 (cadr p1))&lt;BR /&gt;(setq y2 (cadr p2))&lt;BR /&gt;&lt;BR /&gt;(repeat nw&lt;/P&gt;
&lt;P&gt;(setq pp (+ xd stp))&lt;BR /&gt;(setq xd pp)&lt;BR /&gt;(setq p3 (list pp y1 0.0))&lt;BR /&gt;(setq p4 (list pp y2 0.0))&lt;/P&gt;
&lt;P&gt;(command "line" p3 p4 "")&lt;/P&gt;
&lt;P&gt;)&lt;/P&gt;
&lt;P&gt;; (hprev_layer)&lt;BR /&gt;; (hend)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="acad_2019-04-27_07-41-11.jpg" style="width: 199px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/630624i53CCE5429FCF2756/image-dimensions/199x207?v=v2" width="199" height="207" role="button" title="acad_2019-04-27_07-41-11.jpg" alt="acad_2019-04-27_07-41-11.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2019 05:44:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8756887#M89336</guid>
      <dc:creator>hseeda</dc:creator>
      <dc:date>2019-04-27T05:44:21Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong line coordinates</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8756963#M89337</link>
      <description>&lt;P&gt;Looks like you need to turn off osnaps for your routine.&lt;/P&gt;
&lt;P&gt;(setvar 'osmode 0)&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2019 08:23:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8756963#M89337</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2019-04-27T08:23:21Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong line coordinates</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8756965#M89338</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;;------------------------------------------
(defun hpromptr (textq default_value / tmp)
(initget 6)
(setq tmp (cond ( (getreal (strcat "\n" textq " &amp;lt;" (rtos default_value) "&amp;gt; : "))) (default_value)))
)
;-------------------------------------------
;-------------------------------------------
;-------------------------------------------
;-------------------------------------------

(defun c:ooo(/ osm stp w p1 p2 nw xd y1 y2 p3 p4)
; (hinit)
; (hlayer "_Grid")
(cond ( (/= (getvar 'osmode) 0) (setq osm (getvar 'osmode)) (setvar 'osmode 0)))

(setq stp (hpromptr "Step" 100.0 ))
(setq w (hpromptr "Frame Width" 0.1))


(setq p1 (getpoint "\nPick first point: "))
(setq p2 (getcorner p1 "\nPick second point: "))
;(command "rectang" "w" w p1 p2)
(command "rectang" "w" w p1 p2)

(setq nw (fix (/ (- (car p2) (car p1)) stp)))

;(p nw)

(setq xd (car p1))
(setq y1 (cadr p1))
(setq y2 (cadr p2))

(repeat nw
  (setq xd (+ xd stp))
  (setq p3 (list xd y1 0.0))
  (setq p4 (list xd y2 0.0))
  (command "line" p3 p4 "")
)

(if osm (setvar 'osmode osm))
; (hprev_layer)
; (hend)
)
&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Apr 2019 08:30:26 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8756965#M89338</guid>
      <dc:creator>dlanorh</dc:creator>
      <dc:date>2019-04-27T08:30:26Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong line coordinates</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8756972#M89339</link>
      <description>&lt;P&gt;You can also try by this change only (without manipulating "OSMODE").......&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(command "line" &lt;FONT color="#FF0000"&gt;"_none"&lt;/FONT&gt; p3 &lt;FONT color="#FF0000"&gt;"_none"&lt;/FONT&gt; p4 "")&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2019 08:43:12 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8756972#M89339</guid>
      <dc:creator>dbhunia</dc:creator>
      <dc:date>2019-04-27T08:43:12Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong line coordinates</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8756991#M89340</link>
      <description>&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/3148552"&gt;@hseeda&lt;/a&gt;&amp;nbsp;hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;follow the good advises you got here but if you want to upgrade it a little more, make it support draw the rectangle from any direction meaning from upper right corner down to bottom left (and any other direction) this may easily implemented with (polar) function to calculate the points accordingly.&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;</description>
      <pubDate>Sat, 27 Apr 2019 09:05:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8756991#M89340</guid>
      <dc:creator>Moshe-A</dc:creator>
      <dc:date>2019-04-27T09:05:29Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong line coordinates</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8757328#M89341</link>
      <description>&lt;P&gt;Great. Thanks. but why? what is the _none in the command?&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2019 16:43:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8757328#M89341</guid>
      <dc:creator>hseeda</dc:creator>
      <dc:date>2019-04-27T16:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong line coordinates</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8757329#M89342</link>
      <description>&lt;P&gt;Thanks for the reply. Alot of ideas can be implemented, but I was buzzled by the missalignment. NOw I figure out its the osnap settings.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2019 16:45:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8757329#M89342</guid>
      <dc:creator>hseeda</dc:creator>
      <dc:date>2019-04-27T16:45:47Z</dc:date>
    </item>
    <item>
      <title>Re: Wrong line coordinates</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8757443#M89343</link>
      <description>&lt;P&gt;Why you have to turn the osnaps off? Because of this setting of yours:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="image.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/630727i35B110BE28B467B3/image-size/medium?v=v2&amp;amp;px=400" role="button" title="image.png" alt="image.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Why putting non prior &lt;STRONG&gt;&lt;EM&gt;all point user inputs within command&lt;/EM&gt;&lt;/STRONG&gt; works? Because of&amp;nbsp;&lt;A href="http://help.autodesk.com/view/ACD/2019/ENU/?guid=GUID-CF5780AD-D1AB-4526-9608-83D7952749E7" target="_blank" rel="noopener"&gt;THIS&lt;/A&gt;&amp;nbsp;feature, specifically the last item in the list.&lt;/P&gt;
&lt;P&gt;BTW&amp;nbsp;&amp;nbsp;&lt;EM&gt;None&lt;/EM&gt;&amp;nbsp;you should also add prior points defying the rectangle.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Apr 2019 19:01:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/wrong-line-coordinates/m-p/8757443#M89343</guid>
      <dc:creator>ВeekeeCZ</dc:creator>
      <dc:date>2019-04-27T19:01:54Z</dc:date>
    </item>
  </channel>
</rss>

