Author Topic: Opening Drawings and Running LISP  (Read 6080 times)

0 Members and 1 Guest are viewing this topic.

deegeecees

  • Guest
Re: Opening Drawings and Running LISP
« Reply #15 on: July 28, 2011, 10:26:22 AM »
My halfacent:

http://www.theswamp.org/index.php?topic=6657.msg84407#msg84407
Ok, so nthat works for the most part, but it does not save and close the drawing, please note that I change the scrline to:
(setq scrline (strcat "open" " " n2 " " "(load rt.lsp)" " " "(RT_BSR)" " " "qsave" " " "close" " "));;;;;;;COMMANDS FOR BATCH GO HERE
(setq scrline (strcat "open" " " n2 " " "(load\"batch_core\")" " " "batch_insert" " " "qsave" " " "close"))

Did I somehow mess it up?


I included the original for you to examine the differences. It's old code, and although it ain't pretty, it works.

Also, note that in the 'batch_core' lisp, the call out uses c: to get a command line call.

Code: [Select]
(defun c:batch_insert ()
(setq tester1 (SSGET "X" (LIST (CONS 0 "insert") (CONS 2 "Tsbder57"))))
(if tester1
(progn
(SETQ fixer1 (ssname tester1 0))
(SETQ ats3 (ENTGET fixer1))
(if ats3
(progn
(setq attit1(cdr (assoc 41 ats3)))
(setq wutscale (rtos attit1))
(command "-insert" "c:\\yourblock" "0,0" wutscale wutscale "")
(command "-insert" "c:\\yourotherblock" "0,0" wutscale wutscale "")
)
)
)
)


(princ)

)
« Last Edit: July 28, 2011, 10:30:10 AM by Plankton »

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Opening Drawings and Running LISP
« Reply #16 on: July 28, 2011, 11:14:45 AM »

I'm surprised no-one has mentioned AutoCAD ScriptPro 2.0

http://labs.autodesk.com/utilities/adn_plugins/supported_apps/  (Nov 2010)

It can load and run lisp ( and provide suitable error trapping to eradicate the gremlins that will halt conventional scripts.

Just a thought :)
Unfortunately the last time that I tried using this, it opened a new session of AutoCAD for every single drawing, which added about 2 minutes per drawing, not bad when there are only a few drawings, but when I need the routine, it quite often is for 200+ drawings. Add to that the fact that I need to set options prior to running the script and you can see things would get complicated with it.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Opening Drawings and Running LISP
« Reply #17 on: July 28, 2011, 11:27:28 AM »
My halfacent:

http://www.theswamp.org/index.php?topic=6657.msg84407#msg84407
Ok, so nthat works for the most part, but it does not save and close the drawing, please note that I change the scrline to:
(setq scrline (strcat "open" " " n2 " " "(load rt.lsp)" " " "(RT_BSR)" " " "qsave" " " "close" " "));;;;;;;COMMANDS FOR BATCH GO HERE
(setq scrline (strcat "open" " " n2 " " "(load\"batch_core\")" " " "batch_insert" " " "qsave" " " "close"))

Did I somehow mess it up?


I included the original for you to examine the differences. It's old code, and although it ain't pretty, it works.

Also, note that in the 'batch_core' lisp, the call out uses c: to get a command line call.

Code: [Select]
(defun c:batch_insert ()
(setq tester1 (SSGET "X" (LIST (CONS 0 "insert") (CONS 2 "Tsbder57"))))
(if tester1
(progn
(SETQ fixer1 (ssname tester1 0))
(SETQ ats3 (ENTGET fixer1))
(if ats3
(progn
(setq attit1(cdr (assoc 41 ats3)))
(setq wutscale (rtos attit1))
(command "-insert" "c:\\yourblock" "0,0" wutscale wutscale "")
(command "-insert" "c:\\yourotherblock" "0,0" wutscale wutscale "")
)
)
)
)


(princ)

)
Thank you, I figured I probably mangled that line somehow, I have that working now, next up is adding in the rest of what I need my LISP routine to do.

deegeecees

  • Guest
Re: Opening Drawings and Running LISP
« Reply #18 on: July 28, 2011, 01:43:36 PM »
YW. Nice to see that getting some extended mileage. I used it for a large firm that needed to update 1000's of dwgs. Set it and forget it.


Boldly go forth and batch. lol