Jump to content
chiimayred

LISP for Creating Top/Side Views

Recommended Posts

chiimayred

Hey all,

 

I'm trying to work on a code where I can project the Top and Side views from a cross-section of a W-Beam (see attached block for an example).

 

I've tried my best but this is as far as I got before spinning my wheels.

 

(Defun c:fd (/ d1 d2 d3 d4 p1)
 (SETQ D1 (GETDIST "\nWhat is Flange width: "))
 (setq d2 (getdist "\nWhat is Flange thickness: "))
 (setq d3 (getdist "\nWhat is Web thickness: "))
 (setq d4 (getdist "\nWhat is Depth: "))
 (setq p1 (getpoint "\nBasepoint for top view: "))
 (command
   "line" p1 @d1.0

 )
)

 

Please note that this lisp is only for W-Beams, I do not need a catch all lisp. If required I should be able to modify this lisp to suit future needs. Lastly, I haven't added any error catching as I'm not at that stage yet.

 

Any help is greatly appreciated.

W10x45 (W250x67).dwg

Share this post


Link to post
Share on other sites
ReMark

Seems like a lot to go through. I imagine this information is already available in another way.

Share this post


Link to post
Share on other sites
chiimayred

I thought so too, I've been trying to search it for the last hour but haven't had any luck yet... I'm going to keep on searching for solutions/ideas and post my findings/solution here when I can figure it out.

Share this post


Link to post
Share on other sites
ReMark

You did not search thoroughly enough. What you need is Al's Steel Mill. Check this out...

 

Al Steel Mill Views.JPG

 

Ta da! Do I have your attention now?

Share this post


Link to post
Share on other sites
Tharwat

I have wrote this lisp for another forum and hope this is what you're after .

 

(defun c:IProfile (/ seg p p1 p2 p3 p4 p5 p6 p7 p8 p9 p10 p11)
;;;;;        Author : Tharwat Al Shoufi    www.Autolisp.com    ;;;;;
;;;;;        14. November. 2012 , Codes to draw I profile         ;;;;;
 (if (and
       (setq
         *l* (cond
               ((getdist (strcat "\n Specify Length "
                                 (if *l*
                                   (strcat "< " (rtos *l* 2 2) " > :")
                                   " :"
                                 )
                         )
                )
               )
               (t *l*)
             )
       )
       (setq
         *w* (cond
               ((getdist (strcat "\n Specify Width "
                                 (if *w*
                                   (strcat "< " (rtos *w* 2 2) " > :")
                                   " :"
                                 )
                         )
                )
               )
               (t *w*)
             )
       )
       (setq *ft*
              (cond
                ((getdist (strcat "\n Flange Thickness "
                                  (if *ft*
                                    (strcat "< " (rtos *ft* 2 2) " > :")
                                    " :"
                                  )
                          )
                 )
                )
                (t *ft*)
              )
       )
       (setq *wt*
              (cond
                ((getdist (strcat "\n Web Thickness "
                                  (if *wt*
                                    (strcat "< " (rtos *wt* 2 2) " > :")
                                    " :"
                                  )
                          )
                 )
                )
                (t *wt*)
              )
       )
       (if (and (> *l* *ft*) (> *l* *wt*) (> *w* *ft*) (> *w* *ft*))
         t
         (princ "\n Length and Width must be the tallest")
       )
       (setq p (getpoint "\n Specify a point :"))
     )
   (progn
     (setq p1  (polar p 0.0 *w*)
           p2  (polar p1 (* pi 0.5) *ft*)
           p3  (polar p2 pi (setq seg (- (/ *w* 2.) (/ *wt* 2.))))
           p4  (polar p3 (* pi 0.5) (- *l* (+ *ft* *ft*)))
           p5  (polar p4 0.0 seg)
           p6  (polar p5 (* pi 0.5) *ft*)
           p7  (polar p6 pi *w*)
           p8  (polar p7 (* pi 1.5) *ft*)
           p9  (polar p8 0. seg)
           p10 (polar p9 (* pi 1.5) (- *l* (+ *ft* *ft*)))
           p11 (polar p10 pi seg)
     )
     (entmakex (list '(0 . "LWPOLYLINE")
                     '(100 . "AcDbEntity")
                     '(100 . "AcDbPolyline")
                     '(90 . 12)
                     '(70 . 1)
                     (cons 10 p)
                     (cons 10 p1)
                     (cons 10 p2)
                     (cons 10 p3)
                     (cons 10 p4)
                     (cons 10 p5)
                     (cons 10 p6)
                     (cons 10 p7)
                     (cons 10 p8)
                     (cons 10 p9)
                     (cons 10 p10)
                     (cons 10 p11)
               )
     )
   )
 )
 (princ)
)

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...