LISP TO SPLIT TEXT

LISP TO SPLIT TEXT

pink_floid23
Enthusiast Enthusiast
4,679 Views
7 Replies
Message 1 of 8

LISP TO SPLIT TEXT

pink_floid23
Enthusiast
Enthusiast

HI

I need lisp can split the text to two text and two layers , split from letter or simple i enter it in command. 

and the lisp work on a lot of texts  , not one by one

0 Likes
Accepted solutions (2)
4,680 Views
7 Replies
Replies (7)
Message 2 of 8

ВeekeeCZ
Consultant
Consultant

ALWAYS post 2 drawings. One this your current state, the second one with the wanted result.

 

btw the same applies to your another thread where you talking too much without much understanding.

0 Likes
Message 3 of 8

pink_floid23
Enthusiast
Enthusiast

thanks , i didn't know how to make lisp , i try to explain what i want ..

 

Message 4 of 8

hak_vz
Advisor
Advisor
Accepted solution

@pink_floid23 Try this

 

 

(defun c:splittext ( / string_to_list e ent p1 cont nt del )
(defun string_to_list ( str del / pos )
(if (setq pos (vl-string-search del str))
(cons (substr str 1 pos) (string_to_list (substr str (+ pos 1 (strlen del))) del))
(list str)))
(setq e (car (entsel "\nSelect text >")))
(setq ent (entget e))
(setq p1 (cdr (assoc 10 ent)))
(setq cont (string_to_list (cdr (assoc 1 ent)) "-"))
(setvar 'cmdecho 0)
(while cont
(setq nt (car cont) cont (cdr cont))
(setq del (* 1.2(caadr(textbox ent))))
(command "_.copy" e "" p1 (setq p1 (polar p1 0 del)) "")
(setq e (entlast) ent (entget e))
(setq ent(subst (cons 1 nt) (assoc 1 ent) ent))
(setq ent(entmod ent))
)
(setvar 'cmdecho 1)
(princ)
)

 

 

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes
Message 5 of 8

pbejse
Mentor
Mentor
Accepted solution

@pink_floid23 wrote:

thanks , i didn't know how to make lisp , i try to explain what i want ..


(Defun c:SplitMeBuddy (/ ss i e str p d ent ents pts pt ds)
  (if (setq ss (ssget "X" '((0 . "TEXT") (1 . "*-*mm"))))
    (repeat (setq i (sslength ss))
      (setq e	 (ssname ss (setq i (1- i)))
	    str	 (cdr (assoc 1 (setq ent (entget e))))
	    p	 (vl-string-position 45 str)
	    d	 (mapcar '(lambda (x) (assoc x ent)) '(11 50 1 40 7))
	    ent2 ent
      )
      (setq pts	(textbox (Cddr d))
	    pt	(cdr (car d))
      )
      (setq ds (* (- (caadr pts) (caar pts)) 0.25))
      (entmod
	(append	ent
		(list (cons 1 (substr str 1 p))
		      '(8 . "TS-SJ-TEXT")
		      (cons 11 (polar pt (+ pi (cdr (cadr d))) ds))
		)
	)
      )
      (entmake
	(append	ent2
		(list (cons 1 (substr str (+ 2 p)))
		      '(8 . "TS-SJ-DIA")
		      (cons 11 (polar pt (cdr (cadr d)) ds))
		)
	)
      )

    )
  )(princ)
)

HTH

0 Likes
Message 6 of 8

pink_floid23
Enthusiast
Enthusiast

thank you very much 🌹

0 Likes
Message 7 of 8

pink_floid23
Enthusiast
Enthusiast

thank you very much 🌹 , and hope you make fix to the attribute block lisp

0 Likes
Message 8 of 8

hak_vz
Advisor
Advisor

@pink_floid23If you are satisfied with provided codes, accept them as solution (both @pbejse  and my solution).

Miljenko Hatlak

EESignature

Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
0 Likes