Author Topic: Script to Lisp  (Read 2922 times)

0 Members and 1 Guest are viewing this topic.

amc.dicsac

  • Newt
  • Posts: 109
  • Autocad 2008
Script to Lisp
« 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.
<a href="http:/http://axprogramlisp.blogspot.pe" class="bbc_link" target="_blank">By Alexander Castro</a>

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: Script to Lisp
« Reply #1 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?
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

mailmaverick

  • Bull Frog
  • Posts: 493
Re: Script to Lisp
« Reply #2 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


Grrr1337

  • Swamp Rat
  • Posts: 812
Re: Script to Lisp
« Reply #3 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 loaded.
(apply ''((a b c)(a b c))
  '(
    (( f L ) (apply 'strcat (f L)))
    (( L ) (if L (cons (chr (car L)) (f (cdr L)))))
    (72 101 108 108 111 32 87 111 114 108 100)
  )
)
vevo.bg

GP

  • Newt
  • Posts: 83
  • Vercelli, Italy
Re: Script to Lisp
« Reply #4 on: September 29, 2017, 03:50:19 AM »
One cannot pronounce LISP without Lee:
the 11th commandment  :-D

MSTG007

  • Gator
  • Posts: 2601
  • I can't remeber what I already asked! I need help!
Re: Script to Lisp
« Reply #5 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.
Civil3D 2020