Author Topic: Modifying Mulitleader text properties via LISP  (Read 8449 times)

0 Members and 1 Guest are viewing this topic.

Chris

  • Swamp Rat
  • Posts: 548
Modifying Mulitleader text properties via LISP
« on: November 12, 2008, 12:29:42 PM »
I have been working on a few different things to make mleaders better, adding some of the qualities of the qleader that I liked and used.  I have however run into a bit of a snag.  This is the entget that is displayed when selecting a multileader:
Quote
((-1 . <Entity name: 7e366800>) (0 . "MULTILEADER") (330 . <Entity name:
7e5f6d40>) (5 . "14B8") (100 . "AcDbEntity") (67 . 1) (410 . "08-104-02") (8 .
"Dim") (100 . "AcDbMLeader") (300 . "CONTEXT_DATA{") (40 . 1.0) (10 1.28564
18.5249 0.0) (41 . 0.1) (140 . 0.15) (145 . -0.15) (174 . 6) (175 . 1) (176 .
0) (177 . 0) (290 . 1) (304 . "APPLY TOPSOIL SURFACE, SALV, 3\";\\PSEEDING,
MIXTURE TUF (220#/ACRE);\\PAND FERTILIZER, CHEMICAL NUTRIENT,\\PCL A
(228#/ACRE) TO ALL DISTURBED\\PAREAS NOT TO BE PAVED (TYP.).\\PINSTALL MULCH
BLANKETS ON ALL\\PDITCH SLOPES OR AS DIRECTED BY\\PTHE ENGINEER IN THE FIELD.")
(11 0.0 0.0 1.0) (340 . <Entity name: 7e5f8488>) (12 1.13564 18.6449 0.0) (13
1.0 0.0 0.0) (42 . 0.0) (43 . 0.0) (44 . 0.0) (45 . 1.0) (170 . 1) (90 .
-1073741824) (171 . 1) (172 . 5) (91 . -1073741824) (141 . 0.0) (92 . 0) (291 .
0) (292 . 0) (173 . 0) (293 . 0) (142 . 0.0) (143 . 0.0) (294 . 0) (295 . 0)
(296 . 0) (110 4.71454 19.7116 0.0) (111 1.0 0.0 0.0) (112 0.0 1.0 0.0) (297 .
0) (302 . "LEADER{") (290 . 1) (291 . 1) (10 4.71454 18.5849 0.0) (11 -1.0 0.0
0.0) (90 . 0) (40 . 0.743185) (304 . "LEADER_LINE{") (10 4.71454 19.7116 0.0)
(91 . 0) (305 . "}") (303 . "}") (301 . "}") (340 . <Entity name: 7e366198>)
(90 . 267488) (170 . 1) (91 . -1023410171) (341 . <Entity name: 7e5f6ca0>) (171
. -2) (290 . 1) (291 . 1) (41 . 0.48133) (42 . 0.15) (172 . 2) (343 . <Entity
name: 7e5f8488>) (173 . 6) (95 . 1) (174 . 1) (175 . 0) (92 . -1073741824) (292
. 0) (93 . -1056964608) (10 1.0 1.0 1.0) (43 . 0.0) (176 . 0) (293 . 0) (294 .
0) (178 . 0) (179 . 1) (45 . 1.0))
I am trying to get the line spacing style to automatically switch to exact, as currently just like the qleader, Autodesk forgot to make the mleader text follow the tspacestyle system variable.  I will be using a reactor to get this program to run, but that is not my area of concern.  My question is, can anyone help me find out why my program isnt working as I think it should.  The following program is supposed to replace the dxf code in red above with (170 . 2).  When in reality when run, it changes the dxf code in blue above to (170 . 2) and changes the code marked in green to (45 . 2.0).  Is my code telling the mleader to change those properties, and I am just totally dense and cant see it, or does anyone have any other suggestions.
Code: [Select]
(defun mleaderspfac (/ obj objent objentdata line flag)
  (if (setq obj (ssget "_L"))
    (progn (setq objent (ssname obj 0)
objentdata (entget objent)
)
 
      (if (/= (equal (assoc 170 objentdata) '(170 . 2)) t)
(progn
  (setq objentdata
(subst '(170 . 2) (assoc 170 objentdata) objentdata)
  ) ;_ end of setq
  (entmod objentdata)
) ;_ end of progn
      ) ;_ end of if
      )
    )
  )

The second part of multileaders that I am trying to correct is the apparent inability to allow text on the left side of the leader to extend under the leader line when left justify is turned on.  I have found a way to manually allow the user to extend the leader tail into the "text box", but would ultimatley like to be able to have this run automatically.  My question is, when you have a large piece of text as in the 304 dxf code above, is there a way to determine the longest line of text and the shortest line of text?  To accomplish this task, I think I would probably subtract the length of the short line from the long line and apply a negative landing gap.

Thanks,
« Last Edit: November 12, 2008, 12:35:41 PM by Chris »
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

sinc

  • Guest
Re: Modifying Mulitleader text properties via LISP
« Reply #1 on: November 12, 2008, 12:33:58 PM »
The only suggestion that I have is that MLEADERs are easier to work with via .NET, but that probably won't help you much...   :?

Chris

  • Swamp Rat
  • Posts: 548
Re: Modifying Mulitleader text properties via LISP
« Reply #2 on: November 12, 2008, 12:36:16 PM »
The only suggestion that I have is that MLEADERs are easier to work with via .NET, but that probably won't help you much...   :?
I would be willing to learn, if someone is willing to be patient and teach.
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

Chris

  • Swamp Rat
  • Posts: 548
Re: Modifying Mulitleader text properties via LISP
« Reply #3 on: November 12, 2008, 01:07:06 PM »
Ok I got the first part of my question answered.  In conjunction with a reactor, this will automatically adjust any mleader just created to a linespace style of exactly.
Code: [Select]
(defun mleaderspfac (/ obj objent objentdata vlaobjent)
  (if (setq obj (ssget "_L"))
    (progn (setq objent (ssname obj 0)
objentdata (entget objent)
vlaobjent (vlax-ename->vla-object objent)
)
      (if (= (vlax-get-property vlaobjent 'TextLineSpacingStyle) 1)
(vlax-put-property vlaobjent 'TextLineSpacingStyle 2)
)
      )
    )
  )
Christopher T. Cowgill, P.E.
AEC Collection 2020 (C3D)
Win 10

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Modifying Mulitleader text properties via LISP
« Reply #4 on: November 12, 2008, 01:34:34 PM »
Gald we could help.  :evil:
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.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
Re: Modifying Mulitleader text properties via LISP
« Reply #5 on: October 12, 2010, 11:42:11 AM »
On this same topic, I'm trying to get my line space factor of mleaders to default to 0.85.  Can I follow this same method?

ronjonp

  • Needs a day job
  • Posts: 7529
Re: Modifying Mulitleader text properties via LISP
« Reply #6 on: October 12, 2010, 12:16:46 PM »
I'd think you'd set this in you mleaderstyle then all would be well?

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

Harrie

  • Guest
Re: Modifying Mulitleader text properties via LISP
« Reply #7 on: October 16, 2010, 05:42:23 PM »
See http://forums.augi.com/showthread.php?t=124979 (Nth item in DXF list) with HofCAD's ChNthDxf subroutine
(Change Nth Dxf code) for editing LWpolylines, mlines, leaders, mleaders, tables and splines.
Examples on http://forums.augi.com/showthread.php?t=124979&page=3 in TestChNthDxf2.lsp
« Last Edit: October 16, 2010, 06:03:55 PM by Harrie »

marztrek

  • Guest
Re: Modifying Mulitleader text properties via LISP
« Reply #8 on: December 02, 2010, 04:09:40 PM »
Wow! that's cool.

Now one quick question: how can I change the justification to center rather than left?

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Modifying Mulitleader text properties via LISP
« Reply #9 on: December 02, 2010, 04:26:47 PM »
Wow! that's cool.

Now one quick question: how can I change the justification to center rather than left?
MLEADERSTYLE>CONTENT (tab)>Default text>change justification.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

marztrek

  • Guest
Re: Modifying Mulitleader text properties via LISP
« Reply #10 on: December 02, 2010, 04:30:23 PM »
Sorry, I was not clear with my question.

I want to change the justification to center using lisp.

Thanks for the reply.

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Modifying Mulitleader text properties via LISP
« Reply #11 on: December 02, 2010, 04:36:10 PM »
style or objects?
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

marztrek

  • Guest
Re: Modifying Mulitleader text properties via LISP
« Reply #12 on: December 02, 2010, 04:37:25 PM »
objects

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Modifying Mulitleader text properties via LISP
« Reply #13 on: December 02, 2010, 04:40:50 PM »
Search for StripMText and you'll get your formatting info.
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

marztrek

  • Guest
Re: Modifying Mulitleader text properties via LISP
« Reply #14 on: December 02, 2010, 04:42:14 PM »
Cool!

Thanks for your help.