Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Create a layer filter if Attribute tag value = X
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Create a layer filter if Attribute tag value = X (Read 1615 times)
0 Members and 1 Guest are viewing this topic.
jlogan02
Bull Frog
Posts: 327
Create a layer filter if Attribute tag value = X
«
on:
January 07, 2019, 03:29:49 PM »
I want to use this portion of code...
Code - Auto/Visual Lisp:
[Select]
(
defun
FDN_LayGrpFltr
(
)
(
setq
osm
(
getvar
'osmode
)
)
(
setvar
'osmode
0
)
(
setvar
'cmdecho
0
)
(
defun
lm:getattributevalue
(
blk tag
/
val enx
)
(
while
(
and
(
null
val
)
(
=
"ATTRIB"
(
cdr
(
assoc
0
(
setq
enx
(
entget
(
setq
blk
(
entnext
blk
)
)
)
)
)
)
)
)
(
if
(
=
(
strcase
tag
)
(
strcase
(
cdr
(
assoc
2
enx
)
)
)
)
(
setq
val
(
cdr
(
assoc
1
enx
)
)
)
)
)
)
(
setq
ss
(
ssget
"x"
'
(
(
0
.
"INSERT"
)
(
2
.
"TBLK_ATT_CTL"
)
(
66
.
1
)
)
)
)
)
(
setq
attvalue
(
lm:getattributevalue
(
ssname
ss
0
)
"TITLELINE4"
)
)
(
cond
(
(
wcmatch
(
strcase
attvalue
)
"FOUNDATION PLAN"
)
with something like this
Code - Auto/Visual Lisp:
[Select]
(
command
"._layer"
"Filter"
"New"
"Group"
""
"S-FDN-*"
"S_FDN_Layers"
""
)
(
command
"._layer"
"Make"
"S_FDN"
"color"
"Cyan"
"S_FDN"
""
)
)
)
)
(
setvar
'osmode osm
)
(
setvar
'cmdecho
1
)
(
princ
)
)
(
FDN_LayGrpFltr
)
To create a layer filter group if the TitleLine4 reads "x" (Foundation Plan in this example).
The alternative to using the Attribute tag value would be to use the paper space tab name 'Foundation Plan".
I'm getting the "bad argument type: lselsetp nil. I assume because I'm missing an ssnamex
Code - Auto/Visual Lisp:
[Select]
(
if
(
setq
FDNLay
(
ssget
"X"
'
(
(
8
.
"S-FDN"
)
)
)
)
(
foreach
x
(
mapcar
'
cadr
(
ssnamex
FDNLay
)
)
Or something to this effect.
Logged
J. Logan
ACAD 2018
I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10
Dlanor
Bull Frog
Posts: 263
Re: Create a layer filter if Attribute tag value = X
«
Reply #1 on:
January 08, 2019, 03:11:19 AM »
The error means there is nothing in the selection set, i.e. there are no objects on layer "S-FDN"
Logged
Dlanor
http://www.theswamp.org/donate.html
jlogan02
Bull Frog
Posts: 327
Re: Create a layer filter if Attribute tag value = X
«
Reply #2 on:
January 08, 2019, 12:00:58 PM »
Gaaaaahhh!!! I knew that. Simple things.
I kept saying it's not find what it's looking for.
Thank D.
Logged
J. Logan
ACAD 2018
I am one with the Force and the Force is with me.
AutoCAD Map 2018 Windows 10
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Create a layer filter if Attribute tag value = X