Jump to content
Sign in to follow this  
Joe-SA

Adding Auto Sheet Number to old PIO script

Recommended Posts

We are in the process of upgrading from VW12.5 to VW2011. I wrote a suite of Drawing Marker PIO's over 10 years ago that I have been using ever since. They have held up surprisingly well over the different upgrades. However, with this latest upgrade they could use some small tweaks. I'm 10 years rusty on my Vectorscript and was never an expert at it in the first place but managed to cobble together from various sources enough information to put together some very useful tools that allows my firm to set some standards that are difficult if not impossible for employees to screw up. In that regard I'd like to maintain them in VW2011.

The main feature I'm interested in adding is the call to Active Sheet Number in my Drawing Title PIO. I searched through the Function Reference in hopes I could find what I needed to add a few lines of code but instead found I'm too far removed from VS to get where I would like to go.

NNA tech support suggested I post this question here as my best source of information.

Below is the script to my Drawing Title PIO. I can configure the VW Drawing Label PIO to look very close to this and could simply save this out as a symbol but I'm interested in removing all the customization controls that PIO has built into it so the rest of my office can more easily stick to the office standards.

Any assistance you can provide will be much appreciated. Thank You.

Joseph Hoffner

Sears Architects

Grand Rapids, MI 49503

PROCEDURE ReferenceMarker;

{

1999 - Joseph Hoffner

First Created: 01/14/99

Last Modified: 1/7/02

}

LABEL 99;

CONST

{**Starting distances from origin for full size mark**}

kDistanceA=0.25;

kDistanceB=0.175;

kDistanceC=3.5;

kDistanceD=0.4;

kDistanceE=0.0125;

kDistanceF=0.03;

kDistanceG=0.185;

kDistanceH=0.32;

kDistanceI=0.455;

{**Assigning textsize values to a variable**}

kTextSize18=18;

kTextSize10=10;

kTextSize9=9;

{** Scales to appear as text in the mark}

kS1200='Scale: 1" = 100 ft';

kS600='Scale: 1" = 50 ft';

kS500='Scale: 1:500';

kS480='Scale: 1" = 40 ft';

kS360='Scale: 1" = 30 ft';

kS240='Scale: 1" = 20 ft';

kS200='Scale: 1:200';

kS192='Scale: 1/16" = 1''-0"';

kS120='Scale: 1" = 10 ft';

kS100='Scale: 1:100';

kS96='Scale: 1/8" = 1''-0"';

kS64='Scale: 3/16" = 1''-0"';

kS50='Scale: 1:50';

kS48='Scale: 1/4" = 1''-0"';

kS32='Scale: 3/8" = 1''-0"';

kS25='Scale: 1:25';

kS24='Scale: 1/2" = 1''-0"';

kS20='Scale: 1:20';

kS16='Scale: 3/4" = 1''-0"';

kS12='Scale: 1" = 1''-0"';

kS10='Scale: 1:10';

kS8='Scale: 1 1/2"= 1''-0"';

kS5='Scale: 1:5';

kS4='Scale: 3" = 1''-0"';

kS2='Half Actual Size';

kS1='Actual Size';

kS0='Not to Scale';

VAR

A1, B1, C1, D1, E1, F1, G1, H1, I1, J1, x, y, Length, TheLayerScale, UPI : REAL;

getUPI : REAL;

TheScl, Fmt : INTEGER;

LayerHandle, hPIO, hRECORD, hWALL, Rtext, AutoLength : HANDLE;

UM, UM2, Title, Scale, MScale, CScale, ScaleSetting, Detail, Page, FontToggle, R1, R2, R3, R4, hNAME: STRING;

useGraphics , Abort, Done, ALength, status : BOOLEAN;

UName, DA : LONGINT;

{*********************************************************}

FUNCTION getTextScaleFactor (hPIO : HANDLE) : REAL;

