Jump to content

Recommended Posts

Posted

I know what you mean, Buzzard, but I kept getting errors thrown at me until I changed to that format. Logic was telling me to do it one way and the machine was hassling me. I had to use more variables too as it was not liking nested arguments/calculations, like you can do in an excel spreadsheet.

Anyway it all helps to keep me out of the pub and something to do whilst waiting for a job to turn up.:wink:

( I,ve now had 26 days of work since Jan 15 )

It keeps the mind active and I relish a challenge, especially if it's made of wood:lol:. Off now to add the drip groove to the code above 'cos I got it sorted just now:D.

  • Replies 45
  • Created
  • Last Reply

Top Posters In This Topic

  • The Buzzard

    21

  • Rob-GB

    17

  • Lee Mac

    7

  • David Bethel

    1

Top Posters In This Topic

Posted Images

Posted
I know what you mean, Buzzard, but I kept getting errors thrown at me until I changed to that format. Logic was telling me to do it one way and the machine was hassling me. I had to use more variables too as it was not liking nested arguments/calculations, like you can do in an excel spreadsheet.

Anyway it all helps to keep me out of the pub and something to do whilst waiting for a job to turn up.:wink:

( I,ve now had 26 days of work since Jan 15 )

It keeps the mind active and I relish a challenge, especially if it's made of wood:lol:. Off now to add the drip groove to the code above 'cos I got it sorted just now:D.

 

 

Rob,

 

Hope you do not mind, But I took out those variables you converted from strings to reals. Also tightned the code a bit.

I ran this and had no problems. You may keep yours the way you wish, I just wanted to show you those additional variables were not needed.

 

; lisp routine to draw basic casement sash window sngl opener 
; by Rob-GB 
;=========================================================================================;
(defun C:casement1 (/ IP A B C D E F G H K S N P Q R GL x y z J1 J2 J3 J4 J5 J6 J7
                     MD M1 M2 M3 M4 M5 M6 M7 M8 M9 M10 D1 D2 D3 D4 D5
                     P1 P1A P1B P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12
                     P13 P14 P15 P16 P17 P18 P19 P20 P21 P22 P23
                     CEG SLOPE FH HH S1 S2 DRIP RAD SLOPE2 W1
                     BRI BR1 BR2 BR3 BR4 BR5 BR6 BR7 BR8
                     TR1 TR2 TR3 TR4 TR5 TR6 TR7 TR8 GLASS
                     F1 F2 F3 F4 F5 F6 F7 F8 F9 F10 F11 F12 F13 F14 F15
                     F16 F17 F18 F19 F20 F21 F22 F23 F24 F25 F26 F27 F28
                     F29 F30 F31 F32 F33 F34 F35 F36 F37 F38 F39 F40
                     C1 C2 C3 C4 C5 C6 C7 C8 C9 C10 C11 C12 C13 C14 C15 C16 C17 C18 C2A C2B C2C
                     GL1 GL2 RW1 BRG SG OLDSNAP OLDBLIP OLDLIGHT)
;=========================================================================================;
;store settings
 (setq    OLDSNAP  (getvar "OSMODE"))
 (setq    OLDBLIP  (getvar "BLIPMODE"))
 (setq    OLDLIGHT (getvar "HIGHLIGHT"))
 (setvar "CMDECHO"  0)
 (setvar "BLIPMODE" 0)
;=========================================================================================;
;Basic dims required
 (or HEIGHT  (setq HEIGHT  1000.0))
 (or WIDTH   (setq WIDTH   1000.0))
 (or JWD     (setq JWD       94.0))
 (or JTH     (setq JTH       56.0))
 (or CWT     (setq CWT      170.0))
 (or CTH     (setq CTH       69.0))
 (or CILLANG (setq CILLANG    9.0))
 (or FRT     (setq FRT       15.0))
 (or WB      (setq WB        25.0))
 (or BORA    (setq BORA      90.0))
 (or HEAD    (setq HEAD      50.0)) 
 (or STILE   (setq STILE     50.0))
 (or STW     (setq STW       44.0))
 (or GRT     (setq GRT       15.0))
 (or GLASS   (setq GLASS     14.0))
 (setq A  (rtos HEIGHT  2 1))
 (setq B  (rtos WIDTH   2 1))
 (setq C  (rtos JWD     2 1))
 (setq D  (rtos JTH     2 1))
 (setq E  (rtos CWT     2 1))
 (setq F  (rtos CTH     2 1))
 (setq G  (rtos CILLANG 2 1))
 (setq H  (rtos FRT     2 1))
 (setq K  (rtos WB      2 1))
 (setq S  (rtos BORA    2 1))  
 (setq N  (rtos HEAD    2 1))
 (setq P  (rtos STILE   2 1))
 (setq Q  (rtos STW     2 1))
 (setq R  (rtos GRT     2 1))
 (setq GL (rtos GLASS   2 1))   
 (setq HEIGHT  (cond ((getdist (strcat "\nEnter height of window <"A">:")))            (T (setq HEIGHT  HEIGHT))))
 (setq WIDTH   (cond ((getdist (strcat "\nEnter width of window <"B">:")))             (T (setq WIDTH   WIDTH))))
 (setq JWD     (cond ((getdist (strcat "\nEnter jamb width <"C">:")))                  (T (setq JWD     JWD))))
 (setq JTH     (cond ((getdist (strcat "\nEnter jamb thickness <"D">:")))              (T (setq JTH     JTH))))
 (setq CWT     (cond ((getdist (strcat "\nEnter cill width <"E">:")))                  (T (setq CWT     CWT))))  
 (setq CTH     (cond ((getdist (strcat "\nEnter cill thickness <"F">:")))              (T (setq CTH     CTH))))
 (setq CILLANG (cond ((getdist (strcat "\nEnter cill angle <"G">:")))                  (T (setq CILLANG CILLANG))))
 (setq FRT     (cond ((getdist (strcat "\nEnter frame rebate <"H">:")))                (T (setq FRT     FRT))))
 (setq WB      (cond ((getdist (strcat "\nEnter Window board Thickness <"K">:")))      (T (setq WB      WB))))
 (setq BORA    (cond ((getdist (strcat "\nEnter Bottom Rail <"S">:")))                 (T (setq BORA    BORA))))
 (setq HEAD    (cond ((getdist (strcat "\nEnter Top Rail <"N">:")))                    (T (setq HEAD    HEAD)))) 
 (setq STILE   (cond ((getdist (strcat "\nEnter Stile <"P">:")))                       (T (setq STILE   STILE))))
 (setq STW     (cond ((getdist (strcat "\nEnter Head & Bottom Rail thickness <"Q">:")))(T (setq STW     STW))))
 (setq GRT     (cond ((getdist (strcat "\nEnter Glass Rebate <"R">:")))                (T (setq GRT     GRT))))
 (setq GLASS   (cond ((getdist (strcat "\nEnter Glass or unit thickness <"GL">:")))    (T (setq GLASS   GLASS))))
 (setq IP      (getpoint "\nInsertion Point: "))
;=========================================================================================;
;set other dims
 (setq J1     (- JTH FRT))    
 (setq J4 100.0)
 (setq J3     (+ J4 JWD))    
 (setq J2     (+ STW 2.0))                                ; jamb rebate and clearance
 (setq J5     (- CTH WB))
 (setq J6 0.017555555)                                    ;this is the rate of declination per mm per degree
 (setq GB     (+ GLASS GRT))                              ;assumes glazing bead or putty is of equal width and height
 (setq J7     (* CILLANG J6))
 (setq SLOPE  (* J7 J2))
 (setq SLOPE2 (* (- CWT JWD) (* CILLANG J6)))   
 (setq D1     (+ (- HEIGHT   (+ CTH JTH))(* FRT 2) SLOPE))
 (setq D2     (- WIDTH (* J1 2)))
 (setq D3     (- HEIGHT (+ CTH JTH)))
 (setq S1     (- D1 4))                                   ; sash height
 (setq HH     (- S1 HEAD))  
 (setq W1     (+ WIDTH 150))
 (setq S2     (- D2 4))                                   ; sash width
 (setq GL1    (- S1 (+ (- HEAD GRT)(- BORA GRT))))
 (setq GL2    (- S2 (* 2 (- STILE GRT))))
 (setq RW1    (- S2 (* 2 STILE)))
 (setq BRG    (- BORA GRT))
 (setq SG     (- STILE GRT))
 (setq CEG    (- CTH (+ 5 SLOPE SLOPE2 FRT)))
 (setq MD     (- STW GB))
;=========================================================================================;
; plot points for side elevation
 (setq C1  (POLAR IP  (DTR 180.0) 175.0))        ; side elevation from insert point
 (setq C2  (POLAR C1  (DTR  90.0) WB))
 (setq C2A (POLAR C2  (DTR 180.0) 10.0))
 (setq C2B (POLAR C2A (DTR 270.0) 10.0))
 (setq C2C (POLAR C2B (DTR   0.0) 10.0))
 (setq C3  (POLAR C1  (DTR  90.0) CTH))
 (setq C4  (POLAR C3  (DTR  90.0) D3))
 (setq C5  (POLAR C4  (DTR  90.0) JTH))          ; top corner head
 (setq C6  (POLAR C5  (DTR 180.0) JWD))
 (setq C7  (POLAR C6  (DTR 270.0) J1))
 (setq C8  (POLAR C7  (DTR   0.0) J2))
 (setq C9  (POLAR C8  (DTR 270.0) FRT))
 (setq C10 (POLAR C9  (DTR 270.0) D3))
 (setq C11 (POLAR C10 (DTR 270.0) FRT))
 (setq C12 (POLAR C7  (DTR 270.0) D1))
 (setq C13 (POLAR C12 (DTR 270.0) 5.0))
 (setq C14 (POLAR C1  (DTR 180.0) CWT))
 (setq C15 (POLAR C14 (DTR  90.0) CEG))
 (setq C16 (POLAR C14 (DTR   0.0) 10.0))
 (setq C17 (POLAR C16 (DTR   0.0) 6.0))
 (setq C18 (POLAR C17 (DTR   0.0) 6.0))
;=========================================================================================;
; plot points for frame
 (setq F1  (POLAR IP  (DTR 180.0) 75.0))         ; cill return from insert point
 (setq F2  (POLAR F1  (DTR  90.0) CTH))
 (setq F3  (POLAR F2  (DTR   0.0) 75.0))
 (setq F4  (POLAR F3  (DTR  90.0) D3))
 (setq F5  (POLAR F4  (DTR 180.0) 75.0))
 (setq F6  (POLAR F5  (DTR  90.0) JTH))
 (setq F7  (POLAR F6  (DTR   0.0) 75.0))
 (setq F8  (POLAR F7  (DTR   0.0) WIDTH))
 (setq F9  (POLAR F8  (DTR   0.0) 75.0))
 (setq F10 (POLAR F9  (DTR 270.0) JTH))
 (setq F11 (POLAR F10 (DTR 180.0) 75.0))
 (setq F12 (POLAR F11 (DTR 270.0) D3))
 (setq F13 (POLAR F12 (DTR   0.0) 75.0))
 (setq F14 (POLAR F13 (DTR 270.0) CTH))          ;bottom right corner of frame
 (setq F15 (POLAR F1  (DTR  90.0) CEG))          ; cill edge
 (setq F16 (POLAR F14 (DTR  90.0) CEG))          ; cill edge
 (setq F17 (POLAR F6  (DTR 270.0) J1))           ; head face
 (setq F18 (POLAR F9  (DTR 270.0) J1))           ; head face
 (setq F19 (POLAR C12 (DTR   0.0) J3))           ; cillstep
 (setq F20 (POLAR C13 (DTR   0.0) J3))           ; cillstep
 (setq F36 (POLAR F19 (DTR   0.0) W1))
 (setq F37 (POLAR F20 (DTR   0.0) W1))
 (setq F21 (POLAR F17 (DTR   0.0) 75.0))         ; jamb
 (setq F22 (POLAR F19 (DTR   0.0) 75.0))         ; jamb
 (setq F23 (POLAR F21 (DTR   0.0) J1))           ; jamb
 (setq F24 (POLAR F22 (DTR   0.0) J1))           ; jamb
 (setq F25 (POLAR F4  (DTR   0.0) JTH))          ; jamb
 (setq F26 (POLAR F3  (DTR   0.0) JTH))          ; jamb
 (setq F27 (POLAR F4  (DTR   0.0) J1))           ; jamb
 (setq F28 (POLAR F3  (DTR   0.0) J1))           ; jamb
 (setq F29 (POLAR F18 (DTR 180.0) 75.0))         ; jamb
 (setq F30 (POLAR F36 (DTR 180.0) 75.0))         ; jamb
 (setq F31 (POLAR F29 (DTR 180.0) J1))           ; jamb
 (setq F32 (POLAR F30 (DTR 180.0) J1))           ; jamb
 (setq F33 (POLAR F11 (DTR 180.0) JTH))          ; jamb
 (setq F34 (POLAR F12 (DTR 180.0) JTH))          ; jamb
 (setq F35 (POLAR F12 (DTR 180.0) J1))           ; jamb
 (setq F38 (POLAR F11 (DTR 180.0) J1))           ; jamb
 (setq F39 (POLAR F28 (DTR 270.0) FRT))          ; jamb
 (setq F40 (POLAR F35 (DTR 270.0) FRT))          ; jamb
;=========================================================================================;
; mullion section

;=========================================================================================;
; plot points for sash
 (setq P1A (POLAR F24 (DTR  90.0) 2.0))
 (setq P1B (POLAR P1A (DTR   0.0) 2.0))              
 (setq P1  (POLAR P1B (DTR  90.0) S1))           ;insert point for sash in frame
 (setq P2  (POLAR P1  (DTR   0.0) SG))
 (setq P3  (POLAR P2  (DTR   0.0) GRT))
 (setq P4  (POLAR P3  (DTR   0.0) RW1))
 (setq P5  (POLAR P4  (DTR   0.0) GRT))
 (setq P6  (POLAR P5  (DTR   0.0) SG))
 (setq P7  (POLAR P6  (DTR 270.0) S1))
 (setq P8  (POLAR P7  (DTR 180.0) SG))
 (setq P9  (POLAR P8  (DTR 180.0) GRT))
 (setq P10 (POLAR P9  (DTR 180.0) RW1))
 (setq P11 (POLAR P10 (DTR 180.0) GRT))
 (setq P12 (POLAR P11 (DTR  90.0) BRG))
 (setq P13 (POLAR P12 (DTR  90.0) GL1))
 (setq P14 (POLAR P13 (DTR   0.0) GL2))
 (setq P15 (POLAR P14 (DTR 270.0) GL1))
 (setq P16 (POLAR P10 (DTR  90.0) BORA))
 (setq P17 (POLAR P10 (DTR  90.0) HH))
 (setq P18 (POLAR P17 (DTR   0.0) RW1))
 (setq P19 (POLAR P9  (DTR  90.0) BORA))
 (setq P20 (POLAR P16 (DTR 270.0) GRT))
 (setq P23 (POLAR P19 (DTR 270.0) GRT))
 (setq P21 (POLAR P17 (DTR  90.0) GRT))
 (setq P22 (POLAR P18 (DTR  90.0) GRT))
;=========================================================================================;
; bottom rail sash
 (setq BRI (POLAR C12 (DTR  90.0) 2.0))  
 (setq BR1 (POLAR BRI (DTR  90.0) BORA))
 (setq BR2 (POLAR BR1 (DTR 270.0) GRT))
 (setq BR3 (POLAR BR1 (DTR   0.0) GB))
 (setq BR4 (POLAR BR3 (DTR 270.0) GRT))
 (setq BR5 (POLAR BR3 (DTR   0.0) MD))
 (setq BR6 (POLAR BR5 (DTR 270.0)(- BORA SLOPE)))
;=========================================================================================;
; top rail sash
 (setq TRI (POLAR C7  (DTR 270.0) 2.0))
 (setq TR1 (POLAR TRI (DTR 270.0) HEAD))
 (setq TR2 (POLAR TR1 (DTR  90.0) GRT))
 (setq TR3 (POLAR TR1 (DTR   0.0) GB))
 (setq TR4 (POLAR TR3 (DTR  90.0) GRT))
 (setq TR5 (POLAR TR3 (DTR   0.0) MD))
 (setq TR6 (POLAR TR5 (DTR  90.0) HEAD))
;=========================================================================================;
;plot frame elevation
 (setvar "OSMODE" 0)
 (command "_.PLINE" IP F1 F2 F3 "")
 (command "_.PLINE" F4 F5 F6 F7 F8 F9 F10 F11 "")
 (command "_.PLINE" F12 F13 F14 F1 "")              ; outside drawn
 (command "_.PLINE" F17 F18 "")
 (command "_.PLINE" F15 F16 "")
 (command "_.PLINE" C1 C2C C2B C2A C2 C3 C4 C5 C6 C7 C8 C9 C4 "")
 (command "_.PLINE" C9 C10 C3 "")
 (command "_.PLINE" C10 C11 C12 C13 C15 C14 C16 "")
 (command "_.PLINE" C18 C16 C1 "")                  ;drip groove not figured out yet
 (command "_.PLINE" C7 C12 "")
 (command "_.PLINE" F21 F22 "")
 (command "_.PLINE" F23 F24 "")
 (command "_.PLINE" F25 F26 "")
 (command "_.PLINE" F29 F30 "")
 (command "_.PLINE" F31 F32 "")
 (command "_.PLINE" F33 F34 "")
 (command "_.PLINE" F27 F38 "")
 (command "_.PLINE" F28 F35 "")
 (command "_.PLINE" F19 F36 "")
 (command "_.PLINE" F20 F37 "")
;=========================================================================================;
 (command "_.PLINE" P1B P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P1B ""); outside drawn
 (command "_.PLINE" P2  P11 "")
 (command "_.PLINE" P5  P8 "")
 (command "_.PLINE" P13 P14 "")
 (command "_.PLINE" P12 P15 "")
 (command "_.PLINE" P16 P17 P18 P19 P16 "")
 (command "_.PLINE" P17 P21 "")
 (command "_.PLINE" P18 P22 "")
 (command "_.PLINE" P16 P20 "")
 (command "_.PLINE" P19 P23 "")
 (command "_.PLINE" BRI BR2 BR4 BR3 BR5 BR6 BRI "") ; bottom sash elevation
 (command "_.PLINE" TRI TR2 TR4 TR3 TR5 TR6 TRI "") ; top sash elevation
 (setvar "OSMODE"    OLDSNAP)
 (setvar "BLIPMODE"  OLDBLIP)
 (setvar "HIGHLIGHT" OLDLIGHT)
 (princ)
);defun
;=========================================================================================;
(defun DTR (a)
 (* PI (/ a 180.0))  ;degrees to radians
)
;=========================================================================================;

