Jump to content

TEXT ISSUE


Ajmal

Recommended Posts

I am experiencing an issue with mirrored text in my drawings.  the "Mirrortext" system variable set to 0, the text still mirrors when I mirror the drawing. I have observed that there are two types of text in the drawing: one type mirrors along with the drawing, while the other type maintains its normal orientation when the drawing is mirrored.

I have attached the drawings for reference. Could anyone provide a solution to this problem?

Thank you in advance for your assistance.

TEXT ISSUE.dwg

TEXT ISSUE 1.dwg

Edited by Ajmal
add more drawings
Link to comment
Share on other sites

I guess you know this...

If text is nailed into block or xref, it will mirror TEXT along with block/xref, if not - normal text in model space (when MIRROR and set MIRRORTXT to 0) text will retain it's unmirrored look...

Edited by marko_ribar
Link to comment
Share on other sites

Sunday, CAD Is off so I can't check this - but the Internet reckons set block text to attributes and setting 'constant' and then they won't mirror. I thought there was another setting in there to keep normal text the same too - would have to open CAD to check though;

Link to comment
Share on other sites

  • 2 weeks later...
On 17/06/2023 at 19:59, marko_ribar said:

I guess you know this...

If text is nailed into block or xref, it will mirror TEXT along with block/xref, if not - normal text in model space (when MIRROR and set MIRRORTXT to 0) text will retain it's unmirrored look...

text not in the block. text already independent  

Link to comment
Share on other sites

I have one solution idea. select all text and recreate text with the same value and all other properties with the same location. I don't know if this is a good idea.

actually, when I google, it's showing this text from 3rd party text so sometimes it will act like this. so when I ever mirror, the text is also mirrored. if I match the text with the same property also with will not change.

can someone do this for me 

Link to comment
Share on other sites

(defun recreate-selected-text ()
  (setq ss (ssget))
  (if ss
    (progn
      (setq i 0)
      (repeat (sslength ss)
        (setq ent (ssname ss i))
        (setq text-properties (entget ent))
        (setq old-text (cdr (assoc 1 text-properties)))
        
        ;; Get text properties
        (setq layer (cdr (assoc 8 text-properties)))
        (setq height (cdr (assoc 40 text-properties)))
        (setq angle (cdr (assoc 50 text-properties)))
        (setq position (cdr (assoc 10 text-properties)))
        (setq text-style (cdr (assoc 7 text-properties)))
        
        ;; Create new text entity
        (setq new-text (entmakex
                        (list
                         '(0 . "TEXT")
                         (cons 8 layer)
                         (cons 40 height)
                         (cons 50 angle)
                         (cons 10 position)
                         (cons 7 text-style)
                         (cons 1 old-text)
                        )))
        
        ;; Delete old text entity
        (entdel ent)
        
        (setq i (1+ i))
      )
      (princ "\nSelected text recreated.")
    )
    (princ "\nNo text objects selected.")
  )
)

(defun c:textor ()
  (recreate-selected-text)
  (princ)
)

this is working but I need in mtext, this is create a text object 

Link to comment
Share on other sites

I never had time earlier today, but for your latest question, this will remake an entity exactly the same and delete the old entity - in this case filtered by text or mtext

 

(defun c:recreateentity ( / SS acount ent MyEnt new-text)
  (if (setq SS (ssget (list '(0 . "TEXT,MTEXT")) )) ; user selects text
    (progn
      (setq acount (sslength SS))
      (while (> acount 0)
        (setq ent (ssname SS (- acount 1)))
        (setq MyEnt (entget ent))
        (setq new-text (entmakex
          MyEnt
        )) ; end entmakex, end setq
        (entdel ent)
        (setq acount (- acount 1))
      ) ; end while
      (princ "\nSelected entity recreated.")
    ) ; end progn
  (princ "\nNo objects selected.")
  ) ; end if
)

 

 

If all you want is a few items you could do something like this. Slightly shorter code to yours, added in filter for the selection set

 

(defun c:copytext ( / SS acount ent MyEnt new-text)
  (if (setq SS (ssget (list '(0 . "TEXT,MTEXT")) )) ; user selects text
    (progn
      (setq acount (sslength SS))
      (while (> acount 0)
        (setq ent (ssname SS (- acount 1)))
        (setq MyEnt (entget ent))
        (setq new-text (entmakex
          (list
            (assoc 0 MyEnt) ; entity type
            (assoc 100 MyEnt) ; entity type
            (assoc 100 (reverse MyEnt)) ; entity type
            (assoc 8 MyEnt) ; layer
            (assoc 40 MyEnt) ; text height
            (assoc 50 MyEnt) ; text angle
            (assoc 10 MyEnt) ; insertion point
            (assoc 7 MyEnt) ; text style
            (assoc 1 MyEnt) ; actual text, up to 256 characters
          ) ;end list
        )) ; end entmakex, end setq
        (entdel ent)
        (setq acount (- acount 1))
      ) ; end while
      (princ "\nSelected text recreated.")
    ) ; end progn
  (princ "\nNo text objects selected.")
  ) ; end if
)

 

EDIT

Put the '100' codes in

 

If this was something I would use a lot I would go for the top method but search remove entity codes I don't want from the list using something like this, making the search terms as a list perhaps and a loop to remove the from the entity definition list

 

(defun c:copytext ( / SS acount ent MyEnt )
  (if (setq SS (ssget (list '(0 . "TEXT,MTEXT")) )) ; user selects text ; ignores the never used rtext else use "*TEXT"
    (progn
      (setq acount (sslength SS)) ; counting backwards through selection set - you can remove last list items
      (while (> acount 0) ; loop length of selection set
        (setq ent (ssname SS (- acount 1))) ; get each entity name
        (setq MyEnt (entget ent)) ; get the entity description list

  (setq search (list 210 11 41 42 43 )) ; as examples for entity codes to ignore, remove from the list
;;This only works for unique entity description codes, example polylines have several '10' - this won't work
  (foreach n search ; loop through the entity description
    (setq MyEnt (append ; create a new list
      (reverse (cdr (member (assoc n MyEnt) (reverse MyEnt) ))) ; items before the nth search term
      (cdr (member (assoc n MyEnt) MyEnt )) ; items after the nth search terms
    )); ; end setq
  ) ; end foreach

        (entmakex MyEnt) ; Make new text
        (entdel Ent) ; delete old text
        (setq acount (- acount 1)) ; incriment for next text
      ) ; end while
      (princ "\nSelected text recreated.")
    ) ; end progn
  (princ "\nNo text objects selected.")
  ) ; end if
)

 

 

EDIT 1

Changed the last code to exclude dxf codes 41, 42, and 43 as example, X, Y, Z scale factors, if set to negative will mirror text in that axis

EDIT 2

Changed last code to exclude codes 210 and 11, mirroring mtext

Also slight change to code to make it work

Edited by Steven P
Link to comment
Share on other sites

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