Author Topic: Lisp how to question  (Read 6400 times)

0 Members and 1 Guest are viewing this topic.

One Shot

  • Guest
Lisp how to question
« Reply #15 on: March 28, 2005, 03:59:40 PM »
I can not seem to get this to work.  Can anyone please help me out?

Thank you,

Brad
Code: [Select]
(defun c:column ( in_base in_size / Base Top Size BaseHeight TopHeight BasePoint TopPoint ColWdtB ColWdtT )
  ;;; in_base argument #28 #32 or 0  
  ;;; in_size argument 10 12 14 16 20
  ;;; Use like this Command : (c:column "#32" "14" ) or Command : (c:column "0" "16" )

  ;;;  ----------- # ----------                ---------- 0 ----------
  ;;;      SQUARE COLUMN TOP                       ROUND COULUMN TOP
  ;;;     13   15    17    19                   10.75 12.75 14.75 16.75  <- Top width
  ;;;     |    |     |     |                      |     |     |     |
  ;;;     |    |     |     |                      8    10    12    14
  ;;;   6.25 8.25 10.25 12.25                     |     |     |     |    <- Column width
  ;;;     |    |     |     |                      9    11    13    15
  ;;;     |    |     |     |                      |     |     |     |
  ;;;     10   12    14    16                    12    14    16    18    <- Base width
  ;;;  28INCH SQUARE COLUMN BASE                   ROUND COLUMN BASE
  ;;;  32INCH SQUARE COLUMN BASE               ---------- 0 ----------
  ;;;  ----------- # ----------
                                                        ;; You have to make 12 base block and 8 top block
  (cond                                                 ;;  Base Block name     Top Block name
    ((and (= in_base "#28" ) (= in_size "10" )) (setq Base "28SQUAREBASE10" Top "SQUARETOP13" ColWdtB  6.25 ColWdtT  6.25 ) )
    ((and (= in_base "#28" ) (= in_size "12" )) (setq Base "28SQUAREBASE12" Top "SQUARETOP15" ColWdtB  8.25 ColWdtT  8.25 ) )
    ((and (= in_base "#28" ) (= in_size "14" )) (setq Base "28SQUAREBASE14" Top "SQUARETOP17" ColWdtB 10.25 ColWdtT 10.25 ) )
    ((and (= in_base "#28" ) (= in_size "16" )) (setq Base "28SQUAREBASE16" Top "SQUARETOP19" ColWdtB 12.25 ColWdtT 12.25 ) )
    ((and (= in_base "#32" ) (= in_size "10" )) (setq Base "32SQUAREBASE10" Top "SQUARETOP13" ColWdtB  6.25 ColWdtT  6.25 ) )
    ((and (= in_base "#32" ) (= in_size "12" )) (setq Base "32SQUAREBASE12" Top "SQUARETOP15" ColWdtB  8.25 ColWdtT  8.25 ) )
    ((and (= in_base "#32" ) (= in_size "14" )) (setq Base "32SQUAREBASE14" Top "SQUARETOP17" ColWdtB 10.25 ColWdtT 10.25 ) )
    ((and (= in_base "#32" ) (= in_size "16" )) (setq Base "32SQUAREBASE16" Top "SQUARETOP19" ColWdtB 12.25 ColWdtT 12.25 ) )
    ((and (= in_base "0"   ) (= in_size "12" )) (setq Base "ROUNDBASE12"    Top "ROUNDTOP10"  ColWdtB     9 ColWdtT     8 ) )
    ((and (= in_base "0"   ) (= in_size "14" )) (setq Base "ROUNDBASE14"    Top "ROUNDTOP12"  ColWdtB    11 ColWdtT    10 ) )
    ((and (= in_base "0"   ) (= in_size "16" )) (setq Base "ROUNDBASE16"    Top "ROUNDTOP14"  ColWdtB    13 ColWdtT    12 ) )
    ((and (= in_base "0"   ) (= in_size "18" )) (setq Base "ROUNDBASE18"    Top "ROUNDTOP16"  ColWdtB    15 ColWdtT    14 ) )
    (t (princ "Wrong combination" ) )
  )

  (cond
    ((= in_base "#28" ) (setq BaseHeight 2'-4  ) ) ; <-- Sorry I do not know how to enter Your stupid numbers, You must do it
    ((= in_base "#32" ) (setq BaseHeight 2'-8  ) ) ; <-- Sorry I do not know how to enter Your stupid numbers, You must do it
    ((= in_base "0"   ) (setq BaseHeight 4 1/2 ) ) ; <-- Sorry I do not know how to enter Your stupid numbers, You must do it
    (t nil)
  )

  (cond
    ((= in_base "#28" ) (setq TopHeight 1'-0 ) ) ; <-- Sorry I do not know how to enter Your stupid numbers, You must do it
    ((= in_base "#32" ) (setq TopHeight 1'-0 ) ) ; <-- Sorry I do not know how to enter Your stupid numbers, You must do it
    ((= in_base "0"   ) (setq TopHeight 5    ) )
    (t nil)
  )

  (setq BasePoint (getpoint "Digitize BasePoint : " ) )
  (setq TopPoint  (getpoint "Digitize TopPoint : "  ) )
  (setq TopPoint  (list (car BasePoint ) (cadr TopPoint ) (caddr BasePoint )) )
  (command "._insert" Base BasePoint "1" "1" "0" )
  (command "._insert" Top  TopPoint  "1" "1" "0" )
  ;;; Beware of osmode snap
  (command "._line"
    (list (- (car BasePoint ) (/ ColWdtB 2.0 )) (+ (cadr BasePoint ) BaseHeight ) (caddr BasePoint ) )
    (list (- (car TopPoint  ) (/ ColWdtT 2.0 )) (- (cadr TopPoint  ) TopHeight  ) (caddr TopPoint  ) )
    ""
  )
  (command "._line"
    (list (+ (car BasePoint ) (/ ColWdtB 2.0 )) (+ (cadr BasePoint ) BaseHeight ) (caddr BasePoint ) )
    (list (+ (car TopPoint  ) (/ ColWdtT 2.0 )) (- (cadr TopPoint  ) TopHeight  ) (caddr TopPoint  ) )
    ""
  )  
  (princ)
)

Birdy

  • Guest
Lisp how to question
« Reply #16 on: March 28, 2005, 04:34:21 PM »
All this talk about psuedo code has me
psuedo excited.
   :oops:
For me, that's what I think I need.  Kinda like a roadmap of where I wanna go.

Sure would appreciate it if you all could post your techniques on this subject.
Maybe start a new thread in the "lisp" or "teach me" forum.

It seems to me that a well developed arsenal of subroutines is a handy thing to have, then it's basically a matter of tweaking stuff and blending it all together (?)

Thanks again to all of you.  Great site.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Lisp how to question
« Reply #17 on: March 30, 2005, 04:09:09 PM »
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.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Lisp how to question
« Reply #18 on: March 30, 2005, 07:58:09 PM »
Kennet did nice job with the routine.
Here is a modified version that you call from the command line.
Hope you don't mind Kennet, I added the getkword so the user doesn't
have to know the column numbers, just pick from list.
Code: [Select]

Command: column

***  Enter base (0/28/32) 32

***  Enter size (10/12/14/16) 14
***  Digitize BasePoint :
***  Digitize TopPoint :


It also sets Units and other system variables needed.
It does not work in UCS other than World.

Column.lsp
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.

One Shot

  • Guest
Lisp how to question
« Reply #19 on: March 30, 2005, 08:07:04 PM »
Quote from: CAB
Kennet did nice job with the routine.
Here is a modified version that you call from the command line.
Hope you don't mind Kennet, I added the getkword so the user doesn't
have to know the column numbers, just pick from list.
Code: [Select]

Command: column

***  Enter base (0/28/32) 32

***  Enter size (10/12/14/16) 14
***  Digitize BasePoint :
***  Digitize TopPoint :


It also sets Units and other system variables needed.
It does not work in UCS other than World.

Column.lsp


Cab,

Thank you for your help.  The reason I posted the same question on the 2 Forums is to see how other Lispers would write this lisp.  This would help me to understand different ways to write lisp.

Brad

Birdy

  • Guest
Lisp how to question
« Reply #20 on: March 31, 2005, 08:34:50 AM »
Quote
There is a lot of info on pseudo code & lisp in general.
Start your search here:

http://www.theswamp.org/phpBB2/viewtopic.php?t=4509&highlight=pseudo

http://www.theswamp.org/phpBB2/search.php?mode=results
   

Thanks CAB.