hidxb123 Posted November 6, 2016 Posted November 6, 2016 (edited) Sir, i have small lisp i wanted to repeat it in my 100 drawings , the drawing path is D:\WORK and the lisp is following bellow, (defun DEE( / fname) (mapcar 'setvar '("cmdecho" "insunits" "dimasz") '(0 4 3.0)) (if (findfile (setq fname "c:\\hpc\\DEE.dwg")) (command "insert" fname '(7.6911 3.3174) 1.4 "" 0 AV) ) (command "qsave" "CLOSE" )) );DEE i have leemac wscript lisp with me, after uploaded wscipt lisp after that the please tell me the next step Thank you Edited November 7, 2016 by hidxb123 spelling mistake Quote
Lee Mac Posted November 6, 2016 Posted November 6, 2016 What are 'TLOAD' and 'TSAVEP' - these are not standard AutoCAD commands as far as I am aware. Can you confirm that your program performs successfully and without error on your current drawing? Quote
BIGAL Posted November 7, 2016 Posted November 7, 2016 Adding to Lee's comments for 100 dwg's you will need a script like this, there are various ways to write the script Lee-Mac has a nice scriptwriter or me I use old fashioned DOS from the CMD option bottom left of "Windows", then Dir *.dwg >dirlst /b then throw into Word and use replace about 5 minutes max to do a 100 dwgs. open dwg1 (load "DEE")(DEE) open dwg2 (load "DEE")(DEE) etc Ps lips are on your face LISP is a programming language Quote
Cad64 Posted November 7, 2016 Posted November 7, 2016 Sir,i have small lips lips are on your face LISP is a programming language Sorry, but I had to laugh at that one. Quote
hidxb123 Posted November 7, 2016 Author Posted November 7, 2016 (edited) What are 'TLOAD' and 'TSAVEP' - these are not standard AutoCAD commands as far as I am aware. Can you confirm that your program performs successfully and without error on your current drawing?[/quote Sir, Tload is our external supporting software's command , i remove tload ,i update the lisp please see follow, and how can i run the following lips in D:\WORK ... 100 Drawings (defun DEE( / fname) (mapcar 'setvar '("cmdecho" "insunits" "dimasz") '(0 4 3.0)) (if (findfile (setq fname "c:\\hpc\\DEE.dwg")) (command "insert" fname '(7.6911 3.3174) 1.4 "" 0 AV) ) (command "qsave" "CLOSE" )) );DEE Edited November 7, 2016 by hidxb123 EDIT Quote
hidxb123 Posted November 7, 2016 Author Posted November 7, 2016 What are 'TLOAD' and 'TSAVEP' - these are not standard AutoCAD commands as far as I am aware. Can you confirm that your program performs successfully and without error on your current drawing? Sir i edit the lisp , please see now Quote
Dadgad Posted November 7, 2016 Posted November 7, 2016 Sorry, but I had to laugh at that one. +1 With no ill will whatsoever, a mere typo! Quote
hidxb123 Posted November 7, 2016 Author Posted November 7, 2016 Sir, thanks for your reply , please see the attachment it shows error , i am not much families with cmd , please put the full cmd command my file location is C:\Work and my drawing name is 01,02,03 etc thank you Quote
SLW210 Posted November 7, 2016 Posted November 7, 2016 Please read the Code Posting Guidelines and edit your Code to be included in Code Tags.[NOPARSE] Your Code Here[/NOPARSE] = Your Code Here Quote
Lee Mac Posted November 7, 2016 Posted November 7, 2016 (defun DEE( / fname) (mapcar 'setvar '("cmdecho" "insunits" "dimasz") '(0 4 3.0)) (if (findfile (setq fname "c:\\hpc\\DEE.dwg")) (command "insert" fname '(7.6911 3.3174) 1.4 "" 0 AV) ) (command "qsave" "CLOSE" )) );DEE Remove this line: (command "qsave" "CLOSE" )) Save the code as DEE.lsp. Then use the following as the 'Script Line' for my program: _.open *file* (load "DEE.lsp" nil) (if DEE (DEE)) _.qsave _.close Quote
BIGAL Posted November 8, 2016 Posted November 8, 2016 I would use Lee's script writer as he suggested but if you want the other way CMD CD\ CD work dir *.dwg > dirlst.scr /b exit open Word open dirlst.scr press enter once need a blank line at top use replace ^p with ^pOPEN <-space here you should have Open dwg1 use replace ^p with (load "DEE.lsp" nil) (if DEE (DEE)) _.qsave _.close^p remove 1st dummy line close and save your script is done. Quote
hidxb123 Posted November 8, 2016 Author Posted November 8, 2016 Sir, Sorry for the doubt again 1) i removed the 'qsave' 'close' in 'DEE.lsp' and i saved 2) I run 'Wsript' i copied the same in script line 3) i selected my directory 4) Now all of my drawing open and close automatically but 'DEE' lisp drawing not inserting Please tell me which step i did mistake , Remove this line:(command "qsave" "CLOSE" )) Save the code as DEE.lsp. Then use the following as the 'Script Line' for my program: _.open *file* (load "DEE.lsp" nil) (if DEE (DEE)) _.qsave _.close Quote
BIGAL Posted November 8, 2016 Posted November 8, 2016 Type (load "dee.lsp" nil) and you should see DEE on the command line otherwise its just not loading it must be in a directory that has been preset in you support paths else you will need to do something like (load "c:\yourlispsdirectoryhere\dee.lsp" nil) Quote
hidxb123 Posted November 8, 2016 Author Posted November 8, 2016 Sir, I did the same, i typed (load "dee.lsp" nil) and run leemac program now also, every drawing open automatically and close without any change dee.lisp please see the attachment bellow i know i do some mistake , but i can't figure out what is my mistake , please excuse me Quote
Lee Mac Posted November 8, 2016 Posted November 8, 2016 In your DEE.lsp, I notice that your variable 'AV' is not defined - this will cause the Script to terminate. Quote
hidxb123 Posted November 8, 2016 Author Posted November 8, 2016 Sir, Can you defined , i don't have any knowledge about this In your DEE.lsp, I notice that your variable 'AV' is not defined - this will cause the Script to terminate. Quote
Lee Mac Posted November 8, 2016 Posted November 8, 2016 Can you defined , i don't have any knowledge about this How should I know what value to define it to use? The variable is setting the attribute value for your block: (command "insert" fname '(7.6911 3.3174) 1.4 "" 0 [highlight]AV[/highlight]) Here: fname is the block '(7.6911 3.3174) is the insertion point 1.4 is the x-scale "" means ENTER, i.e. use the x-scale value for the y-scale 0 is the rotation AV is a variable to set the attribute value I would suggest the following changes: (command "_.-insert" fname "_S" 1.4 "_R" 0.0 "_non" '(7.6911 3.3174) "YourAttributeValue") However, this still assumes that ATTREQ=1 and that your block has only a single attribute. To avoid the attribute prompt altogether, simply set ATTREQ=0. Quote
hidxb123 Posted November 8, 2016 Author Posted November 8, 2016 Sir, I CHANGED ATTREQ=0 , And i edited the code as follows , please see and edit if its wrong (defun c:dee( / fname) (mapcar 'setvar '("cmdecho" "insunits" "dimasz") '(0 4 3.0)) (if (findfile (setq fname "c:\\hpc\\DE.dwg")) (command "_.-insert" fname "_S" 1.4 "_R" 0.0 "_non" '(7.6911 3.3174) "" 0 AV) ) );dee How should I know what value to define it to use? The variable is setting the attribute value for your block: (command "insert" fname '(7.6911 3.3174) 1.4 "" 0 [highlight]AV[/highlight]) Here: fname is the block '(7.6911 3.3174) is the insertion point 1.4 is the x-scale "" means ENTER, i.e. use the x-scale value for the y-scale 0 is the rotation AV is a variable to set the attribute value I would suggest the following changes: (command "_.-insert" fname "_S" 1.4 "_R" 0.0 "_non" '(7.6911 3.3174) "YourAttributeValue") However, this still assumes that ATTREQ=1 and that your block has only a single attribute. To avoid the attribute prompt altogether, simply set ATTREQ=0. Quote
Lee Mac Posted November 8, 2016 Posted November 8, 2016 I CHANGED ATTREQ=0 , And i edited the code as follows , please see and edit if its wrong (defun c:dee( / fname) (mapcar 'setvar '("cmdecho" "insunits" "dimasz") '(0 4 3.0)) (if (findfile (setq fname "c:\\hpc\\DE.dwg")) (command "_.-insert" fname "_S" 1.4 "_R" 0.0 "_non" '(7.6911 3.3174) "" 0 AV) ) );dee If you are changing ATTREQ to 0, you should not supply the attribute value: (defun c:dee ( / fname ) (mapcar 'setvar '("cmdecho" "insunits" "dimasz") '(0 4 3.0)) (if (findfile (setq fname "c:\\hpc\\DE.dwg")) (command "_.-insert" fname "_S" 1.4 "_R" 0.0 "_non" '(7.6911 3.3174)) ) ) You also no longer require the ENTER & rotation responses, as these have already been supplied ("_S" 1.4 and "_R" 0.0). Please take some time to study the comments in my posts, and also manually enter the prompts for the -INSERT command at the command-line so that you are aware of how your program works. I see that you have also changed the function definition to 'c:dee', therefore, it will need to be evaluated as such: _.open *file* (load "DEE.lsp" nil) (if c:DEE (c:DEE)) _.qsave _.close 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.