+ Reply to Thread
Page 3 of 4 FirstFirst 1 2 3 4 LastLast
Results 21 to 30 of 40

Thread: HVAC drawings

  1. #21
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Registered forum members do not see this ad.

    Viv,

    I did not mess around with the code as much as i should have. I took for granted that the figure for object snap mode 128 was what you wanted as I saw this in your code. After lookung it up, It only sets perpedicular snap to be active. There are two locations in the code where the snaps are turned on.

    Befor selecting the insertion point and Before rotating the object.

    I do not think this will cut it for you. I set the object snap for these as follows.

    Code:
    (setvar "osmode" 16383) ;Turn on all object snaps
    You can edit this yourself or download the attached zip.
    Sorry about that, But I should have tested it more.

    This section on object snap mode is from the Acad Help Section.

    Type: Integer
    Saved in: Registry
    Initial value: 4133

    Sets running Object Snap modes using the following bitcodes:

    0 NONe
    1 ENDpoint
    2 MIDpoint
    4 CENter
    8 NODe
    16 QUAdrant
    32 INTersection
    64 INSertion
    128 PERpendicular
    256 TANgent
    512 NEArest
    1024 QUIck
    2048 APParent Intersection
    4096 EXTension
    8192 PARallel

    To specify more than one object snap, enter the sum of their values. For example, entering 3 specifies the Endpoint (bitcode 1) and Midpoint (bitcode 2) object snaps. Entering 16383 specifies all object snaps.

    When object snaps are switched off using the Osnap button on the status bar, a bitcode of 16384 (0x4000) is returned, in addition to the normal value of OSMODE. With this additional value, developers can write applications for AutoCAD, and distinguish this mode from Object Snap modes that have been turned off from within the Drafting Settings dialog box. Setting this bit toggles running object snaps off. Setting OSMODE to a value with this bit off toggles running object snaps on.
    Attached Files

  2. #22
    Senior Member viviancarvalho's Avatar
    Discipline
    HVAC
    viviancarvalho's Discipline Details
    Occupation
    Draughtsman HVAC
    Discipline
    HVAC
    Using
    AutoCAD 2010
    Join Date
    Oct 2009
    Location
    Bahrain
    Posts
    152

    Default

    Hey Buzz
    I liked that attitude too much & also the concept.

    A LIGHTED CANDLE LOOSES NOTHING BY LIGHTING ANOTHER ONE

    Thanks once again

  3. #23
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Quote Originally Posted by viviancarvalho View Post
    Hey Buzz
    I liked that attitude too much & also the concept.

    A LIGHTED CANDLE LOOSES NOTHING BY LIGHTING ANOTHER ONE

    Thanks once again

    I like that!

    Anyway, We are not quite done yet. We can take this code beyond what you have seen so far. I was thinking of DCL (Dialog Control Langage) with preset user inputs that you just select from a list and of course the settings will be remembered each time. We can also have attributes in the block that will be filled in automatically based on the user selection. The program will also have a built-in loop function keeping the program running if you have more than one block you wish to put in. When you are done, Just hit the Cancel button. And finally we can add an image of the object that changes display also based on the user selection as well giving the user confirmation as to what is suppose to show up. The block name can also be present on the dialog also based on selection as well.

    I know this sounds like alot, But it is possible. Some parts of the main function will look completely different since the program needs to communicate with the dialog. This will give you plenty to digest, But it will show you what some persistence can do. A program designed in this manner helps to prevent all possible user errors and speeds up the process of getting your work done much faster than a command prompt type program.

    This will be your ultimate program. You would just need to supply me with some information such as standard metric size grilles and the name of your text layer for the attributes.

    Below in my signature, The first program will give you an idea as to what I mean. You only need to make sure that both files are in the acad support search path.

    I hope you are up to this.
    The Buzzard

  4. #24
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    To give you an idea of program looping, I modified the SAG4.lsp to SAG5.lsp and installed a Program Loop Function. I am sure you know that this is your program with a loop and no DCL.

    I am sorry for taking you down such a long road, But I wish for you to absorb this in smaller pieces to make this easier on you.

    See the attached SAG5.lsp zip file and take this one for a test to see if you like it. It sure beats typing the program syntax over and over when you have many of these objects to put in place. The program ends when you decide to end it. What you are witnessing is your program evolving very quickly.

    As far as the DCL I mentioned, I will leave that up to you to decide if you want to go down that road.

    Enjoy this one for now,
    The Buzzard
    Attached Files

  5. #25
    Senior Member viviancarvalho's Avatar
    Discipline
    HVAC
    viviancarvalho's Discipline Details
    Occupation
    Draughtsman HVAC
    Discipline
    HVAC
    Using
    AutoCAD 2010
    Join Date
    Oct 2009
    Location
    Bahrain
    Posts
    152

    Default

    Buzz .
    This is a nice one. The basic goal for developing this program was to save time that is spent in finding the right size block everytime. I just got the idea started off & came a long way with you in more better way than i ever imagined.But i dont want to go ahead for DCL. The reason for this is ,it will increase the user input time. In any type of HVAC dwg i make i ve to insert a number of blocks. Actually just drawing them using lisp is easy but i wanted to convert these into blocks that are named depending on their sizes. So that after i finish the dwg i can get the quantities using the "BCOUNT" command. Now i am heading towards some other blocks which i want to be treated in the same way. I ll try to do it myself till i get stuck. You are always there with a helping hand.

    Thanks & regards
    Vivian.

  6. #26
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Quote Originally Posted by viviancarvalho View Post
    Buzz .
    This is a nice one. The basic goal for developing this program was to save time that is spent in finding the right size block everytime. I just got the idea started off & came a long way with you in more better way than i ever imagined.But i dont want to go ahead for DCL. The reason for this is ,it will increase the user input time. In any type of HVAC dwg i make i ve to insert a number of blocks. Actually just drawing them using lisp is easy but i wanted to convert these into blocks that are named depending on their sizes. So that after i finish the dwg i can get the quantities using the "BCOUNT" command. Now i am heading towards some other blocks which i want to be treated in the same way. I ll try to do it myself till i get stuck. You are always there with a helping hand.

    Thanks & regards
    Vivian.

    Not a problem, But a DCL is just as fast and more reliable in terms of correct user input and all inputs are in one place so you do not need to anticipate what prompts are going to be next. The methods you have now put you in a very good position to make other programs of the same nature and still will be big time savers.

    You are off to a good start.
    So thats it for now.
    Good Luck with your programs.
    The Buzzard

  7. #27
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Viv,

    I made some more revisions to your program. Essentially the program works the same, However I found some minor things that could be changed to improve the performance of the code.

    If you have any questions about this, I will be glad to answer.
    I just want to make sure your code is set to work as best as possible and for you to have a proper example to work from.

    All revisions are listed in your header and this code is now SAG6.lsp

    Here is the header:
    Code:
    ;/////////////////////////////////////////////////////////////////////////////////////////
    ;;;
    ;;; Program Name: SAG6.lsp 10/29/09
    ;;;
    ;;; Author: Vivian Carvalho
    ;;;
    ;;; Program Description: Supply Air Grille Lisp
    ;;;
    ;;; Creates Metric Supply Air Grilles as a block.
    ;;; Program starts by saving all user settings. The program then draws a short extension
    ;;; of the duct as lines and inserts the grille at the end of the duct. Just enter size
    ;;; in mm, flow direction L ~ Left or R ~ Right and insertion point. After insertion you
    ;;; are requested for a rotation angle. The program will then loop requesting a Y ~ Yes or
    ;;; N ~ No if you wish to continue or not. When the program ends, It will restore all
    ;;; user Settings.
    ;;;
    ;;; Command Syntax: SAG6
    ;;;
    ;;; Note: Variables with # at the end indicate Integer.
    ;;;       Variables with $ at the end indicate String.
    ;;;
    ;;;
    ;;; Revisions - 11/05/09:
    ;;;
    ;;; 1. Changed getreal to getint in the Grille Width input.
    ;;; 2. Changed all if statements to cond.
    ;;; 3. Added # & $ to variables that handle numbers & strings.
    ;;; 4. Relocated Layer call before the block tblsearch & move it before the insert command.
    ;;; 5. Removed insert, layer call & select command from the end of block definition function.
    ;;; 6. Renamed program & local functions from SAG5 to SAG6.
    ;;;____________________________________________________
    ;;;| No. | Function Name | Function Description        |
    ;;;|_____|_______________|_____________________________|
    ;;;| F01 | SAG6          | Start-Up Function           |
    ;;;| F02 | SAG6_MF       | Main Function               |
    ;;;| F03 | SAG6_PL       | Program Loop Function       |
    ;;;| F04 | SAG6_RUS      | Restore User Settings       |
    ;;;| F05 | SAG6_BD       | Block Definition Function   |
    ;;;| F06 | SAG6_DTR      | Degrees To Radians Function |
    ;;;| F07 | SAG6_ML       | Make Layer Function         |
    ;;;| F08 | SAG6_SET      | Set Error Trap Function     |
    ;;;
    ;/////////////////////////////////////////////////////////////////////////////////////////
    And here is the attached lisp:
    Attached Files

  8. #28
    Senior Member viviancarvalho's Avatar
    Discipline
    HVAC
    viviancarvalho's Discipline Details
    Occupation
    Draughtsman HVAC
    Discipline
    HVAC
    Using
    AutoCAD 2010
    Join Date
    Oct 2009
    Location
    Bahrain
    Posts
    152

    Default

    Thanks for that buzz.
    After this job done i made another program for square diffusers. It works as i want it to be without any errors. Only thing is that i want to add an "error trap" to it. Inspite of going through notes & tutorials i m not able to get it done all by myself. Can you just add an error trap to my this program without changing it. That would give me an better idea.

    ; SUPPLY AIR DIFFUSER
    ;
    ;Lisp to draw SUPPLY DIFFUSER of the size desired by the user
    ;Type sad, you will have to click on the insertion point.
    ;later just type in the size you want
    ;eg: Type 300 for a sad of (300x300) size.
    ;It will also draw a branch & boot top which needs to be edited by the user.
    (defun c:sad(/ r1 r2 r3 r4 l1 ha hao hat ha1 hao1 hat1 ha2 hao2 hat2
    ha3 hao3 hat3 insp sz p1 p2 p3 p4 p5 p6 p7 p8 ce osm clyr insp
    l1 l2 pt1 pt2 pt3 pt4 pt5 pt6 pt7 pin pin1 pp1 pp2 pp3 pp4 pp5 pp6
    pp7 pin2 ppp1 ppp2 ppp3 ppp4 ppp5 ppp6 ppp7 pin3 pppp1 pppp2
    pppp3 pppp4 pppp5 pppp6 pppp7 bnm)
    (princ "\n Program by Vivian Carvalho")
    (setq insp(getpoint "\nSpecify the insertion point : ")
    sz(getdist "\nSpecify the size : ")
    p1(polar insp 0.7853979 (sqrt (+(*(/ sz 2)(/ sz 2))(*(/ sz 2)(/ sz 2)))))
    p2(polar insp 3.926989 (sqrt (+(*(/ sz 2)(/ sz 2))(*(/ sz 2)(/ sz 2)))))
    p3(polar p1 3.926989 (* 0.189 sz))
    p4(polar p2 0.7853979 (* 0.189 sz))
    p5(polar p3 3.926989 (* 0.189 sz))
    p6(polar p4 0.7853979 (* 0.189 sz))
    p7(polar p5 3.926989 (* 0.189 sz))
    p8(polar p6 0.7853979 (* 0.189 sz))
    ce(getvar "cmdecho")
    osm(getvar "osmode")
    clyr(getvar "clayer"))
    (if (null(tblsearch "layer" "DIFFUSERS"))
    (command "layer" "n" "DIFFUSERS" "color" "72" "DIFFUSERS" "")
    (princ))
    (command "osmode" 0)
    (command "cmdecho" 0)
    (command "rectang" p1 p2)
    (setq r1(entlast))
    (command "rectang" p3 p4)
    (setq r2(entlast))
    (command "rectang" p5 p6)
    (setq r3(entlast))
    (command "rectang" p7 p
    (setq r4(entlast))
    (command "line" p1 p2"")
    (setq l1(entlast))
    (command "mirror" l1"" insp (polar insp 1.570796 (/ sz 2)) "n")
    (setq l2(entlast)
    pin(polar insp 1.570796 (+(/ sz 2)(* sz 0.22))) ;top arrow
    pt1(polar pin 3.141592 (* sz 0.06))
    pt2(polar pin 0.0 (* sz 0.06))
    pt3(polar pt1 1.570796 (* sz 0.416))
    pt4(polar pt2 1.570796 (* sz 0.416))
    pt5(polar pt3 3.141592 (* sz 0.1))
    pt6(polar pt4 0.0 (* sz 0.1))
    pt7(polar pin 1.570796 (* sz 0.717)))
    (command "pline" pin "w" "0" "0" pt2 pt4 pt6 pt7 "c")
    (setq ha(entlast))
    (command "pline" pin "w" "0" "0" pt1 pt3 pt5 pt7 "")
    (setq hao(entlast))
    (command "-hatch" "p" "s" "s" ha "" "")
    (setq hat(entlast)
    pin1(polar insp 0.0 (+(/ sz 2)(* sz 0.22))) ;right arrow
    pp1(polar pin1 1.570796 (* sz 0.06))
    pp2(polar pin1 4.712387 (* sz 0.06))
    pp3(polar pp1 0.0 (* sz 0.416))
    pp4(polar pp2 0.0 (* sz 0.416))
    pp5(polar pp3 1.570796 (* sz 0.1))
    pp6(polar pp4 4.712387 (* sz 0.1))
    pp7(polar pin1 0.0 (* sz 0.717)))
    (command "pline" pin1 "w" "0" "0" pp2 pp4 pp6 pp7 "c")
    (setq ha1(entlast))
    (command "pline" pin1 "w" "0" "0" pp1 pp3 pp5 pp7 "")
    (setq hao1(entlast))
    (command "-hatch" "p" "s" "s" ha1 "" "")
    (setq hat1(entlast)
    pin2(polar insp 4.712387 (+(/ sz 2)(* sz 0.22))) ;down arrow
    ppp1(polar pin2 0.0 (* sz 0.06))
    ppp2(polar pin2 3.141592 (* sz 0.06))
    ppp3(polar ppp1 4.712387 (* sz 0.416))
    ppp4(polar ppp2 4.712387 (* sz 0.416))
    ppp5(polar ppp3 0.0 (* sz 0.1))
    ppp6(polar ppp4 3.141592 (* sz 0.1))
    ppp7(polar pin2 4.712387 (* sz 0.717)))
    (command "pline" pin2 "w" "0" "0" ppp2 ppp4 ppp6 ppp7 "c")
    (setq ha2(entlast))
    (command "pline" pin2 "w" "0" "0" ppp1 ppp3 ppp5 ppp7 "")
    (setq hao2(entlast))
    (command "-hatch" "p" "s" "s" ha2 "" "")
    (setq hat2(entlast)
    pin3(polar insp 3.141592 (+(/ sz 2)(* sz 0.22))) ;left arrow
    pppp1(polar pin3 4.712387 (* sz 0.06))
    pppp2(polar pin3 1.570796 (* sz 0.06))
    pppp3(polar pppp1 3.141592 (* sz 0.416))
    pppp4(polar pppp2 3.141592 (* sz 0.416))
    pppp5(polar pppp3 4.712387 (* sz 0.1))
    pppp6(polar pppp4 1.570796 (* sz 0.1))
    pppp7(polar pin3 3.141592 (* sz 0.717)))
    (command "pline" pin3 "w" "0" "0" pppp2 pppp4 pppp6 pppp7 "c")
    (setq ha3(entlast))
    (command "pline" pin3 "w" "0" "0" pppp1 pppp3 pppp5 pppp7 "")
    (setq hao3(entlast))
    (command "-hatch" "p" "s" "s" ha3 "" "")
    (setq hat3(entlast))
    (command "change" r1 r2 r3 r4 l1 l2 ha hao hat ha1 hao1 hat1
    ha2 hao2 hat2 ha3 hao3 hat3"" "p" "la" "DIFFUSERS" "")
    (setq bnm (strcat "Sdiff" (rtos sz 2 0)))
    (if (null(tblsearch "block" bnm))
    (progn (command "block" bnm insp "previous" "")
    (command "insert" bnm insp "1" "1" "0"))
    (progn (command "erase" "previous" "")
    (command "insert" bnm insp "1" "1" "0")))
    (if (null(tblsearch "layer" "DUCTING"))
    (command "layer" "n" "DUCTING" "c" "magenta" "DUCTING" "")
    (princ))
    (setq ct1(polar p1 1.570796 150)
    c1(polar ct1 0.0 25)
    c2(polar c1 3.141592 (+ sz 50))
    c3(polar c1 4.712387 (- (* sz 3) 100))
    c4(polar c2 4.712387 (* sz 3))
    c5(polar c4 0.0 (+ sz 150))
    c6(polar c2 4.712387 (- (* sz 3) 100)))
    (command "pline" c4 "w" "0" "0" c2 c1 c3 c5 "")
    (setq bpl(entlast))
    (command "line" c3 c6 "")
    (setq bt(entlast))
    (command "change" bpl bt "" "p" "la" "DUCTING" "")
    (command "clayer" clyr)
    (command "osmode" osm)
    (command "cmdecho" ce)
    (princ))

  9. #29
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Hey Viv,

    Great to see you are still at it.
    I will have something for you later, I have a doctors appointment this morning, So when I get back, I get started on this for you.

    I noticed when I run your program shown here, It seems to have a bracket out of place or something else.

    Command: _appload SAD.lsp successfully loaded.
    Command: ; error: malformed list on input

    I will look at this of course first.
    Please check your posted code and make sure everything is OK.

    I contact you later in the day.

    The Buzzard

    Also please note, I am working on some sort of an HVAC duct program with many options. I am taking my time on this one to make sure I get this right. I am doing this as blocks with attributes to get a material take-off. I will be posting some time in the distant future.

    Keep an eye out for it.

  10. #30
    Forum Deity
    Using
    AutoCAD 2009
    Join Date
    Oct 2008
    Posts
    2,112

    Default

    Registered forum members do not see this ad.

    I noticed a Kool Face in your code above.

    When posting codes please use the advanced options and paste the code between code brackets using the # icon.

    That should avoid these problems.

    In any event, This is what I am getting now:

    Command:
    SAD
    Program by Vivian Carvalho
    Specify the insertion point :
    Specify the size : 300
    layer
    Current layer: "0"
    Enter an option
    [?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
    n
    Enter name list for new layer(s): DIFFUSERS Enter an option
    [?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
    color
    New color [Truecolor/COlorbook] <7 (white)>: 72
    Enter name list of layer(s) for color 72 <0>: DIFFUSERS Enter an option
    [?/Make/Set/New/ON/OFF/Color/Ltype/LWeight/Plot/Freeze/Thaw/LOck/Unlock/stAte]:
    Command: Unknown command "-HATCH". Press F1 for help.
    Unknown command "P". Press F1 for help.
    Unknown command "S". Press F1 for help.
    Unknown command "S". Press F1 for help.
    <Entity name: 7EF65040>
    Unknown command "SAD". Press F1 for help.
    Unknown command "SAD". Press F1 for help.
    Unknown command "SAD". Press F1 for help.
    Unknown command "-HATCH". Press F1 for help.
    Unknown command "P". Press F1 for help.
    Unknown command "S". Press F1 for help.
    Unknown command "S". Press F1 for help.
    <Entity name: 7EF65050>
    Unknown command "SAD". Press F1 for help.
    Unknown command "SAD". Press F1 for help.
    Unknown command "SAD". Press F1 for help.
    Unknown command "-HATCH". Press F1 for help.
    Unknown command "P". Press F1 for help.
    Unknown command "S". Press F1 for help.
    Unknown command "S". Press F1 for help.
    <Entity name: 7EF65060>
    Unknown command "SAD". Press F1 for help.
    Unknown command "SAD". Press F1 for help.
    Unknown command "SAD". Press F1 for help.
    Unknown command "-HATCH". Press F1 for help.
    Unknown command "P". Press F1 for help.
    Unknown command "S". Press F1 for help.
    Unknown command "S". Press F1 for help.
    <Entity name: 7EF65070>
    Unknown command "SAD". Press F1 for help.
    Unknown command "SAD". Press F1 for help.
    Unknown command "SAD". Press F1 for help.
    Command: Z
    ZOOM
    Specify corner of window, enter a scale factor (nX or nXP), or
    [All/Center/Dynamic/Extents/Previous/Scale/Window] <real time>: A
    Regenerating model.


    Seem like a problem at the moment with the hatch command.

Similar Threads

  1. HVAC Software
    By S.P.I in forum Catch All
    Replies: 7
    Last Post: 9th Jan 2010, 08:29 pm
  2. Hvac
    By versegi in forum AutoCAD Drawing Management & Output
    Replies: 3
    Last Post: 5th Oct 2009, 05:44 am
  3. HVAC...
    By Dave-CSMW in forum AutoCAD Drawing Management & Output
    Replies: 4
    Last Post: 26th Sep 2009, 01:10 pm
  4. Hvac Duvting
    By keithozim in forum Mechanical
    Replies: 17
    Last Post: 15th Jan 2009, 02:06 am

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts