tamipeab Posted February 28, 2014 Posted February 28, 2014 (edited) I am using ACAD 2013. I am new to using lsp files. Is it possible to combine 3 lsp routines that I regularly run to prepare files for a different software program? Is it possible to use the combined lsp routine to batch process multiple files in a folder? Is it possible to modify the 1st code to open the new file automatically? ;changes layout to model space, appends filename, option to open new file (defun c:L2M ( / BASE LST OLD_DIA) (setq old_dia (getvar 'FILEDIA) base (strcat (getvar 'DWGPREFIX) (vl-filename-base (getvar 'DWGNAME))) ) (setvar 'FILEDIA 1) (setq lst (layoutlist)) (foreach l lst (command "_.ctab" l "exportlayout" (strcat base "-" l) ) ) (setvar 'FILEDIA old_dia) (princ) ) ;Sets linework to by layer, layers to color 7 white, detaches external references (defun c:set7 () (setq uecho (getvar "cmdecho")) (setvar "cmdecho" 0) (command "setbylayer" "al" "" "n" "y") (command "-layer" "c" "7" "*") (command "-xref" "d" "*") (setvar "cmdecho" uecho) (princ) ) ;Justify text (defun c:BL (justify title / ss) (princ (strcat "\nSelect *Text to " title " justify: ")) (if (setq ss (ssget "_:L" '((0 . "ATTDEF,MTEXT,TEXT")))) (command "_.justifytext" ss "" justify) ) (princ) ) (defun c:JL (/) (_justifyIt "_ML" "Middle Left")) (defun c:JC (/) (_justifyIt "_MC" "Middle Center")) (defun c:JR (/) (_justifyIt "_MR" "Middle Right")) (defun c:BL (/) (_justifyIt "_BL" "Bottom Left")) (defun c:BC (/) (_justifyIt "_BC" "Bottom Center")) (defun c:BR (/) (_justifyIt "_BR" "Bottom Right")) (defun c:TL (/) (_justifyIt "_TL" "Top Left")) (defun c:TC (/) (_justifyIt "_TC" "Top Center")) (defun c:TR (/) (_justifyIt "_TR" "Top Right")) I don't know who the code authors are to give credit. Edited February 28, 2014 by tamipeab Quote
Snownut Posted February 28, 2014 Posted February 28, 2014 tamipeab, #1.-Please use code wrapper when posting code. #2.- Since all your lisp functions are defined as "c:..." you can place them all in one lisp file to load all at once. Quote
tamipeab Posted February 28, 2014 Author Posted February 28, 2014 What is code wrapper? I've tried combining them but I don't know enough about lsp writing to make it work. Quote
Snownut Posted February 28, 2014 Posted February 28, 2014 See here http://www.cadtutor.net/forum/showthread.php?9184-Code-posting-guidelines [url=http://www.cadtutor.net/forum/showthread.php?9184-Code-posting-guidelines][/url] Quote
mostafa badran Posted February 28, 2014 Posted February 28, 2014 Open New Text Document.txt and change extension from .txt to .lsp then copy your lisps, past them in the New Text Document.lsp then close and save your lisp. Quote
BIGAL Posted March 1, 2014 Posted March 1, 2014 Easy way is to use a script can open and close as many as you like and run multiple lisps in the process. open dwg1 (load "lisp1") (load "lisp2") close y open dwg2 (load "lisp1") (load "lisp2") close y and so on Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.