Message 1 of 14
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
HELO,
IF ANY ONE SUGGEST A LISP FOR MAKE A INDIVIUAL GROUP OF TEXT WITH UNDER POLYLINE.
Solved! Go to Solution.
HELO,
IF ANY ONE SUGGEST A LISP FOR MAKE A INDIVIUAL GROUP OF TEXT WITH UNDER POLYLINE.
Solved! Go to Solution.
Have you considered adding an underscore to your text?
John F. Uhden
Yes Sir, I tried,
but in that case, I don't get the (Object snap) end point of line.
(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)
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.
@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.
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)
@jaggisingh003 wrote:
Yups you r right..
Then I don't see any need for an AutoLisp routine. See the beginning of my previous Reply.
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.
Is there any way we can do this.
either than group command.
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)
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
It is highly appreciable for the code provided by you.
Thanks for the kind & quick reply.