Assembly Posted February 27, 2009 Share Posted February 27, 2009 Text size is controlled by layer. Is there a function to set absolute text size. What I'm thinking is creating a PIO that will be viewed at 2 scales 1-50 & 1-5 and using the Class to control visibility. Say Nameclass(Notes-Scale5) Nameclass(Notes-Scale50) For this to work I need to control the absolute size of the text regardless of the layer scale it is inserted on. Quote Link to comment
Pat Stanford Posted February 27, 2009 Share Posted February 27, 2009 The typical way to do this is to set your text sizes so that you canmultiply it by the layer scale so it will be the correct size. Something like: pioTextSize := ((GetObjectVariableReal(pioHandle, 17)/GetLScale(GetLayer(pioHandle))) * 72) / 25.4; This was taken from a Vectorscript list post by Charles Changeler on 1 May 2007. The Subject was Re: Text size of PIOs. Quote Link to comment
Assembly Posted March 1, 2009 Author Share Posted March 1, 2009 Procedure textpio; Var layerscalestring:string; PIOrecordhandle:handle; pioHandle:handle; PIOwallhandle:handle; pioTextSize:real; PIOname, pioText: String; PIOlayerscale:integer; BEGIN; IF getcustomobjectinfo(PIOname,PIOHandle,PIOrecordhandle,PIOwallhandle)=TRUE THEN BEGIN; PIOlayerscale:=getlscale(PIOHandle); layerscalestring:=num2str(5,PIOlayerscale); TextOrigin(0,0); textsize(300mm/PIOlayerscale); BeginText; Concat (Ptext,'This is the scale 100 size',' ',layerscalestring) EndText; textsize(75mm/PIOlayerscale); BeginText; Concat (Ptext,'This is the scale 25 size') EndText; hmove(lnewobj,0,-50); textsize(15mm/PIOlayerscale); BeginText; Concat(Ptext, 'This is the scale 5 size') EndText; hmove(lnewobj,0,-70); END; END; run(textpio); Quote Link to comment
Assembly Posted March 1, 2009 Author Share Posted March 1, 2009 I'm having trouble with the above in that PIOlayerscale:=getlscale(PIOHandle); returns a value of 0.0000. anyone spot what is wrong?. Quote Link to comment
Assembly Posted March 1, 2009 Author Share Posted March 1, 2009 this is a point object with one string parameter: 'text' Quote Link to comment
Vectorworks, Inc Employee klinzey Posted March 1, 2009 Vectorworks, Inc Employee Share Posted March 1, 2009 You need to pass a layer handle to getlscale. Your code is passing the object handle. You need to do a GetLayer() first. Quote Link to comment
Assembly Posted March 1, 2009 Author Share Posted March 1, 2009 Procedure textpio; Var layerhandle:handle; layerscalestring:string; PIOrecordhandle:handle; pioHandle:handle; PIOwallhandle:handle; pioTextSize:real; PIOname, pioText: String; PIOlayerscale:integer; textheight:real; scale1:real; scale2:real; scale3:real; classstring1, classstring2, classstring3:STRING; BEGIN; classstring1:=Concat('Note-Text-',num2str(0,pscale1)); classstring2:=Concat('Note-Text-',num2str(0,pscale2)); classstring3:=Concat('Note-Text-',num2str(0,pscale3)); textheight:=ptextheight; IF getcustomobjectinfo(PIOname,PIOHandle,PIOrecordhandle,PIOwallhandle)=TRUE THEN BEGIN; layerhandle:=getlayer(PIOHandle); PIOlayerscale:=getlscale(layerhandle); layerscalestring:=num2str(5,PIOlayerscale); TextOrigin(0,0); Nameclass(classstring1); textsize(textheight*pscale1/PIOlayerscale); BeginText; Ptext EndText; Nameclass(classstring2); textsize(textheight*pscale2/PIOlayerscale); BeginText; Ptext EndText; textsize(textheight*pscale3/PIOlayerscale); Nameclass(classstring3); BeginText; Ptext Endtext; END; END; run(textpio); Quote Link to comment
Assembly Posted March 1, 2009 Author Share Posted March 1, 2009 The above script has five parameters. 1) a String field for text. 2) A field to set text height in mm 3-4-5) Three options of layer scale the text may be viewed at. Quote Link to comment
Recommended Posts
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.