Message 1 of 6

Not applicable
06-23-2017
07:23 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
So I have this routine that will make an elbow for duct based on user specified initial and final width and throat length, but in my code the elbow always turns right, is there a way i can make it go either way based on a user specified point?
; Garrett Ford 6/23/17 ; The purpose of this program is to allow the user to enter a few ; dimensions and then insert and elbow with a turning vane (defun C:bow(/ oldsnap oldlayer oldblip flag iw fw tt ip ang p1 p2 p3 p4 p5 p6) ;*********************************************************************** ; Save System Variables (setq oldsnap (getvar "osmode")) (setq oldlayer (getvar "clayer")) (setq oldblip (getvar "blipmode")) ;*********************************************************************** ;Change Settings & User Input (setvar "osmode" 35) (setvar "blipmode" 0) (setq flag (tblsearch "Layer" "LP-DUCT")) ; checks for LP-DUCT (if flag (setvar "clayer" "LP-DUCT") ; changes layer to LP-DUCT (alert ("No LP-DUCT Layer!")) ; if layer doesn't exist fuction terminates ) (setq iw (getdist "\nWhat is the Initial Width? : ")) (setq fw (getdist "\nWhat is the Final Width? : ")) (setq tt (getdist "\nWhat is the Throat Length: ")) (setq ang (getangle "\nWhat is the Angle of Rotation"))
(setq ip (getpoint "\nSelect an Insertion Point: ")) (setvar "osmode" 0) ;*********************************************************************** ; Polar Calculations (setq p1 (polar ip (+ ang (dtr 0)) (/ iw 2))) (setq p2 (polar p1 (+ ang (dtr 90)) tt)) ; Inside Corner (setq p3 (polar p2 (+ ang (dtr 0)) tt)) (setq p4 (polar p3 (+ ang (dtr 90)) fw)) (setq p5 (polar p4 (+ ang (dtr 180)) (+ tt iw))) ; Outside Corner (setq p6 (polar p5 (+ ang (dtr 270)) (+ tt fw))) ;*********************************************************************** ; Line & Insert Commands (command "Line" ip p1 p2 p3 p4 p5 p6 ip "") (setvar "osmode" oldsnap) (setvar "clayer" oldlayer) (setvar "blipmode" oldblip) ) ; End Defun ;************************************************************************ ;Converts the Degrees into Radians (defun dtr (ang) ;define degrees to radians function (* pi (/ ang 180.0)) ;divide the angle by 180 then ;multiply the result by the constant PI ) ;end of function ;************************************************************************
Solved! Go to Solution.