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

change the style of a text

  • Thread starter Thread starter Angelo2449
  • Start date Start date

Angelo2449

Guest
Hello everyone,
I am trying to change the style of a point (text) with a lisp command but I always get messages related to unknown commands and errors.........
this is the last command used (command "_change" point "" "_style" "arial" "") but it does not work.
Thank you.
 
depends what is:
Is that a text? Sure?

which error messages returns?
What kind of text is it? single line or multiline?
 
you are a safe text, this is the interested code disc (where it is replaced by primad)
Code:
 (setq list nil)
(sing)
(= list nil)
(setq list (entget (entsel)) (group))))
)

(setq xlist (assoc -3 list)
(setq txt1 (assoc 1 list)
(setq primed (car txt1))
....
....
....
(command "_change" primed "" "" "" "" "" station)
(command "_change" primed "_p" "_c" "_blue"")
This code works, I would like you to primate, besides changing the color in blue, changing style from txt to arial, in the design, the style is already arial.
Thank you.
 
If you can't change, then the way is to extract from the entity the text style group
(setq oldstyle (assoc '7 (entget point)))
(setq newstyle (cons '7 "arial")
(setq newpoint (cdr (subst newstyle oldstyle)))
 
Thank you.
according to you which type of data extracted from the list should apply the code (for you > point <). .
I tried almost everyone but it doesn't work.
 
Hello rpor66,
I changed the logic of the routine, now I no longer use the "change" command to replace the existing text but I write a new text exactly in the location where the existing one is.
since in the design is set the style "arial", a new text should be written in this style.
instead the text is still in the style "txt"!
if instead I write a text with the command "text normally, I get a string in "arial" style.
a big problem instead, is that represented by the uncommon behavior of the routine surely depending on how the selected text is intercepted.
If the zoom is at a certain value, it all works well otherwise the novo text is not written or a circle is not drawn.
place here the whole routine, I'm sure you will find the solution to problems.
Code:
(defunc c:reference (/ fc1 fc2 fc3 control1 today's date start now pdop fp3 list txt1 nomad xlist primed txtdata name ecef gaussboaga control1 fp2 notex secondline reference and control3 fpr newtext fp1 fp5 ind cnt system namex whole texting)

(setq osmode (getvar "osmode")
(if)
(if) osmode 16384)
(Setvar "osmode" (- osmode 16384))
)
)

(Sectq reference nil)
(setq station nil)

(if)
(progn)
(alert "you must first perform > tax relief <")
(exit)
)
)

(setq baseline nil)
(Sects increase nil)
(setq system ")

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

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

(if fc)
(progn)
(setq fp1 (open "c:\\\\autocadsupport\\\config\\\config.dat" "r"))
(setq baseline (read-line fp1))
(setq increase (read-line fp1))
(setq system (read-line fp1))
(close fp)
)
)

(if)
(progn)
(alert "reference name (base line) missing!")
(exit)
)
)

(if (= increase nil)
(progn)
(alert "value of the missing increase!")
(exit)
)
)


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

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

(if fc)
(vl-file-delete "c:\\autocadsupport\\dati\\datirilievo.dat")
)

(setq fc2 (findfile "c:\\\autocadsupporto\\dati\\\resposta.dat"))

(if fc)
(vl-file-delete "c:\\autocadsupport\\\dati\resposta.dat")
)

(if)
(progn)
(alert "the reference line has already been inserted")
;(exit)
)
)

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

(setq station ")
(setq notax)

(seq control1 nil)

(while (= control1 nil)
(setq control1 (findfile "c:\\\autocadsupport\\\\datirilievo.dat"))
);

(if (/= control1 nil)
(progn)
(setq fp3 (open "c:\\\autocadsupport\\\dati\\datirilievo.dat" "r"))
(setq current date (read-line fp3))
(setq now start (read-line fp3))
(setq orafine (read-line fp3))
(setq pdop (read-line fp3))
(setq station (read-line fp3))
(setq notax (read-line fp3))
(close fp)
); prog
)

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

(setq xlist (assoc -3 list)
(setq point1 (cdr (assoc 10 list))
(setq xd_ent (cdr -3 list))
(setq txtdata (car))
(setq string)

(setq txt1 (assoc 1 list)
(setq primed (car txt1))

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

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

(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 cxb (substr ecef 1 11))
(setq cyb (substr ecef 13 11)
(setq czb (substr ecef 25 11)
(setq cxbb (atof cxb))
(setq cybb (atof cyb))
(setq czbb)

(setq note2 (strcat nomex notax " - " station))
(setq reference (strcat "1|" station "|" ecef "|0.000|[WGS84-RTF2000] "Note2 "|")
(setq secondlinea (strcat "6|l1|" today's date "-" now start "|" today's date "-" now end "|rtk|pdop=" pdop "|")

(setq whole name (strcat nomex " - " station))
(setq textstation (strcat station " - (if itself)))))

(command "_circle" gaussboaga "0.15"")

(setq baseline station)
(command "_text" point1 0.40 0 station)
(command "_change" "_last" "_p" "_c" "_blue"")
;(command "_change" "_last" """ """ "arial" "" """)

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

(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 "point 2d") (cons 1000 quota) (cons 1000 "-----------------") (cons 1000 gaussboaga) (cons 1000 station) (cons 1000 "undefined")))))

(setq newlist)
(entmod newlist)

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

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

(setq fp5 (open "c:\\\\autocadsupport\\\contatori\\\counter.dat" "w"))
(write-line baseline fp5)
(write-line increase fp5)
(close fp)

(setq ind "x")
(setq index (strcat ind nomex))
(seq primariga 1)
(command "_circle" point1 "1.00")

(alert "line basic data stored - ready to insert points")
) ;
Thank you.
 
all over,
I had forgotten the little routine at first
Code:
 (setq osmode)
(if (= mode "on")
(if) 16384
(set "smode" (- osmode 16384))
)
)
I replaced it with (setvar "osmode" 16384) and everything returned normal.
Thank you.
 
Hello rpor66,
Now that the routine works, I find the two overlapping strings or,
Code:
(defunc c:reference (/ fc1 fc2 fc3 control1 today's date start now pdop fp3 list txt1 nomad xlist primed txtdata name ecef gaussboaga control1 fp2 notex secondline reference and control3 fpr newtext fp1 fp5 ind cnt system namex whole texting)

(Setvar "osmode" 16384)

(Sectq reference nil)
(setq station nil)

(if)
(progn)
(alert "you must first perform > tax relief <")
(exit)
)
)

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

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

(if fc)
(progn)
(setq fp5 (open "c:\\\\autocadsupport\\\config\\\config.dat" "r"))
(setq baseline value (read-line fp5))
(setq value increase (read-line fp5))
(setq type angle (read-line fp5))
(setq heightwritten (read-line fp5))
(setq valuerage (read-line fp5))
(close fp)
)
)

(if (= basic value nil)
(progn)
(alert "reference name (base line) missing!")
(exit)
)
)

(if (= value increase nil)
(progn)
(alert "value of the missing increase!")
(exit)
)
)


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

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

(if fc)
(vl-file-delete "c:\\autocadsupport\\dati\\datirilievo.dat")
)

(setq fc2 (findfile "c:\\\autocadsupporto\\dati\\\resposta.dat"))

(if fc)
(vl-file-delete "c:\\autocadsupport\\\dati\resposta.dat")
)

(if)
(progn)
(alert "the reference line has already been inserted")
;(exit)
)
)

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

(setq station ")
(setq notax)

(seq control1 nil)

(while (= control1 nil)
(setq control1 (findfile "c:\\\autocadsupport\\\\datirilievo.dat"))
);

(if (/= control1 nil)
(progn)
(setq fp3 (open "c:\\\autocadsupport\\\dati\\datirilievo.dat" "r"))
(setq current date (read-line fp3))
(setq now start (read-line fp3))
(setq orafine (read-line fp3))
(setq pdop (read-line fp3))
(setq station (read-line fp3))
(setq notax (read-line fp3))
(close fp)
); prog
)

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

(setq xlist (assoc -3 list)
(setq point1 (cdr (assoc 10 list))
(setq xd_ent (cdr -3 list))
(setq txtdata (car))
(setq string)

(setq txt1 (assoc 1 list)
(setq primed (car txt1))

(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 cxb (substr ecef 1 11))
(setq cyb (substr ecef 13 11)
(setq czb (substr ecef 25 11)
(setq cxbb (atof cxb))
(setq cybb (atof cyb))
(setq czbb)

(setq note2 (strcat nomex notax " - " station))
(setq reference (strcat "1|" station "|" ecef "|0.000|[WGS84-RTF2000] "Note2 "|")
(setq secondlinea (strcat "6|l1|" today's date "-" now start "|" today's date "-" now end "|rtk|pdop=" pdop "|")

(setq whole name (strcat nomex " - " station))
(setq textstation (strcat station " - (if itself)))))

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

(command "_circle" gaussboaga "0.15"")

(setq baseline station)
(command "_text" point1 0.40 0 station)
(command "_change" "_last" "_p" "_c" "_blue"")

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

(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 "basic initial page") (cons 1000 quota) (cons 1000 "-----------------") (cons 1000 gaussboaga) (cons 1000 station) (cons 1000 "undefined"))))

(setq newlist)
(entmod newlist)

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

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

(setq fp5 (open "c:\\\\autocadsupport\\\contatori\\\counter.dat" "w"))
(write-line baseline fp5)
(write-line value increase fp5)
(write-line type angle fp5)
(write-line heightwritten fp5)
(write-line valor fp5)
(close fp)

(setq ind "x")
(setq index (strcat ind nomex))
(seq primariga 1)
(command "_circle" point1 "1.00")

(alert "line basic data stored - ready to insert points")
) ;

) ; fine stationary function
I would like to delete the selected item with > (setq list (entget (car (entsel)) '('group")) <
I tried in every way but I can't intercept it and then delete it.
Thank you.
 

Forum statistics

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

Members online

No members online now.
Back
Top