TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: amc.dicsac on September 26, 2017, 02:34:34 PM

Title: Script to Lisp
Post by: amc.dicsac on September 26, 2017, 02:34:34 PM
Hi, how are you? I need your help.

I want to make a lisp do the same as this script

Code - Auto/Visual Lisp: [Select]
  1. _.open "C:\My Folder\Drawing1.dwg" _.circle 0,0,0 5 _.save  _Y _.close

if anyone has an idea how to do it.
Title: Re: Script to Lisp
Post by: dgorsman on September 26, 2017, 02:42:17 PM
LISP only runs in the current document; if you start it from one document it cannot switch to another, so you cannot do this by following commands.

You can use VLISP and ObjectDBX to access the DWG file without opening it in the editor, add the entity, and then save and close.

That's a *very* basic example - is there some specific task you're building up to?
Title: Re: Script to Lisp
Post by: mailmaverick on September 27, 2017, 04:28:21 AM
You can achieve this using microsoft excel. Please check attached Files. There are two files :-

(1.) LISP file which contains the commands which you want to run on multiple AutoCAD Files.
(2.) Excel File containing VBA macro which asks you to select one or multiple AutoCAD Files to run the selected LISP.

Source :
https://www.theswamp.org/index.php?topic=52112.0 (https://www.theswamp.org/index.php?topic=52112.0)

Title: Re: Script to Lisp
Post by: Grrr1337 on September 27, 2017, 07:01:30 AM
One cannot pronounce LISP without Lee:

Code - Auto/Visual Lisp: [Select]
  1.   ( (not LM:ODBX) (prompt "\nPlease load Lee's Object DBX wrapper.") )
  2.   (
  3.     (LM:ODBX
  4.       '(lambda ( doc / spc )
  5.         (setq spc (vla-get-ModelSpace doc))
  6.         (vlax-invoke spc 'AddCircle '(0. 0. 0.) 5)
  7.         (vlax-release-object spc)
  8.       )
  9.       (list "C:\\My Folder\\Drawing1.dwg")
  10.       T ; Save
  11.     )
  12.   )
  13. )

The above code requires Lee's ObjectDBX Wrapper (http://lee-mac.com/odbxbase.html) loaded.
Title: Re: Script to Lisp
Post by: GP on September 29, 2017, 03:50:19 AM
One cannot pronounce LISP without Lee:
the 11th commandment  :-D
Title: Re: Script to Lisp
Post by: MSTG007 on September 29, 2017, 07:14:39 AM
mailmaverick. That was pretty slick. Its amazing all the different ways one can batch drawings.

Excel Batching
Lee's OBDX Wrapper
Script Pro
acaddoc.lsp

I know there are more ways. Just naming some that I like to use.