Results 1 to 4 of 4

Thread: LISP to change font of text styles from Revit export

  1. #1
    100 Club
    Join Date
    2008-06
    Location
    Rochester, NY
    Posts
    109
    Login to Give a bone
    0

    Default LISP to change font of text styles from Revit export

    I've been working on a script to run in .DWG files to clean them up and standardize them after a Revit to .DWG export.

    When Revit exports to DWG, the DWG will have multiple text styles used for every instance of viewport within the sheet. So, in the exported file, I wind up with multiple similar text styles.

    For instance, in Revit, we use the RomanD font, and it exports to multiple RomanD text styles, I'll have RomanD, RomanD_1, RomanD_2, etc...

    I need a lisp to change the font in all these RomanD text styles to RomanS.shx to meet client standards.

    I've seen a few ways of doing this such as the command line below:
    (command "_style" "RomanD" "romans.shx" "" "" "" "" "" "")

    I'd like to do something like this, but have a wildcard in the style to change so that all RomanD* text styles has it's font changed to RomanS.shx. The amount of exported RomanD text styles varies per sheet/DWG file.

    Any help would be appreciated.

    Thank you!

  2. #2
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: LISP to change font of text styles from Revit export

    Untested, but should work... See if it needs debugging...

    Code:
    (defun c:allstyle2romansshx nil
      (foreach st (ai_table "STYLE" 4)
        (command "_.STYLE" st "romans.shx")
        (while (< 0 (getvar 'cmdactive))
          (command "")
        )
      )
      (princ)
    )
    HTH, M.R.

  3. #3
    100 Club
    Join Date
    2008-06
    Location
    Rochester, NY
    Posts
    109
    Login to Give a bone
    0

    Default Re: LISP to change font of text styles from Revit export

    Thank you Marko.
    I may be missing something, but is there something that I am supposed to edit to put the wild card in so that I am only changing the styles with "RomandD" included in the style name? This looks to change ALL styles in the file. As a clarification, I am only looking to change styles with "RomanD" in the name, like RomanD_1, RomanD_2, RomanD_3, etc... I do not want other text styles changed that would be named something else (such as Arial).

    Thank you,

    Dave

    - - - Updated - - -

    To get us by, I am currently just running the below command line a dozen times to edit or create text styles (if they were not previously in the file), then I just run a purge to get rid of the styles not used. So the script will basically edit/create 12 RomanD text styles, then purge the ones not used. It is doing the trick so far as long as Revit keeps it under 12 similar text styles...

    (command "_style" "RomanD" "romans.shx" "" "" "" "" "" "")
    (command "_style" "RomanD_1" "romans.shx" "" "" "" "" "" "")
    (command "_style" "RomanD_2" "romans.shx" "" "" "" "" "" "")
    ...

  4. #4
    All AUGI, all the time
    Join Date
    2015-10
    Location
    Belgrade, Serbia, Europe
    Posts
    564
    Login to Give a bone
    0

    Default Re: LISP to change font of text styles from Revit export

    Code:
    (defun c:allstyle2romansshx nil
      (foreach st (ai_table "STYLE" 4)
        (if (wcmatch st "RomanD*")
          (progn
            (command "_.STYLE" st "romans.shx")
            (while (< 0 (getvar 'cmdactive))
              (command "")
            )
          )
        )
      )
      (princ)
    )

Similar Threads

  1. Replies: 1
    Last Post: 2014-08-08, 05:20 PM
  2. Routine to change font assigned to styles
    By jcgrer04 in forum AutoLISP
    Replies: 2
    Last Post: 2011-11-08, 12:29 AM
  3. Global Change all Text Styles to Romans font
    By f.tagle in forum AutoLISP
    Replies: 18
    Last Post: 2009-04-29, 05:04 AM
  4. I want to change the font in my text styles
    By sgroff in forum VBA/COM Interop
    Replies: 6
    Last Post: 2006-09-12, 07:16 PM
  5. Replies: 5
    Last Post: 2005-01-04, 07:19 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •