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

select items and add extended files

  • Thread starter Thread starter Angelo2449
  • Start date Start date
I'm still here.
I applied :
Code:
 (setq list one (subst (cons 1000 "ok1") (cons 1000 "1") (cons 1000 "ok2") list)
(entmod list one)
and get the error message: "too many arguments".
Thank you.
 
(setq lista (subst (cons 1000 "ok1") (cons 1000 "1") lista))
(setq lista (subst (cons 1000 "ok2") (cons 1000 "2") lista))
(entmod lista)

uno alla volta
 
I had already tried this solution but it does not work the 4th and 5th given are not changed, there is no error.
Then if I insert the three instructions, the point name is not changed otherwise you!
This is code :
Code:
(defun c:final (/ fc3 control7 check5 list txt1 xlist primed txtdata point ecef gaussboaga control2 fp2)

(if (= primariga nil)
(progn)
(alert "you must first define the initial summit (baseline)")
(exit)
)
)

(setq fc3 (findfile "c:\\\\autocadsupporto\\\note\\\\\nota.dat"))

(if fc)
(vl-file-delete "c:\\\autocadsupport\\\note\\\nota.dat")
)

; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(setq control7 nil)
(setq control7 (findfile "c:\\\autocadsupport\\\contatori\\\counter.dat"))

(if (= check7 "c:\\autocadsupport\\\contatori\\\counter.dat")
(progn)
(setq fp4 (open "c:\\\\autocadsupport\\\contatori\\\counter.dat" "r"))
(setq count (read-line fp4))
(setq step (read-line fp4))
(close fp)
)
)

; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(setq control5 nil)

(setq control5 (findfile "c:\\\autocadsupport\\\dati\\\datirilievo.dat"))

(if (= check5 "c:\\autocadsupport\\dati\\datirilievo.dat")
(progn)
(setq fp3 (open "c:\\\autocadsupport\\\dati\\datirilievo.dat" "r"))
(setq current date (read-line fp3))
(setq ora1 (read-line fp3))
(setq ora2 (read-line fp3))
(setq pdop (read-line fp3))
(close fp)
)
)

(startapp "c:\\autocadsupporto\\\liberty\\\point.exe "c:\autocadsupport\\\\\\\\point.tkn")

(setq list nil)
(sing)
(= list nil)
(setq list (entget (entsel)) (group))))
)

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