{*/// This procedure determines the factor to use to adjust

text size if the plug-in is regenerated and the active layer

has a different scale than the layer on which the plug-in is

located ///*}

BEGIN

IF (IsNewCustomObject (GetName (hPIO))) OR (GetLayer (hPIO) = NIL) THEN

getTextScaleFactor := 1

ELSE

getTextScaleFactor := GetLScale (GetLayer (hPIO)) / GetLScale (ActLayer);

END; {of getTextScaleFactor}

FUNCTION getLayerScaleFactor (hPIO : HANDLE) : REAL;

{*/// This procedure asks if the PIO is existing or not. If new, the scale of the active layer is referenced. If existing, the scale of the layer the PIO is on is referenced///*}

BEGIN

IF (IsNewCustomObject (GetName (hPIO))) OR (GetLayer (hPIO) = NIL) THEN

getLayerScaleFactor :=GetLScale(actlayer)

ELSE

getLayerScaleFactor := GetLScale(GetLayer(hPIO));

END; {of getLayerScaleFactor}

{*********************************************************}

{**Main Script**}

BEGIN

{**Assigns handles to the PIO**}

IF GetCustomObjectInfo(hNAME, hPIO, hRECORD, hWALL) THEN BEGIN

{**Parameters**}

Title:=PDETAIL_TITLE;

Detail:=PDETAIL_NUMBER;

Page:=PSHEET_NUMBER;

Length:=PLINE_LENGTH;

ScaleSetting:=PDISPLAY_SCALE;

MScale:=PManual_Scale;

CScale:=PCustom_Scale;

ALength:=PAUTO_LENGTH;

FontToggle:=PFONTTOGGLE;

{**Find Scale and define Scale Text**}

TheLayerScale :=getLayerScaleFactor(hPIO);

TheScl :=TheLayerScale;

CASE TheScl OF

1200 : Scale:=kS1200;

600 : Scale:=kS600;

500 : Scale:=kS500;

480 : Scale:=kS480;

360 : Scale:=kS360;

240 : Scale:=kS240;

200 : Scale:=kS200;

192 : Scale:=kS192;

120 : Scale:=kS120;

100 : Scale:=kS100;

96 : Scale:=kS96;

64 : Scale:=kS64;

50 : Scale:=kS50;

48 : Scale:=kS48;

32 : Scale:=kS32;

25 : Scale:=kS25;

24 : Scale:=kS24;

20 : Scale:=kS20;

16 : Scale:=kS16;

12 : Scale:=kS12;

10 : Scale:=kS10;

8 : Scale:=kS8;

5 : Scale:=kS5;

4 : Scale:=kS4;

2 : Scale:=kS2;

1 : Scale:=kS1;

OTHERWISE Scale:=ks0;

END;

{**Re-size distances to appropriate scale**}

GetUnits ( UName, DA, Fmt, UPI, UM, UM2 ) ;

A1 := kDistanceA * UPI * TheLayerScale;

B1 := kDistanceB * UPI * TheLayerScale;

C1 := kDistanceC * UPI * TheLayerScale;

D1 := kDistanceD * UPI * TheLayerScale;

E1 := kDistanceE * UPI * TheLayerScale;

F1 := kDistanceF * UPI * TheLayerScale;

G1 := kDistanceG * UPI * TheLayerScale;

H1 := kDistanceH * UPI * TheLayerScale;

I1 := kDistanceI * UPI * TheLayerScale;

J1 := Length * UPI * TheLayerScale;

DSelectAll;

{**Create mark objects and Title Text**}

PushAttrs;

FillFore(65535,65535,65535);

FillPat(1);

PenSize(20);

Marker(0,0,0);

Oval(x-A1,y-A1,x+A1,y+A1);

PenSize(14);

MoveTo(x-A1,y);

LineTo(x+A1,y);

{Add these lines to divide the lower half into quarters}

{MoveTo(x,y);

LineTo(x,y-A1);}

FillPat(0);

TextFont(GetFontID('Palatino'));

TextSize(kTextSize18 * getTextScaleFactor(hPIO));

TextJust(1);

TextVerticalAlign(5);

TextOrigin(X+D1,Y);

IF (FontToggle = 'Archie') THEN BEGIN

TextFont(GetFontID('Archie'));

END;

IF (FontToggle = 'Papyrus') THEN BEGIN

TextFont(GetFontID('Papyrus'));

END;

TextFace([bold]);

IF Title <> '' THEN BEGIN

BeginText;

Title

EndText;

Rtext:=LNewObj;

END;

{**Display Scale **}

IF ScaleSetting = 'Auto Scale' THEN BEGIN

TextSize(kTextSize9 * getTextScaleFactor(hPIO));

TextJust(1);

TextVerticalAlign(1);

TextOrigin(X+D1,Y-F1);

TextFace([]);

BeginText;

Scale

EndText;

END;

IF (ScaleSetting = 'Manual Scale') THEN BEGIN

TextSize(kTextSize9 * getTextScaleFactor(hPIO));

TextJust(1);

TextVerticalAlign(1);

TextOrigin(X+D1,Y-F1);

TextFace([]);

IF (MScale = 'Custom') THEN BEGIN

BeginText;

CSCALE

EndText;

END ELSE

BeginText;

MSCALE

EndText;

END;

{**Auto Length Toggle**}

IF ALength THEN BEGIN

IF Title <> '' THEN BEGIN

Length:=GetTextWidth(Rtext);

J1 := Length + D1;

END;

END;

PenSize(20);

MoveTo(x+A1,y);

LineTo(x+J1,y);

{**Create Reference, Sheet, & Detail numbers**}

TextSize(kTextSize10 * getTextScaleFactor(hPIO));

TextJust(2);

TextVerticalAlign(1);

TextOrigin(X,Y+B1);

TextFace([]);

IF Detail <> '' THEN BEGIN

BeginText;

Detail

EndText;

END;

TextJust(2);

TextVerticalAlign(1);

TextOrigin(X,Y-F1);

IF Page <> '' THEN BEGIN

BeginText;

Page

EndText;

END;

{TextJust(3);

TextVerticalAlign(1);

TextOrigin(X-F1,Y-F1);

BeginText;

R1

EndText;

TextJust(3);

TextVerticalAlign(1);

TextOrigin(X-F1,Y-G1);

BeginText;

R2

EndText;

TextJust(3);

TextVerticalAlign(1);

TextOrigin(X-F1,Y-H1);

BeginText;

R3

EndText;

TextJust(3);

TextVerticalAlign(1);

TextOrigin(X-F1,Y-I1);

BeginText;

R4

EndText;}

PopAttrs;

END;

END;

RUN ( ReferenceMarker );

Share this post


Link to post

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.

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

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...