LISP help

LISP help

Anonymous
Not applicable
830 Views
7 Replies
Message 1 of 8

LISP help

Anonymous
Not applicable

Hello,

I am creating a standards LISP routine to load when opening a drawing. I added a (defun c:___) to it to make screecasting easier. The problem is it is pausing at the end and requiring me to left click out of it after it is run. Looking for a fix for it to complete smoothly. Is there some code I need to put at the end of it to close out the code?

Here is the code so far:

(defun c:stdtest ()
  
  (vl-load-com) (vlax-for pc (vla-get-plotconfigurations (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-delete pc) )
  
  (command "._-psetupin" "R:/cad/sams plot files/plotting.dwg" "BRIDGEHALF")
  (command "._-psetupin" "R:/cad/sams plot files/plotting.dwg" "BRIDGEFULL")
  (command "._-psetupin" "R:/cad/sams plot files/plotting.dwg" "BRIDGECOLOR")
  (command "._-psetupin" "R:/cad/sams plot files/plotting.dwg" "BRIDGEPDF")
   (c:SetNamePageSetupAllLayouts "BRIDGEHALF" T)

  (command "dimlayer" "PEN5")												;;;Sets dimension layer to PEN5

(setvar "dimassoc" 0)													;;;Turns off dimension associativity

(command "._insert" "GENTITLE=R:\\design\\Michael\\Blocks\\Title Blocks\\Borders\\GENTITLE.dwg")			;;;Redefine GENTITLE block
(command)

(command "._insert" "MISCTITLE=R:\\design\\Michael\\Blocks\\Title Blocks\\Borders\\MISCTITLE.dwg")			;;;Redefine MISCTITLE block
(command)

(command "._insert" "SITETITLE=R:\\design\\Michael\\Blocks\\Title Blocks\\Borders\\SITETITLE.dwg")			;;;Redefine SITETITLE block
(command)

(command "._insert" "Standard_Styles=R:\\design\\Michael\\Blocks\\Standards\\Standard Styles.dwg" "0,0" "" "" "")	;;;Insert Standard Styles (Dimension styles, text styles, layers and linetypes)

(setvar "pdmode" 35)

(command "._-dwgunits" "2" "2" "4" "no" "no")

(prompt "\nStandards Loaded")
(princ)
  )

 

Thanks!

Michael

Screencast will be displayed here after you click Post.

5fea7ab8-9987-4c2d-b64a-68bbb5ed4e7c

 

0 Likes
831 Views
7 Replies
Replies (7)
Message 2 of 8

Moshe-A
Mentor
Mentor

@Anonymous  hi,

 

if you comment "-dwgunits" does it work?

 

moshe

 

0 Likes
Message 3 of 8

ronjonp
Mentor
Mentor

Not an answer to your problem just an observation to simplify some of your code to redefine the blocks 🙂

  (setq path "R:\\design\\Michael\\Blocks\\Title Blocks\\Borders\\")
  (foreach dwg '("GENTITLE" "MISCTITLE" "SITETITLE")
    (command "._insert" (strcat dwg "=" path dwg ".dwg") nil)
  )
0 Likes
Message 4 of 8

dlanorh
Advisor
Advisor

If you type -dwgunits on the command line, you are asked 7 questions (my version 2012), therefore it requires a list of 7 inputs. Your list contains 5 inputs

 

(command "._-dwgunits" "2" "2" "4" "no" "no")

 

If the lisp "hangs" maybe this is why. Perhaps you need to check how many inputs are required to complete the command on your system.

I am not one of the robots you're looking for

0 Likes
Message 5 of 8

dbhunia
Advisor
Advisor

Try with this Change (For AutoCAD 2017/2018/2019).......

 

(command "._-dwgunits" "2" "2" "4" "no" "no" "no")

 

And what about the function .......

 

(c:SetNamePageSetupAllLayouts "BRIDGEHALF" T)

 


Debashis Bhunia
Co-Founder of Geometrifying Trigonometry(C)
________________________________________________
Walking is the First step of Running, Technique comes Next....
0 Likes
Message 6 of 8

Anonymous
Not applicable

So that is another issue... -dwgunits is 5 inputs if no settings changed. If units did change, it adds:  "Scale objects in current drawing to reflect change in units? [Yes/No]"

So another problem is I don't know how to input "no" when it asks, and nothing when it doesn't.

Either way, I removed this code completely and I am still having problem I asked about originally.

 

Thanks,

Michael

0 Likes
Message 7 of 8

Anonymous
Not applicable

I think that second one was a remainder from a previously removed piece of code. I removed it and I also removed the -dwgunit code and I am still having the same "hanging" problem.

 

Thanks for the reply!

Michael

0 Likes
Message 8 of 8

Anonymous
Not applicable

Oh great! Always nice to have unnecessarily complicated things simplified!

 

Thanks!

Michael

0 Likes