+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 20
  1. #1
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows 8.1
    Discipline
    Landscape
    Using
    AutoCAD 2015
    Join Date
    Apr 2010
    Posts
    2,943

    Default Annotative troubles

    Registered forum members do not see this ad.

    To All.. please help

    what i'm trying to do is update the annotative state ot a TEXT/MTEXT with mulitple Anno scale i was able to drill down up to the point "ACDB_ANNOTATIONSCALES" which shows me the number of annotative scale the entity have
    .... testing it .. then deal with it .. after that i'm stumped.. cant seem to update the entity to loose the other
    annotative scales, say i the text has 4 annotative scale.. i'll take out 3 then update the text.. but nada
    heres what i have so far...

    Code:
    (defun c:kj ()(vl-load-com)
           (setq disdg (vla-get-activedocument (vlax-get-acad-object))
                 dd_utl (vla-get-utility disdg))
            (vla-getentity dd_utl 'obg 'pwnt "\nSelect object: ")
            (setq str_scl (vla-GetExtensionDictionary obg)
             frst (vla-item str_scl 0))
     
      (gt_scl frst)
          )
    (defun gt_scl (frst)
     (setq scl_lst (vla-item frst 0) prcd2 0)
      (repeat (vla-get-count scl_lst)
        
        (setq dlkd (vla-item str_scl prcd2))
        
         (setq i2nyun (entget (vlax-vla-object->ename (vla-item dlkd 0)))
         txt_scle (assoc 40 i2nyun))
         
        (if (/= txt_scle ******) ; the condition is met
           (vla-delete dlkd))
        )
     )
    ;;;; or this method


    Code:
    (defun gt_scl (frst) 
     (setq scl_lst (vla-item frst 0));(vla-addxrecord scl_lst "New_SCale_list")
      (vlax-for vegeta scl_lst
         (setq i2nyun (entget (vlax-vla-object->ename vegeta))
         txt_scle (assoc 40 i2nyun))
        (if (/= txt_scle ******) ; the condition is met
           (vla-delete dlkd))
        
        )
      )
    or am i better off not using enames? and stick with vla-objects?

    vla-update? vla-replace? i think i hit a stonewall
    which brings me to another question..

    vlax-item gave me this : IAcadDictionary: A container object for storing and retrieving objects
    vlax-for gave me this : IAcadObject: The standard interface for a basic AutoCAD object

    whats the main difference?
    Last edited by Tiger; 6th Oct 2010 at 08:15 am. Reason: added codetags

  2. #2
    Luminous Being BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    2 x 240GB Samsung EVO SSD (RAID 0)
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Discipline
    Civil
    BlackBox's Discipline Details
    Occupation
    Senior Civil Designer
    Discipline
    Civil
    Details
    Public/Private Land Development, Transportation, and Utilities.
    Using
    Civil 3D 2016
    Join Date
    Nov 2009
    Posts
    5,281

    Default

    Congrats on your first post, and welcome to the forums!

    I *think* you're looking for this, to apply the desired annotation scale:

    Code:
    (setvar 'cannoscale (strcat "1\" = <Desired_AnnoScale>'"))

    Or, perhaps this may be of use:

    Code:
    (setvar 'cannoscale (strcat "1\" = " (rtos (getvar 'dimscale) 2 0) "'"))

    Please note the space " " before and after the equal sign "="... this is present for my annotative scales list, yours may not include the spaces, and should be removed if that is the case. The text string should exactly match your format.

    Quote Originally Posted by pBe View Post
    ...
    vlax-item gave me this : IAcadDictionary: A container object for storing and retrieving objects
    vlax-for gave me this : IAcadObject: The standard interface for a basic AutoCAD object

    whats the main difference?
    The vla-item function returns a vla-object in many cases from a collection, example:

    Code:
    (setq layerItem (vla-item (vlax-get-layers *activeDoc*) "<LayerName>"))

    The vlax-for function is used to do, check, of modify something for each vla-item in a vla-collection object, example:

    Code:
    (vlax-for lay (vla-get-layers *activeDoc*)
      (vla-put-freeze lay :vlax-true))

    Hope this helps!
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Exchange Apps ~ Autoloader ~ AutoCAD Security

  3. #3
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows 8.1
    Discipline
    Landscape
    Using
    AutoCAD 2015
    Join Date
    Apr 2010
    Posts
    2,943

    Default

    Thx RenderMan... nice to be seen

    Anyway.. you gave me an idea as to where i can compare the list i got as to the current anoscale... but what i'm looking for is getting rid of "annoscale" on the entity itself... not all but leave 1... hmmmn like this, select a MTEXT by grips.. and you will see shadows of the different annoscales it has ... now the goal is slecting this text (entitities), detect all the anoscale scales, leave the ones i dictated, and update...

    i got to the point where i extracted the number of annoscales it has. but my problem is updating or making the others dissapear...

    ordinarily you select the text.. go to properties... go to annotative scale box.. select the scales you want to get rid of..

    remember, what i want is to to update the enitities one by one...

    thanks sire.....

  4. #4
    Luminous Being BlackBox's Avatar
    Computer Details
    BlackBox's Computer Details
    Operating System:
    Windows 8.1 Professional, Server 2012 R2 Datacenter
    Computer:
    Dell Precision T3600
    CPU:
    Hex-Core Intel Xeon 3.2Ghz
    RAM:
    32GB
    Graphics:
    3GB NVIDIA Quadro K4000
    Primary Storage:
    2 x 240GB Samsung EVO SSD (RAID 0)
    Secondary Storage:
    1TB Western Digital VelociRaptor 10K RPM
    Monitor:
    Dual 24" Dell Ultrasharp Widescreen Monitors
    Discipline
    Civil
    BlackBox's Discipline Details
    Occupation
    Senior Civil Designer
    Discipline
    Civil
    Details
    Public/Private Land Development, Transportation, and Utilities.
    Using
    Civil 3D 2016
    Join Date
    Nov 2009
    Posts
    5,281

    Default

    Sadly, *to the best of my knowledge* this can only be done (programmatically) via DXF XData.
    "Potential has a shelf life." - Margaret Atwood
    AutoCAD, and Civil 3D Certified Professional | Autodesk Authorized Developer
    Sincpac C3D ~ Exchange Apps ~ Autoloader ~ AutoCAD Security

  5. #5
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows 8.1
    Discipline
    Landscape
    Using
    AutoCAD 2015
    Join Date
    Apr 2010
    Posts
    2,943

    Default

    no worries,,, someday i'll figure it out.... but hey great advice on cannoscale variable

    BTW i posted the same thread at AUGI forum... apologies....

  6. #6
    Luminous Being alanjt's Avatar
    Using
    Civil 3D 2013
    Join Date
    Apr 2008
    Posts
    6,199

    Default

    To turn off display of additional, inactive scales, look at the system variable "SELECTIONANNODISPLAY".

    You can also remove additional scales from the Annotative Scales option upon a right-click on the object; or were you wanting to remove additional scales in code?
    DropBox
    Seann: ...it went crazy ex-girlfriend on me...
    eric_monceaux...its pretty funny seeing two AutoCAD Gods give each other flak...

  7. #7
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows 8.1
    Discipline
    Landscape
    Using
    AutoCAD 2015
    Join Date
    Apr 2010
    Posts
    2,943

    Default

    thanks buddy...

    The thing is, its not the display that bothers me. its the thought of that entity does have annoscales other than the scale it was intended for... taking it out using right click works well but if you have to check hundreds of dwgs to go through... welll you know what i mean....

    i intend to use the selection sets after i figure out how to do it with just one entity.. but i will use it to find all entities with annoscales.. detect the active ones the annihilate the rest .. my problem is after getting what i need from the selected object i dont know how to update it.. similar to entupd/entmod method but in VLISP... i'm totally bummed out on that part.. dont know when and how to used vla-replace/vla-update/xdata stuff

    thanks for the advice though, honestly i didnt know about variable for the anno display.. cool..... and yup i want to remove it by code....



    besides files with too many annoscales are rather large...

  8. #8
    Super Member irneb's Avatar
    Computer Details
    irneb's Computer Details
    Operating System:
    Win7 Pro 64bit
    Computer:
    Antec One Hundred
    Motherboard:
    ASUS P8P67-Pro P67
    CPU:
    Intel i7 2600 @ 3.4GHz
    RAM:
    16GB-1600MHz
    Graphics:
    GeForce GT 430 (1GB)
    Primary Storage:
    Seagate1TB SATA2 - 7200rpm
    Monitor:
    Samsung 2333TN 23" 1920 x 1080 Full HD LCD Monitor2GW
    Discipline
    Architectural
    irneb's Discipline Details
    Occupation
    Architectural Technician and Programmer
    Discipline
    Architectural
    Using
    AutoCAD 2013
    Join Date
    Sep 2010
    Location
    Jo'burg SA
    Posts
    1,743

    Default

    Well, a "quick-fix" solution would be to use the ObjectScale command's command-line arguments.
    Code:
    (defun c:ObjectScaleCurOnly (/ ss n scLst OSC:GetScales)
      (print "Select the objects you wish to modify: ")
      (if (or (setq ss (ssget "I")) (setq ss (ssget)))
        (progn
          ;; Define helper function to get scales attached to an entity
          (defun OSC:GetScales (en / ed xn xd cdn cdd asn asd cn cd sn sd cannoscale)
            (setq ed (entget en))
            (if (and
                  ;; Get the XDictionary attached to the object
                  (setq xn (vl-position '(102 . "{ACAD_XDICTIONARY") ed))
                  (setq xn (cdr (nth (1+ xn) ed)))
                  (setq xd (entget xn))
                  ;; Get the Context Data Management dictionary attached to the XDictionary
                  (setq cdn (vl-position '(3 . "AcDbContextDataManager") xd))
                  (setq cdn (cdr (nth (1+ cdn) xd)))
                  (setq cdd (entget cdn))
                  ;; Get the Annotation Scales dictionary attached to the CD
                  (setq asn (vl-position '(3 . "ACDB_ANNOTATIONSCALES") cdd))
                  (setq asn (cdr (nth (1+ asn) cdd)))
                  (setq asd (entget asn))
                  ;; Get the 1st scale attached
                  (setq cn (assoc 3 asd))
                  (setq cn (member cn asd))
                )
              ;; Step through all scales attached
              (while cn
                (if (and (= (caar cn) 350) ;It it's pointing to a scale record
                         ;; Get the record's data
                         (setq cd (entget (cdar cn)))
                         ;; Get the Context data class
                         (setq sn (assoc 340 cd))
                         (setq sd (entget (cdr sn)))
                         (setq sn (assoc 300 sd))
                         ;; Check if the scale is already in the list
                         (not (vl-position (cdr sn) scLst))
                    )
                  ;; Add it to the list
                  (setq scLst (cons (cdr sn) scLst))
                )
                (setq cn (cdr cn))
              )
            )
          )
    
          ;; Find a list of scales used in selection
          (setq n (sslength ss))
          (while (>= (setq n (1- n)) 0)
            (OSC:GetScales (ssname ss n))
          )
    
          ;; Add the current scale to the selection
          (setq cannoscale (getvar "CANNOSCALE"))
          (command "._ObjectScale" ss "" "_Add" cannoscale "")
    
          ;; Remove all other scales attached
          (command "._ObjectScale" ss "" "_Delete")
          (foreach n scLst
            (if (wcmatch (strcase n) (strcat "~" (strcase cannoscale)))
              (command n)
            )
          )
          (command "")
        )
      )
    
      (princ)
    )
    The problem with anno scales are that they are nested 5 levels deep into the dictionaries attached to the entity.

  9. #9
    Forum Deity pBe's Avatar
    Computer Details
    pBe's Computer Details
    Operating System:
    Windows 8.1
    Discipline
    Landscape
    Using
    AutoCAD 2015
    Join Date
    Apr 2010
    Posts
    2,943

    Default

    works great

    delete all then put the current back... splendid idea... thanks a mil.. i keep you posted how it goes...

    in vlisp i was able to retrieve the scales but after that i dont what to do...
    while you're at it.. can you tell me how and when to use (vla-replace...) and
    (vla-update ....)?

    Again thanks irneb....

  10. #10
    Super Member irneb's Avatar
    Computer Details
    irneb's Computer Details
    Operating System:
    Win7 Pro 64bit
    Computer:
    Antec One Hundred
    Motherboard:
    ASUS P8P67-Pro P67
    CPU:
    Intel i7 2600 @ 3.4GHz
    RAM:
    16GB-1600MHz
    Graphics:
    GeForce GT 430 (1GB)
    Primary Storage:
    Seagate1TB SATA2 - 7200rpm
    Monitor:
    Samsung 2333TN 23" 1920 x 1080 Full HD LCD Monitor2GW
    Discipline
    Architectural
    irneb's Discipline Details
    Occupation
    Architectural Technician and Programmer
    Discipline
    Architectural
    Using
    AutoCAD 2013
    Join Date
    Sep 2010
    Location
    Jo'burg SA
    Posts
    1,743

    Default

    Registered forum members do not see this ad.

    Just to be clear: it's first add the current, then delete all but the current. The problem with doing it the other way, is you will usually end up with 2 scales (the last in the list for that object) and the current - since you cannot remove all the scales from an object (it has to have at least one). So if you're going the VLA / entmod route, please remember this.

    I had something which removed scales from the entire DWG without checking such stuff. Causes huge problems as drawings start crashing.

Similar Threads

  1. Troubles with vla-addleader...
    By Lee Mac in forum AutoLISP, Visual LISP & DCL
    Replies: 0
    Last Post: 5th Apr 2009, 11:20 pm
  2. Troubles With My 3D Model
    By Bill Tillman in forum AutoCAD 3D Modelling & Rendering
    Replies: 19
    Last Post: 12th Mar 2009, 04:05 am
  3. text troubles
    By chelsea1307 in forum AutoCAD Beginners' Area
    Replies: 2
    Last Post: 12th Dec 2008, 07:19 pm

Bookmarks

Posting Permissions

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