TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Marc'Antonio Alessi on March 04, 2021, 12:36:41 PM
-
(defun C:Test ( / BlockEnt BlockDat BlockObj)
(setq
BlockEnt (car (entsel))
BlockDat (entget BlockEnt)
BlockObj (vlax-ename->vla-object BlockEnt)
)
(princ (strcat "\nBefore > Dxf 66 : " (itoa (cdr (assoc 66 BlockDat)))))
(princ "\nBefore > HasAttributes: ") (princ (vla-get-hasattributes BlockObj))
(foreach ForElm (vlax-invoke BlockObj 'getattributes)
(vl-catch-all-apply 'vla-delete (list ForElm))
)
(princ (strcat "\nAfter1 > Dxf 66 : " (itoa (cdr (assoc 66 BlockDat)))))
(princ "\nAfter > HasAttributes: ") (princ (vla-get-hasattributes BlockObj))
(entupd BlockEnt)
(princ (strcat "\nAfter2 > Dxf 66 : " (itoa (cdr (assoc 66 BlockDat)))))
(princ)
)
BricsCAD
Before > Dxf 66 : 1
Before > HasAttributes: :VLAX-TRUE
After1 > Dxf 66 : 1
After > HasAttributes: :VLAX-FALSE <<<
After2 > Dxf 66 : 1
AutoCAD
Before > Dxf 66 : 1
Before > HasAttributes: :vlax-true
After1 > Dxf 66 : 1
After > HasAttributes: :vlax-true <<<
After2 > Dxf 66 : 1
In BricsCAD I get this error: >>> Edit: only if I delete attribs in AcDbBlockTableRecord see replay #3
Name: AcDbBlockTableRecord(3E9D7)
Value: hasAttributeDefinitions flag is true, but record has no AttributeDefinitions
Validation: Disparity
Replaced by: Set to False >>> but it IS recovered!
how to avoid this problem?
-
Entmake a new INSERT.
-
Entmake a new INSERT.
Thanks, I'm working on this topic because there are some differences between BricsCAD and AutoCAD and I have to correct what I wrote:
Name: AcDbBlockTableRecord(3E9D7)
Value: hasAttributeDefinitions flag is true, but record has no AttributeDefinitions
Validation: Disparity
Replaced by: Set to False
this error occurred after Audit if I delete all the attributes in the block definition (BLOCK) and not in the inserted block (INSER), as soon as I have some other news I will write it.
Marco
-
Here I am, if I use this function to delete attribs in AcDbBlockTableRecord:
; VlaBlk > AcDbBlockTableRecord > #<VLA-OBJECT IOdaBlock 0000000039FF2400>
;
(defun test2 (VlaBlk)
(vlax-for ObjFor VlaBlk
(if (= "AcDbAttributeDefinition" (vla-get-objectname ObjFor))
(progn
(princ " Attrib > ") (prin1 (vla-get-TextString ObjFor)) (princ "\n")
(prin1 (vl-catch-all-apply 'vla-delete (list ObjFor)))
)
(progn (princ " Other > ") (prin1 (vla-get-objectname ObjFor)) (princ "\n"))
)
)
(princ)
)
After audit I get this error ONLY in BricsCAD (tested in V20) the error IS recovered!
Name: AcDbBlockTableRecord(3E9D7)
Value: hasAttributeDefinitions flag is true, but record has no AttributeDefinitions
Validation: Disparity
Replaced by: Set to False
-
Obviously a bug. The 'hasAttributeDefinitions flag' is actually stored on the "BLOCK" entity (gc 70). But I am not able to entmod it.
This code does not work (BricsCAD V18).
(defun FixBlkDef
(blkDef
/ elst
) elst
)
)
)
-
Maybe it is not possible with Lisp, I do not see a "HasAttributeDefinitions" property.