LISP FOR MAKE A INDIVIUAL GROUP TEXT WITH LINE

LISP FOR MAKE A INDIVIUAL GROUP TEXT WITH LINE

jaggisingh003
Advocate Advocate
1,628 Views
13 Replies
Message 1 of 14

LISP FOR MAKE A INDIVIUAL GROUP TEXT WITH LINE

jaggisingh003
Advocate
Advocate

HELO,

 

 IF ANY ONE SUGGEST A LISP FOR MAKE A INDIVIUAL GROUP  OF TEXT WITH UNDER POLYLINE.

0 Likes
Accepted solutions (1)
1,629 Views
13 Replies
Replies (13)
Message 2 of 14

john.uhden
Mentor
Mentor

Have you considered adding an underscore to your text?

John F. Uhden

0 Likes
Message 3 of 14

jaggisingh003
Advocate
Advocate

Yes Sir,  I tried,

but in that case, I don't get the (Object snap) end point of line. 

 

0 Likes
Message 4 of 14

roland.r71
Collaborator
Collaborator

 

(defun c:UnderlineText ( / )
   (while (setq ent (entsel))
      (setq entData (entget (car ent))
            entType (cdr (assoc 0 entData))
      )
      (cond
         ((= entType "TEXT")
            (setq obj (vlax-ename->vla-object (car ent))
                  box (vlax-invoke-method obj 'getboundingbox 'pt1 'pt2)
                  ll (vlax-safearray->list pt1)
                  ur (vlax-safearray->list pt2)
                  lr (list (car ur)(cadr ll))
            )
            (command "_.line" ll lr "")
         )
      )
   )
)

This will do just what you want.

 

Note: as i took the code from a larger function (to create boxes, instead of underlining)

the (cond ... has only 1 condition, Text. You could add more options (mtext, blocks etc) or get rid of the cond. Because of that, it doesn't check if the user did select a text. (it will currently do nothing if you select something else)

 

It also continues until the user selects nothing or hits 'escape'. Allowing to underline multiple text entities one after the other. Remove the (while ... cycle to use it just ones

 

Note2:

You might have to turn off "object snap", to get a correct line. (otherwise the endpoint of the line might snap to the starting point or something else close enough to snap to)

0 Likes
Message 5 of 14

jaggisingh003
Advocate
Advocate

Thanks for the reply,

but it only create a underline not create a group of text and polyline. I want a group of selected text and under polyline together.

 

for creating underline. I use strikethrough http://lee-mac.com/strikethrough.html

by lee mac.

0 Likes
Message 6 of 14

Kent1Cooper
Consultant
Consultant

@jaggisingh003 wrote:

.... A LISP FOR MAKE A INDIVIUAL GROUP  OF TEXT WITH UNDER POLYLINE.


Are the Text and Polyline both already drawn?  If so, just use the GROUP command, or BLOCK if you prefer.

 

If they're not both already drawn, is the Text  already drawn as it must be in @roland.r71's routine?  If so, is it always at a rotation angle of 0, as that routine would require it to be?  And do you want the underlining Polyline touching  the bottom of the Text as that makes it, or should it be slightly farther below?

 

If neither is already drawn, and you want both to be drawn as part of the routine, the same questions apply about rotation and the position of the underlining.  And other questions arise:  Should it always just use the current Text Style and height and Layer and so on, or should the routine set all of those?

 

In any case, the results can be GROUPed together easily enough after whatever else the routine does.

Kent Cooper, AIA
0 Likes
Message 7 of 14

roland.r71
Collaborator
Collaborator

As he's using LeeMac's "Strikethrough" for the underlining, the text must already be present.

 

So, it looks like all he realy wants to do is group the (existing) text & line. (probably to keep them together)

0 Likes
Message 8 of 14

jaggisingh003
Advocate
Advocate
Yups you r right..
0 Likes
Message 9 of 14

Kent1Cooper
Consultant
Consultant

@jaggisingh003 wrote:
Yups you r right..

Then I don't see any need for an AutoLisp routine.  See the beginning of my previous Reply.

Kent Cooper, AIA
0 Likes
Message 10 of 14

jaggisingh003
Advocate
Advocate

ee.PNG

 

I have hundreds of text like this, and When I want to move them only text are moving.

if there is  a group of text and line they both move at the same time. 

 

0 Likes
Message 11 of 14

jaggisingh003
Advocate
Advocate

Is there any way we can do this.

either than group command.

0 Likes
Message 12 of 14

roland.r71
Collaborator
Collaborator

I understand your problem, but know of no quick solution.

 

For this i would not advice to use "group", as that would require you to "ungroup" & re-"group" each time you need to change the text.

 

You (or somebody else) could write a script to do the grouping, automatically, but in the time i write that, you could make the changes by hand. (looking at your drawing, it will require some thought (& coding) on how to select the right line to go with each text)

 

IMHO: For this it would be better to start over, using a block (or a dynamic block, to allow stretching the line if needed)

 

0 Likes
Message 13 of 14

cadffm
Consultant
Consultant
Accepted solution

@jaggisingh003

If you really want to use Groups:

Is it a problem for you to create the line new? In this case an for the next:

Save your LM-Lisp under a new name, like StrikeThroughV1-1_Group.lsp

Perhaps it is better to rename the defined Autocad commands too:

C:STRIKE => C:STRIKE_GR

and all others "C:" too.

And above the last (princ) for each (defun c:  you should add this line as reminder:

(if (/= (logand (getvar 'pickstyle) 1) 1) (alert "Note: Your PICKSTYLE GROUP is current switched off!"))

 

Then change the last line of (defun LM:strikethrough

from

rtn

to

(command "_.GROUP" "_create" "*" "" ent (foreach i rtn i) "")

 

 

 

Sebastian

0 Likes
Message 14 of 14

jaggisingh003
Advocate
Advocate

It is highly appreciable for the code provided by you.

 

Thanks for the kind & quick reply.

 

0 Likes