View Full Version : tblsearch
tflaherty
2005-05-27, 05:31 PM
Can I combine mutiple table searches in the same if statement. For example can I take this code:
(if (tblsearch "layer" "BRICK")
(command "._-layer" "_t" "BRICK" "_on" "BRICK" "_s" "BRICK" "")
(command "._-layer" "_m" "BRICK" "_c" "5" "" ""))
(if (tblsearch "layer" "DETAIL")
(command "._-layer" "_t" "DETAIL" "_on" "DETAIL" "_s" "DETAIL" "")
(command "._-layer" "_m" "DETAIL" "_c" "5" "" ""))
and combine it like this:
(if (tblsearch "layer" "BRICK")
(command "._-layer" "_t" "BRICK" "_on" "BRICK" "_s" "BRICK" "")
(command "._-layer" "_m" "BRICK" "_c" "5" "" "")
(tblsearch "layer" "DETAIL")
(command "._-layer" "_t" "DETAIL" "_on" "DETAIL" "_s" "DETAIL" "")
(command "._-layer" "_m" "DETAIL" "_c" "5" "" ""))
madcadder
2005-05-27, 06:01 PM
are you looking for BOTH or OR
tflaherty
2005-05-27, 10:13 PM
I'm looking for both.
madcadder
2005-05-27, 11:48 PM
without testing i'll say:
(IF (AND (TBLSEARCH "layer" "BRICK")
(TBLSEARCH "layer" "DETAIL")
) ;_ end of and
(PROGN
(COMMAND "._-layer" "_t" "BRICK" "_on" "BRICK" "_s" "BRICK" "") ;_ end of command
(COMMAND "._-layer" "_t" "DETAIL" "_on" "DETAIL" "_s" "DETAIL" "") ;_ end of command
) ;_ end of progn
(PROGN
(COMMAND "._-layer" "_m" "BRICK" "_c" "5" "" "")
(COMMAND "._-layer" "_m" "DETAIL" "_c" "5" "" "")
) ;_ end of progn
) ;_ end of if
kennet.sjoberg
2005-05-28, 12:57 AM
without testing i'll say:. . .
and which one do You want to be current ?
and if one of them exist ?
: ) Happy Computing !
kennet
kennet.sjoberg
2005-05-28, 01:10 AM
Can I . . .
I think You have to reformulate the question, it is not possible to know which layer you want to have active. But it is possible to create the layer if they not exist, also to turn them on if they is off.
: ) Happy Computing !
kennet
tflaherty
2005-05-28, 02:27 AM
It doesn't matter which one is current. I handle that later in the code when I need to draw a line on the specific layer. I just want to make sure that the layers are present and on and if they're not present to create them.
It doesn't matter which one is current. I handle that later in the code when I need to draw a line on the specific layer. I just want to make sure that the layers are present and on and if they're not present to create them.
If it is not needed to set either one current at this time, then remove the "_s" "BRICK" and "_s" "DETAIL" from your code.
(COMMAND "._-layer" "_t" "BRICK" "_on" "BRICK" "_s" "BRICK" "")
(COMMAND "._-layer" "_t" "DETAIL" "_on" "DETAIL" "_s" "DETAIL" "")
This will leave your current layer alone until you need to change it and reduce your code a little.
kennet.sjoberg
2005-05-28, 04:00 PM
I just want to make sure that the layers are present and on and if they're not present to create them. If the layer not exist, create the layer
(if (not (tblsearch "LAYER" "BRICK" ) ) (command "._-layer" "_n" "BRICK" "_c" "5" "BRICK" "" ) ( ) )
(if (not (tblsearch "LAYER" "DETAIL" ) ) (command "._-layer" "_n" "DETAIL" "_c" "5" "DETAIL" "" ) ( ) )
Later on You can check if the layer is on or off, you can see it on the layer color number
if negative color number the layer is off, else on.
(if (minusp (cdr (assoc 62 (tblsearch "LAYER" "BRICK" )))) (command "._-layer" "_ON" "BRICK" "" ) ( ) )
(if (minusp (cdr (assoc 62 (tblsearch "LAYER" "DETAIL" )))) (command "._-layer" "_ON" "DETAIL" "" ) ( ) )
: ) Happy Computing !
kennet
vBulletin® v3.6.7, Copyright ©2000-2009, Jelsoft Enterprises Ltd.