TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: baitang36 on January 31, 2019, 03:29:45 AM

Title: Realization of WYSIWYG with ZOOM command
Post by: baitang36 on January 31, 2019, 03:29:45 AM
If you want to see what the drawing looks like on the screen, you can use zoom C command.



Enter zoom at the command line and C at the center of the screen, which is the center of the drawing you want to see.



Then it shows you to enter the ratio or height, then measure the height of the screen drawing area with a ruler, that is, how many millimeters the height of the black (or white) window is, just enter Enter. My screen is 269 mm.



In this case, if the ratio is 1 mm = 1 graphic unit, if it is not 1 = 1, but 1 = 100 Tianzheng, the told value here will multiply this ratio, 269 should be input 26900.



Then use the translation command to see the picture, not the wheel. What you see is the actual size of the drawings, and print out the same size.



Try it, is it simple?
Title: Re: Realization of WYSIWYG with ZOOM command
Post by: VovKa on January 31, 2019, 11:05:57 AM
https://www.theswamp.org/index.php?topic=54534.0
Title: Re: Realization of WYSIWYG with ZOOM command
Post by: baitang36 on January 31, 2019, 07:33:07 PM
thank you
Title: Re: Realization of WYSIWYG with ZOOM command
Post by: Augusto on February 04, 2019, 07:05:15 AM
By having minimally understood the grread function, I am looking like a child who has won a new gift.  :lmao:
Here's my try.
It works fine when we have visible ribbons, but after running the CLEANSCREENON function the program has undesired result.
Could someone clarify the reason?
Code: [Select]
(defun c:test ()
  ;what you see is what you get
  (vl-load-com)
  (defun *error* (err)
    (setq cp nil
  magnification
   nil
    ) ;_ >setq
  ) ;_ >defun

  (defun wysiwyg (cp magnification / cp)
    (setq acadObj (vlax-get-acad-object))
    (setq acadDoc (vla-get-activedocument acadObj))
    (vla-zoomcenter acadObj cp magnification)
    (vla-regen acadDoc acActiveViewport)
    (princ)
  ) ;_ >defun

  (defun pjk-Grread-Fkeys (kcode)
    (cond
      ((= kcode 43) ;+ zoom out
       (wysiwyg cp (setq magnification (- magnification 0.5)))
      )
      ((= kcode 45) ;- zoom in
       (wysiwyg cp (setq magnification (+ magnification 0.5)))
      )
    ) ;_ >cond
  ) ;_ >defun

  (setq magnification
(/ (car (getvar 'SCREENSIZE)) ; width of the screen in pixels?
    10
) ;_ >/
  )
  (setq cp
(vlax-3d-point
   (getpoint "\nPick center point for zoom : ")
) ;_ >vlax-3d-point
  ) ;_ >setq
  (wysiwyg cp magnification)
  (prompt "\nPress + or - to adjust the display")
  (while (setq grr (grread t 15 0))
    (if (/= (car grr) 5)
      (pjk-Grread-Fkeys (cadr grr))
    ) ;_ >if
  ) ;_ >while
  (*error*)
)