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
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]
  1.     (APPLY
  2.       (FUNCTION APPEND)
  3.       (CONS (List '(0 . "BLOCK")
  4.                    (CONS 2  (strcat tabname blk))
  5.                   '(70 . 0)
  6.                   '(10 0.0 0.0 0.0)
  7.                   )
  8.             (MAPCAR (FUNCTION LIST)
  9.                     (MAPCAR (FUNCTION (LAMBDA (a) (CONS -2 a))) LWentL)
  10.                     )
  11.             )
  12.       )
  13.     )
  14.     (ENTMAKE '((0 . "ENDBLK")))


CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: ENTMAKE BLOCK Troubles
« Reply #1 on: February 19, 2013, 07:35:11 PM »
Hint
(APPLY 'APPEND
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
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 LWPOLYLINEs, 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]
  1.     (list
  2.        '(0 . "BLOCK")
  3.         (cons 2 (strcat tabname blk))
  4.        '(70 . 0)
  5.        '(10 0.0 0.0 0.0)
  6.     )
  7. )
  8.  
  9. (entmake '((0 . "LWPOLYLINE") ... )) ;;  Anything created here
  10. (entmake '((0 . "LWPOLYLINE") ... )) ;;  will be part of the
  11. (entmake '((0 . "LWPOLYLINE") ... )) ;;  block definition
  12.  
  13. (entmake '((0 . "ENDBLK")))

snownut2

  • Swamp Rat
  • Posts: 971
  • Bricscad 22 Ultimate
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. :-o

Speed is very good also.


Bruce

Lee Mac

  • Seagull
  • Posts: 12929
  • London, England
Re: ENTMAKE BLOCK Troubles
« Reply #4 on: February 20, 2013, 05:50:08 AM »
You're welcome Bruce  :-)