USING LISP TO SPECIFY A DISTANCE

G.H.

Usenet Archive
Joined
Jul 31, 2003
Messages
3
Reaction score
0
i'm looking for a way to insert a block and then insert another block 90 degrees from the insertion point of the first block and a distance specified in a dialog box.

(setq pt1 (getpoint "\nPick Insertion point:"))
(command "insert" "225" PT1 "" "" "")

(setq pt2 (get_tile "lb_notes")------------ here is where i get lost....the user specifies a distance in feet in a dialog box then i want to take that distance and insert another block 90 degrees away from the first block (if (eq ant "ant1")(command "insert" "blocks/panels" pt2 "" "" "")) (if (eq ant "ant2")(command "insert" "blocks/panels2" pt2 "" "" ""))

any help would be great,

thanks in advance

Here are the files

(defun C:lattice ;define function
(setq dcl_id (load_dialog "lattice.dcl")) ;load dialogue (if (not ;test if loaded (new_dialog "lattice" dcl_id) ;new dialogue ) ;end not (exit) ;if not loaded, exit )

(action_tile
"200"
"(setq TWR \"TH\")"
)

(action_tile
"225"
"(setq TWR \"TH2\")"
)

(action_tile
"250"
"(setq TWR \"TH3\")"
)

(action_tile
"om"
"(setq ANT \"ANT1\")"
)

(action_tile
"pn"
"(setq ANT \"ANT2\")"
)

(action_tile
"accept" ;if OK selected
"(done_dialog)" ;*close dialogue, set flag
)

(action_tile
"cancel" ;if Cancel selected
"(setq TWR nil)(done_dialog)"
)

(start_dialog)
(unload_dialog dcl_id)
(if (eq TWR "TH")
(do_200)
)
(if (eq TWR "TH2")
(do_225)
)
(if (eq TWR "TH3")
(do_250)
)
(princ)
)

(defun do_200
(setq pt1 (getpoint "\nPick Tower Insertion point:"))
(COMMAND "insert" "Blocks/TOWERS/LATTICE200" PT1 "" "" "") (if (eq ANT "ANT1") (COMMAND "insert" "Blocks/TOWERS/ANT-PANELS" PT1 "" "" "") ) (if (eq ANT "ANT2") (COMMAND "insert" "Blocks/TOWERS/ANT-PANELS2" PT1 "" "" "") )
)

(defun do_225
(setq pt1 (getpoint "\nPick Tower Insertion point:"))
(COMMAND "insert" "Blocks/TOWERS/LATTICE225" PT1 "" "" "") (if (eq ANT "ANT1") (COMMAND "insert" "Blocks/TOWERS/ANT-PANELS" PT1 "" "" "") ) (if (eq ANT "ANT2") (COMMAND "insert" "Blocks/TOWERS/ANT-PANELS2" PT1 "" "" "") )
)

(defun do_250
(setq pt1 (getpoint "\nPick Tower Insertion point:"))
(COMMAND "insert" "Blocks/TOWERS/LATTICE250" PT1 "" "" "") (if (eq ANT "ANT1") (COMMAND "insert" "Blocks/TOWERS/ANT-PANELS" PT1 "" "" "") ) (if (eq ANT "ANT2") (COMMAND "insert" "Blocks/TOWERS/ANT-PANELS2" PT1 "" "" "") )
)

lattice: dialog { //dialogue name
label = "Lattice Tower"; //label
row {
boxed_radio_column{ //radio column
label = "Select Height" ; //label
: radio_button { //*radio button
label = "200'-0"; //*label
key = "200"; //*key
} //*end radio button
: radio_button { //*radio button
label = "225'-0"; //*label
key = "225"; //*key
} //*end radio button
: radio_button { //*radio button
label = "250'-0"; //*label
key = "250"; //*key
} //*end radio button
} //*end radio column
:boxed_radio_column{ //radio column
label = "Antenna Type" ; //label
: radio_button { //*radio button
label = "Omni"; //*label
key = "om"; //*key
}
: radio_button { //*radio button
label = "Panel"; //*label
key = "pn"; //*key
} //*end radio button
} //*end radio column
} //*end row
: edit_box {
label = "Rad Center:";
key = "eb_note";
horizontal_alignment = left;
}
:spacer { width = 1;} //*spacer
ok_cancel ; //OK/Cancel Tile
spacer { width = 1;} //*end radio column
paragraph { //begin paragraph
text_part { //a bit of text
label = "GH 2003"; //text
}
}
}
 
(setq pt1 (getpoint "\nPick Insertion point:"))
(if pt1
(progn
(setq di (getdist "\nEnter Distance: "))
(if di
(progn
(setq pt2 (polar pt1 (dtr 90.00) di)))
(command "insert" "225" PT1 "" "" "")
(command "insert" .....etc.)
)
)
)
)
(defun dtr (a)
(* pi (/ a 180.0))
)
(defun rtd (a)
(/ (* a 180.0) pi)
)
 
More than likely someone will reply, why even use (dtr 90)

I just get in the habit of coding a given way so I don't make mistakes later when I error check when specifying points.
 
Thanks Rudy,
It works great, but is there a way to use the get tile function to supply the getdist value because i want to enter the distance in a dialog box not at the command line.

Thanks again
 

Latest threads

Back
Top