Jump to content

Recommended Posts

Posted

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

  • Replies 26
  • Created
  • Last Reply

Top Posters In This Topic

  • Michaels

    12

  • The Buzzard

    5

  • ccowgill

    5

  • Lee Mac

    3

Popular Days

Top Posters In This Topic

Posted Images

Posted

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.

Posted

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.

Posted

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]

Posted

OK.

 

But that would set the width of the text not the length of the text !

 

Thanks

Posted

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.

Posted

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

Posted

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

Posted
[/size][/font]

 

1234567890

 

Thanks Lee.

 

But that's what I did in my first post and it does not work .

Posted
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)
Posted

Thanks

 

So how could I control the length of the Mtext ? :)

Posted

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?

Posted

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.

Posted

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)
)

Posted

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

Posted

Why not use an attribute with a FIT justification?

Posted
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

Posted
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.

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...