Jump to content

ssget or other way to do it


woodman78

Recommended Posts

I am pieceing together a LISP that will allow users to input numbers incementally next to the notes that they can insert from a lisp. I have set it up so that it inserts the numbers on a specific layer. If someone deletes or adds a layer and wants to rerun the numbers, then the layer is deleted and a recreated and the new set of numbers created. I realise that this isn't the best way to do this in case someone has put something on that layer (even with all the warnings not to do so). I have tried to play around a with creating a selection set that will allow me then to create a block with the numbers in it.

 

Can someone help with the code or tell me is there a better way to do this that I am looking at?

 

 
(defun C:notenumbers (/ ECL EOM EOS ECC ECE EFS)
 (setq ECL (getvar "clayer"))
(setq EOM (getvar "orthomode"))
(setq EOS (getvar "osmode"))
(setq ECC (getvar "cecolor"))
(setq ECE (getvar "cmdecho"))
(setq EFS (getvar "style"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(command "laydel" "N" "CCC_SHEET_LAYOUT_Note_Numbers" "" "YES")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   (if (null (tblsearch "STYLE" "CCC_Note_Numbers"))
  (progn
      (entmake
         (list
           (cons 0 "STYLE")
           (cons 100 "AcDbSymbolTableRecord")
           (cons 100 "AcDbTextStyleTableRecord")
           (cons 2 "CCC_Note_Numbers")
           (cons 3 "Verdana.ttf")
           (cons 40 0)
   (cons 74 1) ;Bold
           (cons 70 0)))))
;(command "_-style" "CCC_Note_Numbers" "verdana.ttf" "0" "1" "0" "N" "N")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
   (if (null (tblsearch "layer" "CCC_SHEET_LAYOUT_Note_Numbers"))
      (progn
        (entmake
           (list
             (cons 0   "LAYER")
            (cons 100 "AcDbSymbolTableRecord")
             (cons 100 "AcDbLayerTableRecord")
             (cons 2    "CCC_SHEET_LAYOUT_Note_Numbers")
             (cons 62   7)
             (cons 70   0)
             (cons 370  30)))))
;(command "_-layer" "s" "CCC_SHEET_LAYOUT_Note_Numbers" "")
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(setvar "textstyle" "CCC_Note_Numbers")
(setvar "clayer" "CCC_SHEET_LAYOUT_Note_Numbers") 
(setvar "osmode" 4)
(setq myheight 2.5) 
(setq mynumber 1) 
(setq myincrement 1) 
(setq mypoint (getpoint "\nPick point: "))
(while mypoint
 (command "text" "j" "BL" mypoint myheight "0" (itoa mynumber)) 
 (setq mynumber (+ mynumber myincrement))
 (setq mypoint (getpoint "\nPick point: "))
       )
 ;(setq sel1 (ssget entlast))
                         ;(setq sel1 (ssadd ent sel1))
 (alert (strcat sel1))
 ;(command "_-block" "notenos" "0,0" sel1)

(setvar "clayer" ECL)
)

numbers.jpg

Link to comment
Share on other sites

Yeah I have that downloaded as well but I'm looking for something very simple in this case. The guys in my office tend to shy away from something with many options.

 

That is why I wanted to so it this way. I got this from another lisp and I think it is something along these lines only that this was selecting all the text whereas I want to select only the text I create in this lisp.

 

(setq sset (ssget "_X" '((0 . "TEXT"))) i 0)
 (repeat (sslength sset)
   (setq ent (ssname sset i))
   (setq lst (entget ent))
   (setq i (1+ i))

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