Author Topic: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD  (Read 6451 times)

0 Members and 1 Guest are viewing this topic.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
After a few hours of manual work I managed to isolate the bad entity that put the program in fatal error,
Is there a way to find these entities with Lisp and correct them?

Tested with Open/Recover/Inser + DxfOut/DxfIn:

AutoCAD 2017/18/19 + ODBX AutoCAD/BricsCAd > Fatal error

AutoCAD 2013 + Bricscad (all)              > OK

Edit: in AutoCAD 2013 if copy or move the hatch I get a Fatal Error.

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #1 on: July 19, 2018, 01:23:23 PM »
I don't know myself, but I am definitely interested to find out if anyone else knows as it would be a huge help with drawings we get from others.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #2 on: July 19, 2018, 01:28:12 PM »
I don't know myself, but I am definitely interested to find out if anyone else knows as it would be a huge help with drawings we get from others.
Sorry but I did not understand what you mean. Can you rewrite it in a different way?
(Sorry for my English)  :oops:

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #3 on: July 19, 2018, 01:30:52 PM »
No problem, I am saying that I don't have an answer for you, but I also want to know if someone can find a way to do this, as we receive a lot of drawings from outside companies and a lot of times they have these entities that cause AutoCAD to crash like this and it would be very helpful to be able to find them quickly.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #4 on: July 19, 2018, 01:39:26 PM »
No problem, I am saying that I don't have an answer for you, but I also want to know if someone can find a way to do this, as we receive a lot of drawings from outside companies and a lot of times they have these entities that cause AutoCAD to crash like this and it would be very helpful to be able to find them quickly.
Thanks for the answer I fully agree with what you said, the original DWG was full of null blocks and other things from Microstation, Genius, etc. I managed to eliminate everything other than the evil hatches…
L'applicazione: AME_SOL è stata eliminata. 
L'applicazione: GENIUS_GENOBJ-N-FIL_13 è stata eliminata. 
L'applicazione: AEC_XDATA_BOUND_SPACE è stata eliminata. 
L'applicazione: GENIUS_GENODEF_13 è stata eliminata. 
L'applicazione: AcAecLayerStandard è stata eliminata. 
L'applicazione: ACAD_DGNLS è stata eliminata. 
L'applicazione: AcDbBlockRepETag è stata eliminata. 
L'applicazione: RAK è stata eliminata. 

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #5 on: July 19, 2018, 01:43:13 PM »
Do you by chance have a LISP routine that eliminates all of those things automatically? If so, could you post it? I think it would be great to have and who knows maybe I could look at it and find a way to modify it to deal with the hatches as well.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #6 on: July 19, 2018, 04:24:08 PM »
Opening the dwg with ODBX in BricsCAD V18 I do not experience a fatal error. 'Dumping' the object also works fine.

The regenerated boundary of the hatch looks peculiar and may provide a clue to the cause of the crash.  Maybe the spline portions are the problem? If so, you could check for the presence of (72 . 4) in the entity list.

Also: Regenerating the boundary causes the hatched area to change: the hole in the pattern is now filled and the area around it empty. This might also explain the crash.

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #7 on: July 20, 2018, 01:07:14 PM »
Do you by chance have a LISP routine that eliminates all of those things automatically? If so, could you post it? I think it would be great to have and who knows maybe I could look at it and find a way to modify it to deal with the hatches as well.
I have functions that I have found here over several years:

http://www.theswamp.org/index.php?topic=50731.msg558659;topicseen#msg558659
http://www.theswamp.org/index.php?topic=44371.msg496225#msg496225
http://www.theswamp.org/index.php?topic=43362.msg485896#msg485896
http://www.theswamp.org/index.php?topic=51529.msg566265#msg566265
http://www.theswamp.org/index.php?topic=53948.msg585974;topicseen#msg585974

Search:
LayerFiltersDelete
DeleteAllXRecs
ACAD_LAYERSTATES
;////////////////////////////////////////////////////////////////////////////
;  c:RenameNullTables
;  Copyright (c) 2003 - Michael Puckett - All Rights Reserved
;////////////////////////////////////////////////////////////////////////////

Code: [Select]
;
; PrmFlg = T > prompt attivati
;
(defun ALE_Fix_DictPurge (PrmFlg)
  (and PrmFlg (dictremove (namedobjdict) "ACAD_DATALINK"             ) (prompt "\nDict: ACAD_DATALINK pulito.  "             ))
  (and PrmFlg (dictremove (namedobjdict) "AEC_DISP_REPS"             ) (prompt "\nDict: AEC_DISP_REPS pulito.  "             ))
  (and PrmFlg (dictremove (namedobjdict) "AEC_DISPLAY_PROPS_DEFAULTS") (prompt "\nDict: AEC_DISPLAY_PROPS_DEFAULTS pulito.  "))
  (and PrmFlg (dictremove (namedobjdict) "ACAD_SCALELIST"            ) (prompt "\nDict: ACAD_SCALELIST pulito.  "            ))
  (and PrmFlg (dictremove (namedobjdict) "ACAD_DGNLINESTYLECOMP"     ) (prompt "\nDict: ACAD_DGNLINESTYLECOMP pulito.  "     ))
)
;
; PrmFlg = T > prompt attivati
;
(defun ALE_Fix_AuditPurge (PrmFlg)
  (vlax-invoke-method *AcAcDwg* 'AuditInfo :vlax-true)
  (repeat 3 (vlax-invoke-method *AcAcDwg* 'PurgeAll))
  (and PrmFlg (prompt "\nPurgeAll eseguito.  "))
  (princ)
)

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #8 on: July 20, 2018, 01:13:09 PM »
Opening the dwg with ODBX in BricsCAD V18 I do not experience a fatal error. 'Dumping' the object also works fine.

The regenerated boundary of the hatch looks peculiar and may provide a clue to the cause of the crash.  Maybe the spline portions are the problem? If so, you could check for the presence of (72 . 4) in the entity list.

Also: Regenerating the boundary causes the hatched area to change: the hole in the pattern is now filled and the area around it empty. This might also explain the crash.
Thanks for test, Yes I confirm no problems V18/ODBX with attached file,  I had problems with the complete DWG and so the problem is still another ... and it is very difficult to identify it …
unfortunately I can not post the whole file, I will try to investigate further.
Grazie.  :-)

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #9 on: July 20, 2018, 07:53:58 PM »
Ok, I have taken a stab at a CleanDrawing routine, but I am getting an error message: Error: bad argument type: VLA-object collection: nil

If no one has looked at it by Monday, I will go back to trying and I am sure there is more that can be added, ultimately I just want a single routine that can clean up the messes that we get from outside consultants from time to time.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #10 on: July 21, 2018, 05:54:04 AM »
Line 197:
Code: [Select]
(vlax-for lay lyc ...Line 213:
Code: [Select]
(setq lyc ...)

ribarm

  • Gator
  • Posts: 3225
  • Marko Ribar, architect
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #11 on: July 21, 2018, 06:58:20 AM »
If Roy is suggesting that (setq ... ) should be before (vlax-for ...) and if that is the only thing, I've localized main function and I've changed ident formatting to be a little more concise and for me better for reading...
Marko Ribar, d.i.a. (graduated engineer of architecture)

:)

M.R. on Youtube

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #12 on: July 23, 2018, 11:37:52 AM »
Ok, I have taken a stab at a CleanDrawing routine, but I am getting an error message: Error: bad argument type: VLA-object collection: nil

If no one has looked at it by Monday, I will go back to trying and I am sure there is more that can be added, ultimately I just want a single routine that can clean up the messes that we get from outside consultants from time to time.
I managed to open my (complete) file only by deleting all the hatches (I also tried the Convert command but without success).
AutoCad Recover/Audit fix some errors BUT the errors still be in the file...
Code: [Select]
Pass 1 31600   objects audited
Invalid block name "PLANCIA " found.
  Changed to "AUDIT_I_180723164356-0".
Pass 1 58000   objects auditedAcDbLeader(15C9EC)  annotation id Bad mtext id          Disable annotation
AcDbLeader(15C9EE)  annotation id Bad mtext id          Disable annotation
AcDbLeader(15C9F0)  annotation id Bad mtext id          Disable annotation
AcDbLeader(15C9F2)  annotation id Bad mtext id          Disable annotation
AcDbLeader(15C9F4)  annotation id Bad mtext id          Disable annotation
AcDbLeader(15C9F6)  annotation id Bad mtext id          Disable annotation
AcDbLeader(15C9F9)  annotation id Bad mtext id          Disable annotation
AcDbLeader(15CA17)  annotation id Bad mtext id          Disable annotation
Pass 1 88100   objects auditedAcDbLeader(23232B)  annotation id Bad mtext id          Disable annotation
Pass 1 88500   objects auditedAcDbLeader(2324F6)  annotation id Bad mtext id          Disable annotation
Pass 1 96000   objects audited
Auditing Entities Pass 2

Pass 2 5700    objects auditedAcDbMText(60ED1)
       Extension dictionary 60ECE Not this object       Set to this
Pass 2 96000   objects audited
Auditing Blocks
2673    Blocks audited
I have test your program (modified by Ribarm and similar to those I've tried) and if I save the drawing I get:

 *Warning* Multiply owned object, handle "60ECE"

(entget (handent "60ECE"))
((-1 . <Entity name: 143a9c7b260>) (0 . "DICTIONARY") (330 . <Entity name: 143a9c7b290>)
(5 . "60ECE") (100 . "AcDbDictionary") (280 . 1) (281 . 1) (3 . "AcDbContextDataManager")
(360 . <Entity name: 143a9c7b270>))

So I have tested >  Nettoyer en profondeur un dessin JAV V3.34  (C) Patrick_35
and after if I save I get many Undefined shapes messages:
** Undefined shape nn

So now I can open the file in all version of AutoCAD but if I save I still get ** Undefined shape nn messages...

cmwade77

  • Swamp Rat
  • Posts: 1443
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #13 on: July 23, 2018, 12:19:34 PM »
Ok, after some very deep digging and using the wayback machine I was able to dig up an old routine that may solve the issue, I have made a slight tweak to it so that it also handles mtext. Please make sure you are testing this on a copy of your file and not the original just to be safe.

Please see the attached, updated version of CleanDrawing, this should eliminate all SHX issues with any luck, not positive though.

Edit: I have changed this to add the command CleanDrawingH that also removes all hatches before cleaning the drawing.
« Last Edit: July 23, 2018, 01:42:24 PM by cmwade77 »

Marc'Antonio Alessi

  • Swamp Rat
  • Posts: 1451
  • Marco
Re: Strange Hatch > Fatal Error on AutoCAD & ODBX, not in BricsCAD
« Reply #14 on: July 26, 2018, 11:12:33 AM »
Ok, after some very deep digging and using the wayback machine I was able to dig up an old routine that may solve the issue, I have made a slight tweak to it so that it also handles mtext. Please make sure you are testing this on a copy of your file and not the original just to be safe.

Please see the attached, updated version of CleanDrawing, this should eliminate all SHX issues with any luck, not positive though.

Edit: I have changed this to add the command CleanDrawingH that also removes all hatches before cleaning the drawing.
Thanks, I have tested your new version but not luck with shapes...
I would suggest you make these changes:
...
  (setq dict (namedobjdict))
  (setq data (entget dict))
  (setq NameList (list "ACAD_IMAGE_DICT" ...)
  (setq lst nil);<<<< reset lst variable because it is used before
  (foreach name NameList
...
  (vl-cmdf "._-scalelistedit" "_R" "_Y" "_E");<<< _Y
...
Thanks again.  :-) :-) :-)