Jump to content

HVAC Ducting Program


The Buzzard

Recommended Posts

An example for you to try:

 

(defun c:test (/ line pt1 pt2)

 (defun line (p1 p2 c)
   (entmake (list (cons 0 "LINE")
                  (cons 10 p1) (cons 11 p2) (cons 62 c))))

 (command "_.ucs" "")
 (command "_.ucs" "_z" 45)

 (if (and (setq pt1 (getpoint "\nPick Point 1: "))
          (setq pt2 (getpoint "\nPick Point 2: " pt1)))

   (progn 
     (line pt1 pt2 1) ;; RED
     (line (trans pt1 1 0) (trans pt2 1 0) 3))) ;; GREEN

 (princ))

 

Lee,

 

I got it to work correctly now, But the Automatic snapang I set in the program only works in world. I cannot get the cursor to rotate with the UCS rotated. I am not sure why.

Link to comment
Share on other sites

Lee,

 

I got it to work correctly now, But the Automatic snapang I set in the program only works in world. I cannot get the cursor to rotate with the UCS rotated. I am not sure why.

 

SnapAng seems to work fine for me with a rotated UCS - what are you trying?

 

PS> With the example above, do you now see the consequences of not using trans?

Link to comment
Share on other sites

SnapAng seems to work fine for me with a rotated UCS - what are you trying?

 

PS> With the example above, do you now see the consequences of not using trans?

I see what you mean now, But I set snapang at then end of each function.

 

For example, If I place a rectangular duct in the direction of 90 degrees and add a 45 degree elbow at the end of that duct, I have snapang adjust the cursor to the outlet angle of the elbow automatically. This does not seem to work well when the UCS is rotated.

Link to comment
Share on other sites

This or something similar is at the end of each output function to adjust the cursor.

 

  (cond ((= SAM$ "1")(setvar "snapang" (angle CL01# CL02#))))

Link to comment
Share on other sites

I suppose it differs for those that use the UCS to draw, and those that use SNAPANG.

 

 

The funny thing is if I set the snapang with the UCS rotated, It works correctly. Just will not work when the program sets it.

Link to comment
Share on other sites

The funny thing is if I set the snapang with the UCS rotated, It works correctly. Just will not work when the program sets it.

 

Is it mandatory that the program sets it? Can't the user decide whether he/she wants it to be set, or whether they want to use the UCS?

Link to comment
Share on other sites

The funny thing is if I set the snapang with the UCS rotated, It works correctly. Just will not work when the program sets it.

I guess I will need to indicate this in the instructions. I have a toggle for the purpose of shutting off the Automatic Snapang if the user want to set it themselves.

 

Otherwise it works great in world.

Link to comment
Share on other sites

Lee;

 

Just in case I forgot.

Thanks for the help on this one.

I have other things now to deal with on this code now.

But I should be OK.

Link to comment
Share on other sites

Lee;

 

Just in case I forgot.

Thanks for the help on this one.

I have other things now to deal with on this code now.

But I should be OK.

 

Not a problem, happy to offer advice as always. :)

Link to comment
Share on other sites

Hello Again,

 

Well, The Metric version is finally done, However it is a separate program. I was going to combine the two, But changed my mind on this for now.

 

Its been a while for me since I had done some metric work, So I would advise you to give me feed back on the construction of the fittings, The text sizes and anything else you can find. I will fix this accordingly.

 

Like the Imperial program, This one also has extensive error trapping to prevent the user from making duct & fittings too small that they look distorted. The Transition will not allow you to make the outlet larger than the inlet and so on. Please test this code completely.

 

For a copy of the Imperial program go to the first post or click this link: http://www.cadtutor.net/forum/showthread.php?t=44550

 

Command Syntax: RMD2

 

Attention!

Revision Date: February 21, 2010

RMD2_V3 has been revised to RMD2_V4.lsp and RMD2_V4.dcl

 

;/////////////////////////////////////////////////////////////////////////////////////////
;;;
;;; Do Not Remove This Header!
;;;
;;; Revisions
;;;
;;; No. | Description                                                        | Date
;;;=====|====================================================================|===========
;;; 1.0 | Removed all entity lists from functions RMD_HUCT thru RMD_FCON     | 02|18|10
;;; --- | Added RMD2_DFL, RMD2_IL and RMD2_DE Functions                      | --------
;;;=====|====================================================================|===========
;;; 2.0 | Added User Defined inside elbow radius and error trapping          | 02|19|10
;;;=====|====================================================================|===========
;;; 3.0 | Added a \ to all instances of the degree character in the dcl      | 02|20|10
;;; --- | ------------------------------------------------------------------ | --------
;;;=====|====================================================================|===========
;;; 4.0 | Modified RMD2_FS Function to use default font style                | 02|21|10
;;; --- | ------------------------------------------------------------------ | --------
;/////////////////////////////////////////////////////////////////////////////////////////

To modify the metric program to suit your layers, colors, linetype, lineweight, font style and text height, look for these functions in the program and edit there or post me and I will give you instructions.

 

;/////////////////////////////////////////////////////////////////////////////////////////
;
; F25 - Make Layer Function.
;
(defun RMD2_ML ()
 (if (or (= ITYP$ "INTERNAL")(= ITYP$ "EXTERNAL")(= ITYP$ "BOTH"))
   (or (tblsearch "ltype" "DUCT_INSL")
       (entmake
         (list
           (cons 0   "LTYPE")
           (cons 100 "AcDbSymbolTableRecord")
           (cons 100 "AcDbLinetypeTableRecord")
           (cons 2   "DUCT_INSL")
           (cons 70   0)
           (cons 3   "Duct Insulation _ _ _ _ _ _ _ ")
           (cons 72   65)
           (cons 73   2)
           (cons 40   1.190625)
           (cons 49   0.79375)
           (cons 74   0)
           (cons 49  -0.396875)
           (cons 74   0)))))
 (cond                                        ;Layer Name               Layer Color     Linetype                 Lineweight
   ((and (= DSYS$ "SUPPLY") (= LATYP$ "DUCT")(setq LNAM$ "M-HVACSUM")(setq LCLR#   4)(setq LTYP$ "Continuous")(setq LWGT# 50)))
   ((and (= DSYS$ "SUPPLY") (= LATYP$ "INSL")(setq LNAM$ "M-HVACINM")(setq LCLR#   1)(setq LTYP$ "DUCT_INSL") (setq LWGT# 18)))
   ((and (= DSYS$ "SUPPLY") (= LATYP$ "IDEN")(setq LNAM$ "M-HVACIDM")(setq LCLR#   6)(setq LTYP$ "Continuous")(setq LWGT# 35)))
   ((and (= DSYS$ "RETURN") (= LATYP$ "DUCT")(setq LNAM$ "M-HVACREM")(setq LCLR#  23)(setq LTYP$ "Continuous")(setq LWGT# 50)))
   ((and (= DSYS$ "RETURN") (= LATYP$ "INSL")(setq LNAM$ "M-HVACINM")(setq LCLR#   1)(setq LTYP$ "DUCT_INSL") (setq LWGT# 18)))
   ((and (= DSYS$ "RETURN") (= LATYP$ "IDEN")(setq LNAM$ "M-HVACIDM")(setq LCLR#   6)(setq LTYP$ "Continuous")(setq LWGT# 35)))
   ((and (= DSYS$ "DUST")   (= LATYP$ "DUCT")(setq LNAM$ "M-DUSTDUM")(setq LCLR# 203)(setq LTYP$ "Continuous")(setq LWGT# 50)))
   ((and (= DSYS$ "DUST")   (= LATYP$ "IDEN")(setq LNAM$ "M-DUSTIDM")(setq LCLR#   6)(setq LTYP$ "Continuous")(setq LWGT# 35)))
   ((and (= DSYS$ "EXHAUST")(= LATYP$ "DUCT")(setq LNAM$ "M-EXHSDUM")(setq LCLR#  83)(setq LTYP$ "Continuous")(setq LWGT# 50)))
   ((and (= DSYS$ "EXHAUST")(= LATYP$ "IDEN")(setq LNAM$ "M-EXHSIDM")(setq LCLR#   6)(setq LTYP$ "Continuous")(setq LWGT# 35))))
 (if (null (tblsearch "layer" LNAM$))
   (entmake
     (list
       (cons 0   "LAYER")
       (cons 100 "AcDbSymbolTableRecord")
       (cons 100 "AcDbLayerTableRecord")
       (cons 2    LNAM$)
       (cons 6    LTYP$)
       (cons 62   LCLR#)
       (cons 70   0)
       (cons 290  1)
       (cons 370  LWGT#))))
 (princ))
;
;/////////////////////////////////////////////////////////////////////////////////////////
;
; F27 - Text Size Function.
;
(defun RMD2_TS ()
 (cond
   ((= FSCL# 0)(setq TSIZ# (setvar "textsize" 300)))      ;300mm.     Height
   ((= FSCL# 1)(setq TSIZ# (setvar "textsize" 150)))      ;150mm.     Height
   ((= FSCL# 2)(setq TSIZ# (setvar "textsize"  75))))     ; 75mm.     Height
 (princ))
;
;/////////////////////////////////////////////////////////////////////////////////////////

Enjoy the program,

The Buzzard

Document1.JPG

RMD2_V4.zip

Link to comment
Share on other sites

  • 2 weeks later...

Hello Again,

 

The Rectangular Mechanical Duct Program for Imperial & Metric have been updated. Refer to post 1 for Imperial and post 52 for Metric. A list of revisions has been provided.

This should complete the list of recommended changes mentioned by Lee Mac to improve the coding.

 

Thanks Lee!

 

 

Enjoy the programs,

The Buzzard

Link to comment
Share on other sites

Hey Buzz . Thanks . This is a nice one.

hai

 

This Programme is really Good but i need small changes

elbow radious must me user defined values

for Ex Elbow Small side radius 100mm or 150mm or 200mm

That is depend on User only.. Please Update this Programme

and send my Mail id Chandra_v1@rediffmail.com

Link to comment
Share on other sites

hai

 

This Programme is really Good but i need small changes

elbow radious must me user defined values

for Ex Elbow Small side radius 100mm or 150mm or 200mm

That is depend on User only.. Please Update this Programme

and send my Mail id Chandra_v1@rediffmail.com

 

Hi vanacharlasekhar,

 

I like that idea, Originally I had a User Defined radio button for that purpose, But I had removed it. I am not sure why.

I shall put this button back in and the user will be prompted for the radius size. I will also error trap this so that if the user selects a radius that is too small, The program will alert them to this.

I will update both programs and repost to let everyone know when this has been done.

 

Thanks

 

 

 

Ah! The joys of creating and releasing programs / functions to the public.......:x

 

Hey Tim,

 

I asked for it I guess. This is not problem Tim just as long as I do not have to write a whole program like this on que.

 

Thats life on the Big Forum.

Link to comment
Share on other sites

Still, that was quite demanding.

 

Lee,

 

I appreciate the concern, However I did request feedback for the improvement of this program. I feel that idea was worth the trouble since I have some of the programming done in an earlier version that was never posted. All I am doing is adding some flexibility to the program which is good.

 

I have the Imperial version completed with this feature and all the error trapping as I post this message. I will post the program later when the Metric version is done and I put them thru their tests.

 

Thanks

Link to comment
Share on other sites

Hello All,

 

Again both codes were revised to accomodate User Defined Elbow Inside Radius's. See post 1 for Imperial version and post 52 for Metric version.

 

Enjoy the programs

The Buzzard

Link to comment
Share on other sites

Hi,

 

I tried to run this but get messages saying error in dcl file.

 

like in "line 115 newline in string constant"

 

line 115 looks like this:

 

label = "90?;

 

I thought it maybe should looks like this

 

label = "90";

 

When I try to delete the ? a " come out. Now it looks like what I thought and it works now.

 

Great!

 

Thanks

 

Cean

Link to comment
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
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...