2D plan Beam Creator LISP
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Guys.
i need some help on my beam creator lisp. It should draw a line of the beam given the width that is entered in the dcl. P1 and P2 should be user input. I have made the computation on lisp i dont think it is correct, there are 3 radio button to determine whether the basepoint is placed on the centerline or if it is on top face or bottom face on the gridline. and the offset is added in the computation if the beam is referred on a certain offset on the basepoint.
Beam.dcl
beam : dialog {
label = "Beam Creator";
spacer;
: boxed_radio_row {
label = "Beam Properties";
: edit_box {
label = "Width, b:";
key = "width";
edit_width = 30;
mnemonic = "T";
allow_accept = true;
}
: edit_box {
label = "depth, d:";
key = "depth" ;
edit_width = 30 ;
mnemonic = "T" ;
allow_accept = true ;
}
} // end boxed_column
spacer;
: boxed_column {
label = "Beam Location";
: edit_box {
label = "offset:";
key = "offset";
edit_width = 30;
mnemonic = "T";
allow_accept = true;
}
: radio_button {
label = "&Top Face";
key = "rb1";
}
: radio_button {
label = "&Centerline";
key = "rb2";
}
: radio_button {
label = "&Bottom Face";
key = "rb3";
}
} // end boxed_radio_row
spacer;
ok_cancel;
} // end dialog
Beam.lsp
(defun c:beam()
(defun title_dflt ()
(if (= typ nil) (setq typ "c"))
(if (= width nil) (setq width "beam width in inches"))
(if width (set_tile "width" width))
(if (= depth nil) (setq depth "beam depth in inches"))
(if depth (set_tile "depth" depth))
(if (= offset nil) (setq offset "+/- distance in inches"))
(if offset (set_tile "offset" offset))
(if (= typ "t") (set_tile "rb1" "1"))
(if (= typ "c") (set_tile "rb2" "1"))
(if (= typ "b") (set_tile "rb3" "1"))
); title_dflt
(title_set)
(if
(setq p1 (getpoint "\nSpecify insertion point: "))
(setq p2 (getpoint "\nSpecify end point: "))
(setq xl1t (+ p1(/ b 2))
(setq yl1t (+ p2(/ b 2))
(setq xl2t (+ p1(/ b 2))
(setq yl2t (+ p2(/ b 2))
(setq xl1c p1)
(setq yl1c p2)
(setq xl2c (+ p1 b)
(setq yl2c (+ p2 b)
(setq xl1b p1)
(setq yl1b p2)
(setq xl2b (- p1 b)
(setq yl2b (- p2 b)
(progn
(cond
((= typ "t")
(command "line" xl1t yl1t xl2t yl2t "")
)
((= typ "c")
(command "line" xl1c yl1c xl2c yl2c "")
)
((= typ "b")
(command "line" xl1b yl1b xl2b yl2b "")
)
); cond
); progn
); if
(princ)
); beam
(defun title_set ()
(setq dcl_id (load_dialog "beam.dcl"))
(if (not (new_dialog "beam" dcl_id))
(exit)
)
); title_set
(princ)