Jump to content

Changing font and width factor of multiple text styles


Recommended Posts

Hi guys

 

I have to change a lot of electrical sketches to plot them in pdf. The words in those sketches have to be searchable by PDF. So the fact is that I have to change the Width factor to 1. I'm already using a lisp for changing the width factor in different block attributes. Now i'm trying to find a lisp for changing font to Tahoma and the width factor for different styles to 1.0 , cuz it takes a lot of work to plot thousand and thousands of sketches to pdf. ow yeah btw i'm a newbie. I actually have used autocad for a week now. so don't make it to difficult for me. :P

 

 

Greetings from Belgium

Edited by sala
more information
Link to comment
Share on other sites

Thanks dadgad! :D

 

I haven't tried it yet, but it looks like they are replacing the styles? That's not what I want. I'm actually just looking for something to change only the Width factor and the font to Tahoma for all the text styles at once if that is also possible without changing anything else about that text style (there are per file like 3 to 12 different text styles) . I have here right now 3000 electrical sketches waiting for me to be converted to pdf and there are like thousands more. :o so I tried first just the command 'style' and changing the fonts to Tahoma and the Width for every text style, but after a while I figured out that not everything was searchable because some texts where in block attributes. The last problem is luckily fixed now by using a lisp file. Now I'm only looking for a solution for this problem and i'm good to go! :D

Link to comment
Share on other sites

There is no way that this is not going to be difficult for you since you are new. It will also be time consuming.

 

First thing I would do is to create a file with all of the text styles set up properly. Save that file somewhere handy.

 

Next I would look for a LISP to replace text styles. Yes, replace them. I believe that it will be easier than trying to alter the existing ones. You might be able to replace with the same style name but you might need to change the names slightly for the routine to work. You will have to determine that.

 

This could be also done by inserting the drawings into the file you created to hold the altered style definitions.

Link to comment
Share on other sites

This is why.

 

I have here right now 3000 electrical sketches waiting for me to be converted to pdf and there are like thousands more.
Link to comment
Share on other sites

This will change all some ttf works others dont need perhaps correct name which is slightly different to the known name will try to find it for Tahoma

 

(vlax-for TEXTS (vla-get-TextstyleS (vla-get-activedocument (vlax-get-acad-object)))
(vla-put-Fontfile TEXTS "Arial.ttf")
)

Link to comment
Share on other sites

Thanks guys!

 

I will take a look at your ideas. :)

 

Your code looks nice, Bigal. If I only can understand what it says. ;) It also only works for text only, not mtext right?

Link to comment
Share on other sites

I think I fount it :D

 

i'm using the code like this

 

(vl-load-com)
(defun C:sala ()
(vlax-for x (vla-get-TextStyles
      (vla-get-activedocument (vlax-get-acad-object)) 
	    )
  (princ)
  (vla-setfont x "Tahoma" :vlax-False :vlax-False 0 32)
)
)

 

it just says always "nil" at the end? what is the meaning of that?

Link to comment
Share on other sites

This is why.

 

Ten four. Why can't you isolate those and select a bunch at once? Thousands or not, if you isolate the layers it shouldn't take long at all. When we have scales change on viewports I have to go in and change all of the text and leader sizes. its not thousands but several hundreds worth.

Link to comment
Share on other sites

Thanks the Code works amazing is there also a way to add something to it that the width changes to 1.0? I mean all text like in blocks and without blocks and Mtext too?

 

I'm almost the autocad specialist at my job now and i'm only using this for almost 2 weeks.:shock::lol::D

Link to comment
Share on other sites

Do a bit of searching there should be an answer to the blocks part. With Mtext you have to go inside the Mtext and change the text, it can be done though just a bit more complex again search.

Link to comment
Share on other sites

Thanks! I have found what I was looking for now i'm trying to get to the next step, opening a file and it modifies itself by using an autolisp. It works fine with commands, but when I try to add a lisp command in the file by using

(load 'nameofthefile')

This is in acad2015.lsp. I also tried the command "_appload" and just "command".

it does nothing? I guess I have to tell the autolisp also where it can find the lisp? I have it in a flash drive so i tried "F:\nameoffile". it didn't work either

Edited by sala
Link to comment
Share on other sites

Sala,

 

Great job figuring out the solution. It's always cool to see new members get what they were looking for. Also, finishing a thread allows someone that may have the same issue to see how to solve it. Bravo :thumbsup:

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