Author Topic: dcl in lisp  (Read 8762 times)

0 Members and 1 Guest are viewing this topic.

DEVITG

  • Bull Frog
  • Posts: 481
dcl in lisp
« on: June 28, 2004, 10:48:28 PM »
Is there a way to put a dcl file or it's statements inside the Lisp it call.

So you dont have to worry to locate the dcl on the proper dierectory and folder.

I mean the lisp with the dcl in a sole file
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Serge J. Gianolla

  • Guest
dcl in lisp
« Reply #1 on: June 28, 2004, 11:03:45 PM »
Yeah, you can add dcl files to lsp files when compiling via VLIDE.
Serge

DEVITG

  • Bull Frog
  • Posts: 481
dcl in lisp
« Reply #2 on: June 28, 2004, 11:06:35 PM »
I had seen pure LISP with DCL inside, but I do not know how to do it .
I do not  mean compiled.
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

Serge J. Gianolla

  • Guest
dcl in lisp
« Reply #3 on: June 28, 2004, 11:20:02 PM »
If you do not want to use compiled method, then you are looking for headaches. Your lisp code has to have a write function to a file where each single dcl line is to be added! With all the problems of AutoLISP not able to interpret correctly if " is part of a string or part of imperial settings. Cannot have a string withing another string, have to use \" crap... This method was good 6 to 12 years ago when there was nothing else!

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
dcl in lisp
« Reply #4 on: June 29, 2004, 01:16:49 AM »
Here is one way.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
dcl in lisp
« Reply #5 on: June 29, 2004, 03:14:35 AM »
Quote from: CAB
Here is one way.

Very nice work CAB. I did a similar thing with atoms15.vlx despite the fact it's compiled so it would thwart casual attempts to change tiles etc. (you can easily view dcl code in vlx files). :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

Anonymous

  • Guest
dcl in lisp
« Reply #6 on: June 29, 2004, 03:25:05 AM »
Agreed Michael, but Devitg did not mention about security issue. If it is a concern; and real power, with ease of use and Activex added to forms, "nothing" beats ObjectDCL! Your Atoms.vlx is the routine the same guy is after; i believe in different thread - unless i am mistaken.

Serge J. Gianolla

  • Guest
dcl in lisp
« Reply #7 on: June 29, 2004, 03:27:57 AM »
Guess who wrote the line above. Man, i'm goin' home, fed up with login bug for today 8)

SpeedCAD

  • Guest
dcl in lisp
« Reply #8 on: June 29, 2004, 01:48:35 PM »
Quote from: DEVITG
I had seen pure LISP with DCL inside, but I do not know how to do it .
I do not  mean compiled.


Hola...

Lo que debes hacer es simplemente compilar tu proyecto en forma Expert y asi podras añadir el archivo DCL que deseas que se compile junto con tu archivo Lisp.

En la pagina AfraLisp tambien hay un tutorial sobre DCL en donde pone un ejemplo de crear un DCL por medio del Lisp...

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
dcl in lisp
« Reply #9 on: June 29, 2004, 01:56:21 PM »
Quote from: Anonymous
Agreed Michael, but Devitg did not mention about security issue. If it is a concern; and real power, with ease of use and Activex added to forms, "nothing" beats ObjectDCL!

... Except maybe rolling your own dlls and calling them from visual lisp. :) (no disrespect to Chad; a very good programmer).

Quote from: Anonymous
Your Atoms.vlx is the routine the same guy is after; i believe in different thread - unless i am mistaken.

I saw that thread and wasn't convinced he was looking for my toy; the last thing I want to do is start flogging my stuff gratuitously. But thanks for the note. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JohnK

  • Administrator
  • Seagull
  • Posts: 10669
dcl in lisp
« Reply #10 on: June 29, 2004, 05:26:11 PM »
Quote from: MP
... the last thing I want to do is start flogging my stuff gratuitously. But thanks for the note. :)
Yeah! ...I tell ya what MP, shoot me an email of all your source code and ill do it.

:lol:
TheSwamp.org (serving the CAD community since 2003)
Member location map - Add yourself

Donate to TheSwamp.org

DEVITG

  • Bull Frog
  • Posts: 481
dcl in lisp
« Reply #11 on: June 29, 2004, 07:15:53 PM »
it is on the web .
it is a freeware
I had downloaded
work great
but it is not what I had seen.
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

DEVITG

  • Bull Frog
  • Posts: 481
I found it , here it is
« Reply #12 on: July 01, 2004, 10:05:12 PM »
Following is a sole and pure LISP with DCL inside.

Code: [Select]
; Copyright 2001 by EMT Software Inc. - by Scott Hull 05/11/01
;
; updated: 07/20/01
;
; This program will draw a 3D solid of a roller sprocket.
;
; Data from Engineering Handbook  
;
(defun C:3DSPRKT (/ #2XTHKNS #4XTHKNS #CHAM_DP #CHAM_WD #DCL-FILE #DCL-ID
 #DCL-LIST #FILE #HD #HELP #PITCH #RLR_DIA #ROWS #SETVAR #SIZE #SIZELIST
 #TEETH #THKNS #TRANSV #TRANSV_H #WIDTH @EXT-PLINE @GETVAR @GRAY_HEAVY
 @GRAY_ROWS @INTERSECT @REV-PLINE @ROT-Y @ROWS @SETVAR @SPRKT @SPRKT-DRAW
 @SPRKT-PTS @TEETH @TRANSLATE @WIDTH *error*)

; start or R14 compatibility library
(if (= (substr (getvar "acadver") 1 2) "14")
 (progn
(defun vl-file-delete (%A) nil)

(defun vl-filename-mktemp (%A / #DIR)
 (cond
  ((setq #DIR (getenv "tmp")) nil)
  ((setq #DIR (getenv "temp")) nil)
  (T (setq #DIR "")))
 (strcat #DIR "\\" %A))

(defun vl-position (%A %B)
 (if (member %A %B) (- (length %B) (length (member %A %B)))))
))
; end of R14 compatibility library

 (defun *error* (%A)
  (if (= (type #FILE) 'FILE) (close #FILE))
  (cond
   ((= %A "Function cancelled") nil)
   (t (princ (strcat "\nerror: " %A "\007\n"))))
  (princ))

 (setq #DCL-LIST (list
"sprocket3d : dialog {"
"  label = \"3D Sprocket\";"
"    : row {"
"      : column {"
"        : popup_list {"
"          height = 3;"
"          label = \"&Size\";"
"          key = \"size\";"
"          width = 16;"
"        }"
"        : toggle {"
"          key = \"heavy_duty\";"
"          label = \"&Heavy duty\";"
"        }"
"      }"
"      spacer;"
"      : column {"
"        : row {"
"          : edit_box {"
"            edit_width = 3;"
"            key = \"teeth\";"
"            label = \"&Teeth:\";"
"          }"
"          : button {"
"            key = \"teeth_minus\";"
"            label = \"-\";"
"          }"
"          : button {"
"            key = \"teeth_plus\";"
"            label = \"+\";"
"          }"
"        }"
"        : row {"
"          : edit_box {"
"            edit_width = 3;"
"            key = \"rows\";"
"            label = \"&Rows:\";"
"          }"
"          : button {"
"            key = \"rows_minus\";"
"            label = \"-\";"
"          }"
"          : button {"
"            key = \"rows_plus\";"
"            label = \"+\";"
"          }"
"        }"
"      }"
"    }"
"  spacer;"
"  ok_cancel_help_cadalog_errtile;"
"}"
""
"cadalog_button : retirement_button {"
"  key = \"cadalog\";"
"  label = \"&CADalog.com...\";"
"}"
""
"ok_cancel_help_cadalog : column {"
"  : row {"
"    fixed_width = true;"
"    alignment = centered;"
"    ok_button;"
"    : spacer {"
"      width = 2;"
"    }"
"    cancel_button;"
"    : spacer {"
"      width = 2;"
"    }"
"    help_button;"
"    : spacer {"
"      width = 2;"
"    }"
"    cadalog_button;"
"  }"
"}"
""
"ok_cancel_help_cadalog_errtile : column {"
"  ok_cancel_help_cadalog;"
"  errtile;"
"}"))

(setq #HELP (strcat
 "3D Sprocket\n\n"
 "This program draws 3D solid models of standard roller chain \n"
 "sprockets. You can specify the size, number of teeth, number \n"
 "of rows, and insertion point. Some multi-row sprockets also \n"
 "have a heavy duty sprocket option."))

;Sprocket sizes
;
;"SIZE" "PITCH" "RLR_DIA" "THKNS" "2XTHKNS" "4XTHKNS" "CHAM_DP" "CHAM_WD" "TRANSV" "TRANSV_H"
(setq #SIZELIST (list
'("25" 0.25 0.13 0.11 0.106 0.096 0.125 0.031 0.252 nil)
'("35" 0.375 0.2 0.169 0.163 0.15 0.188 0.047 0.399 nil)
'("41" 0.5 0.306 0.226 nil nil 0.25 0.062 nil nil)
'("40" 0.5 0.312 0.284 0.275 0.256 0.25 0.062 0.566 nil)
'("50" 0.625 0.4 0.343 0.332 0.31 0.312 0.078 0.713 nil)
'("60" 0.75 0.469 0.459 0.444 0.418 0.375 0.094 0.897 1.028)
'("80" 1.0 0.625 0.575 0.556 0.526 0.5 0.125 1.153 1.283)
'("100" 1.25 0.75 0.692 0.669 0.633 0.625 0.156 1.408 1.539)
'("120" 1.5 0.875 0.924 0.894 0.848 0.75 0.188 1.798 1.924)
'("140" 1.75 1.0 0.924 0.894 0.848 0.875 0.219 1.924 2.055)
'("160" 2.0 1.125 1.156 1.119 1.063 1.0 0.25 2.305 2.437)
'("180" 2.25 1.406 1.302 1.259 1.198 1.125 0.281 2.592 2.723)
'("200" 2.5 1.562 1.389 1.344 1.278 1.25 0.312 2.817 3.083)
'("240" 3.0 1.875 1.738 1.682 1.602 1.5 0.375 3.458 3.985)))

 (defun @EXT-PLINE (%PTS %H / #ENTADD #ENTFIRST #ENTLAST
  #ENTNEXT #LYR #P0 #P1 #P2 #P3 #PTS #SS)
  (@GETVAR '("aunits" "blipmode" "clayer" "limcheck" "osmode"))
  (setq #ENTLAST (entlast))
  (if #ENTLAST
   (while (entnext #ENTLAST) (setq #ENTLAST (entnext #ENTLAST))))
  (setq #PTS %PTS)
  (if (/= (distance (car #PTS) (last #PTS)) 0.0)
   (setq #PTS (reverse (cons (car #PTS) (reverse #PTS)))))
  (setvar "blipmode" 0)
  (setvar "limcheck" 0)
  (setvar "osmode" 0)
  (while (> (length #PTS) 1)
   (setq #P0 (caddr (caddr #PTS))
         #P1 (car #PTS)
         #P2 (cadr #PTS)
         #P3 (caddr #PTS)
         #P1 (list (car #P1) (cadr #P1) 0)
         #P2 (list (car #P2) (cadr #P2) 0)
         #P3 (list (car #P3) (cadr #P3) 0))
   (if (= #P0 1)
    (progn
     (command "_.arc" #P1 #P2 #P3)
     (setq #PTS (cdr (cdr #PTS))))
    (progn
     (command "_.line" #P1 #P2 "")
     (setq #PTS (cdr #PTS)))))
  (if #ENTLAST
   (setq #ENTFIRST (entnext #ENTLAST))
   (setq #ENTFIRST (entnext)))
  (setq #SS (ssadd (setq #ENTADD (entnext #ENTFIRST))))
  (while (setq #ENTADD (entnext #ENTADD))
   (ssadd #ENTADD #SS))
  (command "_.pedit" #ENTFIRST "_y" "_j" #SS "" "_x")
  (setvar "aunits" 3)
  (if (/= #ENTLAST (entlast))
   (command "_.extrude" (entlast) "" %H 0))
  (@SETVAR '("aunits" "blipmode" "clayer" "limcheck" "osmode"))
  (setq #ENTNEXT (entlast))
  (if (= #ENTLAST #ENTNEXT) nil #ENTNEXT))

;(function (list "variable1" "variable2" etc.))
 (defun @GETVAR (%A / #X)
  (foreach #X %A
   (if (not (assoc #X #SETVAR))
    (setq #SETVAR (cons (list #X (getvar #X)) #SETVAR)))))

 (defun @GRAY_HEAVY ()
  (if (and #TRANSV_H (> #ROWS 1.0))
   (mode_tile "heavy_duty" 0)
   (progn
    (setq #HD 0)
    (set_tile "heavy_duty" "0")
    (mode_tile "heavy_duty" 1))))

 (defun @GRAY_ROWS ()
  (if #TRANSV
   (progn
    (mode_tile "rows" 0)
    (mode_tile "rows_minus" 0)
    (mode_tile "rows_plus" 0))
   (progn
    (setq #ROWS 1)
    (set_tile "rows" "1")
    (mode_tile "rows" 1)
    (mode_tile "rows_minus" 1)
    (mode_tile "rows_plus" 1))))

 (defun @INTERSECT (%SS / #SS #X)
  (if (= (type %SS) 'LIST)
   (progn
    (setq #SS (ssadd))
    (foreach #X %SS (ssadd #X #SS)))
   (setq #SS %SS))
  (command "_.intersect" #SS "")
  (ssname #SS 0))

 (defun @REV-PLINE (%PTS %ANG %AXIS / #ENTADD #ENTFIRST #ENTLAST
  #ENTNEXT #LYR #P0 #P1 #P2 #P3 #PTS #SS)
  (@GETVAR '("aunits" "blipmode" "clayer" "limcheck" "osmode"))
  (setq #ENTLAST (entlast))
  (if #ENTLAST
   (while (entnext #ENTLAST) (setq #ENTLAST (entnext #ENTLAST))))
  (setq #PTS %PTS)
  (if (/= (distance (car #PTS) (last #PTS)) 0.0)
   (setq #PTS (reverse (cons (car #PTS) (reverse #PTS)))))
  (setvar "blipmode" 0)
  (setvar "limcheck" 0)
  (setvar "osmode" 0)
  (while (> (length #PTS) 1)
   (setq #P0 (caddr (caddr #PTS))
         #P1 (car #PTS)
         #P2 (cadr #PTS)
         #P3 (caddr #PTS)
         #P1 (list (car #P1) (cadr #P1) 0)
         #P2 (list (car #P2) (cadr #P2) 0)
         #P3 (list (car #P3) (cadr #P3) 0))
   (if (= #P0 1)
    (progn
     (command "_.arc" #P1 #P2 #P3)
     (setq #PTS (cdr (cdr #PTS))))
    (progn
     (command "_.line" #P1 #P2 "")
     (setq #PTS (cdr #PTS)))))
  (if #ENTLAST
   (setq #ENTFIRST (entnext #ENTLAST))
   (setq #ENTFIRST (entnext)))
  (setq #SS (ssadd (setq #ENTADD (entnext #ENTFIRST))))
  (while (setq #ENTADD (entnext #ENTADD))
   (ssadd #ENTADD #SS))
  (command "_.pedit" #ENTFIRST "_y" "_j" #SS "" "_x")
  (if (/= #ENTLAST (entlast))
   (progn
    (setvar "aunits" 3)
    (command "_.revolve" (entlast) "" (car %AXIS) (cadr %AXIS) %ANG)))
  (@SETVAR '("aunits" "blipmode" "clayer" "limcheck" "osmode"))
  (setq #ENTNEXT (entlast))
  (if (= #ENTLAST #ENTNEXT) nil #ENTNEXT))

 (defun @ROT-Y (%ENAME %ANG)
  (@GETVAR '("aunits" "blipmode" "ucsicon"))
  (setvar "aunits" 3)
  (setvar "blipmode" 0)
  (setvar "ucsicon" 0)
  (command "_.ucs" "_x" (* -0.5 pi))
  (if (/= %ANG 0) (command "_.rotate" %ENAME "" "_none" (list 0 0 0) %ANG))
  (command "_.ucs" "_p")
  (@SETVAR '("aunits" "ucsicon"))
  (eval T))

 (defun @ROWS (%A / #TMP)
  (if (> (setq #TMP (abs (atoi %A))) 0) (setq #ROWS #TMP))
  (set_tile "rows" (itoa #ROWS))
  (@GRAY_HEAVY))

;(function (list "variable1" "variable2" etc.))
;(function nil) reset all
 (defun @SETVAR (%A / #A #B @A)
  (defun @A (%A %B /)
   (cond
    ((and (= (car %B) "clayer") (not (tblsearch "layer" (cadr %B)))) nil)
    ((member (car %B) (list "ucsorg")) nil)
    (T (setvar (car %B) (cadr %B)))))
  (cond
   ((not %A)
    (foreach #A #SETVAR (@A %A #A)) (setq #SETVAR nil))
   ((= (type %A) 'LIST)
    (foreach #A %A (setq #A (assoc #A #SETVAR))
     (if #A (@A %A #A))))))

 (defun @SPRKT (/ #DIA #EDGE #END #LIST #MHD/2 #RAD_O #RAD_CHAM
  #START #THKNS/2 #TOP/2)

  (setq #DIA (* #PITCH (+ 0.6 (/ 1.0 (atan (/ pi #TEETH)))))
        #RAD_O (/ #DIA 2.0)
        #RAD_CHAM (- #RAD_O #CHAM_DP)
        #MHD/2 (* #PITCH 0.5 (1- (/ 1.0 (atan (/ pi #TEETH))))))
  (cond
   ((> #ROWS 3) (setq #THKNS #4XTHKNS))
   ((> #ROWS 1) (setq #THKNS #2XTHKNS)))
  (if (= #HD 1) (setq #TRANSV #TRANSV_H))
  (setq #EDGE 0.0
        #THKNS/2 (* 0.5 #THKNS)
        #TOP/2 (- #THKNS/2 #CHAM_WD)
        #START (list '(0 0) (list 0 #RAD_CHAM) (list #CHAM_WD #RAD_O))
        #END (list (list (- #WIDTH #CHAM_WD) #RAD_O)
              (list #WIDTH #RAD_CHAM) (list #WIDTH 0) (car #START)))
  (repeat (1- #ROWS)
   (setq #LIST (append #LIST (list
      (list (+ #EDGE #THKNS (- #CHAM_WD)) #RAD_O)
      (list (+ #EDGE #THKNS) #RAD_CHAM)
      (list (+ #EDGE #THKNS) #MHD/2)
      (list (+ #EDGE #TRANSV) #MHD/2)
      (list (+ #EDGE #TRANSV) #RAD_CHAM)
      (list (+ #EDGE #TRANSV #CHAM_WD) #RAD_O)))
         #EDGE (+ #EDGE #TRANSV)))
  (setq #LIST (append #START #LIST #END))
  (if (> #MHD/2 0.0)
   (progn
    (setq #SOL_SPRKT (@REV-PLINE #LIST (* 2.0 pi) '((0 0) (1 0))))  
    (@ROT-Y #SOL_SPRKT (* pi 0.5))
    (setq #PTS (@SPRKT-PTS #PITCH #RLR_DIA #TEETH)
          #PROFILE (@EXT-PLINE #PTS #WIDTH))
    (@TRANSLATE #PROFILE 0 0 (- #WIDTH))
    (setq #SOL_SPRKT (@INTERSECT (list #SOL_SPRKT #PROFILE))))))

 (defun @SPROCKET-DRAW (/ #PT0 #PTS)
  (initget 1)
  (setq #PT0 (getpoint "\nInsert point: ")
        #PTS (@SPRKT-PTS #PITCH #RLR_DIA #TEETH))
  (command "_.ucs" "_o" #PT0)
  (@WIDTH)
  (@SPRKT)
  (command "_.ucs" "_p"))

 (defun @SIZE (%A)
  (setq #PITCH (nth 1 %A)
        #RLR_DIA (nth 2 %A)
        #THKNS (nth 3 %A)
        #2XTHKNS (nth 4 %A)
        #4XTHKNS (nth 5 %A)
        #CHAM_DP (nth 6 %A)
        #CHAM_WD (nth 7 %A)
        #TRANSV (nth 8 %A)
        #TRANSV_H (nth 9 %A))
 (@GRAY_ROWS)
 (@GRAY_HEAVY))

 (defun @SPRKT-PTS (%PITCH %RLR_DIA %TEETH / #ANG-A #ANG-B #ANG-C
  #ANGINC #AX #CX #D #DP #INT #LAST #LIST #N #P #PD #PROFILE #PT-A #PT-B
  #PT-BPEAK #PT-C #PT-INT #PT-PEAK #PT-X #PT-XY #PT-XX #PT-Z #PT0 #PTLIST
  #RAD #RAD-P #TMP #X)
  (setq #ANG 0
        #ANGINC (/ (* 2.0 pi) %TEETH)
        #PT0 '(0 0)
        #N %TEETH
        #PD (/ %PITCH (sin (/ pi #N)))
        #RAD-P (* 0.5 #PD)
        #PT-A (list #RAD-P 0)
        #D %RLR_DIA
        #DP (+ (* 1.005 %RLR_DIA) 0.003)
        #ANG-A (+ (* pi (/ 35.0 180.0)) (/ pi 3.0 #N))
        #ANG-B (- (* pi 0.1) (* pi (/ 56.0 180.0 #N)))
        #ANG-C (/ pi #N)
        #AX (* 0.5 #DP)
        #PT-X (polar #PT-A (- (* 1.5 pi) #ANG-A) #AX)
        #PT-XX (polar #PT-A pi #AX)
        #PT-C (polar #PT-A (- (* 0.5 pi) #ANG-A) (* 0.8 #D))
        #CX (distance #PT-C #PT-X)
        #PT-Y (polar #PT-C (- (* 1.5 pi) #ANG-A (- #ANG-B)) #CX)
        #PT-XY (polar #PT-C (- (* 1.5 pi) #ANG-A (* -0.5 #ANG-B)) #CX)
        #PT-Z (polar #PT-Y (- #ANG-B #ANG-A) 1)
        #PT-B (polar #PT-A (- (* 1.5 pi) #ANG-C) (* 1.24 #D))
        #PT-Z (inters #PT-Y #PT-Z #PT-B
         (polar #PT-B (- (* 1.5 pi) #ANG-A (- #ANG-B)) 1) nil)
        #RAD-F (distance #PT-B #PT-Z)
        #PT-INT (inters #PT0 (polar #PT0 (- #ANG-C) 1)
        #PT-B (polar #PT-B (- (* 0.5 pi) #ANG-C) 1) nil)
        #INT (distance #PT-B #PT-INT)
        #INT (sqrt (- (expt #RAD-F 2.0) (expt #INT 2.0)))
        #PT-PEAK (polar #PT-INT (- #ANG-C) #INT)
        #RAD (distance #PT0 #PT-PEAK)
        #PT-BPEAK (polar #PT-B
         (* 0.5 (+ (angle #PT-B #PT-PEAK) (angle #PT-B #PT-Z))) #RAD-F)
        #PTLIST (list #PT-PEAK #PT-BPEAK (list (car #PT-Z) (cadr #PT-Z) 1)
         #PT-Y #PT-XY (list (car #PT-X) (cadr #PT-X) 1) #PT-XX
         (list (car #PT-X) (- (cadr #PT-X)) 1)
         (list (car #PT-XY) (- (cadr #PT-XY)))
         (list (car #PT-Y) (- (cadr #PT-Y)) 1)
         (list (car #PT-Z) (- (cadr #PT-Z)))
         (list (car #PT-BPEAK) (- (cadr #PT-BPEAK)))
         (list (car #PT-PEAK) (- (cadr #PT-PEAK)) 1)))
   (repeat %TEETH
    (foreach #X (cdr #PTLIST)
     (setq #P (list (car #X) (cadr #X))
           #TMP (polar #PT0 (+ (angle #PT0 #P) #ANG) (distance #PT0 #P)))
     (if (caddr #X) (setq #TMP (list (car #TMP) (cadr #TMP) 1)))
     (setq #LIST (cons #TMP #LIST)))
    (setq #ANG (+ #ANG #ANGINC)))
   (setq #LIST (append #LIST (list (car #LIST))))
   (reverse #LIST))

 (defun @TEETH (%A / #TMP)
  (if (> (setq #TMP (abs (atoi %A))) 8) (setq #TEETH #TMP))
  (set_tile "teeth" (itoa #TEETH)))

 (defun @TRANSLATE (%ENAME %X %Y %Z / #BLIPMODE)
  (@GETVAR '("blipmode"))
  (setvar "blipmode" 0)
  (command "_.move" %ENAME "" "_none" (list %X %Y %Z) "")
  (@SETVAR '("blipmode"))
  (eval T))

 (defun @WIDTH ()
  (cond
   ((> #ROWS 3) (setq #WIDTH #4XTHKNS))
   ((> #ROWS 1) (setq #WIDTH #2XTHKNS))
   (T (setq #WIDTH #THKNS)))
  (cond
   ((and (= #HD 0) (> #ROWS 1))
    (setq #WIDTH (+ (* (1- #ROWS) #TRANSV) #WIDTH)))
   ((and (= #HD 1) (> #ROWS 1))
    (setq #WIDTH (+ (* (1- #ROWS) #TRANSV_H) #WIDTH)))))

 (setvar "cmdecho" 0)
 (setq #DCL-FILE (vl-filename-mktemp "3Dsprkt.dcl")
       #FILE (open #DCL-FILE "w"))
 (foreach #X #DCL-LIST (write-line #X #FILE))
 (close #FILE)
 (if (< (setq #DCL-ID (load_dialog #DCL-FILE)) 0)
  (progn
   (alert "\nCan't load DCL file.")
   (quit))
  (vl-file-delete #DCL-FILE))
 (if (not (new_dialog "sprocket3d" #DCL-ID)) (quit))
 (start_list "size")
 (foreach #X #SIZELIST
  (add_list (car #X)))
 (end_list)
 (setq #SIZE (assoc "35" #SIZELIST) #POSN (vl-position #SIZE #SIZELIST))
 (@SIZE #SIZE)
 (set_tile "size" (itoa #POSN))
 (@TEETH "12")
 (setq #HD 0 #ROWS 1)
 (set_tile "heavy_duty" (itoa #HD))
 (set_tile "rows" (itoa #ROWS))
 (action_tile "accept" "(done_dialog 1)")
 (action_tile "cadalog" "(done_dialog 2)")
 (action_tile "help" "(alert #HELP)")
 (action_tile "heavy_duty" "(setq #HD (atoi $value))")
 (action_tile "rows_minus" "(@ROWS (itoa (1- #ROWS)))")
 (action_tile "rows_plus" "(@ROWS (itoa (1+ #ROWS)))")
 (action_tile "rows" "(@ROWS $value)")
 (action_tile "size"
  "(setq #SIZE (nth (atoi $value) #SIZELIST)) (@SIZE #SIZE)")
 (action_tile "teeth" "(@TEETH $value)")
 (action_tile "teeth_minus" "(@TEETH (itoa (1- #TEETH)))")
 (action_tile "teeth_plus" "(@TEETH (itoa (1+ #TEETH)))")
 (setq #GO (start_dialog))
 (cond
  ((= #GO 1) (@SPROCKET-DRAW))
  ((= #GO 2) (command "_.browser" "www.cadalog.com")))
 (princ))


;;; Uncomment for the language needed.
;(princ "\n\n3DSPRKT ‚ð“ü—Í‚µ‚ÄŠJŽn")  ; For Japanese.
(princ "\n\nType 3DSPRKT to start.") ; For English.

(princ)



No compiling , no nothing just pure LISP.
Location @ Córdoba Argentina Using ACAD 2019  at Window 10

SMadsen

  • Guest
dcl in lisp
« Reply #13 on: July 02, 2004, 03:37:42 AM »
Well, it may be just pure lisp but it's a lisp that creates a dialog file. You'll still have a dcl file floating around afterwards (in most cases it seems).

DEVITG

  • Bull Frog
  • Posts: 481
dcl in lisp
« Reply #14 on: July 02, 2004, 07:50:37 AM »
Yes , it could not be dcl whit uot a dcl .
But it avoid to send two separated files and to load both.
It is what I was looking for.
Thanks .
 :lol:
Location @ Córdoba Argentina Using ACAD 2019  at Window 10