Jump to content

Recommended Posts

Posted

Nice one Rob - you are progressing fast.

 

A few more things :)

 

  • Make sure that your localise your *error* function in your main function, so that it goes back to the default ACAD *error* handler after the routine has finished.

  • {optional}:

With the Sys var collection and setting and resetting, I would use
mapcar
as it is much tidier
:)

 

For collection:

 

(setq varlist '("CMDECHO" "BLIPMODE" "OSMODE"))
(setq oldvars (mapcar 'getvar varlist))

 

For resetting:

 

(mapcar 'setvar varlist oldvars)

 

If you are going to use this method, remember that the sys vars need to be reset not only at the end of the routine, but also in the error handler
:)

 

 

Lee

  • 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

:)Thanks Lee.

Just a quick question:- If I wanted to get the distance between two points and then use that dimension to determine others via a calculation, would "getdist" be an appropriate method?

Actually had a days work today so have been out in the sun too much.:D The old noggin is in need of beer coolant!:lol:

Cheers, Rob.

Posted
Just a quick question:- If I wanted to get the distance between two points and then use that dimension to determine others via a calculation, would "getdist" be an appropriate method?.

 

It depends if you are wanting the user to enter the distance or not.

 

(getdist) will prompt for a distance input,

 

or, if you already have two points calculated from something else:

 

(distance pt1 pt2) will find the distance between them. :)

Posted
Just adjusted code, been busy so had to get up early (0300hrs) and get it sorted.

 
(defun *error* (msg)
(setvar "OSMODE" *osnap)   ;error check
(setvar "CMDECHO" 1)
(princ msg)
(princ)
)
(defun DTR (a) (* PI (/ a 180.0))  ;degrees to radians
)
(defun C:SASH2 (/ IP P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 P12 P13 P14 P15 P16 P17 P18 P19 P20 P21 P22 P23 
 HEIGHT WIDTH GRT GL1 GL2 RW1 BORA BRG SG HH HEAD STILE OLDSNAP OLDBLIP OLDLIGHT)
; lisp routine to draw basic casement sash v.2
; by Rob-GB 
(setq OLDSNAP (getvar "OSMODE")
)
(setq OLDBLIP (getvar "BLIPMODE")  ;store settings
)
(setq OLDLIGHT (getvar "HIGHLIGHT")
)
(setvar "CMDECHO" 0)
(setvar "BLIPMODE" 0)
(setq HEIGHT (getdist "\nEnter height of sash : ")
)
(setq WIDTH (getdist "\nEnter Width of sash : ")
)
(setq BORA (getdist "\nEnter Bottom Rail : ") ; size of rail in elevation view
)
(setq HEAD (getdist "\nEnter Top Rail : ") ; size of rail in elevation view
)
(setq STILE (getdist "\nEnter Stile : ") ; size of stile in elevation view
)
(setq GRT (getdist "\nEnter Glass Rebate : ") ; size of rebate in elevation view
)
(setq IP (getpoint "\nInsertion Point: ")) ; bottom left corner
(setvar "OSMODE" 0)
;Basic dims required
(setq GL1 (- HEIGHT (+(- HEAD GRT)(- BORA GRT)))
)
(setq GL2 (- WIDTH (* 2 (- STILE GRT)))
)
(setq RW1 (- WIDTH (* 2 STILE))
)
(setq BRG (- BORA GRT)
)
(setq SG (- STILE GRT)
)
(setq HH (- HEIGHT HEAD)
)
; PLOT POINTS
(setq P1 (POLAR IP (DTR 90.0) HEIGHT)
)     
(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) HEIGHT)
)
(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)
)
;points plotted
(command "_.PLINE" IP P1 P2 P3 P4 P5 P6 P7 P8 P9 P10 P11 IP ""
); 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 ""
)
(setvar "OSMODE" OLDSNAP)
(setvar "BLIPMODE" OLDBLIP)
(setvar "HIGHLIGHT" OLDLIGHT)
(princ)
);defun

 

I am a bit happier with outcome.:) It's just the organising of all the Glazing bars variants do work on now.:lol:

 

Your coding is coming together Rob.

Nice work.

Posted

Delivered the in-laws back home so have been playing again:D.

 

This has moved on to be a complete single opening casement window with the start of a side elevation. Error routine was causing problems so took it out. Also found that to get over a "bad argument" error all I had to do was copy the first incidence of the variable and paste it in place!?

 

Word of warning! as I work in millimetres the program as it is contains dimensions pre-placed in mm's!

 
;=========================================================================================;
(defun C:casement1 (/ IP a b c d e f g h i k s n p q r x y z J1 J2 J3 J4 J5 J6 J7 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 OFF1 TEN SIX FIVE TWO SEVENFIVE DRIP RAD SLOPE2 W1
     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)
;=========================================================================================;
; lisp routine to draw basic casement sash window sngl opener ; by Rob-GB 
(setq OLDSNAP (getvar "OSMODE")
)
(setq OLDBLIP (getvar "BLIPMODE")  ;store settings
)
(setq OLDLIGHT (getvar "HIGHLIGHT")
)
(setvar "CMDECHO" 0)
(setvar "BLIPMODE" 0)
;=========================================================================================;
;Basic dims required
;=========================================================================================;
(if (= HEIGHT nil)
 (setq HEIGHT 1000.0)
);end if
(princ "\nEnter height of window <")
(princ HEIGHT)
(princ "> ")
(setq a (getdist))
(if (= a nil)
 (setq a HEIGHT)
);end if
(setq HEIGHT a) 
(princ a)
(if (= WIDTH nil)
 (setq WIDTH 1000.0)
);end if
(princ "\nEnter width of window <")
(princ WIDTH)
(princ "> ")
(setq b (getdist))
(if (= b nil)
 (setq b WIDTH)
);end if
(setq WIDTH b) 
(princ b) 
(if (= JWD nil)
 (setq JWD 94.0)
);end if
(princ "\nEnter jamb width <")
(princ JWD)
(princ "> ")
(setq c (getdist))
(if (= c nil)
 (setq c JWD)
);end if
(setq JWD c) 
(princ c) 
(if (= JTH nil)
 (setq JTH 56.0)
);end if
(princ "\nEnter jamb thickness <")
(princ JTH)
(princ "> ")
(setq d (getdist))
(if (= d nil)
 (setq d JTH)
);end if
(setq JTH d) 
(princ d) 
(if (= CWT nil)
 (setq CWT 170.0)
);end if
(princ "\nEnter cill width <")
(princ CWT)
(princ "> ")
(setq e (getdist))
(if (= e nil)
 (setq e CWT)
);end if
(setq CWT e) 
(princ e) 
(if (= CTH nil)
 (setq CTH 69.0)
);end if
(princ "\nEnter cill thickness <")
(princ CTH)
(princ "> ")
(setq f (getdist))
(if (= f nil)
 (setq f CTH)
);end if
(setq CTH f) 
(princ f) 
(if (= CILLANG nil)
 (setq CILLANG 9.0)
);end if
(princ "\nEnter cill angle <")
(princ CILLANG)
(princ "> ")
(setq g (getdist))
(if (= g nil)
 (setq g CILLANG)
);end if
(setq CILLANG g) 
(princ g) 
(if (= FRT nil)
 (setq FRT 15.0)
);end if
(princ "\nEnter frame rebate <")
(princ FRT)
(princ "> ")
(setq h (getdist))
(if (= h nil)
 (setq h FRT)
);end if
(setq FRT h) 
(princ h) 
(if (= WB nil)
 (setq WB 25.0)
);end if
(princ "\nEnter Window board Thickness <")
(princ WB)
(princ "> ")
(setq k (getdist))
(if (= k nil)
 (setq k WB)
);end if
(setq WB k) 
(princ k) 
(if (= BORA nil)
 (setq BORA 90.0)
);end if
(princ "\nEnter Bottom Rail <")
(princ BORA)
(princ "> ")
(setq s (getdist))
(if (= s nil)
 (setq s BORA)
);end if
(setq BORA s) 
(princ s) 
(if (= HEAD nil)
 (setq HEAD 50.0)
);end if
(princ "\nEnter Top Rail <")
(princ HEAD)
(princ "> ")
(setq n (getdist))
(if (= n nil)
 (setq n HEAD)
);end if
(setq HEAD n) 
(princ n) 
(if (= STILE nil)
 (setq STILE 50.0)
);end if
(princ "\nEnter Stile <")
(princ STILE)
(princ "> ")
(setq p (getdist))
(if (= p nil)
 (setq p STILE)
);end if
(setq STILE p) 
(princ p) 
(if (= STW nil)
 (setq STW 44.0)
);end if
(princ "\nEnter Head & Bottom Rail thickness <")
(princ STW)
(princ "> ")
(setq q (getdist))
(if (= q nil)
 (setq q STW)
);end if
(setq STW q) 
(princ q) 
(if (= GRT nil)
 (setq GRT 15.0)
);end if
(princ "\nEnter Glass Rebate <")
(princ GRT)
(princ "> ")
(setq r (getdist))
(if (= r nil)
 (setq r GRT)
);end if
(setq GRT r) 
(princ r)
(setq IP (getpoint "\nInsertion Point: ")
) ; bottom left corner 
;=========================================================================================;
;set other dims
(setq TWO (atof "2")    
)
(setq TEN (atof "10")    
)
(setq FIVE (atof "5")    
)
(setq SIX (atof "6")    
)
(setq SEVENFIVE (atof "75")    
)   
(setq J1 (- JTH FRT)
)    
(setq J4 (atof "100")
)    
(setq OFF1 (atof "175")    
) 
(setq J3 (+ J4 JWD)    
) 
(setq J2 (+ STW TWO)    ; jamb rebate and clearance
)
(setq J5 (- CTH WB)
)
(setq J6 (atof "0.017555555")
)
(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 (atof "4"))   ; sash height
)
(setq HH (- S1 HEAD)
)  
(setq W1 (+ WIDTH 150)
)
(setq S2 (- D2 (atof "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))
)
;=========================================================================================;
; plot points for side elevation
(defun DTR (a) (* PI (/ a 180.0))  ;degrees to radians
)  
(setq C1 (POLAR IP (DTR 180.0) OFF1)  ; side elevation from insert point
)
(setq C2 (POLAR C1 (DTR 90.0) WB)
)
(setq C2A (POLAR C2 (DTR 180.0) TEN)
)
(setq C2B (POLAR C2A (DTR 270.0) TEN)
)
(setq C2C (POLAR C2B (DTR 0.0) TEN)
)
(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) FIVE)
)
(setq C14 (POLAR C1 (DTR 180.0) CWT)
)
(setq C15 (POLAR C14 (DTR 90.0) CEG)
)
(setq C16 (POLAR C14 (DTR 0.0) TEN)
)
(setq C17 (POLAR C16 (DTR 0.0) SIX)
)
(setq C18 (POLAR C17 (DTR 0.0) SIX)
)
;=========================================================================================;
;=========================================================================================;
; plot points for frame
(setq F1 (POLAR IP (DTR 180.0) SEVENFIVE)  ; cill return from insert point
)
(setq F2 (POLAR F1 (DTR 90.0) CTH)
)
(setq F3 (POLAR F2 (DTR 0.0) SEVENFIVE)
)
(setq F4 (POLAR F3 (DTR 90.0) D3)
)
(setq F5 (POLAR F4 (DTR 180.0) SEVENFIVE)
)
(setq F6 (POLAR F5 (DTR 90.0) JTH)
)
(setq F7 (POLAR F6 (DTR 0.0) SEVENFIVE)
)
(setq F8 (POLAR F7 (DTR 0.0) WIDTH)
)
(setq F9 (POLAR F8 (DTR 0.0) SEVENFIVE)
)
(setq F10 (POLAR F9 (DTR 270.0) JTH)
)
(setq F11 (POLAR F10 (DTR 180.0) SEVENFIVE)
)
(setq F12 (POLAR F11 (DTR 270.0) D3)
)
(setq F13 (POLAR F12 (DTR 0.0) SEVENFIVE) 
)
(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) SEVENFIVE)       ; jamb
)
(setq F22 (POLAR F19 (DTR 0.0) SEVENFIVE)      ; 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) SEVENFIVE)     ; jamb
)
(setq F30 (POLAR F36 (DTR 180.0) SEVENFIVE)     ; 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) TWO)
)
(setq P1B (POLAR P1A (DTR 0.0) TWO)
)              
(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) ; problem 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)
)
;=========================================================================================;
;=========================================================================================;
;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
)
(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 ""
)
(setvar "OSMODE" OLDSNAP)
(setvar "BLIPMODE" OLDBLIP)
(setvar "HIGHLIGHT" OLDLIGHT)
(princ)
);defun

