Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

vla-get-effectivename fails with an error

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
mdhutchinson
984 Views, 7 Replies

vla-get-effectivename fails with an error

I am checking for effectivename with...

(setq blkname (vla-get-effectivename blkobj))

... but it fails with an Automation Error. Null object ID.

 

when I checked the block with LIST command. All I get is:

 

BLOCK REFERENCE  Layer: "Trapeze Hangers"
                            Space: Model space
                   Handle = 600fcc

 

How can I trap this error so as to not crash my code?

7 REPLIES 7
Message 2 of 8

Have you tried using vl-catch-all-apply?

 

Message 3 of 8
Lee_Mac
in reply to: mdhutchinson

The 'sledgehammer' approach would be something like:

 

(if
    (not
        (vl-catch-all-error-p
            (setq bln
                (vl-catch-all-apply 'vla-get-effectivename (list blkobj))
            )
        )
    )
    bln
)

 

But I'd be interested to know why the method is failing...

 

Message 4 of 8
mdhutchinson
in reply to: Lee_Mac

I am not sure I can re-create the issue. We've had a few occurrances in the past when inserting a block ended up in inserting a 'bad' block reference. The user does the insert and nothing shows up inpite of all settings saying it should (layers on and thawed, etc). I one case the user inserted a bunch of them before giving me a call. The only way I've been able to catch it is to do LIST with L (for last object added to the database) right after the user did the insert. When you do LIST command all you get is:

 

  

BLOCK REFERENCE  Layer: "Trapeze Hangers"
                            Space: Model space
                   Handle = 600fcc

 

... nothing else!  No insertion point, no X, Y or Z scale factor, no rotation angle, no other properties whatsoever.

 

The first time I saw this I thought it had to do with the user modeling far, far away from world origin... but I couldn't prove that.

So, I ran into this again when I was running ObjectDBX on a slug of the drawing files. This is what prompted this post.

Message 5 of 8
mdhutchinson
in reply to: mdhutchinson

here... I was able to find the drawing and cleaned it up leaving only the bad block.

I'd be interested in what you find.

 

If you do LIST on ALL... this is what you'll get

 

 

Message 6 of 8
mdhutchinson
in reply to: mdhutchinson

oops...  do LIST on ALL... this is what you'll get... you see a grip also.

 

BLOCK REFERENCE  Layer: "Trapeze Hangers"
                            Space: Model space
                   Handle = 11

 

I'd be interested in what you find.

Message 7 of 8
mdhutchinson
in reply to: mdhutchinson

I think how I eliminated the bad blocks was to do Erase All then remove with a window selection... the bad blocks were all that was left.

Message 8 of 8
Lee_Mac
in reply to: mdhutchinson

I'm not sure what causes the bad block reference, but auditing the drawing seems to fix it.

 

Lee

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost