Display Extents

Display Extents

Anonymous
Not applicable
127 Views
3 Replies
Message 1 of 4

Display Extents

Anonymous
Not applicable
Does anyone know how to return the display extents in VB.

It is possible to see the values required when you use the status command,
the values are given the heading Display Shows. If anyone knows how to
return these values in VB please let me know.

Thanks....

William Hutchins
GIS Technician
CA DESIGN SERVICES LTD
The Design Centre, Hewett Road, Gapton Hall, Great Yarmouth, Norfolk,
NR31 0NN. Registered in England No. 1595687
mailto:WHutchins@cadesign.demon.co.uk
Phone: 01493 440444
Fax: 01493 442480
0 Likes
128 Views
3 Replies
Replies (3)
Message 2 of 4

Anonymous
Not applicable
William,

Here is sample VBA code:

Public Sub test()
'view center in WCS
ctr = ThisDrawing.GetVariable("VIEWCTR")

'convert in to DCS
ctr = ThisDrawing.Utility.TranslateCoordinates(ctr, acWorld, acDisplayDCS,
0)

'height of the viewport in DCS
h = ThisDrawing.GetVariable("VIEWSIZE")
minp = ctr: maxp = ctr

'calculate the width of the viewport in DCS
vph = ThisDrawing.ActiveViewport.Height
vpw = ThisDrawing.ActiveViewport.Width
w = vpw * h / vph

'calculate bounding view boundary in DCS
minp(0) = ctr(0) - w / 2
maxp(0) = ctr(0) + w / 2
minp(1) = ctr(1) - h / 2
maxp(1) = ctr(1) + h / 2

'show that the points are indeed the ones we are looking for
minp = ThisDrawing.Utility.TranslateCoordinates(minp, acDisplayDCS, acWorld,
0)
maxp = ThisDrawing.Utility.TranslateCoordinates(maxp, acDisplayDCS, acWorld,
0)
ThisDrawing.ModelSpace.AddLine minp, maxp
End Sub

Hope this helps.

Cheers,
Thilak

William Hutchins wrote in message
news:ef074c1.-1@WebX.SaUCah8kaAW...
> Does anyone know how to return the display extents in VB.
>
> It is possible to see the values required when you use the status command,
> the values are given the heading Display Shows. If anyone knows how to
> return these values in VB please let me know.
>
> Thanks....
>
> William Hutchins
> GIS Technician
> CA DESIGN SERVICES LTD
> The Design Centre, Hewett Road, Gapton Hall, Great Yarmouth, Norfolk,
> NR31 0NN. Registered in England No. 1595687
> mailto:WHutchins@cadesign.demon.co.uk
> Phone: 01493 440444
> Fax: 01493 442480
>
0 Likes
Message 3 of 4

Anonymous
Not applicable
ZoomExtents

William Hutchins je v sporoèilu novic
ef074c1.-1@WebX.SaUCah8kaAW napisal ...
> Does anyone know how to return the display extents in VB.
>
> It is possible to see the values required when you use the status command,
> the values are given the heading Display Shows. If anyone knows how to
> return these values in VB please let me know.
>
> Thanks....
>
> William Hutchins
> GIS Technician
> CA DESIGN SERVICES LTD
> The Design Centre, Hewett Road, Gapton Hall, Great Yarmouth, Norfolk,
> NR31 0NN. Registered in England No. 1595687
> mailto:WHutchins@cadesign.demon.co.uk
> Phone: 01493 440444
> Fax: 01493 442480
>
0 Likes
Message 4 of 4

Anonymous
Not applicable
Thilak:
btw: I enjoyed reading your MSG... because you do give out a good tips.
amy

Thilak wrote in message ...
>William,
>
>Here is sample VBA code:
>
>Public Sub test()
>'view center in WCS
>ctr = ThisDrawing.GetVariable("VIEWCTR")
>
>'convert in to DCS
>ctr = ThisDrawing.Utility.TranslateCoordinates(ctr, acWorld, acDisplayDCS,
>0)
>
>'height of the viewport in DCS
>h = ThisDrawing.GetVariable("VIEWSIZE")
>minp = ctr: maxp = ctr
>
>'calculate the width of the viewport in DCS
>vph = ThisDrawing.ActiveViewport.Height
>vpw = ThisDrawing.ActiveViewport.Width
>w = vpw * h / vph
>
>'calculate bounding view boundary in DCS
>minp(0) = ctr(0) - w / 2
>maxp(0) = ctr(0) + w / 2
>minp(1) = ctr(1) - h / 2
>maxp(1) = ctr(1) + h / 2
>
>'show that the points are indeed the ones we are looking for
>minp = ThisDrawing.Utility.TranslateCoordinates(minp, acDisplayDCS,
acWorld,
>0)
>maxp = ThisDrawing.Utility.TranslateCoordinates(maxp, acDisplayDCS,
acWorld,
>0)
>ThisDrawing.ModelSpace.AddLine minp, maxp
>End Sub
>
>Hope this helps.
>
>Cheers,
>Thilak
>
>William Hutchins wrote in message
>news:ef074c1.-1@WebX.SaUCah8kaAW...
>> Does anyone know how to return the display extents in VB.
>>
>> It is possible to see the values required when you use the status
command,
>> the values are given the heading Display Shows. If anyone knows how to
>> return these values in VB please let me know.
>>
>> Thanks....
>>
>> William Hutchins
>> GIS Technician
>> CA DESIGN SERVICES LTD
>> The Design Centre, Hewett Road, Gapton Hall, Great Yarmouth, Norfolk,
>> NR31 0NN. Registered in England No. 1595687
>> mailto:WHutchins@cadesign.demon.co.uk
>> Phone: 01493 440444
>> Fax: 01493 442480
>>
>
0 Likes