- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Can anyone help, please? A very specific problem has surfaced when using AutoCAD 2016 loading a new drawing from a script file and then a (command..) using PAUSE. The PAUSE causes failure. To show this, the following fragment: (original script and AutoLISP files attached. Script files renamed with TXT extension as cannot be attached otherwise!)
Thanks, John
;RECTPOS.LSP
;Simple fragment to test drawing and moving a rectangle when called from a script file
;in AutoCAD 2016
;The script file will start a new drawing (see below)
(*push-error-using-command*)
(princ "\nDraw rectangle and move it")
;Set some points
(setq pt1 (list 100.0 100.0 0.0)
pt2 (list 2100.0 100.0 0.0)
pt3 (list 2100.0 1100.0 0.0)
pt4 (list 100.0 1100.0 0.0)
)
;Draw the rectangle
(command "PLINE" pt1 pt2 pt3 pt4 pt1 "")
(setq entp (entlast)
ptZ (list 0.0 0.0 0.0)
ptQ (list -100.0 -100.0 0.0)
)
;show it
(command "._ZOOM" "E")
;and make some space
(command "._ZOOM" "0.5x")
;Drag the rectangle
;This works
(command-s "._MOVE" entp "" ptZ ptQ )
;This fails when the script file has loaded a NEW drawing
;It works fine when this .LSP is loaded in an existing drawing
;It works fine in AutoCAD 2013!
(command-s "._MOVE" entp "" ptZ PAUSE)
(princ)
;The script file (A160627 NEW REC.SCR) starting a new drawing looks like:
; NEW
; Y
;
;(load "I:/MRC/DEV/RECTPOS.LSP")
;
;The script file (A160627 REC ONLY.SCR) only loading the above LSP into an existing drawing looks like:
;
;(load "I:/MRC/DEV/RECTPOS.LSP")
;
Solved! Go to Solution.