ObjectIDtoObject

ObjectIDtoObject

john.uhden
Mentor Mentor
440 Views
4 Replies
Message 1 of 5

ObjectIDtoObject

john.uhden
Mentor
Mentor

This method is returning an exception, no matter how I use it.

What I am trying to do is see if a nentseled entity is nested in a block, especially an xref.

The only way I see to do it (without better knowledge) is to check out its 330 owner.

Is there a better/easier way?

My goal is to be able to use TEXTEDIT or MTEDIT accordingly on any textstring within a block, rather than having to BEDIT or REFEDIT.  I have it working perfectly, except that...

1.  There's no need for any special code if the object isn't nested, and

2.  There's no point just editing the textstring if the object is nested in an xref.  For that, one would have to use Open, or DbxOpen, or REFEDIT first.

John F. Uhden

0 Likes
441 Views
4 Replies
Replies (4)
Message 2 of 5

CodeDing
Advisor
Advisor

@john.uhden ,

 

What year of Acad? I believe you're running 2002 at home, but newer at work. This method would work on newer versions, but probably not with '02:

(defun IsOwnerXRef (nent / owner)
  (and (setq owner (car (last nent)))
       (eq 'ENAME (type owner))
       (eq "AcDbXref" (getpropertyvalue owner "ClassName"))
  );and
);defun
Call Like:
(IsOwnerXref (nentsel))

Best,

~DD

0 Likes
Message 3 of 5

john.uhden
Mentor
Mentor
@CodeDing.
You are just a wizard!
These days I am running 2020 at both home and office.
I will try out your function maybe later today. Right now I am actually
doing work (recreating an image that some numbskull here deleted from the
server. I think it was our IT genius). Leaves me tempted to copy all
applicable standard reference files to the job folder.

John F. Uhden

0 Likes
Message 4 of 5

CodeDing
Advisor
Advisor

@john.uhden ,

 

I have not tried that code on text Inside a Block, Inside an XRef... So maybe check that once just in case lol.

 

Best,

~DD

0 Likes
Message 5 of 5

Sea-Haven
Mentor
Mentor

A great new device called USB 😂 my TV has a 32Gb plugged in.

 

If IT has not locked you out. 

0 Likes