Author Topic: how to create sld file in silent mode  (Read 2660 times)

0 Members and 1 Guest are viewing this topic.

Sam

  • Bull Frog
  • Posts: 201
how to create sld file in silent mode
« on: March 20, 2012, 02:35:38 AM »
dear all
today's my 2nd question
how to create sld file in silent mode without open any drawing (it's possible)
because so many files
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: how to create sld file in silent mode
« Reply #1 on: March 20, 2012, 02:58:14 AM »

Can't be done.

Try a script using something like ScriptPro.

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

JohnK

  • Administrator
  • Seagull
  • Posts: 10648
Re: how to create sld file in silent mode
« Reply #2 on: March 20, 2012, 03:13:37 PM »
And here is a small/simple script for you to use with ScriptPro.

Code - Auto/Visual Lisp: [Select]
  1. ( (lambda ( / )
  2.     (mapcar
  3.       '(lambda ( x / )
  4.          (eval x)
  5.          (repeat 2 (command))
  6.          (princ))
  7.       '(
  8.         (command "_zoom" "e")
  9.         (command "_zoom" "0.9x")
  10.  
  11.         (command "_mslide" (cadr (fnsplitl (getvar "DWGNAME"))))
  12.  
  13.         (repeat 2 (command))
  14.  
  15.         (command "_qsave")
  16.         ;; save
  17.         (command "_close")
  18.         ;; close
  19.         )
  20.       )
  21.     (princ)
  22.     )
  23.  )
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

Sam

  • Bull Frog
  • Posts: 201
Re: how to create sld file in silent mode
« Reply #3 on: March 21, 2012, 05:49:22 AM »
And here is a small/simple script for you to use with ScriptPro.

Code - Auto/Visual Lisp: [Select]
  1. ( (lambda ( / )
  2.     (mapcar
  3.       '(lambda ( x / )
  4.          (eval x)
  5.          (repeat 2 (command))
  6.          (princ))
  7.       '(
  8.         (command "_zoom" "e")
  9.         (command "_zoom" "0.9x")
  10.  
  11.         (command "_mslide" (cadr (fnsplitl (getvar "DWGNAME"))))
  12.  
  13.         (repeat 2 (command))
  14.  
  15.         (command "_qsave")
  16.         ;; save
  17.         (command "_close")
  18.         ;; close
  19.         )
  20.       )
  21.     (princ)
  22.     )
  23.  )
dear sir

thx very much
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html

Sam

  • Bull Frog
  • Posts: 201
Re: how to create sld file in silent mode
« Reply #4 on: March 21, 2012, 05:51:35 AM »
dear all
found the lisp but very slow
Code - Auto/Visual Lisp: [Select]
  1. ;;the By carrot1983
  2. (defun C:DWG2SLD (/ ACADOBJ DOC DWG_DIR DWG_LST NAME SDI)
  3.   ;;By carrot1983
  4.   (defun CJW-FILE-GET (MSG / WINSHELL SHFOLDER PATH CATCHIT)
  5.     (setq WINSHELL (vlax-create-object "Shell.Application"))
  6.     (setq
  7.       SHFOLDER (vlax-invoke-method WINSHELL 'BROWSEFORFOLDER 0 MSG 1)
  8.     )
  9.     (setq
  10.       CATCHIT (vl-catch-all-apply
  11.                 '(lambda ()
  12.                    (setq SHFOLDER (vlax-get-property SHFOLDER 'SELF))
  13.                    (setq PATH (vlax-get-property SHFOLDER 'PATH))
  14.                  )
  15.               )
  16.     )
  17.     (if        (vl-catch-all-error-p CATCHIT)
  18.       NIL
  19.       PATH
  20.     )
  21.   )
  22.   (princ
  23.     "\nCAD graphical DWG files batch converted into a slide (DWGTOSLD) By carrot1983 2009-05-10"
  24.   )
  25.   (setvar "CMDECHO" 0)
  26.   (alert "\nNote: backup original!")
  27.   (if (and (setq DWG_DIR (CJW-FILE-GET "to select the DWG file folder?"))
  28.            (setq DWG_LST (vl-directory-files DWG_DIR "*.DWG" 1))
  29.       )
  30.     (progn
  31.       (foreach DWG DWG_LST
  32.         (if (setq SS (ssget "x"))
  33.           (command "._ERASE" SS "")
  34.         )
  35.         (setq DWG (strcat DWG_DIR "\\" DWG))
  36.         (setq SLD (strcat DWG_DIR "\\" (vl-filename-base DWG) ".sld"))
  37.         (command ".-INSERT" DWG "_NON" '(0. 0. 0.) "1" "1" "0")
  38.         (command "._ZOOM" "_E")
  39.         (command "._MSLIDE" SLD)
  40.         (print SLD)
  41.       )
  42.       (alert "program the finished <DWG2SLD>")
  43.       (command "._BROWSER" "http://carrot1983.blog.sohu.com/")
  44.     )
  45.   )
  46.   (princ)
  47. )
Every time we waste electricity, we put our planet's future in the dark. Let's turn around our attiude and start saving power and our planet, before it's too late
http://www.theswamp.org/donate.html