Assembly Posted January 19, 2010 Share Posted January 19, 2010 The tool below draws a timber frame in section and add the size of the frame. It includes a note for treatment. The procedure gets the layer scale and adjusts the text size to suit. -> SetTextSize(lnewobj,0,50,5*5/PIOlayerscale); This works fine for me most of the time. BUT When if this is used inside a Symbol the text resizing part gets overridden. Anyone know why this would be?. How to work around?. PROCEDURE SECTIONFRAMING; Var layerhandle, pioHandle, pioRecordHandle, PioWallHandle: Handle; PIOlayerscale:Integer; Layerscale:Integer; ClassName:String; pioName: String; text:boolean; Radius: Real; framewidth: Integer; Depth: Integer; BEGIN; pushattrs; SetLScale(GetLayer(pioHandle),5); Nameclass('Sec-Framing'); FPatByClass; If (getcustomobjectinfo(pioName,pioHandle,pioRecordHandle,PioWallHandle)=True) THEN Layerscale:=GetLScale(ActLayer); SetLScale(GetLayer(pioHandle),5); BEGIN; framewidth:=pframewidth; depth:=pframedepth; layerhandle:=getlayer(pioHandle); PIOlayerscale:=getlscale(layerhandle); BeginGroup; RRect(0,0,framewidth,depth,5,5); SetFPatByClass(lnewobj); radius:=1; Moveto(radius,radius);Lineto(framewidth-radius,depth-radius); setlw(lnewobj,2); IF (plength='Continious') THEN BEGIN; Moveto(radius,depth-radius); Lineto(framewidth-radius,radius); setlw(lnewobj,2); END; {----TEXT------------------------------} text:= ptext; IF(text=true) THEN IF IsNewCustomObject(pioName)=False THEN BEGIN; textsize(5*5/PIOlayerscale); TextFont(GetFontID('Arial')); TextFace([]); TextFlip(0); TextRotate(0); TextSpace(2); TextJust(2); TextVerticalAlign(5); TextOrigin(framewidth/2,0); BEGINTEXT; num2str(0,framewidth) ENDTEXT; SetTextWidth(LNewObj,framewidth); SetTextSize(lnewobj,0,50,5*5/PIOlayerscale); Setfpat(lnewobj,0); TextRotate(90); TextOrigin(framewidth,depth/2); BEGINTEXT; num2str(0,depth) ENDTEXT; SetTextWidth(LNewObj,depth); Setfpat(lnewobj,0); IF (pTreatment<>'None') Then BEGIN; TextRotate(90); TextOrigin(0,depth/2); TextVerticalAlign(1); BEGINTEXT; ptreatment ENDTEXT; SetTextWidth(LNewObj,depth); Setfpat(lnewobj,0); END; END; END; EndGroup; if pflip=true then Hmove(LNewObj,0,-depth); if pinsertline='Centre' then Hmove(LNewObj,-framewidth/2,0); if pinsertline='Right' then Hmove(LNewObj,-framewidth,0); message(layerscale); SetLScale(GetLayer(pioHandle),layerscale); popattrs; resetobject(piohandle); END; Run (SECTIONFRAMING); Quote Link to comment
Assembly Posted April 6, 2010 Author Share Posted April 6, 2010 Hitting this again. Is there a way to find out if a PIO is inside a symbol?. Symbols are creating trouble with text wrap width. Quote Link to comment
Pat Stanford Posted April 7, 2010 Share Posted April 7, 2010 GetType(GetParent(H1)); If this returns as a symbol you are set if it returns as a layer then you are not in a symbol. Up to you to figure out how to get a handle to your PIO. Quote Link to comment
Vectorworks, Inc Employee klinzey Posted April 7, 2010 Vectorworks, Inc Employee Share Posted April 7, 2010 If you want to know if you are inside of a symbol you can recursively call GetParent() till you reach a symdef or a layer. Quote Link to comment
Assembly Posted April 8, 2010 Author Share Posted April 8, 2010 Thanks Kevin I did manage a hack If lScale<2 THEN Textwidth:=lscale@50 ELSE Textwidth:=500; will put on the list of things to check 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.