Jump to content
The Buzzard

Pressure Vessel Dished Head Lisp

Recommended Posts

The Buzzard

Hello everyone,

 

I have another entity make program for you to try out. Back some time this type of program was requested. I noticed a couple of threads on the subject, But there was nothing quite elaborate as this program.

 

The program draws 2D ASME Coded Elliptical heads and Non-Coded Heads. It creates the head outline as a closed polyline with a thickness line. Each are placed on separated layers. There is an option to draw just the outline without the thickness line and also an option to create these heads in SI units.

 

The program has an instructions dialog and changeable images of your selections. I have provided the source coding for you to edit if you wish, But I request that if you make changes and post, Do not remove the headers and be sure to record your changes as a revision and add to the header. Please do not post changes to this thread.

 

If you are unsure about how to edit this code, I will be happy to answer your questions.

 

The command syntax for this program is DH.

See below for the attached Zip file.

 

For loading instructions see this thread: http://www.cadtutor.net/forum/showthread.php?t=1390

 

For ANSI B16.5 Flanges, See this thread:http://www.cadtutor.net/forum/showthread.php?t=48462

 

For ANSI B16.47 Flanges, See this thread:http://www.cadtutor.net/forum/showthread.php?t=48567

 

Attention!

Revision V0.4 has been uploaded. October 04, 2010

 

 

;/////////////////////////////////////////////////////////////////////////////////////////
;
; Do Not Remove This Header!
;
; Revisions
;
;-----------------------------------------------------------------------------------------
; Version | Change                                                              | Date
;-----------------------------------------------------------------------------------------
; V0.1    | Replace the dialog load in the DH_MF function with a new function.  | 04|29|10
;         | Replace mode tile in the DH_MT function with a new function.        |
;         | Replace all setvars in the DH_MF function will a new function call. |
;         | Added DH_CUS function or Change User Settings function.             |
;         | Replace all (if (or calls with (cond ( (member calls.               |
;-----------------------------------------------------------------------------------------
; V0.2    | Add Non-Coded Flanged Only Head                                     | 04|30|10
;-----------------------------------------------------------------------------------------
; V0.3    | Remove DH_PL Program Loop Function & replaced with while            | 09|17|10
;-----------------------------------------------------------------------------------------
[color=red][b]; V0.4    | Removed popup lists from dialog and replaced with edit boxes        | 10|04|10[/b][/color]
[color=red][b];         | Action_Tile modifications made to Main Function                     |[/b][/color]
[color=red][b];         | Modifcations made to Set Size Parameters Function                   |[/b][/color]
;
;/////////////////////////////////////////////////////////////////////////////////////////

Document1.JPG

DH_V4.zip

Edited by The Buzzard
Revision V0.4

Share this post


Link to post
Share on other sites
Lee Mac

A Great looking dialog Buzzard, well done :)

Share this post


Link to post
Share on other sites
The Buzzard
A Great looking dialog Buzzard, well done :)

Thanks Lee,

 

But I am not overly concerned about the dialog appearance as much as what the program does and how it does it. I would appreciate any comments concerning this. As you may realize my programming looks the same in all my programs, But its output is different. I have got some great tips from you and put it to use.

 

Thanks to you and Alan for your help before with the trig related problem for this code.

The Buzzard

Share this post


Link to post
Share on other sites
ReMark

Buzzman: I will definitely give this a try upon my return to work on Thursday. I work for a chemical manufacturing plant and a program such as this would be a real time saver. As a matter of fact I have a tank design that I need to start working on soon. Thanks a million man! :)

Share this post


Link to post
Share on other sites
The Buzzard
Buzzman: I will definitely give this a try upon my return to work on Thursday. I work for a chemical manufacturing plant and a program such as this would be a real time saver. As a matter of fact I have a tank design that I need to start working on soon. Thanks a million man! :)

Thanks Remark,

 

I myself used to work in custom built refrigeration process chiller systems for the Petrol/Chemical industry. We had an ASME shop with certified welders and design software to boot. I always wanted to make a program like this years ago, But at that time it was beyond me. I did a lot of research on this one for months making sure I had good information to work with. I would appreciate your feed back on this code if there is anything that would need adjusting.

 

Enjoy the code,

The Buzzard

Share this post


Link to post
Share on other sites
ReMark

Will do Buzzard.

 

We have the welders but no specific tank design software. For vessels operating at atmospheric pressure will sometimes elect to do the design and fabrication in house. For pressure vessels we create a fairly detailed drawing of what we want the tank to look like then send it off to a company like Roben or Highland Tank. They kick us back a fully designed tank drawing which we revise (if necessary), sign and send back for fabrication.

Share this post


Link to post
Share on other sites
The Buzzard
Will do Buzzard.

 

We have the welders but no specific tank design software. For vessels operating at atmospheric pressure will sometimes elect to do the design and fabrication in house. For pressure vessels we create a fairly detailed drawing of what we want the tank to look like then send it off to a company like Roben or Highland Tank. They kick us back a fully designed tank drawing which we revise (if necessary), sign and send back for fabrication.

My former boss would very rarely send anything out to another shop if our shop was undersized. He would make a hole in roof if it kept the job in house. Most of our ASME tanks were receivers, oil separators and suction accumulators. Having an ASME certification sure helps when you do custom fabrication and you need to stay within size constraints.

Share this post


Link to post
Share on other sites
ReMark

Did you ever design a catch tank (a.k.a. - blowdown tank) with a packed column? It would be tied into a rupture disk relief line and header.

Share this post


Link to post
Share on other sites
The Buzzard
Did you ever design a catch tank (a.k.a. - blowdown tank) with a packed column? It would be tied into a rupture disk relief line and header.

Not exactly, Although one time we did a US Government contract building a Dilimonine system for a hyperbaric chamber that could reach -75 degrees f. We needed to also build the test setup in our shop to run the unit for weeks before the government would accept the product. It required a rupture disk as well. The whole shop smell like oranges for months afterward.

Share this post


Link to post
Share on other sites
ReMark

I just noticed you're in New York city. I'm about an hour or so up I-95 from you. Coooool!

Share this post


Link to post
Share on other sites
The Buzzard
I just noticed you're in New York city. I'm about an hour or so up I-95 from you. Coooool!

I moved to here from Jersey 12 years ago to be closer to the VA hospital. That place takes up a lot of my time. I just do the programming so I won't be bored since I no longer work.

Share this post


Link to post
Share on other sites
ReMark

Well we'll just have to get together for a beer some time! I have a daughter who lives in Brooklyn (Bayridge?).

Share this post


Link to post
Share on other sites
The Buzzard
Well we'll just have to get together for a beer some time! I have a daughter who lives in Brooklyn (Bayridge?).

I keep that in mind. Look forward to seeing if you really look like your avatar.

Share this post


Link to post
Share on other sites
The Buzzard

Just a little information for you concerning head radius's.

 

The 2:1 head IDD or Inside Dish Depth can be determined by dividing the ID or Inside Diameter by 4. Note that this only applies to the 2:1 head only. This make the IDR or Inside Dish Radius slightly over 90% and the IKR or Inside Knuckle Radius slightly of 17%.

 

The other heads IDD are a result of the combination of IDR or Inside Dish Radius and IKR or Inside Knuckle Radius. These can vary from manufacturers, However the radius's used in this program are typical for the type of head they are assigned to. These values can be changed in the program if needed.

 

If you have any actual specifications concerning these dimensions, I can set the program up for you accordingly.

 

See image below.

Document4.JPG

Share this post


Link to post
Share on other sites
Lee Mac

Buzzard,

 

Just got a chance to look over your code, its pretty good, but here are a few suggestions if you wanted them:

  • You seem to be loading the dialog twice if the new_dialog call fails:

(setq DCL_ID (load_dialog "DH.dcl"))
(if (not (new_dialog "MAIN" DCL_ID))
   (cond
     ((<= (setq DCL_ID (load_dialog "DH_V0.dcl")) 0)
     (princ "\nDialog File not Found"))
     ((not (new_dialog "MAIN" DCL_ID))
     (princ "\nDialog Definition not Found"))(t)))

I would instead approach it like this perhaps:

 

 (cond (  (<= (setq DCL_ID (load_dialog "DH_V0.dcl")) 0)

          (princ "\n** Dialog File not found **"))

       (  (not (new_dialog "MAIN" DCL_ID))

          (princ "\n** Dialog Definition Not Found **"))

       (t
          (start_list "HOD")
        
           ... rest of program ...

As I say, just a suggestion - it could be achieved using IF statements and (exit) calls, but I prefer to code it this way.

  • With your Mode_tile program, it could be made more concise perhaps:

(defun DH_MT (/ MT#)
 (cond
   ((= DH:HTYP$ "ELLI")(setq MT# (list 0 0 0)))
   ((= DH:HTYP$ "8010")(setq MT# (list 0 0 0)))
   ((= DH:HTYP$ "F-D") (setq MT# (list 0 0 0)))
   ((= DH:HTYP$ "HEMI")(setq MT# (list 0 0 1)))
   ((= DH:HTYP$ "HIGH")(setq MT# (list 0 0 0)))
   ((= DH:HTYP$ "SHAL")(setq MT# (list 0 0 0)))
   ((= DH:HTYP$ "STAN")(setq MT# (list 0 0 0))))
 (mapcar (function mode_tile) '("HOD" "HTHK" "SFLG") MT#)
 (princ))

(defun DH_MT nil  
 (mapcar (function mode_tile) '("HOD" "HTHK" "SFLG")
   
   (cond (  (member DH:HTYP$ '("ELLI" "8010" "F-D" "HIGH" "SHAL" "STAN"))
          
           '(0 0 0))

         ( '(0 0 1)))))

  • Another small suggestion, instead of having to define an additional variable "BUTTON", to check if the user has clicked OK, you could use the return of the start_dialog call, and check to see whether this is 1 or 0.

  • When setting your System Variables, you already have the list of System Variables you wish to change (stored in SUS_LST), so instead of:

     (setvar "cmdecho" 0)(setvar "orthomode" 1)(setvar "osmode" (nth 2 SUS))
     (setvar "blipmode" 0)(setvar "angbase" 0)(setvar "angdir" 0)(setvar "aunits" 0)

You could use a mapcar statement using the SUS_LST variable.

  • Congrats on the TRANS :thumsup:

  • I'm not sure if this is necessary,

 (setq HOD$  (fix DH:HOD$)
       HOD$  (nth DH:HOD$ HOD_LST)

Why the fix statement?

  • Another small thing, but instead of a long list of OR statements:

(or (= HTYP$ "ELLI")(= HTYP$ "8010")(= HTYP$ "F-D")(= HTYP$ "HIGH")(= HTYP$ "SHAL")(= HTYP$ "STAN"))

You could make use of the member function (or vl-position), as in an example above.

 

 

Don't take this as me slating your code, I'm just offering some ideas :)

 

Lee

Share this post


Link to post
Share on other sites
ReMark

I'll leave the coding comments to people like Lee and others you credit in your "About" message. That stuff is beyond me at the moment.

 

However, I can say, without any doubt, that I've never drawn an ASME flanged and dished head so freakin' quickly in my years working in the chemical industry! You have just made my life so much easier I could (and did) shout for joy. It worked like a charm. All I need is your program and my dogearred copy of Bethlem Steel flanged and dished heads / volumes and dimensions code requirements and I am off to the races. I can't thank you enough Buzzard. The next time I'm NYC bound I'll let you know. Maybe there is some way we can meet up and I can buy you that beer (or two...or ???). You da man!

Share this post


Link to post
Share on other sites
The Buzzard
Buzzard,

 

Just got a chance to look over your code, its pretty good, but here are a few suggestions if you wanted them:

  • You seem to be loading the dialog twice if the new_dialog call fails:

(setq DCL_ID (load_dialog "DH.dcl"))
(if (not (new_dialog "MAIN" DCL_ID))
   (cond
     ((<= (setq DCL_ID (load_dialog "DH_V0.dcl")) 0)
     (princ "\nDialog File not Found"))
     ((not (new_dialog "MAIN" DCL_ID))
     (princ "\nDialog Definition not Found"))(t)))

I would instead approach it like this perhaps:

 

 (cond (  (<= (setq DCL_ID (load_dialog "DH_V0.dcl")) 0)

          (princ "\n** Dialog File not found **"))

       (  (not (new_dialog "MAIN" DCL_ID))

          (princ "\n** Dialog Definition Not Found **"))

       (t
          (start_list "HOD")
        
           ... rest of program ...

As I say, just a suggestion - it could be achieved using IF statements and (exit) calls, but I prefer to code it this way.

  • With your Mode_tile program, it could be made more concise perhaps:

(defun DH_MT (/ MT#)
 (cond
   ((= DH:HTYP$ "ELLI")(setq MT# (list 0 0 0)))
   ((= DH:HTYP$ "8010")(setq MT# (list 0 0 0)))
   ((= DH:HTYP$ "F-D") (setq MT# (list 0 0 0)))
   ((= DH:HTYP$ "HEMI")(setq MT# (list 0 0 1)))
   ((= DH:HTYP$ "HIGH")(setq MT# (list 0 0 0)))
   ((= DH:HTYP$ "SHAL")(setq MT# (list 0 0 0)))
   ((= DH:HTYP$ "STAN")(setq MT# (list 0 0 0))))
 (mapcar (function mode_tile) '("HOD" "HTHK" "SFLG") MT#)
 (princ))

(defun DH_MT nil  
 (mapcar (function mode_tile) '("HOD" "HTHK" "SFLG")
   
   (cond (  (member DH:HTYP$ '("ELLI" "8010" "F-D" "HIGH" "SHAL" "STAN"))
          
           '(0 0 0))

         ( '(0 0 1)))))

  • Another small suggestion, instead of having to define an additional variable "BUTTON", to check if the user has clicked OK, you could use the return of the start_dialog call, and check to see whether this is 1 or 0.

  • When setting your System Variables, you already have the list of System Variables you wish to change (stored in SUS_LST), so instead of:

     (setvar "cmdecho" 0)(setvar "orthomode" 1)(setvar "osmode" (nth 2 SUS))
     (setvar "blipmode" 0)(setvar "angbase" 0)(setvar "angdir" 0)(setvar "aunits" 0)

You could use a mapcar statement using the SUS_LST variable.

  • Congrats on the TRANS :thumsup:

  • I'm not sure if this is necessary,

 (setq HOD$  (fix DH:HOD$)
       HOD$  (nth DH:HOD$ HOD_LST)

Why the fix statement?

  • Another small thing, but instead of a long list of OR statements:

(or (= HTYP$ "ELLI")(= HTYP$ "8010")(= HTYP$ "F-D")(= HTYP$ "HIGH")(= HTYP$ "SHAL")(= HTYP$ "STAN"))

You could make use of the member function (or vl-position), as in an example above.

 

 

Don't take this as me slating your code, I'm just offering some ideas :)

 

Lee

Thanks for that Lee,

 

I will need to break some of that down and digest it before I try to use it. You know, Its odd, But some of that coding you suggested to change were changes I made from the last code you looked over. I guess you keep finding ways to shrink coding.

 

When I make another version of this code to add a feature, I shall add some of these fixes.

 

Thanks Again,

The Buzzard

Share this post


Link to post
Share on other sites
The Buzzard
I'll leave the coding comments to people like Lee and others you credit in your "About" message. That stuff is beyond me at the moment.

 

However, I can say, without any doubt, that I've never drawn an ASME flanged and dished head so freakin' quickly in my years working in the chemical industry! You have just made my life so much easier I could (and did) shout for joy. It worked like a charm. All I need is your program and my dogearred copy of Bethlem Steel flanged and dished heads / volumes and dimensions code requirements and I am off to the races. I can't thank you enough Buzzard. The next time I'm NYC bound I'll let you know. Maybe there is some way we can meet up and I can buy you that beer (or two...or ???). You da man!

 

 

That good to hear ReMark,

 

I hope you tested out some of the options as well to see if these are useful at all. As I mentioned the radius used for these heads are typical, So they should be close to accurate. I do know the 2:1 head is on the money. I plan to work on some more code for B16.5 flanges and piping as well as structural steel. I took my time with this Dished Head code to make sure I did not have to redo a lot coding, So these other codes will be coming down the pike in due time.

 

Anyway, Put the code through its paces.

Glad you like it, Enjoy the code.

The Buzzard

Share this post


Link to post
Share on other sites
Lee Mac
Thanks for that Lee,

 

I will need to break some of that down and digest it before I try to use it. You know, Its odd, But some of that coding you suggested to change were changes I made from the last code you looked over. I guess you keep finding ways to shrink coding.

 

When I make another version of this code to add a feature, I shall add some of these fixes.

 

Thanks Again,

The Buzzard

 

True, I'm always trying to find better ways to do things :)

Share this post


Link to post
Share on other sites
The Buzzard

Attention All!

 

Revision V0.1 has been uploaded to the first post.

You can review the revision list for changes.

 

 

Thank you and enjoy the code.

The Buzzard

Share this post


Link to post
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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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