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:
Identifing the visibility state a nested entity is associated with
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Identifing the visibility state a nested entity is associated with (Read 2433 times)
0 Members and 1 Guest are viewing this topic.
cadpoobah
Newt
Posts: 49
WWW
Identifing the visibility state a nested entity is associated with
«
on:
June 25, 2018, 02:47:56 PM »
All,
I'd like to generate a report of the entities nested within a block and know if each entity is associated with a visibility state. Can anyone tell me how to determine that info?
Thanks!
Chris
Logged
Chris Lindner
Onebutton CAD Solutions
----------------------------------------------------
www.onebuttoncad.com
#dayjob
www.unpavedart.com
#sidehustle
kpblc
Bull Frog
Posts: 396
Re: Identifing the visibility state a nested entity is associated with
«
Reply #1 on:
June 25, 2018, 03:29:53 PM »
I thinck you have to check block reference (not by EffectiveName, but just Name) and going through all subentities check - are they visible or not.
Logged
Sorry for my English.
cadpoobah
Newt
Posts: 49
WWW
Re: Identifing the visibility state a nested entity is associated with
«
Reply #2 on:
June 25, 2018, 03:47:53 PM »
Thanks, @kpblc.
You are correct; this would be for references. Similar to AutoCAD's LIST command, the user would be prompted to select a block reference. The report would be specific to the selected block.
Logged
Chris Lindner
Onebutton CAD Solutions
----------------------------------------------------
www.onebuttoncad.com
#dayjob
www.unpavedart.com
#sidehustle
Lee Mac
Seagull
Posts: 12926
London, England
WWW
Re: Identifing the visibility state a nested entity is associated with
«
Reply #3 on:
June 25, 2018, 05:50:44 PM »
The following function should return a list of entities visible for each visibility state for a given dynamic block:
Code - Auto/Visual Lisp:
[Select]
;; Visibility State Entities - Lee Mac
;; Returns an association list of visibility states and the entities visible for each state
;; blk - [str] Dynamic block name
(
defun
LM:vsentities
(
blk
/
ent enx rtn ste tmp vis
)
(
if
(
and
(
setq
ent
(
tblobjname
"block"
blk
)
)
(
setq
ent
(
cdr
(
assoc
330
(
entget
ent
)
)
)
)
(
setq
enx
(
member
'
(
102
.
"{ACAD_XDICTIONARY"
)
(
entget
ent
)
)
)
(
setq
ent
(
cdr
(
assoc
360
enx
)
)
)
(
setq
vis
(
vl-some
'
(
lambda
(
x
)
(
if
(
and
(
=
360
(
car
x
)
)
(
=
"BLOCKVISIBILITYPARAMETER"
(
cdr
(
assoc
0
(
entget
(
cdr
x
)
)
)
)
)
)
(
cdr
x
)
)
)
(
dictsearch
ent
"ACAD_ENHANCEDBLOCK"
)
)
)
)
(
foreach
itm
(
entget
vis
)
(
cond
(
(
=
303
(
car
itm
)
)
(
if
(
and
ste tmp
)
(
setq
rtn
(
cons
(
cons
ste
(
reverse
tmp
)
)
rtn
)
)
)
(
setq
ste
(
cdr
itm
)
tmp
nil
)
)
(
(
=
332
(
car
itm
)
)
(
setq
tmp
(
cons
(
cdr
itm
)
tmp
)
)
)
)
)
)
(
reverse
(
if
(
and
ste tmp
)
(
cons
(
cons
ste
(
reverse
tmp
)
)
rtn
)
rtn
)
)
)
For example:
Code - Auto/Visual Lisp:
[Select]
_$
(
LM:vsentities
"MyDynamicBlock"
)
(
(
"State 0"
<
Entity name: 7ffff7104d0
>
<
Entity name: 7ffff7104e0
>
)
(
"State 1"
<
Entity name: 7ffff7104d0
>
<
Entity name: 7ffff7104e0
>
<
Entity name: 7ffff7104f0
>
)
(
"State 2"
<
Entity name: 7ffff7104d0
>
<
Entity name: 7ffff7104e0
>
<
Entity name: 7ffff7104f0
>
<
Entity name: 7ffff710500
>
)
(
"State 3"
<
Entity name: 7ffff7106b0
>
)
)
Logged
Lee Mac Programming
•
Twitter
•
Exchange App Store
cadpoobah
Newt
Posts: 49
WWW
Re: Identifing the visibility state a nested entity is associated with
«
Reply #4 on:
June 26, 2018, 10:07:15 AM »
Thanks, Lee. That's perfect. I can tweak from there.
You continue to amaze, man. Your code is always 'spot on' and super clean.
Logged
Chris Lindner
Onebutton CAD Solutions
----------------------------------------------------
www.onebuttoncad.com
#dayjob
www.unpavedart.com
#sidehustle
roy_043
Water Moccasin
Posts: 1895
BricsCAD 18
Re: Identifing the visibility state a nested entity is associated with
«
Reply #5 on:
June 26, 2018, 10:44:05 AM »
Isn't Lee's code for block definitions instead of references? Or am I missing something?
Logged
cadpoobah
Newt
Posts: 49
WWW
Re: Identifing the visibility state a nested entity is associated with
«
Reply #6 on:
June 26, 2018, 02:12:44 PM »
You're right, @roy_043. For now, I'm using it as a general block definition ("what's inside this block") reporting tool. I'll eventually need a reference version as well.
Logged
Chris Lindner
Onebutton CAD Solutions
----------------------------------------------------
www.onebuttoncad.com
#dayjob
www.unpavedart.com
#sidehustle
Lee Mac
Seagull
Posts: 12926
London, England
WWW
Re: Identifing the visibility state a nested entity is associated with
«
Reply #7 on:
June 26, 2018, 05:02:18 PM »
Thanks cadpoobah, glad it helps.
Thank you also for your compliments for my code, I appreciate it.
The 'block reference' version is actually a lot easier, since you can simply query the contents of the anonymous block definition generated based on the current dynamic parameter values of the block and return the visible entities in the definition:
Code - Auto/Visual Lisp:
[Select]
(
defun
blockrefentities
(
ent
/
enx rtn
)
(
if
(
setq
ent
(
tblobjname
"block"
(
cdr
(
assoc
2
(
entget
ent
)
)
)
)
)
(
while
(
setq
ent
(
entnext
ent
)
)
(
if
(
/=
1
(
cdr
(
assoc
60
(
entget
ent
)
)
)
)
(
setq
rtn
(
cons
ent rtn
)
)
)
)
)
(
reverse
rtn
)
)
The active visibility state can be ascertained using
this function
.
Logged
Lee Mac Programming
•
Twitter
•
Exchange App Store
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
Identifing the visibility state a nested entity is associated with