Author Topic: A text font lisp  (Read 17310 times)

0 Members and 1 Guest are viewing this topic.

BREZI

  • Guest
A text font lisp
« on: August 17, 2005, 08:55:02 AM »
Anybody got a lisp routine to change all fonts to be the same in a drawing?

much obliged!

 :D

Mark

  • Custom Title
  • Seagull
  • Posts: 28753
A text font lisp
« Reply #1 on: August 17, 2005, 09:19:20 AM »
qselect!!
TheSwamp.org  (serving the CAD community since 2003)

BREZI

  • Guest
A text font lisp
« Reply #2 on: August 17, 2005, 09:37:19 AM »
Cheers use that already its good.

Tell my problem, we get loads of architects drawings with loads of fonts, our standard procedure we change all fonts to romans.

I was think I could use ezscript to run a lisp on afolder of drawings during lunch time or somthing like that.

Im still learning lisp, not good at doing my own yet, I can edit and tweak existing ones no probs.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
A text font lisp
« Reply #3 on: August 17, 2005, 09:44:47 AM »
BREZI,

One solution that doesn't require modifying the drawings is to remove ALL the font definitions other than ROMANS, and update your font mapping file accordingly.

.. That way when you get revisions to the reference drawings you wont have to repeat the process.

.. .. and it can be demonstrated that you haven't made modifications to design documents .. which may, or may not, be important one day.
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

BREZI

  • Guest
A text font lisp
« Reply #4 on: August 17, 2005, 10:06:29 AM »
Good idea, but;

Unfortunately I have to produce presentation drawings sometimes, and then we use all of the fancy drawings, and we have to print architects drawings exactly as issued for record purposes.

thanks :o)

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
A text font lisp
« Reply #5 on: August 17, 2005, 10:10:41 AM »
Sure ..
Options, -> Files -> Font File Location

Have 2 folders, one for presentation, one for your special needs.
Flip a switch, you have them all back.
... something you wont have if you change the Font physically

kwb
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
A text font lisp
« Reply #6 on: August 17, 2005, 10:10:48 AM »
I dont have a LISP version, but I have a vba routine that will do it.  It can be called from a script as well
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

BREZI

  • Guest
A text font lisp
« Reply #7 on: August 17, 2005, 10:15:59 AM »
Quote from: CmdrDuh
I dont have a LISP version, but I have a vba routine that will do it.  It can be called from a script as well


That would be cool.

cheers.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
A text font lisp
« Reply #8 on: August 17, 2005, 10:16:18 AM »
I can upload the file if you need it. Here is the code
Code: [Select]
Option Explicit

Public Sub ChangeTextToRomans()
  Dim objSelected As Object
  Dim objTxt As AcadText
  Dim objstyle As AcadTextStyle
  Dim objLayer As AcadLayer
  Dim objSelSet As AcadSelectionSet
  Dim intAnswer As Integer
  On Error GoTo ErrControl

Set objstyle = ThisDrawing.TextStyles.Add("ROMANS")
objstyle.fontFile = "romans.shx"
objstyle.Width = 1#

  Set objSelSet = ThisDrawing.SelectionSets.Add("Text")
  objSelSet.Select acSelectionSetAll
    For Each objSelected In objSelSet
        If TypeOf objSelected Is AcadText Then
        Set objTxt = objSelected
            If UCase(objTxt.StyleName) <> "ROMANS" Then
            objTxt.StyleName = "ROMANS"
            objTxt.ScaleFactor = 1#
            Else
            objTxt.ScaleFactor = 1#
            End If
        End If
    Next
  ThisDrawing.SelectionSets.Item("Text").Delete
  ThisDrawing.Application.Update
Exit_Here:
  Exit Sub
ErrControl:
  MsgBox Err.Description
End Sub
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
A text font lisp
« Reply #9 on: August 17, 2005, 10:20:44 AM »
your script would look something like
Quote

open "your dwg name" (command "-vbarun" "E:/TextToRomans.dvb!ThisDrawing.ChangeTextToRomans") qsave close

all you would have to do is change paths to match yours
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

BREZI

  • Guest
A text font lisp
« Reply #10 on: August 17, 2005, 10:47:08 AM »
Thats great cheers for the help!

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
A text font lisp
« Reply #11 on: August 17, 2005, 10:48:49 AM »
Glad it worked!  You might need to tweak some of the settings like width factor or preset height.  Also, I didn't put in the error checking to see if the Selection Set existed or not, so that can be added.  I have that code if you need it.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

BREZI

  • Guest
A text font lisp
« Reply #12 on: August 17, 2005, 11:11:47 AM »
Dumb question, but how I turn that code into a dvb file?

Never done that before, only worked with lisp & scripts.

ronjonp

  • Needs a day job
  • Posts: 7526
A text font lisp
« Reply #13 on: August 17, 2005, 11:40:26 AM »
Hey cmdrduh,

I'm trying to set a font to arial.ttf but it wont work??
Code: [Select]

Dim objstyle As AcadTextStyle

Set objstyle = ThisDrawing.TextStyles.Add("Arial")
objstyle.fontFile = "arial.ttf"
objstyle.Width = 1#


Doest this not work with True Type Fonts?

Thanks,

Ron

Windows 11 x64 - AutoCAD /C3D 2023

Custom Build PC

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
A text font lisp
« Reply #14 on: August 17, 2005, 11:49:06 AM »
Brezi, I'll upload the file, but in a nutshell, open VBAman, create a new project, and add to ThisDrawing or a module of your choice.  Ronjonp, ill post that in a minute
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)