TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Lupo76 on April 13, 2021, 01:15:02 AM
-
Hi,
I have been using this simple code for many years and it has always worked correctly.
However when used with an arc dimension, AutoCAD (various versions) crashes :-o
The same code with the same context works fine in BricsCAD
(defun c:test ()
(setq ogg (car (entsel)))
(DeleteXdata "EMILISPCA" ogg)
)
(defun DeleteXdata (appname ent /)
(entmod (list (cons -1 ent)(list -3 (list appname))))
(princ)
)
I attach a dwg file, the lsp file and a video showing the crash.
Can anyone help me understand or work around the problem?
Thank you!
-
"ARC_DIMENSION" has "ACAD" Xdata, maybe you need to remove only your Xdata "EMILISPCA"
(-3
(
"ACAD"
(1000 . "DSTYLE")
(1002 . "{")
(1070 . 40)
(1040 . 50.0)
(1070 . 144)
(1040 . 1.0)
(1002 . "}")
)
(
"EMILISPCA"
(1000 . "TIPOOGG=QUOTEFERRO")
(1000 . "IDFERRO=DEFAULT_1")
(1000 . "UM_QUOTE=cm")
)
)
Try an audit, the dwg has many errors:
...
Name: AcDbBlockGripExpr(45E)
Value: Double - 1.79769e+307
Validation: Invalid
Replaced by: Set to 0
Name: AcDbBlockGripExpr(45F)
Value: Double - 1.79769e+307
Validation: Invalid
Replaced by: Set to 0
...
-
Hi Marc'Antonio,
I confirm that I only have to remove my "EMILISPCA" Xdata.
The AUDIT command finds no errors in my file which was made from scratch, so the presence of errors would be very strange:
Comando: _AUDIT
Correggere qualsiasi errore trovato? [Ś/No] <N>: S
Verifica dell'intestazione
Verifica delle tabelle
Verifica delle entità della fase 1
Fase 1 1100 oggetti controllati
Verifica delle entità della fase 2
Fase 2 1100 oggetti controllati
Verifica dei blocchi
41 blocchi verificati
Verifica di AcDsRecords
Totale di 0 errori trovati: 0 corretti
Oggetti cancellati 0
Comando:
Furthermore, the crash also occurs on a new empty file by creating a new ARC_DIMENSION object.
-
...
The AUDIT command finds no errors in my file which was made from scratch, so the presence of errors would be very strange:
Comando: _AUDIT
Correggere qualsiasi errore trovato? [Ś/No] <N>: S
Verifica dell'intestazione
Verifica delle tabelle
Verifica delle entità della fase 1
Fase 1 1100 oggetti controllati
Verifica delle entità della fase 2
Fase 2 1100 oggetti controllati
Verifica dei blocchi
41 blocchi verificati
Verifica di AcDsRecords
Totale di 0 errori trovati: 0 corretti
Oggetti cancellati 0
Comando:
BricsCAD V20 on TEST CON ARCO2.dwg:
: _audit
Fix any errors detected? [Yes/No] <No>:y
Name: AcDbBlockGripExpr(45E)
Value: Double - 1.79769e+307
Validation: Invalid
Replaced by: Set to 0
Name: AcDbBlockGripExpr(45F)
Value: Double - 1.79769e+307
Validation: Invalid
Replaced by: Set to 0
Name: AcDbBlockGripExpr(465)
Value: Double - 1.79769e+307
Validation: Invalid
Replaced by: Set to 0
Name: AcDbBlockGripExpr(466)
Value: Double - 1.79769e+307
Validation: Invalid
Replaced by: Set to 0
Name: AcDbBlockGripExpr(474)
Value: Double - 1.79769e+307
Validation: Invalid
Replaced by: Set to 0
Name: AcDbBlockGripExpr(475)
Value: Double - 1.79769e+307
Validation: Invalid
Replaced by: Set to 0
Name: AcDbBlockGripExpr(47C)
Value: Double - 1.79769e+307
Validation: Invalid
Replaced by: Set to 0
Name: AcDbBlockGripExpr(47D)
Value: Double - 1.79769e+307
Validation: Invalid
Replaced by: Set to 0
Name: AcDbProxyObject(6A3)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6A0)
Name: AcDbProxyObject(6B3)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6A0)
Name: AcDbProxyObject(6B6)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6A0)
Name: AcDbProxyObject(6B7)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6A0)
Name: AcDbProxyObject(6B8)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6A0)
Name: AcDbProxyObject(6B9)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6A0)
Name: AcDbProxyObject(6BA)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6A0)
Name: AcDbProxyObject(6BF)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6A0)
Name: AcDbProxyObject(6C0)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6A0)
Name: AcDbProxyObject(6C1)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6A0)
Name: AcDbProxyObject(6C2)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6A0)
Name: AcDbProxyObject(6C3)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6A0)
Name: AcDbProxyObject(708)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6D9)
Name: AcDbProxyObject(709)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6D9)
Name: AcDbProxyObject(707)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6D9)
Name: AcDbProxyObject(70A)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6D9)
Name: AcDbProxyObject(705)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6D9)
Name: AcDbProxyObject(704)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6D9)
Name: AcDbProxyObject(706)
Value: Owner Id (0)
Validation: Invalid
Replaced by: Set to AcDbProxyObject(6D9)
1116 objects audited
Total errors found during audit 27, fixed 27[code]
-
BricsCAD works correctly.
The problem is in AutoCAD... :-(
-
No errors on audit here either but did crash AutoCAD 2022.
-
Hi Marc'Antonio,
I confirm that I only have to remove my "EMILISPCA" Xdata.
…
Furthermore, the crash also occurs on a new empty file by creating a new ARC_DIMENSION object.
Try this:
(defun ALE_RemoveXdata (EntNam AppNam / EntLst TmpLst)
(setq EntLst (entget EntNam (list AppNam)))
(foreach ForElm (cdr (assoc -3 EntLst))
(setq
TmpLst (cons -3 (list (cons (car ForElm) nil)))
EntLst (entmod (subst TmpLst (assoc -3 EntLst) EntLst))
)
)
(setq EntLst (entmod (reverse (cdr (reverse EntLst)))))
(entupd (cdr (assoc -1 EntLst)))
)
(defun c:test2 ( / EntNam)
(setq EntNam (car (entsel)))
(ALE_RemoveXdata EntNam "EMILISPCA")
)
-
No errors on audit here either but did crash AutoCAD 2022.
which version of BricsCAD?
Tested on V19 > less errors...:
: _audit
Correggere gli eventuali errori rilevati? [Si/No] <No>:s
Nome: AcDbBlockGripExpr(45E)
Valore: Double - 1.79769e+307
Validazione: Non valido
Sostituito da: Impostato a 0
Nome: AcDbBlockGripExpr(45F)
Valore: Double - 1.79769e+307
Validazione: Non valido
Sostituito da: Impostato a 0
Nome: AcDbBlockGripExpr(465)
Valore: Double - 1.79769e+307
Validazione: Non valido
Sostituito da: Impostato a 0
Nome: AcDbBlockGripExpr(466)
Valore: Double - 1.79769e+307
Validazione: Non valido
Sostituito da: Impostato a 0
Nome: AcDbBlockGripExpr(474)
Valore: Double - 1.79769e+307
Validazione: Non valido
Sostituito da: Impostato a 0
Nome: AcDbBlockGripExpr(475)
Valore: Double - 1.79769e+307
Validazione: Non valido
Sostituito da: Impostato a 0
Nome: AcDbBlockGripExpr(47C)
Valore: Double - 1.79769e+307
Validazione: Non valido
Sostituito da: Impostato a 0
Nome: AcDbBlockGripExpr(47D)
Valore: Double - 1.79769e+307
Validazione: Non valido
Sostituito da: Impostato a 0
1116 oggetti controllati
Errori totali rilevati durante la verifica 8, risolti 8
-
I don't have Bricscad. Did the audit using AutoCAD 2022.
-
Try this:
(defun ALE_RemoveXdata (EntNam AppNam / EntLst TmpLst)
(setq EntLst (entget EntNam (list AppNam)))
(foreach ForElm (cdr (assoc -3 EntLst))
(setq
TmpLst (cons -3 (list (cons (car ForElm) nil)))
EntLst (entmod (subst TmpLst (assoc -3 EntLst) EntLst))
)
)
(setq EntLst (entmod (reverse (cdr (reverse EntLst)))))
(entupd (cdr (assoc -1 EntLst)))
)
(defun c:test2 ( / EntNam)
(setq EntNam (car (entsel)))
(ALE_RemoveXdata EntNam "EMILISPCA")
)
Hi Marc'Antonio,
thanks to your function I was able to work around the AutoCAD bug and solve the problem!
Thank you!
-
Hi Marc'Antonio,
thanks to your function I was able to work around the AutoCAD bug and solve the problem!
Thank you!
:) It was an old question... http://www.theswamp.org/index.php?topic=41456.msg465573#msg465573 (http://www.theswamp.org/index.php?topic=41456.msg465573#msg465573)
IMHO I think this is not a Bug 8)
-
:) It was an old question... http://www.theswamp.org/index.php?topic=41456.msg465573#msg465573 (http://www.theswamp.org/index.php?topic=41456.msg465573#msg465573)
IMHO I think this is not a Bug 8)
It was my post! I had completely forgotten it.
It came up again on a referral from a client of mine.
In my opinion this is a bug, my code works with all object types except ARC_DIMENSION, I see no reason to think this is normal.
Also the problem only occurs in AutoCAD, while BricsCAD has no problem here.
Also, again in my opinion, a system crash is always a bug as it is something unexpected.
-
:) It was an old question... http://www.theswamp.org/index.php?topic=41456.msg465573#msg465573 (http://www.theswamp.org/index.php?topic=41456.msg465573#msg465573)
IMHO I think this is not a Bug 8)
It was my post! I had completely forgotten it.
It came up again on a referral from a client of mine.
In my opinion this is a bug, my code works with all object types except ARC_DIMENSION, I see no reason to think this is normal.
Also the problem only occurs in AutoCAD, while BricsCAD has no problem here.
Also, again in my opinion, a system crash is always a bug as it is something unexpected.
The difference is that BricsCAD NEVER removes "ACAD" Xdata ... and I don't know (and I've never tried) if it allows their modification...