TheSwamp
Code Red => AutoLISP (Vanilla / Visual) => Topic started by: MeasureUp on February 02, 2010, 10:08:40 PM
-
How to write underlined mtext by using lisp?
Thanks in advance.
-
Perhaps the answer you seek is HERE (http://www.theswamp.org/index.php?action=search2;params=YWR2YW5jZWR8J3wxfCJ8YnJkfCd8MnwifHNob3dfY29tcGxldGV8J3x8InxzdWJqZWN0X29ubHl8J3x8Inxzb3J0X2RpcnwnfGRlc2N8Inxzb3J0fCd8cmVsZXZhbmNlfCJ8c2VhcmNofCd8dW5kZXJsaW5lIG10ZXh0)
-
Perhaps the answer you seek is HERE (http://www.theswamp.org/index.php?action=search2;params=YWR2YW5jZWR8J3wxfCJ8YnJkfCd8MnwifHNob3dfY29tcGxldGV8J3x8InxzdWJqZWN0X29ubHl8J3x8Inxzb3J0X2RpcnwnfGRlc2N8Inxzb3J0fCd8cmVsZXZhbmNlfCJ8c2VhcmNofCd8dW5kZXJsaW5lIG10ZXh0)
Thanks for your help.
-
You're welcome.
Did you find the information you needed?
-
[color=RED]{\\L[/color]This text is Underlined[color=RED]}[/color]
-
Simply add \\u to the text string, let's say your text is in a variable called TEXT
(setq TEXT (strcat "\\u" TEXT))
should do the trick.
-
To underdline a text object add %%u.
But the question was how to underline an mtext object.
-
[color=RED]{\\L[/color]This text is Underlined[color=RED]}[/color]
Simply add \\u to the text string, let's say your text is in a variable called TEXT
(setq TEXT (strcat "\\u" TEXT))
should do the trick.
Unlike underlining TEXT, the prefix "\\L" doesn't do the trick for MTEXT.
Thanks.
-
To underdline a text object add %%u.
But the question was how to underline an mtext object.
Yes, you know what I mean.
Thanks.
-
Seems to work for me :?
(defun c:MakeThatMTextUnderlined (/ ent obj)
(vl-load-com)
(if (and (setq ent (car (entsel "\nSelect MText: ")))
(eq "MTEXT" (cdr (assoc 0 (entget ent)))))
(vlax-put-property
(setq obj (vlax-ename->vla-object ent)) 'TextString
(strcat "{\\L"
(vlax-get-property obj 'TextString) "}")))
(princ))
-
You're welcome.
Did you find the information you needed?
Hi CAB,
Yes, I have read ervery threads which you linked.
They are helpful. Thanks.
Another question raised after reading the info you linked:
How to customise a mtext in leader?
For example, write an underline mtext and/or set up text style in leader.
Thanks again.
-
Seems to work for me :?
(defun c:MakeThatMTextUnderlined (/ ent obj)
(vl-load-com)
(if (and (setq ent (car (entsel "\nSelect MText: ")))
(eq "MTEXT" (cdr (assoc 0 (entget ent)))))
(vlax-put-property
(setq obj (vlax-ename->vla-object ent)) 'TextString
(strcat "{\\L"
(vlax-get-property obj 'TextString) "}")))
(princ))
Thank you very much.
This is very nice when underlining an existing MTEXT.
-
Seems to work for me :?
(defun c:MakeThatMTextUnderlined (/ ent obj)
(vl-load-com)
(if (and (setq ent (car (entsel "\nSelect MText: ")))
(eq "MTEXT" (cdr (assoc 0 (entget ent)))))
(vlax-put-property
(setq obj (vlax-ename->vla-object ent)) 'TextString
(strcat "{\\L"
(vlax-get-property obj 'TextString) "}")))
(princ))
Thank you very much.
This is very nice when underlining an existing MTEXT.
Is that what you were after? Or was it something else?
-
Seems to work for me :?
(defun c:MakeThatMTextUnderlined (/ ent obj)
(vl-load-com)
(if (and (setq ent (car (entsel "\nSelect MText: ")))
(eq "MTEXT" (cdr (assoc 0 (entget ent)))))
(vlax-put-property
(setq obj (vlax-ename->vla-object ent)) 'TextString
(strcat "{\\L"
(vlax-get-property obj 'TextString) "}")))
(princ))
Thank you very much.
This is very nice when underlining an existing MTEXT.
Is that what you were after? Or was it something else?
Origenally, I want to write underlined MTEXT by using AutoLisp.
Thanks again.
-
Origenally, I want to write underlined MTEXT by using AutoLisp.
Thanks again.
(defun c:test (/ M-Text pt str)
(defun M-Text (pt val)
(entmakex (list (cons 0 "MTEXT")
(cons 100 "AcDbEntity")
(cons 100 "AcDbMText")
(cons 10 pt)
(cons 1 val))))
(if (setq pt (getpoint "\nSpecify Point: "))
(progn
(setq str (getstring t "\nSpecify Text: "))
(M-Text pt (strcat "{\\L" str "}"))))
(princ))
-
Origenally, I want to write underlined MTEXT by using AutoLisp.
Thanks again.
(defun c:test (/ M-Text pt str)
(defun M-Text (pt val)
(entmakex (list (cons 0 "MTEXT")
(cons 100 "AcDbEntity")
(cons 100 "AcDbMText")
(cons 10 pt)
[color=red](cons 7 "ROMANS")[/color]
(cons 1 val))))
(if (setq pt (getpoint "\nSpecify Point: "))
(progn
(setq str (getstring t "\nSpecify Text: "))
(M-Text pt (strcat "{\\L" str "}"))))
(princ))
Thank you very much.
By learning your code, I read DXF section in the HELP & add a line the your code allowing to change the text style. :-)
-
good job.
You can also set the layer and if needed the color override.
Do you see which DXF codes do that?
-
Nice one :-)
This may help you :-)
http://autodesk.com/techpubs/autocad/acad2000/dxf/ (http://autodesk.com/techpubs/autocad/acad2000/dxf/)
-
good job.
You can also set the layer and if needed the color override.
Do you see which DXF codes do that?
Not sure if the following correct:
(defun c:test (/ M-Text pt str)
(defun M-Text (pt val)
(entmakex (list (cons 0 "MTEXT")
(cons 100 "AcDbEntity")
(cons 100 "AcDbMText")
(cons 10 pt)
(cons 7 "ROMANS")
(cons 1 val))
); end of entmakex
[color=red](entmakex (list (cons 0 "LAYER")
(cons 2 "Layer_Mtext")) ; set mtext's layer to "Layer_Mtext" if it exists.
); end of entmakex[/color]
)
(if (setq pt (getpoint "\nSpecify Point: "))
(progn
(setq str (getstring t "\nSpecify Text: "))
(M-Text pt (strcat "{\\L" str "}"))))
(princ)
)
Thanks.
-
Nice one :-)
This may help you :-)
http://autodesk.com/techpubs/autocad/acad2000/dxf/ (http://autodesk.com/techpubs/autocad/acad2000/dxf/)
Thanks for the link.
PS. Is there a 2010 version available in autodesk's web?
I can find it there.
-
Not quite. The benefit of using entmake is that if the layer does not exist it will create it without your help.
Try this:
(defun c:test (/ M-Text pt str)
(defun M-Text (pt val)
(entmakex (list (cons 0 "MTEXT")
(cons 100 "AcDbEntity")
(cons 100 "AcDbMText")
(cons 10 pt)
(cons 7 "ROMANS")
(cons 8 "Layer_Mtext")
(cons 1 val))
); end of entmakex
(if (setq pt (getpoint "\nSpecify Point: "))
(progn
(setq str (getstring t "\nSpecify Text: "))
(M-Text pt (strcat "{\\L" str "}"))))
(princ)
)
-
Thanks for the link.
PS. Is there a 2010 version available in autodesk's web?
I can find it there.
Try this :-
http://images.autodesk.com/adsk/files/acad_dxf1.pdf
-
Not quite. The benefit of using entmake is that if the layer does not exist it will create it without your help.
Try this:
(defun c:test (/ M-Text pt str)
(defun M-Text (pt val)
(entmakex (list (cons 0 "MTEXT")
(cons 100 "AcDbEntity")
(cons 100 "AcDbMText")
(cons 10 pt)
(cons 7 "ROMANS")
(cons 8 "Layer_Mtext")
(cons 1 val))
); end of entmakex
(if (setq pt (getpoint "\nSpecify Point: "))
(progn
(setq str (getstring t "\nSpecify Text: "))
(M-Text pt (strcat "{\\L" str "}"))))
(princ)
)
Sorry, I confuse with the DXF group codes.
I use the (cons 2 "Layer_Mtext") because I found "2" under the layer section.
-
Thanks for the link.
PS. Is there a 2010 version available in autodesk's web?
I can find it there.
Try this :-
http://images.autodesk.com/adsk/files/acad_dxf1.pdf
Thanks for your help. I opened the file.
I am trying to get more resources from Autodesk web.
I did a search again but can't find a page in the Autodesk web showing the entry to the DXF Reference file.
Can you show me the page?
Thanks again.
-
http://usa.autodesk.com/adsk/servlet/ps/item?siteID=123112&id=2882295&linkID=9240617
Have you tried your local Help files ? :-
C:\Program Files\Autodesk\ACAD 2010\Help\acad_dxf.chm
-
Don't forget to visit this thread:
http://www.theswamp.org/index.php?topic=24700.msg359343#msg359343
-
Not quite. The benefit of using entmake is that if the layer does not exist it will create it without your help.
Try this:
(defun c:test (/ M-Text pt str)
(defun M-Text (pt val)
(entmakex (list (cons 0 "MTEXT")
(cons 100 "AcDbEntity")
(cons 100 "AcDbMText")
(cons 10 pt)
(cons 7 "ROMANS")
(cons 8 "Layer_Mtext")
(cons 1 val))
); end of entmakex
(if (setq pt (getpoint "\nSpecify Point: "))
(progn
(setq str (getstring t "\nSpecify Text: "))
(M-Text pt (strcat "{\\L" str "}"))))
(princ)
)
Sorry, I confuse with the DXF group codes.
I use the (cons 2 "Layer_Mtext") because I found "2" under the layer section.
When aiming to modify/set the properties for an entity, just look at the entity dxf group codes - these are all that you need. The layer dxf codes would be used to create/modify a layer.
-
http://usa.autodesk.com/adsk/servlet/ps/item?siteID=123112&id=2882295&linkID=9240617
Have you tried your local Help files ? :-
C:\Program Files\Autodesk\ACAD 2010\Help\acad_dxf.chm
Thanks.
Yes, I know the local built in one but was thinking it would be helpful if there is one in pdf form.
-
Don't forget to visit this thread:
http://www.theswamp.org/index.php?topic=24700.msg359343#msg359343
You are the biggggggg man.
Thanks for the useful/helpful resources.
-
...
When aiming to modify/set the properties for an entity, just look at the entity dxf group codes - these are all that you need. The layer dxf codes would be used to create/modify a layer.
Thanks. you are right.