×
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

Lisp program for cones

Lisp program for cones

Lisp program for cones

(OP)
This program is for unwraping cones into 2d.  My problem is when ever the cone is greater then 60 Degrees it does not work.  Can anyone see why it would not work?

Thanks

(defun c:dcone (/ sd d H sr R X thick deg xp1 xp2 yp1 yp2)

(setq d (getreal "\nLarge Inside Diameter of Cone. "))
(setq sd (getreal "\nSmall Inside Diameter of Cone. "))
(setq H (getreal "\Height of Cone. "))
(setq thick (getreal "\nThickness of Cone. "))  

(setq d (+ d (/ (* (* 2 (cos (atan (/ H (/(- d sd) 2 ))))) thick) 2)))
(setq sd (+ sd (/ (* (* 2 (cos (atan (/ H (/(- d sd) 2 ))))) thick) 2)))  
(setq x (expt (+ (expt (/ (- d sd) 2) 2) (expt H 2)) 0.5))
(setq sr (/ (* sd x) (- d sd)))
(setq R (+ sr X) )
(setq deg (*(/ d R) 180))

;area = (R ^ 2 - sr ^ 2) * deg / 360 * 3.14159
;wt = area / 144 * thick * 40.8

(If (<= deg 180) (progn
        (setq yp1 ( * R  (Sin (*(/ 3.14159 180)  (/  (- 180  deg)  2)))))
    (setq xp1 ( * R  (cos (*(/ 3.14159 180)  (/  (- 180  deg)  2)))))
        (setq yp2 ( * sr  (Sin (*(/ 3.14159 180)  (/  (- 180  deg)  2)))))
        (setq xp2 ( * sr  (cos (*(/ 3.14159 180)  (/  (- 180  deg)  2)))))
       (command "Line" (strcat (rtos xp2) "," (rtos yp2))   (strcat "@" (rtos (- R  sr)) "<"  (rtos (/(- 180  deg)  2))) "")
    (command "_zoom" "e")
    (command "_zoom" ".5xp")
    (command "copy" "la" "" "0,0" "0,0")
    (command "_zoom" "e")
    (command "_zoom" ".5xp")
    (command "rotate" "la" "" "0,0" deg)
    (command "arc" (strcat(rtos xp1) "," (rtos yp1) ) (strcat "0," (rtos R))  (strcat "-" (rtos xp1) "," (rtos yp1) ))
    (command "arc" (strcat(rtos xp2) "," (rtos yp2) ) (strcat "0," (rtos sr))  (strcat "-" (rtos xp2) "," (rtos yp2) ))
    (command "_zoom" "e")
    )
      (progn
        (If (> deg  270)(progn
                (setq yp1  (* R  (Sin (*(Atan 1) ( *(/ (- deg 270)180)4)))))
                (setq xp1  (* R  (COS (*(Atan 1) ( *(/ (- deg 270)180)4)))))
        (setq yp2  (* sr  (sin (*(Atan 1) ( *(/ (- deg 270)180)4)))))
                (setq xp2  (* sr  (COS (*(Atan 1) ( *(/ (- deg 270)180)4)))))
               )
          (progn
                (setq yp1  (* (- R)  (Sin (*(Atan 1) ( *(/ (- 270 deg)180)4)))))
                (setq xp1  (* R  (cos (*(Atan 1) ( *(/ (- 270 deg)180)4)))))
        (setq yp2  (* (- sr)  (Sin (*(Atan 1) ( *(/ (- 270 deg)180)4)))))
                (setq xp2  (* sr  (cos (*(Atan 1) ( *(/ (- 270 deg)180)4)))))
              )
    )
    (command "line" (strcat "0," (rtos sr)) (strcat "@" (rtos (- R sr)) "<90") "")
        (command "line" (strcat (rtos xp1) "," (rtos yp1))(strcat(rtos xp2) "," (rtos yp2)) "")
    (command "_zoom" "e")
    (command "_zoom" ".5xp")
    (command "arc" (strcat "0," (rtos R)) (strcat "-" (rtos R) ",0")(strcat(rtos xp1) "," (rtos yp1)))
    (command "arc" (strcat "0," (rtos sr)) (strcat"-" (rtos sr) ",0")(strcat(rtos xp2) "," (rtos yp2)))
    (command "_zoom" "e")
    )
)
)

RE: Lisp program for cones

I wonder if the zoom command is capturing
everything. try increasing

 (command "_zoom" ".5xp")

to  (command "_zoom" ".75xp")

or maybe eliminate it and see what happens.


RE: Lisp program for cones

(OP)
Ok I tried that.  I don't belive this is the problem.  I can do very large cones that are less then 60 Degrees.    When I try to do a 65 Degree cones, even small ones, it gives an error after the first line.

Thanks for your suggestions.

RE: Lisp program for cones

For what it's worth, the code seems to run fine on my system with a variety of cone dimensions. I can't tell if the layouts are actually correct, since I don't know exactly what the program is doing. But it draws the layouts every time without system errors. I use Intellicad 4 standard. It seems the problem you're having is Autocad or local system related. Hope this helps.

RE: Lisp program for cones

(OP)
Ok thanks for the heads up.

Could you try these dimensions for a cone?  I want to make sure it is not an anomaly with these particular dimensions.

169" Large ø
18-5/8" Small ø
161-1/4" Height
.1094" Thickness

Thanks in advance.

RE: Lisp program for cones

Darken99,
   Those dimensions work on my system.

RE: Lisp program for cones

(OP)
Ok thanks,

Will have to look at other things then.

Thanks again

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