Jump to content

PLEASE HELP ME TO USE LEE MAC WScript LISP


Recommended Posts

Posted (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 by hidxb123
spelling mistake
  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • hidxb123

    10

  • Lee Mac

    6

  • BIGAL

    5

  • marioo

    2

Top Posters In This Topic

Posted Images

Posted

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?

Posted

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 :lol:

Posted
Sir,

i have small lips

 

lips are on your face LISP is a programming language :lol:

 

Sorry, but I had to laugh at that one. :rofl:

Posted (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 by hidxb123
EDIT
Posted
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

Posted
Sorry, but I had to laugh at that one. :rofl:

 

+1 With no ill will whatsoever, a mere typo! :)

Posted

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

error.jpg

Posted
(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

Posted

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.

Posted

Sir,

 

Sorry for the doubt again :unsure:

 

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

Posted

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)

Posted

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

attachment.php?attachmentid=59687&cid=1&stc=1attachment.php?attachmentid=59688&cid=1&stc=1

leemac.jpg

load.jpg

Posted

In your DEE.lsp, I notice that your variable 'AV' is not defined - this will cause the Script to terminate.

Posted

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.
Posted
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.

Posted

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.

Posted
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

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...