TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: DEVITG on August 05, 2006, 11:21:15 PM

Title: HOW TO GET THE MIN AND MAX POINT OF THE WINDOW
Post by: DEVITG 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

Title: Re: HOW TO GET THE MIN AND MAX POINT OF THE WINDOW
Post by: MP 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 (http://www.theswamp.org/index.php?topic=3988.0) related thread.
Title: Re: HOW TO GET THE MIN AND MAX POINT OF THE WINDOW
Post by: DEVITG 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



Title: Re: HOW TO GET THE MIN AND MAX POINT OF THE WINDOW
Post by: MP 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.

:)