Author Topic: How To Update Text Style Table for Bigfontfile?  (Read 1993 times)

0 Members and 1 Guest are viewing this topic.

Hrishikesh

  • Guest
How To Update Text Style Table for Bigfontfile?
« on: July 27, 2017, 02:36:17 PM »
Hi All,
I have set of Erection drawing which has 17 text styles are used of which 10 are with Bigfont styles,
dimensions, text, with these style are not visible.
I removed Bigfont option manually from text style editor.
But there are bunch of Erection drawing so I tried to remove Bigfont file by lisp, But something is wrong in my code so its not working.
Need help on this code.

Thanks,
Hrishikesh

Code - Auto/Visual Lisp: [Select]
  1. (defun C:TxtStUp ()
  2. (vlx-for txtst (vla-get-textstyles doc)
  3. (setq StName (vla-get-name txtst))
  4. )
  5.  

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How To Update Text Style Table for Bigfontfile?
« Reply #1 on: July 28, 2017, 04:16:58 AM »
Typo: vlx-for should be vlax-for.

Hrishikesh

  • Guest
Re: How To Update Text Style Table for Bigfontfile?
« Reply #2 on: July 31, 2017, 03:17:01 AM »
Is it possible to use tblnext and and change assoc code (4 . "bigfont.shx") to (4 . "").

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How To Update Text Style Table for Bigfontfile?
« Reply #3 on: July 31, 2017, 05:02:23 AM »
Is it possible to use tblnext and and change assoc code (4 . "bigfont.shx") to (4 . "").
No. The output of tblnext does not contain a reference to the ename. If you want to perform this task using 'Classic' Lisp you will need to (also) use tblobjname.

To get a usable entity list for the first text style this will work:
Code: [Select]
(entget (tblobjname "style" (cdr (assoc 2 (tblnext "style" T)))))

Hrishikesh

  • Guest
Re: How To Update Text Style Table for Bigfontfile?
« Reply #4 on: July 31, 2017, 06:28:04 AM »
If you want to perform this task using 'Classic' Lisp you will need to (also) use tblobjname.

To get a usable entity list for the first text style this will work:
Code: [Select]
(entget (tblobjname "style" (cdr (assoc 2 (tblnext "style" T)))))

Thanks Roy,
As you said I used tblobjname and it works.
Code - Auto/Visual Lisp: [Select]
  1. (defun C:REMOVEBIGFONT (/ DOC NBF NM OBF TBL)
  2.  (setvar "CMDECHO" 0)
  3.   (setq NM (vla-get-name TXTST))
  4.   (setq TBL (entget (tblobjname "STYLE" NM)))
  5.   (setq OBF (assoc 4 TBL))
  6.   (setq NBF (cons '4 ""))
  7.   (setq TBL (subst NBF OBF TBL))
  8.   (entmod TBL)
  9.  )
  10.  (vl-cmdf "REGENALL")
  11. )
  12.  

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: How To Update Text Style Table for Bigfontfile?
« Reply #5 on: July 31, 2017, 09:49:14 AM »
That is a strange approach, why do you choose it? I would either use your original code or *only* use Classic Lisp.

Lee Mac

  • Seagull
  • Posts: 12914
  • London, England
Re: How To Update Text Style Table for Bigfontfile?
« Reply #6 on: July 31, 2017, 12:15:30 PM »
That is a strange approach, why do you choose it? I would either use your original code or *only* use Classic Lisp.

Agreed - if using Vanilla AutoLISP, I would suggest something along the lines of:

Code - Auto/Visual Lisp: [Select]
  1. (defun c:rembigfont ( / enx sty )
  2.     (while (setq sty (tblnext "style" (not sty)))
  3.         (setq enx (entget (tblobjname "style" (cdr (assoc 2 sty)))))
  4.         (entmod (subst '(4 . "") (assoc 4 enx) enx))
  5.     )
  6.     (princ)
  7. )

Hrishikesh

  • Guest
Re: How To Update Text Style Table for Bigfontfile?
« Reply #7 on: August 01, 2017, 02:23:05 AM »
Thanks Lee & Roy,
Yes I agreed too thats a strange to use classic Autolisp & Visuallisp together.
But I am doing my lisp programming by studying it by books & internet so struggling with some basic things in lisp programming.
But when I got my answers from professionals like you it help me to understand & improve my lisp programming.

Thanks,
Hrishikesh