Author Topic: HOW TO GET THE MIN AND MAX POINT OF THE WINDOW  (Read 1998 times)

0 Members and 1 Guest are viewing this topic.

DEVITG

  • Bull Frog
  • Posts: 481
HOW TO GET THE MIN AND MAX POINT OF THE WINDOW
« on: August 05, 2006, 11:21:15 PM »
When I do a zoom extend and a zom 0.9 to this dwg , I got the image attached

But the max and min poitn of it are fare away from it.
How I can get the min and max point of the viewed image.
Find attached the dwg too
I insert this dwg on a new empty dwg , as a block , and need to now
the max and min point of the image .
Thanks in advance

« Last Edit: August 05, 2006, 11:23:41 PM by DEVITG »
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: HOW TO GET THE MIN AND MAX POINT OF THE WINDOW
« Reply #1 on: August 06, 2006, 12:15:52 AM »
Do you mean the viewwport coordinates? If so perhaps this will suffice --

Code: [Select]
(defun VPCords ( )
    (   (lambda (offset)
            (   (lambda (viewctr)
                    (list
                        (mapcar '- viewctr offset)
                        (mapcar '+ viewctr offset)
                    )
                )
                (getvar "viewctr")
            )
        )
        (   (lambda (halfHeight aspectRatio)
                (list
                    (* halfHeight aspectRatio)
                    halfHeight
                )
            )
            (* 0.5 (getvar "viewsize"))
            (apply '/ (getvar "screensize"))
        )
    )
)

In your drawing it returns these coordinates (may vary from the coordinates returned on your machine as my PC's resolution etc. is likely different from yours) --

(
    (282368.83894 2051273.52473)
    (283899.31719 2052085.27839)
)


Edit: See this related thread.
« Last Edit: August 06, 2006, 12:21:01 AM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

DEVITG

  • Bull Frog
  • Posts: 481
Re: HOW TO GET THE MIN AND MAX POINT OF THE WINDOW
« Reply #2 on: August 06, 2006, 08:07:01 AM »
Hi MP.

That's what I need , but I have also to say that I sin as most of us do.
Asking how and not what we want to do.
My final task is to insert a block in the center  point of the screen
so
(GETVAR "VIEWCTR")
FULLFILL my need.
Thanks again



Location @ Córdoba Argentina Using ACAD 2019  at Window 10

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: HOW TO GET THE MIN AND MAX POINT OF THE WINDOW
« Reply #3 on: August 06, 2006, 08:21:43 AM »
Well since I am not with out my sin I can't pitch any rocks at ya, so glad you found what you need.

:)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst