Loading R2000 dwg

Loading R2000 dwg

Anonymous
Not applicable
1,154 Views
12 Replies
Message 1 of 13

Loading R2000 dwg

Anonymous
Not applicable

When loading a R2000 dwg I ge this error:-

Capture1.GIF

 

If I click OK I can continue to edit the drawing. This error is not fatal.

 

But if I try to load the drawing via my application (using COM) I do get an error

"File D:\My Drawings\00160000\2A.DWG is not a valid drawing file"

and I can't load it.

 

Any ideas?

0 Likes
1,155 Views
12 Replies
Replies (12)
Message 2 of 13

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

you can try

  • to start a sendcommand (I hate it, but sometimes we need it all) and start the command _RECOVER. Do all that only if the default open-sub does not work.
  • not to open it, but create a new drawing and insert the old one (don't forget, you have to load the layouts then separately!)

And no app can be fully prepared to work with drawings that are:

  • defect
  • raise an exception during loading

....except applications that a specialized in DWG-repairing 😉

 

First, I would verify what happend with this drawing and clean the errors .... before working with this DWG any single step more 😉

 

Good luck, - alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 3 of 13

Alfred.NESWADBA
Consultant
Consultant

>>>crosspost<<< where do we continue now?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 4 of 13

Anonymous
Not applicable

OK.

I tried to Recover the drawing and faults were found, but I could not save the drawing.

 

Capture2.GIF

 

But I still need to deal with this problem in my COM object.

The code is straightforward.

   Public Sub LoadDwg(ByVal FileName As String, ByVal LayoutName As String)
      Try
         App.Visible = True
         App.WindowState = AcWindowState.acMax
         If LayoutName = "" Then LayName = "Model" Else LayName = LayoutName
         App.Documents.Open(FileName, False)                                              '  with name of drawing to open (True= Read-Only)
      Catch ex As Exception
         If ex.Message.Contains("is not a valid drawing file") Then
            ShowWarning(FileName & " seems to be corrupt", "Load it manually and try using the Recover Command to put it right", e_Button.OKOnly, e_Image.Exclamation)
            Dim i As Integer = App.Documents.Count
            'App.Documents.Item(i).Close()
            App.Visible = True
            App.ZoomExtents()
            App.ActiveDocument.SendCommand(cnEsc & cnEsc & "_OPEN" & vbLf)
         End If
      End Try
   End Sub

 For the moment I am using the OPEN command and not RECOVER.

 

But if I try to load the drawing, I am told that AutoCAD has already loaded the drawing. The drawing is not visible despite ACAD being visible. Drawing1 (new dwg) is there and I can close it.

 

If I stop execution of my code, App returns, but App.Documents creates error. I can't see how to close the failing drawing.

 

So 2 problems.

Recovering the drawing

Recovering the application

 

Thanks very much in advance.

0 Likes
Message 5 of 13

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> but I could not save the drawing

Can you upload such a drawing? It's difficult to imagine what a proggi does if that would have a file I don't have.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 6 of 13

Anonymous
Not applicable

Actually it was a R13 drawing. And as far as I remember no custom objects (were there any then?) etc.

 

I couldn't WBlock it, but I could DXF it out, and so I DXFin and saved.

Now its fine.

 

But - why does AUTO_CONVERTOLDMATERIALS crash? Doesn't it have internal error checking.

 

And why doesn't Acad allow a save etc.

 

and I still don't know how to deal with this sort of error in code?

0 Likes
Message 7 of 13

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> But - why does AUTO_CONVERTOLDMATERIALS crash?

One reason may be: also Autodesk development-people are also "only" humans; another reason could be that the drawing is defect ... and that you can't save it makes me thinking that the second reason is the more important one.

 

>> And why doesn't Acad allow a save etc.

Once more ... without playing with this DWG(s) it's not possible (for me) to tell you anything, just as a guess: same like above ==> is this R13-DWG defect?

 

>> and I still don't know how to deal with this sort of error in code?

As long as you don't write an app for "repairing drawings" you should come back to the goal of your app.

If a user runs your app with defect drawings, he has to repair them before starting your app. Do a perfect error handling that your app does not crash when trying to open such DWGs, but that's it.

If there are multiple defect drawings you could try _DWGCONVERT to get them cleaned?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 8 of 13

Anonymous
Not applicable

Thanks for your help.

 

Actually most of the dwgs in this folder are R13 and I am having problems with many of them.

If I may, I'll come back to this if I find out something interesting.

0 Likes
Message 9 of 13

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

did you think about "new drawing" and "insert old one"?

Have you tried _DWGCONVERT if there is a chance to prepare the drawing in this way automatically before proceeding with your app?

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 10 of 13

Anonymous
Not applicable

Gosh, that seems to be a complicated solution.

 

However, I created a DXF file and had a look at it.

I note that it refers to font files that don't exist. (the path is not there). The drawings were copied from another computer.

 

Could this be the reason?

0 Likes
Message 11 of 13

Alfred.NESWADBA
Consultant
Consultant

Hi,

 

>> I note that it refers to font files that don't exist.

I don't think so because if fonts are missing there is on one side the technique to get them replaced by a font that exists plus on the other side it has nothing to do with the material-arx crash.

But I have not looked into the DXF, if you find there some material-definitions and you can remove them without damaging the DXF .... that could be a solution.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes
Message 12 of 13

Anonymous
Not applicable

You are quite right. Autocad replaces faulty fonts with default fonts.

 

Looking at the drawing (I dxfout and in) all I use that might be special are 3D Faces. Remember R13 was pretty limited.

The DXF File referes to AVE_ENTITY_MATERIAL and AVE_MATERIAL as well as various AcDb objects, but this might be because the DXF file was not generated by R13.

 

However the interesting point for me is that trying to write code that other users might want, I have to assume that somewhere along the line, they might have similar problems.

 

Can I error check this, and more importantly, can I write code to put these problems right without too much intervention from the user?

 

What do you think?

 

 

ps TrueView 2012 has no problem viewing the dwg.

0 Likes
Message 13 of 13

Alfred.NESWADBA
Consultant
Consultant

HI,

 

>> can I write code to put these problems right without too much intervention from the user?

As long as you always have the same error ... yes, you should be able to create am error handling to make your app save from crashes. But if you have a lot of drawings ... and you found one error that creates an arx-exception then there may be more/different defects in these drawings and that get's hard.

 

Upload 2 or 3 of your drawings, Let's see what if there are some other ideas when looking into these DWGs.

 

- alfred -

------------------------------------------------------------------------------------
Alfred NESWADBA
ISH-Solutions GmbH / Ingenieur Studio HOLLAUS
www.ish-solutions.at ... blog.ish-solutions.at ... LinkedIn ... CDay 2026
------------------------------------------------------------------------------------

(not an Autodesk consultant)
0 Likes