<?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 How to modify lisp to do automatically copy in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-modify-lisp-to-do-automatically-copy/m-p/12971345#M9930</link>
    <description>&lt;P&gt;Hello guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CAD file have 3 graphics&amp;nbsp; in area (0:0) to (50:50),&amp;nbsp; I want one lisp command to perform three layer simultaneous copies and&amp;nbsp; moves.&amp;nbsp; &amp;nbsp;How to modify below lisp to do automatically copy?&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;layer names 1, 2, and 3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Layer 1 needs to be copied and offset horizontally by 50mm along the X-axis,&lt;/P&gt;&lt;P&gt;layer 2 needs to be copied and offset vertically by 50mm along the Y-axis,&lt;/P&gt;&lt;P&gt;layer 3 needs to be copied and offset horizontally by 50mm along the X-axis and vertically by 50mm along the Y-axis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:CopyAndOffsetLayers (/ ss1 ss2 ss3)  
  (setq ss1 (ssget '((0 . "CIRCLE,LINE,*") (8 . "1"))))  
  (if ss1  
    (progn  
      (command "_.copy" ss1 "" "_non" '(50 0))  
      (princ "\nlayer1Xoffset50\n")  
    )  
  )  
  (setq ss2 (ssget '((0 . "CIRCLE,LINE,*") (8 . "2"))))  
  (if ss2  
    (progn  
      (command "_.copy" ss2 "" "_non" '(0 50))  
      (princ "\nlayer2Yoffset50\n")  
    )  
  )  
  (setq ss3 (ssget '((0 . "CIRCLE,LINE,*") (8 . "3"))))  
  (if ss3  
    (progn  
      (command "_.copy" ss3 "" "_non" '(50 50)) 
      (princ "\nlayer3X&amp;amp;Yoffset50\n")  
    )  
  )  
  (princ)  
)  
  
(princ "\nCOPYANDOFFSETLAYERS\n")  
(princ)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Aug 2024 03:55:28 GMT</pubDate>
    <dc:creator>tencome</dc:creator>
    <dc:date>2024-08-21T03:55:28Z</dc:date>
    <item>
      <title>How to modify lisp to do automatically copy</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-modify-lisp-to-do-automatically-copy/m-p/12971345#M9930</link>
      <description>&lt;P&gt;Hello guys,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;CAD file have 3 graphics&amp;nbsp; in area (0:0) to (50:50),&amp;nbsp; I want one lisp command to perform three layer simultaneous copies and&amp;nbsp; moves.&amp;nbsp; &amp;nbsp;How to modify below lisp to do automatically copy?&amp;nbsp; &amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;layer names 1, 2, and 3.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Layer 1 needs to be copied and offset horizontally by 50mm along the X-axis,&lt;/P&gt;&lt;P&gt;layer 2 needs to be copied and offset vertically by 50mm along the Y-axis,&lt;/P&gt;&lt;P&gt;layer 3 needs to be copied and offset horizontally by 50mm along the X-axis and vertically by 50mm along the Y-axis.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(defun c:CopyAndOffsetLayers (/ ss1 ss2 ss3)  
  (setq ss1 (ssget '((0 . "CIRCLE,LINE,*") (8 . "1"))))  
  (if ss1  
    (progn  
      (command "_.copy" ss1 "" "_non" '(50 0))  
      (princ "\nlayer1Xoffset50\n")  
    )  
  )  
  (setq ss2 (ssget '((0 . "CIRCLE,LINE,*") (8 . "2"))))  
  (if ss2  
    (progn  
      (command "_.copy" ss2 "" "_non" '(0 50))  
      (princ "\nlayer2Yoffset50\n")  
    )  
  )  
  (setq ss3 (ssget '((0 . "CIRCLE,LINE,*") (8 . "3"))))  
  (if ss3  
    (progn  
      (command "_.copy" ss3 "" "_non" '(50 50)) 
      (princ "\nlayer3X&amp;amp;Yoffset50\n")  
    )  
  )  
  (princ)  
)  
  
(princ "\nCOPYANDOFFSETLAYERS\n")  
(princ)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 03:55:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-modify-lisp-to-do-automatically-copy/m-p/12971345#M9930</guid>
      <dc:creator>tencome</dc:creator>
      <dc:date>2024-08-21T03:55:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to modify lisp to do automatically copy</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-modify-lisp-to-do-automatically-copy/m-p/12971359#M9931</link>
      <description>&lt;P&gt;Just a few quick things to double check, (I'm not allowed to download that attached file to my work machine)&lt;/P&gt;&lt;P&gt;Are they just a single set of entities that you wish to copy three times to three separate layers and then move them to separate positions depending on the layer they have been give?&lt;BR /&gt;Do you wish for the items to be selected automatically first time round or you select the items first time round manually then they are automatically selected as you process through each layer?&lt;/P&gt;&lt;P&gt;In the example you posted what is the "non" part of the command? (I use the english language version and that would be displacement).&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 04:11:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-modify-lisp-to-do-automatically-copy/m-p/12971359#M9931</guid>
      <dc:creator>ryanatkins49056</dc:creator>
      <dc:date>2024-08-21T04:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to modify lisp to do automatically copy</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-modify-lisp-to-do-automatically-copy/m-p/12971730#M9932</link>
      <description>&lt;P&gt;hey,&lt;/P&gt;&lt;P&gt;check this&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(defun c:copy_move_1_2_3 (/ move_sset)
	(if (setq move_sset (ssget "_w" '(0 0) '(50 50) '((8 . "1,2,3"))))
		(foreach object (mapcar 'vlax-ename-&amp;gt;vla-object (vl-remove-if 'listp (mapcar 'cadr (ssnamex move_sset))))
			(cond
				((= "1" (vla-get-layer object))
					(vla-move (vla-copy object) (vlax-3d-point 0 0) (vlax-3d-point 50 0))
				)
				((= "2" (vla-get-layer object))
					(vla-move (vla-copy object) (vlax-3d-point 0 0) (vlax-3d-point 0 50))
				)
				((= "3" (vla-get-layer object))
					(vla-move (vla-copy object) (vlax-3d-point 0 0) (vlax-3d-point 50 50))
				)
			)
		)
	)
	(princ)
)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 08:32:59 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-modify-lisp-to-do-automatically-copy/m-p/12971730#M9932</guid>
      <dc:creator>komondormrex</dc:creator>
      <dc:date>2024-08-21T08:32:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to modify lisp to do automatically copy</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-modify-lisp-to-do-automatically-copy/m-p/12972182#M9933</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If what is to be Copied is &lt;EM&gt;everything&lt;/EM&gt; on each Layer:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:C123 (/ ss)
  (foreach entry '(("1" (50 0)) ("2" (0 50)) ("3" (50 50)))
    (if (setq ss (ssget "_X" (list (cons 8 (car entry)))))
      (command "_.copy" ss "" (cadr entry) "")
    ); if
  ); foreach
  (prin1)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If only those things within that initial area:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="general"&gt;(defun C:C123 (/ ss)
  (foreach entry '(("1" (50 0)) ("2" (0 50)) ("3" (50 50)))
    (if (setq ss (ssget "_W" '(0 0) '(50 50) (list (cons 8 (car entry)))))
      (command "_.copy" ss "" (cadr entry) "")
    ); if
  ); foreach
  (prin1)
)&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;It's the "_X" in the first one [for finding everything that fits the filter], and the "_W" with following window corners in the second one [for defines the selection area], that make them automatic, not requiring User selection.&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 12:53:10 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-modify-lisp-to-do-automatically-copy/m-p/12972182#M9933</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-08-21T12:53:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to modify lisp to do automatically copy</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-modify-lisp-to-do-automatically-copy/m-p/12972222#M9934</link>
      <description>&lt;P&gt;By the way, this [Layer 2 instance]:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;(setq ss2 (ssget '((0 . "CIRCLE,LINE,&lt;FONT size="4" color="#FF00FF"&gt;*&lt;/FONT&gt;") (8 . "2"))))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;has an object-type entry in the filter that makes it pointless.&amp;nbsp; The asterisk&lt;FONT face="courier new,courier" size="4"&gt;&lt;STRONG&gt;&lt;FONT color="#FF00FF"&gt; *&lt;/FONT&gt; &lt;/STRONG&gt;&lt;/FONT&gt;allows it to select &lt;STRONG&gt;&lt;EM&gt;any and all kinds of objects&lt;/EM&gt;&lt;/STRONG&gt;, which is what makes it usable in your sample drawing with some Polylines.&amp;nbsp; With the resulting &lt;EM&gt;&lt;STRONG&gt;no limit on object type&lt;/STRONG&gt;&lt;/EM&gt;, that whole filter entry serves no purpose, and this would have exactly the same result:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;(setq ss2 (ssget '((8 . "2"))))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;The routines in Message 4 could have object-type filtering added if needed.&lt;/P&gt;
&lt;P&gt;And these:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;(command "_.copy" ss2 "" "_non" '(0 50))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;need the second point of displacement [in this case Enter for use-the-first-point-as-a-displacement]:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;(command "_.copy" ss2 "" "_non" '(0 50) &lt;FONT size="4" color="#0000FF"&gt;""&lt;/FONT&gt;)&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;
&lt;P&gt;As it is, the notification is being fed in as the second point, which triggers an error.&amp;nbsp; It could also be like this:&lt;/P&gt;
&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&lt;STRONG&gt;(command "_.copy" ss2 "" "_non" '(0 0) "_non" '(0 50))&lt;/STRONG&gt;&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Aug 2024 13:06:25 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-modify-lisp-to-do-automatically-copy/m-p/12972222#M9934</guid>
      <dc:creator>Kent1Cooper</dc:creator>
      <dc:date>2024-08-21T13:06:25Z</dc:date>
    </item>
  </channel>
</rss>