Posted

You can tell I'm new to this can't you. That or I have an untidy mind:lol:.

That code looks great! I promise to try harder and will make another attempt to get rid of the extra code, will have to do it myself as the original has grown a bit.

Posted
You can tell I'm new to this can't you. That or I have an untidy mind:lol:.

That code looks great! I promise to try harder and will make another attempt to get rid of the extra code, will have to do it myself as the original has grown a bit.

 

I was only making it easier fo me to read. Sorry if I am so selfish.

I just wanted you to see that those variables TWO, FIVE, etc etc

were not needed. Thats all.

Posted
I was only making it easier fo me to read. Sorry if I am so selfish.

I just wanted you to see that those variables TWO, FIVE, etc etc

were not needed. Thats all.

 

I was not suggesting that you are, just wish I had made it that nice in the first place. Maybe when I get more comfortable in what can and what can't be done in lisp I will find a nice tidy style of writing code. Yours is definately easier to read, as is your HLR.lsp you posted, I have it printed out for reference ( my thoughts are going towards writing a DCL format of this code when I get it as functional as I can).

It is early days as yet so I must stop myself charging ahead regardless.

Regards Rob.

Posted
I was not suggesting that you are, just wish I had made it that nice in the first place. Maybe when I get more comfortable in what can and what can't be done in lisp I will find a nice tidy style of writing code. Yours is definately easier to read, as is your HLR.lsp you posted, I have it printed out for reference ( my thoughts are going towards writing a DCL format of this code when I get it as functional as I can).

It is early days as yet so I must stop myself charging ahead regardless.

Regards Rob.

 

 

No problem Rob,

 

If you decide to go DCL and need help, I am in your corner. As far as the format is concerned, It is ideal to format in a way that is less stressfull on the eyes. I will take the trouble to align things. It does make it much easier to read, But I do not believe there is a set of rules for this. Its really upto the programmer.

 

You did great on the code and I look forward to seeing a completed version.

Good Luck,

The Buzzard

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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...