Author Topic: Slowww Loading Lisp  (Read 2325 times)

0 Members and 1 Guest are viewing this topic.

DanB

  • Bull Frog
  • Posts: 367
Slowww Loading Lisp
« on: May 31, 2005, 12:27:34 PM »
I have a routine written that loads our company standard Text styles and I am noticing that a lot of the time it "hangs" or seems to run slowww. I understand there a quite a few commands being executed so I just wanted another opinion if there is a "better"/more efficient way of accomplishing this task.

(some lines commented out intentionally, removed as needed)

Thanks
Dan

Code: [Select]

;;
;;
;; Text Styles.LSP
;;     02/09/05
;;
;; (command "STYLE" "NAME" "FONT" "HEIGHT" "WIDTH" "ANGLE" "BACKWARDS<N>" "UP-SIDE DOWN<N>" "VERTICAL<N>")
;;
;;
(defun c:bt (/ cmdecho scaleH chscale)
 (setq oldecho (getvar "cmdecho"))
 (setvar "cmdecho" 0)
 
 
 
 (if bt:scaleH
   (progn
     (setq scaleH (strcat "\nEnter Drawing Scale: <" bt:scaleH "> "))
     (setq chscale (getstring scaleH))
       (if (= chscale "")                  
        (setq bt:scaleH bt:scaleH)  
        (setq bt:scaleH chscale)        
       )
   )
   (setq bt:scaleH (getstring "\nEnter Drawing Scale: "))
 )
 (setq bt:scaleH (atof bt:scaleH))

(command "STYLE" "STANDARD" "SIMPLEX" "0" "1" "0" "" "" "")
;;
;; Custom Linetype Text
;;
(command "STYLE" "Customline" "SIMPLEX" "0" "1" "0" "" "" "")
;;
;; Paper Space General Text
;;
(command "STYLE" "PS60"  "SIMPLEX" "0.06" "1" "0" "" "" "")
(command "STYLE" "PS70"  "SIMPLEX" "0.07" "1" "0" "" "" "")
(command "STYLE" "PS80"  "SIMPLEX" "0.08" "1" "0" "" "" "")
(command "STYLE" "PS100" "SIMPLEX" "0.10" "1" "0" "" "" "")
(command "STYLE" "PS120" "SIMPLEX" "0.12" "1" "0" "" "" "")
;;
;; Paper Space Titles
;;
(command "STYLE" "PT100" "ROMAND" "0.10" "1" "0" "" "" "")
(command "STYLE" "PT120" "ROMAND" "0.12" "1" "0" "" "" "")
(command "STYLE" "PT140" "ROMAND" "0.14" "1" "0" "" "" "")
(command "STYLE" "PT150" "ROMAND" "0.15" "1" "0" "" "" "")
(command "STYLE" "PT180" "ROMAND" "0.18" "1" "0" "" "" "")
(command "STYLE" "PT200" "ROMAND" "0.20" "1" "0" "" "" "")
(command "STYLE" "PT300" "ROMAND" "0.30" "1" "0" "" "" "")
;;
;; Paper Space "Existing" Text
;;
;(command "STYLE" "PX60"  "SIMPLEX" "0.06" "15" "0" "" "" "")
;(command "STYLE" "PX70"  "SIMPLEX" "0.07" "15" "0" "" "" "")
;(command "STYLE" "PX80"  "SIMPLEX" "0.08" "15" "0" "" "" "")
;(command "STYLE" "PX100" "SIMPLEX" "0.10" "15" "0" "" "" "")
;(command "STYLE" "PX120" "SIMPLEX" "0.12" "15" "0" "" "" "")
;;
;; Paper Space As-Built Text
;;
;(command "STYLE" "PA60"  "ITALIC" "0.06" "1" "0" "" "" "")
;(command "STYLE" "PA70"  "ITALIC" "0.07" "1" "0" "" "" "")
;(command "STYLE" "PA80"  "ITALIC" "0.08" "1" "0" "" "" "")
;(command "STYLE" "PA100" "ITALIC" "0.10" "1" "0" "" "" "")
;(command "STYLE" "PA120" "ITALIC" "0.12" "1" "0" "" "" "")
;;
;; Model Space Leroy Styles, General Text
;;
(command "STYLE" "L60"  "SIMPLEX" (* 0.06 bt:scaleH) "1" "0" "" "" "")
(command "STYLE" "L70"  "SIMPLEX" (* 0.07 bt:scaleH) "1" "0" "" "" "")
(command "STYLE" "L80"  "SIMPLEX" (* 0.08 bt:scaleH) "1" "0" "" "" "")
(command "STYLE" "L100" "SIMPLEX" (* 0.10 bt:scaleH) "1" "0" "" "" "")
(command "STYLE" "L120" "SIMPLEX" (* 0.12 bt:scaleH) "1" "0" "" "" "")
;;
;; Model Space Titles, Road Names, Tract Callouts
;;
(command "STYLE" "TL100" "ROMAND" (* 0.10 bt:scaleH) "1" "0" "" "" "")
(command "STYLE" "TL120" "ROMAND" (* 0.12 bt:scaleH) "1" "0" "" "" "")
;;
;; Model Space "Existing" Text
;;
;(command "STYLE" "X60"  "SIMPLEX" (* 0.06 bt:scaleH) "1" "15" "" "" "")
;(command "STYLE" "X70"  "SIMPLEX" (* 0.07 bt:scaleH) "1" "15" "" "" "")
;(command "STYLE" "X80"  "SIMPLEX" (* 0.08 bt:scaleH) "1" "15" "" "" "")
;(command "STYLE" "X100" "SIMPLEX" (* 0.10 bt:scaleH) "1" "15" "" "" "")
;(command "STYLE" "X120" "SIMPLEX" (* 0.12 bt:scaleH) "1" "15" "" "" "")
;;
;; Model Space As-Built Text
;;
;(command "STYLE" "AB60"  "ITALIC" (* 0.06 bt:scaleH) "1" "0" "" "" "")
;(command "STYLE" "AB70"  "ITALIC" (* 0.07 bt:scaleH) "1" "0" "" "" "")
;(command "STYLE" "AB80"  "ITALIC" (* 0.08 bt:scaleH) "1" "0" "" "" "")
;(command "STYLE" "AB100" "ITALIC" (* 0.10 bt:scaleH) "1" "0" "" "" "")
;(command "STYLE" "AB120" "ITALIC" (* 0.12 bt:scaleH) "1" "0" "" "" "")
;;
;; Set Current Textstyle (L80)
;;
(setq bt:scaleH (rtos bt:scaleH))
(setvar "TEXTSTYLE" "L80")
(setvar "cmdecho" oldecho)
;;
;; Display Results
;;
(princ "\nCompany Standard Textstyles loaded.")
(princ "\nCurrent Textstyle is L80.")
(princ "\nTextstyle height based on Drawing Scale: ")
(princ bt:scaleH)
(princ)
)

Craig

  • Guest
Slowww Loading Lisp
« Reply #1 on: May 31, 2005, 01:33:43 PM »
What version are you using?

If your using 2000+ could you not setup all those standards in a template file? If your unsure how, just open a blank drawing, run your program and save the drawing as a template or .dwt file and a standards .dwg file. Once you do this start your new drawings with this .dwt template file or in existing drawings insert the .dwg file to bring in all your standards.

You can also setup all your layer standards, dimensions, etc.. as well

Just an idea

CADaver

  • Guest
Slowww Loading Lisp
« Reply #2 on: May 31, 2005, 01:55:26 PM »
Make sure the path to those fonts is at the top of the Support File Search Path.

or

Use lisp to create those styles only when needed.

grush

  • Guest
Slowww Loading Lisp
« Reply #3 on: May 31, 2005, 02:38:46 PM »
Why not just create a pull down menu to set each style? That's how I have mine set up.

Pete

DanB

  • Bull Frog
  • Posts: 367
Slowww Loading Lisp
« Reply #4 on: June 01, 2005, 09:59:04 AM »
We do have a template for the initial loading of the text styles, however many times drawings are purged (I know purging can be another topic of debate) and I find it easier just to load them through LISP. I would like to set up a Company Menu in the near future. Thanks for all the replies/suggestions.

Dan
(Currently running LDD2006, soon to be on Civil 3d 2006)

CADaver

  • Guest
Slowww Loading Lisp
« Reply #5 on: June 01, 2005, 10:30:57 AM »
Quote from: DanB
We do have a template for the initial loading of the text styles, however many times drawings are purged (I know purging can be another topic of debate) and I find it easier just to load them through LISP. I would like to set up a Company Menu in the near future. Thanks for all the replies/suggestions.

Dan
(Currently running LDD2006, soon to be on Civil 3d 2006)
Create the style only when needed.  
Build a function for say titles called TTL.lsp
1.) Check if style exists, If yes set it, if no make it.
2.) Check if layer exists,  If yes set it, if no make it.
3.) Collect string for title and strcat with underline code or whatever.
4.) Collect text location
5.) Place mtext setting justification at MC and width=0.

Do this for all types of text placements and you'll always be assured of proper style and layer.

pmvliet

  • Guest
Slowww Loading Lisp
« Reply #6 on: June 01, 2005, 11:07:05 AM »
Quote
Build a function for say titles called TTL.lsp
1.) Check if style exists, If yes set it, if no make it.


DanB might want the option for this routine to redefine styles that may have been changed by users.

pieter

CADaver

  • Guest
Slowww Loading Lisp
« Reply #7 on: June 01, 2005, 12:16:48 PM »
Quote from: pmvliet
Quote
Build a function for say titles called TTL.lsp
1.) Check if style exists, If yes set it, if no make it.


DanB might want the option for this routine to redefine styles that may have been changed by users.

pieter
Very true.

I avoid such because it may lead to existing text moving around due to new height or font definitions.  We have standard style that are ALWAYS the same.  If a user changes the standard styles, I will personally nail his knees together.