<?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: Copy objects using previous basepoint in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6201807#M134219</link>
    <description>&lt;P&gt;Thanks guys for all the help.&lt;/P&gt;&lt;P&gt;I did try all the lisp programs but i think the problem rests in the copy command in Autocad itself and not within the Lisp Programming.&lt;/P&gt;&lt;P&gt;When i do copy an object, Autocad does not temporarily disable the snaps when you input a distance. causing it to snap to diferent objects when it lays the copy down.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will continue to investigate and post if i find a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 07 Mar 2016 07:22:34 GMT</pubDate>
    <dc:creator>Anonymous</dc:creator>
    <dc:date>2016-03-07T07:22:34Z</dc:date>
    <item>
      <title>Copy objects using previous basepoint</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6055976#M134214</link>
      <description>&lt;P&gt;Hey guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I currently have a small LISP program that i wrote that will copy an object to multiple positions and the basepoint would change according to the new position.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the problem i have with my LISP program is that when i call up the COPY command, i cannot temporarily&amp;nbsp;disable my snaps after i have selected the new position. When i place an object down and want to copy the object 3000mm to the right (can be any length or direction), it will snap to any other object in the vacinity of the new position.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have had a look at using the standard COPY&amp;nbsp;command, the only problem with that is if i want it to update my basepoint, i have to pick a basepoint, and then shift-right-click and select "From", then select the basepoint again before i can carry on, and i will have to do this every time i use the COPY command.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Below is the Lisp program, if anybody could help, it would be highly appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(defun C:BASECOPY( / selset pt xsel)&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;(defun *error* (msg)&lt;BR /&gt;(princ "Error: ")&lt;BR /&gt;(princ msg)&lt;BR /&gt;(setvar "OSMODE" cosmode)&lt;BR /&gt;(command "COLOR" ccolor)&lt;BR /&gt;(setvar "CLAYER" curlayer)&lt;BR /&gt;(command "LINETYPE" cline)&lt;BR /&gt;(setvar "cmdecho" 1)&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;&lt;P&gt;(setq cosmode (getvar "OSMODE")&lt;BR /&gt;ccolor (getvar "COLOR")&lt;BR /&gt;curlayer (getvar "CLAYER")&lt;BR /&gt;cline (getvar "LINETYPE"))&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;(setq selset (ssget))&lt;BR /&gt;(setq pt (getpoint "\nSpecify Base Point:"))&lt;BR /&gt;(while&lt;BR /&gt;(setq xsel (entlast))&lt;BR /&gt;(command "COPY" selset "" pt Pause "'_OSMODE" 0)&lt;BR /&gt;(setq pt (car (cdr (grread 1 4 1 ))))&lt;BR /&gt;(setq pt (getvar "lastpoint"))&lt;BR /&gt;(setq selset (ssadd))&lt;BR /&gt;(while (/= xsel nil)&lt;BR /&gt;(if (/= xsel nil)(setq xsel (entnext xsel)))&lt;BR /&gt;(if (/= xsel nil)(ssadd xsel selset))&lt;BR /&gt;)&lt;BR /&gt;(setvar "OSMODE" cosmode)&lt;BR /&gt;)&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 11:17:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6055976#M134214</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-02-25T11:17:48Z</dc:date>
    </item>
    <item>
      <title>Re: Copy objects using previous basepoint</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6056063#M134215</link>
      <description>&lt;DIV style="font-size: 12px; font-style: italic; color: blue; margin-left: 25px; margin-bottom: 25px; padding: 3px; border: 1px dotted black; font-family: verdana;"&gt;CGeylen wrote:&lt;BR /&gt;




&lt;P&gt;Now the problem i have with my LISP program is that when i call up the COPY command, i cannot temporarily&amp;nbsp;disable my snaps after i have selected the new position. When i place an object down and want to copy the object 3000mm to the right (can be any length or direction), it will snap to any other object in the vacinity of the new position.&lt;/P&gt;
&lt;/DIV&gt;

&lt;P&gt;
You can call the "non" object snap mode to disable object snap.
&lt;/P&gt;&lt;P&gt;
Example: (command "._arc" "_non" pt1 "_non" pt2)





&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 12:21:56 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6056063#M134215</guid>
      <dc:creator>rkmcswain</dc:creator>
      <dc:date>2016-02-25T12:21:56Z</dc:date>
    </item>
    <item>
      <title>Re: Copy objects using previous basepoint</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6056919#M134216</link>
      <description>&lt;P&gt;Not sure ab OSNAPs, but few years ago I wrote something similar to your routine... You can try it, it has many options and I use it very often...&lt;/P&gt;&lt;P&gt;Maybe it can help you, although not sure ab snapping, but I had no such issues when inputing multiple copy actions for the same distance and same direction...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Routine can be found here :&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.theswamp.org/index.php?topic=40547.msg481693#msg481693" target="_blank"&gt;https://www.theswamp.org/index.php?topic=40547.msg481693#msg481693&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;HTH, M.R.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Feb 2016 19:55:55 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6056919#M134216</guid>
      <dc:creator>marko_ribar</dc:creator>
      <dc:date>2016-02-25T19:55:55Z</dc:date>
    </item>
    <item>
      <title>Re: Copy objects using previous basepoint</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6058342#M134217</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;@Anonymous wrote:&lt;BR /&gt;
&lt;P&gt;...&amp;nbsp;a small LISP program that i wrote that will copy an object to multiple positions and the basepoint would change according to the new position.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;.... When i place an object down and want to copy the object 3000mm to the right (can be any length or direction), it will snap to any other object in the vacinity of the new position.&lt;/P&gt;
&lt;P&gt;....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;(defun C:BASECOPY( / selset pt xsel)&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;(defun *error* (msg)&lt;EM&gt;&lt;FONT color="#ff0000"&gt; ; this should be listed among localized variables to revert to AutoCAD's when done&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;(princ "Error: ")&lt;BR /&gt;(princ msg)&lt;BR /&gt;(setvar "OSMODE" cosmode)&lt;BR /&gt;(command "COLOR" ccolor) &lt;EM&gt;&lt;FONT color="#ff0000"&gt;; newer versions don't like (command) functions in *error*&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;(setvar "CLAYER" curlayer)&lt;BR /&gt;(command "LINETYPE" cline) &lt;EM&gt;&lt;FONT color="#ff0000"&gt;; newer versions don't like (command) functions in *error*&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;(setvar "cmdecho" 1)&lt;EM&gt;&lt;FONT color="#ff0000"&gt; ; [cmdecho was never turned off]&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;(princ)&lt;BR /&gt;)&lt;/P&gt;
&lt;P&gt;(setq cosmode (getvar "OSMODE")&lt;BR /&gt;ccolor (getvar "&lt;FONT color="#ff0000"&gt;COLOR&lt;/FONT&gt;")&lt;EM&gt;&lt;FONT color="#ff0000"&gt; ; incorrect System Variable name&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;curlayer (getvar "CLAYER")&lt;BR /&gt;cline (getvar "&lt;FONT color="#ff0000"&gt;LINETYPE&lt;/FONT&gt;"))&lt;EM&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp;; incorrect System Variable name&lt;/FONT&gt;&lt;/EM&gt;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;(setq selset (ssget))&lt;BR /&gt;(setq pt (getpoint "\nSpecify Base Point:"))&lt;BR /&gt;(while&lt;BR /&gt;(setq xsel (entlast))&lt;BR /&gt;(command "COPY" selset "" pt Pause "'_OSMODE" 0)&lt;BR /&gt;(setq pt (car (cdr (grread 1 4 1 ))))&lt;BR /&gt;(setq pt (getvar "lastpoint"))&lt;BR /&gt;(setq selset (ssadd))&lt;BR /&gt;(while (/= xsel nil)&lt;FONT color="#ff00ff"&gt; ; [not used in mine, but this kind of thing can be just &amp;nbsp;&lt;FONT color="#0000ff"&gt;(while xsel&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp; &lt;FONT color="#ff00ff"&gt;; since the mere existence of the variable is the same as its not being nil]&lt;/FONT&gt;&lt;BR /&gt;(if (/= xsel nil)(setq xsel (entnext xsel))) &lt;FONT color="#ff00ff"&gt;; and likewise, just &amp;nbsp;&lt;FONT color="#0000ff"&gt;(if xsel&lt;/FONT&gt;&amp;nbsp; ]&lt;/FONT&gt;&lt;BR /&gt;(if (/= xsel nil)(ssadd xsel selset))&lt;BR /&gt;)&lt;BR /&gt;(setvar "OSMODE" cosmode)&lt;BR /&gt;)&lt;BR /&gt;(princ)&lt;EM&gt;&lt;FONT color="#ff0000"&gt; ; no point -- it never gets to this, since it has to be ended with Esc&lt;/FONT&gt;&lt;/EM&gt;&lt;BR /&gt;)&lt;/P&gt;
&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;I would go about this in a different way.&amp;nbsp; If you &lt;EM&gt;Copy&lt;/EM&gt; things &lt;EM&gt;in place&lt;/EM&gt; and then &lt;EM&gt;Move&lt;/EM&gt; the copy, you can keep going along using the &lt;EM&gt;Previous&lt;/EM&gt; selection repeatedly, without the need to re-construct the selection set every time.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;[You also have some errors I commented about above.]&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Try this, which goes about it in the Copy-in-place-then-Move way, and does not Osnap to nearby locations when given direction-and-distance input as you describe:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;(defun C:BASECOPY(/ &lt;STRONG&gt;&lt;FONT color="#0000ff"&gt;*error*&lt;/FONT&gt;&lt;/STRONG&gt; cosmode ccolor curlayer cline n ss)

  (defun *error* (msg)
    (if (not (wcmatch msg "Function cancelled,quit / exit abort,console break"))
      (prompt (strcat "Error: " msg))
    )&lt;FONT color="#999999"&gt;; if
&lt;/FONT&gt;    (setvar 'osmode cosmode)
    (&lt;STRONG&gt;&lt;FONT color="#0000ff"&gt;setvar 'cecolor&lt;/FONT&gt;&lt;/STRONG&gt; ccolor)
    (setvar 'clayer curlayer)
    (&lt;FONT color="#0000ff"&gt;&lt;STRONG&gt;setvar 'celtype&lt;/STRONG&gt;&lt;/FONT&gt; cline)
    (repeat (setq n (sslength (setq ss (ssget "_P"))))
      (entdel (ssname ss (setq n (1- n))))&lt;BR /&gt;      &lt;EM&gt;&lt;FONT color="#008000"&gt;; [remove latest copy that's being Moved when routine is cancelled]&lt;/FONT&gt;&lt;/EM&gt;
    )&lt;FONT color="#999999"&gt;; repeat&lt;/FONT&gt;
    (princ)
  )

  (setq
    cosmode (getvar 'osmode)
    ccolor (getvar '&lt;STRONG&gt;&lt;FONT color="#0000ff"&gt;cecolor&lt;/FONT&gt;&lt;/STRONG&gt;)
    curlayer (getvar 'clayer)
    cline (getvar '&lt;STRONG&gt;&lt;FONT color="#0000ff"&gt;celtype&lt;/FONT&gt;&lt;/STRONG&gt;)
  )

  (command
    "_.select" pause &lt;EM&gt;&lt;FONT color="#008000"&gt;; allows any amount of selection; don't need selection-set variable here
&lt;/FONT&gt;&lt;/EM&gt;    "_.copy" "_previous" "" pause "_none" "@"&lt;BR /&gt;      &lt;FONT color="#008000"&gt;&lt;EM&gt;; copy &lt;STRONG&gt;in-place&lt;/STRONG&gt; [pause gets initial base pt without need for variable]
&lt;/EM&gt;&lt;/FONT&gt;    "_.move" "_previous" "" "_none" "@" pause
  ); command
  (while T &lt;FONT color="#999999"&gt;; as long as you want to keep going&lt;/FONT&gt;
    (command
      "_.copy" "_previous" "" "_none" "@" "_none" "@" &lt;EM&gt;&lt;FONT color="#008000"&gt;; copy in-place&lt;/FONT&gt;&lt;/EM&gt;
      "_.move" "_previous" "" "_none" "@" pause
    )&lt;FONT color="#999999"&gt;; command&lt;/FONT&gt;
  )&lt;FONT color="#999999"&gt;; while&lt;/FONT&gt;
)&lt;FONT color="#999999"&gt;; defun
&lt;/FONT&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 26 Feb 2016 15:13:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6058342#M134217</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2016-02-26T15:13:54Z</dc:date>
    </item>
    <item>
      <title>Re: Copy objects using previous basepoint</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6059227#M134218</link>
      <description>I would eliminate the pause and incorporate the second point&lt;BR /&gt;inside the while test.&lt;BR /&gt;&lt;BR /&gt;&amp;gt;&amp;gt; (command "COPY" selset "" pt Pause "'_OSMODE" 0)&lt;BR /&gt;&lt;BR /&gt;Within your while, at the end, set pt2 to pt1 and call the next pt2 in the while test:&lt;BR /&gt;&lt;BR /&gt;(if (and (setq selset (ssget)) (setq pt1 (getpoint "\nFirst point: ")))&lt;BR /&gt; (while (setq pt2 (getpoint pt1 "Next point: "))&lt;BR /&gt;  (setq xsel (entlast))&lt;BR /&gt;  ...&lt;BR /&gt;  (setvar 'OSMODE (+ (getvar 'OSMODE) 16384))&lt;BR /&gt;  (command "COPY"...&lt;BR /&gt;  (setvar 'OSMODE (- (getvar 'OSMODE) 16384))&lt;BR /&gt;  ...&lt;BR /&gt;  (setq pt2 pt1)&lt;BR /&gt; );while&lt;BR /&gt; (princ :\nNo object(s) selected or point specified. ")&lt;BR /&gt;);if&lt;BR /&gt;&lt;BR /&gt;- One can error out if (ssget) has no members. You need to test&lt;BR /&gt;for that before proceeding to the next user input.&lt;BR /&gt;- Notice that there is also a test for pt1's validity before proceeding&lt;BR /&gt;to the while.&lt;BR /&gt;- Notice 16384 is added to OSMODE. This will toggle the status icon&lt;BR /&gt;in the status line. So if there really is an error, the user can simply turn&lt;BR /&gt;OSMODE back on by selecting the icon.&lt;BR /&gt;- And finally, [Esc] does not need to be used to terminate the while.&lt;BR /&gt;Just a simple right-click or [Enter] or [spacebar], like most all the&lt;BR /&gt;AutoCAD commands.&lt;BR /&gt;&lt;BR /&gt;- ALWAYS TEST USER INPUT BEFORE PROCEEDING!&lt;BR /&gt;If done correctly, one does not need any *error* handling, ever.&lt;BR /&gt;The structure I show above does not need an error handler since&lt;BR /&gt;there are no variables that are set during the user input gathering&lt;BR /&gt;section of the code.&lt;BR /&gt;&lt;BR /&gt;Color, Layer and Linetype does not need to be retained when using&lt;BR /&gt;the copy command.&lt;BR /&gt;&lt;BR /&gt;(untested)&lt;BR /&gt;???&lt;BR /&gt;</description>
      <pubDate>Sat, 27 Feb 2016 00:07:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6059227#M134218</guid>
      <dc:creator>scot-65</dc:creator>
      <dc:date>2016-02-27T00:07:21Z</dc:date>
    </item>
    <item>
      <title>Re: Copy objects using previous basepoint</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6201807#M134219</link>
      <description>&lt;P&gt;Thanks guys for all the help.&lt;/P&gt;&lt;P&gt;I did try all the lisp programs but i think the problem rests in the copy command in Autocad itself and not within the Lisp Programming.&lt;/P&gt;&lt;P&gt;When i do copy an object, Autocad does not temporarily disable the snaps when you input a distance. causing it to snap to diferent objects when it lays the copy down.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I will continue to investigate and post if i find a solution.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Much appreciated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 07 Mar 2016 07:22:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-objects-using-previous-basepoint/m-p/6201807#M134219</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2016-03-07T07:22:34Z</dc:date>
    </item>
  </channel>
</rss>

