Jump to content

Recommended Posts

Posted

Words, numbers or emoticons cannot express how much this stresses me out in AutoCAD2008. Already today, i have lost approximately 2 hours having AutoCAD crash on me then having to located the culprit files and run a scalelist edit on them:x. If only you could see my event viewer - it shows from 8am this morning about 25 application hangs due to this simply, yet horrible fault.

 

What im wondering and potentially after is a lisp file that i can shove in my acaddoc that will purge the binded xref's scales leaving only 1:1, 1:20, 1:50 & 1:100. I've created one which simply resets the scale so that i can actually perform a scalelistedit once i've opened it up. But my problem is that the whole process of removing them idividually is not only annoying but incredibly time consuming. :glare:

 

Is there anyone who can help me? The lisp routine im running to reset the scale is very basic, but im afraid my knoweldge is just that! :huh:

 

(command "-scalelistedit" "reset" "y" "e")

 

Regards,

Z

  • Replies 23
  • Created
  • Last Reply

Top Posters In This Topic

  • Commandobill

    8

  • Zorg

    8

  • Lee Mac

    5

  • Alnaibii

    1

Posted

To make this a little more intresting - anyone who can solve this i will buy a pint of thier chosen larger/ale/cider :). If you can't make it to my local or mine to your, i will send you a voucher of some form for one.

 

Now, doesn't that sound a little more worth while? :wink:

 

ReMark - If you solve my problem, i'll give you a personal oil change! o:):D

 

Z

Posted

Check out the similar threads below - there are tons on this topic :)

 

Now, where's my reward... :P

Posted

In all honesty...

 

Im afraid to edit the registry :oops:

 

Its a work machine!! o:)

Posted

Something i hacked together. (Doesn't Edit the registry)

 

(defun c:slclean ( / slist rlist)
 (vl-load-com)
 (setvar "cmdecho" 0)
 (setq slist '("1:1" "1:20" "1:50" "1:100"))
 (setq rlist (vl-remove-if '(lambda (z) (member z slist)) (getscalelist)))
 (mapcar '(lambda (z) (command "-scalelistedit" "d" z "e")) rlist)
 (setq slist (vl-remove-if '(lambda (z) (member z (getscalelist))) slist))
 (mapcar '(lambda (z) (command "-scalelistedit" "a" z z "e")) slist)
 (setvar "cmdecho" 1)
 (princ)
 )



;*************************************GETSCALELIST******************************************
;*****************************Provided By Daniel J. Altam***********************************
(defun GETSCALELIST (/ ScaleListDict ScaleListEnts ScaleListNumber
ScaleListUnits N DIGIT ACAD-KEY)
(if (>= (atof (substr (getvar "acadver") 1 4)) 17.1)
(progn ; 2008 and higher
(setq ScaleListDict (dictsearch (namedobjdict) "ACAD_SCALELIST")
ScaleListEnts (MASSOC 350 ScaleListDict)
ScaleList (list "")
N 0
)
(repeat (length ScaleListEnts)
(setq ScaleList (cons (cdr (assoc 300 (entget (nth N
ScaleListEnts)))) ScaleList)
N (+ N 1)
)
)
(setq ScaleList (cdr (reverse ScaleList)))
)
(progn ; 2007& lower
(setq ACAD-KEY (strcat "HKEY_CURRENT_USER\\" (vlax-product-key)
"\\Scale List"))
(if (vl-registry-descendents ACAD-KEY T)
(progn
(setq ScaleListNumber (/ (vl-list-length (vl-registry-descendents
ACAD-KEY T)) 3)
ScaleList (list "")
N 0
)
(repeat ScaleListNumber
(if (>= N 10)
(setq DIGIT (itoa N))
(setq DIGIT (strcat " " (itoa N)))
)
(setq ScaleList (cons (vl-registry-read ACAD-KEY (strcat DIGIT
".ScaleName")) ScaleList)
N (+ N 1)
)
)
(setq ScaleList (cdr (reverse ScaleList)))
)
)
)
)
)

(defun MASSOC (KEY ALIST / X NLIST)
(foreach X ALIST
(if (eq KEY (car X))
(setq NLIST (cons (cdr X) NLIST))
)
)
(reverse NLIST)
)

Posted

:?!

 

Will this leave only my desired scales or just clear all the ones not supported by an annotative object? Also, can i update my acaddoc file with this to run on every drawing? :huh:

 

Z

Posted

if the scale is used it wont be able to erase the scale from the list. It is going to leave the scales you want. As you can see "slist" is a list of the named scales you asked for. sure you can put this in your acaddoc file. just somewhere else not in a defun add (c:slclean) so it will automatically run.

Posted

great! :D i take it this will execute only once the drawing has opened? how is a scale defined if it is in use or not? justy if anything annoative is using it?

Posted
great! :D i take it this will execute only once the drawing has opened? how is a scale defined if it is in use or not? justy if anything annoative is using it?

 

Yes once you open the drawing it will run. It's in use if something annotative is using it or if you have a viewport using that scale

Posted

This is it only slightly different

 

(defun c:slclean ( / slist rlist)
 (vl-load-com)
 (setvar "cmdecho" 0)
 (setq slist '("1:1" "1:20" "1:50" "1:100"))
 (setq rlist (vl-remove-if '(lambda (z) (member z slist)) (getscalelist)))
 (mapcar '(lambda (z) (command "-scalelistedit" "d" z "e")) rlist)
 (setq slist (vl-remove-if '(lambda (z) (member z (getscalelist))) slist))
 (mapcar '(lambda (z) (command "-scalelistedit" "a" z z "e")) slist)
 (setvar "cmdecho" 1)
 (princ)
 )



;*************************************GETSCALELIST******************************************
;**********************************The updated Version**************************************
(defun GETSCALELIST ( / csobj drac cslst)
(setq csobj (vlax-ename->vla-object (cdar (dictsearch (namedobjdict) "ACAD_SCALELIST")))
     drac 0)
(repeat (vla-get-count csobj)
 (setq cslst (append (list (cdr (assoc 300 (entget (vlax-vla-object->ename (vlax-invoke-method csobj 'item drac)))))) cslst))
 (setq drac (1+ drac)))
 cslst
 )

Posted

And even different still... The only thing with this one is that it doesnt add any of the scales it just deletes them. This one deletes them even if they are in use.... Except the ones you tell it not to ofcourse

 

(defun c:slclean ( / slist rlist drac csobj entlst entnm)
 (vl-load-com)
 (setvar "cmdecho" 0)
 (setq slist '("1:1" "1:20" "1:50" "1:100"))
 (setq csobj (vlax-ename->vla-object (cdar (dictsearch (namedobjdict) "ACAD_SCALELIST")))
   drac 0)
 (repeat (vla-get-count csobj)
   (if (not (member (cdr (assoc 300 (entget (setq entnm (vlax-vla-object->ename (vlax-invoke-method csobj 'item drac)))))) slist))
     (setq entlst (append (list entnm) entlst)))
   (setq drac (1+ drac)))
 (mapcar 'entdel entlst)
 (setvar "cmdecho" 1)
 (princ)
 )

Posted

Woah, nice! :shock:

 

Two last thing, will this delete scales within xref files?

 

Do i just remove the defun function from the start of the lisp and load it into my acaddoc for it too run on every drawing?

 

Z

Posted

Personally i would throw that function into your acaddoc lsp then somewhere at the end (not in a function) simply write (c:slclean) that will load it everytime you open autocad or open a file.

Posted

Kool, thanks for all yopur help Bill! Looks like i owe you a pint :wink:

Posted
Looks like i owe you a pint :wink:

 

haha, for the amount of times I've heard that phrase, I reckon we'd all be alcoholics on here in no time... :P

Posted
Kool, thanks for all yopur help Bill! Looks like i owe you a pint :wink:

 

Lol I'll let you know if I'm ever in the UK. :P

  • 1 month later...
Posted

Hello,

 

i tried the last lisp above, and it only leaves me with 1:1 scale. any idea why?

 

Thanks

Posted
Hello,

 

i tried the last lisp above, and it only leaves me with 1:1 scale. any idea why?

 

Thanks

 

Perhaps the other scales were not present in your scale list to begin with :)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...