[Therion] custumizing lines wall subtype blocks
Georg Pacher
gpacher at sbox.tugraz.at
Fri Apr 10 12:11:17 CEST 2009
Hi!
The syntax for the symbol-assign with subtypes is using a colon:
symbol-assign line wall:blocks PINEE
yet, note that this is a therion command and not a metapost command.
Therefore it should not be inside the code metapost section (though it
works!?).
On the other hand the "let" is a metapost command, and the line has to
be terminated by a semicolon, or you get metapost errors.
regards,
Georg.
Ps.: This is the redefinition of line wall:blocks, I did:
def l_wall_blocks_AUT (expr P) =
T:=identity;
pickup PenC;
laenge := arclength P;
path block;
path old_block;
cur := 0;
t:= arctime cur of P;
% draw first block
old_block := (
(.7u,-.35u)--(.85u,0.01u)--(.4u,.5u)--(.1u,.3u)--(-.0u,-.0u) );
block_width := (xpart urcorner old_block - xpart ulcorner old_block);
old_block:=old_block rotated angle( thdir(P,0) ) shifted point t of P;
thclean (old_block--cycle);
thdraw old_block;
cur := cur + block_width/2;
t:= arctime cur of P;
forever:
% generate random block
block := punked ( (
(.8u,-.35u)--(.85u,0.01u)--(.6u,.4u)--(.1u,.1u)--(-.0u,-.3u) )
randomized (0.3u) )
scaled (uniformdeviate(0.3)+.65)
rotated (uniformdeviate(45)-15);
% check width of block
block_width := (xpart urcorner block - xpart ulcorner block);
exitif cur > (laenge- 3.5*block_width/2);
% find next position where the block fits in without intersecting
the previous one
forever:
exitif xpart ( ((block--cycle) rotated angle(direction t of P)
shifted point t of P) intersectiontimes old_block) < 0;
cur:=cur+0.01u;
t:= arctime cur of P;
exitif cur > (laenge- 3.5*block_width/2);
endfor;
exitif cur > (laenge- 3.5*block_width/2);
old_block:= block rotated angle(direction t of P) shifted point t of P;
thclean (old_block--cycle);
thdraw old_block;
cur := cur + block_width/2;
t:= arctime cur of P;
endfor;
% generate last block
t:= arctime laenge-eps of P;
block := ((
(-.15u,-.35u)--(.0u,.0u)--(-.45u,.5u)--(-.75u,.3u)--(-.85u,-.0u)) );
block_width := (xpart urcorner block - xpart ulcorner block);
% scale last block to fit in the remaining gap
scale_factor:=(laenge-cur)/block_width;
forever:
exitif xpart ( ( (block) rotated angle (direction t of P) scaled
scale_factor shifted (point t of P) ) intersectiontimes old_block) < 0;
scale_factor:=scale_factor-0.001;
endfor;
thclean (block--cycle) rotated angle (direction t of P) scaled
scale_factor shifted (point t of P);
thdraw (block) rotated angle (direction t of P) scaled scale_factor
shifted (point t of P);
enddef;
Gilbert Fernandes (mailinglist) schrieb:
>
> Hello,
> I tried to custumise the line drawing for Wall subtype blocks
> but I did not succeed. I try to use the same technique (and syntaxe)
> used for others kinds of lines but here, it's not a line but a SUBTYPE
> of line
> Is it possible ? and what is the syntaxe ?
[...]
> initsymbol("l_wall_blocks_PINEE");
> #symbol-assign line wall_blocks PINEE
> # let l_wall_blocks = l_wall_blocks_PINEE
> endcode
>
> The symbol-assign command did not work, and the "let l_wall_blocks =
> l_wall_blocks_PINEE" generate an error on compiling
> An extract of the logs
[...]
More information about the Therion
mailing list