-
1
- #1
dom
Mechanical
- Jul 23, 2000
- 7
For my CAD college course I am developing a series of small lisps which automatically produce 3D solids of bar stock(angle, box section, c-section etc). The problem is I would like to have data extracted automatically from them as they are created namely type(ie angle) and length so a BOM can be produced. Below is the lisp for angle production (I'm sorry it'a a bit crude I only started lisps 2 weeks ago) if someone could add the lines of code I need and explain how they work I would be most grateful.
(defun c:angle()
(setq p1 (getpoint "ENTER ANGLE INSERTION POINT: ")(terpri)
(setq w(getdist "ENTER ANGLE WIDTH: ")
(setq h(getdist"ENTER ANGLE HEIGHT: ")
(setq x(getdist"ENTER MATERIAL THICKNESS: ")
(setq l(getdist"ENTER REQUIRED LENGTH: ")
(setq p2(list(+(car p1)w)(cadr p1)))
(setq p3(list(car p1)(+(cadr p1)h)))
(setq p4(list(+(car p3)x)(cadr p3)))
(setq p5(list(car p2)(+(cadr p2)x)))
(command "pline" p2 p1 p3 ""
(command "offset" x p3 p5 ""
(command "pline" p3 p4 "" "pline" p2 p5 ""
(command "pedit" p1 "j" "all" "" ""
(command "extrude" p1 "" l "" ))
(defun c:angle()
(setq p1 (getpoint "ENTER ANGLE INSERTION POINT: ")(terpri)
(setq w(getdist "ENTER ANGLE WIDTH: ")
(setq h(getdist"ENTER ANGLE HEIGHT: ")
(setq x(getdist"ENTER MATERIAL THICKNESS: ")
(setq l(getdist"ENTER REQUIRED LENGTH: ")
(setq p2(list(+(car p1)w)(cadr p1)))
(setq p3(list(car p1)(+(cadr p1)h)))
(setq p4(list(+(car p3)x)(cadr p3)))
(setq p5(list(car p2)(+(cadr p2)x)))
(command "pline" p2 p1 p3 ""
(command "offset" x p3 p5 ""
(command "pline" p3 p4 "" "pline" p2 p5 ""
(command "pedit" p1 "j" "all" "" ""
(command "extrude" p1 "" l "" ))