Author Topic: Frame design lisp tutorial  (Read 10831 times)

0 Members and 1 Guest are viewing this topic.

JCUTRONA

  • Guest
Frame design lisp tutorial
« on: February 17, 2009, 04:53:27 PM »
I would love to have a lisp that automates the process illustrated below in steps 1,2 and 3.

I, however, am just getting my feet wet with lisp; learning all about syntax and "car"s and "cdr"s and strings and variables with Jeff Sanders and the fine folks at Afralisp.

I am seeing much progress and am still as eager and motivated as ever.  (MY wife teased me this weekend because on our road trip I had taken printouts of lisp functions to memorize on the road instead of any material from my college classes.)

What would be great is if some one (or someone-s), would give me a tutorial on how to write the perfect lisp for my needs (ie point me in the right direction and help me keep moving along the way by giving clues or direction).  That way, even if it takes a while, not only will I get the lisp i need, but it will also be the best kind of learning experience for me.

SO>>>
What I need this "perfect lisp" to do is basically automate my storefront/curtainwall drawing process. Usually (as in step one), I will draw lines the proper height and distance apart according to centerlines ect given to me on the architectural prints.

>>>Then depending on what dimensions I was given I will either offset one way or the other to give the vertical or horizontal it's thickness.

>>>  Last I clean up, stretching and trimming and extending as necessary.

Ideally, the lisp would first ask me to define whether the material would be 1-3/4" or 2" or 2-1/4" or 2-1/2" thickness.  Then this routine would ask me for a "getpoint" at which time I would pick the centerpoint for the top or bottom or left or right side of the member to be drawn.  At some point I would have to select an option from vertical or horizontal...  I would also have to "pull" the line in the right direction and then give it a direct distance entry.

Essentially this is very similar to the way the line command already works.  It just draws two parallel lines at equal distances from the point you picked.

I also included and example (eg) drawing to show what the finished product is actually made up of.

Any help is greatly appreciated,,, As is this site in general and the pioneers there of!

This is what I got so far
Code: [Select]
(defun C:DRAFRM()
(EDIT) I obviously can't get the png to look right so included said dwg file as well.
« Last Edit: February 17, 2009, 05:08:43 PM by JCutrona »

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Frame design lisp tutorial
« Reply #1 on: February 17, 2009, 05:20:36 PM »
Here is how I would start.

Code: [Select]
(defun c:DrawFram ()
   
    (if
        (and
            (setq StPt (getpoint "\n Select first point ( corner of window ): "))
            (setq EndPt (getcorner StPt "\n Select next point: "))
            (setq MemSz (getdist "\n Enter member size of sill: "))
            (or
                (initget "Center Outer Inner")
                (setq DimOpt
                    (cond
                        ((getkword "\n Dimension type [ Center/Outer/Inner ]<Outer>: "))
                        (t "Outer")
                    )
                )
            )
        )
        (progn
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Frame design lisp tutorial
« Reply #2 on: February 17, 2009, 05:25:52 PM »
Your drawing file provided much more information than the picture ever could.

Are you working in metric or imperial units?
If Imperial is you base unit Inches or Feet?

Usually the most tedious part of programing is the user interface.
You will need from the user the material thickness, height & width of the store front
and the reference point to place the objects drawn.

Because the is a simple lines & rectangle the POLAR function is easy to understand and
simple to use when creating lines.

More to follow if Tim doesn't continue. :)
I have to go out for the evening.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

Spike Wilbury

  • Guest
Re: Frame design lisp tutorial
« Reply #3 on: February 17, 2009, 05:27:52 PM »
i don't use lisp anymore, but have you tried/option to use dynamic blocks?

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #4 on: February 17, 2009, 05:29:16 PM »
I see that we are setting variables for start point, end points and member sizes.  Cool...
But what does the " (if " and the " (and " start?  Is it a loop of some sort???
And how will picking points at corners play in?

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #5 on: February 17, 2009, 05:32:44 PM »
i don't use lisp anymore, but have you tried/option to use dynamic blocks?
My understanding of dynamic blocks would not be sufficient for this task simply because of how complicated these frames often get.  The ones in the examples are simple for illustration but more often than not the frames span several floors and have multiple intermediate horizontals/verticals.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Frame design lisp tutorial
« Reply #6 on: February 17, 2009, 05:34:16 PM »
;;;Curtain wall creater (2D) (c) 97
;;;Original concept by Rob Starz For use with Autocad R13 & R14
;;;Stardsign@aol.com

I have a modified version...but it is not a standalone routine.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #7 on: February 17, 2009, 05:38:06 PM »
Your drawing file provided much more information than the picture ever could.
Good I will keep this in mind.


Are you working in metric or imperial units?
If Imperial is you base unit Inches or Feet?
Always in inches.  Makes it easier on the guys in the shop to fabricate.


Usually the most tedious part of programing is the user interface.
You will need from the user the material thickness, height & width of the store front
and the reference point to place the objects drawn.

Because the is a simple lines & rectangle the POLAR function is easy to understand and
simple to use when creating lines.
Interesting.  I hope you will explain further.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Frame design lisp tutorial
« Reply #8 on: February 17, 2009, 05:43:16 PM »
I see that we are setting variables for start point, end points and member sizes.  Cool...
But what does the " (if " and the " (and " start?  Is it a loop of some sort???
And how will picking points at corners play in?

The ' if ' is there so that the routine will not run unless it meets what is in the argument section of the ' if ' call.  In this case, the ' and ' call is the argument section of the ' if ' statement.  This is saying that ' if ' you pick a start point ( StPt ) ' and ' a corner point ( EndPt ) ' and ' you enter a member size ( MemSz ) ' and ' you select a dimension option ( DimOpt ), then you can proceed with the routine.  If all options are not entered, then the program will not execute anything.  Hope that makes sense.

The ' or ' option within the ' and ' option is just a preferred way to write that section.  That is because ' initget ' always returns nil, so if used with ' or ' it will always be called, and the second option will always be called, which in this case sets the DimOpt variable.
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #9 on: February 17, 2009, 05:47:19 PM »
The ' if ' is there so that the routine will not run unless it meets what is in the argument section of the ' if ' call.  In this case, the ' and ' call is the argument section of the ' if ' statement.  This is saying that ' if ' you pick a start point ( StPt ) ' and ' a corner point ( EndPt ) ' and ' you enter a member size ( MemSz ) ' and ' you select a dimension option ( DimOpt ), then you can proceed with the routine.  If all options are not entered, then the program will not execute anything.  Hope that makes sense.

The ' or ' option within the ' and ' option is just a preferred way to write that section.  That is because ' initget ' always returns nil, so if used with ' or ' it will always be called, and the second option will always be called, which in this case sets the DimOpt variable.
Ok yes that helps.  Thanks..

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #10 on: February 18, 2009, 10:52:59 AM »
"initget"? what is this functions definition?  how is it being used get the "DimOpt"?

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Frame design lisp tutorial
« Reply #11 on: February 18, 2009, 11:00:16 AM »
It's being used in conjunction with the getkword function. See the help. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #12 on: February 18, 2009, 11:15:25 AM »
pauses for user to answer the initget question.  I see.

Just knowing the lisp functions are defined in the help is crucial.  Thanks!

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: Frame design lisp tutorial
« Reply #13 on: February 18, 2009, 11:25:00 AM »
My pleasure. Once upon a time, before Windows, before widely available IDEs and the like, I typed the entire LISP Reference into a text file to use with my then shareware editor PC-Write. It took me 3 days to do it but gave me an excellent fast track overview of the language to the point I barely needed the very help file I created. What's my point? Spend some time in said help file(s), worth every moment invested. :)
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.comhttp://cadanalyst.slack.comhttp://linkedin.com/in/cadanalyst

dustinthiesse

  • Guest
Re: Frame design lisp tutorial
« Reply #14 on: February 18, 2009, 11:28:11 AM »
pauses for user to answer the initget question.  I see.

Initget initializes a "get....." function by restricting the acceptable input in some manner.  In this case, it sets up the options for the getkword function by restricting string input to the defined words OR the capitalized letters within those words (actually it will also work with partial words as well...i.e. "cent" or "out").

No user input is actually done until the getkword function is called.

Ex. Initget can also be used to disallow zero or negative numbers when using getint.

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #15 on: February 18, 2009, 11:41:30 AM »
What's my point? Spend some time in said help file(s), worth every moment invested. :)
will do.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Frame design lisp tutorial
« Reply #16 on: February 18, 2009, 12:27:51 PM »
This is another way to gather the needed information & a very simple way, simple to me, to create the line work.
Note that this is not how I would do it today but how I learned in my first lisp routines.
It is simply Drawing with LISP, that is using the same commands you would use at the command line
to create the line work.

I'm sure someone will give you an example using entmake instead of command "._line"
Code: [Select]
(defun c:DrawFram (/ 1/2MEMSZ 180DEG 270DEG 90DEG DIMOPT LL LR MEMSZ
                   MPL MPU UL UR WHEIGHT WWIDTH)
    ;;  NOTE: uses current layer
    (if
        (and
            (setq Wheight (getdist "\n Enter window height: "))
            (setq Wwidth (getdist "\n Enter window width: "))
            (setq MemSz (getdist "\n Enter member size of sill: "))
            (or
                (initget "Outer Inner")
                (setq DimOpt
                    (cond
                        ((getkword "\n Dimension are [ Outer/Inner ]<Outer>: "))
                        (t "Outer")
                    )
                )
            )
            (setq LL (getpoint "\n Pick window location for Lower Left Corner."))
        )
        (progn
          (if (= DimOpt "Inner") ; change to outer
            (setq Wheight (+ Wheight MemSz MemSz)
                  Wwidth  (+ Wwidth MemSz MemSz)
            )
          )
          ;; Create angle variables, use 0.0
          (setq 90deg  (/ pi 2.0)
                180deg pi
                270deg (* pi 1.5)
          )
          ;;  get the four outer corner points
          (setq LR (polar LL 0.0 Wwidth ) ; Lower Right
                UL (polar LL 90deg Wheight) ; Upper Left
                UR (list (car LR)(cadr UL)) ; Upper Right
          )
          ;;  Draw the parts
          ;;  Left Frame
          (command "._LINE" "_non" LL "_non" UL "")
          (command "._LINE" "_non" (polar LL 0.0 MemSz) "_non" (polar UL 0.0 MemSz) "")
          (command "._LINE" "_non" LL "_non" (polar LL 0.0 MemSz) "")
          (command "._LINE" "_non" UL "_non" (polar UL 0.0 MemSz) "")
          ;;  Right Frame
          (command "._LINE" "_non" LR "_non" UR "")
          (command "._LINE" "_non" (polar LR 180deg MemSz) "_non" (polar UR 180deg MemSz) "")
          (command "._LINE" "_non" LR "_non" (polar LR 180deg MemSz) "")
          (command "._LINE" "_non" UR "_non" (polar UR 180deg MemSz) "")
          ;;  Middle Vertical Frame
          (setq MPL (polar LL 0.0 (/ Wwidth 2.0)) ; Mid Point Lower
                MPU (polar UL 0.0 (/ Wwidth 2.0))
                1/2MemSz (/ MemSz 2.0)
          )
          (command "._LINE" "_non" (polar MPL 0.0 1/2MemSz) "_non" (polar MPU 0.0 1/2MemSz) "")
          (command "._LINE" "_non" (polar MPL 180deg 1/2MemSz) "_non" (polar MPU 180deg 1/2MemSz) "")
          (command "._LINE" "_non" (polar MPL 180deg 1/2MemSz) "_non" (polar MPL 0.0 1/2MemSz) "")
          (command "._LINE" "_non" (polar MPU 180deg 1/2MemSz) "_non" (polar MPU 0.0 1/2MemSz) "")
          ;;  Upper Left Horz Frame
          (command "._LINE" "_non" (polar UL 0.0 MemSz) "_non" (polar MPU 180deg 1/2MemSz) "")
          (command "._LINE" "_non" (polar (polar UL 0.0 MemSz) 270deg MemSz)
                            "_non" (polar (polar MPU 180deg 1/2MemSz) 270deg MemSz) "")
          ;;  Lower Left Horz Frame
          (command "._LINE" "_non" (polar LL 0.0 MemSz) "_non" (polar MPL 180deg 1/2MemSz) "")
          (command "._LINE" "_non" (polar (polar LL 0.0 MemSz) 90deg MemSz)
                            "_non" (polar (polar MPL 180deg 1/2MemSz) 90deg MemSz) "")
          ;;  Upper Right Horz Frame
          (command "._LINE" "_non" (polar UR 180deg MemSz) "_non" (polar MPU 0.0 1/2MemSz) "")
          (command "._LINE" "_non" (polar (polar UR 180deg MemSz) 270deg MemSz)
                            "_non" (polar (polar MPU 0.0 1/2MemSz) 270deg MemSz) "")
          ;;  Lower Right Horz Frame
          (command "._LINE" "_non" (polar LR 180deg MemSz) "_non" (polar MPL 0.0 1/2MemSz) "")
          (command "._LINE" "_non" (polar (polar LR 180deg MemSz) 90deg MemSz)
                            "_non" (polar (polar MPL 0.0 1/2MemSz) 90deg MemSz) "")
    )
  )
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Frame design lisp tutorial
« Reply #17 on: February 18, 2009, 12:53:53 PM »
Here is another one...

http://204.101.252.14/library/lispdk.html

ELWIND.zip file

; FILE NAME: ELWIND.LSP
; Written by: Bob Thomas               
;             Thomas Enterprises, ltd. 
;             1030 "B" Street, Suite 201
;             San Rafael, CA 94901   
;             415/453-8712
; This file and its accompanying drawing file, ELWIND.DWG, may be freely
; copied provided that the two files remain together and this header remains
; intact, so that people know what the program does and I can get a free
; plug in. Thank you.  Use and enjoy...
;
; ELWIND is a command to create architectural elevation drawings of different
; window types, with a "grilled" option. All variables are local except those
; used to carry defaults, as follows:
;
; w     = default window width
; h     = default window height
; oset1 = default 1st offset
; oset2 = default 2nd offset
; gs    = default grill spacing
;
;
; Command:
; ELWIND - Creates elevation windows
;
; Command Prompt Sequence:
;
;    Awning/Casement/Dblhung/Fixed/Gliding
;         Awning - Hidden lines connecting lower corners with upper midpoint
;         Casement - Hidden lines connecting right corners with left midpoint
;         Dblhung - Standard double-hung window
;         Fixed - Simple non-opening window
;         Gliding - Horizontal sliding window
;
; Select options with either the option word (or the first letter of the
; option word).
;
;    Width:
;    Height:
;    1st offset:
;    2nd offset:
;    Grilled? <N>:
;        Grill spacing:
;
; Respond to prompts with the appropriate value. Refer to accompanying
; AutoCAD drawing file, EL-WN.DWG, for a diagram illustrating the meaning
; of the various options.
;
; Note: In order to save time and node space, if you select the "grilled"
; option, the window grill is drawn onscreen after the window is positioned.
;
; PROGRAM:
;


Gary
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #18 on: February 18, 2009, 01:09:39 PM »
This is another way to gather the needed information & a very simple way, simple to me, to create the line work.
Note that this is not how I would do it today but how I learned in my first lisp routines.
It is simply Drawing with LISP, that is using the same commands you would use at the command line
to create the line work.

I'm sure someone will give you an example using entmake instead of command "._line"

Wow, there is alot in there that I don't understand but it is clearer now than ever...  Drawing lines with lisp using polar entry...
I need to modify it now so that I can draw the pairs of lines seperatly though.  You see, the frames we draw often span entire high rise elevations and have multiple horizontals/verticals.
I need to alter it so that I am able to draw the parallel lines one set at a time.  and then be able to go some distance up from the bottom of a vertical member and draw to parallel lines horizontally (perpendicular).  Then closing the tops and bottoms of the vertical members making them 4 line segments that form a rectangle.
Also, the initget function arguments are limiting me.  The dimensions I have to work with are often mixed between centerlines and "outers".  Meaning one  horizontal continuous dimension may start at the "outer" of the left jamb and the give me a the dimension to the center line of each vertical and then end at the outer of the right Jamb.  I'll Illustrate in a simple dwg.
But this is exaclty what I was hoping for, to be involved in the process of writing so that I retain what went into it.  Thanks everybody.
« Last Edit: February 18, 2009, 04:00:13 PM by CAB »

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #19 on: February 18, 2009, 01:23:47 PM »
Here is another one...

http://204.101.252.14/library/lispdk.html

ELWIND.zip file

Thanks, that is a great site for handy tools i can tell.  Bookmarked for later...
However, that particular lisp file is not much help to me because of the nature and detail of the shop drawings we do.  Also, that lisp seems to be a great tool for drawing residential style casement windows but not much in the way of storefronts and curtain walls.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Frame design lisp tutorial
« Reply #20 on: February 18, 2009, 01:27:03 PM »
The code is just an example but it does draw the exact example found in your Steps.dwg labeled 3.
End caps and all.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #21 on: February 18, 2009, 02:46:42 PM »
The code is just an example but it does draw the exact example found in your Steps.dwg labeled 3.
End caps and all.


Yes thank you!  I will study and dissect in order to further my understanding.

GDF

  • Water Moccasin
  • Posts: 2081
Re: Frame design lisp tutorial
« Reply #22 on: February 18, 2009, 03:50:08 PM »
;;;Curtain wall creater (2D) (c) 97
;;;Original concept by Rob Starz For use with Autocad R13 & R14
;;;Stardsign@aol.com

I have a modified version...but it is not a standalone routine.

This routine I have modified and added a dialog box...if you want it I can send it to you off line, but it will need major modification to make it a standalone routine.
Why is there never enough time to do it right, but always enough time to do it over?
BricsCAD 2020x64 Windows 10x64

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Frame design lisp tutorial
« Reply #23 on: February 18, 2009, 04:04:18 PM »
This example is the same routine using the entmake function which has advantages over the Command "._LINE"
As you will see the entmake is not bothered with osnaps and handles layers more easily.
Code: [Select]
(defun c:DrawFram (/ 1/2MEMSZ 180DEG 270DEG 90DEG DIMOPT LL LR MEMSZ
                   MPL MPU UL UR WHEIGHT WWIDTH
                  )
  (defun MakeLine (st en lay)
    (or lay (setq lay (getvar "clayer")))
    (entmakex
      (list    (cons 0 "LINE")
               (cons 6 "BYLAYER")
               (cons 8 lay)
               (cons 10 st)
               (cons 11 en)
               (cons 39 0.0)
               (cons 62 256)
               (cons 210 (list 0.0 0.0 1.0))))
  )


  ;;  NOTE: uses current layer
  (if
    (and
      (setq Wheight (getdist "\n Enter window height: "))
      (setq Wwidth (getdist "\n Enter window width: "))
      (setq MemSz (getdist "\n Enter member size of sill: "))
      (or
        (initget "Outer Inner")
        (setq DimOpt
               (cond
                 ((getkword "\n Dimension are [ Outer/Inner ]<Outer>: "))
                 (t "Outer")
               )
        )
      )
      (setq LL (getpoint "\n Pick window location for Lower Left Corner."))
    )
     (progn
       (if (= DimOpt "Inner") ; change to outer
         (setq Wheight (+ Wheight MemSz MemSz)
               Wwidth  (+ Wwidth MemSz MemSz)
         )
       )
       ;; Create angle variables, use 0.0
       (setq 90deg  (/ pi 2.0)
             180deg pi
             270deg (* pi 1.5)
       )
       ;;  get the four outer corner points
       (setq LR (polar LL 0.0 Wwidth)     ; Lower Right
             UL (polar LL 90deg Wheight)  ; Upper Left
             UR (list (car LR) (cadr UL)) ; Upper Right
       )
       ;;  Draw the parts
       ;;  Left Frame
       (MakeLine LL UL nil)
       (MakeLine (polar LL 0.0 MemSz) (polar UL 0.0 MemSz) nil)
       (MakeLine LL (polar LL 0.0 MemSz) nil)
       (MakeLine UL (polar UL 0.0 MemSz) nil)
       ;;  Right Frame
       (MakeLine LR UR nil)
       (MakeLine (polar LR 180deg MemSz) (polar UR 180deg MemSz) nil)
       (MakeLine LR (polar LR 180deg MemSz) nil)
       (MakeLine UR (polar UR 180deg MemSz) nil)
       ;;  Middle Vertical Frame
       (setq MPL      (polar LL 0.0 (/ Wwidth 2.0)) ; Mid Point Lower
             MPU      (polar UL 0.0 (/ Wwidth 2.0))
             1/2MemSz (/ MemSz 2.0)
       )
       (MakeLine (polar MPL 0.0 1/2MemSz) (polar MPU 0.0 1/2MemSz) nil)
       (MakeLine (polar MPL 180deg 1/2MemSz) (polar MPU 180deg 1/2MemSz) nil)
       (MakeLine (polar MPL 180deg 1/2MemSz) (polar MPL 0.0 1/2MemSz) nil)
       (MakeLine (polar MPU 180deg 1/2MemSz) (polar MPU 0.0 1/2MemSz) nil)
       ;;  Upper Left Horz Frame
       (MakeLine (polar UL 0.0 MemSz) (polar MPU 180deg 1/2MemSz) nil)
       (MakeLine (polar (polar UL 0.0 MemSz) 270deg MemSz)
                 (polar (polar MPU 180deg 1/2MemSz) 270deg MemSz) nil)
       ;;  Lower Left Horz Frame
       (MakeLine (polar LL 0.0 MemSz) (polar MPL 180deg 1/2MemSz) nil)
       (MakeLine (polar (polar LL 0.0 MemSz) 90deg MemSz)
                 (polar (polar MPL 180deg 1/2MemSz) 90deg MemSz) nil)
       ;;  Upper Right Horz Frame
       (MakeLine (polar UR 180deg MemSz) (polar MPU 0.0 1/2MemSz) nil)
       (MakeLine (polar (polar UR 180deg MemSz) 270deg MemSz)
                 (polar (polar MPU 0.0 1/2MemSz) 270deg MemSz) nil)
       ;;  Lower Right Horz Frame
       (MakeLine (polar LR 180deg MemSz) (polar MPL 0.0 1/2MemSz) nil)
       (MakeLine (polar (polar LR 180deg MemSz) 90deg MemSz)
                 (polar (polar MPL 0.0 1/2MemSz) 90deg MemSz) nil)
     )
  )
  (princ)
)
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #24 on: February 18, 2009, 05:28:33 PM »

This routine I have modified and added a dialog box...if you want it I can send it to you off line, but it will need major modification to make it a standalone routine.

I'd like to experiment with that but I may have to ask your advice for modifying it.  I don't know if I would even know where to start but if you will send it to me I will give my best effort.

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #25 on: February 18, 2009, 05:32:11 PM »
This example is the same routine using the entmake function which has advantages over the Command "._LINE"

Thanks CAB, this will give me a contrast and comparison to the first one which should help me make sense of the process.

JCUTRONA

  • Guest
Re: Frame design lisp tutorial
« Reply #26 on: February 20, 2009, 05:59:03 PM »
OK so I thought that anyone who has been helping me for the last month or so might be interested in seeing my progress.

Keep in mind I stumbled onto this site just 43 days ago talking about "what is a LISP".

But here is my first attempt to draw curtainwall frame members with lisp.

If anyone cares to comment please do...  What I want to do now is have an "(if" option at the beginning that asks if it is horizontal or vertical...  I would also like for the lines to be in the process of appearing as I pick the point for mullion height.  Anyway, my first lisp..  Take a look.

Code: [Select]
;this lsp will draw curtain wall frame members one at a time vertical or horizontal
;here goes

;************************************

(defun c:myfrm() ;define function

;get face dimension and insertion point of member
(setq sl (getdist "\nSight Line : ")
     ip (getpoint "\nInsertion Point : ")
)

;This function converts Degrees to Radians.
(defun dtr (x)
;define degrees to radians function

(* pi (/ x 180.0))
;divide the angle by 180 then
;multiply the result by the constant PI
) ;end of function

;find points for lines to connect
(setq pt1 (polar ip (dtr 180.0) (/ sl 2)
)
)

(setq mh (getdist "\nMullion Height : ")
)

(setq pt2 (polar pt1 (dtr 90.0) mh)
)

(setq pt3 (polar pt2 (dtr 0.0) sl)
)

(setq pt4 (polar pt3 (dtr 270.0) mh)
)

;Draw lines hopefully
(command "line" pt1 pt2 pt3 pt4 pt1 "")
(princ)
)
(princ)

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Frame design lisp tutorial
« Reply #27 on: February 20, 2009, 06:09:49 PM »
Note that the Osmode when ON will cause you trouble if any of your points used within a command are near existing objects.
The snaps can pull the points away from there intended location. As you see in my lisp that used the LINE command, I
used "_non" before each point to insure the osnaps were ignored.
Like this:
Code: [Select]
(command "line" "_non" pt1 "_non" pt2 "_non" pt3 "_non" pt4 "_non" pt1 "")
The alternative is to turn off the osmode while the commands are being executed.
I've reached the age where the happy hour is a nap. (°¿°)
Windows 10 core i7 4790k 4Ghz 32GB GTX 970
Please support this web site.