Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Boolean functions in Lisp? 2

Status
Not open for further replies.

mikehetherton

Structural
Jan 18, 2003
14
G'day All,

Please find below a basic cube lisp routine. My question is how do I add a hole through the centre of the cube through each 6 sides. The hole is to be 1/10th the cube size.

Thanks for any help.

Cheers
Mike


(defun C:CUBE (/ point1 cubesize1)
(setq cubesize1 (RTOS (getreal "\nWhat size is the cube: ")))
(setq point1 (getpoint "\nPick insertion point: "))
(command "rectangle"
point1
(strcat "@" cubesize1 "," cubesize1)
"extrude"
"last"
""
cubesize1
""
)
(princ)
)
 
Replies continue below

Recommended for you

Dear mikehetherton,
The following program does all you need.

(defun c:CH(/ bp bl bc osflag)
(setq bp (getpoint "\n Box position: "))
(command "ucs" "m" bp)
(setq bl (getdist '(0 0 0) "\n Length: "))
(if (<= (getvar &quot;osmode&quot;) 16383)
(progn
(setvar &quot;osmode&quot;
(+ (getvar &quot;osmode&quot;) 16384)
)
(setq osflag t)
)
)
(command &quot;rectangle&quot; '(0 0) &quot;d&quot; bl bl &quot;@&quot;)
(command &quot;extrude&quot; &quot;l&quot; &quot;&quot; bl &quot;&quot;)
(setq bc (list (/ bl 2)
(/ bl 2)
(caddr bp)
))
(command &quot;circle&quot; bc (/ bl 10))
(command &quot;extrude&quot; &quot;l&quot; &quot;&quot; bl &quot;&quot;)
(command &quot;subtract&quot; '(0 0) &quot;&quot; &quot;l&quot; &quot;&quot;)
(command &quot;ucs&quot; &quot;n&quot; &quot;x&quot; &quot;&quot;)
(command &quot;circle&quot; bc (/ bl 10))
(command &quot;extrude&quot; &quot;l&quot; &quot;&quot; (* bl -1) &quot;&quot;)
(command &quot;subtract&quot; '(0 0) &quot;&quot; &quot;l&quot; &quot;&quot;)
(command &quot;ucs&quot; &quot;n&quot; &quot;y&quot; &quot;-90&quot;)
(setq bc (list (* (car bc) -1)
(cadr bc)
(caddr bc)
))
(command &quot;circle&quot; bc (/ bl 10))
(command &quot;extrude&quot; &quot;l&quot; &quot;&quot; (* bl -1) &quot;&quot;)
(command &quot;subtract&quot; '(0 0) &quot;&quot; &quot;l&quot; &quot;&quot;)
(command &quot;ucs&quot; &quot;p&quot; &quot;ucs&quot; &quot;p&quot; &quot;ucs&quot; &quot;p&quot;)
(if osflag
(setvar &quot;osmode&quot;
(- (getvar &quot;osmode&quot;) 16384)
)
)
(princ)
)

Good Luck,
Farzad
 
Thanks FH,

I shall study the code to see how I get over this next hill. Thanks again.

Cheers
Mike
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor