• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

selection of a text

  • Thread starter Thread starter Angelo2449
  • Start date Start date

Angelo2449

Guest
Hello everyone,
the following program works, surely it will not be a style lesson, but it works.
Code:
 (defunc c:aaaa (/ object string entity name point)

(seq object "group")
(regapp object)
(setq string (entget (entsel)) (group))))
(setq entita (cdr string))
(setq np (assoc 1 authority))
(setq point name (cdr np))
(setq xyz (assoc 10 entities))
(setq gaussboaga (strcat (rtos (cadr xyz)) "," (rtos (caddr xyz))))

(setq thedata (list -3 (cons 1000 point name) (cons 1000 "ecef") (cons 1000 gaussboaga) (cons 1000 station)))

(setq list)
(setq xlist (assoc -3 list)

(entmod list)

(princ "\n")
(princ > > > > > > > > > > > > )
(princ entita)
(princ "\n")

(princ "\n")
(princ "np > > > > > > > > > > > > > > > > > )
(princ np)
(princ "\n")

(princ "\n")
(princ > > > > > > > > > > > > > > > > > > > > > )
(princ point name)
(princ "\n")

(princ "\n")
(princ "xyz > > > > > > > > > > > > > > > > > > > > > )
(princ xyz)
(princ "\n")

(princ "\n")
(princ "gaussboaga > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > )
(princ gaussboaga)
(princ "\n")

(princ "list > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > )
(princ list)
(princ "\n")

)
the programme provides for the selection of a text (stringa) to which the 5 data (thedata) are attached.
If I wanted to, instead of manually selecting a text, select one that was just created with the "_text" command, how should I change the program so that it works?
If someone wants to give me style lessons, it is well accepted!
Thank you.
 
in this program I do not use the "_text" command but I would like a string created with "_text" to be treated as in the program or, instead of manually selecting the string:
> (setq string (entget (entsel)) (group))) <, programme selection and ........... .
Code:
(command "_text"......... string)
automatic string selection
(setq entita (cdr string))
(setq np (assoc 1 authority))
(setq point name (cdr np))
(setq xyz (assoc 10 entities))
......
....
grazie.
 
I rewrote the routine (it didn't work, renamed some variables), divided into command (c:aaaa) and function (aaaa_motor named), with aaaa you have the classical command, with aaaaa_motor you can call it from anywhere passing the name of the entity.
to recover the name of the last entity inserted, you can use (ssname (ssget "_l") 0) or the function I entered in the file lisp fnnomelastent(), does the same but is more beautiful.
 

Attachments

Hello rpor66,
as you see I am already here, I studied your edit and I learned something again!
I have another question:
I would like to apply the routine that you have made working on a text just created by the routine itself.
I'll explain.
I create a text with > (command "_text" ...... string)
instead of selecting string with : (setq oldlist (entget nomeentita))
I would like to select it automatically and then continue with the routine.
the purpose is to create a point with its name and associate it with the data I want, exactly as in the routine.
Thank you.
 
I answer to myself having found the solution to the question:
Code:
(defun c:attruno (/ naming gaussboaga oldlist name point xyz np naming newlist thedata object)

(setq gaussboaga "1498789.9620.5042438.9823")
(command "_text" gaussboaga 0.40 0 "point")
(setq naming (entlast))

(seq object "group")

(if (not (tblsearch "appid" object)
(regapp object)
)

(setq oldlist (entget nomeentita)

(setq np (assoc 1 oldlist)
(setq point name (cdr np))
(setq xyz (cdr 10 oldlist))
(setq gaussboaga (strcat (rtos (car xyz)) "," (rtos (cadr xyz))))

(setq thedata (list -3 (cons 1000 point name) (cons 1000 "ecef") (cons 1000 gaussboaga) (cons 1000 station)))

(setq newlist)
(entmod newlist)
)
of course in the code there are repetitions (gaussboaga) but demonstrate the good functioning of the routine.
Thank you.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top