<?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 polylines between dwg files using script in Visual LISP, AutoLISP and General Customization Forum</title>
    <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12514834#M18932</link>
    <description>&lt;P&gt;Hi guys, thanks for the answers.&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;&amp;nbsp;- I still need to figure out the .dwg issue in your code (AutoCAD struggles with it "Unknown command "DWG".")&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/856802"&gt;@andkal&lt;/a&gt;&amp;nbsp;- I would need to take a deeper look. This would require me to open each document manually and run the command separately for each which is something I'd like to avoid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the end I have found some code here that does more less what I need.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.cadtutor.net/forum/topic/70092-copy-all-object-from-another-drawing-to-the-current-drawing/" target="_blank"&gt;https://www.cadtutor.net/forum/topic/70092-copy-all-object-from-another-drawing-to-the-current-drawing/&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 23 Jan 2024 06:48:51 GMT</pubDate>
    <dc:creator>Andrzej_K.</dc:creator>
    <dc:date>2024-01-23T06:48:51Z</dc:date>
    <item>
      <title>Copy polylines between dwg files using script</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12505812#M18926</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I was looking for some script to copy objects (not blocks) from multiple .dwg file to another.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Ideally I wanted to open the destination file. Run the script and the rest will be done for me.&lt;/P&gt;&lt;P&gt;I have found this code:&lt;/P&gt;&lt;PRE&gt;&lt;SPAN class=""&gt;; by alanh copy a window from another dwg
; Nov 2019
(defun openblk (blkname / adocs)
(setq acDocs (vla-get-documents (vlax-get-acad-object)))
(vla-open acDocs blkname)
(command "copyclip" "w" "13,30" "402,276" "")
(vla-close (vla-item acdocs 1) :vlax-false)
(command "pasteclip" "0,0")
)
(openblk "d:\\acadtemp\\2circs.dwg")&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;But when I was running it I got some errors:&amp;nbsp;&lt;/P&gt;&lt;P&gt;"1; error: Automation Error. Drawing is busy."&lt;/P&gt;&lt;P&gt;I did some small editing (apart from changing the file address and selection range) - in the function definition it looks like there was a spelling error and "adocs" should be "acdocs" but it did not solve the issue.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please assist?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 18 Jan 2024 13:46:28 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12505812#M18926</guid>
      <dc:creator>Andrzej_K.</dc:creator>
      <dc:date>2024-01-18T13:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: Copy polylines between dwg files using script</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12507167#M18927</link>
      <description>&lt;P&gt;this thread may explain the problem and a possible solution:&lt;/P&gt;&lt;P&gt;&lt;A href="https://forums.augi.com/showthread.php?165365-Open-drawing-in-Autolisp" target="_blank"&gt;https://forums.augi.com/showthread.php?165365-Open-drawing-in-Autolisp&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 00:07:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12507167#M18927</guid>
      <dc:creator>paullimapa</dc:creator>
      <dc:date>2024-01-19T00:07:37Z</dc:date>
    </item>
    <item>
      <title>Re: Copy polylines between dwg files using script</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12507416#M18928</link>
      <description>&lt;P&gt;That is an old one I think we just used it to open a dwg.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Try this as a script should work, you can write a script just use (command "script" filename)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(command "open" "d:\\acadtemp\\timber-edge.dwg")
(setvar 'ctab "MODEL")
(command "copyclip" "w" "13,30" "402,276" "")
close N
pasteclip "0,0"&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 19 Jan 2024 04:15:39 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12507416#M18928</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-01-19T04:15:39Z</dc:date>
    </item>
    <item>
      <title>Re: Copy polylines between dwg files using script</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12507611#M18929</link>
      <description>&lt;P&gt;Seems simple enough but when I use "open" I have a popup window from our database software which stops the process so in this case it will not work.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 19 Jan 2024 07:02:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12507611#M18929</guid>
      <dc:creator>Andrzej_K.</dc:creator>
      <dc:date>2024-01-19T07:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: Copy polylines between dwg files using script</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12509767#M18930</link>
      <description>&lt;P&gt;Try this sounds like Open has been redefined. This should work.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="general"&gt;(command "._open" "d:\\acadtemp\\timber-edge.dwg")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 20 Jan 2024 04:07:40 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12509767#M18930</guid>
      <dc:creator>Sea-Haven</dc:creator>
      <dc:date>2024-01-20T04:07:40Z</dc:date>
    </item>
    <item>
      <title>Re: Copy polylines between dwg files using script</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12514103#M18931</link>
      <description>&lt;P&gt;Some time ago I wrote this program that copies objects between sessions.&lt;BR /&gt;&lt;A href="http://autolisps.blogspot.com/p/copybetweensessions.html" target="_blank" rel="noopener"&gt;http://autolisps.blogspot.com/p/copybetweensessions.html&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;Maybe you will find it interresting. It works with two opened sessions but I you need it to work with more than 3 sessions you can adjust it in code yourself.&lt;BR /&gt;&lt;BR /&gt;pozdr.&lt;BR /&gt;Andrzej K.&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jan 2024 20:52:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12514103#M18931</guid>
      <dc:creator>andkal</dc:creator>
      <dc:date>2024-01-22T20:52:51Z</dc:date>
    </item>
    <item>
      <title>Re: Copy polylines between dwg files using script</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12514834#M18932</link>
      <description>&lt;P&gt;Hi guys, thanks for the answers.&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/6254908"&gt;@Sea-Haven&lt;/a&gt;&amp;nbsp;- I still need to figure out the .dwg issue in your code (AutoCAD struggles with it "Unknown command "DWG".")&lt;/P&gt;&lt;P&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/856802"&gt;@andkal&lt;/a&gt;&amp;nbsp;- I would need to take a deeper look. This would require me to open each document manually and run the command separately for each which is something I'd like to avoid.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the end I have found some code here that does more less what I need.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.cadtutor.net/forum/topic/70092-copy-all-object-from-another-drawing-to-the-current-drawing/" target="_blank"&gt;https://www.cadtutor.net/forum/topic/70092-copy-all-object-from-another-drawing-to-the-current-drawing/&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 23 Jan 2024 06:48:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12514834#M18932</guid>
      <dc:creator>Andrzej_K.</dc:creator>
      <dc:date>2024-01-23T06:48:51Z</dc:date>
    </item>
    <item>
      <title>Re: Copy polylines between dwg files using script</title>
      <link>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12550304#M18933</link>
      <description>&lt;P&gt;I am using the code I have mentioned and I run into the problem.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works fine for dwg files (dwg to dwg).&amp;nbsp;&lt;/P&gt;&lt;P&gt;When I want to use it on dxf (dxf to dwg) (I am switching the file extension), CAD allows me to select the source file but then error shows.&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, if I manually open the source dxf, and run the command in the dwg the program will work.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My guess there must be an issue with LISP not being able to open dxf.&lt;/P&gt;&lt;P&gt;Can you help?&lt;/P&gt;&lt;LI-CODE lang="lisp"&gt;(vl-load-com)
  
(command "MODEL" "")
(command "ZOOM" "E")


  (setq acobj (vlax-get-acad-object)
        acdoc (vla-get-activedocument acobj) ;;== Gets the active document/current drawing
        model (vla-get-modelspace acdoc) ;;== To tell AutoCAD which space the new entities should occupy, you need to obtain a pointer to that space.
        docs  (vla-get-documents acobj)
	targets '((0 10000) (15000 10000) (30000 10000))
  )
  ;;== Checking the AutoCAD version as some of the functions are version dependent 
  (setq dbx
    (vla-GetInterfaceObject acobj
      (if
        (&amp;lt; (setq acver (atoi (getvar "ACADVER"))) 16)
        "ObjectDBX.AxDbDocument"
        (strcat "ObjectDBX.AxDbDocument." (itoa acver))
      )
    )
  );;== Check end


  (setq cntr 0) ;;= Variable to count number of loops to be performed
  
  (setq reference_point (vlax-3d-point 0.0 0.0 0.0)) ;;== creates a point at given coordinates, required for most operations on objects
  (while 
    (and
      (&amp;lt;= cntr 0) ;;== loop counter condition === should be 2, set to 0 for testing!!!
      (progn
        (princ)
        (setq file (getfiled "Select file to import lines" (cond (path) ((getvar 'dwgprefix))) "dwg" 2)) ;;== getfiled - Prompts the user for a file name with the standard AutoCAD file dialog box, and returns that file name, 
      )
      ;;(setq insertion_point (getpoint "\nSpecify insertion point:(command "._VBASTMT" (strcat "AcadApplication.Documents.Open \" "C:\Users\320049837\Desktop\MRI\TopView.dxf" "\" "")) "))
      (setq insertion_point (nth cntr targets))  							;;== Goes through the list of target positions and sets the current target accordingly
      (setq insertion_point (vlax-3d-point insertion_point))
      ;;(command "._VBASTMT" (strcat "AcadApplication.Documents.Open \"" file "\""))
    )
    (setq path (strcat (vl-filename-directory file) "\\")
          doc nil
          l nil
    ) 
    (vlax-for x docs
      (if
        (eq (vla-get-fullname x) file)
        (setq doc x)
      )
    )
    (or doc (vla-open dbx file :vlax-true))
    (vlax-for obj (vla-get-modelspace (cond (doc) (dbx)))
      (if
        (eq (vla-get-objectname obj) "AcDbPolyline")
        (setq l (cons obj l))
      )
    )
    (prompt "n\Stop 1")
    (if l
      (foreach x
        (vlax-invoke (cond (doc) (dbx)) 'copyobjects l model)
        (vla-move x reference_point insertion_point)
      )
    )
    (princ (strcat "\n" (itoa (length l)) " lines imported from " (strcase (vl-filename-base file))))
    (MRIcolours)		;;==Adding colours for the lines - subfunction)
    (MRItexts)
    (setq cntr (1+ cntr)) 	;;==loop counter increment
  ) 
  (vlax-release-object dbx)
  (princ)&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 09 Feb 2024 09:21:44 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/copy-polylines-between-dwg-files-using-script/m-p/12550304#M18933</guid>
      <dc:creator>Andrzej_K.</dc:creator>
      <dc:date>2024-02-09T09:21:44Z</dc:date>
    </item>
  </channel>
</rss>

