Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write an AutoLISP program that will generate the bolt circle (centerline linetyp

ID: 3627164 • Letter: W

Question

Write an AutoLISP program that will generate the bolt circle (centerline linetype), center mark or center line, and the holes of a bolt circle. The program should prompt the user to enter the center point of the bolt circle (CR), the bolt circle diameter (D), the bolt circle hole diameter (DH), the number of holes (N), and the start angle (A) of the bolt holes.

Download the graphic for Assignment 12 now and use to complete the work.

Enhancements for a better grade:

1. Use "easy to understand prompts".
2. Input/Draw Bolt Heads (Polygons) instead of bolt holes. The number of sides would have to be an Input.
3. Draw centerlines at each bolt hole position.
4. Use different layers and colors for the center lines and the bolt holes.


Note: Any enhancements must be in addition to the basic requirement of the program to plot a single bolt circle.


For this assignment turn in:

1. Flow chart (if not excused after the other programming assignments)
2. Listing of the program
3. Printer/Plot of the results of running the program at least two times (different inputs for each run) plus a running of your Border and Title Block Program

Design Component

a. List and draw a sketch of at least eight types of screw fasteners. Identify the typical use of each.
b. Sixteen 3/4" diameter American Standard Hexagon bolts (and nuts) are to be used to connect a plate with a housing. If socket-wrench assembly is to used, what is the minimum spacing between bolt centers? How close can the bolts be to an adjacent housing?

Explanation / Answer

(defun c:blh ()

; Our program name will be 'blh' and it will work at command line after its loaded

(setvar "cmdecho" 0)       

; turns the command echo off

(command "osmode" "0")      

; turns osnap off

(prompt "This program will draw a bolt circle with hole heads") ; tells the user we are about to draw some bolts

(setq cr(getpoint " Enter the center of your circle: "))  ; prompts user for center point of circle and puts in variable cr

(setq d(getdist " Enter the diameter of the bolt circle Max [10]: ")) ; prompts user for diameter of circle and puts in variable d

(setq n(getint " Enter the number of bolt holes: "))  ; prompts user for number of bolts and puts in variable n

(setq a(getangle " Enter the angle between each bolt: ")) ; prompts user for angle between bolts and puts in variable a

(setq sd(getint " Enter the sides of the bolt head; "))  ; prompts user for number of bolt sides and puts in variable sd

(setq ra(getdist " Enter the radius for the unit NOT LARGER THAN 4in.: ")); prompts user for bolt head radius and puts in variable ra

; Layer and Line Set Up

; we will set up 3 layers below (center, holes, & boltcircle)
(command "layer" "new" "center, holes, boltcircle" "")
(command "layer" "set" "boltcircle" "")
(command "layer" "color" "truecolor" "28,205,4" "boltcircle" "")

(command "circle" cr (/ d 2))      ; draws a circle of diameter d at centerpoint

; Setting Center Layer and line length

(setq r1(/ d 2))       ;creates variable r1, which is half the overall diameter
(setq pt1(polar cr a r1))      ;creates variable pt1 as the polar value of the centerpoint cr
(command "chprop" "last" "" "lt" "center" "")    ;Change Properties pt1 path to center linetype



; Setting the Center Layer

(command "layer" "set" "center" "")     ;Sets the center layer to current

(command "layer" "color" "truecolor" "250,0,17" "center" "")  ;Changes the color to red

(command "line" cr "@6.5<0" "")     ;Draws a center line 6.5 units long to the right of centerpoint

(command "chprop" "last" "" "lt" "center" "")    ;Changes properties of last line to center linetype

(command "line" cr "@-6.5<0" "")     ;Draws a center line 6.5 units long to the left of centerpoint

(command "chprop" "last" "" "lt" "center" "")    ;Changes properties of last line to center linetype

(command "line" cr pt1 "")      ;Draws line from centerpoint to pt1

(command "chprop" "last" "" "lt" "center" "")    ;Changes properties of last line to center linetype


; Setting Hole Layer

(command "layer" "set" "holes" "")     ;Sets holes as current layer

(setq radi(/ ra 2))       ;Creates variable radi, which is bolt head radius / 2

(command "layer" "color" "truecolor" "244,11,104" "holes" "")  ;Changes color of hole layer to pinkish

(command "polygon" sd "@" "C" radi)     ;Draws polygon with sides of side number sd

(command "array" "L" "p" "" "p" cr n "360" "y")   ;Arrays the polygon around the overall circle

(setvar "cmdecho" 1)       ;turns command echo back on

(princ)        ;Prints an expression to command line. Since we did not specify an expression, it returns nil

(command "zoom" "extents" )      ;Zoom our window to the drawing extents.
)         ; Final parenthesis closes program. Peace out.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote