ObjectARX
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

How to get the coordinates of the actual view corners

4 REPLIES 4
Reply
Message 1 of 5
sherpa
573 Views, 4 Replies

How to get the coordinates of the actual view corners

How do I get the coordinates of the actual view corners?
Thanks ...
4 REPLIES 4
Message 2 of 5
Anonymous
in reply to: sherpa

View or viewport?

 

Aragao


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
How
do I get the coordinates of the actual view corners?
Thanks
...
Message 3 of 5
sherpa
in reply to: sherpa

View or viewport?
... viewport I think ... what I need are the corners of the actual drawing surface in the model space ...
thanks
Message 4 of 5
Anonymous
in reply to: sherpa

Here:

 


void


color=#880000>sgGetCorner

size=2>()


{


//Get the VIEWCENTER(Centro da View)
in current UCS


//and transform the point to DCS
(Display Coordinate System


struct
resbuf
color=#808080>rbViewCtr

size=2>;


ads_point
ptCenter

size=2>;


if
color=#000000>((
acedGetVar
color=#000000>(
"VIEWCTR",
&
rbViewCtr)) !=
RTNORM)
color=#0000ff>return
;


ptCenter
color=#000000>[
X] =
rbViewCtr.
color=#808080>resval
.
color=#808080>rpoint
[
color=#a000a0>X
];


ptCenter
color=#000000>[
Y] =
rbViewCtr.
color=#808080>resval
.
color=#808080>rpoint
[
color=#a000a0>Y
];


ptCenter
color=#000000>[
Z] =
rbViewCtr.
color=#808080>resval
.
color=#808080>rpoint
[
color=#a000a0>Z
];


struct
resbuf
color=#808080>rbUCS
,
color=#808080>rbDCS
,
color=#808080>rbWCS
;


ads_point
ptCenterDCS

size=2>;


rbUCS
color=#000000>.
restype =
RTSHORT

size=2>;


rbUCS
color=#000000>.
resval
color=#000000>.
rint

color=#000000> = 1;


rbDCS
color=#000000>.
restype =
RTSHORT

size=2>;


rbDCS
color=#000000>.
resval
color=#000000>.
rint

color=#000000> = 2;


rbWCS
color=#000000>.
restype =
RTSHORT

size=2>;


rbWCS
color=#000000>.
resval
color=#000000>.
rint

color=#000000> = 0;


if
color=#000000>((
acedTrans
color=#000000>(
ptCenter,
&
rbUCS,
&
rbDCS, 0,
ptCenterDCS)) !=
RTNORM)
color=#0000ff>return
;


//Get the VIEWSIZE (in drawing
units),


//which is the height of the
view.


struct
resbuf
color=#808080>rbViewSize

size=2>;


double
dblHeight

size=2>;


if
color=#000000>((
acedGetVar
color=#000000>(
"VIEWSIZE",
&
rbViewSize)) !=
RTNORM)
color=#0000ff>return
;


dblHeight
=
rbViewSize.
color=#808080>resval
.
color=#808080>rreal
;


//Get the screen aspect ratio using
SCREENSIZE system variable.


//Using the value returned by
SCREENSIZE, get the screen width


//and screen height. SCREENSIZE
returns a list of two reals,


//first one is the screen width and
second one is screen height.


struct
resbuf
color=#808080>rbScreenSize

size=2>;


double
dblWidth

size=2>;


if
color=#000000>((
acedGetVar
color=#000000>(
"SCREENSIZE"
color=#000000>, &
rbScreenSize
color=#000000>)) !=
RTNORM
color=#000000>)
return

color=#000000>;


dblWidth =
dblHeight*(
color=#808080>rbScreenSize
.
color=#808080>resval
.
color=#808080>rpoint
[0]
color=#808080>rbScreenSize
.
color=#808080>resval
.
color=#808080>rpoint

size=2>[1]);


//Calculate the lower left corner in
DCS


ads_point
ptMinDCS

size=2>;


ptMinDCS
color=#000000>[
X] =
ptCenterDCS[
color=#a000a0>X
] - (
color=#808080>dblWidth

2);


ptMinDCS
color=#000000>[
Y] =
ptCenterDCS[
color=#a000a0>Y
] - (
color=#808080>dblHeight

2);


ptMinDCS
color=#000000>[
Z

color=#000000>] = 0;


//Calculate the Upper right corner in
DCS


ads_point
ptMaxDCS

size=2>;


ptMaxDCS
color=#000000>[
X] =
ptCenterDCS[
color=#a000a0>X
] + (
color=#808080>dblWidth

2);


ptMaxDCS
color=#000000>[
Y] =
ptCenterDCS[
color=#a000a0>Y
] + (
color=#808080>dblHeight

2);


//Transform lower left and upper righ
corner


//from DCS to
WCS


ads_point
ptMinWCS,
color=#808080>ptMaxWCS

size=2>;


if
color=#000000>((
acedTrans
color=#000000>(
ptMinDCS,
&
rbDCS,
&
rbWCS, 0,
ptMinWCS)) !=
color=#a000a0>RTNORM
)
color=#0000ff>return
;


if
color=#000000>((
acedTrans
color=#000000>(
ptMaxDCS,
&
rbDCS,
&
rbWCS, 0,
ptMaxWCS)) !=
color=#a000a0>RTNORM
)
color=#0000ff>return
;


//Draw line from lower corner to
upper corner


createLine
color=#000000>(
ptMinWCS,
ptMaxWCS

size=2>);


return
size=2>;


}


CHeers,


Aragao


 

 

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
View
or viewport?
... viewport I think ... what I need are the corners of the
actual drawing surface in the model space ...

thanks
Message 5 of 5
diagodose2009
in reply to: Anonymous

Hi...

Here is my solution... in programming language virtualc+lisp for all CAD's platforms.........

I can convert the routine  "dfn_view_getpnts" to ObjectARx+Cpp but ,i need  your ... private message...

In autolisp,or c++arx my routine  work very nice

best regards..

 

 

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

Post to forums  

”Boost