Author Topic: [Help] Pack SLD file into VLX file.  (Read 7633 times)

0 Members and 1 Guest are viewing this topic.

cjw

  • Guest
[Help] Pack SLD file into VLX file.
« on: August 14, 2009, 05:36:02 AM »
Pack SLD file into VLX file.

Something wrong...

Code: [Select]
;;By cjw 8/14/09
;;For test
;;To pack SLD file into VLX file.
;;Something wrong...How to fix it?
(defun C:TEST (/ DCL_DIA   DCL_FILE  DCL_ID    DCL_LST
       DIRECTORY DONE_ID   FILE      FILE_NAME KEYS
       STR TXT_LST   X      Y
      )
  ;;The SLD Files from CAB "Text Box Routine"
  (setq TXT_LST '("bt-bold-f" "bt-bold" "bt-double-f" "bt-double"))
  (setq DIRECTORY (vl-filename-directory (findfile "acad.pat")))
  ;;Create file:
  (foreach X TXT_LST
    (setq STR (vl-get-resource X))
    (setq FILE_NAME (strcat DIRECTORY "\\" X ".SLD"))
    (setq FILE (open FILE_NAME "W"))
    (write-line STR FILE)
    (close FILE)
  )
  ;;============================================================
  (setq DCL_LST '("test:dialog {"
  "    label = \"test\" ;"
  "        :image {"
  "            key = \"image\" ;"
  "            width= 50 ;"
  "            height = 25 ;"
  "        }"
  "        :button {"
  "            key = \"bt-bold-f\" ;"
  "            label = \"bt-bold-f\" ;"
  "        }"
  "        :button {"
  "            key = \"bt-bold\" ;"
  "            label = \"bt-bold\" ;"
  "        }"
  "        :button {"
  "            key = \"bt-double-f\" ;"
  "            label = \"bt-double-f\" ;"
  "        }"
  "        :button {"
  "            key = \"bt-double\" ;"
  "            label = \"bt-double\" ;"
  "        }"
  "    spacer_1;"
  "    cancel_button;"
  "}"
)
DCL_DIA "test"
KEYS TXT_LST
  )
  ;;================================================
  ;;Create DCL
  (setq DCL_FILE (vl-filename-mktemp NIL NIL ".dcl"))
  (setq FILE (open DCL_FILE "w"))
  (foreach X DCL_LST
    (write-line X FILE)
  )
  (close FILE)
  ;;Load_dialog
  (setq DCL_ID (load_dialog DCL_FILE))
  (vl-file-delete DCL_FILE)
  (new_dialog DCL_DIA DCL_ID)
  ;;Action
  (defun ACTION (SLD)
    (setq X (dimx_tile "image")
  Y (dimy_tile "image")
    )
    (start_image "image")
    (fill_image 0 0 X Y -1)
    (slide_image 0 0 X Y SLD)
    (end_image)
  )
  (foreach X KEYS
    (action_tile X "(ACTION $KEY)")
  )
  (setq DONE_ID (start_dialog))
  (princ)
)

See the attachment

cjw

  • Guest
Re: [Help] Pack SLD file into VLX file.
« Reply #1 on: August 14, 2009, 05:40:53 AM »
It work?
It doesn't work well.


Lee Mac

  • Seagull
  • Posts: 12892
  • London, England
Re: [Help] Pack SLD file into VLX file.
« Reply #2 on: August 14, 2009, 06:04:44 AM »
I'd be interested if you could find a solution to this - I use SLD files quite a bit also...  :-P

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8580
  • AKA Daniel
Re: [Help] Pack SLD file into VLX file.
« Reply #3 on: August 14, 2009, 07:39:17 AM »
how about using this http://www.theswamp.org/index.php?topic=17465.0
and store the slide as a list ?

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8580
  • AKA Daniel
Re: [Help] Pack SLD file into VLX file.
« Reply #4 on: August 14, 2009, 09:46:07 AM »
Here is a sample, you probably ought to check to see if the files exists, so you're not recreating them each time you run the command.


Lee Mac

  • Seagull
  • Posts: 12892
  • London, England
Re: [Help] Pack SLD file into VLX file.
« Reply #5 on: August 14, 2009, 10:14:15 AM »
Nice Daniel! thanks for the link  :lol:

GDF

  • Water Moccasin
  • Posts: 2079
Re: [Help] Pack SLD file into VLX file.
« Reply #6 on: August 14, 2009, 11:06:45 AM »
I did not know you could do that. I have always used Terry Miller"s getvectors routine.



;-------------------------------------------------------------------------------
; Program Name: GetVectors.lsp [GetVectors R3]
; Created By:   Terry Miller (Email: terrycadd@yahoo.com)
;               (URL: http://web2.airmail.net/terrycad)
; Date Created: 12-7-01
; Function:     c:GetVectors explodes selected entities into lines segments and
;               writes vector points to C:\Temp\Vectors.lsp which may be viewed
;               by c:ViewVectors.
; Note: There are a few informative notes at the end of this file.
;-------------------------------------------------------------------------------
; Revision History
; Rev  By     Date    Description
;-------------------------------------------------------------------------------
; 1    TM   12-7-01   Initial version
; 2    TM   5-20-04   Added dialogs to assist in creating dialog images.
; 3    TM   3-20-05   Added c:Palet function to view AutoCAD's 255 colors.
;-------------------------------------------------------------------------------
; GetVectors is a programming tool for creating dialog images from AutoCAD
; entities. The entities selected will be exploded into line segments to create
; the image and dialog files C:\Temp\Vectors.lsp and C:\Temp\Vectors.dcl.
; Use the function ViewVectors to view the images created by GetVectors. The
; image and dialog files created by GetVectors may be pasted into your own
; programs and modified as needed.
;-------------------------------------------------------------------------------
; Instructions: Draw a rectangle in units corresponding to the pixel units of
; the image you want to create. For example to create a 50 x 50 pixel image,
; draw a rectangle from 0,0 to 49,-49. Copy and scale the entities you want to
; include in your image into the limits of the outlined rectangle. GetVectors
; creates the blocks GetVectors and DupVectors for reference. Move the blocks
; or the entities off to the side and make modifications as needed.
;-------------------------------------------------------------------------------
; Overview of Main Functions
;-------------------------------------------------------------------------------
; c:GetVectors - Creates an image and dialog file of entities selected.
; c:GV - Shortcut for c:GetVectors
; GetVectors - Function called by c:GetVectors that explodes selected entities
;    into lines segments and writes vector points to C:\Temp\Vectors.lsp.
; WmfExplode - Function called by GetVectors that creates a WMF file of the
;    selection and then explodes the WMF entities into lines.
; c:ViewVectors - View vectors created by c:GetVectors in C:\Temp\Vectors.lsp.
; c:VV - Shortcut for c:ViewVectors
; c:ImageAtts - Image Attributes dialog used to calculate the height and width
;    of dialog images.
; c:IA - Shortcut for c:ImageAtts
; c:Palet - Displays a Palet Image to view AutoCAD's 256 colors.
; c:PI - Shortcut for c:Palet
;-------------------------------------------------------------------------------
; c:GetVectors - Creates an image and dialog file of entities selected.
;-------------------------------------------------------------------------------
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

cjw

  • Guest
Re: [Help] Pack SLD file into VLX file.
« Reply #7 on: August 14, 2009, 11:35:16 AM »
Here is a sample, you probably ought to check to see if the files exists, so you're not recreating them each time you run the command.



Nice work.Daniel!
Thank you very much.

Lee Mac

  • Seagull
  • Posts: 12892
  • London, England
Re: [Help] Pack SLD file into VLX file.
« Reply #8 on: August 14, 2009, 01:09:18 PM »
I did not know you could do that. I have always used Terry Miller"s getvectors routine.



Yes, I've seen similar routines like that - but I prefer the quality you get with a SLD file, but in the past I have just zipped them with the vlx file.

jxphklibin

  • Guest
Re: [Help] Pack SLD file into VLX file.
« Reply #9 on: August 16, 2009, 10:50:00 PM »
Here is a sample, you probably ought to check to see if the files exists, so you're not recreating them each time you run the command.




为何输出的文件大小为 0 字节?????幻灯片还是不能用,读取错误

Lee Mac

  • Seagull
  • Posts: 12892
  • London, England
Re: [Help] Pack SLD file into VLX file.
« Reply #10 on: August 17, 2009, 03:40:58 AM »
Here is a sample, you probably ought to check to see if the files exists, so you're not recreating them each time you run the command.




为何输出的文件大小为 0 字节?????幻灯片还是不能用,读取错误

Seems Ok to me  :?

aicr317

  • Guest
Re: [Help] Pack SLD file into VLX file.
« Reply #11 on: December 22, 2009, 08:37:06 PM »
i also can't done like that , cad notice "read sld file error"

aicr317

  • Guest
Re: [Help] Pack SLD file into VLX file.
« Reply #12 on: December 22, 2009, 09:03:07 PM »
the file "sld in vlx.zip" has something wrong ,so it do not work well,help me !!!

mail:
jiangmj@scei.com.cn
« Last Edit: December 23, 2009, 01:28:29 AM by aicr317 »

efernal

  • Bull Frog
  • Posts: 206
Re: [Help] Pack SLD file into VLX file.
« Reply #13 on: December 24, 2009, 08:19:25 AM »
sometimes i use a code like this...
e.fernal

;; lines made by a exploded user's hatch...
;|

(SETQ s1 (SSGET "x" '((0 . "LINE"))))
(SETQ cn  0
      par nil
      fim nil
      sn  (SSLENGTH s1)
)
(REPEAT   sn
  (SETQ   ent (ENTGET (SSNAME s1 cn))
   cn  (1+ cn)
   p10 (CDR (ASSOC 10 ent))
   p11 (CDR (ASSOC 11 ent))
   par (LIST p10 p11)
   fim (APPEND fim (LIST par))
  )
)
;; fim will be:
(SETQ fim '(((97.441 -39.3978 0.0) (97.441 -14.7406 0.0))
       ((96.0667 -39.2055 0.0) (96.0667 -15.0535 0.0))
       ((94.6924 -39.0132 0.0) (94.6924 -15.3665 0.0))
       ((93.3181 -38.8209 0.0) (93.3181 -15.6794 0.0))
       ((91.9438 -38.6285 0.0) (91.9438 -15.9923 0.0))
       ((90.5696 -38.4362 0.0) (90.5696 -16.3053 0.0))
       ((89.1953 -38.2439 0.0) (89.1953 -16.6182 0.0))
       ((87.821 -38.0516 0.0) (87.821 -16.9311 0.0))
       ((86.4467 -37.8593 0.0) (86.4467 -17.2441 0.0))
       ((85.0724 -37.6669 0.0) (85.0724 -17.557 0.0))
       ((83.6981 -37.4746 0.0) (83.6981 -17.8699 0.0))
       ((82.3238 -2.92525 0.0) (82.3238 -1.42207 0.0))
       ((82.3238 -37.2823 0.0) (82.3238 -18.1828 0.0))
       ((80.9496 -4.94164 0.0) (80.9496 -1.45067 0.0))
       ((80.9496 -37.09 0.0) (80.9496 -18.4958 0.0))
       ((79.5753 -6.95803 0.0) (79.5753 -1.47927 0.0))
       ((79.5753 -36.8977 0.0) (79.5753 -18.8087 0.0))
       ((78.201 -8.97442 0.0) (78.201 -1.50787 0.0))
       ((78.201 -36.7053 0.0) (78.201 -19.1216 0.0))
       ((76.8267 -10.9908 0.0) (76.8267 -1.53647 0.0))
       ((76.8267 -36.513 0.0) (76.8267 -19.4346 0.0))
       ((75.4524 -13.0072 0.0) (75.4524 -1.56507 0.0))
       ((75.4524 -36.3207 0.0) (75.4524 -19.7475 0.0))
       ((74.0781 -15.0236 0.0) (74.0781 -1.59367 0.0))
       ((74.0781 -36.1284 0.0) (74.0781 -20.0604 0.0))
       ((72.7038 -17.04 0.0) (72.7038 -1.62227 0.0))
       ((72.7038 -35.9361 0.0) (72.7038 -20.3734 0.0))
       ((71.3296 -19.0564 0.0) (71.3296 -1.65088 0.0))
       ((71.3296 -35.7438 0.0) (71.3296 -20.6863 0.0))
       ((69.9553 -35.5514 0.0) (69.9553 -1.67948 0.0))
       ((68.581 -35.3591 0.0) (68.581 -1.70808 0.0))
       ((67.2067 -35.1668 0.0) (67.2067 -1.73668 0.0))
       ((65.8324 -34.9745 0.0) (65.8324 -1.76528 0.0))
       ((64.4581 -34.7822 0.0) (64.4581 -1.79388 0.0))
       ((63.0839 -34.5898 0.0) (63.0839 -1.82248 0.0))
       ((61.7096 -34.3975 0.0) (61.7096 -1.85108 0.0))
       ((60.3353 -34.2052 0.0) (60.3353 -1.87969 0.0))
       ((58.961 -34.0129 0.0) (58.961 -1.90829 0.0))
       ((57.5867 -33.8206 0.0) (57.5867 -1.93689 0.0))
       ((56.2124 -33.6282 0.0) (56.2124 -1.96549 0.0))
       ((54.8381 -33.4359 0.0) (54.8381 -1.99409 0.0))
       ((53.4639 -33.2436 0.0) (53.4639 -2.02269 0.0))
       ((52.0896 -33.0513 0.0) (52.0896 -2.05129 0.0))
       ((50.7153 -32.859 0.0) (50.7153 -2.07989 0.0))
       ((49.341 -32.6667 0.0) (49.341 -2.1085 0.0))
       ((47.9667 -32.4743 0.0) (47.9667 -2.1371 0.0))
       ((46.5924 -32.282 0.0) (46.5924 -2.1657 0.0))
       ((45.2181 -32.0897 0.0) (45.2181 -2.1943 0.0))
       ((43.8439 -31.8974 0.0) (43.8439 -2.2229 0.0))
       ((42.4696 -31.7051 0.0) (42.4696 -2.2515 0.0))
       ((41.0953 -31.5127 0.0) (41.0953 -2.2801 0.0))
       ((39.721 -31.3204 0.0) (39.721 -2.3087 0.0))
       ((38.3467 -31.1281 0.0) (38.3467 -2.33731 0.0))
       ((36.9724 -30.9358 0.0) (36.9724 -2.36591 0.0))
       ((35.5981 -30.7435 0.0) (35.5981 -2.39451 0.0))
       ((34.2239 -30.5511 0.0) (34.2239 -2.42311 0.0))
       ((32.8496 -30.3588 0.0) (32.8496 -2.45171 0.0))
       ((31.4753 -30.1665 0.0) (31.4753 -2.48031 0.0))
       ((30.101 -29.9742 0.0) (30.101 -2.50891 0.0))
       ((28.7267 -29.7819 0.0) (28.7267 -2.53751 0.0))
       ((27.3524 -29.5895 0.0) (27.3524 -2.56612 0.0))
       ((25.9781 -29.3972 0.0) (25.9781 -2.59472 0.0))
       ((24.6039 -29.2049 0.0) (24.6039 -2.62332 0.0))
       ((23.2296 -29.0126 0.0) (23.2296 -2.65192 0.0))
       ((21.8553 -28.8203 0.0) (21.8553 -2.68052 0.0))
       ((20.481 -28.628 0.0) (20.481 -2.70912 0.0))
       ((19.1067 -28.4356 0.0) (19.1067 -2.73772 0.0))
       ((17.7324 -28.2433 0.0) (17.7324 -2.76632 0.0))
       ((16.3581 -28.051 0.0) (16.3581 -2.79493 0.0))
       ((14.9839 -27.8587 0.0) (14.9839 -2.82353 0.0))
       ((13.6096 -27.6664 0.0) (13.6096 -2.85213 0.0))
       ((12.2353 -27.474 0.0) (12.2353 -2.88073 0.0))
       ((10.861 -27.2817 0.0) (10.861 -2.90933 0.0))
       ((9.48671 -27.0894 0.0) (9.48671 -2.93793 0.0))
       ((8.11243 -26.8971 0.0) (8.11243 -2.96653 0.0))
       ((6.73814 -26.7048 0.0) (6.73814 -2.99514 0.0))
       ((5.36386 -26.5124 0.0) (5.36386 -3.02374 0.0))
       ((3.98957 -26.3201 0.0) (3.98957 -3.05234 0.0))
       ((2.61528 -26.1278 0.0) (2.61528 -12.0889 0.0))
       ((3.27208 -3.06727 0.0) (1.60352 -25.9862 0.0))
       ((83.3631 -1.40044 0.0) (3.27208 -3.06727 0.0))
       ((70.0146 -20.9857 0.0) (83.3631 -1.40044 0.0))
       ((98.3802 -14.5267 0.0) (70.0146 -20.9857 0.0))
       ((98.3802 -39.5292 0.0) (98.3802 -14.5267 0.0))
       ((1.60352 -25.9862 0.0) (98.3802 -39.5292 0.0))
      )
      NOVA '()
)
(FOREACH x fim
  (SETQ   x    (LIST (ABS (FIX (CAR (CAR x))))
         (ABS (FIX (CADR (CAR x))))
         (ABS (FIX (CAR (CADR x))))
         (ABS (FIX (CADR (CADR x))))
        )
   nova (APPEND nova (LIST x))
  )
)
|;

 ;| dcl for test

lixo:dialog{label="Teste";
:image{key="i";width=60;aspect_ratio=0.40;}
ok_only;}

|;

(DEFUN c:teste (/ dh dx dt)
  (SETQ dh (LOAD_DIALOG "C:\\LIXO.DCL"))
  (NEW_DIALOG "lixo" dh)
  (SETQ   dx (DIMX_TILE "i") ; 360
   dy (DIMY_TILE "i")
  )          ; 144
  ;; viewport = 100x40
  ;; ratio = 360 / 100 = 3.6
  ;; ratio = 144 / 40  = 3.6
  (START_IMAGE "i")
  (FOREACH x '((97 39 97 14)
          (96 39 96 15)
          (94 39 94 15)
          (93 38 93 15)
          (91 38 91 15)
          (90 38 90 16)
          (89 38 89 16)
          (87 38 87 16)
          (86 37 86 17)
          (85 37 85 17)
          (83 37 83 17)
          (82 2 82 1)
          (82 37 82 18)
          (80 4 80 1)
          (80 37 80 18)
          (79 6 79 1)
          (79 36 79 18)
          (78 8 78 1)
          (78 36 78 19)
          (76 10 76 1)
          (76 36 76 19)
          (75 13 75 1)
          (75 36 75 19)
          (74 15 74 1)
          (74 36 74 20)
          (72 17 72 1)
          (72 35 72 20)
          (71 19 71 1)
          (71 35 71 20)
          (69 35 69 1)
          (68 35 68 1)
          (67 35 67 1)
          (65 34 65 1)
          (64 34 64 1)
          (63 34 63 1)
          (61 34 61 1)
          (60 34 60 1)
          (58 34 58 1)
          (57 33 57 1)
          (56 33 56 1)
          (54 33 54 1)
          (53 33 53 2)
          (52 33 52 2)
          (50 32 50 2)
          (49 32 49 2)
          (47 32 47 2)
          (46 32 46 2)
          (45 32 45 2)
          (43 31 43 2)
          (42 31 42 2)
          (41 31 41 2)
          (39 31 39 2)
          (38 31 38 2)
          (36 30 36 2)
          (35 30 35 2)
          (34 30 34 2)
          (32 30 32 2)
          (31 30 31 2)
          (30 29 30 2)
          (28 29 28 2)
          (27 29 27 2)
          (25 29 25 2)
          (24 29 24 2)
          (23 29 23 2)
          (21 28 21 2)
          (20 28 20 2)
          (19 28 19 2)
          (17 28 17 2)
          (16 28 16 2)
          (14 27 14 2)
          (13 27 13 2)
          (12 27 12 2)
          (10 27 10 2)
          (9 27 9 2)
          (8 26 8 2)
          (6 26 6 2)
          (5 26 5 3)
          (3 26 3 3)
          (2 26 2 12)
          (3 3 1 25)
          (83 1 3 3)
          (70 20 83 1)
          (98 14 70 20)
          (98 39 98 14)
          (1 25 98 39)
         )
    (VECTOR_IMAGE
      (FIX (* 3.6 (CAR x)))
      (FIX (* 3.6 (CADR x)))
      (FIX (* 3.6 (CADDR x)))
      (FIX (* 3.6 (LAST x)))
      5
    )
  )
  (END_IMAGE)
  (START_DIALOG)
  (UNLOAD_DIALOG dh)
  (PRINC)
)


e.fernal