catching an invalid entity name

catching an invalid entity name

JamesMaeding
Advisor Advisor
4,296 Views
27 Replies
Message 1 of 28

catching an invalid entity name

JamesMaeding
Advisor
Advisor

I have code that loops through a selection set, and it fails on drawings with slight corruption.

I ran AUDIT and it cleaned the corruption, but I want to detect what drawings have invalid entitiy names.

 

I tried many things, like:

(vl-catch-all-error-p (vl-catch-all-apply '(lambda () (SETQ OBJ (vlax-ename->vla-object (SSNAME CALLOUT-SS INDEX))))))

 

and so on, but those do not think there is an error.

But then this fails on same ename:

(SETQ ENAME (SSNAME CALLOUT-SS INDEX))

 

so the (vl-catch-all-apply... is not "catching", its letting the error by.

Any ideas on how to gracefully catch the invalid entity?

 

In my case, the invalid entity is a simple block with one attribute, not some huge AEC monster thingy.

I do want to keep this to lisp. I'm guessing its easy with .net.

thanks

 


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
4,297 Views
27 Replies
Replies (27)
Message 21 of 28

JamesMaeding
Advisor
Advisor

actually the test of getting the object "name" (vla-get-name... will cause an error I can catch.

My particular program trips on the darn invalid block definition in several places though, and I did not want to add in all the error checking needed.

Kind of a bittersweet ending.

 

I agree with Doug on working with corrupt drawings, its just that the file does not feel corrupt until my tool crashes, or you run an audit.

Meanwhile, those pesky aecc_parcels are sitting in the drawing.

Those passed by the Civil batch converter because you cannot explode them in a c3d session.

So its like one more thing I have to clean after the batch conversion. fun, fun.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

0 Likes
Message 22 of 28

SeeMSixty7
Advisor
Advisor

Yeah I remember when they came up with custom entities. I loved the idea, but then after all the proxy issues and OE's not providing a smooth interface on everything, like WriteBlock. It just got frustrating. I have stuck with Xdata in my app, but seriously considering moving into custom ents in my next iteration. I hate PROXIES though.

 

Civil 3D seems to drop them in every drawing it touches. Add in different versions an it gets even more fun.

 

Good luck

 

 

0 Likes
Message 23 of 28

JamesMaeding
Advisor
Advisor

I would not go to the dark "custom entity" side if I were you, unless you just like making users and cad managers hate you.

I have done many tools that seem like great fits for custom ents, but honestly I am not up the C++ learning curve, though I can read the code.

 

Instead, I make use of both xdata and xrecord data to teach one entity about another it should care about.

That thing of grouping entities that should stay grouped is a trick, and some of the games I play to do it took weeks to get ironed out.

Basic entities are so much better in the long run though.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 24 of 28

john.uhden
Mentor
Mentor
Aw, c'mon. You don't like AECC_CONTOURs?

Speaking of lost time, when I was at Hatch Mott MacDonald (now just Mott MacDonald) we had users waiting over 15 minutes to load a DWG from another consultant working on the WTC rebuild. Turns out that some other company had implanted over 320K or maybe it was 1.4M regapps. It took me like an hour to write something to purge the unreferenced ones, only to find out that Autodesk had added Regapps to the Purge command. Anyway, problem solved. Here's hoping for you.

John F. Uhden

0 Likes
Message 25 of 28

JamesMaeding
Advisor
Advisor

well, I actually have no problem with Autodesk doing custom objects for civil stuff, its just that they don't understand real life civil that well.

 

That regapp issue is one I have pursued for years, and is why autodesk wrote the regapp cleanup util.

About two years before they wrote it, the ADN group made me an exe that cleaned one file at a time without opening it in the editor (realdwg type open).

Then they stopped compiling that for me and showed .net code to do it, then Kean showed everyone on his blog how to.

The fact is, purging regapps on an open drawing typically either runs super slow, or locks up, particularly if the xrefs have the regapps too.

And guess what - the exact time you need to clean stuff, is because xrefs brought in the regapps.

Doing it on non-open drawings gets around all that, but Autodesk swept that issue under the carpet to let us struggle with for the rest of our days.

I just cleaned two files with 360k regapps yesterday that came from ignorant consultants.

Autodesk should learn by now you never let xrefs automatically add anything to the file xreffing them. When you detach an xref, ALL traces of it should be gone.


internal protected virtual unsafe Human() : mostlyHarmless
I'm just here for the Shelties

Message 26 of 28

john.uhden
Mentor
Mentor
Thanks for clearing up my memory, and yes, I agree with your opinions.
I'm still amazed that some clod programmer could/would fall into an abyss of proliferating regapps. Um, like how many do you need, one for each object?
Wanna bet it was the same guy/company with which we dealt? Thankfully I don't remember.

John F. Uhden

0 Likes
Message 27 of 28

Anonymous
Not applicable

You choose Triump or Hilary Clinton.? Smiley LOL

 

 

 

 

0 Likes
Message 28 of 28

john.uhden
Mentor
Mentor
I agree with a sign down my street, "Hillary for Prison."

John F. Uhden