Author Topic: block group code 71?  (Read 9656 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
block group code 71?
« Reply #15 on: September 30, 2004, 01:04:19 PM »
I have been experimenting with one of these blocks. When I run FixBlock it eliminates the
code 71 and entmakes a replacement block, but ACAD adds back the code 71. I can only
assume that because the INSERT linked to that block is a minsert that ACAD uses the
code 71 as a flag.

Here is the revised FixBlock routine.

Code: [Select]
;FixBlock.lsp  [June 30, 1998]
 ;
 ; Copyright 1996 - 1998 ManuSoft
 ;
 ; Freeware from:
 ;   ManuSoft
 ;   http://www.manusoft.com
 ;
 ; Load function, then enter FIXBLOCK to redefine selected blocks
 ;  so that all entities are on layer '0', color 'BYBLOCK'.
 ;
;;===================================================================
;;  09/29/2004  CAB modified to remove the 71 code from block def.  
;;===================================================================


(defun C:FixBlock (/ ss cnt idx blkname donelist DXF Update)
  (defun DXF (gcode el) (cdr (assoc gcode el)))
  (defun Update (bname / ename elist)
    (setq ename (tblobjname "BLOCK" bname))
    (if
      (and ename (zerop (logand 52 (DXF 70 (entget ename '("*"))))))
      (progn
        (while ename
          (setq elist (entget ename '("*"))
                elist (subst '(8 . "0") (assoc 8 elist) elist)
                elist (if (assoc 62 elist)
                        (subst '(62 . 0) (assoc 62 elist) elist)
                        (append elist '((62 . 0)))))
          ;;  CAB added - filter (71 .1) from BLOCK
          (if (and (= (cdr(assoc 0 elist)) "BLOCK") (assoc 71 elist))
            (setq elist (vl-remove '(71 . 1) elist))
          );  end CAB add
          (entmake elist)
          (setq ename (entnext ename)))
          (if (= "ENDBLK" (DXF 0 elist)); CAB revised was /=
            T ; CAB added, might use this as a 'empty block' counter
            ;; ELSE return true if created successfully - CAB added
            (not(null(entmake '((0 . "ENDBLK") (8 . "0") (62 . 0)))))
            ;;(entmake '((0 . "ENDBLK") (8 . "0") (62 . 0))) ; CAB removed
          )
        ;;'T   CAB removed
        ); progn
      ); endif
  ); defun
 
 
  ;;=====================  Start  =======================
  (if (> (logand (DXF 70 (tblsearch "layer" "0")) 1) 0)
    (princ "\nLayer 0 must be thawed before running FIXBLOCK!\n")
    (progn
      (if
        (progn
          (princ "\nPress <Enter> to fix ALL defined blocks\n")
          (setq cnt 0
                ss (ssget '((0 . "INSERT")))))
        (progn
          (setq idx (sslength ss))
          (while (>= (setq idx (1- idx)) 0)
            (if (not (member (setq blkname (DXF 2 (entget (ssname ss idx)))) donelist))
              (progn
                (if (Update blkname) (setq cnt (1+ cnt)))
                (setq donelist (cons blkname donelist))))))
        (while (setq blkname (DXF 2 (tblnext "BLOCK" (not blkname))))
          (if (Update blkname) (setq cnt (1+ cnt)))))
      (princ (strcat "\n" (itoa cnt) " block" (if (= cnt 1) "" "s") " redefined\n"))))
  (princ)
)
(prompt "\nFix Block Loaded. Enter FixBlock to run.")
(princ)
;End-of-file
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.

David Bethel

  • Swamp Rat
  • Posts: 656
block group code 71?
« Reply #16 on: September 30, 2004, 02:13:24 PM »
Quote
as I understand it, it is the BLOCK definition ("AcDbBlockBegin") that has a code 71. Or maybe a "AcDbBlockTableRecord"?


That is a strange table definition.  How was is extracted?  -David
R12 Dos - A2K

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
block group code 71?
« Reply #17 on: September 30, 2004, 02:46:38 PM »
If you use the FixBlock routine and stop it here
Code: [Select]
         (setq elist (entget ename '("*"))
You will get this in elist:
Code: [Select]
((-1 . <Entity name: 1bb15e0>)
  (0 . "BLOCK")
  (330 . <Entity name: 1bb15d8>)
  (5 . "2FD4")
  (100 . "AcDbEntity")
  (67 . 0)
  (8 . "STRUCTURE-11")
  (62 . 1)
  (6 . "Continuous")
  (370 . 0)
  (100 . "AcDbBlockBegin")
  (70 . 0)
  (71 . 1)
  (10 0.0 0.0 0.0)
  (-2 . <Entity name: 1bb15e8>)
  (2 . "SHS218")
  (1 . "")
)
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.

David Bethel

  • Swamp Rat
  • Posts: 656
block group code 71?
« Reply #18 on: September 30, 2004, 02:57:22 PM »
Have you tried (entmakex)  -David
R12 Dos - A2K

V-Man

  • Bull Frog
  • Posts: 343
  • I exist therefore I am! Finally Retired!
block group code 71?
« Reply #19 on: September 30, 2004, 04:47:50 PM »
I use these to get to the data.

Code: [Select]

(defun C:ENTITY ( / e d)
(while (setq e (entsel "\nSelect entity: "))
(setq d (entget (car e)))
(foreach n d (princ n) (terpri))
)
(princ)
)

(defun C:OBJECT ( / e o)
(while (setq e (entsel "\nSelect object: "))
(setq o (vlax-ename->vla-object (car e)))
(vlax-dump-object o T)
)
(princ)
)
AutoCAD 9 - 2023, AutoCADMap 2008 - 2010, Revit 2012 - 2022, Autocad Civil 3D 2023