Lisp to insert block is not working on only one computer.

Lisp to insert block is not working on only one computer.

Anonymous
Not applicable
1,201 Views
4 Replies
Message 1 of 5

Lisp to insert block is not working on only one computer.

Anonymous
Not applicable

Hello world, 

 

What I have here is a section of a program that is intended to help speed up our process and take out the idiot human errors. This program works and runs perfectly on every computer except one...  on the computer I am having issues on the program seems to fail at this stage.

(defun C:DXF () 
(initget "Y N")
(setq bk (getkword "\nDo You Want To Insert Project Info? [Y/N]:"))
(cond ((eq "Y" bk) (command "clayer" "0") ; makes 0 the current layer (setvar 'attreq 1) (setq p (getpoint "\nPick An Insertion Point For Your Project Info......")) ; prompts the user to pick an insertion point (command "insert" "dxf tag info" p 1 1 0) ; inserts the block and opens the window to enter the attribute info (sssetfirst nil (ssadd (entlast))) (c:Burst) ; bursts the block so i can keep the users input ) ((eq"N" bk) ) )

 It will let you pick the point but it will not insert the block. It tries to have you select objects...

Here is the lisp as a whole in case it helps any. 

 

(defun C:DXF ()
    (initget "Y N")
	(setq bk (getkword "\nDo You Want To Insert Project Info? [Y/N]:"))
(cond
  ((eq "Y" bk)
   (command "clayer" "0") 
   (setvar 'attreq 1)
   (setq p (getpoint "\nPick An Insertion Point For Your Project Info......"))
   (command "insert" "dxf tag info" p 1 1 0)
   (sssetfirst nil (ssadd (entlast))) (c:Burst)
  )
  ((eq"N" bk)
 )
)
  
  (alert "First selection makes it the current layer (The layer you want to check)")
  (alert "Second selection lets you freeze all other layers you select (Check one layer at a time)")
  
	(command "_.laythw") ;thaws all layers 
  		(command "_.chprop" "all" "" "color" "BYLAYER" "") ;changes color of layers back to BYLAYER
  		
	(setq entlist (entget (car (entsel "\nSelect object: "))))  
		(setvar "clayer" (cdr (assoc 8 entlist)))  
			(command-s "_.LAYFRZ") 
				(initcommandversion)
					(command "_.JOIN" "_All" "") 
						(if (setq ss (ssget "_X" (list '(0 . "*POLYLINE") '(-4 . "&=") '(70 . 1) (cons 410 (getvar 'CTAB)))))
							(command "_.CHPROP" ss "" "_color" "_colorbook" "DIC COLOR GUIDE(R) PART II" "DIC 2630" ""))
  	(command "_.CHANGE" "_all" "" "_p" "_e" 0 "") 
  								(command "zoom" "e")
  (initget "Y N")
      (setq pnk (getkword "\nDid All Your Geometry Turn Pink? [Y/N]:"))
  (cond
    ((eq "N" pnk)
     (alert "You Need To Check the Geometry That Did Not Change And Close Your Lines.")
   )
    ((eq "Y" pnk)
     	  
  (initget "Y N")
  	(setq a (getkword "\nAre You Done Checking Geometry? [Y/N]: "))
  (cond
    	((eq "N" a)
		(alert "Repeat This Process For Every Layer You Need To Check")
    )
	((eq "Y" a)
		(command "_.laythw")
					(command "_.chprop" "all" "" "color" "BYLAYER" "")
  (repeat 10
		(initcommandversion)
			(command "_.EXPLODE" "_All" "")
				(command "_.CHANGE" "_all" "" "_p" "_e" 0 "") 
			   (command "_.-OVERKILL" "_all" "" "_done")
		     (command "_.-PURGE" "_all" "" "_no"))
  (initget 1 "Y N")
		(setq x (getkword "\nIS THIS A SAMPLE [Yes/No]: ")); PROMPTS USER A QUESTION IF DWD IS A SAMPLE 
	     (cond ((= x "N")
	  (setq path "M:\\CNC DXF FILES\\") 
           )
		   ((= x "Y")
	      (setq path "M:\\CNC DXF FILES\\SAMPLES\\") 
                )
)
	(setq file (vl-string-translate "" "" (getstring T "NAME FILE"))); PROMPTS USER TO ENTER FILE NAME 
		(setq 1F (vl-string-translate "" "" (getstring T "NAME FOLDER"))); PROMPTS USER TO ENTER THEIR FOLDER NAME 
			(acet-file-mkdir (strcat path 1F )); CREATES FOLDER
				(setq filepath (strcat path 1F "\\" file )) 
					(command "saveas" "dxf" "V" "2000" "" filepath);SAVES AS DXF 2000 FILE IN NEW FOLDER
       )
      )
     )
    )
   )

Does anyone have any ideas as to if there is a variable or setting that might mess this up the one computer. 

0 Likes
Accepted solutions (1)
1,202 Views
4 Replies
Replies (4)
Message 2 of 5

Anonymous
Not applicable

Here are the drawing I am messing with.

0 Likes
Message 3 of 5

CodeDing
Advisor
Advisor
Accepted solution

@Anonymous ,

 

My assumption is that it has to do with your "insert" command. Since it is running, then interrupted it may lead you to believe your sssetfirst line is causing the problem. To test this, try implementing this:

   ;(setq p (getpoint "\nPick An Insertion Point For Your Project Info......"))
   (command "insert" "dxf tag info" pause 1 1 0)

Also, I HIGHLY HIGHLY recommend declaring your local variables every time.

Best,

~DD

0 Likes
Message 4 of 5

Moshe-A
Mentor
Mentor

hi,

 

set attdia=0

run the lisp,  does it work now?

 

moshe

 

Message 5 of 5

Anonymous
Not applicable

That worked great thank you!

I will keep that in mind and do some research on that matter. 

0 Likes