Author Topic: Reset scale List and qsave drawing...  (Read 2468 times)

0 Members and 1 Guest are viewing this topic.

PitchBlack98

  • Guest
Reset scale List and qsave drawing...
« on: March 07, 2008, 07:01:40 PM »
I am writing a lisp that will reset the scales list and then qsave the drawing automatically. I want to add this to my acaddoc.lsp so it will do it automatically anytime a drawing is opened. I tried to use the dbxremsl routine to clean up my drawings by directory, but it is way too time consuming. The duplicate scales have gotten out of hand and is bringing CAD to a crawl.

I know this is a fairly simple lisp and I have it working for the most part. The problem I have is trying to get the lisp check the drawing to see if it is read only or not. I want it to check and quit the routine if the drawing is read only. Right now it works great, but I get the "Drawing is write protected" pop up.

If anyone could take a few minutes and help me out I would greatly appreciate it.

Heres what I have so far...

Code: [Select]
;;;Updated - 03/06/2008
;;;This routine resets the scales lists to default. It removes all of the
;;;duplicate "_XREF" scales created by AutoCAD 2008 before service pack 1.

(DEFUN C:slr ()
(command "-scalelistedit" "Reset" "Yes" "Exit")
  (command "qsave")
 ;;CLEAN EXIT
 (princ)
 )

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Reset scale List and qsave drawing...
« Reply #1 on: March 07, 2008, 08:33:53 PM »
Code: [Select]
(vl-load-com)
(if (= :vlax-false
       (vla-get-readonly
(vla-get-activedocument
   (vlax-get-acad-object)
   )
)
       )
  (princ "Drawing is not read-only.");;replace this with what you want to do.
  )

PitchBlack98

  • Guest
Re: Reset scale List and qsave drawing...
« Reply #2 on: March 10, 2008, 10:50:04 AM »
Awesome. I will give it a try. Much appreciated!