Author Topic: Looking for approach to AUDIT DWG file  (Read 8973 times)

0 Members and 1 Guest are viewing this topic.

slappy

  • Guest
Looking for approach to AUDIT DWG file
« on: June 09, 2010, 01:15:31 PM »
I have fruitlessly spent a lot of time looking through ObjectARX SDK, Internet Forms, and Documentation; and have come to the following conclusions:
  • No one has ever written code to this respect.  (Highly unlikely)
  • This code is not necessary.  (Maybe, but why the AUDIT method)
  • The process for doing it is so simple no one has thought it necessary to post it.
All that aside, I know the Database object has an Audit method, however it wants Auditinfo to process.  So my conundrum is to:
First, get the AuditInfo and Second process it correctly.

I've tried Cast and Ctype to iterate the database, but the object type to access eludes me.

Pardon if this makes no sense.  Slowly picking up this .Net thing.  Please, any code jargon be VB.NET form, as C# is learning for another day.

Thanks,
Chris

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Looking for approach to AUDIT DWG file
« Reply #1 on: June 09, 2010, 02:37:06 PM »
what exactly are you trying to audit?  I ask because if your just trying to do a regular audit, use acads version
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

Glenn R

  • Guest
Re: Looking for approach to AUDIT DWG file
« Reply #2 on: June 09, 2010, 03:15:16 PM »
I have 2010 and unless it's implemented in 2011, the ARX documentation for 2010 says it's not currently implemented.

You could use the ActiveX implementation.

slappy

  • Guest
Re: Looking for approach to AUDIT DWG file
« Reply #3 on: June 09, 2010, 03:18:13 PM »
what exactly are you trying to audit?  I ask because if your just trying to do a regular audit, use acads version

I'm developing a batch processor to do various things.  Typically to Archive our closed projects, which includes a complete Purge (see this post), Audit, Bind Xrefs, etc...  Preferable without opening any DWG files in AutoCAD.  Using a sendcommand or similar would require opening, yes?  So to answer your question: Audit the whole drawing and fix the errors.

Although to be honest not opening the file is becoming a pain.

Chris

slappy

  • Guest
Re: Looking for approach to AUDIT DWG file
« Reply #4 on: June 09, 2010, 03:22:48 PM »
I have 2010 and unless it's implemented in 2011, the ARX documentation for 2010 says it's not currently implemented.

You could use the ActiveX implementation.

I noticed that too, although does your response indicate it's not possible?

ActiveX?  As in VBA?  Or is there a reference to ActiveX available in .NET.
The reason for VB.NET is because we are migrating to 64bit and vba is a dog in 64bit.

Chris

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Looking for approach to AUDIT DWG file
« Reply #5 on: June 09, 2010, 05:20:10 PM »
Look at the AutoCAD .NET Developer's Guide
Introduction > Overview of Microsoft Visual Studio > Use COM Interoperability with .NET
Speaking English as a French Frog

slappy

  • Guest
Re: Looking for approach to AUDIT DWG file
« Reply #6 on: June 10, 2010, 12:53:23 PM »
Look at the AutoCAD .NET Developer's Guide
Introduction > Overview of Microsoft Visual Studio > Use COM Interoperability with .NET

Pardon my ignorance, but doesn't using Interop require the document be open?  Maybe it's the way I was using it?

Thanks
Chris

Glenn R

  • Guest
Re: Looking for approach to AUDIT DWG file
« Reply #7 on: June 10, 2010, 02:52:03 PM »
When you say you don't want the document to be 'open', what exactly do you mean?

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Looking for approach to AUDIT DWG file
« Reply #8 on: June 10, 2010, 04:40:33 PM »
I think hes thinking of ObjectDBX thingy
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

slappy

  • Guest
Re: Looking for approach to AUDIT DWG file
« Reply #9 on: June 10, 2010, 04:45:13 PM »
When you say you don't want the document to be 'open', what exactly do you mean?

Open AutoCAD, netload dll, select list of files, audit each one without opening them in AutoCAD, saveas.

Somewhat works with purge and xref bindings(another subject) but not audit.

Thanks
C

slappy

  • Guest
Re: Looking for approach to AUDIT DWG file
« Reply #10 on: June 10, 2010, 04:46:40 PM »
...thingy

Is that a Method, Class, or Object?   :lmao:

Glenn R

  • Guest
Re: Looking for approach to AUDIT DWG file
« Reply #11 on: June 10, 2010, 05:07:57 PM »
Open AutoCAD, netload dll, select list of files, audit each one without opening them in AutoCAD, saveas.

Well, you're actually opening them in AutoCAD, it just depends whether you want it to open them graphically or not and judging by your response, not.

Okay then, not graphically, which means you're reading in a DWG file and it will NOT have a Document object associated with it. You will find, as I suspect you already have, that batch processing drawings, even in the editor, let alone non-graphically, is not such an easy thing, especially for somebody who's new to this.

Having said that, as I understand you're requirements, you have the following choices:

1. I think ScriptPro is still shipped with AutoCAD (you will have to check), so you could be able to use it to write a script that audits, purges and binds, across a selection of drawings. This can have problems ie. audit hits something ugly and crashes is my first thought. Second, purging might not get everything - it did require multiple passes in previous releases; not sure now. As far as binding goes, well that's a subject I've commented on extensively on this board - search.

2. Write a .NET program to Audit, Bind and Purge - not particularly easy if you really want to make it robust. Binding has it's own issues - see point 1 above. With respect to purging, yes you can do it, as has been shown on here recently by Gile I believe, if memory serves, but you have to be meticulous. As far as doing an Audit goes, yes, you can reference the AutoCAD COM type library and use it in your .NET code (one of the features of .NET and it's compatibility), but I don't know if that would even work if you're opening a drawing as a database (ie. non-graphically), as the ActiveX documentation requires a Document object from memory for the AuditInfo method, which you won't have, if you read the drawing via ActiveX's ObjectDBX's methods.

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Looking for approach to AUDIT DWG file
« Reply #12 on: June 10, 2010, 05:39:30 PM »
Note that 'Recover' will find problems that Audit doesn't find.
Opendesign has a "sniffer" that works with older drawings and doesn't require AutoCAD. http://www.opendesign.com/guestfiles
It would be great to have something similar for newer formats and .NET compatible.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

slappy

  • Guest
Re: Looking for approach to AUDIT DWG file
« Reply #13 on: June 11, 2010, 10:23:10 AM »
Open AutoCAD, netload dll, select list of files, audit each one without opening them in AutoCAD, saveas.
1. I think ScriptPro is still shipped with AutoCAD (you will have to check), so you could be able to use it to write a script that audits, purges and binds, across a selection of drawings. This can have problems ie. audit hits something ugly and crashes is my first thought. Second, purging might not get everything - it did require multiple passes in previous releases; not sure now. As far as binding goes, well that's a subject I've commented on extensively on this board - search.
I could use scripts, but I was hoping for something faster.
Quote
2. Write a .NET program to Audit, Bind and Purge - not particularly easy if you really want to make it robust. Binding has it's own issues - see point 1 above. With respect to purging, yes you can do it, as has been shown on here recently by Gile I believe, if memory serves, but you have to be meticulous. As far as doing an Audit goes, yes, you can reference the AutoCAD COM type library and use it in your .NET code (one of the features of .NET and it's compatibility), but I don't know if that would even work if you're opening a drawing as a database (ie. non-graphically), as the ActiveX documentation requires a Document object from memory for the AuditInfo method, which you won't have, if you read the drawing via ActiveX's ObjectDBX's methods.

My research and testing agrees with you.  I will concede, and use COM.  Because ultimately will be easier and I can have a finished product for my users sooner.  However, this will be an ongoing project so I will inevitably be updating it for efficiency and "Robust"ness, as you say.  And hopefully, the API will improve to accommodate my needs.

To give you a little background.  I have a complete working program that does all of this and more in VBA.  And I've chosen this one to use as my pilot BECAUSE it's complex and it will allow me to cover more .net in a shorter period of time.  So I will not shy away because of complexity.  Call me stubborn. :evil:

Anyway, thanks for help.

Chris

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Looking for approach to AUDIT DWG file
« Reply #14 on: June 11, 2010, 09:54:56 PM »

1. I think ScriptPro is still shipped with AutoCAD (you will have to check), so you could be able to use it to write a script that audits, purges and binds, across a selection of drawings.

ScriptPro is available in 32bit. As it is a VB based program, AutoDesk have not produced a version for 64bit systems.

There is a program called 'AutoScript-for-AutoCAD' I've been meaning to have a look at .... If anyone has looked at it please post comments :)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.