Author Topic: Basic Lisp help copying a file to a new folder  (Read 4266 times)

0 Members and 1 Guest are viewing this topic.

BryanHerron

  • Guest
Re: Basic Lisp help copying a file to a new folder
« Reply #15 on: August 09, 2018, 12:58:24 PM »
Here is where I am at now.

Command: (vl-file-copy "//GES-FS-01/design Support/CAD/Acad Blocks/GUY BLOCKS/XXX-ODOT-BLOCK.dwg" (getvar "DWGPREFIX")(subsrt(getvar "DWGNAME") 1 4) "-ODOT-BLOCK.dwg") ; error: no function definition: SUBSRT

Not a programmer, so this "no function definition" doesn't really tell me anything. I'm very close though. To recap, this is the goal - Open a base drawing from the project folder (so the code has something to work with) execute the custom button to copy the XXX-ODOT-BLOCK.dwg from the static support folder and derive the destination folder & project # from the previously opened 1084-BASE.dwg resulting in the XXX-ODOT-BLOCK drawing being copied to the project folder and renamed 1084-ODOT-BLOCK.dwg. The base drawings will always have the 4-digit project# as a prefix to the file name.

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Basic Lisp help copying a file to a new folder
« Reply #16 on: August 09, 2018, 01:00:11 PM »
You have a typo: subsrt should be substr

You also need STRCAT to join the strings:
Code - Auto/Visual Lisp: [Select]
  1.   "//GES-FS-01/design Support/CAD/Acad Blocks/GUY BLOCKS/XXX-ODOT-BLOCK.dwg"
  2.   (strcat (getvar 'dwgprefix) (substr (getvar 'dwgname) 1 4) "-ODOT-BLOCK.dwg")
  3. )



You could also benefit from using the VLIDE editor in cad when writing code:

« Last Edit: August 09, 2018, 01:08:10 PM by ronjonp »

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

BryanHerron

  • Guest
Re: Basic Lisp help copying a file to a new folder
« Reply #17 on: August 09, 2018, 02:00:58 PM »
RONJONP
U Da Man

Many thanks my friend!!

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Basic Lisp help copying a file to a new folder
« Reply #18 on: August 09, 2018, 03:10:16 PM »
Glad to help :)

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC