Saturday, December 10, 2011

Sheetmetal developments and PIDs

This might be handy for some: How to make a flat sheet metal pattern from a 3D solid in Autocad?

Well, as far as I know, it does not do it out of the box, unlike Inventor or Solidworks. I do not have these so I have to manage somehow.

Normal transitions can be done using 3rd party programs that do that sort of thing. Unfortunately, these do not handle special cases like the round outlet being on an angle, as well as being offset.

Back to basics: just draw the object in 3D and draw a series of lines in 3D to represent the folds that you want. If your metal thickness is 3mm, you would offset everything in 1.5mm ie half, in from the outside of the finished product.

Sounds easy? It is. Sadly it is extremely time consuming and tiresome. This is where some Lispy tricks come in handy, and while it does not do the full job, it does help.

First, to draw a transition, draw a rectangle, then a circle somewhat higher. You then use the loft command to produce the 3d solid. Now it pays to change to a different layer and draw the midlines, ie those ones halfway in as mentioned above. So, for instance you would draw a rectangle on top of the original one and offset it by 1.5mm if your metal thickness was 3mm.
same for the circle. You may need to hide the original solid to get the offset command to work.

If your circle was parallel to the rectangle, you could now issue the divide command and pick the circle and divide it into 48 pieces. You will see that nothing appears to have happened after the divide command. This is now the time to change your OSNAP to endpoint, intersection and node. This last one is important because it will pick up all the nodes (points) that were put in and that you cannot see as yet.

Issue the line command and hover over parts of your circle- you should see the nodes light up as the mouse passes over them.

Draw in your development lines-this takes a while. Now you find out the length of the small arc,ie the bit between two of the nodes. This can be done by copying the circle and the nodes off a little bit an putting in some lines to the nodes and then trimming off the circle, leaving an arc.

Right click on the arc and select Properties, it will give you an arc length. Write this down.
Call it Length A.

Next, start on the development, usually handy to the 3D part so you can see both at the same time. The rectangular part edge is the best place to start. You will see that there is a triangle, and the lengths of the sides are easily found through their properties, so after drawing one side, draw two circles the radii of which are these lengths. Now draw two lines from each end of the original line to where the two circles cross. Erase the circles and you are now started.

To get the part that has all the little creases, you need to do the same again, but for one of the sides of the triangle you use length A as mentioned above. All the while you are building on the original triangle. Normally, a transition gets welded up the middle so normally half has to be drawn (or a quarter if it is symmetrical).

My lisp routine (available free if anyone is interested) allows you to pick the 3d line, then it draws a circle with the radius information from that line, which does speed things up a tiny bit.

A nice finishing touch is to put 0.5mm radius circles on every intersection around the circle and then trim them out so they appear as notches. This is so the sheetmetal guy does not have to divide them out - he just folds using the notches.

Next a bit on PIDs (Process and Instrumentation Diagrams)

If you have done any of these, you know 3 things:

1. Lines are nice to draw first, and blocks are ok to put in a drawing, but these ones always land on lines, so the inner bits have to be trimmed out.

2. There are lisp routines around that do autobreaking of the lines, but this has to be organised or downloaded or paid for. If, like me, you only do PIDs about 10% of the time, you might not bother. (Maybe I should!)

3. Autodesk make an add-on to Autocad, specifically to do PIDs. Unfortunately at NZ$3500 to upgrade from standard Autocad, and an extra NZ$300 a year this is not liable to be on the menu any time soon.

So along came one of my ideas that even I have my doubts will catch on: what if you could do a drawing just by pressing keys on your keyboard? Turns out you cannot use the arrow keys, but the rest of the keyboard is available, using a lisp routine (see below). Just issue the command PID, pick your start point, press the "o" key (make sure caps lock is OFF!) and up the line goes by 6mm. Press "l" key and off to the right it goes by 6mm. Now press 4 on the keypad-and a manual valve is inserted. Press 5 and an actuated valve is put in. "k" is to go left and "," is used to go down.

The routine uses the autcad lisp function grread - short for graphics read, which also does the keyboard. In my research trying to understand this I realised that my level of writing lisp is very low level and basic....Anyway, it does work. You could cut and paste the following code into notepad and save it as PID.lsp.

Whoops! Stop press....just tried the routine below at work and found that HP keyboards seem to have a different mapping right is 76, left is 75, up is 79. Strangely, down is still 44. Go figure.

Stop press yet again. Just realised that if you have caps lock on, then the above is the way to go.
If caps lock off, then the stuff below is OK!


(defun C:PID()
(setq initial_point (getpoint "Pick a start Point\n"))
(setq the_x (car initial_point))
(setq the_y (cadr initial_point))

(print the_x)
(print the_y)

(while (setq the_input (grread 1 5 2))

(if (eq (car the_input) 2)
(setq key_press (cadr the_input))
(print the_input)
(print key_press)
(print initial_point)
(print the_new_point)

(if (eq key_press 108) ;to the right
(setq the_x_right ( + the_x 6))
(command "_line" (list the_x the_y) (list the_x_right the_y) "")
(setq the_orient "right")
(print "x,xright,y")
(print the_x)
(print the_x_right)
(print the_y)
(setq the_x ( + the_x 6))
);end 108 progn
);end 108 if

(if (eq key_press 107) ;to the left
(setq the_x_left ( - the_x 6))
(command "_line" (list the_x the_y) (list the_x_left the_y) "")
(setq the_orient "left")
(setq the_x ( - the_x 6))
);end 107 progn
);end 107 if

(if (eq key_press 111) ;up
(setq the_y_up ( + the_y 6))
(command "_line" (list the_x the_y) (list the_x the_y_up) "")
(setq the_orient "up")
(print "y,y-up,x")
(print the_y)
(print the_y_up)
(print the_x)
(setq the_y ( + the_y 6))
);end 111 progn
);end 111 if

(if (eq key_press 44) ;down
(setq the_y_down ( - the_y 6))
(command "_line" (list the_x the_y) (list the_x the_y_down) "")
(setq the_orient "down")
(setq the_y ( - the_y 6))
);end 44 progn
);end 44 if

;--------------------INSERTING VALVE MANUAL-----------------------------

(if (and (eq key_press 52) (eq the_orient "right")) ;valve manual to the right
(command "-insert" "vmr" (list the_x the_y) "1" "1" "0")
(setq the_x ( + the_x 6))
);end 52 progn
);end 52 if

(if (and (eq key_press 52) (eq the_orient "left")) ;valve manual to the left
(command "-insert" "vml" (list the_x the_y) "1" "1" "0")
(setq the_x ( - the_x 6))
);end 52 progn
);end 52 if

(if (and (eq key_press 52) (eq the_orient "up")) ;valve manual to the up
(command "-insert" "vmr" (list the_x the_y) "1" "1" "90")
(setq the_Y ( + the_Y 6))
);end 52 progn
);end 52 if

(if (and (eq key_press 52) (eq the_orient "down")) ;valve manual to the down
(command "-insert" "vmr" (list the_x the_y) "1" "1" "-90")
(setq the_Y ( - the_Y 6))
);end 52 progn
);end 52 if

;--------------------END OF INSERTING VALVE MANUAL-----------------------------

;--------------------INSERTING NON-RETUN VALVE FORWARD -----------------------------

(if (and (eq key_press 49) (eq the_orient "right")) ;to the right
(command "-insert" "VNFR" (list the_x the_y) "1" "1" "0")
(setq the_x ( + the_x 6))
);end 49 progn
);end 49 if

(if (and (eq key_press 49) (eq the_orient "left")) ;to the left
(command "-insert" "VNFL" (list the_x the_y) "1" "1" "0")
(setq the_x ( - the_x 6))
);end 49 progn
);end 49 if

(if (and (eq key_press 49) (eq the_orient "up")) ; to the up
(command "-insert" "VNFR" (list the_x the_y) "1" "1" "90")
(setq the_Y ( + the_Y 6))
);end 49 progn
);end 49 if

(if (and (eq key_press 49) (eq the_orient "down")) ; to the down
(command "-insert" "VNFR" (list the_x the_y) "1" "1" "-90")
(setq the_Y ( - the_Y 6))
);end 49 progn
);end 49 if

;--------------------END OF INSERTING VALVE MANUAL-----------------------------

;--------------------INSERTING VALVE ACTUATED-----------------------------

(if (and (eq key_press 53) (eq the_orient "right")) ;valve to the right
(command "-insert" "var" (list the_x the_y) "1" "1" "0")
(setq the_x ( + the_x 6))
);end 53 progn
);end 53 if

(if (and (eq key_press 53) (eq the_orient "left")) ;valve to the left
(command "-insert" "val" (list the_x the_y) "1" "1" "0")
(setq the_x ( - the_x 6))
);end 53 progn
);end 53 if

(if (and (eq key_press 53) (eq the_orient "up")) ;valve to the up
(command "-insert" "var" (list the_x the_y) "1" "1" "90")
(setq the_Y ( + the_Y 6))
);end 53 progn
);end 53 if

(if (and (eq key_press 53) (eq the_orient "down")) ;valve to the down
(command "-insert" "var" (list the_x the_y) "1" "1" "-90")
(setq the_Y ( - the_Y 6))
);end 53 progn
);end 53 if

;--------------------END OF INSERTING VALVE ACTUATED-----------------------------

;--------------------INSERTING VALVE CONTROL-----------------------------

(if (and (eq key_press 54) (eq the_orient "right")) ;valve to the right
(command "-insert" "vcr" (list the_x the_y) "1" "1" "0")
(setq the_x ( + the_x 6))
);end 54 progn
);end 54 if

(if (and (eq key_press 54) (eq the_orient "left")) ;valve to the left
(command "-insert" "vcl" (list the_x the_y) "1" "1" "0")
(setq the_x ( - the_x 6))
);end 54 progn
);end 54 if

(if (and (eq key_press 54) (eq the_orient "up")) ;valve to the up
(command "-insert" "vcr" (list the_x the_y) "1" "1" "90")
(setq the_Y ( + the_Y 6))
);end 54 progn
);end 54 if

(if (and (eq key_press 54) (eq the_orient "down")) ;valve to the down
(command "-insert" "vcr" (list the_x the_y) "1" "1" "-90")
(setq the_Y ( - the_Y 6))
);end 54 progn
);end 54 if

;--------------------END OF INSERTING VALVE CONTROL-----------------------------

);end if progn
);end if

);end progn

);end while

);end func

Saturday, October 8, 2011

Revit Spark

A while back I found that you could download a copy of a thing called SPARK.
This is a possible release of a different type of Revit.

The download is from:

You can check Robin Capper's blog opinion at,
look for 13th September 2011.

It is free to download and will last till 7th July 2012.

I would call it Revit LT, ie "Low Technology"? or LITE?
(As Tim would say, you are able to draft lots on LT because it is "Lite")

Someone has suggested I write up my experiences with it.
I have had experience with Autocad Architecture, so thought it might be
interesting to give it a try.

At the outset, I have to say that leaping straight in is not the ideal
way to approach learning a new program. I found lot's of frustrations that
would not have happened if I had learned in a classroom situation.
I have given Revit a go before about a year ago, so the user interface was
familiar and I had a small project a friend had started using 2D Autocad.

The project is to take a standard house and put a basement rumpus room
in it. The drawings are not perfect(!?...are they ever?) and are in a very
preliminary stage.

The things I found most wanting were: (unless I'm missing something!)

1. No ability to be in 3D of the level you are editing. Sure, you can
make a 3D view and fiddle around for ages with that, but that is a
separate view. This compares very badly with Autocad Architecture, which
allows you to do an instant 3D view of the level you are editing,
and whats more, get a perspective view in an instant.

2. The supply of windows and doors seemed a little poor. I guess I could
create my own families, but that feels like a bit of a mission. For instance,
I wanted bifolds, 4 off, on the front part. Not there.... So mangled a curtain
wall to fill it in.

As with Autocad, it is a lot of knowing where to find things....

Saturday, September 24, 2011

Just a Simple Door

A friend of mine has a joinery shop. It seems sometimes he gets a job where an architectural style of door is needed. He mentioned how it was a bit of calculator bashing to work out the plank widths and how many planks etc. Previously, I had investigated doing Autocad scripts generated from an excel visual basic macro, so I thought, what good waste of my time this might be!

It was quite surprising to me that it was quite tricky to work out, and compromises had to be made-for instance the gap had to be specified, not calculated, then all the tricky stuff with decimal points and integers etc.

The resulting script draws it in 3D.

Sunday, August 14, 2011

Autocad and piping

Just had a look on Youtube at a demo of Autodesk's Plant 3D which I guess is an add-on to Autocad. It looks easy to use and produces things like isometric drawings with bills of materials.
From the short demo, I came away quite impressed. You can see one of the videos here:

It makes my home grown approach to piping look a little crude and backward. If you want a look at how I do this, go to:

Having said this, I could imagine how hard it would be to persuade decision makers at my work that this would be a good way to go, probably because my work about 20% piping. Well, I can dream can't I?

Even if I were certain that this was the way to go, there would be a nagging doubt that maybe other products such as Revit MEP might be the clever way.....

So, back to Youtube and what do you know? Here is a demo of Revit MEP,

To me, it looked like a lot of button pressing for not much result. So here is a puzzle: Autodesk make and sell both products.....why?

I don't want to be seen as a Revit basher here, because as I understand it, a lot of quite clued up people think that Revit is the way to go for drawings of buildings, so maybe I'm missing something.

Friday, April 22, 2011


A co-worker who uses Autocad LT to do his electrical drawings recently said he could not open one of my drawings, because I had saved it as R2010. I had recently been upgraded from Autocad R2008 to R2010, so I said:

"I believe you may be able to upgrade to the R2010 version".

Which he did, which in hindsight was not the best plan, as after installing he wanted to use the hatch command, and got a dialog saying:

"Cannot find acadlt.pat"

Which is fine: All you have to do is go Options, File Locations, and add where it is to your support path. Unfortunately, on the network, we are mere users and are not allowed access to our c: drive.

The IT man was duly called, and progress is on going...involving reimaging and so on.

Which made me think, why can you not get a copy off the internet, download it, stick it somewhere where you are allowed to go and add that location to your support listing?

Strangely enough, I was not able to find a copy of acad.pat anywhere!

Of course there were heaps of people giving out add-ons to the file, but not the file itself.

So here I am, Saturday morning of the 23rd of April, rummaging around my hard drive for the mysterious file. (Mad? Yes!). You can open it up in Notepad and check it out.

Here is part of it:

;; Copyright (C) 1991-2011 by Autodesk, Inc. All Rights Reserved.
;; Version 2.0
;; AutoCAD Hatch Patterns
;; Note: in order to ease migration of this file when upgrading
;; to a future version of AutoCAD, it is recommended that you add
;; your customizations to the User Defined Hatch Patterns section at the
;; end of this file.

;; Note: Dummy pattern description used for 'Solid fill'.
*SOLID, Solid fill
45, 0,0, 0,.125
*ANGLE, Angle steel
0, 0,0, 0,.275, .2,-.075
90, 0,0, 0,.275, .2,-.075
*ANSI31, ANSI Iron, Brick, Stone masonry
45, 0,0, 0,.125

It does go on for quite a bit more, as I have Autocad Architecture, then towards then end it has this bit:

;; User Defined Hatch Patterns
;; Add any hatch patterns that you define to this section of
;; the file to ensure that they migrate properly when
;; upgrading to a future AutoCAD version. If duplicate hatch
;; patterns are found in this file, items in the User Defined
;; Hatch Patterns section take precedence over patterns that
;; appear earlier in the file.

I find it puzzling as to why the file is called acadlt.pat for LT, but maybe they are given less hatches out of the box.

STOP PRESS! According to Robin, a good plan is to run Autocad first time WITH ADMINISTRATOR RIGHTS! Should I tell the IT man?......

Saturday, April 2, 2011

Autocad 2012 - 3dconfig

Well, here we go again, with another release of Autocad.

A quick verdict:

1. It seems nice to use, quick and responsive.

2. No new killer features, except that the section command seems to be doing what it should have done in R2007. Namely the colour of the cut lines seems to be OK now.
To me that is almost worth the upgrade.

3. The nicest thing I like is the display. I have an old quadro fx1500 video card and after updating the video driver, I used 3dconfig to enable hardware acceleration. At first I had rotten results, but after setting it to only have Gooch hardware shader, I found it performed a lot better.
The point is here that you need to update your video driver with a new version, and set it's usage to be not too overtaxing.

4. It has a lot of other stuff that I probably would not use, but I have to concede that my usage is not everyones! Things like 3d parametric arrays and so on.

5. Rendering seems a lot better.

6. As usual, a small upgrade, but all these small things add up over the years to make things a little easier. For instance hatching.

7. A little easy to miss is a new system for views-there is a new bit of text in the top left corner to select views, and visual styles. This comes under the heading of old dogs and new tricks.....woof.

It seems there is more and more stuff with each release. It shows up in the file size of the download (I don't bother with discs any more). It was a 1.4GB download.
Back in 2002, it seemed to fit on a cd.

I had a bit of fun installing: It seemed Nortons noticed a good time to do a background scan, which froze things up a bit. Never mind, do a "restore point". That failed as well, and I was just considering dealing to the whole hard drive, when I tried again and it seemed OK. This time, I hovered around and pounced on Nortons as soon as it came up and killed it off.

The picture of the house I did in Autocad Architecture 2011 as a concept for a friend, which shows what gooch shading looks like.

If you want a quick roundup of all the features, nicely presented, go see:

Thursday, January 6, 2011

Last Post for a While

A New Year's Resolution...haul back on the blogging and do something more useful.

Probably something to do with not a lot of feedback.

This post is about a porch roof I designed. My wife requested a cover over our front door so you don't have to get wet when it rains lots in Auckland. My original idea was a repeat of the roof nearby,ie tiles, rafters etc.

Then I saw one a friend had done: Just a sheet of glass held up by steel brackets.

Just to be competitive I designed a similar one, but this one used stainless steel. Originally, I chose 40 x 5 flat bars as the material, but the look was not all that "architectural", so I redesigned it to use a profile cut shape as the support part.