Jump to content

LOWERCASE TO UPPERCASE TEXT FIELD


Manuelmfec

Recommended Posts

hello colleagues good morning I've created this little routine that inserts a dynamic text (code attached), however I need it to be in uppercase. I tried using this code:

 

(DEFUN C:TDA1 ()
(SETQ P1 (GETPOINT "\nUBIQUE EL TEXTO"))
(PRINC "\nSELECCIONE EL TEXTO")

(setq conjunto (ssget "_+.:E:S" '((0 . "TEXT"))))
(setq CONTENIDO (strcat "%<\\AcObjProp Object(%<\\_ObjId "(itoa (vla-get-ObjectID (vlax-ename->vla-object (ssname conjunto 0))))">%)TextString \\f ""%tc1"">%"))
(COMMAND "_TEXT" "_S" "MFEC2" "_J" "_M" P1 ALTURA3 ANGULOO CONTENIDO)

 

but it didn't work for me, can anyone help me?

DINAMIC_TEXT.txt

Link to comment
Share on other sites

You'll want to use strcase somewhere to make it uppercase, perhaps:

 


(setq CONTENIDO (strcase (strcat "%<\\AcObjProp Object(%<\\_ObjId "(itoa (vla-get-ObjectID (vlax-ename->vla-object (ssname conjunto 0))))">%)TextString \\f ""%tc1"">%")))

 

Link to comment
Share on other sites

Have you tried :

...

(setq conjunto (ssget "_+.:E:S" '((0 . "TEXT"))))

(entupd (cdr (assoc -1 (entmod (subst (cons 1 (strcase (cdr (assoc 1 (setq conx (entget (ssname conjunto 0))))))) (assoc 1 conx) conx)))))

...

Link to comment
Share on other sites

1 hour ago, marko_ribar said:

Has probado :

...

(setq conjunto (ssget "_+.:E:S" '((0 . "TEXT"))))

(entupd (cdr (assoc -1 (entmod (subst (cons 1 ( strcase (cdr (assoc 1 (setq conx (entget (ssname conjunto 0))))))) (assoc 1 conx) conx)))))

...

Hola, gracias por tu respuesta. Podrías ilustrarme un poco más tu idea y cuál sería la variable de salida para insertarla con el comando texto, me podría decir un poco más porfavor 

Link to comment
Share on other sites

Hace 2 horas, Steven P dijo:

Querrá usar strcase en algún lugar para que esté en mayúsculas, tal vez:

 

 

Hola, gracias por tu respuesta. Intente con strcase pero no me funcionó. creo que el código no me funciona porque original mente la línea que da origen al campo y consigo la extracción del dato lleva comillas ", pero autolisp reconoce las  comillas para crear variables de texto y no como parte o original del texto para concatenar, ejemplo: "%tc1"

Link to comment
Share on other sites

47 minutes ago, Manuelmfec said:

Hola, gracias por tu respuesta. Podrías ilustrarme un poco más tu idea y cuál sería la variable de salida para insertarla con el comando texto, me podría decir un poco más porfavor 

En esta caso convierte un TEXTO que está en minúsculas a  MAYÚSCULAS, pero se trata de un texto y no de un FIELD que contiene un TEXTO , que podría ser por ejemplo, la capa del Objeto. 

 

Por lo que seve , tu idea es crear una FIELD que contiene un TEXTO de alguna propiedad del Obj. por ej . CAPA, COLOR , etc

 

Edited by devitg
add line
Link to comment
Share on other sites

52 minutes ago, devitg said:

En este caso convierte un TEXTO que está en minúsculas a MAYÚSCULAS, pero se trata de un texto y no de un FIELD que contiene un TEXTO , que podría ser por ejemplo, la capa del Objeto. 

 

Por lo que seve , tu idea es crear un CAMPO que contiene un TEXTO de alguna propiedad del Obj. por ej. CAPA, COLOR, etc.

 

La rutina extrae el contenido de un texto y crea otro con dicho contenido pero como campo de tal manera que este se actualice conforme se modifique el primero. El inconveniente que tengo es que necesito que este campo me retorne el contenido en mayúsculas y que siga siendo un campo 

Link to comment
Share on other sites

57 minutes ago, Manuelmfec said:

La rutina extrae el contenido de un texto y crea otro con dicho contenido pero como campo de tal manera que este se actualice conforme se modifique el primero. El inconveniente que tengo es que necesito que este campo me retorne el contenido en mayúsculas y que siga siendo un campo 

Por favor sube un ejemplo.dwg 

Link to comment
Share on other sites

When you use a field string as suggested the coding was correct, you need to use a (vla-put-textstring on the mtext object then it should work, it does not work with plain MTEXT command. So just make a dummy mtext with say "a" as text then use the (setq obj (vlax-ename->vla-object (entlast))) then put the new string.

Edited by BIGAL
Link to comment
Share on other sites

7 minutes ago, BIGAL said:

Cuando usa una cadena de campo como se sugirió que la codificación era correcta, debe usar una (vla-put-textstring en el objeto mtext, entonces debería funcionar, no funciona con el comando MTEXT simple. Así que simplemente haga un mtext ficticio con decir "a" como texto, luego use (setq obj (vlax-ename->vla-object (entlast))) y luego coloque la nueva cadena.

Hello, thanks for your answer, could you enlighten me a little more about your idea, please. this is my code:

 

(DEFUN C:TDA1 ()
(SETQ P1 (GETPOINT "\nUBIQUE EL TEXTO"))
(PRINC "\nSELECCIONE EL TEXTO")
(setq conjunto (ssget "_+.:E:S" '((0 . "TEXT"))))
(setq CONTENIDO (strcat "%<\\AcObjProp Object(%<\\_ObjId "(itoa (vla-get-ObjectID (vlax-ename->vla-object (ssname conjunto 0))))">%).TextString>%"))
(COMMAND "_TEXT" "_S" "MFEC2" "_J" "_M" P1 2 90 CONTENIDO)

)

 

I have achieved this with the little that I know and taking parts of other routines that I have but until now this case had not touched me

Link to comment
Share on other sites

Hola , no muy elegante pero da el resultado.

 

(DEFUN C:TDA2  (/
                CONJUNTO
                CONTENIDO
                MAYUSCULA
                P1
                TEXTO
                TEXTO-$
                TEXTO-ENT
                )
  (SETQ P1 (GETPOINT "\nUBIQUE EL TEXTO"))
  (PRINC "\nSELECCIONE EL TEXTO")
  (SETQ CONJUNTO (SSGET "_+.:E:S" '((0 . "TEXT"))))
  (SETQ TEXTO-ENT (SSNAME CONJUNTO 0))
  (SETQ TEXTO-$ (CDR (ASSOC 1 (ENTGET TEXTO-ENT))))
  (SETQ MAYUSCULA (STRCASE TEXTO-$))

  (VLA-PUT-TEXTSTRING (VLAX-ENAME->VLA-OBJECT TEXTO-ENT) MAYUSCULA)


  (SETQ CONTENIDO (STRCAT "%<\\AcObjProp Object(%<\\_ObjId "
                          (ITOA (VLA-GET-OBJECTID (VLAX-ENAME->VLA-OBJECT TEXTO-ENT)))
                          ">%).TextString>%"))
  (COMMAND "_TEXT" "_S" "MFEC2" "_J" "_M" P1 2 90 CONTENIDO)

  (VLA-PUT-TEXTSTRING (VLAX-ENAME->VLA-OBJECT TEXTO-ENT) TEXTO-$)

  (PRINC)

  )

Consiste en obtener el  STRING del TEXTO-ENT , convertirlo en mayúscula como un nuevo STRING ,  modifica el texto-ent , lo usa para crear el field , lo pone en el punto elegido , y recupera el valor original del texto. 

TEXTO - TDA2.lsp texto a campo en mayuscula.dwg

  • Like 1
Link to comment
Share on other sites

Just a maybe by adding \\f %tc1> then the original text can be lower case but the field will be Capitals. Only if required

 

(DEFUN C:TDA2  (/
                CONJUNTO
                CONTENIDO
                MAYUSCULA
                P1
                TEXTO
                TEXTO-$
                TEXTO-ENT
                )
  (SETQ P1 (GETPOINT "\nUBIQUE EL TEXTO"))
  (PRINC "\nSELECCIONE EL TEXTO")
  (SETQ CONJUNTO (SSGET "_+.:E:S" '((0 . "TEXT"))))
  (SETQ TEXTO-ENT (SSNAME CONJUNTO 0))
  (SETQ TEXTO-$ (CDR (ASSOC 1 (ENTGET TEXTO-ENT))))
(SETQ CONTENIDO (STRCAT "%<\\AcObjProp Object(%<\\_ObjId "
                          (ITOA (VLA-GET-OBJECTID (VLAX-ENAME->VLA-OBJECT TEXTO-ENT)))
                          ">%).TextString \\f %tc1>%"))
(COMMAND "_TEXT" "_S" "MFEC2" "_J" "_M" P1 2 90 "a")
  (VLA-PUT-TEXTSTRING (VLAX-ENAME->VLA-OBJECT (entlast)) CONTENIDO)
  (princ)
  )
(c:tda2)

 

 

  • Like 2
Link to comment
Share on other sites

11 hours ago, devitg said:

Hola, no es muy elegante pero da el resultado.

 






Consiste en obtener el STRING del TEXTO-ENT , convertirlo en mayúsculas como un nuevo STRING , modificar el texto-ent , lo usa para crear el campo , lo pone en el punto elegido , y recuperar el valor original del texto. 

TEXTO - TDA2.lsp 1 KB · 2 descargas texto a campo en mayuscula.dwg 949,4 kB · 1 descarga

Hola, muchas gracias por tu respuesta, tu código funciona a la perfección, es el resultado que estaba buscando.

muchas gracias por tu tiempo.

Link to comment
Share on other sites

4 hours ago, BIGAL said:

Solo tal vez agregando \\f %tc1> entonces el texto original puede estar en minúsculas pero el campo será Mayúsculas. Solo si es necesario

 

 

 

Hello, thank you very much for your answer, your code works perfectly, it is the result that I was looking for. thanks for your time.

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