Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Recrangle coordinates?

9 REPLIES 9
Reply
Message 1 of 10
Anonymous
132 Views, 9 Replies

Recrangle coordinates?

R14 Autolisp:
Need to know the best way to get the window coordinates for the rectangle used to make a crossing selection set in Autolisp. Anyone know? I would like to make the selection set and have to window show while selection, then I need to know what the corner xy's are to process what entities need to be broke. I'm trying to make a copy command to get just what's inside the window. Is there a program that already does this?
Thanks.
BillZ
9 REPLIES 9
Message 2 of 10
Anonymous
in reply to: Anonymous

Hi Bill

This function returns the screen coordinates:

(defun GetScreenCoords ( / ViwCen ViwDim ViwSiz VptMin VptMax)
(setq ViwSiz (/ (getvar "VIEWSIZE") 2.0)
ViwCen (getvar "VIEWCTR")
ViwDim (list
(* ViwSiz (apply '/ (getvar "SCREENSIZE")))
ViwSiz
)
VptMin (mapcar '- ViwCen ViwDim)
VptMax (mapcar '+ ViwCen ViwDim)
)
(list VptMin VptMax)
)

Cheers
--
Juerg Menzi
MENZI ENGINEERING GmbH, Switzerland
http://www.menziengineering.ch


BillZ schrieb:
>
> R14 Autolisp:
> Need to know the best way to get the window coordinates for the rectangle used
> to make a crossing selection set in Autolisp. Anyone know? I would like to
> make the selection set and have to window show while selection, then I need to
> know what the corner xy's are to process what entities need to be broke. I'm
> trying to make a copy command to get just what's inside the window. Is there a
> program that already does this?
> Thanks.
> BillZ
Message 3 of 10
Anonymous
in reply to: Anonymous

Bill,

Why not get the points of the crossing and then feed them to the selection?

(initget 1)
(setq p1 (getpoint "\n1st corner: ))
(initget 1)
(setq p2 (getcorner p1 "\n2nd corner: ))
(setq ll (list (min (car p1) (car p2))
(min (cadr p1) (cadr p2)))
ur (list (max (car p1) (car p2))
(max (cadr p1) (cadr p2))))

Now you can use ll & ur for all kinds of commands... ZOOM COPY ...

-David
)


"BillZ" wrote in message
news:f089b00.-1@WebX.maYIadrTaRb...
> R14 Autolisp:
> Need to know the best way to get the window coordinates for the rectangle
used to make a crossing selection set in Autolisp. Anyone know? I would like
to make the selection set and have to window show while selection, then I
need to know what the corner xy's are to process what entities need to be
broke. I'm trying to make a copy command to get just what's inside the
window. Is there a program that already does this?
> Thanks.
> BillZ
>
Message 4 of 10
Anonymous
in reply to: Anonymous

I'd forgotten all about "getcorner". Here I thought I knew everthing. Must be my age.
ThanksBillZ
Message 5 of 10
Anonymous
in reply to: Anonymous

Any way to get the window of getcorner to "highlight", like dashed lines?
BillZ
Message 6 of 10
Anonymous
in reply to: Anonymous

Bill,

 

Good question.  Look up the ssnamex
function.  Its pretty neat.

 

Doug


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
R14
Autolisp:
Need to know the best way to get the window coordinates for the
rectangle used to make a crossing selection set in Autolisp. Anyone know? I
would like to make the selection set and have to window show while selection,
then I need to know what the corner xy's are to process what entities need to
be broke. I'm trying to make a copy command to get just what's inside the
window. Is there a program that already does this?
Thanks.

BillZ
Message 7 of 10
Anonymous
in reply to: Anonymous

Here's a bunch of temporary shapes:

;;;TEMPORARY VECTOR SHAPES

;;;GRDRAW X -> pt color flag
(defun grx (p c f / size)
(setq size (/ (getvar "VIEWSIZE") 33))
(grdraw (polar p (* pi 1.25) size)
(polar p (* pi 0.25) size) c f)
(grdraw (polar p (* pi 1.75) size)
(polar p (* pi 0.75) size) c f))

;;;GRDRAW PLUS -> pt color flag
(defun grp (p c f / size)
(setq size (/ (getvar "VIEWSIZE") 46.6))
(grdraw (polar p (* pi 1.00) size)
(polar p (* pi 0.00) size) c f)
(grdraw (polar p (* pi 1.50) size)
(polar p (* pi 0.50) size) c f))

;;;GRDRAW BOX -> pt color
(defun grb (p c / size)
(setq size (/ (getvar "VIEWSIZE") (getvar "PICKBOX") 16))
(grdraw (polar p (* pi 0.25) size)
(polar p (* pi 0.75) size) c)
(grdraw (polar p (* pi 0.75) size)
(polar p (* pi 1.25) size) c)
(grdraw (polar p (* pi 1.25) size)
(polar p (* pi 1.75) size) c)
(grdraw (polar p (* pi 1.75) size)
(polar p (* pi 0.25) size) c))

;;;GRDRAW BOX WITH X -> pt color
(defun grbx (p c / size)
(setq size (/ (getvar "VIEWSIZE") (getvar "PICKBOX") 16))
(grdraw (polar p (* pi 0.25) size)
(polar p (* pi 0.75) size) c)
(grdraw (polar p (* pi 0.75) size)
(polar p (* pi 1.25) size) c)
(grdraw (polar p (* pi 1.25) size)
(polar p (* pi 1.75) size) c)
(grdraw (polar p (* pi 1.75) size)
(polar p (* pi 0.25) size) c)
(grdraw (polar p (* pi 1.25) size)
(polar p (* pi 0.25) size) c)
(grdraw (polar p (* pi 1.75) size)
(polar p (* pi 0.75) size) c))

;;;GRDRAW RECTANGLE -> pt color flag
(defun grr (ll ur c f / ul lr)
(setq ul (list (car ll) (cadr ur))
lr (list (car ur) (cadr ll)))
(grdraw ll lr c f)
(grdraw lr ur c f)
(grdraw ur ul c f)
(grdraw ul ll c f))

;;;GRDRAW RECTANGLE WITH X -> pt color flag
(defun grrx (ll ur c f / ul lr)
(setq ul (list (car ll) (cadr ur))
lr (list (car ur) (cadr ll)))
(grdraw ll lr c f)
(grdraw lr ur c f)
(grdraw ur ul c f)
(grdraw ul ll c f)
(grdraw ll ur c f)
(grdraw ul lr c f))


(grr ll ur clr flag); should work


Rubberbanding during selection should be automatic I think

(initget 32) -David

"BillZ" wrote in message
news:f089b00.3@WebX.maYIadrTaRb...
> Any way to get the window of getcorner to "highlight", like dashed lines?
> BillZ
>
Message 8 of 10
Anonymous
in reply to: Anonymous

(initget 32)


style="BORDER-LEFT: #000000 2px solid; MARGIN-LEFT: 5px; MARGIN-RIGHT: 0px; PADDING-LEFT: 5px; PADDING-RIGHT: 0px">
Any
way to get the window of getcorner to "highlight", like dashed lines?

BillZ
Message 9 of 10
Anonymous
in reply to: Anonymous

Damn, as soon as global varibles come into the whole thing I get lost.
I cannot see anywhere in your below code where "p c or f" are defined and
hence I cannot follow how everything works.
Why is it that I always get stuck on this point.
peter

David Bethel wrote in message
news:EE8B6540022C95959AE6C3626E81C8F3@in.WebX.maYIadrTaRb...
> Here's a bunch of temporary shapes:
>
> ;;;TEMPORARY VECTOR SHAPES
>
> ;;;GRDRAW X -> pt color flag
> (defun grx (p c f / size)
> (setq size (/ (getvar "VIEWSIZE") 33))
> (grdraw (polar p (* pi 1.25) size)
> (polar p (* pi 0.25) size) c f)
> (grdraw (polar p (* pi 1.75) size)
> (polar p (* pi 0.75) size) c f))
>
> ;;;GRDRAW PLUS -> pt color flag
> (defun grp (p c f / size)
> (setq size (/ (getvar "VIEWSIZE") 46.6))
> (grdraw (polar p (* pi 1.00) size)
> (polar p (* pi 0.00) size) c f)
> (grdraw (polar p (* pi 1.50) size)
> (polar p (* pi 0.50) size) c f))
>
> ;;;GRDRAW BOX -> pt color
> (defun grb (p c / size)
> (setq size (/ (getvar "VIEWSIZE") (getvar "PICKBOX") 16))
> (grdraw (polar p (* pi 0.25) size)
> (polar p (* pi 0.75) size) c)
> (grdraw (polar p (* pi 0.75) size)
> (polar p (* pi 1.25) size) c)
> (grdraw (polar p (* pi 1.25) size)
> (polar p (* pi 1.75) size) c)
> (grdraw (polar p (* pi 1.75) size)
> (polar p (* pi 0.25) size) c))
>
> ;;;GRDRAW BOX WITH X -> pt color
> (defun grbx (p c / size)
> (setq size (/ (getvar "VIEWSIZE") (getvar "PICKBOX") 16))
> (grdraw (polar p (* pi 0.25) size)
> (polar p (* pi 0.75) size) c)
> (grdraw (polar p (* pi 0.75) size)
> (polar p (* pi 1.25) size) c)
> (grdraw (polar p (* pi 1.25) size)
> (polar p (* pi 1.75) size) c)
> (grdraw (polar p (* pi 1.75) size)
> (polar p (* pi 0.25) size) c)
> (grdraw (polar p (* pi 1.25) size)
> (polar p (* pi 0.25) size) c)
> (grdraw (polar p (* pi 1.75) size)
> (polar p (* pi 0.75) size) c))
>
> ;;;GRDRAW RECTANGLE -> pt color flag
> (defun grr (ll ur c f / ul lr)
> (setq ul (list (car ll) (cadr ur))
> lr (list (car ur) (cadr ll)))
> (grdraw ll lr c f)
> (grdraw lr ur c f)
> (grdraw ur ul c f)
> (grdraw ul ll c f))
>
> ;;;GRDRAW RECTANGLE WITH X -> pt color flag
> (defun grrx (ll ur c f / ul lr)
> (setq ul (list (car ll) (cadr ur))
> lr (list (car ur) (cadr ll)))
> (grdraw ll lr c f)
> (grdraw lr ur c f)
> (grdraw ur ul c f)
> (grdraw ul ll c f)
> (grdraw ll ur c f)
> (grdraw ul lr c f))
>
>
> (grr ll ur clr flag); should work
>
>
> Rubberbanding during selection should be automatic I think
>
> (initget 32) -David
>
> "BillZ" wrote in message
> news:f089b00.3@WebX.maYIadrTaRb...
> > Any way to get the window of getcorner to "highlight", like dashed
lines?
> > BillZ
> >
>
>
Message 10 of 10
Anonymous
in reply to: Anonymous

Peter,

p c & f are not global variables, they are the arguments supplied to the
routine.

p = pt : 'LST
c = color : 'INT
f = flag : per (grdraw) conventions

(grx '(3 3) 6 1)

would draw an X at 3,3 in magenta with default highlight


-David


"pi" wrote in message
news:0B47A3CEDA2A285B376EA3A07E088BC6@in.WebX.maYIadrTaRb...
> Damn, as soon as global varibles come into the whole thing I get lost.
> I cannot see anywhere in your below code where "p c or f" are defined and
> hence I cannot follow how everything works.
> Why is it that I always get stuck on this point.
> peter
>
> David Bethel wrote in message
> news:EE8B6540022C95959AE6C3626E81C8F3@in.WebX.maYIadrTaRb...
> > Here's a bunch of temporary shapes:
> >
> > ;;;TEMPORARY VECTOR SHAPES
> >
> > ;;;GRDRAW X -> pt color flag
> > (defun grx (p c f / size)
> > (setq size (/ (getvar "VIEWSIZE") 33))
> > (grdraw (polar p (* pi 1.25) size)
> > (polar p (* pi 0.25) size) c f)
> > (grdraw (polar p (* pi 1.75) size)
> > (polar p (* pi 0.75) size) c f))
> >
> > ;;;GRDRAW PLUS -> pt color flag
> > (defun grp (p c f / size)
> > (setq size (/ (getvar "VIEWSIZE") 46.6))
> > (grdraw (polar p (* pi 1.00) size)
> > (polar p (* pi 0.00) size) c f)
> > (grdraw (polar p (* pi 1.50) size)
> > (polar p (* pi 0.50) size) c f))
> >
> > ;;;GRDRAW BOX -> pt color
> > (defun grb (p c / size)
> > (setq size (/ (getvar "VIEWSIZE") (getvar "PICKBOX") 16))
> > (grdraw (polar p (* pi 0.25) size)
> > (polar p (* pi 0.75) size) c)
> > (grdraw (polar p (* pi 0.75) size)
> > (polar p (* pi 1.25) size) c)
> > (grdraw (polar p (* pi 1.25) size)
> > (polar p (* pi 1.75) size) c)
> > (grdraw (polar p (* pi 1.75) size)
> > (polar p (* pi 0.25) size) c))
> >
> > ;;;GRDRAW BOX WITH X -> pt color
> > (defun grbx (p c / size)
> > (setq size (/ (getvar "VIEWSIZE") (getvar "PICKBOX") 16))
> > (grdraw (polar p (* pi 0.25) size)
> > (polar p (* pi 0.75) size) c)
> > (grdraw (polar p (* pi 0.75) size)
> > (polar p (* pi 1.25) size) c)
> > (grdraw (polar p (* pi 1.25) size)
> > (polar p (* pi 1.75) size) c)
> > (grdraw (polar p (* pi 1.75) size)
> > (polar p (* pi 0.25) size) c)
> > (grdraw (polar p (* pi 1.25) size)
> > (polar p (* pi 0.25) size) c)
> > (grdraw (polar p (* pi 1.75) size)
> > (polar p (* pi 0.75) size) c))
> >
> > ;;;GRDRAW RECTANGLE -> pt color flag
> > (defun grr (ll ur c f / ul lr)
> > (setq ul (list (car ll) (cadr ur))
> > lr (list (car ur) (cadr ll)))
> > (grdraw ll lr c f)
> > (grdraw lr ur c f)
> > (grdraw ur ul c f)
> > (grdraw ul ll c f))
> >
> > ;;;GRDRAW RECTANGLE WITH X -> pt color flag
> > (defun grrx (ll ur c f / ul lr)
> > (setq ul (list (car ll) (cadr ur))
> > lr (list (car ur) (cadr ll)))
> > (grdraw ll lr c f)
> > (grdraw lr ur c f)
> > (grdraw ur ul c f)
> > (grdraw ul ll c f)
> > (grdraw ll ur c f)
> > (grdraw ul lr c f))
> >
> >
> > (grr ll ur clr flag); should work
> >
> >
> > Rubberbanding during selection should be automatic I think
> >
> > (initget 32) -David
> >
> > "BillZ" wrote in message
> > news:f089b00.3@WebX.maYIadrTaRb...
> > > Any way to get the window of getcorner to "highlight", like dashed
> lines?
> > > BillZ
> > >
> >
> >
>
>

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost