Results 1 to 4 of 4

Thread: Viewport scale

  1. #1
    Member
    Join Date
    2012-03
    Posts
    4

    Default Viewport scale

    I have been tasked with creating a command for my team to create frame references for ships. I almost had the routine done but then they asked me to have it scale based on the scale of the view port. As it sits right now they have top key in the scale (***) I would much rather them just pick the vport they would like. My issue is I can not seem to get a useable number.

    So my question is

    How do I get the view port scale?

    Acad help showed me this "NoteThe ZOOM XP factor is calculated with the following formula: group_41 / group_45 (or pspace_height / mspace_height)."

    but I always get nil returned when I try to grab the val with something like this

    (defun c:test()
    (setq VP (ssget(list (cons 0 "viewport"))))
    (setq vps (getval 41 VP))
    )



  2. #2
    Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    2,383

    Default Re: Viewport scale

    Unfortunately, Viewports are not entirely accessible via DXF... Visual LISP (read VLA-Object) is required. Specifically, look into the AcDbViewport Object's CustomScale, and/or StandardScale Properties.

    For example:

    Code:
    (defun c:DVP () (c:DumpViewport))
    (defun c:DumpViewport (/ ss)
      (vl-load-com)
      (if (setq ss (ssget ":S:E:L" '((0 . "VIEWPORT"))))
        (progn
          (textpage)
          (vlax-dump-object (vlax-ename->vla-object (ssname ss 0)) T))
        (prompt "\n** Nothing selected ** "))
      (princ))
    **Edit - ... And, welcome to AUGI! BTW
    "Potential has a shelf life." - Margaret Atwood

  3. #3
    Member
    Join Date
    2012-03
    Posts
    4

    Default Re: Viewport scale

    Thanks and thanks. That is helpful info. Have been working with it for a couple years now but am still by far a noob.

  4. #4
    Moderator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    2,383

    Default Re: Viewport scale

    No worries; we all start somewhere.
    "Potential has a shelf life." - Margaret Atwood

Similar Threads

  1. match annotation scale to viewport scale
    By ccowgill in forum AutoLISP
    Replies: 33
    Last Post: 2009-05-04, 10:54 PM
  2. match annotation scale to viewport scale
    By Mary_Ellen_Banning in forum AutoCAD General
    Replies: 4
    Last Post: 2008-12-05, 07:20 AM
  3. Viewport scale changes after using Maximise Viewport facility
    By larry.111254 in forum AutoCAD LT - General
    Replies: 3
    Last Post: 2007-02-21, 11:08 AM
  4. Replies: 0
    Last Post: 2006-11-28, 09:37 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
  •