generateusagedata messages

generateusagedata messages

fieldguy
Advisor Advisor
723 Views
5 Replies
Message 1 of 6

generateusagedata messages

fieldguy
Advisor
Advisor

I am using generateusagedata in a batch file scanner with ReadDwgFile.  I start an autocad session and netload the dll.  Sometimes generateusagedata generates a message that says "A vertex was added to a 2D pline" and the handle of the object.

I want to know the name of the file that was being scanned at that time. I should be able to use an event handler??  The editor is not doing anything.  The messages are on the screen when I check the batch results.

 

0 Likes
Accepted solutions (1)
724 Views
5 Replies
Replies (5)
Message 2 of 6

BKSpurgeon
Collaborator
Collaborator

> Sometimes generateusagedata generates a message that says "A vertex was added to a 2D pline" and the handle of the object.

 

  1. How is it that that particular method is returning that message? generateusagedata should just generate data for the IsUsed property of the layerTableRecord object - according to the documentation, so presumably (and I could be wrong here - there should not be a message about polylines and vertexes?)
  2. Perhaps post some code so that the issue can be replicated on someone else's PC? Otherwise it makes it harder to solve the problem.

 

rgds

 

 

 

0 Likes
Message 3 of 6

fieldguy
Advisor
Advisor

There's something different about "GenerateUsageData".  I see the progress bar flash by in the bottom right corner.  I don't understand why I see anything in the editor.  

I was working on a dwg sample but I can't replicate it.  I found the file using debug.  The handles belong to 4 zero length plines.    When I strip everything else out of the file I don't get the messages anymore.  Unfortunately I can't post it here.  Below is all the code required to generate the messages.  I'll resurrect this post in the future if I get any more information.  Thx

[CommandMethod("scanfiles")]
        static public void scanfiles()
        {
            string msg = "scanfiles";
            Document doc = Autodesk.AutoCAD.ApplicationServices.Core.Application.DocumentManager.MdiActiveDocument;
            Editor ed = doc.Editor;
            List<string> dwgfiles = new List<string>();
            dwgfiles.Add("c:\\temp\\bad_plines.dwg");
            dwgfiles.Add("c:\\temp\\bad_plines_ii.dwg");
            foreach (string d in dwgfiles)
            {
                Database scandb = new Database(false, true);
                try
                {
                    scandb.ReadDwgFile(d, System.IO.FileShare.Read, true, null);
                    msg += "\nfile open " + d;
                }
                catch
                {
                    msg += "\nfile not open " + d;
                    continue;
                }
                using (Transaction tr = scandb.TransactionManager.StartTransaction())
                {
                    // layers
                    LayerTable lt = (LayerTable)tr.GetObject(scandb.LayerTableId, OpenMode.ForRead);
                    lt.GenerateUsageData();
tr.Commit(); }// }// foreach ed.WriteMessage(msg); }// scanfiles - acad command

  

 

0 Likes
Message 4 of 6

BKSpurgeon
Collaborator
Collaborator

I have no idea.

 

I could not replicate that problem.

 

 

0 Likes
Message 5 of 6

ActivistInvestor
Mentor
Mentor
Accepted solution

Output the name of each file you process to the command line, and turn on console logging.

 


@fieldguywrote:

I am using generateusagedata in a batch file scanner with ReadDwgFile.  I start an autocad session and netload the dll.  Sometimes generateusagedata generates a message that says "A vertex was added to a 2D pline" and the handle of the object.

I want to know the name of the file that was being scanned at that time. I should be able to use an event handler??  The editor is not doing anything.  The messages are on the screen when I check the batch results.

 


 

0 Likes
Message 6 of 6

fieldguy
Advisor
Advisor

That works!  Thanks

0 Likes