Message 1 of 8

Not applicable
06-28-2016
05:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have gathered bits and pieces of code (As I do not yet know how to code properly in LISP) which I want to simplify so that I only have to select multiple points once and it does both commands.
The problem with the first command "SPOT" is that I'm not given the option to select my points which I want to be able to do, and then use the exact some list of points for the second command without having to select them again.
(defun C:SPOT ( / sset pt ent loc pt2 elv i) (setq sset (ssget "_X" '((0 . "POINT"))) i 0 z (getvar "textsize") ) (if sset (repeat (sslength sset) (setq pt (ssname sset i)) (setq ent (entget pt)) (setq loc (cdr (assoc 10 ent))) (setq pt2 (polar (list (car loc) (cadr loc)) 0.0 z)) (setq elv (last loc)) (entmake (list (cons 0 "TEXT") (cons 100 "AcDbText") (cons 8 "SPOTLEVELS") ;Layer (cons 1 (rtos elv 2 2)) ;Content (cons 10 pt2) ;Insert Point (cons 40 0.4) ;Text Height (cons 41 0.8) ;Text Width (cons 71 1) ;Justification (4=Top Left) (cons 50 0.785398) ;Rotation (Radians) (cons 51 0.261799) ;Oblique Angle (cons 7 "R") ;Text Style (cons 100 "AcDbText") ) ) (setq i (1+ i)) ) (princ "\n No POINT objects found! ") ) (princ) ) (defun c:cross ( / BlockName ss sn) ;; Tharwat - Date: 28.June.2016 ;; (setq BlockNAme "SH_CROSS") ;; Replace ABC with your Block Name and be sure it is not Attributed Block. (if (and (or (tblsearch "BLOCK" BlockName) (progn (princ (strcat "\nBlock name <" BlockName "> is not found in this drawing !")) nil) ) (princ (strcat "\nSelect points to place the block name < " BlockName " > at their insertion point :")) (setq ss (ssget '((0 . "POINT")))) ) (while (setq sn (ssname ss 0)) (entmake (list '(0 . "INSERT") (cons 2 BlockName) (assoc 10 (entget sn)))) (ssdel sn ss) ) ) (princ) ) (defun c:SPOTHEIGHT() (c:SPOT) (c:cross) (princ) )
Solved! Go to Solution.