Chris.
That should work as Mark has recommended.
TCL can be very useful but also frustrating ... the TCL error messages
can be very misleading and sometimes have no relevance to the actual
error:.
A couple of gotcha's to watch out for when programming in TCL
1) What spaces are your friend. Because the language is interpreted you
need white spaces to parse your code correctly.
I have burned many times by this especially with function declarations
Do not do this -> proc myproc{}{
It should be -> proc myproc { } { #NOTE THE EXTRA SPACES
Rule of thumb when in doubt add white spaces. It will save much pain
and anguish.
2) The opening bracket of a function or control structure should be on
the same line ... NOT THE NEXT LINE!!!!!!
For example - THIS will work
proc myproc { } {
...
for { set i 0 } { $i < $list_length } { incr i } {
...
if {$distance > $bridgeDistance} {
.....
}
}
...
}
This WILL NOT WORK , although it is far more readable.
proc myproc { }
{ # this bracket is on the wrong line
...
for { set i 0 } { $i < $list_length } { incr i }
{ # bracket on the wrong line
...
if {$distance > $bridgeDistance}
{ # bracket on the wrong line
.....
}
}
...
}
Generally the TCL interpreter's error messages are misleading. It is
best to have a small data set to use during development and run the TCL
code often. If your TCL script breaks just remove the newest lines of
code that you have added until you pinpoint the issue. Good luck
Geordie Hobart,
GIS Analyst/ Programmer
[EMAIL PROTECTED]
Refractions Research Inc.
www.refractions.net
300-1207 Douglas St.
Victoria, BC.
Canada, V8W 2E7
phone 250-383-3022
fax 250-383-2140
mark2atsafe wrote:
> Hi Chris,
> I'm not a mapping file expert but I think this should be possible.
>
> Try...
>
> @SupplyAttributes(mapinfo_brush_foreground,@Tcl2(myTCLfunction))
>
> and then within the function retrieve any attribute with the line
> "FME_GetAttribute myAttributename". I'm not sure how you'd retrieve a
> global within a Tcl procedure.
>
> Make sure you use @Tcl2 and not @TCL2 (shouldn't be all upper case).
>
> If you use @TCL instead of @Tcl2 then you'd need the line "global
> FME_Attributes" to make the attributes available to you.
>
> Hope this is useful; if you're still having problems then I think
> you'll need to post your files for us to check out, plus a bit more
> info on exactly what error messages you receive.
>
> Regards,
>
> Mark
>
> Mark Ireland, Product Support Engineer
> Safe Software Inc. Surrey, BC, CANADA
> [EMAIL PROTECTED] http://www.safe.com
> Solutions for Spatial Data Translation, Distribution and Access
>
> --- In [email protected], "christweekie" <[EMAIL PROTECTED]> wrote:
>
>> Hello
>>
>> Part of my FME file to create style MapInfo TAB files has this
>>
>> @SupplyAttributes(mapinfo_brush_foreground,16755370)
>>
>> Is it possible to call a TCL function with parameters to get the value
>> ? Something like this
>>
>> @SupplyAttributes(mapinfo_brush_foreground,@myTclFunction(¶m))
>>
>> where myTclFunction is my own TCL procedure INCLUDEd in the mapping
>> file and ¶m is some parameter derived from the source table or a
>> global variable
>>
>> I have tried using @TCL2 and @TCL but can't get it to work.
>>
>> Thanks anyone !
>>
>> Chris
>>
>>
Get the maximum benefit from your FME, FME Objects, or SpatialDirect via our
Professional Services team. Visit www.safe.com/services for details.
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/fme/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/