Routine To Set All Text Styles To Romans.docx

  • Uploaded by: Jesus E. Alvarado Salazar
  • 0
  • 0
  • May 2020
  • PDF

This document was uploaded by user and they confirmed that they have the permission to share it. If you are author or own the copyright of this book, please report to us by using this DMCA report form. Report DMCA


Overview

Download & View Routine To Set All Text Styles To Romans.docx as PDF for free.

More details

  • Words: 1,294
  • Pages: 5
http://forums.augi.com/showthread.php?79615-Routine-to-set-ALL-textstyles-to-Romans-shx 1. Routine to set ALL text styles to Romans.shx? Hi everyone, He escrito rutinas para establecer (o cambiar) fuentes para ciertos estilos de texto. ¿Alguien tiene una rutina (o sabe cómo escribir una) para cambiar todos los estilos de texto a la vez? Como ... ¿hay una variable, o una manera de crear una "lista" dentro de la rutina, para encontrar todos los estilos de texto en un dibujo y forzar la fuente? Cualquier ayuda será apreciada. Thanks

Ted 2.

2008-05-01, 12:10 PM#2

3.

2008-05-01, 12:19 PM#3

4.

2008-06-19, 09:22 PM#4

5.

2008-06-19, 09:55 PM#5

6.

2008-06-19, 10:17 PM#6

7.

2009-06-11, 03:02 PM#7

Re: Routine to set ALL text styles to Romans.shx? Originally Posted by tedg

Thanks R.K. That seems to work fine. I tweaked a bit to help common users to run it: with the command prompt and the alert message Code: ;;Changes all textstyles to the font romans.shx (defun c:romans () (vl-load-com) (vlax-for ts (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object))) (if (not (eq (vla-get-Name ts) "")) (vla-put-fontfile ts "Romans") ) ) (command (alert "All Textstyles are now RomanS.shx")) (princ) ) (princ "Romans.lsp loaded ...command: ROMANS")

Ok, does anyone know how I can modify this routine to change all text styles to ARIAL.TTF? I tried several attempts to assign ARIAL or ARIAL.TTF, but didn't work. I'm not very savvy with Visual Lisp funtions so I don't know what I don't know.

It probably has something to do with the fact it's a TTF and not an SHX, but I don't know how to address that.

Ted 8.

2009-06-11, 06:24 PM#8

You need to use the SetFont method for TrueType fonts (ttf). Code: (vla-SetFont ts "Arial" :vlax-False :vlax-False 0 32) ; 0=ANSI character, 32=san-serif

9.

2009-06-11, 08:53 PM#9

10. 2009-06-12, 02:17 PM#10 1.

2009-06-12, 08:53 PM#11

Re: Routine to set ALL text styles to Romans.shx? The first argument in vla-* statements is always the object to which the property/method applies. vlax-For assigns an object to a variable and iterates thru an entire collection. You are mistaken in your code assuming that the variable "at" means Arial.ttf. You are also not providing a collection for the 2nd argument of the vlax-for statement. vla-GetFont is a method that stuffs values into output variables, so it needs the variable names. Code: (vlax-For aStyle (vla-Get-TextStyles (vla-Get-ActiveDocument (vlax-Get-AcadObject))) (vla-GetFont aStyle 'fontName 'isBold 'isItalic 'fontCharSet 'fontPitch) (cond ((/= (strcase fontName) "ARIAL.TTF") (vla-SetFont aStyle "Arial.ttf" :vlax-False :vlax-False 0 32)))) ; ; 0=ANSI character, 32=san-serif

Please note that changing all text styles to a particular font will not address MText/MAttributes with font overrides. 2.

2009-06-15, 05:02 PM#12

3.

2009-06-15, 05:20 PM#13

4.

2009-06-15, 08:46 PM#14

Re: Routine to set ALL text styles to Romans.shx? Originally Posted by RobertB

The first argument in vla-* statements is always the object to which the property/method applies. vlax-For assigns an object to a variable and iterates thru an entire collection. You are mistaken in your code assuming that the variable "at" means Arial.ttf. You are also not providing a collection for the 2nd argument of the vlax-for statement. vla-GetFont is a method that stuffs values into output variables, so it needs the variable names. Code: (vlax-For aStyle (vla-Get-TextStyles (vla-Get-ActiveDocument (vlax-Get-AcadObject)))

(vla-GetFont aStyle 'fontName 'isBold 'isItalic 'fontCharSet 'fontPitch) (cond ((/= (strcase fontName) "ARIAL.TTF") ;;; Ya no se pone la extensión ttf (vla-SetFont aStyle "Arial.ttf" :vlax-False :vlax-False 0 32)))) ; ; 0=ANSI character, 32=san-serif ;;; Ya no se pone la extensión ttf

Please note that changing all text styles to a particular font will not address MText/MAttributes with font overrides. Ok so I spent some time on afralisp's site and in the help menu, trying to wrap my head around objects, properties and methods I commented what you wrote above, wanting to see if I am begining to understand, from here who knows, hopefully UP Code: (vlax-For aStyle;<--object (vla-Get-TextStyles ;object.TextStyles (vla-Get-ActiveDocument;object.ActiveDocument (vlax-Get-Acad-Object);returns a pointer to the AutoCAD Application object ) ) (vla-GetFont;object.GetFont Typeface, Bold, Italic, CharSet, PitchAndFamily aStyle 'fontName 'isBold 'isItalic 'fontCharSet 'fontPitch) (cond ((/= (strcase fontName) "ARIAL.TTF");fonts not equal to arail.ttf (vla-SetFont;set aStyle to arial.ttf aStyle "Arial.ttf" :vlax-False :vlax-False 0 32);do not get vlax-false ) ) ) ; ; =ANSI character, 32=san-serif

;;; Ya no se pone la extensión ttf

5.

2009-06-15, 10:44 PM#15

Code: (defun c:ARIAL () (vl-load-com) (vlax-for ts (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object))) (vla-SetFont ts "Arial" :vlax-False :vlax-False 0 32)) ; ; 0=ANSI character, 32=san-serif (princ "\nALL TEXTSTYLES are now ARIAL.") (princ)) (princ "ARIAL.lsp loaded ... Command: ARIAL")

