0% found this document useful (0 votes)
0 views

lisp routine for text manipulation

This document contains AutoLISP code for manipulating points and text in a CAD environment. The functions convert elevation data from centimeters to meters and replace specified text within selected text entities based on clipboard data. It includes utility functions for handling clipboard operations and parsing strings.

Uploaded by

tolga
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
0 views

lisp routine for text manipulation

This document contains AutoLISP code for manipulating points and text in a CAD environment. The functions convert elevation data from centimeters to meters and replace specified text within selected text entities based on clipboard data. It includes utility functions for handling clipboard operations and parsing strings.

Uploaded by

tolga
Copyright
© © All Rights Reserved
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 2

(vl-load-com)

(defun c:txtkot () ;kotları cm ise çalıştır, kotları metreye çevirir


(setq ss (ssget '((0 . "POINT"))) c 0)
(repeat (sslength ss)
(setq dat (entget (ssname ss c)))
(setq p (cdr (assoc 10 dat)) z (last p))
(setq nz (/ z 100.))
(setq np (list (car p) (cadr p) nz))
(entmod (subst (cons 10 np) (assoc 10 dat) dat))

(setq c (1+ c))


);repeat

);defun txtkot

(defun c:qwe ()
(setq dat_tx (getClipText))
(while (vl-string-search "\r" dat_tx) (setq dat_tx (vl-string-subst "" "\r"
dat_tx)))
(setq mm (get_data dat_tx))
(princ "\nDegistirilecek textleri sec:")
(setq txsel (ssget '((0 . "TEXT"))))
(setq c 0)
(repeat (sslength txsel)
(setq ent (ssname txsel c))
(setq dat (entget ent))
(setq txt (cdr (assoc 1 dat)))
(foreach i mm
(if (vl-string-search (car i) txt)
(progn
(setq ntxt (vl-string-subst (cadr i) (car i) txt))
(chtxt dat ntxt)

);progn
);if
);foreach
(setq c (1+ c))
);repeat
);defun qwe

(defun get_data (str / datt ans y1)


(setq datt (parse str "\n"))
(setq ans nil)
(foreach i datt
(setq y1 (parse i "\t"))
(setq ans (append ans (list y1)))
);
ans

);

(defun chtxt (dat str)


(entmod (subst (cons 1 str) (assoc 1 dat) dat))
);defun chtxt

(defun setClipText(str / html result)


(if (= 'STR (type str))
(progn
(setq html (vlax-create-object "htmlfile")
result (vlax-invoke (vlax-get (vlax-get html 'ParentWindow)
'ClipBoardData) 'setData "Text" str)
)
(vlax-release-object html)
str
)
);end if
);defun
(defun getClipText (/ html result)
(setq html (vlax-create-object "htmlfile")
result (vlax-invoke (vlax-get (vlax-get html 'ParentWindow) 'ClipBoardData)
'GetData "Text")
)
(vlax-release-object html)
result
);defun
(defun parse (str delim / lst pos)
(setq pos (vl-string-search delim str))
(while pos
(setq lst (cons (substr str 1 pos) lst)
str (substr str (+ pos 2))
pos (vl-string-search delim str)
)
)
(if (> (strlen str) 0)
(setq lst (cons str lst))
)
(reverse lst)
)

You might also like