Jump to content

cell selection joing to string


Recommended Posts

mhupp

To cut down on spam I'm would like to reworking one of my lisp.  Currently for each selected cell its sending the the command + the cell.value to AutoCAD.

So if i have 5 cells selected it runs the command 5 times.

 

What i would like to do now is send one command for all selected cells.

(FT '("cell1.value" "cell2.value" "cell3.value" "cell4.value" "cell5.value"))

 

I have already rewritten the lisp part to handle this.

;;----------------------------------------------------------------------------;;
;; Find Text & Draw Line
(defun FT (lst / x txt SS PT)
  (vl-load-com)
  (setvar 'cmdecho 0)
  (setvar 'clayer "0")
  (foreach x lst
    (setq SS (ssget "_X" (list (cons 0 "*TEXT") (cons 1 (strcat "*" x "*")) (cons 410 (getvar 'ctab)))))
    (if (= SS nil)
      (princ (strcat "\n\"" x "\" Not Found"))
      (foreach txt (mapcar 'cadr (ssnamex SS))
        (Setq PT (cdr (assoc 11 (entget txt))))
        (vl-cmdf "_.Line" "_non" "0,0,0" "_non" PT "")
      )
    )
  )
  (setvar 'cmdecho 1)
  (princ)
)

 

 

Link to post
Share on other sites
BIGAL

I am a bit confused cell do you mean a table cell ? lee-mac has a hittest for picking a cell so could run it twice start - end of range then loop through the table pulling the text values out and making a list.

Link to post
Share on other sites
mhupp

Sorry didn't explain that. highlight cells in excel have a VBA over there that then sends the command to autocad one at a time now but want to build them into a list and send it once.

Link to post
Share on other sites
mhupp

Everything im finding is not set for AutoCAD list.

It would be more (red, Blue, Green)

rather then '("red" "Blue" "Green")

I thinking it might be easier to pass the cell.value one at a time over to CAD and build the list their then run the command.

Link to post
Share on other sites
mhupp

Decided to just put in a alert instead of pompt when something isn't found.

Link to post
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
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...