Author Topic: So I just came across this revelation (a revelation for me)  (Read 3743 times)

0 Members and 1 Guest are viewing this topic.

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
So I just came across this revelation (a revelation for me)
« on: February 09, 2004, 11:55:36 PM »
I've posted a few times on here.  As it were, I'm new to Lisp (1-2 weeks) and am grasping it pretty well.  I posted a lisp file I made to create elevation lines.  Simple enough.  Works perfect for me.  It asks for the plate heights of the two floors and the floor construction for the first floor, all of which are typed in.  Couldn't I make a dialog box from which to pick them from?

So I came across DCL, but didn't want to dive into that.  Then came VBA.  Simple enough.  Made my dialog box where I would select the preset buttons and it would input those into the Lisp with no problem.  Was searching for how to combine my Lisp with the VBA, and found out I can't do that.  Can someone point me in the direction I need to go now?

hendie

  • Guest
So I just came across this revelation (a revelation for me)
« Reply #1 on: February 10, 2004, 03:37:54 AM »
it is possible to call Lisp from within VBA but it's not nice, and best to be avoided at all costs. my advice would be... since you've already created the dialogue box... you've seen some of the advantages of VBA.. so why not continue with the project in VBA ?

on the up side, you get to learn another language ! and it does get easier !




remember to just ask when you get stuck

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16716
  • Superior Stupidity at its best
So I just came across this revelation (a revelation for me)
« Reply #2 on: February 10, 2004, 06:36:34 AM »
Quote from: hendie
it is possible to call Lisp from within VBA but it's not nice, and best to be avoided at all costs. ......... so why not continue with the project in VBA ?

on the up side, you get to learn another language ! and it does get easier !


Well said!

Of course once you learn the syntax of an object oriented language, it becomes relatively easy to move on to bigger and better things.

VBA is really good when you require more control over the AutoCAD object, there are still some things best done in lisp, but those are few. Welcome to the wonderful world of VBA ...
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
So I just came across this revelation (a revelation for me)
« Reply #3 on: February 10, 2004, 07:12:25 PM »
Alright...well, I finished it...in DCL, that is.  I'll try to get to VBA soon, but I'm still learning Lisp.  I'll post it if anyone wants to see.  Time to go home and read some more about it all.   :twisted:

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16716
  • Superior Stupidity at its best
So I just came across this revelation (a revelation for me)
« Reply #4 on: February 10, 2004, 09:15:22 PM »
Well, I am not sure what use everyone would have with it, BUT, ,I can assure you that you would likely get some quality feedback on your programming methods.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Dommy2Hotty

  • Swamp Rat
  • Posts: 1127
So I just came across this revelation (a revelation for me)
« Reply #5 on: February 11, 2004, 01:39:56 AM »
I didn't think anyone would have a use for it...except for critiquing...that's all...It's such a little thing, but I'm so impressed by it!  My next step is to create the layers used if they're not in the drawing already.   :twisted:

DCL file:
Code: [Select]

ELines : dialog {
label = "Elevation Line Setup" ;

: boxed_radio_row {
label = "First Floor Ceiling Height" ;

: radio_button {
 key = "opt1" ;
 label = "8 Foot" ;
 }

: radio_button {
 key = "opt2" ;
 label = "9 Foot" ;
 value = "1" ;
 }

: radio_button {
 key = "opt3" ;
 label = "10 Foot" ;
 }
}

: boxed_radio_row {
label = "Second Floor Ceiling Height" ;

: radio_button {
 key = "opt4" ;
 label = "8 Foot" ;
 value = "1" ;
 }

: radio_button {
 key = "opt5" ;
 label = "9 Foot" ;
 }

: radio_button {
 key = "opt6" ;
 label = "10 Foot" ;
 }
}

: boxed_radio_row {
label = "First Floor Construction" ;

: radio_button {
 key = "opt7" ;
 label = "2x10" ;
 value = "1" ;
}

: radio_button {
 key = "opt8" ;
 label = "2x12" ;
 }
}

: boxed_radio_row {
label = "Second Floor Construction" ;

: radio_button {
 key = "opt9" ;
 label = "2x10" ;
 value = "1" ;
 }

: radio_button {
 key = "opt10" ;
 label = "2x12" ;
 }
}

ok_cancel ;

: row {
: paragraph {
: text_part {
label = "Designed and Created" ;
}
: text_part {
label = "by Dominic Cesare" ;
}
}
}
}


LISP file:
Code: [Select]

(prompt "\nType Elines to run.....") ;informs user how to run lisp

(defun c:ELines () ;define function

  (setq echo (getvar "cmdecho")) ;gets echo value

  (setq HT1 "109") ;set default HT1 value
  (setq HT2 "97") ;set default HT2 value
  (setq FC1 "11.5") ;set default FC1 value
  (setq FC2 "10") ;set default FC2 value
 
  (setq dcl_id (load_dialog "ELines.dcl")) ;load dialog
  (if (not (new_dialog "ELines" dcl_id) ;test for dialog
  ) ;not
    (exit) ;exit if no dialog
)
    (action_tile "opt1" "(setq HT1 \"97\")") ;store HT1 to 8'-1"
    (action_tile "opt2" "(setq HT1 \"109\")") ;store HT1 to 9'-1"
    (action_tile "opt3" "(setq HT1 \"121\")") ;store HT1 to 10'-1"

    (action_tile "opt4" "(setq HT2 \"97\")") ;store HT2 to 8'-1"
    (action_tile "opt5" "(setq HT2 \"109\")") ;store HT2 to 9'-1"
    (action_tile "opt6" "(setq HT2 \"121\")") ;store HT2 to 10'-1"
 
    (action_tile "opt7" "(setq FC1 \"11.5\")") ;store FC1 to 11 1/2"
    (action_tile "opt8" "(setq FC1 \"13.5\")") ;store FC1 to 1'-0 1/2"

    (action_tile "opt9" "(setq FC2 \"10\")") ;store FC2 to 10"
    (action_tile "opt10" "(setq FC2 \"12\")") ;store FC2 to 12"

    (action_tile
      "cancel" ;if cancel button is pressed
      "(done_dialog) (setq userclick nil)" ;close dialog, set flag
      ) ;end action_tile

    (action_tile
      "accept" ;if O.K. is pressed
      "(done_dialog) (setq userclick T))" ;close dialog, set flag
)

    (start_dialog) ;start dialog

    (unload_dialog dcl_id) ;unload

  (if userclick
    (progn
 
  (setq DN '(0 -100000000)
UP '(0 100000000)
)

;;; ***************  Creating Grade & Top of Foundation   ****************

(prompt "\nDraw Grade Line.....")

  (setvar "cmdecho" 0)
 
  (command "line" pause pause "") ;creating grade line

  (setq L1 (entlast)) ;setting grade line to L1

  (command "change" L1 "" "P" "LA" "WALL" "C" "WHITE" "") ;changing grade line to layer wall, color white

  (command "offset" "8.0" L1 UP "") ;creating top of foundation line

  (setq FDN (entlast)) ;setting top of foundation line to FDN

  (command "change" FDN "" "P" "LA" "WALL" "C" "15" "") ;changing top of foundation line to layer wall, color 15


;;; ***************  Creating First Floor Lines   ************************

  (command "offset" FC1 FDN UP "") ;creating first floorline

  (setq FLR1 (entlast)) ;setting first floorline to FLR1

  (command "change" FLR1 "" "P" "LA" "FLR" "C" "BYLAYER" "") ;changing first floorline to layer FLR, color bylayer

  (command "offset" HT1 FLR1 UP "") ;creating first floor ceilingline

  (setq CLG1 (entlast)) ;setting first floor ceilingline to CLG1

  (command "change" CLG1 "" "P" "LA" "CLG" "") ;changing first floor ceilingline to layer CLG

 
;;; *************** Creating First Floor Fascia **************************

  (command "offset" "3.0" CLG1 DN "") ;creating top of first floor fascia

  (setq F1T (entlast)) ;setting top of first floor fascia to F1T

  (command "change" F1T "" "P" "LA" "WALL" "") ;changing top of first floor fascia to layer WALL

  (command "offset" "8.0" F1T DN "") ;creating bottom of first floor fascia

  (setq F1B (entlast)) ;setting bottom of first floor fascia to F1B

;;; *************** Creating Second Floor Lines **************************

  (command "offset" FC2 CLG1 UP "") ;creating second floorline

  (setq FLR2 (entlast)) ;setting second floorline to FLR2
 
  (command "change" FLR2 "" "P" "LA" "FLR" "") ;changing second floorline to layer FLR
 
  (command "offset" HT2 FLR2 UP "") ;creating second floor ceilingline
 
  (setq CLG2 (entlast)) ;setting second floor ceilingline to CLG2

  (command "change" CLG2 "" "P" "LA" "CLG" "") ;changing second floor ceilingline to layer CLG

;;; *************** Creating Second Floor Fascia **************************
 
(command "offset" "3.0" CLG2 DN "") ;creating top of second floor fascia

(setq F2T (entlast)) ;setting top of second floor fascia to F2T

(command "change" F2T "" "P" "LA" "WALL" "") ;changing top of second floor fascia to layer WALL

(command "offset" "8.0" F2T DN "") ;creating bottom of second floor fascia

(setq F2B (entlast)) ;setting top of second floor fascia to F2B

  (setvar "cmdecho" echo)
  )
    )
    (princ)
)
  (princ)

Bobby C. Jones

  • Swamp Rat
  • Posts: 510
  • Cry havoc and let loose the dogs of war.
So I just came across this revelation (a revelation for me)
« Reply #6 on: February 11, 2004, 04:54:23 PM »
Here are a couple of articles that you may find interesting.  More interesting than DCL anyway  :D

http://code.acadx.com/articles/005.htm
http://code.acadx.com/articles/002.htm
Bobby C. Jones

SMadsen

  • Guest
So I just came across this revelation (a revelation for me)
« Reply #7 on: February 12, 2004, 05:25:37 AM »
Hey Bobby, nice to see you. Hope things are well.

Those are great articles. Thanks.

Stig Madsen

Bobby C. Jones

  • Swamp Rat
  • Posts: 510
  • Cry havoc and let loose the dogs of war.
So I just came across this revelation (a revelation for me)
« Reply #8 on: February 13, 2004, 01:55:13 PM »
Hi Stig!
Long time no "see".  I'll be around a bit. I'm glad that you enjoyed the articles!
Bobby C. Jones