6.

2009-07-14, 03:50 PM#16

7.

2009-07-16, 06:19 PM#17

(vla-setfont myStyle "ARIAL.TTF" :vlax-False :vlax-False 0 32) Remove the extension from the font file. That is my bad. (vla-setfont myStyle "ARIAL" :vlax-False :vlax-False 0 32) 8.

2009-07-16, 06:37 PM#18

9.

2009-07-16, 11:49 PM#19

10. 2009-07-30, 02:10 PM#20

Re: Routine to set ALL text styles to Romans.shx? Code: (vl-load-com) (vlax-for x (vla-get-textstyles (vla-get-activedocument (vlax-get-acad-object)) ) (vla-put-fontfile x "Simplex.shx") ) (vl-load-com) (setq TxtHgt 0.1) (setq CurSet (ssget '((0 . "TEXT")(-4 . "<=")(40 . 4.7)))) (if CurSet (while (setq CurEnt (ssname CurSet 0)) (setq CurObj (vlax-ename->vla-object CurEnt)) (ssdel CurEnt CurSet) (vla-put-alignment CurObj acAlignmentLeft) (vla-put-StyleName CurObj "STANDARD") (vla-put-height CurObj TxtHgt) (vla-Update CurObj) ) ) (princ) )

I use this code to do that, but it requires a selection box. How can i do this without selection method? Thanks. I´m using Autocad since 1990 Give me a point and i create a line 1.

2009-07-31, 07:07 PM#21

Re: Routine to set ALL text styles to Romans.shx? Simply iterate thru all the Layout objects againt its Block object, checking each object within the block (a layout and model space is treated like a block) to see if it is a text-based object. But in all honesty, a filtered selection set is better, e.g.: (setq CurSet (ssget "X" '((0 . "TEXT") (-4 . "<=") (40 . 4.7)))) Note that the "X" option searches the entire drawing without user interaction. 2.

2009-08-01, 09:41 PM#22

Re: Routine to set ALL text styles to Romans.shx? Originally Posted by RobertB

Simply iterate thru all the Layout objects againt its Block object, checking each object within the block (a layout and model space is treated like a block) to see if it is a text-based object. But in all honesty, a filtered selection set is better, e.g.: (setq CurSet (ssget "X" '((0 . "TEXT") (-4 . "<=") (40 . 4.7)))) Note that the "X" option searches the entire drawing without user interaction. This is much faster and produces excellent results. For the purpose I want is the best! Thank you. I´m using Autocad since 1990 Give me a point and i create a line

3.

2012-08-15, 11:42 AM#23

Re: Routine to set ALL text styles to Romans.shx? Sorry to gravedig here. Is it possible to edit the lisp routine to alter the font in Mtext ? The problem I have is that somehow I have inherited a file where the Mtext style is Romans but the shape text is Arial. have to manually edit each line .... ( yes btw Romans style is correctly defined ) 4.

2012-08-15, 04:38 PM#24

Re: Routine to set ALL text styles to Romans.shx? Originally Posted by bjrochford958510

Sorry to gravedig here. Is it possible to edit the lisp routine to alter the font in Mtext ? The problem I have is that somehow I have inherited a file where the Mtext style is Romans but the shape text is Arial. have to manually edit each line .... ( yes btw Romans style is correctly defined ) Sounds like an MTEXT formatting issue, meaning someone has over ridden the style to a font within the MTEXT. You may want to look into a lisp routine "STRIPMTEXT[3].LSP" where you can select to remove the formatting. I think it lives here in AUGI somewhere.

Ted 5.

2012-08-15, 07:02 PM#25

Re: Routine to set ALL text styles to Romans.shx? new home: http://www.theswamp.org/index.php?topic=31584.0

Related Documents


More Documents from ""