Jump to content
Developer Wiki and Function Reference Links ×

Text Size


Recommended Posts

Simple request yet can't get to work.

I have a simple Grid line marker.

Graphically it consists of a circle with a bit of text eg: "x1"

I'm using a pop up menu for scale; 5,10,25,50,100,200. to adjust the size of the circle and the text. The idea is that I can work on my building sections at layer scale of 10 to see the details, while using a viewport of scale 1-50. to print sections.

Hence PIO will controll the correct scale apearance of the Grid Buble for the viewport independent of the scale of drawing.

I have no problem in scaling the circle however I can't get the text to stay constant. When I insert the PIO on layers of different scales the text size changes in relation to the circle size.

Im using

settextsize(lnewobj,0,5,2mm*scale);

I'm guessing that settextsize references the layer the object is on to figure out how big 2mm is.

Any one know a way arround this?.

Link to comment

I dug up a sample plug-in object script that I wrote a couple years ago that does something similar to what you want. This script is for a linear plug-in object the has the following parameters:

code:

  

LineLength Line Length 1

Factor Number 1

Title Text Integer 14

Title Text Your Title Here

Scale Boolean TRUE

Scale Text Integer 12
[/code]

The "Scale" parameter was just used to force a regen (reset) of the object for testing purposes. You won't need that. Also, if you go to the Properties dialog when creating your plug-in object, you can turn on the "Reset on Move" flag. This will force a reset when you paste the object onto a different layer. ( A paste is considered a Move.) I think there is a bug in that "Paste In Place" doesn't cause the reset, but we'll fix that in next version.

This object will show a circle and text at same size on layers of different scales. I have tried this with ViewPorts.

Regards,

Jeff

code:

  

PROCEDURE MyScale;

{ JAK 3/13/03 }

VAR

A, theFactor, theLayerScale : REAL;

theScale : STRING;

{** Get Units stuff}

UPI : REAL;

Fmt : INTEGER;

UM, UM2 : STRING;

UName, DA : LONGINT;

{** Regeneration state globals}

gParmN: STRING; {** my name}

gParmH: HANDLE; {** my object in drawing}

gRecH: HANDLE; {** my record}

gWallH: HANDLE; {** The wall I am currently inserted into, if any}

saveClass, noneClass :STRING;

{---------------------------------------------------------------------------}

FUNCTION getScaleFactor : REAL;

BEGIN

IF IsNewCustomObject(gParmN) OR (GetLayer(gParmH)=NIL) THEN

getScaleFactor:=1

ELSE

getScaleFactor:=GetLScale(GetLayer(gParmH)) / GetLScale(ActLayer);

END;

{-------------------------------------------------------------------}

BEGIN {** of main program}

if GetCustomObjectInfo(gParmN, gParmH, gRecH, gWallH) then

BEGIN

SetObjectVariableBoolean(gParmH, 800, TRUE);

PushAttrs;

{** scale the marker as required for the layer and the selected scale factor}

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

{** error-check for possible size changes in regens}

IF IsNewCustomObject (gParmN) OR (GetLayer(gParmH)=NIL) THEN

theLayerScale:=GetLScale(ActLayer)

ELSE

theLayerScale:=GetLScale(GetLayer(gParmH));

IF (pFactor <= 0) THEN

BEGIN

SysBeep;

SetRField(gParmH,GetName(gRecH),'Factor','.1');

theFactor:=.1;

END

ELSE

theFactor:=pFactor;

A :=theFactor*theLayerScale;

Message('theLS=', theLayerScale, ' theFactor=', theFactor, 'A=', A, ' getSF=', getScaleFactor, ' pST=', pScale_Text, ' TextSize=', (getScaleFactor*pTitle_Text));

{ ***** DrawConfig 1 ***** }

Oval(0, A*(-1/4"), A*1/2", A*1/4");

TextSize(getScaleFactor * pTitle_Text);

TextJust(1);

TextVerticalAlign(5);

TextOrigin(A*5/8", A*1/32");

IF pTitle<>'' THEN

CreateText(pTitle)

ELSE

CreateText(' ');

PopAttrs;

END;

END; {** of main program}

RUN (MyScale);
[/code]

Link to comment

Hi,

I'm not sure this is relevant in this case... but as I've done some 'scale independent' PIOs I noticed that on special ocasions they can regenerate while not being at the active layer, making the text size go wrong.

So I have added some code before and after the drawing procedures that make the parent layer (if found) temporarily active.

rgrds,

Alexandre

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.

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.

×
×
  • Create New...