×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Boolean functions in Lisp?
2

Boolean functions in Lisp?

Boolean functions in Lisp?

(OP)
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)
)

RE: Boolean functions in Lisp?

2
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 "osmode") 16383)
    (progn
      (setvar "osmode"
          (+ (getvar "osmode") 16384)
      )
      (setq osflag t)
    )
  )
  (command "rectangle" '(0 0) "d" bl bl "@")
  (command "extrude" "l" "" bl "")
  (setq bc (list (/ bl 2)
         (/ bl 2)
         (caddr bp)
  ))
  (command "circle" bc (/ bl 10))
  (command "extrude" "l" "" bl "")
  (command "subtract" '(0 0) "" "l" "")
  (command "ucs" "n" "x" "")
  (command "circle" bc (/ bl 10))
  (command "extrude" "l" "" (* bl -1) "")
  (command "subtract" '(0 0) "" "l" "")
  (command "ucs" "n" "y" "-90")
  (setq bc (list (* (car bc) -1)
          (cadr bc)
          (caddr bc)
  ))
  (command "circle" bc (/ bl 10))
  (command "extrude" "l" "" (* bl -1) "")
  (command "subtract" '(0 0) "" "l" "")
  (command "ucs" "p" "ucs" "p" "ucs" "p")
  (if osflag
    (setvar "osmode"
        (- (getvar "osmode") 16384)
    )
  )
  (princ)
)

Good Luck,
Farzad

RE: Boolean functions in Lisp?

(OP)
Thanks FH,

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

Cheers
Mike

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources