Zoom Extents for Saving Drawing Preview for Block Catalog

Zoom Extents for Saving Drawing Preview for Block Catalog

Anonymous
Not applicable
356 Views
8 Replies
Message 1 of 9

Zoom Extents for Saving Drawing Preview for Block Catalog

Anonymous
Not applicable
I am trying to create a routine that will

-resize the active drawing window to 300 X 400
(pixels) and then

-perform zoom extents to include and maximize the
contents within the drawing so the it is displayed as large as possible in the
drawing preview

-lastly saving the drawing

 

I will use scriptpro to perform this routine on
multiple drawings.

 

The code I have written so far is as
follows:

 

Sub SDWMain()
'Size Document
Window


   
ThisDrawing.Width = 300
    ThisDrawing.Height =
400
   

   
ZoomExtents
  'The problem occurs here.  For some reason the
zoom extents does not correctly recognize the new window size?

 

End Sub

 

Anyone have any insight why this is not rendering
the desired effects?
0 Likes
357 Views
8 Replies
Replies (8)
Message 2 of 9

Anonymous
Not applicable
I was playing around with window resizing a little while ago, and found a
couple of things....

- the Width and Height did not reset to exactly 300 and 400 in one step.
You may want to print out .Width and .Height after you do your resize. I
think it had something to do with toolbars, etc. If they don't go to what
you want, calculate the difference and size a second time to (.Width +/-
Difference). I know you didn't ask about this, but it's what came to mind.

http://groups.google.com/groups?selm=C1A35DF718C310208FFEB3797AD7D7FE%40in.W
ebX.maYIadrTaRb

Although I see now that this was based on the SCREENSIZE variable for some
reason... this may not affect you at all...

FWIW, Here's another person who seems to be in the same boat as you...

http://groups.google.com/groups?threadm=29F2D73049FB6581B2624049B861E2C0%40i
n.WebX.maYIadrTaRb

James
0 Likes
Message 3 of 9

Anonymous
Not applicable
James,

Thanks for the info. I'll check it out.

"James Belshan" wrote in message
news:73E45064962AA1FE7D5DE27A1A419387@in.WebX.maYIadrTaRb...
> I was playing around with window resizing a little while ago, and found a
> couple of things....
>
> - the Width and Height did not reset to exactly 300 and 400 in one step.
> You may want to print out .Width and .Height after you do your resize. I
> think it had something to do with toolbars, etc. If they don't go to
what
> you want, calculate the difference and size a second time to (.Width +/-
> Difference). I know you didn't ask about this, but it's what came to
mind.
>
>
http://groups.google.com/groups?selm=C1A35DF718C310208FFEB3797AD7D7FE%40in.W
> ebX.maYIadrTaRb
>
> Although I see now that this was based on the SCREENSIZE variable for some
> reason... this may not affect you at all...
>
> FWIW, Here's another person who seems to be in the same boat as you...
>
>
http://groups.google.com/groups?threadm=29F2D73049FB6581B2624049B861E2C0%40i
> n.WebX.maYIadrTaRb
>
> James
>
>
0 Likes
Message 4 of 9

Anonymous
Not applicable
I acheived want I wanted with the
following:

 

Sub SDW()

 

ThisDrawing.Width =
300
ThisDrawing.Height = 400

 

ThisDrawing.SendCommand "zoom extents
"
ThisDrawing.Save

 

End Sub

> I was playing
around with window resizing a little while ago, and found a
> couple of
things....
>
>  - the Width and Height did not reset to
exactly 300 and 400 in one step.
> You may want to print out .Width and
.Height after you do your resize.  I
> think it had something to do
with toolbars, etc.   If they don't go to what
> you want,
calculate the difference and size a second time to (.Width +/-
>
Difference).  I know you didn't ask about this, but it's what came to
mind.
>
>

href="http://groups.google.com/groups?selm=C1A35DF718C310208FFEB3797AD7D7FE%40in.W">
face=Arial
si...


face=Arial size=2>> ebX.maYIadrTaRb
>
> Although I see now that
this was based on the SCREENSIZE variable for some
> reason... this may
not affect you at all...
>
> FWIW, Here's another person who seems
to be in the same boat as you...
>
>

href="http://groups.google.com/groups?threadm=29F2D73049FB6581B2624049B861E2C0%40i">
face=Arial
si...


face=Arial size=2>> n.WebX.maYIadrTaRb
>
> James
>

>
0 Likes
Message 5 of 9

Anonymous
Not applicable
I don't know why the orizinal way did not
work.  It seems this is some type of BUG?


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

I acheived want I wanted with the
following:

 

Sub SDW()

 

ThisDrawing.Width =
300
ThisDrawing.Height = 400

 

