Michaels Posted December 9, 2010 Share Posted December 9, 2010 Hello. Suppose that I have a limited length of (600. long of distance) , and I do not want the Mtext strings to exceed that area . What is the dxf code which control the width of Mtext in "entmakex" please ? I tried the following but it seems that it doesn't work for my situation . (cons 41 400.) (cons 42 600.) (cons 48 600.) Thanks Michaels Quote Link to comment Share on other sites More sharing options...
ccowgill Posted December 9, 2010 Share Posted December 9, 2010 To answer your question directly, it should be (41 . 600) this code may not work as I took it out of a much larger program and did not test it. (setq EntDxf (subst '(41 600) (assoc 41 EntDxf) EntDxf) ) ;_ end of setq (entmod EntDxf) I always just use VLA-put-width and specify 600 (vla-put-width obj 0) convert the object to a vlaobject and use it. Quote Link to comment Share on other sites More sharing options...
Michaels Posted December 9, 2010 Author Share Posted December 9, 2010 Thank you so much. But I want to include them in "entmakex" function, so not to modify the current selected Mtext as you have mentioned in your examples . Appreciated. Quote Link to comment Share on other sites More sharing options...
ccowgill Posted December 9, 2010 Share Posted December 9, 2010 I'm not familiar with using entmakex, but try not using cons, try actually using the dotted pair: [i][i](entmakex '((0 . "mtext")(41 . 600)))[/i][/i] Quote Link to comment Share on other sites More sharing options...
Michaels Posted December 9, 2010 Author Share Posted December 9, 2010 OK. But that would set the width of the text not the length of the text ! Thanks Quote Link to comment Share on other sites More sharing options...
ccowgill Posted December 9, 2010 Share Posted December 9, 2010 ok, I got you, the only problem of with that is that depending on your font, not all characters take up the same width. if you are referring to the number of characters, I dont know if there is a way to necessarily limit that, like I said, I'm not really familiar with using entmakex, perhaps someone else here can lend a hand. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 9, 2010 Share Posted December 9, 2010 42 horizontal width of the characters that make up the mtext entity. This value will always be equal to or less than the value of group code 41. (read-only, ignored if supplied) 1234567890 Quote Link to comment Share on other sites More sharing options...
Michaels Posted December 9, 2010 Author Share Posted December 9, 2010 Thanks a lot CCOWGILL. Actually I have a length of line and I do not want the mtext to exceed that limits (length of line) so I think the width of text may solve the issue but with the Height of mtext as well . Am I right ? Appreciated Quote Link to comment Share on other sites More sharing options...
Michaels Posted December 9, 2010 Author Share Posted December 9, 2010 [/size][/font] 1234567890 Thanks Lee. But that's what I did in my first post and it does not work . Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 9, 2010 Share Posted December 9, 2010 horizontal width of the characters that make up the mtext entity. This value will always be equal to or less than the value of group code 41. (read-only, ignored if supplied) But that's what I did in my first post and it does not work . I'll try again: horizontal width of the characters that make up the mtext entity. This value will always be equal to or less than the value of group code 41. (read-only, ignored if supplied) Quote Link to comment Share on other sites More sharing options...
Michaels Posted December 9, 2010 Author Share Posted December 9, 2010 Thanks So how could I control the length of the Mtext ? Quote Link to comment Share on other sites More sharing options...
ccowgill Posted December 9, 2010 Share Posted December 9, 2010 I would think it would run back to the 41 code as Lee stated, the value will always be less than or equal to the value of that group code, so if you specify 600, it would be your maxium length. Correct? perhaps a picture of what it is that your are trying to accomplish might be in order? Quote Link to comment Share on other sites More sharing options...
Michaels Posted December 9, 2010 Author Share Posted December 9, 2010 Here is an example ........ Quote Link to comment Share on other sites More sharing options...
ccowgill Posted December 9, 2010 Share Posted December 9, 2010 so you are saying if it exceeds 600, you want it to change the text height so that it is less than 600 wide? It sounds like it is a little out of my league, I'll have to defer to others that are more qualified than I. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted December 9, 2010 Share Posted December 9, 2010 This? (defun c:test ( / ss wi ) ;; © Lee Mac 2010 (if (and (setq ss (ssget "_:L" '((0 . "MTEXT")))) (progn (initget 7) (setq wi (getdist "\nSpecify Desired Width: ")) ) ) ( (lambda ( i / e l ) (while (setq e (ssname ss (setq i (1+ i)))) (setq l (entget e)) ( (lambda ( h ) (while (and (< 0 h) (< wi (cdr (assoc 42 l)))) (setq l (entget (entupd (cdr (assoc -1 (entmod (subst (cons 40 (setq h (- h 0.01))) (assoc 40 l) l ) ) ) ) ) ) ) ) ) (cdr (assoc 40 l)) ) ) ) -1 ) ) (princ) ) Quote Link to comment Share on other sites More sharing options...
Michaels Posted December 9, 2010 Author Share Posted December 9, 2010 I am not looking forward to change the Mtext height ,or update existing one Mr Lee. I want the length of the Mtext not exceeding the length of the selected line . (defun c:test (/ ss ss1 e 1st 2nd dis) (if (setq ss (ssget '((0 . "LINE")))) (progn (setq ss1 (ssname ss 0)) (setq e (entget a)) (setq 1st (cdr(assoc 10 e))) (setq 2nd (cdr(assoc 11 e))) (setq dis (distance 1st 2nd)) (entmakex (list (cons 0 "MTEXT") (cons 100 "AcDbEntity") (cons 100 "AcDbMText") (cons 40 150.) [color=red][b] (cons .......... dis)[/b][/color] (cons 10 1st) (cons 1 "This is just an example")))) (princ) ) (princ) ) Thanks Quote Link to comment Share on other sites More sharing options...
alanjt Posted December 9, 2010 Share Posted December 9, 2010 Why not use an attribute with a FIT justification? Quote Link to comment Share on other sites More sharing options...
Michaels Posted December 9, 2010 Author Share Posted December 9, 2010 Why not use an attribute with a FIT justification? So can I say that it is impossible to take a place that way with "entmakex" to let me turn to Attribute ? Thanks Quote Link to comment Share on other sites More sharing options...
The Buzzard Posted December 9, 2010 Share Posted December 9, 2010 So can I say that it is impossible to take a place that way with "entmakex" to let me turn to Attribute ? Thanks You cannot do textfit with Mtext. Why not just use regular text? You are only using one line of text anyway. Quote Link to comment Share on other sites More sharing options...
alanjt Posted December 9, 2010 Share Posted December 9, 2010 here................. new block.dwg Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.