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:
ENTMAKE BLOCK Troubles
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: ENTMAKE BLOCK Troubles (Read 1778 times)
0 Members and 1 Guest are viewing this topic.
snownut2
Swamp Rat
Posts: 971
Bricscad 22 Ultimate
WWW
ENTMAKE BLOCK Troubles
«
on:
February 19, 2013, 06:28:25 PM »
In trying to assemble a block from any number of LWPOLYLINES I seem to be missing something. My code is below, as the LWPOLYLINES are being created with an ENTMAKE I am generating a list of entity names the LWentL variable is the list, all appears fine with the list.
Sample of the generated list; (<Entity name: 7eb4dde8> <Entity name: 7eb4ddd8> <Entity name: 7eb4ddc8>)
Actual list is much longer....
Code - Auto/Visual Lisp:
[Select]
(
ENTMAKE
(
APPLY
(
FUNCTION
APPEND
)
(
CONS
(
List
'
(
0
.
"BLOCK"
)
(
CONS
2
(
strcat
tabname blk
)
)
'
(
70
.
0
)
'
(
10
0.0
0.0
0.0
)
)
(
MAPCAR
(
FUNCTION
LIST
)
(
MAPCAR
(
FUNCTION
(
LAMBDA
(
a
)
(
CONS
-
2
a
)
)
)
LWentL
)
)
)
)
)
(
ENTMAKE
'
(
(
0
.
"ENDBLK"
)
)
)
Logged
CAB
Global Moderator
Seagull
Posts: 10401
Re: ENTMAKE BLOCK Troubles
«
Reply #1 on:
February 19, 2013, 07:35:11 PM »
Hint
(APPLY 'APPEND
Logged
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.
Lee Mac
Seagull
Posts: 12929
London, England
WWW
Re: ENTMAKE BLOCK Troubles
«
Reply #2 on:
February 19, 2013, 07:45:13 PM »
You will need to first entmake the
BLOCK
entity, then entmake the
LWPOLYLINE
s, and finally the
ENDBLK
entity; else the
LWPOLYLINE
entities will be created in the drawing (modelspace/paperspace) rather than within the block definition.
For example:
Code - Auto/Visual Lisp:
[Select]
(
entmake
(
list
'
(
0
.
"BLOCK"
)
(
cons
2
(
strcat
tabname blk
)
)
'
(
70
.
0
)
'
(
10
0.0
0.0
0.0
)
)
)
(
entmake
'
(
(
0
.
"LWPOLYLINE"
)
...
)
)
;; Anything created here
(
entmake
'
(
(
0
.
"LWPOLYLINE"
)
...
)
)
;; will be part of the
(
entmake
'
(
(
0
.
"LWPOLYLINE"
)
...
)
)
;; block definition
(
entmake
'
(
(
0
.
"ENDBLK"
)
)
)
Logged
Lee Mac Programming
•
Twitter
•
Exchange App Store
snownut2
Swamp Rat
Posts: 971
Bricscad 22 Ultimate
WWW
Re: ENTMAKE BLOCK Troubles
«
Reply #3 on:
February 19, 2013, 09:42:47 PM »
Thanks Lee, that did the trick. I was not sure how that would work since I am calling 1/2 dozen sub-functions between starting the block and ending it.
Speed is very good also.
Bruce
Logged
Lee Mac
Seagull
Posts: 12929
London, England
WWW
Re: ENTMAKE BLOCK Troubles
«
Reply #4 on:
February 20, 2013, 05:50:08 AM »
You're welcome Bruce
Logged
Lee Mac Programming
•
Twitter
•
Exchange App Store
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
ENTMAKE BLOCK Troubles