ObjectARX

Reply
Contributor
sherpa
Posts: 15
Registered: ‎04-01-2003
Message 1 of 5 (203 Views)

How to get the coordinates of the actual view corners

203 Views, 4 Replies
12-09-2002 11:35 PM
How do I get the coordinates of the actual view corners?
Thanks ...
*Aragao, Paulo
Message 2 of 5 (203 Views)

Re: How to get the coordinates of the actual view corners

12-10-2002 06:48 PM 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
...
Contributor
sherpa
Posts: 15
Registered: ‎04-01-2003
Message 3 of 5 (203 Views)

Re:

12-10-2002 09:42 PM 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
*Aragao, Paulo
Message 4 of 5 (203 Views)

Re:

12-12-2002 08:35 PM 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
Mentor
diagodose2009
Posts: 259
Registered: ‎12-04-2009
Message 5 of 5 (133 Views)

Re: Re:

12-15-2012 09:33 PM in reply to: *Aragao, Paulo

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..

 

 

You are not logged in.

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.

Need installation help?

Start with some of our most frequented solutions to get help installing your software.

Ask the Community