(setq txt1 (assoc 1 list)
(princ "\n")
(princ txt)
(princ "\n")

(setq nomeentita (assoc -1 list)
(princ "\n")
(princ nomeentita)
(princ "\n")

(setq xlist (assoc -3 list)
(princ "\n")
(princ "xlist > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ xlist)
(princ "\n")

(setq primed (car txt1))
(setq txtdata (car))
(princ "\n")
(princ "txtdata > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ txtdata)
(princ "\n")

(setq point name (nth 1 txtdata)))
(setq ecef (nth 2 txtdata)))
(setq gaussboaga (nth 3 txtdata)))
(setq controllerstz (nth 4 txtdata)))
(setq controller)

(princ "\n")
(princ point name)
(princ "\n")
(princ ecef)
(princ "\n")
(princ gaussboaga)
(princ "\n")

(Sectq point nil)
(setq notay nil)

(seq control2 nil)

(while (= control2 nil)
(setq control2 (findfile "c:\\\autocadsupporto\\\note\\\\nota.dat"))
)

(setq fp2 (open "c:\\\\autocadsupporto\\note\\\nota.dat" "r"))
(setq point (read-line fp2))
(setq notay (read-line fp2))
(close fp)

(princ "\n")
(princ point)
(princ "\n")
(princ notay)
(princ "\n")

(setq cxp (substr ecef 1 11)
(setq cyp (substr ecef 13 11) ; here 11
(setq czp (substr ecef 24 11)
(setq cxpp (atof cxp)
(setq cypp (atof cyp)
(setq czpp (atof czp))

(princ "\n")
(princ "cxp > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  "
(princ "\n")
(princ cxp)
(princ "\n")
(princ)
(princ "\n")
(princ cyp)
(princ "\n")
(princ)
(princ "\n")
(princ czp)
(princ "\n")

(princ "\n")
(princ "cxbb > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  "
(princ "\n")
(princ cxbb)
(princ "\n")
(princ "cybb > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ "\n")
(princ cybb)
(princ "\n")
(princ "czbb > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ "\n")
(princ czbb)

(setq diffx (* -1 (- cxbb cxpp)))
(setq diffy (* -1 (- cybb cypp)))
(setq diffz (* -1 (- czbb czpp)))

(setq diffxx (rtos diffx)
(setq diffyy (rtos diffy)
(setq diffzz (rtos diffz)
(setq xxyyzz (strcat diffxx "," diffyy "," diffzz))

(setq note2 (strcat name " - " notay " - " point))
(setq line (strcat "2|" point "|" xxyyzz "|0,0,0,0,0,0|pdop=" pdop "|0.000" note2 "|"))

(setq fp1 (open "c:\\\autocadsupport\\\\librettopregeo.dat" "a"))
(write-line line fp1)
(close fp)

;------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(command "_circle" gaussboaga "0.15")
(setq newtext (strcat " point " - " point name))
(command "_change" primed """ """ """ newtext)

(princ "\n")
(prince > > > > > > > > > )
(princ primed)
(princ "\n")
(princ "newtext" > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  "
(princ newtext)

(setq count1)
(setq pointn)

(if (= pointn (+ count1) (too)))
(progn)
(setq count2 (+ count1 10))
(setq count3 (itoa count2)
)
(setq count3 count)
)

(setq fp4 (open "c:\\\\autocadsupport\\\contatori\\\counter.dat" "w"))
(write-line count3 fp4)
(write-line step fp4)
(close fp)

(setq index (strcat index point name))

; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(setq listuno (subst (cons 1000 "ok1") (cons 1000 "1") list)
(setq listuno (subst (cons 1000 "ok2") (cons 1000 "2") list)
(instead of one list)

; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(alert "dates of the final summit saved")

) final procedure
It also happens that if the point selection occurs with a close zoom, the point name is not changed.
I had entered education (setvar "osmode" 0) but it does not affect, the problem remains.
Thank you.
 
I forgot to say that I have insert the instructions
Code:
 (setq listauno (subst (cons 1000 "ok1") (cons 1000 "1") lista))
(setq listauno (subst (cons 1000 "ok2") (cons 1000 "2") lista))
(entmod listauno)
come
Code:
 (setq lista (subst (cons 1000 "ok1") (cons 1000 "1") lista))
(setq lista (subst (cons 1000 "ok2") (cons 1000 "2") lista))
(entmod lista)
but the result is identical.
I also removed the "list" variable from the initial statement, nothing!
I send you all the files including the dwg file.
Thank you.
 

Attachments

Sorry, running I didn't realize that subst applied it to the data of the extended entities.
to change them follow these steps:

- read the data and store the extended data
(Sectq) List (entget (car (entsel) '("gruppo")))
(setq xd_ent (cdr (assoc -3 List)

- the code section
(setq list (subst (cons 1000 "ok1") (cons 1000 "1") list)
(setq list (subst (cons 1000 "ok2") (cons 1000 "2") list)

replace it with reconfiguration of extended data; read the data, change the variable values and recompil the list (it is an example, I don't have your share of code where you read the data):
(Sectq) The nist (list (list "gruppo" (cons 1000 txt1) (cons 1000 txt2) (cons 1040 del))))
(setq List (subst (cons -3 The nist) (cons -3 xd_ent) List)
(ent List)

practically modify in one shot only the entire sublist of the extended data, identified by -3.
 
thanks rpor66,
I think I didn't understand well, I applied, definitely wrong, your suggestions and I have problems.
A little more patience, please.
Code:
(defun c:final (/ fc3 control7 check5 list xlist txt1 name xlist primed txtdata point ecef gaussboaga control2 fp2)

(if (= primariga nil)
(progn)
(alert "you must first define the initial summit (baseline)")
(exit)
)
)

(setq fc3 (findfile "c:\\\\autocadsupporto\\\note\\\\\nota.dat"))

(if fc)
(vl-file-delete "c:\\\autocadsupport\\\note\\\nota.dat")
)

; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(setq control7 nil)
(setq control7 (findfile "c:\\\autocadsupport\\\contatori\\\counter.dat"))

(if (= check7 "c:\\autocadsupport\\\contatori\\\counter.dat")
(progn)
(setq fp4 (open "c:\\\\autocadsupport\\\contatori\\\counter.dat" "r"))
(setq count (read-line fp4))
(setq step (read-line fp4))
(close fp)
)
)

; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(setq control5 nil)

(setq control5 (findfile "c:\\\autocadsupport\\\dati\\\datirilievo.dat"))

(if (= check5 "c:\\autocadsupport\\dati\\datirilievo.dat")
(progn)
(setq fp3 (open "c:\\\autocadsupport\\\dati\\datirilievo.dat" "r"))
(setq current date (read-line fp3))
(setq ora1 (read-line fp3))
(setq ora2 (read-line fp3))
(setq pdop (read-line fp3))
(close fp)
)
)

(startapp "c:\\autocadsupporto\\\liberty\\\point.exe "c:\autocadsupport\\\\\\\\point.tkn")

(setq list nil)
(sing)
(= list nil)
(setq list (entget (entsel)) (group))))
(setq xd_ent (cdr -3 list))
)

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

(setq txt1 (assoc 1 list)
(princ "\n")
(princ txt)
(princ "\n")

(setq nomeentita (assoc -1 list)
(princ "\n")
(princ nomeentita)
(princ "\n")

(setq xlist (assoc -3 list)
(princ "\n")
(princ "xlist > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ xlist)
(princ "\n")

(setq primed (car txt1))
(setq txtdata (car))
(princ "\n")
(princ "txtdata > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ txtdata)
(princ "\n")

(setq point name (nth 1 txtdata)))
(setq ecef (nth 2 txtdata)))
(setq gaussboaga (nth 3 txtdata)))
(setq controllerstz (nth 4 txtdata)))
(setq controller)

(princ "\n")
(princ point name)
(princ "\n")
(princ ecef)
(princ "\n")
(princ gaussboaga)
(princ "\n")

(Sectq point nil)
(setq notay nil)

(seq control2 nil)

(while (= control2 nil)
(setq control2 (findfile "c:\\\autocadsupporto\\\note\\\\nota.dat"))
)

(setq fp2 (open "c:\\\\autocadsupporto\\note\\\nota.dat" "r"))
(setq point (read-line fp2))
(setq notay (read-line fp2))
(close fp)

(princ "\n")
(princ point)
(princ "\n")
(princ notay)
(princ "\n")

(setq cxp (substr ecef 1 11)
(setq cyp (substr ecef 13 11) ; here 11
(setq czp (substr ecef 24 11)
(setq cxpp (atof cxp)
(setq cypp (atof cyp)
(setq czpp (atof czp))

(princ "\n")
(princ "cxp > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  "
(princ "\n")
(princ cxp)
(princ "\n")
(princ)
(princ "\n")
(princ cyp)
(princ "\n")
(princ)
(princ "\n")
(princ czp)
(princ "\n")

(princ "\n")
(princ "cxbb > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  "
(princ "\n")
(princ cxbb)
(princ "\n")
(princ "cybb > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ "\n")
(princ cybb)
(princ "\n")
(princ "czbb > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ "\n")
(princ czbb)

(setq diffx (* -1 (- cxbb cxpp)))
(setq diffy (* -1 (- cybb cypp)))
(setq diffz (* -1 (- czbb czpp)))

(setq diffxx (rtos diffx)
(setq diffyy (rtos diffy)
(setq diffzz (rtos diffz)
(setq xxyyzz (strcat diffxx "," diffyy "," diffzz))

(setq note2 (strcat name " - " notay " - " point))
(setq line (strcat "2|" point "|" xxyyzz "|0,0,0,0,0,0|pdop=" pdop "|0.000" note2 "|"))

(setq fp1 (open "c:\\\autocadsupport\\\\librettopregeo.dat" "a"))
(write-line line fp1)
(close fp)

;------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(command "_circle" gaussboaga "0.15")
(setq newtext (strcat " point " - " point name))
(command "_change" primed """ """ """ newtext)

(princ "\n")
(prince > > > > > > > > > )
(princ primed)
(princ "\n")
(princ "newtext" > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >  "
(princ newtext)

(setq count1)
(setq pointn)

(if (= pointn (+ count1) (too)))
(progn)
(setq count2 (+ count1 10))
(setq count3 (itoa count2)
)
(setq count3 count)
)

(setq fp4 (open "c:\\\\autocadsupport\\\contatori\\\counter.dat" "w"))
(write-line count3 fp4)
(write-line step fp4)
(close fp)

(setq index (strcat index point name))

; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(setq nlist (list "group" (cons 1000 "undefined") (cons 1000 point name) (cons 1040 del)))))
(setq list (subst (cons -3 nlist) (cons -3 xd_ent) list)
(entmod list)

; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(alert "dates of the final summit saved")

) final procedure
See what you can do, I really want to know where the problem is, thank you.
 
Hello rpor66,
the final procedure < finally works, now I am writing this code :
Code:
 (defunc c:aripo (/ pointa puntob ray string gb gaussboaga np point)

(setq point (car (entsel "\nselect the point")))

(setq string (entget point))
(setq np (assoc 1 string)
(setq gb (assoc 10 string))

(setq gaussboaga (cdr gb))
(setq point name (cdr np))

(setq radius 1.00)

(setq ecef "444444444.444,5555555.555,666666666.666")
(setq station "2000")

;; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(setq xd_ent (cdr -3 string)))

(setq xlist (list "group" (cons 1000 point name) (cons 1000 ecef) (cons 1000 gaussboaga) (cons 1000 station)))
(setq list (subst (cons -3 xlist) (cons -3 xd_ent) list)

(entmod list)

;; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

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

(princ "stringa > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > )
(princ string)
(princ "\n")

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

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

(by point)
(command "_erase" gaussboaga ")
(command "_circle" gaussboaga ray)

(setq postratt (vl-string-search "-" point name))
(setq first point name (substr point name (+ postratt 3)))
(princ "first name > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >
(first point)
(princ "\n")

(command "_text" gaussboaga 0.40 first name)
)
I would like the point that is selected, to belong to "group" and to associate the items listed in xlist.
I would, because the code, so, doesn't work!
Thank you.
 
(setq xd_ent (cdr) String)))

(setq xlist (list "gruppo" (cons 1000 nomepunto) (cons 1000 ecef) (cons 1000 gaussboaga) (cons 1000 stazione) (cons 1000 "non-definito")))
(setq lista (subst (cons -3 xlist)) (cons -3 xd_ent) List)

1) extract the list of extended data from string (which is the original list)
2) Create the new list
3) replace the list of extended data in list (which is nil); Replace it with string.
 
Thank you.
Now the program turns without errors but what then extracts the data does not work, easy to understand why but I can not remedy it:
Code:
(defun c:estraiext (/ fc3 list name ecef gaussboaga controlstz controllerpt)

(setq fc3 (findfile "c:\\\\autocadsupport\\\extended.dat"))

(if fc)
(vl-file-delete "c:\\\autocadsupport\\'esteso.dat")
)

(setq list (entget (entsel)) (group))))
(setq xlist (assoc -3 list)

(if (= xlist nil)
(alert "the selected string is not suitable, no extended data is associated!")
)

(setq ylist (assoc 1 list)
(setq txtdata (car))

(princ "\n")
(princ "xlist > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ xlist)
(princ "\n")
(princ "ylist > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ ylist)
(princ "\n")
(princ > > > > > > > > )
(princ txtdata)
(princ "\n")

(setq point name (cdr ylist)
(setq ecef (nth 2 txtdata)))
(setq gaussboaga (nth 3 txtdata)))
(setq controllerstz (nth 4 txtdata)))
(setq controllerpt (cdr (nth 5 txtdata))))

(setq fp2 (open "c:\\\\autocadsupporto\\esteso.dat" "w"))
(write-line point name fp2)
(write-line ecef fp2)
(write-line gaussboaga fp2)
(write-line controllerstz fp2)
(write-line controllerpt fp2)
(close fp)

(setq control8 nil)
(while)
(setq control8 (findfile "c:\\\autocadsupport\\extended\\\'esteso.dat"))
)

(if control8
(startapp "c:\autocadsupporto\\\liberty\\\estesi.exe "c:\\autocadsupporto\\\liberty\\estesi.tkn")
)


)
grazie.
 
Here I am again,
I applied your valuable suggestions with great results but, this does not want to know how to work properly!
I wrote the routine, it works, then I inserted the part between the two double rows of dashes and the fourth element of thedata does not work:
Code:
(defun c:acelerimetrico2dinput (/ fc2 fp1 control1 fp5 fp1 name puntoone notion dotted cx cy xyz comment dist anglestr lung anglestr gaussboaga oldlist np name thedata newlist)

(if)
(progn)
(setq fp1 (open "c:\\\autocadsupporto\\help\\datihelp.dat" "w"))
(write-line "celerimetric2dinput" fp1)
(close fp)
(startapp "c:\autocadsupporto\\\liberty\\\\helpgen.exe "c:\\autocadsupport\\\\liberty\\\\helpgen.tkn")
(exit)
)
)

(setq fc2 (findfile "c:\\\\autocadsupporto\celerimetric\\\datiori.dat"))

(if fc)
(vl-file-delete "c:\\\autocadsupport\\\celerimetric\\\\datiori.dat")
)

; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(startapp "c:\autocadsupport\\\\liberty\\2dceloriinput.exe "c:\\\autocadsupport\\liberty\\\2dceloriinput.tkn")

; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(setq spotted (getpoint "\nclick point"))

(seq control1 nil)
(while (= control1 nil)
(setq control1 (findfile "c:\\\autocadsupport\\\celerimetric\\\ datiori.dat"))
)

(if (= control1 "c:\\\autocadsupport\\\celerimetric\\datiori.dat")
(progn)
(setq fp5 (open "c:\\\\autocadsupporto\\celerimetric\\\\datiori.dat" "r"))
(setq name puntoone (read-line fp5))
(setq notaone (read-line fp5))
(close fp)
)
)

(command "_circle" point 0.15)

(setq cx (car point))
(setq cy)

(setq cxx (+ cx 0.00))
(setq cyyy (+ cy 0.25))

(setq xyz (list cxx cyy 0.0)

(print xyz)
(print "\n")

(command "_text" xyz 0.40 0 (strcat "name))
(command "_change" "_last" "_p" "_c" "_red"")

;; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(setq naming (entlast))
(seq object "group")

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

(setq oldlist (entget nomeentita)
(setq gaussboaga (strcat (rtos cx) "," (rtos cy))

(setq thedata (list -3 (cons 1000 nomepuntoone) (cons 1000 "-----------") (cons 1000 gaussboaga) (cons 1000 "--------------") (cons 1000 "definite"))))

(setq newlist)
(entmod newlist)

;; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(command "_line" point1 ")
(setq dist (distance point1 point))

(setq angle (- organg (angle point1 point)))
(if (< angle 0 ) (seq angle (+* 2 pi) angle)))
(setq anglestr (angtos angle 2 4))
(setq lung (- (strlen anglestr) 1))
(setq anglestr (substr anglestr 1 lung))

(setq comment notary)

(setq fp2 (open "c:\\\autocadsupport\\\\librettopregeo.dat" "a"))

(if)
(setq txtoutldue (strcat "2|" name "|" cornerstr "|" (rtos dist 2 3) "|"))
(setq txtoutldue (strcat "2|" name "|" cornerstr "|" (rtos dist 2 3) "|" comment "|")
)

(write-line txtoutldue fp2)
(close fp)

(alert "horizontal data stored")
(princ "\n")

) ; fine celerimetric command2dinput
I get this error message:

command: ; error: wrong dxf group: (-3 ("group" (1000 . " 1060") (1000 . "-------------") (1000 . "1498792.8525.5042429.7398") (1000 . "definite"))

where the fourth element, instead of "----------------," is nothing!
Lisp = despair!
Thank you.
 
Here I am again,
I applied your valuable suggestions with great results but, this does not want to know how to work properly!
I wrote the routine, it works, then I inserted the part between the two double rows of dashes and the fourth element of thedata does not work:
Code:
(defun c:acelerimetrico2dinput (/ fc2 fp1 control1 fp5 fp1 name puntoone notion dotted cx cy xyz comment dist anglestr lung anglestr gaussboaga oldlist np name thedata newlist)

(if)
(progn)
(setq fp1 (open "c:\\\autocadsupporto\\help\\datihelp.dat" "w"))
(write-line "celerimetric2dinput" fp1)
(close fp)
(startapp "c:\autocadsupporto\\\liberty\\\\helpgen.exe "c:\\autocadsupport\\\\liberty\\\\helpgen.tkn")
(exit)
)
)

(setq fc2 (findfile "c:\\\\autocadsupporto\celerimetric\\\datiori.dat"))

(if fc)
(vl-file-delete "c:\\\autocadsupport\\\celerimetric\\\\datiori.dat")
)

; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(startapp "c:\autocadsupport\\\\liberty\\2dceloriinput.exe "c:\\\autocadsupport\\liberty\\\2dceloriinput.tkn")

; --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(setq spotted (getpoint "\nclick point"))

(seq control1 nil)
(while (= control1 nil)
(setq control1 (findfile "c:\\\autocadsupport\\\celerimetric\\\ datiori.dat"))
)

(if (= control1 "c:\\\autocadsupport\\\celerimetric\\datiori.dat")
(progn)
(setq fp5 (open "c:\\\\autocadsupporto\\celerimetric\\\\datiori.dat" "r"))
(setq name puntoone (read-line fp5))
(setq notaone (read-line fp5))
(close fp)
)
)

(command "_circle" point 0.15)

(setq cx (car point))
(setq cy)

(setq cxx (+ cx 0.00))
(setq cyyy (+ cy 0.25))

(setq xyz (list cxx cyy 0.0)

(print xyz)
(print "\n")

(command "_text" xyz 0.40 0 (strcat "name))
(command "_change" "_last" "_p" "_c" "_red"")

;; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(setq naming (entlast))
(seq object "group")

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

(setq oldlist (entget nomeentita)
(setq gaussboaga (strcat (rtos cx) "," (rtos cy))

(setq thedata (list -3 (cons 1000 nomepuntoone) (cons 1000 "-----------") (cons 1000 gaussboaga) (cons 1000 "--------------") (cons 1000 "definite"))))

(setq newlist)
(entmod newlist)

;; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;; ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

(command "_line" point1 ")
(setq dist (distance point1 point))

(setq angle (- organg (angle point1 point)))
(if (< angle 0 ) (seq angle (+* 2 pi) angle)))
(setq anglestr (angtos angle 2 4))
(setq lung (- (strlen anglestr) 1))
(setq anglestr (substr anglestr 1 lung))

(setq comment notary)

(setq fp2 (open "c:\\\autocadsupport\\\\librettopregeo.dat" "a"))

(if)
(setq txtoutldue (strcat "2|" name "|" cornerstr "|" (rtos dist 2 3) "|"))
(setq txtoutldue (strcat "2|" name "|" cornerstr "|" (rtos dist 2 3) "|" comment "|")
)

(write-line txtoutldue fp2)
(close fp)

(alert "horizontal data stored")
(princ "\n")

) ; fine celerimetric command2dinput
I get this error message:

command: ; error: wrong dxf group: (-3 ("group" (1000 . " 1060") (1000 . "-------------") (1000 . "1498792.8525.5042429.7398") (1000 . "definite"))

where the fourth element, instead of "----------------," is nothing!
Lisp = despair!
Thank you.
 
Did you try to turn off the osnap? used to check, whenever you draw something on screen, the need to have activated osnap.
 
thanks rpor,
must I set "osnap" to zero or what?
another question, I can't make this routine work, I always get the message "wrong subject" :
Code:
(defun c:estraiext (/ fc3 list name ecef gaussboaga checkstz controllerpt nomex)

(if (= primariga nil)
(progn)
(alert "you must first prepare the relief with > preparepoints <")
;(exit)
)
)

(setq fc3 (findfile "c:\\\\autocadsupport\\\extended.dat"))

(if fc)
(vl-file-delete "c:\\\autocadsupport\\'esteso.dat")
)

(setq list (entget (entsel)) (group))))

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

(setq xlist (assoc -3 list)

(if (= xlist nil)
(alert "the selected string is not suitable, no extended data is associated!")
)

(setq ylist (assoc 1 list)
(setq txtdata (car))

(princ "\n")
(princ "xlist > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ xlist)
(princ "\n")
(princ "ylist > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ ylist)
(princ "\n")
(princ > > > > > > > > )
(princ txtdata)
(princ "\n")

(setq nomex (cdr)
(setq type of point (nth 2 txtdata)))
(setq share (cdr (nth 3 txtdata))))
(setq ecef (nth 4 txtdata)))
(setq gaussboaga (cdr 5 txtdata)))
(setq controllerstz (nth 6 txtdata)))
(setq controllerpt (nth 7 txtdata)))

(setq fp2 (open "c:\\\\autocadsupporto\\esteso.dat" "w"))
(write-line namex fp2)
(write-line point type fp2)
(write-line quota fp2)
(write-line ecef fp2)
(write-line gaussboaga fp2)
(write-line controllerstz fp2)
(write-line controllerpt fp2)
(close fp)

(setq control8 nil)
(while)
(setq control8 (findfile "c:\\\autocadsupport\\extended\\\'esteso.dat"))
)

(if control8
(startapp "c:\autocadsupporto\\\liberty\\\estesi.exe "c:\\autocadsupporto\\\liberty\\estesi.tkn")
)


)
the problem definitely lies in the definition of the 7 parameters of "txtdata" not understanding the reason.
I use this routine after performing this other:
Code:
(defun c:preparapunti (/ object string n entitiesta text txt1 txt2 lungh thedata newlist namepoint typepoint quoteslm nomex)

(Setvar "osmode" 0)
(Section 0)

(seq object "group")
(regapp object)
(setq string (ssget "_x"(0 . "text,mtext")(1 . "p*")))))

(repeat (setq n (sslength stringa))
(setq entityta (ssname stringa (setq n (1-n)))))

(Sectq text)
(setq txt1 (assoc 1 text))

(setq point name (cdr txt1))

(setq pospar (vl-string-search)
(setq nomex (substr point 1 (- pospar 1)))

(princ "\n")
(princ "nomex > > > > > > > > > > > )
(princ nomex)
(princ "\n")

(setq quota (substr point name (+ pospar 2) 6)

(princ "\n")
(princ "quota > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > )
(princ quota)
(princ "\n")

(setq txt2 (cdr txt1))
(Sectq lungh (- (strlen txt2) 36)
(setq xyz (assoc 10 text)

(princ "text > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 
(princ text)
(princ "\n")
(princ "txt" > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > "
(princ txt)

(setq gaussboaga (strcat (rtos (cadr xyz)) "," (rtos (caddr xyz))))
(princ "\n")
(princ gaussboaga)
(princ "\n")
(princ text)
(princ "\n")

(princ "\n")
(setq ecef (substr txt2 (+ 2 lungh) 35))
(princ ecef)
(princ "\n")
(setq type "generic" point)
(setq cstz "not included")
(setq cpt "undefined")

(setq oldlist (entget entita))
(setq thedata (list -3 (cons 1000 nomex) (cons 1000 point type) (cons 1000 quota) (cons 1000 ecef) (cons 1000 gaussboaga) (cons 1000 cstz)))
(princ 'thedata > > > > > > > > > > > > > > > > > )
(princ thedata)
(princ "\n")
(princ "----------------------)
(princ "\n")

(setq newlist)
(entmod newlist)

(command "_change" entita "" "" "" """ "" nomex)
);repeat

(Section 1
(command "_style" "arial" "arial.ttf" 0 1 0 "")
(alert "relief setting performed")

);
Grazie!
 
I managed to fix the "extraiext" routine, now it works, this is the code:
Code:
(defun c:estraiext (/ fc3 list name ecef gaussboaga checkstz controllerpt nomex)

(if (= primariga nil)
(progn)
(alert "you must first prepare the relief with > preparepoints <")
;(exit)
)
)

(setq fc3 (findfile "c:\\\\autocadsupport\\\extended.dat"))

(if fc)
(vl-file-delete "c:\\\autocadsupport\\'esteso.dat")
)

(setq list (entget (entsel)) (group))))

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

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

(princ "\n")
(princ > > > > > > > > )
(princ txtdata)

(if (= xlist nil)
(alert "the selected string is not suitable, no extended data is associated!")
)

(setq string)

(princ "\n")
(princ "stringa > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > )
(princ string)

(setq nomex (cdr)
(setq nomex (substr nomex 2))
(setq type of point (nth 2 txtdata)))
(setq share (cdr (nth 3 txtdata))))
(setq ecef (nth 4 txtdata)))
(setq gaussboaga (cdr 5 txtdata)))
(setq controllerstz (nth 6 txtdata)))
(setq controllerpt (nth 7 txtdata)))

(princ "\n")
(princ "nomex > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > )
(princ nomex)

(princ "\n")
(princ "type > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > )
(princ type-point)

(princ "\n")
(princ "quota > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > )
(princ quota)

(princ "\n")
(princ "ecef > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > )
(princ ecef)

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

(princ "\n")
(princ "controllostz > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > )
(princ controllerstz)

(princ "\n")
(princ "controllopt > > > > > > > > > > > > > > > > > > > > > > > > > > )
(princ controllerpt)
(princ "\n")

(setq fp2 (open "c:\\\\autocadsupporto\\esteso.dat" "w"))
(write-line namex fp2)
(write-line point type fp2)
(write-line quota fp2)
(write-line ecef fp2)
(write-line gaussboaga fp2)
(write-line controllerstz fp2)
(write-line controllerpt fp2)
(close fp)

(setq control8 nil)
(while)
(setq control8 (findfile "c:\\\autocadsupport\\extended\\\'esteso.dat"))
)

(if control8
(startapp "c:\autocadsupporto\\\liberty\\\estesi.exe "c:\\autocadsupporto\\\liberty\\estesi.tkn")
)

)
remains the question for "osnap", thank you.
 
in the previous discussion I had inserted a function:
(defun setosnaponoff(mode/osmode)
(setq osmode (getvar "osmode")
(if)
(if) osmode 16384)
(Setvar "osmode" (- osmode 16384))
)
(if) osmode 16384)
(setvar "osmode" (+ osmode 16384))
)
)
)

insert it into the file lisp or create a file that calls you back from yours, when you want to turn off the osnap add the command (setosnaponoff "off") and when you want to turn it on (setosnaponoff "on").
this has the advantage, compared to osmode=0, that if you set the osnap do not lose.
 

Forum statistics

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

Members online

No members online now.
ciao
Back
Top