Posted

This is what it will produce. Have a few niggles to sort, like getting it to draw an arc for drip groove between c16 and c18 with c17 as centre point, not that I gave up or anything :unsure:

casement1.jpg

Posted
This is what it will produce. Have a few niggles to sort, like getting it to draw an arc for drip groove between c16 and c18 with c17 as centre point, not that I gave up or anything :unsure:

 

 

Rob-GB,

 

Great job with the default settings. The added side view is also a good add-in. The program ran fine with-out a hitch. Great Job!

 

The Buzzard

Posted

Rob,

 

Taking a closer look at the code you could reduce alot.

Just a suggestion.

 

Example - You have this:

(if (= HEIGHT nil)
(setq HEIGHT 1000.0)
);end if
(princ "\nEnter height of window <")
(princ HEIGHT)
(princ "> ")
(setq a (getdist))
(if (= a nil)(setq a HEIGHT));end if
(setq HEIGHT a) 
(princ a)

 

Replace with this:

(or   HEIGHT (setq HEIGHT 1000.0))
(setq A (rtos HEIGHT 2 1))



(setq HEIGHT (getdist "\nEnter height of window <"A">:"))

 

Also try to keep your defaults grouped together and keep your prompts also grouped together. It will make the code more understandable or readable. These are only just suggestions as you can do your code any way you wish.

Posted
Rob,

 

Taking a closer look at the code you could reduce alot.

Just a suggestion.

 

Example - You have this:

(if (= HEIGHT nil)
(setq HEIGHT 1000.0)
);end if
(princ "\nEnter height of window <")
(princ HEIGHT)
(princ "> ")
(setq a (getdist))
(if (= a nil)(setq a HEIGHT));end if
(setq HEIGHT a) 
(princ a)

 

Replace with this:

(or   HEIGHT (setq HEIGHT 1000.0))
(setq A (rtos HEIGHT 2 1))



(setq HEIGHT (getdist "\nEnter height of window <"A">:"))

 

Also try to keep your defaults grouped together and keep your prompts also grouped together. It will make the code more understandable or readable. These are only just suggestions as you can do your code any way you wish.

 

Thanks Buzzard, that would make it a lot more tidy.:)

It is a matter of getting code to work then staying with it until a better solution presents itself. I would say that two thirds of my time is taken up with reading and learning code and the rest sorting out typo's.:lol: All advice is gratefully recieved.

Posted
Rob,

 

Replace with this:

(or   HEIGHT (setq HEIGHT 1000.0))
(setq A (rtos HEIGHT 2 1))



(setq HEIGHT (getdist "\nEnter height of window <"A">:"))

 

 

Changed the code but this bit is creating " error- too many arguments" . Any ideas?

Posted
Changed the code but this bit is creating " error- too many arguments" . Any ideas?

 

 

I am sorry Rob, My mistake.

 

I just tried this and it worked.

 

(or   HEIGHT (setq HEIGHT 1000.0))
(setq A (rtos HEIGHT 2 1))
(setq HEIGHT
 (cond
   ((getdist (strcat "\nEnter height of window <"A">:")))
   (T (setq HEIGHT HEIGHT))
 )
)

Posted

To give you an idea as to what I mentioned about grouping your defaults etc etc.

 

Here is the input section of your code for the first five inputs.

 

;=========================================================================================;
;Basic dims required
;=========================================================================================;
(or HEIGHT (setq HEIGHT 1000.0))
(or WIDTH  (setq WIDTH  1000.0))
(or JDW    (setq JDW      94.0))
(or JTH    (setq JTH      56.0))
(or CWT    (setq CWT     170.0))
(setq A (rtos HEIGHT 2 1))
(setq B (rtos WIDTH  2 1))
(setq C (rtos JDW    2 1))
(setq D (rtos JTH    2 1))
(setq E (rtos CWT    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 JDW
 (cond
   ((getdist (strcat "\nEnter jamb width <"C">:")))
   (T (setq JDW JDW))
 )
)
(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))
 )
)

 

As you can see this is much easier to deal with.

Posted

Here are the first five inputs again with a more compact look.

 

;=========================================================================================;
;Basic dims required
;=========================================================================================;
(or HEIGHT (setq HEIGHT 1000.0))
(or WIDTH  (setq WIDTH  1000.0))
(or JDW    (setq JDW      94.0))
(or JTH    (setq JTH      56.0))
(or CWT    (setq CWT     170.0))
(setq A (rtos HEIGHT 2 1))
(setq B (rtos WIDTH  2 1))
(setq C (rtos JDW    2 1))
(setq D (rtos JTH    2 1))
(setq E (rtos CWT    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 JDW    (cond ((getdist (strcat "\nEnter jamb width <"C">:")))      (T (setq JDW JDW))))
(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))))

 

 

Get the idea.

Posted
I am sorry Rob, My mistake.

 

I just tried this and it worked.

 

(or   HEIGHT (setq HEIGHT 1000.0))
(setq A (rtos HEIGHT 2 1))
(setq HEIGHT
 (cond
   ((getdist (strcat "\nEnter height of window <"A">:")))
   (T (setq HEIGHT HEIGHT))
 )
)

 

No problem mate, whilst delving into the code I learnt some more about converting data types from Ron Leigh's site :D

http://ronleigh.info/autolisp/acatalog.htm

Thanks for your help and suggestions.

Posted
No problem mate, whilst delving into the code I learnt some more about converting data types from Ron Leigh's site :D

http://ronleigh.info/autolisp/acatalog.htm

Thanks for your help and suggestions.

 

 

Go for it!

Take it as it comes.

After you have assembled a fine example for yourself and learn from it, The rest will get easier in time. You will find that your coding will go together with less hassles. The best of us always hit a snag, But when we take the trouble to do our own research it makes you more self sufficient.

Posted

Update to the routine now draws in sash sections to side elevation and top of program is a bit neater with Buzzards ideas.

 

 
;=========================================================================================;
(defun C:casement1 (/ IP A B C D E F G H i 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 OFF1 TEN SIX FIVE TWO SEVENFIVE 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)
;=========================================================================================;
; lisp routine to draw basic casement sash window sngl opener 
; by Rob-GB 
(setq OLDSNAP (getvar "OSMODE")
)
(setq OLDBLIP (getvar "BLIPMODE")  ;store settings
)
(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: ")
) ; bottom left corner 
;=========================================================================================;
;set other dims
(setq TWO (atof "2")  ; entering numbers this way due to number of errors from straight numbers  
)
(setq TEN (atof "10")    
)
(setq FIVE (atof "5")    
)
(setq SIX (atof "6")    
)
(setq SEVENFIVE (atof "75")    
)   
(setq J1 (- JTH FRT)
)    
(setq J4 (atof "100")
)    
(setq OFF1 (atof "175")    
) 
(setq J3 (+ J4 JWD)    
) 
(setq J2 (+ STW TWO)    ; jamb rebate and clearance
)
(setq J5 (- CTH WB)
)
(setq J6 (atof "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 (atof "4"))   ; sash height
)
(setq HH (- S1 HEAD)
)  
(setq W1 (+ WIDTH 150)
)
(setq S2 (- D2 (atof "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
(defun DTR (a) (* PI (/ a 180.0))  ;degrees to radians
)  
(setq C1 (POLAR IP (DTR 180.0) OFF1)  ; side elevation from insert point
)
(setq C2 (POLAR C1 (DTR 90.0) WB)
)
(setq C2A (POLAR C2 (DTR 180.0) TEN)
)
(setq C2B (POLAR C2A (DTR 270.0) TEN)
)
(setq C2C (POLAR C2B (DTR 0.0) TEN)
)
(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) FIVE)
)
(setq C14 (POLAR C1 (DTR 180.0) CWT)
)
(setq C15 (POLAR C14 (DTR 90.0) CEG)
)
(setq C16 (POLAR C14 (DTR 0.0) TEN)
)
(setq C17 (POLAR C16 (DTR 0.0) SIX)
)
(setq C18 (POLAR C17 (DTR 0.0) SIX)
)
;=========================================================================================;
;=========================================================================================;
; plot points for frame
(setq F1 (POLAR IP (DTR 180.0) SEVENFIVE)  ; cill return from insert point
)
(setq F2 (POLAR F1 (DTR 90.0) CTH)
)
(setq F3 (POLAR F2 (DTR 0.0) SEVENFIVE)
)
(setq F4 (POLAR F3 (DTR 90.0) D3)
)
(setq F5 (POLAR F4 (DTR 180.0) SEVENFIVE)
)
(setq F6 (POLAR F5 (DTR 90.0) JTH)
)
(setq F7 (POLAR F6 (DTR 0.0) SEVENFIVE)
)
(setq F8 (POLAR F7 (DTR 0.0) WIDTH)
)
(setq F9 (POLAR F8 (DTR 0.0) SEVENFIVE)
)
(setq F10 (POLAR F9 (DTR 270.0) JTH)
)
(setq F11 (POLAR F10 (DTR 180.0) SEVENFIVE)
)
(setq F12 (POLAR F11 (DTR 270.0) D3)
)
(setq F13 (POLAR F12 (DTR 0.0) SEVENFIVE) 
)
(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) SEVENFIVE)      ; jamb
)
(setq F22 (POLAR F19 (DTR 0.0) SEVENFIVE)      ; 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) SEVENFIVE)     ; jamb
)
(setq F30 (POLAR F36 (DTR 180.0) SEVENFIVE)     ; 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) TWO)
)
(setq P1B (POLAR P1A (DTR 0.0) TWO)
)              
(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)
)
;=========================================================================================;
(setq BRI (POLAR C12 (DTR 90.0) TWO)  ; bottom rail sash
)
(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))
)
(setq TRI (POLAR C7 (DTR 270.0) TWO)  : top rail sash
)
(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 C1 ""  
)
(command "arc" "c" C17 C18 C16           ; drip groove
)
(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

Posted

Rob,

 

I just love programs like this. I think it has to do with the fact that the first program I created was polar calculation and also that I believe this type of programming is the meat and potatos of ACAD. Its the whole reason as to why you use ACAD in the first place.

 

To draw objects!

 

Your input section of the code is nice and tight. I am still reviewing the rest of the code and may have some other suggestions later. I do not want to hog the spot light. I will leave room for others to give you their input.

 

Real nice work for starters, But you will make this program even better.

 

Keep up the good work.

The Buzzard

Posted

Rob,

 

In this section of the code there are some things you are doing here that seem a bit of a waste.

 

You are converting a string to a real and passing it to a variable.

Why?

Just enter it as a real in the first place.

 

;set other dims
(setq TWO (atof "2")  ; entering numbers this way due to number of errors from straight numbers  
)
(setq TEN (atof "10")    
)
(setq FIVE (atof "5")    
)
(setq SIX (atof "6")    
)
(setq SEVENFIVE (atof "75")    
)   
(setq J1 (- JTH FRT)
)    
(setq J4 (atof "100")
)    
(setq OFF1 (atof "175")    
) 
(setq J3 (+ J4 JWD)    
) 
(setq J2 (+ STW TWO)    ; jamb rebate and clearance
)
(setq J5 (- CTH WB)
)
(setq J6 (atof "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 (atof "4"))   ; sash height
)
(setq HH (- S1 HEAD)
)  
(setq W1 (+ WIDTH 150)
)
(setq S2 (- D2 (atof "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
(defun DTR (a) (* PI (/ a 180.0))  ;degrees to radians
)  
(setq C1 (POLAR IP (DTR 180.0) OFF1)  ; side elevation from insert point
)
(setq C2 (POLAR C1 (DTR 90.0) WB)
)
(setq C2A (POLAR C2 (DTR 180.0) TEN)
)
(setq C2B (POLAR C2A (DTR 270.0) TEN)
)
(setq C2C (POLAR C2B (DTR 0.0) TEN)
)
(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) FIVE)
)
(setq C14 (POLAR C1 (DTR 180.0) CWT)
)
(setq C15 (POLAR C14 (DTR 90.0) CEG)
)
(setq C16 (POLAR C14 (DTR 0.0) TEN)
)
(setq C17 (POLAR C16 (DTR 0.0) SIX)
)
(setq C18 (POLAR C17 (DTR 0.0) SIX)
)

 

Example:

 


Change this
(setq J2 (+ STW TWO))    ; jamb rebate and clearance

To this
(setq J2 (+ STW 2.0))    ; jamb rebate and clearance

And you don't need this
(setq TWO (atof "2")  ; entering numbers this way due to number of errors from straight numbers  

There is no point in doing this in the first place.

 

Do you get my point?

Posted

If those are constants, Then enter them in as reals.

Posted
If those are constants, Then enter them in as reals.

 

You only need to pass it to a variable when a constant does not apply and need to supply your calculations with a random number.

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