Author Topic: Diffuser lisp  (Read 6140 times)

0 Members and 1 Guest are viewing this topic.

CAB

  • Global Moderator
  • Seagull
  • Posts: 10401
Re: Diffuser lisp
« Reply #15 on: October 05, 2005, 12:15:15 AM »
As Mark said his code was to get the user started toward his own code.
This too is a simple offering.

Code: [Select]
(defun c:diffu (/ usrcmd size_h size_w p1 bang bdiag layer_setup)

  (defun layer_setup (lyr Clr ltype)
    (if (tblsearch "LAYER" lyr)
      (command "._Layer" "_Thaw" lyr "_On" lyr "_UnLock" lyr "_Set" lyr "")
      (command "._Layer" "_Make" lyr "_Color" (if (= Clr "") "_White" Clr) lyr
              "LT" (if (= ltype "") "Continuous" ltype) lyr "")
    )
  )

  (setq usrcmd (getvar "cmdecho"))
  (setvar "cmdecho" 0)
  (layer_setup "_diffuser" "1" "")

  (if (and
        (setq size_h (getdist "\nHeight: "))
        (setq size_w (getdist "\nWidth: "))
      )
    (progn
      (setq p1    (getvar "viewctr")
            bang  (atan size_h size_w)
            bdiag (* (/ 1 (cos bang)) size_w)
      )
      (command "_.rectangle" p1 (polar p1 bang bdiag))
      (prompt "\nPick Insertion Point: ")
      (command "._move" (entlast) "" p1 pause)
      (prompt "\nPick Angle: ")
      (command "._rotate" (entlast) "" (getvar "lastpoint") pause)
    )
  )
  (setvar "cmdecho" usrcmd)
  (princ)
)
(prompt "\nDiffuser Loaded, Enter diffu to run.")
(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.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Diffuser lisp
« Reply #16 on: October 10, 2005, 11:26:43 PM »
I am looking for a lisp routine that will let me insert a diffuser/grille to the size I specifie, like an 8x6, 12x8 etc. plus create a layer name. Any help email me gab@sweng.com. Thanks alot

Hi,

I have created many standards for many HVAC engineering firms and contractors
with all my experience in this field. I suggest you this..


If you have a layer standard in your company.
make a block containing a diffuser with 1 unit "X" by 1 unit "Y"
this block must be created NOT IN LAYER "0"...
create this block on layer "-Diffusers" color "ByBlock" Linetype "Byblock"
and call it "D1".

let me explain...

ALL HVAC design with reflected ceiling must be coordinated with
lightning, sprinkler, speaker and all other stuff in reflected ceiling right ?

so if you have a drawing with an Xref containing the reflected ceiling...
and you have also the lighting in Xref....from your workmate to make good coordination...

you can insert your diffuser block "D1" in your curren layer...eg:
if you are in layer "M-VENT-N"  (Mechanical VENTilation New)
your diffuser will be in the same layer but have created the "-diffusers" Layer
over the layer "0".

this will allow you to have the complete reflected ceiling with all your diffuser
by putting your current layer to "OFF". (M-VENT-N).

this is s simple way to insert your diffuser without changing layer or create another.

Also why put the "-" before the name ??
this is also a simple way to detect some block layer and goes all over the "0" layer list.

If you need to calculate the number of diffusers...I suggest you also to not explode the block.
but make sure to insert the good block...
eg:

eggcrate, EH_Price_Model or Titus_model and so on...
this will be more simple to claculate how many diffuser of each you need for your project.


this is was my suggestion. 8-)


Keep smile...

Royalchill

  • Guest
Re: Diffuser lisp
« Reply #17 on: December 13, 2005, 03:00:00 PM »
good discussion. there was guy on the augi site nammed fatty from russia who wrote this. works greate. Thanks all

Code: [Select]
;===================================================================;

(defun coords-from-center (ptc xscl yscl /  len  wid )
  (setq len (* 0.5 xscl)
        wid (* 0.5 yscl)
ptc (trans ptc 1 0)
        p1 (list (- (car ptc) len)(- (cadr ptc) wid)(caddr ptc))
        p3 (list (+ (car ptc) len)(+ (cadr ptc) wid)(caddr ptc))
        p2 (list (car p3)(cadr p1)(caddr ptc))
        p4 (list (car p1)(cadr p3)(caddr ptc)))
        (list p1 p2 p3 p4))

;===================================================================;

(defun C:dff (/ *error* call ccr clr dfc-err info ipt
       olderr opw osm p1 p2 p3 p4 xscl yscl)

(setq olderr *error*
*error* dfc-err)
(setvar "cmdecho" 0)
(command "._undo" "_g") 
(setq osm (getvar "osmode")) 
(setq opw (getvar "plinewid"))
(setq clr (getvar "clayer"))
(setq ccr (getvar "cecolor")) 
(setvar "plinewid" 0.0)
(setvar "osmode" 0) 
 
  (defun layer_set (lyr col ltp)
  (if (tblsearch "layer" lyr)
  (command "._-layer" "t" lyr "u" lyr "on" lyr  "s" lyr "")
  (command "._-layer" "row" lyr "c" col lyr "lt" ltp lyr "")))

  (layer_set "m-diff" "3" "Continuous")
 
;;==============================================================================;;
 
(while (or   
(initget "Supply Return Exhaust")
(setq call (getkword "\n\tChoose the diffuser > Supply, Return or Exhaust :")))

(if call
(progn
(setq xscl (getreal "\n\tX dimension < 1.0 > ?? :\n"))
(if (not xscl)(setq xscl 1.))

(setq yscl (getreal "\n\tY dimension < 1.0 > ?? :\n"))
(if (not yscl)(setq yscl 1.))

(setvar "osmode" 32)
(initget 1)
(setq ipt (getpoint "\n\tInsertion point :\n"))

(setq info (coords-from-center ipt xscl yscl))

(setq p1 (car info)
      p2 (cadr info)
      p3 (caddr info)
      p4 (last info))


(setvar "clayer" "m-diff")
(setvar "cecolor" "bylayer")
(cond ((eq call "Supply")
       (command "._pline")
       (mapcar 'command (list p1 p4 p3 p1 p2 p4 p3 p2))(command ""))
      ((eq call "Return")
       (command "._pline")
       (mapcar 'command (list p1 p2 p3 p1 p4 p3))(command ""))
      ((eq call "Exhaust")
       (command "._pline")
       (mapcar 'command (list p1 p4 p3 p1 p2 ipt p3 p2))(command "")))
)))
(command "._undo" "_e") 
(setvar "plinewid" opw) 
(setvar "osmode" osm)
(setvar "clayer" clr)
(setvar "cecolor" ccr) 
(setvar "cmdecho" 1)
(setq *error* olderr) 
(princ)
)

(defun dfc-err  (s)
  (princ (strcat "\nError: " s))
  (command "._undo" "_e")
  (setvar "cmdecho" 1)
  (setvar "plinewid" opw) 
  (setvar "osmode" osm)
  (setvar "clayer" clr)
  (setvar "cecolor" ccr)
  (setq *error* olderr)
  (princ))

(prompt "\n\t***\tType DFC to execute...\t***\n")
(princ)
;=======================================================================;


Edit - CAB added code tags.
« Last Edit: December 13, 2005, 03:06:58 PM by CAB »