- File size:
- 10 KB
- Date added:
- Mar 22, 2022 | Last update check: 1 minute ago
- Licence:
- Free
- Runs on:
- AutoCAD
Copy to XRef for AutoCAD is a LISP program that enables you to copy objects from the current drawing to xref (external reference), without opening the referenced drawing. Upon copying the selected objects, the xref source drawing will be saved, the xref is reloaded in the current drawing and the selected objects will be deleted from the current drawing. The lisp will account for the position, scale and rotation of the xref relative to the selected objects. The program will perform successfully under all UCS and View settings.
Typical workflow:
- Start the program. Load the program (see “How to load an AutoLISP program“). Write C2X in command-line and press Enter.
- Select the objects. Select the objects you want to be copied.
- Select a xref. Select an external reference (xref) to which the objects are to be copied.
- Objects are copied to the xref. The selected objects are copied to the source drawing of the selected xref using a deep-clone method, coupled with an ObjectDBX interface should the xref source drawing be unopened in the current drawing session.
Note: The act of copying objects to the xref source drawing involves saving the external drawing remotely – this action cannot be undone within the current drawing and changes to the external drawing must be reset manually. When saving drawings through ObjectDBX, drawing file thumbnails will be lost until the next manual save.
About AutoLISP
AutoLISP is a simple programming language that has been specifically written for designers and architects. AutoLISP originated from LISP language that was created before AutoCAD and was not specifically written for designers. AutoLISP is an AutoCAD’s own version of LISP. LISP is an acronym for List Processing. The format of the LISP language revolves around the proper structure of the lists. A list is defined with parentheses, with the function specified first. It is integrated with the AutoCAD environment, and it contains built-in functions that create and edit geometric entities. Since AutoCAD 2000, the original AutoLISP engine was replaced with the Visual LISP engine. Most people use the phrase LISP instead of AutoLISP and Visual LISP. LISP file extension is .LSP.
How to load an AutoLISP program
- Download the AutoLISP file.
- Decide between two options:
- Load the program file into the current drawing session. In AutoCAD, go to Manage – Load Application, or enter APPLOAD in the command-line. Select the program file and click “Load”. Now all the functions within that file are available to you.
- Load the program file(s) when you open a drawing. AutoCAD automatically loads two LSP files if they’re found in the support directory locations. The files are called Acad.lsp (loads when you start AutoCAD) and AcadDoc.lsp (loads when you create or open a new drawing). If the files don’t exist you need to create them (using Visual LISP Editor or Notepad) and save it in AutoCAD support path. To add a new support file search path in AutoCAD, go to Options – Files – select Support File Search Path – Add – browse for the location of the LSP files – Ok. Using the load function within the AcadDoc you can automatically load other LSP routines. When you create or open a new drawing, it loads the LISP file and all the functions that are found within it. If loading many LISP files on startup cause drawings to open slower, you can use AutoLoad function to load LISP files when you enter a specific command at the command-line.
About Lee Mac Programming
Lee Mac Programming is founded by Lee Mac, a developer from England dealing with AutoCAD customisation. He started programming AutoCAD in 2009. In AutoLISP he sees the potential for productivity in customisation and automation. With the support of the CADTutor and TheSwamp communities he developed collection of AutoLISP functions.