Julian Carr Posted November 9, 2018 Share Posted November 9, 2018 Anyone have a code snippet for applying a Tile resource to a polygon? Not having much luck. TIA. Quote Link to comment
_c_ Posted November 10, 2018 Share Posted November 10, 2018 Just by reversed index: SetFPat(PolyHandle, -Name2Index('tileFill')); Quote Link to comment
Julian Carr Posted November 11, 2018 Author Share Posted November 11, 2018 Thanks Orso. Next question. How to get the tile fill name of a wall component. If I use GetComponentFill() then index2name() on the returned fill, it doesn't work. Thanks. Quote Link to comment
_c_ Posted November 12, 2018 Share Posted November 12, 2018 (edited) Julian, it is indeed so tricky. You must first check for the by class of the fill type. Otherwise GetComponentFill will return the fill type of the component, "below" the by class. Edit: here the test file: wall comp fill style test.vwx.zip Example: PROCEDURE TEST; VAR sty : HANDLE; i, numComponents : INTEGER; resIndx : LONGINT; useClassFillStyleForFill : BOOLEAN; className : STRING; FUNCTION ResolveFillIndex(indx : LONGINT): STRING; BEGIN CASE indx OF 0 : ResolveFillIndex := 'none'; 1 : ResolveFillIndex := 'solid'; OTHERWISE ResolveFillIndex := Index2Name(-indx); END; END; BEGIN sty := GetObject('sty'); { a wall style named 'sty' with some components } { some have a fill by class, some don't } IF GetNumberOfComponents(sty, numComponents) THEN FOR i:=1 TO numComponents DO BEGIN useClassFillStyleForFill := FALSE; { init } { check if it's by class } IF GetCompUseClassFill(sty, i, useClassFillStyleForFill) THEN IF useClassFillStyleForFill THEN IF GetComponentClass(sty, i, resIndx) THEN BEGIN className := Index2Name(resIndx); AlrtDialog(Concat( 'Component ', i, chr(13), 'Has fill by class. Class name: ', chr(13), className, chr(13), 'Fill: ', ResolveFillIndex(GetClFPat(className)) )); { the underlying fill, without the by class } IF GetComponentFill(sty, i, resIndx) THEN AlrtDialog(Concat( 'Component ', i, chr(13), 'UNDERLYING Fill, if it wasn''t by class: ', chr(13), ResolveFillIndex(resIndx) )); END; IF (useClassFillStyleForFill = FALSE) & GetComponentFill(sty, i, resIndx) THEN AlrtDialog(Concat( 'Component ', i, chr(13), 'Fill indx not by class: ', chr(13), ResolveFillIndex(resIndx) )); { index 1: solid fill } { index negative: vectorial fill: hatch, tile, img, gradient } END; END; RUN(TEST); Edited November 12, 2018 by _c_ Img too large 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.