[Therion] Colored Lines Based On Attributes

Carl Magnuson magnu213 at umn.edu
Mon Sep 14 04:11:55 CEST 2009


I figured it out with the following command:

"scantokens ATTR_color;\n" +

Scantokens evaluates the string it is applied to, so I just had to  
change ATTR_color to "color col; col:=red" for example.

Carl


On Sep 11, 2009, at 3:35 PM, Carl Magnuson wrote:

> I am attempting to color the walls of different systems with  
> different colors using the -attr flag and a user defined wall:
>
> portion of code in scrap:
> line u:wall -attr color "(0.1, 0.2, 0.8);"
> 1392.9359853260457 -71.62435442682576
> 1395.5759853260456 125.20564557317425
> endline
>
> portion of code in layout:
> def l_u_wall (expr P)=
> 	T:=identity;
> 	if known(ATTR__color):
> 		pickup PenA;
> 		draw P withpen PenA withcolor ATTR__color\n
> 	fi;
> enddef;
>
> initsymbol(\"l_u_wall\");
>
> I am not having any success however.  Is it possible to set and read  
> attributes from lines as I am trying to do? Is somebody aware of an  
> alternate way to pass in a color argument to the metapost definition  
> (instead of defining separate walls for each different colored  
> system)?
>
> Thanks,
>
> Carl

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.speleo.sk/pipermail/therion/attachments/20090913/bc31bffd/attachment.htm>


More information about the Therion mailing list