ThisDrawing.SendCommand "zoom
extents "
ThisDrawing.Save

 

End
Sub


> I was playing
around with window resizing a little while ago, and found a
> couple of
things....
>
>  - the Width and Height did not reset to
exactly 300 and 400 in one step.
> You may want to print out .Width and
.Height after you do your resize.  I
> think it had something to do
with toolbars, etc.   If they don't go to what
> you want,
calculate the difference and size a second time to (.Width +/-
>
Difference).  I know you didn't ask about this, but it's what came to
mind.
>
>

href="http://groups.google.com/groups?selm=C1A35DF718C310208FFEB3797AD7D7FE%40in.W">
face=Arial...


face=Arial size=2>> ebX.maYIadrTaRb
>
> Although I see now
that this was based on the SCREENSIZE variable for some
> reason... this
may not affect you at all...
>
> FWIW, Here's another person who
seems to be in the same boat as you...
>
>

href="http://groups.google.com/groups?threadm=29F2D73049FB6581B2624049B861E2C0%40i">
face=Arial...


face=Arial size=2>> n.WebX.maYIadrTaRb
>
> James
>

>
0 Likes
Message 6 of 9

Anonymous
Not applicable
Your original code did not save the
drawing.

I assume this is where the preview gets reset(just
a guess)

So to me your first version looks much
different than this version.

Did you try


Sub SDW()

ThisDrawing.Width =
300
ThisDrawing.Height = 400


size=2>ZoomExtents
ThisDrawing.Save

End sub


 

to confirm that it was the send command that changed
the result?

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

I don't know why the orizinal way did not
work.  It seems this is some type of
BUG?
0 Likes
Message 7 of 9

Anonymous
Not applicable
Hi everyone,

 

 

When I tried the first version of
Brian's code, I had the same problem (not zooming extents). But when you
launch this code two times consecutively, you get the researched result...
Strange, no???


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Mark Propst" <nonentityatplanetkcdotcom> a écrit dans le message
de
href="news:016AC78D0DB80203920E1F013719B434@in.WebX.maYIadrTaRb">news:016AC78D0DB80203920E1F01371...
...

Your original code did not save the
drawing.

I assume this is where the preview gets
reset(just a guess)

So to me your first version looks much
different than this version.

Did you try


Sub SDW()

ThisDrawing.Width =
300
ThisDrawing.Height = 400


size=2>ZoomExtents
ThisDrawing.Save

End sub


 

to confirm that it was the send command that changed
the result?

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

I don't know why the orizinal way did not
work.  It seems this is some type of
BUG?
0 Likes
Message 8 of 9

Anonymous
Not applicable
I tried that and it seems the application is not
recognizing that the drawing window size has changed.  I even tried adding
an update method.


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Your original code did not save the
drawing.

I assume this is where the preview gets
reset(just a guess)

So to me your first version looks much
different than this version.

Did you try


Sub SDW()

ThisDrawing.Width =
300
ThisDrawing.Height = 400


size=2>ZoomExtents
ThisDrawing.Save

End sub


 

to confirm that it was the send command that changed
the result?

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

I don't know why the orizinal way did not
work.  It seems this is some type of
BUG?
0 Likes
Message 9 of 9

Anonymous
Not applicable
I've tried this using Vlisp doing a
similar routine (without send comman) and I get the same
results.

 

Plug this in at the command line:

face=Arial size=2>

(vlax-put-property (vla-get-ActiveDocument
(vlax-get-acad-object)) 'Height 400)
(vlax-put-property
(vla-get-ActiveDocument (vlax-get-acad-object)) 'Width 300)
(vla-ZoomExtents
(vlax-get-acad-object))
(vla-Save (vla-get-ActiveDocument
(vlax-get-acad-object)))

 

But if you try this inside Scriptpro ZoomExtents does
not work correctly, even if you double up the ZoomExtents
statement.



 



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
Hi everyone,

 

 

When I tried the first version of
Brian's code, I had the same problem (not zooming extents). But when you
launch this code two times consecutively, you get the researched result...
Strange, no???


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
"Mark Propst" <nonentityatplanetkcdotcom> a écrit dans le message
de
href="news:016AC78D0DB80203920E1F013719B434@in.WebX.maYIadrTaRb">news:016AC78D0DB80203920E1F013...
...

Your original code did not save the
drawing.

I assume this is where the preview gets
reset(just a guess)

So to me your first version looks much
different than this version.

Did you try


Sub SDW()

ThisDrawing.Width =
300
ThisDrawing.Height = 400


size=2>ZoomExtents
ThisDrawing.Save

End sub


 

to confirm that it was the send command that
changed the result?

 


style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

I don't know why the orizinal way did not
work.  It seems this is some type of
BUG?
0 Likes