Jump to content

Worksheet position


Recommended Posts

Is there anyway to find out what the size and location of a worksheet on a drawing and then re-set the location?

When I re-calc my "Materials list" it changes size and I have to manually move it so that the bottom right corner is in the old location. As it is now the top left stays put and everything else changes to suit... I haven't found a vectorscript function that will get or set the "image location".Thanks, Heather rolleyes.gif" border="0

Link to comment

Heather, Name your worksheet,it's size and distance from the drawing area inthe CONST section and your good to go.Dave grin.gif" border="0 -------------------------------------------PROCEDURE WS;CONST WksName = 'My_WS_Name'; {Your worksheet name} Top =1; {Worksheet Top} Left=1; {Worksheet Left} Bottom=2; {Worksheet Bottom} Right=2; {Worksheet Right} WSPositionX=1"; { X Distance from drawing area } WSPositionY=1"; { Y Distance from drawing area }VAR WksH,WSImage : HANDLE; ws1X, ws1Y, ws2X, ws2Y ,d1X, d1Y, d2X, d2Y :REAL;

BEGIN WksH := Getobject ( WksName ); ShowWS(WksH,True); SetWSPlacement(WksH,Top,Left,Bottom,Right); RecalculateWS(WksH); ShowWS(WksH,False); WSImage:=GetWSImage(WksH); GetBBox(WSImage,ws1X, ws1Y, ws2X, ws2Y ); GetDrawingSizeRect(d1X, d1Y, d2X, d2Y ); HMove(WSImage,(d2X - ws2X) - WSPositionX, ( d2Y - ws2Y ) + WSPositionY ); END;RUN ( WS );

[ 02-13-2002: Message edited by: Fuge ]

Link to comment

Thanks Fuge,

Works Great grin.gif" border="0 Since my drawings have several layer with several scales, I added a little bit to it. (You'll recongnize some of my additions to) When I get a spare minute (ya right) I want to make it so the worksheet is positioned relative to my drawing boarder rather that the page... We also print our drawings on severl printer on different size papers.

Again, thanks a million.


PROCEDURE WSrecalc;LABEL99;CONSTWksName = 'materials'; {The Worksheets name}Top =1; {Worksheet Top}Left=1; {Worksheet Left}Bottom=3; {Worksheet Bottom}Right=3; {Worksheet Right}WSPositionX=3.25"; { X Distance from drawing area }WSPositionY=.875"; { Y Distance from drawing area }

VARWksH,ObHd,WKspls2,WKspls1,WSImage,currentHd : HANDLE;ws1X, ws1Y, ws2X, ws2Y ,d1X, d1Y, d2X, d2Y :REAL;


WksH := Getobject ( WksName );{Checks if the worksheet exists by name}IF WksH = NIL THENBEGINSysbeep;AlrtDialog ( 'The worksheet "Materials" does not exist in this document!' );GOTO 99;END;

currentHd:=ActLayer;Layer('Border');WksH := Getobject ( WksName );ShowWS(WksH,True);SetWSPlacement(WksH,Top,Left,Bottom,Right);RecalculateWS(WksH);ShowWS(WksH,False);WSImage:=GetWSImage(WksH);GetBBox(WSImage,ws1X, ws1Y, ws2X, ws2Y );GetDrawingSizeRect(d1X, d1Y, d2X, d2Y );HMove(WSImage,(d2X - ws2X) - WSPositionX, ( d2Y - ws2Y ) + WSPositionY );Layer(GetLName(currentHd));

AlrtDialog ('The Materials list has be updated');

99 : END;RUN ( WSrecalc );

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...