Script behaves differently between versions

Script behaves differently between versions

Anonymous
Not applicable
941 Views
7 Replies
Message 1 of 8

Script behaves differently between versions

Anonymous
Not applicable

Hello lispers,

 

So I updated to 2019. My Accadoc script is behaving differently between versions. Essentially, the draw-order for a couple objects over an image is being effected some how and the intention is that it should NOT be. I double checked my options and both are pointing to the same file location under the support directory. 

 

Here's the script:

(defun c:preprint( / PAGE_LAYOUTLIST)
;************ CANCEL ANY RUNNING COMMANDS ************
 (COMMAND ^C)

;************ TO DEBUG, SET TO 1, SET TO 0 ************
 (SETVAR "CMDECHO" 0)

;************ FILE DIALOG BOX DISPLAY TO ON ************
 (PRINC "\nFile save dialog box set to ON.\n")
 (SETVAR "FILEDIA" 1)

;*********** PURGE ALL ****************
 (PRINC "\nRunning purge...\n")
 (COMMAND "PURGE")
 (COMMAND "ALL")
 (COMMAND "*")
 (COMMAND "N")
 (PRINC "\nPurge done.\n")

;*********** IMAGE FRAME ****************
 (PRINC "\nImageframe OFF.\n")
 (COMMAND "IMAGEFRAME")
 (COMMAND "0")

;*********** LTSCALE ****************
 (PRINC "\nLinetype scale to 1.\n")
 (COMMAND "LTSCALE")
 (COMMAND "1")

;*********** Zoomfactor ****************
 (PRINC "\nZoomfactor to 30.\n")
 (COMMAND "zoomfactor")
 (COMMAND "30")

;************ Save time to ten minutes ************
 (PRINC "\nAutosave set to 10 minutes.\n")
 (SETVAR "SAVETIME" 10)

;*********** VIEWPORT LAYER PLOT SET TO OFF ****************
 (PRINC "\nViewport layer plot set to OFF.\n")
 (COMMAND ^C)
 (COMMAND "-LAYER")
 (COMMAND "PLOT")
 (COMMAND "N")
 (COMMAND "VIEWPORTS")
 (COMMAND ^C)

;*********** RUN Z0 ****************
 ;(COMMAND ^C)
 ;(COMMAND "Z0")

 (COMMAND ^C)
 (SETVAR "CMDECHO" 0)

;*********** Print a list of what to do and print it out for user

(SETQ PAGE_LAYOUTLIST (LAYOUTLIST))
(PRINC "Zoom, Extents on the following pages:")
(PRINC PAGE_LAYOUTLIST)
(PRINC "\n")


;*********** ZOOM EXTENTS IN EACH PAPER SPACE ****************
(FOREACH CURR_PAGE PAGE_LAYOUTLIST (PRINC CURR_PAGE) (PRINC ", done. ") (COMMAND "LAYOUT") (COMMAND "SET") (COMMAND CURR_PAGE) (COMMAND "PSPACE") (COMMAND "ZOOM" "E") ) (PRINC "\nZoom, Extents done.") ;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;THADDEUS ADDITION(S);;; ;;;;;;;;;;;;;;;;;;;;;;;;;; ;LOCK ALL VIEWPORTS (DEFUN VPLOCK ( / SS I) (PRINC "LOCKING ALL VIEWPORTS") (IF (SETQ SS (SSGET "_X" '((0 . "VIEWPORT")))) (REPEAT (SETQ I (SSLENGTH SS)) (SETPROPERTYVALUE (SSNAME SS (SETQ I (1- I))) "LOCKED" 1))) (PRINC "\nALL VIEWPORTS LOCKED") (PRINC) ) (VPLOCK) (PRINC "\nPreprint done.") (PRINC) ;********** END FUNCTION preprint ********************************** )

The script was here before I started. I added the viewport lock at the end. 

 

Thanks for any input!

 
0 Likes
Accepted solutions (1)
942 Views
7 Replies
Replies (7)
Message 2 of 8

Anonymous
Not applicable

I can't get my screen cast to load for some reason. If it's not clear in the post above I can make another attempt to submit them. . . Currently they are "Pending" for public access on my contributions page.

😕

0 Likes
Message 3 of 8

cadffm
Consultant
Consultant
Accepted solution

Please search the problem at other places then your acaddoc, the content dont change the order (my opinion)

if you have trouble with draworder you have this with and without your acaddoc, or?

rename or move your acad doc and check what happen.

 

Without knowing your exact issue: Have you installed the 2019 draworder hotfix?

Only then would it be more useful to talk about draworder in 2019.

 

 

Sebastian

0 Likes
Message 4 of 8

Moshe-A
Mentor
Mentor

tmorisson,

 

check my (blue) remarks, did not test it

 

calling (command) without any arguments is like pressing cancel

 

moshe

 

 

 


@Anonymous wrote:

Hello lispers,

 

So I updated to 2019. My Accadoc script is behaving differently between versions. Essentially, the draw-order for a couple objects over an image is being effected some how and the intention is that it should NOT be. I double checked my options and both are pointing to the same file location under the support directory. 

 

Here's the script:

(defun c:preprint( / PAGE_LAYOUTLIST)
;************ CANCEL ANY RUNNING COMMANDS ************
 (COMMAND ^C) ; this is redundent and cause error,
; (c:preprint) can not be invoked in middle of other command

;************ TO DEBUG, SET TO 1, SET TO 0 ************ (SETVAR "CMDECHO" 0) ;************ FILE DIALOG BOX DISPLAY TO ON ************ (PRINC "\nFile save dialog box set to ON.\n") (SETVAR "FILEDIA" 1) ;*********** PURGE ALL **************** (PRINC "\nRunning purge...\n") (COMMAND "PURGE") (COMMAND "ALL") (COMMAND "*") (COMMAND "N")
; this could be:
(command "purge" "all" "*" "n")

(PRINC "\nPurge done.\n") ;*********** IMAGE FRAME **************** (PRINC "\nImageframe OFF.\n") (COMMAND "IMAGEFRAME") (COMMAND "0")
; this could be
(setvar "imageframe" 0) ;*********** LTSCALE **************** (PRINC "\nLinetype scale to 1.\n") (COMMAND "LTSCALE") (COMMAND "1")
; this could be
(setvar "ltscale" 1) ;*********** Zoomfactor **************** (PRINC "\nZoomfactor to 30.\n") (COMMAND "zoomfactor") (COMMAND "30")
; this could be
(setvar "zoomfactor" 30) ;************ Save time to ten minutes ************ (PRINC "\nAutosave set to 10 minutes.\n") (SETVAR "SAVETIME" 10) ;*********** VIEWPORT LAYER PLOT SET TO OFF **************** (PRINC "\nViewport layer plot set to OFF.\n") (COMMAND ^C) ; redundent and cause error
(COMMAND "-LAYER") (COMMAND "PLOT") (COMMAND "N") (COMMAND "VIEWPORTS") (COMMAND ^C) ; redundent and cause error
; this could be
(command "-layer" "plot" "n" "viewport" "") ;*********** RUN Z0 **************** ;(COMMAND ^C) ;(COMMAND "Z0") (COMMAND ^C) ; redundent
(SETVAR "CMDECHO" 0) ;*********** Print a list of what to do and print it out for user (SETQ PAGE_LAYOUTLIST (LAYOUTLIST)) (PRINC "Zoom, Extents on the following pages:") (PRINC PAGE_LAYOUTLIST) (PRINC "\n") ;*********** ZOOM EXTENTS IN EACH PAPER SPACE ****************
(FOREACH CURR_PAGE PAGE_LAYOUTLIST (PRINC CURR_PAGE) (PRINC ", done. ") (COMMAND "LAYOUT") (COMMAND "SET") (COMMAND CURR_PAGE)
; this could be
(command "layout" "set" curr_page)
(COMMAND "PSPACE") (COMMAND "ZOOM" "E") ) (PRINC "\nZoom, Extents done.") ;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;THADDEUS ADDITION(S);;; ;;;;;;;;;;;;;;;;;;;;;;;;;; ;LOCK ALL VIEWPORTS (DEFUN VPLOCK ( / SS I) (PRINC "LOCKING ALL VIEWPORTS") (IF (SETQ SS (SSGET "_X" '((0 . "VIEWPORT")))) (REPEAT (SETQ I (SSLENGTH SS)) (SETPROPERTYVALUE (SSNAME SS (SETQ I (1- I))) "LOCKED" 1))) (PRINC "\nALL VIEWPORTS LOCKED") (PRINC) ) (VPLOCK) (PRINC "\nPreprint done.") (PRINC) ;********** END FUNCTION preprint ********************************** )

The script was here before I started. I added the viewport lock at the end. 

 

Thanks for any input!

 

 

Message 5 of 8

Anonymous
Not applicable

The hotfix fixed it.

 

Thanks. . . again! 🙂

0 Likes
Message 6 of 8

Anonymous
Not applicable

I managed to get it working with those changes. I had to leave 1 (COMMAND "^C") just before. 

;*********** ZOOM EXTENTS IN EACH PAPER SPACE ****************

 

I like the way the file looks now. I set that purge to repeat like 5 times and included the regapps options. Files will hopefully be looking better now.

 

Thanks a lot.

0 Likes
Message 7 of 8

roland.r71
Collaborator
Collaborator

@Anonymous wrote:

I managed to get it working with those changes. I had to leave 1 (COMMAND "^C") just before. 

;*********** ZOOM EXTENTS IN EACH PAPER SPACE ****************

Why?

You realy shouldn't have to.

 

I took the liberty of streamlining the code even a bit more as @Moshe-A since there is more redundant code & commands that could just as well be setvar's.

 

The original code looks suspiciously like a batch-script turned into lisp.

 

I also took out the redundant variable "page_layoutlist". Directly using (layoutlist).

I added the curr_page variable to the function definition, as its not needed as global.

 

I removed the second (setvar "cmdecho" 0) (halfway the lisp)

& added a (setvar "cmdecho" 1) at the end, to restore the system default setting.

(you might actually better store it at the start and restore it at the end, To keep the setting at whatever it is. i.e. (setq org_cmdecho (getvar "cmdecho")) - at the start: (setvar "cmdecho" org_cmdecho) - at the end.

 

(defun c:preprint( / curr_page)

;************ TO DEBUG, SET TO 1, SET TO 0 ************
   (setvar "cmdecho" 0)
   
;************ FILE DIALOG BOX DISPLAY TO ON ************
 (PRINC "\nFile save dialog box set to ON.\n")
 (SETVAR "FILEDIA" 1)

;*********** PURGE ALL ****************
 (PRINC "\nRunning purge...\n")
 (command "purge" "all" "*" "n")
 (PRINC "\nPurge done.\n")
 
;*********** IMAGE FRAME ****************
 (PRINC "\nImageframe OFF.\n")
 (setvar "imageframe" 0)

;*********** LTSCALE ****************
 (PRINC "\nLinetype scale to 1.\n")
 (setvar "ltscale" 1)

;*********** Zoomfactor ****************
 (PRINC "\nZoomfactor to 30.\n")
 (setvar "zoomfactor" 30)

;************ Save time to ten minutes ************
 (PRINC "\nAutosave set to 10 minutes.\n")
 (setvar "savetime" 10)

;*********** VIEWPORT LAYER PLOT SET TO OFF ****************
 (PRINC "\nViewport layer plot set to OFF.\n")
 (command "-layer" "plot" "n" "viewport" "")

;*********** RUN Z0 ****************
 ;(COMMAND "Z0")

;*********** Print a list of what to do and print it out for user

(princ "Zoom, Extents on the following pages:")
(princ (layoutlist))
(princ "\n")


;*********** ZOOM EXTENTS IN EACH PAPER SPACE ****************

(foreach curr_page (layoutlist)
 (setvar 'ctab curr_page)

 (command "pspace")
 (command "zoom" "e")
 (princ (strcat curr_page ", done. "))
) 
(princ "\nZoom, Extents done.")

;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;THADDEUS ADDITION(S);;;
;;;;;;;;;;;;;;;;;;;;;;;;;;

  ;lock all viewports
  (defun vplock ( / ss i)
    (princ "\nLocking all viewports")
    (if (setq ss (ssget "_x" '((0 . "viewport"))))
      (repeat (setq i (sslength ss))
        (setpropertyvalue (ssname ss (setq i (1- i))) "locked" 1)
      )
    )
    (princ "\nAll viewports locked")
  )
 
  (vplock)

  (princ "\nPreprint done.")
  (setvar "cmdecho" 1)
  (princ)
;********** END FUNCTION preprint **********************************

)
0 Likes
Message 8 of 8

Anonymous
Not applicable

Why, indeed. I don't know. It kept throwing an error when it would get halfway through that curr-page function. I stepped through it and would fail half-way through that (foreach. . . ). Putting the (COMMAND ^C) back in made it work again.

 

I'm not a huge fan of the original design for this script either. However, it's effectiveness here is enough.

"If it ain't broke. . . ." Smiley Wink

Like I said, I didn't write that original part. The vplock is mine though. I may not have time to get to it today, but I'll check it out later.

 

Thanks again for the input. 

 

0 Likes