AutoCAD 2010 :: Enable MTEXT Background Using LISP And DXF Codes
Jun 27, 2012Simple LISP routine to enable the background mask of a single mtext object using dxf codes?
View 4 RepliesSimple LISP routine to enable the background mask of a single mtext object using dxf codes?
View 4 RepliesI have a routine, developed for me through this forum, that selects text or mtext, converts to mtext if not already, and puts a background mask with 1.1 border. I was using it fine in Map 3D 2007, but have recently switched to Civil 3D 2012 where it does not work. I get this error message:
; error: no function definition: VLAX-ENAME->VLA-OBJECT
Why does this not work in 2012? How to get it to work?
I am lifting mtext from a drawing and then working with the result. For some reason the "\pxi-" at the beginning of the string I am lifting is converting to " pxi-" when worked with as a string in vb.net. The result is this, when I apply the string back to mtext I get a bunch of messed up formatting codes at the beginning rather than a formatted piece of text.
This seems to be related to the "\" Is this automatically getting modified by vb or autocad when I pull the source text?
If I create one MTEXT object with the Background Mask set to Yes, then COPY it to several locations, and lastly edit the text for each one, does the width of the bounding box have to be adjusted for the width on each individual peice of MTEXt, or is there an "autofit" option?
The Background Masks are either too narrow or too wide on the copied items.
I need to lay one of our existing blocks ontop of every power outlet on a floorplan (the power outlets are currently shown as a simple shape (eg. either a rectangle, triangle or circle) with text next to it.
There are hundreds of power outlets, so if there is a lisp routine for replacing any part of the power outlet with the block, eg. replacing text/mtext with a block or replacing a pline with a block.
I have found a very successful lisp routine for replacing circles with blocks, but this obviously only works on the power outlets that are shown as circles. So a simpler way of looking at it could be a lisp for drawing a circle around mtext/text then I could simply use the circle to block lisp to place the blocks.
I have been using background masking in Mtext to cover up the mechanical piping in our drawings. It works fine in AutoCAD, but we convert the drawing to pdf and then send the pdf to the printer to make prints. Now
the background masking is not working. You get a line going through the text.
Tool to combine multiple pieces of Mtext into a single Mtext with paragraphs?
View 9 Replies View RelatedI have multiple singular text objects on my screen and I want to convert them to mtext so I can use the Background Mask option within mtext on my drawing. how to quickly select all the text and convert it to mtext without it combinin ginto 1 mtext?
View 9 Replies View RelatedWhy is this happening?
The dwg was fine, then it crashed while changing from modle space to paper space...
When i recovered the dwg, EVERY MTEXT I try to edit becomes rotated vertically and stays that way when i close the edit box...
I do not recall hitting any buttons or making any keystrokes without my knowing...
Is there a way to get my text back to Horizontal and stay that way?
I tried setting the MTEXTFIXED to: 0, 1 & 2.
NONE of these options changed anything.
I NEED to have this fixed. more importantly, i need to know why this is happening sop that i can take steps to prevent this happening in the future...
I am currently working with the latest CAD available.
How I can get the linetype dxf codes of a line that I select. I have tried a few different things and all I can get is the linetype name. I'm trying to write a Lisp program that draws a "template" and sets up the line types and layers etc. But I need to get this info from a current drawing so that I can put it into the program. So far the program works well, but if I take a new drawing and run the program, the line types will need to be set up and the colors on the layers. I don't think I'll have a problem with the colors as they are standard to Autocad, but the linetype used in the current drawing is "homemade".
View 5 Replies View RelatedI am trying to add an MTEXT background mask in vba I know it may be easy to do in lisp but I already have a working vba code for creating the MTEXT just need to add the background mask into the text.
all the codes I can find in the internet are doing it in lisp.
After disabling the "Open - Foreign DWG File" message box, how do you later turn it back on?
View 2 Replies View RelatedAny way to change the default settings for the background mask used with Mtext?
View 9 Replies View RelatedI have mtext in several drawings that contains an error that'd I'd like to fix using Lisp. An example of what this text should look like is:
NOTE:
SEE DRAWING XXXX FOR DRIVE DETAILS
The fist problem is that all of the text after the note has a width factor of 0.1 and is all squished together. The second problem is that the text height of the title (the "NOTE:" part) is supposed to be larger than the actual note (the "SEE DRAWING XXXX FOR DRIVE DETAILS" PART). Is there a way to fix this using lisp? I had a lisp in progress (not done) which is:
(IF
(SETQ SSET (SSGET "X" '((0 . "MTEXT"))))
(PROGN
(SETQ COUNT -1)
(WHILE (< (SETQ COUNT (1+ COUNT)) (SSLENGTH SS))
(SETQ ENTDATA (ENTGET (SSNAME SSET COUNT)))
(SETQ ENTTEXT (CDR (ASSOC 1 ENTDATA)))
(ENTMOD (SUBST (CONS 1 (STRCAT "{\W1;" ENTTEXT "}")) (ASSOC 1 ENTDATA) ENTDATA))
The last line has no effect on the width factor of the note.
This is the entdata for this particular piece of mtext (they aren't all the same):
((-1 . <Entity name: 7ffff79ce50>) (0 . "MTEXT") (330 . <Entity name:
7ffffb069f0>) (5 . "392FD") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 .
"5") (100 . "AcDbMText") (10 676.276 751.03 0.0) (40 . 3.008) (41 . 0.0) (46 .
[Code]....
I am Trying to change layer plot style in layer properties manager tab. but i cant change in plot style. and also trying to change plot option... See Image
View 5 Replies View RelatedIs there a way to change the defaults?
Presently, the Fill Color defaults to "Red" and I have to check "Use drawing background color" every time. Certainly there must be a way to change this?
While I am at it, how about line space distance? Ditto on default justification, height, etc., etc.?
How to make a multileader style with automatic background masks? How to select all the multileaders in a drawing (via a script or macro) and turn on the background masks?
I know I can quick select the mleaders in a drawing, but I'd rather just run a script or macro to correct the mleaders.
I'm looking for a function to return the actual text from an mtext object.if there's a carraige return I wish to replace it with a space.
View 4 Replies View RelatedI would like to write a routine to resize the MText limits box to the minimum size required to cover the text, for background masking purposes. From the DXF codes, I see that I can simply set code 41 to match code 42 in order to set the width. However, I cannot seem to figure out how the vertical dimension is defined. (entget) shows no change in the DXF codes after I resize the mtext box.
I do know how to figure out the height that I need, using (acet-geom-textbox), but I can't seem to figure out how to apply this height the MText entity.
I got this nice little lisp from [URL] .....
(defun c:mt2ml ( / oobj nobj nstrg) (vl-load-com) (setq oobj (vlax-ename->vla-object (car (nentsel "
Select source text: ")))) (if (= (vlax-get-property oobj 'ObjectName) "AcDbMText") (setq nstrg (vlax-get-property oobj 'TextString)) (exit) ) (command "_MLEADER") (while (= 1 (logand (getvar "CMDACTIVE") 1)) (command PAUSE)) (setq nobj (vlax-ename->vla-object (entlast))) (if (= (vlax-get-property nobj 'ObjectName) "AcDbMLeader") (vlax-put-property nobj 'TextString nstrg) (exit) ) (entdel (vlax-vla-object->ename oobj)) (princ))
It converts MText to a Multileader.
My goals would be as follows:
The multileader should end up on the same layer as the Mtext. (Currently it uses the current layer.)The multileader should hold the same rotation as the Mtext. (Currently it goes to zero.)The multileader should be created in the same location as the Mtext, without the user having to click. (Currently the multileader is created wherever the user clicks.)The multileader should be created without a leader. We can add one afterwards if needed, but for many we don't need a leader. (We're just using the object as mtext with a box around it.)
I'm finding Mleaders with Mtext don't seem to play well with command calls. All works fine until one tries to enter the mleader text. Before testing this, be sure your mleader style is set to use mtext. I recommend starting the leader with the arrow first.
Compare this mleader's text entry behavior in this basic lisp command call:(command "_.acad_dim.mleader") with the following routine that relies on an open ended command prompt (useful if you want to add more commands after calling the mleader command):
(defun c:mlx (/ cc_echo)
(prompt "
Example showing mleader mtext misbehaving")
(setq cc_echo (getvar "cmdecho"))
(setvar "cmdecho" 1)
(command "_.acad_dim.mleader")
[code]...
With qleaders, the leader and text are separate entities.
I'm having issues with updating an MTEXT attributes value using lisp.
If I insert my block (this is a titleblock) and run my lisp routine the MTEXT attribute updates fine. Once I edit the MTEXT attribute with the MTEXT editor, and then run my lisp routine again, the MTEXT attribute will not update anymore. All the single line (DTEXT) attributes update fine. The lisp routine I created has worked for years...this is the first time I've tried it with an MTEXT attribute.
Lisp routine that will rotate Mtext to the same angle as the angle of a selected line and the allow you to place the mtext object where you wish.
I know there is an lisp out there called RTL that will allow you to do this with regular or Dtext, but I will not work with Mtext.
In my drawing I have lot of MTEXTS having unwanted spaces in between the text strings.
A lisp to remove space from MTEXT. Here i am attaching sample drawing with MTEXT which is to be modify. Magenta color MTEXT need to modify like yellow color MTEXT.
I have set mtext (with background mask on) to the foreground (using draw order: front, and draw order: above objects) but those settings do not 'stick' and often have to go back and reset all those values over again.
I've also tried using Draw Order on the objects under the text (draw order: behind) which also results inthe text randomly behind in front of or behind objects.
Is there a way to set mtext to be in the foreground permanently and not have to go back and mess with Draw Order all the time?
I’m trying to put together a loop for if nil or something other than text or mtext is accidentally selected than prompt text was not selected. This is what I have so far.
text or mtext is not selected than prompt
(defun C:ww ()
(while
(not
(and
(setq esel (entsel "
[Code]......
I am wanting to use autolisp to access the text in a MTEXT entity. assoc(1) gives me the first bit of text, but not the rest.Is there a way to use assoc to access each of a number of matches or do I need to write my own routine to find all the 1's?
View 5 Replies View RelatedI looking into a way to insert mtext with two differents sizes of the words just like the image about in autolisp.
View 9 Replies View Relatedi have a situation that i need to mirror a lot of MTEXT exisiting in my drawing with following needs ( as attached CAD file) :
- MIRRTEXT = 1
- original text retain not deleted.
- mirrored texts become on another layer with another color.
- mirrored texts exactly become over the original text.
I am not sure why this is not working.
(setq SelectionSet (ssget "C" Point1 Point2 '((-4 . "<or") (0 . "CIRCLE") (0 . "MTEXT") (-4 . "<or"))))
I want to select circles and mtext within the specified points.
why does mtext sometimes have a box around it when i move it and how do i get rid of it.
View 9 Replies View Related