[Therion] custumizing lines wall subtype blocks
Gilbert Fernandes (mailinglist)
gfe_list at aliceadsl.fr
Fri Apr 10 07:31:17 CEST 2009
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 ?
Thanks,
Here my code, written in the layout bloc
code metapost
def l_wall_blocks_PINEE (expr P) =
% pickup PenD;
% draw P withcolor red;
T:=identity;
cas := 0;
dlzka := arclength P;
if dlzka > 0:
mojkrok:=adjust_step(dlzka, 1.5u);
pickup PenA;
forever:
t1 := arctime (cas + mojkrok*1/10) of P;
t2 := arctime (cas + mojkrok*9/10) of P;
q := ((point t1 of P) + .4u * unitvector(thdir(P,t1) rotated
-90)) --
(subpath (t1,t2) of P) --
((point t2 of P) + .4u * unitvector(thdir(P,t2) rotated -90));
thdraw q randomized (u/6);
cas := cas + mojkrok;
exitif cas > dlzka - (2*mojkrok/3); % for rounding errors
endfor;
fi;
enddef;
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
####################### metapost log file ########################
This is MetaPost, Version 0.641 (Web2c 7.5.2) (mem=mpost 2004.3.2) 9
APR 2009 10:25
**data.mp
(data.mp [4001] [4002] [4003] [4004] [4005] [4006] [4007]
! Extra tokens will be flushed.
<to be read again>
string
mapsymbol->string
.s,stype,lname,ID;stype=substring(0,1)of(EXPR0);lname=(EXPR...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
I've just read as much of that statement as I could fathom,
so a semicolon should have been next. It's very puzzling...
but I'll try to get myself back together, by ignoring
everything up to the next `;'. Please insert a semicolon
now in front of anything that you don't want me to delete.
(See Chapter 27 of The METAFONTbook for an example.)
> > stype
> > "a"
! Equation cannot be performed (numeric=string).
<to be read again>
;
mapsymbol->...me,ID;stype=substring(0,1)of(EXPR0);
lname=(EXPR0)&"_"&(EXPR1);...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
I'm sorry, but I don't know how to make such things equal.
(See the two expressions just above the error message.)
> > lname
> > "a_bedrock_UIS"
! Equation cannot be performed (numeric=string).
<to be read again>
;
mapsymbol->...of(EXPR0);lname=(EXPR0)&"_"&(EXPR1);
ID:="ID_"&lname;if(known.s...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
I'm sorry, but I don't know how to make such things equal.
(See the two expressions just above the error message.)
> > "ID_"
> > lname
! Not implemented: (string)&(unknown numeric).
<to be read again>
;
mapsymbol->...(EXPR0)&"_"&(EXPR1);ID:="ID_"&lname;
if(known.scantokens.ID):if...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
I'm afraid I don't know how to apply that operation to that
combination of types. Continue, and I'll return the second
argument (see above) as the result of the operation.
> > lname
! Not a string.
<to be read again>
)
mapsymbol->...="ID_"&lname;if(known.scantokens.ID)
:if.stype="a":s="def
"&(EX...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
I'm going to flush this expression, since
scantokens should be followed by a known string.
! A primary expression can't begin with `:'.
<inserted text>
0
<to be read again>
:
mapsymbol->..."ID_"&lname;if(known.scantokens.ID):
if.stype="a":s="def
"&(EXP...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
I'm afraid I need some sort of value in order to continue,
so I've tentatively inserted `0'. You may want to
delete this zero and insert something else;
see Chapter 27 of The METAFONTbook for an example.
! Missing `)' has been inserted.
<to be read again>
:
mapsymbol->..."ID_"&lname;if(known.scantokens.ID):
if.stype="a":s="def
"&(EXP...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
I found no right delimiter to match a left one. So I've
put one in, behind the scenes; this may fix the problem.
> > stype
> > "a"
! Not implemented: (unknown numeric)=(string).
<to be read again>
:
mapsymbol->...f(known.scantokens.ID):if.stype="a":
s="def "&(EXPR0)&" =
scant...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
I'm afraid I don't know how to apply that operation to that
combination of types. Continue, and I'll return the second
argument (see above) as the result of the operation.
> > "a"
! Undefined condition will be treated as `false'.
<to be read again>
:
mapsymbol->...f(known.scantokens.ID):if.stype="a":
s="def "&(EXPR0)&" =
scant...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
The expression shown above should have had a definite
true-or-false value. I'm changing it to `false'.
> > "let a_bedrock = "
> > lname
! Not implemented: (string)&(unknown numeric).
<to be read again>
&
mapsymbol->...";else:s="let "&(EXPR0)&" = "&lname&
";";fi;scantokens.s;elseif...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
I'm afraid I don't know how to apply that operation to that
combination of types. Continue, and I'll return the second
argument (see above) as the result of the operation.
> > lname
> > ";"
! Not implemented: (unknown numeric)&(string).
<to be read again>
;
mapsymbol->...se:s="let "&(EXPR0)&" = "&lname&";";
fi;scantokens.s;elseif(EXP...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
I'm afraid I don't know how to apply that operation to that
combination of types. Continue, and I'll return the second
argument (see above) as the result of the operation.
! Inconsistent equation.
<to be read again>
;
mapsymbol->...se:s="let "&(EXPR0)&" = "&lname&";";
fi;scantokens.s;elseif(EXP...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
The equation I just read contradicts what was said before.
But don't worry; continue and I'll just ignore it.
! Redundant equation.
<to be read again>
;
mapsymbol->...R0)&" = "&lname&";";fi;scantokens.s;
elseif(EXPR2):message("[Wa...
l.3748 mapsymbol("a_bedrock","UIS",false)
;
I already knew that this equation was true.
But perhaps no harm has been done; let's continue.
More information about the Therion
mailing list