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

Thread: Obtaining Anno Scale of a saved view

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Member
    Join Date
    2004-11
    Posts
    21
    Login to Give a bone
    0

    Default Obtaining Anno Scale of a saved view

    Hello All,
    I need a little help. I am working on a routine and it would be really helpful if I could programatically obtain the annotation scale within a saved view. I am able to grab the view object, but was surprised that I was not able to discern the annotation scale associated with the view once I analyzed the object data.

    any ideas?
    thanks in advance for any help offered.

  2. #2
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Obtaining Anno Scale of a saved view

    Quote Originally Posted by newfoundfreedom View Post
    HI am able to grab the view object, but was surprised that I was not able to discern the annotation scale associated with the view once I analyzed the object data.
    Do you mean a ViewPort Entity (that resides within PaperSpace), or a View Object (as in an Item of the Views Collection of the ActiveDocument Object)?
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #3
    Member
    Join Date
    2004-11
    Posts
    21
    Login to Give a bone
    0

    Default Re: Obtaining Anno Scale of a saved view

    Quote Originally Posted by RenderMan View Post
    Do you mean a ViewPort Entity (that resides within PaperSpace), or a View Object (as in an Item of the Views Collection of the ActiveDocument Object)?
    Hey RenderMan - the later. I've created a series of modelspace views (View Objects not Viewports) that I need to be able to analyze and pull the Annotation Scale that they were saved with. If you go to the View Dialogue Box and click the view in Model Space you can see the Annotation View that was saved with that view - but it is greyed out. Obviously that information is saved within the View definition - I just cant seem to get to it.

  4. #4
    Member
    Join Date
    2004-11
    Posts
    21
    Login to Give a bone
    0

    Default Re: Obtaining Anno Scale of a saved view

    To further clarify - I'm not attempting to alter the Annotation Scale saved as part of the View Object Definition. Just need to pull the information to drive a different portion of my routine.

    Thanks

  5. #5
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Obtaining Anno Scale of a saved view

    Back when 2009 was new, I recall having an issue where there’s a one-way relationship with a named View, where the Annotation scale was saved to the View. When the View was restored, the Drawing Scale (Land Desktop) was made to be the same as the Annotation Scale, yet when manually setting the Drawing Scale, the Annotation was not changed… The source of much frustration for me.

    In any event, given that a quick vlax-Dump-Object of a View Object doesn’t reveal the associated Annotation scale, perhaps digging through the View table record (DXF) will shed more light on what you’re after…? Not everything is exposed to Visual LISP unfortunately.

    Worst case, you hop into Visual Studio, and code yourself a .NET LispFunction Method that will allow LISP to do this for you.

    Good luck!
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  6. #6
    Member
    Join Date
    2004-11
    Posts
    21
    Login to Give a bone
    0

    Default Re: Obtaining Anno Scale of a saved view

    haha - oh is "hopping" into Visual Studio and coding some .NET that easy for you? Unfortunately my skill set has not quite reached such epic proportions.

    Actually, I began with the DXF records which lead me to try grabbing it through the Object Model. It would appear that what you are saying is that I am out-o-luck.

    Thanks RenderMan

  7. #7
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Obtaining Anno Scale of a saved view

    Not entirely necessary to use .Net for this. The AnnoScale is saved as an extension dictionary to the view object. The VL stuff only gets you so far (Adesk "decided" to stop updating the ActiveX library some time back). For the rest you need to look into the raw DXF data. E.g. this would extract the anno scale's name from the view name:
    Code:
    (vl-load-com)
    (defun GetViewAnnoScale  (ViewName / view xDict annoScale)
      (if (not (vl-catch-all-error-p
                 (setq view (vl-catch-all-apply
                              'vla-Item
                              (list (vla-get-Views (vla-get-ActiveDocument (vlax-get-acad-object))) ViewName)))))
       (if (and (eq (vla-get-HasExtensionDictionary view) :vlax-true)
                (setq xDict (vla-GetExtensionDictionary view))
                (not (vl-catch-all-error-p (setq annoScale (vl-catch-all-apply 'vla-Item (list xDict "ADSK_XREC_VTR_ANNOSCALE_DATA"))))))
         (cdr (assoc 300 (entget (cdr (assoc 340 (entget (vlax-vla-object->ename annoScale))))))))))

  8. #8
    Certifiable AUGI Addict
    Join Date
    2015-11
    Location
    Jo'burg SA
    Posts
    4,512
    Login to Give a bone
    0

    Default Re: Obtaining Anno Scale of a saved view

    Or if you prefer the fully AutoLisp (no vl-stuff involved at all):
    Code:
    (defun GetViewAnnoScale2 (ViewName / view xDict annoScale)
      (if (and (setq view (tblobjname "VIEW" ViewName))
               (setq xDict (cdr (assoc 360 (entget view))))
               (setq annoScale (dictsearch xDict "ADSK_XREC_VTR_ANNOSCALE_DATA")))
        (cdr (assoc 300 (entget (cdr (assoc 340 annoScale)))))))

  9. #9
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,719
    Login to Give a bone
    0

    Default Re: Obtaining Anno Scale of a saved view

    Irneb, my bru - You always come through!

    Thanks for clarifying the issue of where that data is stored (in DXF - I thought that's where it would be!), but I enjoyed doing the little .NET ditty, as I've really been trying to self-teach, so opportunities like this just help me learn, as well as help others.

    One of these days, I'll cross the pond and we'll dop a few, for now... Cheers!
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  10. #10
    Member
    Join Date
    2004-11
    Posts
    21
    Login to Give a bone
    0

    Default Re: Obtaining Anno Scale of a saved view

    Wow - okay so there was a way to extract this through just LISP. Thanks for the tip. I am completely unfamiliar with the dictsearch function. I was just looking at the output of a (tblnext "view" viewname) and had not seen the DXF 360 group code listed. I will do some further research now that I see your code, but how did you know about the 360 group code?

    By the way RenderMan - I never got back to you as I got totally caught up a few days ago. But your .NET function has worked beautifully - and I currently have my routine loading and calling it. Thank you for both writing it and the added support in all the help info you put in this post.

Page 1 of 2 12 LastLast

Similar Threads

  1. 2012: Multiple Anno-Scale Hatches
    By randyspear in forum AutoCAD General
    Replies: 3
    Last Post: 2011-11-09, 06:47 PM
  2. VP scale - Anno scale
    By Bryan Thatcher in forum AutoCAD General
    Replies: 11
    Last Post: 2009-09-10, 03:44 AM
  3. Transfer saved VIEW
    By OCD in forum ACA General
    Replies: 2
    Last Post: 2007-11-01, 12:42 AM
  4. 3d view saved orientation
    By JohnCAVogt in forum Revit Architecture - General
    Replies: 3
    Last Post: 2007-08-11, 04:27 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
  •