Jump to content

Inserting Fence Crossing


caltes75

Recommended Posts

what if you don't know what the points are? i am trying to select text in a coordinate that has been placed like this:

 

abc

n

e

el

 

i want to be able to select all of lines and convert them into one mtext object while still keeping them in the order that appear.

Link to comment
Share on other sites

you are so right. it did not work like that when i used it previously. thank you. do you happen to have or know where i can find the actual code for txt2mtxt command?

Link to comment
Share on other sites

i want to use the code below, but to be able to select a group of text all at once and still be able to keep their same order from top to bottom. any thoughts?

(defun Merge()
 (if (and (setq ss (ssget '((0 . "MTEXT,TEXT")))) ;Select both MText & DText
  (> (sslength ss) 1) ;Check if more than one selected
   ) ;end of and
   (progn
     (setq n 1 ;Initialize counter
    en (ssname ss 0) ;Get 1st selected
    ed (entget en) ;Get its DXF data
    txt (cdr (assoc 1 ed)) ;Get its textvalue
    ) ;_ end of setq
     (if (= (cdr (assoc 0 ed)) "TEXT") ;If the 1st is a DText
(progn
  (command "txt2mtxt" en "") ;Convert it to a MText     
  (setq obj (vlax-ename->vla-object (entlast)))
  (vlax-put-property obj 'LineSpacingFactor 1)
  (vlax-put-property obj 'LineSpacingDistance 0.25)
    (vlax-put-property obj 'LineSpacingStyle 2)
  (setq en (entlast)) ;Get the new MText
  ) ;_ end of progn
) ;_ end of if
     (setq eo (vlax-ename->vla-object en)) ;Get the ActiveX object of the 1st text
     (while (< n (sslength ss)) ;Step through the rest of the selected text
(setq en (ssname ss n) ;Get the nth text
      ed (entget en) ;Get its DXF data
      ) ;_ end of set
(setq txt (strcat txt "[url="file://\\P"]\\P[/url]" (cdr (assoc 1 ed)))) ;Append its string to add to the 1st text
(entdel en) ;Delete the nth text
(setq n (1+ n)) ;Increment the counter
) ;_ end of while
     (vla-put-TextString eo txt) ;Modify the 1st text to the concatenated string
     (command "_.justifytext" pause "" "ML")
    ) ;_ end of progn
   ) ;_ end of if
 )

Link to comment
Share on other sites

Would you please try this,And I hope it would give a sense.

 

(defun c:Merge (/ ss)
 (if (setq ss
     (ssget "_:L" '((0 . "TEXT"))))
    ((lambda (i / ent )
                   (while
                  (setq ent (ssname ss
				    (setq i (1+ i))))
                        (command "_.txt2mtxt" ent "") 
                      )
              )
                 -1
                 )
   )
 (princ)
 )

 

Tharwat

Link to comment
Share on other sites

Sort your selection set by Y value of each insertion point.

 

(defun _SortSSbyYcoord (ss)
 ;; Alan J. Thompson, 09.22.10
 (if (eq (type ss) 'PICKSET)
   (vl-sort
     ((lambda (i / e l) (while (setq e (ssname ss (setq i (1+ i)))) (setq l (cons e l)))) -1)
     (function (lambda (a b) (> (caddr (assoc 10 (entget a))) (caddr (assoc 10 (entget b))))))
   )
 )
)

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