Author Topic: Leader Text  (Read 2994 times)

0 Members and 1 Guest are viewing this topic.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Leader Text
« on: March 26, 2010, 07:26:50 AM »
How can one tell, using Visual LISP, if Text is associated with a leader?

Thanks in advance,

Lee

Joe Burke

  • Guest
Re: Leader Text
« Reply #1 on: March 26, 2010, 07:59:51 AM »
Lee,

This seem too simple. Check the Annotation property of the leader object. If it returns an mtext object...

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Leader Text
« Reply #2 on: March 26, 2010, 08:06:21 AM »
Lee,

This seem too simple. Check the Annotation property of the leader object. If it returns an mtext object...

Sorry Joe, I meant if you don't have the Leader Object, but just the Text/MText object - can you tell if they are connected?

I would normally check for the presence of the reactor in the DXF table, but I see no immediate way to accomplish this in VL
« Last Edit: March 26, 2010, 08:11:28 AM by Lee Mac »

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Leader Text
« Reply #3 on: March 26, 2010, 09:30:22 AM »
I see no way but to search through all reactors. :?
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Leader Text
« Reply #4 on: March 26, 2010, 09:34:19 AM »
I see no way but to search through all reactors. :?

Oh, I thought there might be an easier way that I was missing  :-(

Thanks anyway guys. :-)

Crank

  • Water Moccasin
  • Posts: 1503
Re: Leader Text
« Reply #5 on: March 26, 2010, 12:01:38 PM »
Perhaps:
  • First make a selectionset of all leaders
  • Now make a list of the 340 dxf-codes (= pointers to the mtext)
  • If the entityname of the text is a member of the list then it's associated with a leader
Vault Professional 2023     +     AEC Collection

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Leader Text
« Reply #6 on: March 26, 2010, 12:09:29 PM »
Nice idea Crank, thanks :-)

But I really need to do this with VL, as I'd be using it through ObjectDBX. But, on the topic of testing the text for a leader using dxf, I normally use something like this:

Code: [Select]
(defun isLeaderText (ent)
  (and (assoc 102   (entget ent))
       (setq own    (cdr (assoc 330 (entget ent))))
       (eq "LEADER" (cdr (assoc 0 (entget own))))))

Not sure if that's a good way to do it though  :|

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Leader Text
« Reply #7 on: March 26, 2010, 01:08:07 PM »
You might be able to still do it that way with ODBX.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Leader Text
« Reply #8 on: March 26, 2010, 01:11:06 PM »
You might be able to still do it that way with ODBX.

I'll give it a try :-)

I know that entmod isn't available, but entget might be  :-)

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Leader Text
« Reply #9 on: March 26, 2010, 02:35:10 PM »
Nice idea Crank, thanks :-)

But I really need to do this with VL, as I'd be using it through ObjectDBX. But, on the topic of testing the text for a leader using dxf, I normally use something like this:

Code: [Select]
(defun isLeaderText (ent)
  (and (assoc 102   (entget ent))
       (setq own    (cdr (assoc 330 (entget ent))))
       (eq "LEADER" (cdr (assoc 0 (entget own))))))

Not sure if that's a good way to do it though  :|

In early '08, I wrote a routine that would copy (with option to delete) text objects with the QLeader command and change to the current layer. I used the same method to find and delete the attached leader. It did have a flaw that if the MText object had an associated leader, yet already deleted, an executed entdel on an already deleted leader would recreate it. I never followed through with figuring it out since we switched to Multileaders shortly after and I haven't used it since.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12915
  • London, England
Re: Leader Text
« Reply #10 on: March 26, 2010, 02:43:20 PM »
Thanks Alan

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Leader Text
« Reply #11 on: March 26, 2010, 03:44:54 PM »
In early '08, I wrote a routine that would copy (with option to delete) text objects with the QLeader command and change to the current layer. I used the same method to find and delete the attached leader. It did have a flaw that if the MText object had an associated leader, yet already deleted, an executed entdel on an already deleted leader would recreate it. I never followed through with figuring it out since we switched to Multileaders shortly after and I haven't used it since.

Just FYI... you can see if an entity is deleted a couple of ways.  If ' entget ' returns nil, then it has been deleted.  You can also use ' vlax-erased-p ' on an ename or vla-object.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Leader Text
« Reply #12 on: March 26, 2010, 08:13:29 PM »
In early '08, I wrote a routine that would copy (with option to delete) text objects with the QLeader command and change to the current layer. I used the same method to find and delete the attached leader. It did have a flaw that if the MText object had an associated leader, yet already deleted, an executed entdel on an already deleted leader would recreate it. I never followed through with figuring it out since we switched to Multileaders shortly after and I haven't used it since.

Just FYI... you can see if an entity is deleted a couple of ways.  If ' entget ' returns nil, then it has been deleted.  You can also use ' vlax-erased-p ' on an ename or vla-object.
Ahh, good to know. Thanks Tim. :)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox