Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: Edit annotation scale name

  1. #1
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Edit annotation scale name

    Hi gang,

    I'm looking to edit the name of one annotation scale via lisp.

    Easy enough to do manually using SCALELISTEDIT, then selecting the scale and clicking the EDIT button and renaming it.



    However, when using "-SCALELISTEDIT" there is no option to edit the name of the scale.

    You might ask... why JP.. .WHY?

    Well, I have a user who has created a ton of drawings, each with a model view that references an incorrectly named scale. No way to update the scale in the view (and... the views are all uniquely named so I can't write a script to add the correct scale and update the views from the command line).

    If I rename the incorrectly named annotation scale, the view reflects the change.

    Helpitty help.

    Thanks as always!

    -JP
    Attached Images Attached Images

  2. #2
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Edit annotation scale name

    OK, so I know I need to do this using DXF codes and DICTSEARCH. But I'm a little (or a lot) out of my depth.

    I have this code which searches the dictionary for the scale "1" = 10'-0" and dumps the properties into a variable "ent" and the object name into "entnm"

    Code:
    (defun c:SCALETEST (/ slist scaleDict scaleDictName csobj num index scaleObject item entnm ent aScale
    tempNameObj tempFirst RatioObj tempLastRatioObj tempDictList tempDictListEnt
    newScaleDict)
    (setq slist '("1:1"))
    (setq scaleDict (dictsearch (namedobjdict) "ACAD_SCALELIST"))
    (setq scaleDictName (cdar scaleDict))
    (setq csobj (vlax-ename->vla-object scaleDictName))
    
    (setq num (vla-get-count csobj))
    (setq index 0)
    (repeat num
    (setq scaleObject (vlax-invoke-method csobj 'item index))
    (setq entnm (vlax-vla-object->ename scaleObject))
    (setq ent (entget entnm))
    (if (not (member (setq aScale (cdr (assoc 300 ent))) slist))
    (progn (entdel entnm))
    (progn (setq index (+ index 1)))
    )
    )
    (princ ent)
    )
    It spits out the following:

    ((-1 . <Entity name: 7ffffb0ab10>) (0 . SCALE) (5 . 1491) (102 . {ACAD_REACTORS) (330 . <Entity name: 7ffffb051e0>) (102 . }) (330 . <Entity name: 7ffffb051e0>) (100 . AcDbScale) (70 . 0) (300 . 1" = 10'-0") (140 . 1.0) (141 . 120.0) (290 . 0))((-1 . <Entity name: 7ffffb0ab10>) (0 . "SCALE") (5 . "1491") (102 . "{ACAD_REACTORS") (330 . <Entity name: 7ffffb051e0>) (102 . "}") (330 . <Entity name: 7ffffb051e0>) (100 . "AcDbScale") (70 . 0) (300 . "1\" = 10'-0\"") (140 . 1.0) (141 . 120.0) (290 . 0))

    I can see that it's got the correct scale from this bit:

    (300 . 1" = 10'-0")

    But what I don't know how to do is change that to (300 . 1" = 10') and write that back to the entity name in the dictionary. All I want to change is the name of the scale.

    As always... thanks for your help!

    -JP

  3. #3
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: Edit annotation scale name

    First what version and vertical are you using? AutoCAD's methods to update them have changed several times since they were introduced. The 2007 version finally introduced scales based in feet and US foot as a unit of measurement!

    There have been a lot of lisp towards what you're trying to do, including Steve Johnson's ScaleListDel.lsp
    There are a group of scale list functions included, but you can easily modify them or add more using the defined "scaledel_create_scales" function.

    I added a US Civil one for myself below.

    Code:
    ;;; --------------------------------------------------------------------------
    ;; *** Note: several uncommon scales have been commented out.
    ;; Delete the leading semi-colon to make a scale active.
    ;; You can comment out an unwanted scale by placing a semi-colon at
    ;; the start of its line.
    
        (defun scaledel_create_civil ()
          (scaledel_create_scales
            '(
    ;          ("1:1" "1:1");				1" = 5'
    ;          ("1:2" "1:2")
    ;          ("1:3" "1:3")
    ;          ("1:4" "1:4")
              ( "1\" = 5'" "1:5");				1" = 5'
              ( "1\" = 10'" "1:10");			1" = 10'
              ( "1\" = 20'" "1:20");			1" = 20'
              ( "1\" = 30'" "1:30");			1" = 30'
              ( "1\" = 40'" "1:40");			1" = 40'
              ( "1\" = 50'" "1:50");			1" = 50'
              ( "1\" = 60'" "1:60");			1" = 60'
              ( "1\" = 100'" "1:100");			1" = 100'
              ( "1\" = 200'" "1:200");			1" = 200'
              ( "1\" = 300'" "1:300");			1" = 300'
              ( "1\" = 400'" "1:400");			1" = 400'
              ( "1\" = 500'" "1:500");			1" = 500'
              ( "1\" = 600'" "1:600");			1" = 600'
              ( "1\" = 1000'" "1:1000");		1" = 1000'
              ("1\" = 1/4 mile" "1:1320'");		1" = 1/4 mile
              ( "1\" = 1/2 mile" "1:2640'");	1" = 1/2 mile
              ( "1\" = mile" "1:5280'");		1" = mile
            )
          )
        ) ; End scaledel_create_civil
    As we can now update the Default Scale list I haven't needed it in a while.

  4. #4
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Edit annotation scale name

    Thanks Tom,

    All good stuff in there, but it's missing the one thing I need to do which is change the name of an existing scale from 1" = 1' to 1" = 1'-0"

    I can successfully find the scale I want to rename in the dictionary but I don't know how to edit the name and save back to the dictionary.

    Maybe I'm missing something in the info you sent? This process is (obviously) not my forte.

    Thanks for your help, much appreciated.

  5. #5
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Edit annotation scale name

    I'm thinking it's got to somehow be vlax-ldata-put but the syntax is confusing me.

    https://knowledge.autodesk.com/searc...BFA28-htm.html

    (vlax-ldata-put dict key data [private])

    so... I think...

    • dict would the scaleDictName variable
    • key ??? Is the is where I add the new scale name - and how?
    • data should be the entnm variable (entity name)


    maybe this?

    Code:
    (vlax-ldata-put scaleDictName <<new scale name goes here somehow>> entm)
    Last edited by jpcadconsulting347236; 2017-02-08 at 06:11 PM.

  6. #6
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: Edit annotation scale name

    You never said what version and vertical are you using? The Default Scale List only needs to be set one time. After that "-SCALELISTEDIT" does have the option to reset to the Default Scale List.

  7. #7
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Edit annotation scale name

    Oops, sorry.

    Using Vanilla AutoCAD 2016 and testing on 2017.

    All I want to do is rename an existing scale though, not set the default list.

    Thanks Tom.

  8. #8
    Certifiable AUGI Addict
    Join Date
    2001-03
    Location
    Tallahassee, FL USA
    Posts
    3,658
    Login to Give a bone
    0

    Default Re: Edit annotation scale name

    It's an easy way to do it though. I use Jimmy Bergmark's PersonalMtextSymbols.LSP modified to also set up my "Default Scale List".

    Code:
    ;;; PersonalMtextSymbols.LSP ver 1.0
    ;;; Add personal mtext symbols in the right click menu in the mtext editor
    ;;; By Jimmy Bergmark
    ;;; Copyright (C) 1997-2004 JTB World, All Rights Reserved
    ;;; http://jtbworld.com/autocad-personalmtextsymbols-lsp
    ;;; E-mail: info@jtbworld.com
    ;;; Tested on AutoCAD 2002 - 2009
    ;;; (load "PersonalMtextSymbols.LSP") PersonalMtextSymbols
    ;;; Remember that you can change the contents to whatever you would like
    ;;; The syntax is:
    ;;; (vl-registry-write key "Name <1,2,3...n>" "<Description>")
    ;;; (vl-registry-write key "Contents <1,2,3...n>" "<Value>")
    ;;; Command line: (load "PersonalMtextSymbols.lsp")
    (defun PersonalMtextSymbols ()
      (vl-load-com)
      (setq key (strcat "HKEY_CURRENT_USER\\" (vlax-user-product-key) "\\Profiles\\" (getvar "cprofile") "\\Dialogs\\AcLayerApps:LayerStatesManager"))
      (vl-registry-write key "LayerNotFound" "0");	Layer States Manager - Do not turn off layers not found in layer state
      (setq key (strcat "HKEY_CURRENT_USER\\" (vlax-user-product-key) "\\MTEXT\\Symbols"))
      (vl-registry-write key "Name 1" "%%0215 \U+00D7")
      (vl-registry-write key "Name 2" "%%0247 \U+00F7")
      (vl-registry-write key "Name 3" "%%172  \U+00BC")
      (vl-registry-write key "Name 4" "%%171  \U+00BD")
      (vl-registry-write key "Name 5" "%%0190 \U+00BE")
      (vl-registry-write key "Name 6" "%%0133 \U+2026")
      (vl-registry-write key "Contents 1" "×")
      (vl-registry-write key "Contents 2" "÷")
      (vl-registry-write key "Contents 3" "¼")
      (vl-registry-write key "Contents 4" "½")
      (vl-registry-write key "Contents 5" "¾")
      (vl-registry-write key "Contents 6" "…")
      (setq key (strcat "HKEY_CURRENT_USER\\" (vlax-user-product-key) "\\Scale List"))	; Use 2013 function
      (vl-registry-write key " 0.ScaleDrawingUnits" "1.00000000")
      (vl-registry-write key " 0.ScaleName" "1\" = 1'")
      (vl-registry-write key " 0.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 0.ScaleType" "3")
      (vl-registry-write key " 1.ScaleDrawingUnits" "5.00000000")
      (vl-registry-write key " 1.ScaleName" "1\" = 5'")
      (vl-registry-write key " 1.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 1.ScaleType" "2")
      (vl-registry-write key " 2.ScaleDrawingUnits" "10.00000000")
      (vl-registry-write key " 2.ScaleName" "1\" = 10'")
      (vl-registry-write key " 2.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 2.ScaleType" "2")
      (vl-registry-write key " 3.ScaleDrawingUnits" "20.00000000")
      (vl-registry-write key " 3.ScaleName" "1\" = 20'")
      (vl-registry-write key " 3.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 3.ScaleType" "2")
      (vl-registry-write key " 4.ScaleDrawingUnits" "30.00000000")
      (vl-registry-write key " 4.ScaleName" "1\" = 30'")
      (vl-registry-write key " 4.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 4.ScaleType" "2")
      (vl-registry-write key " 5.ScaleDrawingUnits" "40.00000000")
      (vl-registry-write key " 5.ScaleName" "1\" = 40'")
      (vl-registry-write key " 5.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 5.ScaleType" "2")
      (vl-registry-write key " 6.ScaleDrawingUnits" "50.00000000")
      (vl-registry-write key " 6.ScaleName" "1\" = 50'")
      (vl-registry-write key " 6.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 6.ScaleType" "2")
      (vl-registry-write key " 7.ScaleDrawingUnits" "60.00000000")
      (vl-registry-write key " 7.ScaleName" "1\" = 60'")
      (vl-registry-write key " 7.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 7.ScaleType" "2")
      (vl-registry-write key " 8.ScaleDrawingUnits" "100.00000000")
      (vl-registry-write key " 8.ScaleName" "1\" = 100'")
      (vl-registry-write key " 8.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 8.ScaleType" "2")
      (vl-registry-write key " 9.ScaleDrawingUnits" "200.00000000")
      (vl-registry-write key " 9.ScaleName" "1\" = 200'")
      (vl-registry-write key " 9.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 9.ScaleType" "2")
      (vl-registry-write key " 10.ScaleDrawingUnits" "300.00000000")
      (vl-registry-write key " 10.ScaleName" "1\" = 300'")
      (vl-registry-write key " 10.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 10.ScaleType" "2")
      (vl-registry-write key " 11.ScaleDrawingUnits" "400.00000000")
      (vl-registry-write key " 11.ScaleName" "1\" = 400'")
      (vl-registry-write key " 11.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 11.ScaleType" "2")
      (vl-registry-write key " 12.ScaleDrawingUnits" "500.00000000")
      (vl-registry-write key " 12.ScaleName" "1\" = 500'")
      (vl-registry-write key " 12.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 12.ScaleType" "2")
      (vl-registry-write key " 13.ScaleDrawingUnits" "600.00000000")
      (vl-registry-write key " 13.ScaleName" "1\" = 600'")
      (vl-registry-write key " 13.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 13.ScaleType" "2")
      (vl-registry-write key " 14.ScaleDrawingUnits" "1000.00000000")
      (vl-registry-write key " 14.ScaleName" "1\" = 1000'")
      (vl-registry-write key " 14.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 14.ScaleType" "2")
      (vl-registry-write key " 15.ScaleDrawingUnits" "5280.00000000")
      (vl-registry-write key " 15.ScaleName" "1\" = mile")
      (vl-registry-write key " 15.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 15.ScaleType" "2")
      (vl-registry-write key " 16.ScaleDrawingUnits" "1.00000000")
      (vl-registry-write key " 16.ScaleName" "1:1")
      (vl-registry-write key " 16.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 16.ScaleType" "5")
      (vl-registry-write key " 17.ScaleDrawingUnits" "2.00000000")
      (vl-registry-write key " 17.ScaleName" "1:2")
      (vl-registry-write key " 17.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 17.ScaleType" "4")
      (vl-registry-write key " 18.ScaleDrawingUnits" "4.00000000")
      (vl-registry-write key " 18.ScaleName" "1:4")
      (vl-registry-write key " 18.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 18.ScaleType" "4")
      (vl-registry-write key " 19.ScaleDrawingUnits" "5.00000000")
      (vl-registry-write key " 19.ScaleName" "1:5")
      (vl-registry-write key " 19.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 19.ScaleType" "4")
      (vl-registry-write key " 20.ScaleDrawingUnits" "8.00000000")
      (vl-registry-write key " 20.ScaleName" "1:8")
      (vl-registry-write key " 20.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 20.ScaleType" "4")
      (vl-registry-write key " 21.ScaleDrawingUnits" "10.00000000")
      (vl-registry-write key " 21.ScaleName" "1:10")
      (vl-registry-write key " 21.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 21.ScaleType" "4")
      (vl-registry-write key " 22.ScaleDrawingUnits" "16.00000000")
      (vl-registry-write key " 22.ScaleName" "1:16")
      (vl-registry-write key " 22.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 22.ScaleType" "4")
      (vl-registry-write key " 23.ScaleDrawingUnits" "20.00000000")
      (vl-registry-write key " 23.ScaleName" "1:20")
      (vl-registry-write key " 23.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 23.ScaleType" "4")
      (vl-registry-write key " 24.ScaleDrawingUnits" "30.00000000")
      (vl-registry-write key " 24.ScaleName" "1:30")
      (vl-registry-write key " 24.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 24.ScaleType" "4")
      (vl-registry-write key " 25.ScaleDrawingUnits" "40.00000000")
      (vl-registry-write key " 25.ScaleName" "1:40")
      (vl-registry-write key " 25.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 25.ScaleType" "4")
      (vl-registry-write key " 26.ScaleDrawingUnits" "50.00000000")
      (vl-registry-write key " 26.ScaleName" "1:50")
      (vl-registry-write key " 26.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 26.ScaleType" "4")
      (vl-registry-write key " 27.ScaleDrawingUnits" "100.00000000")
      (vl-registry-write key " 27.ScaleName" "1:100")
      (vl-registry-write key " 27.ScalePaperUnits" "1.00000000")
      (vl-registry-write key " 27.ScaleType" "4")
      (vl-registry-write key " 28.ScaleDrawingUnits" "1.00000000")
      (vl-registry-write key " 28.ScaleName" "2:1")
      (vl-registry-write key " 28.ScalePaperUnits" "2.00000000")
      (vl-registry-write key " 28.ScaleType" "4")
      (vl-registry-write key " 29.ScaleDrawingUnits" "1.00000000")
      (vl-registry-write key " 29.ScaleName" "4:1")
      (vl-registry-write key " 29.ScalePaperUnits" "4.00000000")
      (vl-registry-write key " 29.ScaleType" "4")
      (vl-registry-write key " 30.ScaleDrawingUnits" "1.00000000")
      (vl-registry-write key " 30.ScaleName" "8:1")
      (vl-registry-write key " 30.ScalePaperUnits" "8.00000000")
      (vl-registry-write key " 30.ScaleType" "4")
      (vl-registry-write key " 31.ScaleDrawingUnits" "1.00000000")
      (vl-registry-write key " 31.ScaleName" "10:1")
      (vl-registry-write key " 31.ScalePaperUnits" "10.00000000")
      (vl-registry-write key " 31.ScaleType" "4")
      (vl-registry-write key " 32.ScaleDrawingUnits" "1.00000000")
      (vl-registry-write key " 32.ScaleName" "100:")
      (vl-registry-write key " 32.ScalePaperUnits" "100.00000000")
      (vl-registry-write key " 32.ScaleType" "4")
    )
    (PersonalMtextSymbols)
    (princ)
    I'd forgotten about it as it's been autoloaded with acad.lsp the first time a profile is used if Mtext Symbols have not been set up for a few years with:
    Code:
    (if(=(vl-registry-read (strcat "HKEY_CURRENT_USER\\" (vlax-user-product-key) "\\MTEXT\\Symbols") "Name 1")nil)(load "PersonalMtextSymbols"))
    I though it was just set up in the newer versions.

  9. #9
    Member
    Join Date
    2003-10
    Posts
    4
    Login to Give a bone
    0

    Default Re: Edit annotation scale name

    Quote Originally Posted by jpcadconsulting347236 View Post
    Oops, sorry.

    Using Vanilla AutoCAD 2016 and testing on 2017.

    All I want to do is rename an existing scale though, not set the default list.

    Thanks Tom.
    Hi Tom,

    Ever get a good answer on this? I'm in the same boat.

    Thanks,

    Zak

  10. #10
    I could stop if I wanted to
    Join Date
    2011-09
    Posts
    308
    Login to Give a bone
    0

    Default Re: Edit annotation scale name

    I'm now in AutoCAD 2020 and I still don't have a way to do this. Anyone find anything?

    To refresh, I want to change only the name of an existing scale in the current file.

    Thanks for any help...

Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 10
    Last Post: 2022-08-25, 10:06 PM
  2. match annotation scale to viewport scale
    By Mary_Ellen_Banning in forum AutoLISP
    Replies: 11
    Last Post: 2014-12-18, 03:20 AM
  3. Purge Annotation Scales That Are Not the Current Active Annotation Scale
    By autocad.wishlist1734 in forum AutoCAD Wish List
    Replies: 0
    Last Post: 2009-02-01, 06:04 PM
  4. Edit annotation scale lists
    By philcrocker in forum AutoCAD General
    Replies: 1
    Last Post: 2007-12-19, 07:18 PM
  5. AutoCAD 2008 Delete scale from Annotation Scale list
    By cgerhardt in forum VBA/COM Interop
    Replies: 3
    Last Post: 2007-04-25, 02:21 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •