Tuesday, January 19, 2016

Drawing a house in Autocad 3D Solids

I have become the magpie of CAD software, dabbling in, but never quite mastering Inventor, Solidworks, Vectorworks,Chief Architect, and so on.

The thing that strikes me with most of the architectural ones is that they provide a solution to a set problem, for instance, how to draw a roof.  Then you have a major struggle to make things like the fascia board to be in the correct position, which usually causes it to be buried in the roof.  I have just realised most users of this software just live with the approximations the software creates.  After all, does it really matter if the gutter is out of place by say 30mm?

You can draw a house using solids Autocad, but things like doors and windows can be a problem because you have to draw them each time, or have a library of pre drawn ones to stretch into place.
Or have a set of lisp routines to Africa to insert these.  Not impossible.

A unioned window frame is not that stretchable, but if you could live with a window made up of slabs, you could alter these using the properties of the slab. Then once things are fixed, union it all.

I have just got a job drawing houses in 2D, using Autocad LT.  The boss says he is not totally against 3D though, so this possibility is suddenly interesting.  In the meantime, I hope to learn the ropes using 2D.

Over the years I have made a few lisps to lighten the load:

1. Wind.lsp  This just draws a simple window, putting things on layers like "window" and "glass".
You can have only vertical mullions, so it is pretty limited.  On the other hand, is is fast.




2. Truss.lsp. 

The truss routine uses a dialog box called truss.dcl to draw a cross-sectional view of a roof truss. It inserts components such as GutterCopper in the process of drawing the truss.

It could be argued that the bracing is a bit unrealistic.

This is usually not a problem in New Zealand because the draftsman is only expected to
produce an approximation as the actual truss is redrawn anyway by the truss maker.



3. A set of routines to draw wooden windows.



Modelling The House in 3D
The technique used is to model the house carefully in 3D, then xref this into a blank drawing and then use the section command, and the flatshot command.

Bringing my recent try at this into Showcase turned out a bit strange: all the bricks decided not to lie the correct way! I tried drawing a brick as a block and laying them, but this was too long and involved, plus the mortar seems to be a problem. A cunning plan might be to draw a wall all as mortar and then stick 10mm thick bricks on top of this.  Which still does not solve the problem of trimming the bricks around a window. Maybe a super lisp routine might be needed.

The nice thing about Autocad is you know EXACTLY what you are modelling, and Autocad has a nice set of solids editing tools.

In this screenshot, you can see the model on the left, with the sections and flatshots on the right.



I brought this one into Showcase, from Autocad, all weatherboards are drawn, which came out with a bit of realism.


Monday, November 16, 2015

Autocad Dimension Crazy!

Well, maybe not crazy, but a little irritating.

I have just gone back to by old work for a short time to earn a few dollars to pay for a tooth that fell out.

The man who took over from me is an engineer, and while fairly familiar with Autocad, it was not his main thing for most of his career.  He tells me that he finds drafting is a nicer job than being an engineer.  Let's hope this remains the case!

The task he has partially completed is enormous in size, covering several levels of plant and several buildings.

They also had  a friend of mine filling in for a time, so I have been opening up some of their drawings and working on them.  Their drawings are fine, except for one thing: dimensions.

In the past, I would open my template drawing, draw the model in modelspace, jump out to paperspace and start dimensioning with my 1:1 dimension style.   It did not matter what zoom factor the viewport had, it would always give the correct dimension.

Now I find that I have to set dimlfac to whatever the viewport zoom factor is.  This is a nuisance, especially as I had no firm idea what the problem was.

A little bit of research on the net and things became clear:

If you set DIMASSOC to 2, Autocad will take the zoom factor of the viewport into account when filling out the dimension.

I have raved on about zero height text in a previous blog, here:  http://wlecouteur.blogspot.co.nz/search?q=dimstyle

Nowadays, If my dimensions and text are not to my liking I just blast the drawing with 2 lisp routines:

1. DS.lsp which is in the link above, a simple routine, which I have extended below  a bit to cope with the various text styles I did come across. All the things after a ; are comments to explain things

(defun c:DS()
(setq skale (getreal "Please enter the plotted scale: "));get a scale from the user and assign it to skale
(command "-style" "STANDARD" "ARIAL"
                        "0" "1" "0" "" "" );issue the style command and make it Arial font

(if (tblsearch "style" "ROMANS")(command "-style" "ROMANS" "ARIAL" "0" "1" "0" "" "" ""))
(if (tblsearch "style" "R1")(command "-style" "R1" "ARIAL" "0" "1" "0" "" "" ""))
(if (tblsearch "style" "R1-25")(command "-style" "R1-25" "ARIAL" "0" "1" "0" "" "" ""))
(if (tblsearch "style" "R2")(command "-style" "R2" "ARIAL" "0" "1" "0" "" "" ""))
(if (tblsearch "style" "R5")(command "-style" "R5" "ARIAL" "0" "1" "0" "" "" ""))
;;;the above just checks out the other styles in the drawing and sets them all up to zero height text

(setvar "MIRRTEXT" 0) ; hard to believe - some people set their mirror command to be a bit silly
(setvar "DIMSCALE" SKALE); so if you typed 1 as the plotted scale, dimscale gets set to 1
(setq the_textsize (* skale 2)) ;setting a variable up to be used next line ie if dimscale= 2
;the textsize will be set to 2 * 2 = 4
(setvar "textsize" the_textsize) ;the system variable set to that value
(setvar "dimassoc" 2); will take the zoom factor of the viewport into account
;funny, I had forgotten I had put this line in a zillion years ago!
(princ);exits quietly
);end of the defined function

2. The other lisp is called Dimlo.lsp
;imports a dummy block containing a set of dimension styles
(defun c:Dimlo()
(command "-dimstyle" "r" "STANDARD")
;sets the current style to STANDARD
(command "-insert" "dimstyles"  "0,0" "1"     "1"       "0"); inserts a block called dimstyles
(command "-dimstyle" "R" "1-1");issues the dimstyle command and restores it to 1-1
(command "erase" "l" "");then erases the block from the drawing
(princ)
)

The block called dimstyles is just a rectangle (just something to fill in the drawing-,may not even be necessary), but in the drawing all the dimension styles normally used are set up, eg 1-1, 1-2, 1-5 and so on.  Normally in paper space you would use 1:1, so very little setting up is needed.  Sometimes you have to put dimensions in paper space, so you can choose 1:2 if you need to from the dimension styles pull down.

There is no reason why you could not make up such a block and get all your dimension styles all set up in that one block.

This is close to the idea of a virus used in Autocad, but in a good way!

The only problem is that it illustrates how easy it is to get away from how Autocad works using automation, ie lisp routines, to accomplish a simple task, and how strangely rooted in the past some people are. this command came out in 2004.

Other not recommended things are clicking on a dimension and changing it's value; This should never be done! The reason is anyone coming into your drawing will find this (if they are lucky!), then will not trust any of the other dimensions.

As for exploding dimensions-very naughty!

I have been thinking about putting all my lisp routines on a new web page, probably around Christmas time.  If you are keen for that, post a comment. If nobody posts I may get lazy and not do it.




Thursday, July 30, 2015

Much Posting on Youtube

Today is my last day on Autocad Subscription.  If I had found some drafting to do at home for money, then most likely I would have paid up to keep the suite going.  I had thought that by now I would be happily (?) drawing houses in Revit, but it appears I am not suitable for this as I have not got 2 years architectural drafting experience(I have 9 months experience drawing houses).
Mechanical drafting jobs seem elusive as well.  It could be an age thing as well.

So, turning my thoughts to making a little money to help the retirement along, I thought a series of Autocad tutorials would be the way to go.  If they proved popular, I could clutter up the beginning like everyone else does with an advert.

I came across a free video recorder called "Screen Cast O Matic" , found at

http://www.screencast-o-matic.com/

This is very good, the only catch is that you are limited to 15 minutes- not a big deal anyway because most people can only stand watching something like a tutorial for that long anyway.

Lesson 1 is to be found on Youtube at:

https://www.youtube.com/watch?v=k55532L2Ut4

I thought 5 tutorials would be enough, but I seemed to rave on to produce 15 in total.

Towards the end I did a short piece on rendering, here is a sample:


Not to imply that this is the cutting edge of rendering, but to show part of the platform I drew as part of the lessons.  I did a short bit using Autocad 2016 rendering, and was a little disappointed in my results, but that would be me not exploring every setting.  The last video, No 15 shows the Autocad model being brought into Revit, and Showcase, both of which were easier to get a render out of.






Sunday, January 11, 2015

End of an Autocad Website

My site bilrocad.com has just expired.  My original idea was to make a small income from posting blocks, lisp routines and so on.  I did make $2.89 or so.  After a few years, I did away with the advertising.

My apologies to all who requested info regarding lisp routines and had no reply from me.  I guess I just had other fish to fry.

I am in the process of learning Revit, but have a feeling that I might be too old to catch on to this fish.

It is an amazing program in some ways, any fool can put together walls, doors, windows and roofs.
The fun begins when you want a roof that is not just a slab of butter (easy), but a composite made up of tin, purlins, and wooden trusses.  Can be done, as shown below:



This is the same building I had a go at 4 years ago, see

http://wlecouteur.blogspot.co.nz/2010/01/autocad-to-revitnotes-of-autocad-user.html

I have made slightly more progress this time, but things are still taking way too long, which will definitely be my unfamiliarity with the software.  It took 7 and a 1/4 hours to get the basic shell up and going with a start on the floor joist layout made, which compares favourably with the 4 weeks it took to do the whole job in 2D Autocad,  I made the decision way back then to keep everyone happy and use 2D.  Bad decision. It takes forever!

Things I like about Revit are:


1. Make a change in one thing and everywhere it appears gets updated automatically.   If you have ever made changes (what? a draftee who never made any changes?), then this alone is worth all the pain of getting your thinking in line with the designers of Revit.

2. Any sectioned items are hatched automatically with the appropriate hatch pattern.

3. You can make up the equivalent of an Autocad block, but it is in 3D. You then change its parameters when inserting it in a drawing.  For instance, I made the trusses above, then just adjusted the span and slope to fit this location. Laying them out is a bit more frustrating.

Things I am having trouble with (abeit in a very low state of proficiency):


1. Sometimes you cannot just change the size of a family, say a window width, Revit will let you do it then spit the dummy after it fails to work.

2. The famous "You are not putting this in at the correct level for this view".
It is not good that at this stage of it's development, you have people still wondering how to fix this.
Would it not be nice to have a thing that told you what level you were putting things in at?
(Yes, the panel on the side, silly.)

3. Yup, you sure can dimension whole walls at a time.  Just try deleting one of the dimensions though. According to the experts on the net, just hover over it and hit tab, then delete.  Does not work for me.

4. How do you get an endpoint of a  line that is vertical to snap to a nearby point?

5. Why do you have control over material hatching only in coarse mode....what about fine????

6. Ok, you can have visibility of certain items, so for instance if you were doing floor structure, this is great:  Just turn off all walls and floors and draw in timber framing.  The problem arises when you have a mixed timber and concrete floor and you put in a concrete block wall....

7. Sometimes it does not regenerate other views after a change.

Anyway, I now have a book on Revit (thanks, Robin!), so magical things might happen....

Saturday, April 20, 2013

Cunning plans: How to get Autocad to work smarter?

One of the frequent insults hurled at Autocad is that it is not an intelligent program.

Problems with Xrefs
I have tried to steer my drafting life clear of xrefs, for the reason that when I'm gone, some IT Preventer of Information technology will rename the main network drive or someone else will rename directories.  All this will cause blank drawings to appear!  Having said that, maybe the idea of "relative paths" is a good approach. Of course, if you have the files all in the same directory, then this is not a problem.

Say you have an item, say a magnet box, and this is to be placed in a layout, then the only way to keep any automatic updating is to use the Xref mechanism in Autocad. This means that the item being xreffed in needs to be "pure", that is, it has to be just a 3d model and no more.

This then means that you cannot have things like section planes in that model, or any other extras like 2D sketches.

Organizing your Assembly to go into  a Layout Drawing

Yes, you can organise your magnet box drawing to be a series of layout tabs for each of the parts.

There are problems with this approach though:  You have to have all your parts with distinct layer names so that you can use freezing and thawing on a per viewport basis, and while this is possible, setting it all up seems time consuming.

I have devised a layering system that copes with multi-level layouts. It makes layers like:

LEVEL 1 - FLOOR
LEVEL 1 - INTERIOR WALLS
LEVEL 1- PIPING
LEVEL 1 - BEAMS
....and so on. This seems to work well, and is heavily reliant on lisp routines to make it go.
The advantage is that there is a structure to the layer naming.
 
To tie this all in with the layer names you have to create for the above system is also a pain.

This can be got around by calling layers names like MAGNET BOX LID LEVEL 1, and when the xref turns up in the layout, then the lisp line becomes (command "-layer" "t" "*LEVEL 1*" "") ie it uses the * as wild cards.

Any Other Options? 

One that might deserve some consideration, is to have a "pure" model, in which every item is on layer 0, so that when it arrives in the xref, it picks up the layer it is to be, and appears in the correct colours for that layer. Simple.

To enable parts drawings, this pure model would have all the individual parts (each a separate drawing file) xreffed into it.
The nice thing about this system is that you could have a separate assembly drawing of the magnet box, and any sub-assemblies could be easily arranged. In the assembly drawing you can go ahead and do sections.
OK, so what is the downside?  A great pile of autocad drawing files is what you would end up with, instead of one drawing with heaps of layout tabs on it. Coping with printing out a drawing set is probably not as bad as it seems, as you can use saved sheet sets to deal with this. Your drawing register then becomes a large clerical pain to fill out, that is if you decide to go down that route. To avoid this bureaucracy, an alternative to listing them in a separate register could be to maybe keep them in a directory, labelled say "150905 Magnet Box".  In the drawing register, all you need is one entry:"150905 - Magnet Box". Only the "pure" model, with a file name of 150905.dwg would appear in the main directory.

Saturday, March 30, 2013

Drawing an archimedes screw in Autocad

Recently, a man at my work wanted me to draw the junction of a double screw conveyor. It was a long screw conveyor, and had a hanger bearing in the middle that was causing some trouble.  This was the junction.

In the "olden days" I used to use a 2D lisp routine to draw a screw conveyor.  This was my first request since those days to actually draw a screw.  Usually we just draw the outside casing and this is all you really need, unless you are a manufacturer of screw conveyors.

No worries, I thought, I'll just draw a helix, and sweep a rectangle along the helix. Yes, it is that simple. If you have release 13 that is!  At work I am on release 12 and spent 2 hours trying to persuade Autocad to this.  In the end I googled it.  Humf! It appears no easy "how to do it" is there. The nearest I got was someone drawing an acme screw thread.

After about 2 hours I discovered you could do it, but you had to input in a value for twist of about 30 degrees.

On another subject, my website, bilrocad.com seems in for the chop. At one stage I had advertising on it and thought it might pay it's way.  This was not to be. The people at BlueHost did give me an extra year for free though.

Anyway, here is my method for release 13:

1. Draw a shaft - usually these are from 80NB pipe, ie about 89mm outside diameter, say 3000mm high.





















2. Draw helix. In my example, I used a base and top radius of 123.75mm, 10 turns and a height of 3000mm.


3. Draw a rectangle. I drew one 158.5mm x 10mm so that my outside diameter would end up around 406mm.



















4. Issue the sweep command, pick the rectangle and then pick the helix: Job done!








Thursday, January 3, 2013

Sheetmetal-Pretty Basic

Vanilla Autocad does not have a trick for doing simple folded sheet metal developments.
(Hey, we're only up to Release 18 or so, maybe in release 44....)

When I say simple, I mean a piece of sheet metal with one fold or two folds, both at 90 degrees.

Maybe I am the only draftee on the planet that sometimes does this, but it is always a painfully slow process when I do.

To do this manually, I  draw an end on view as above, using polylines. I then would offset
the inner polyline to create a  neutral axis,  by half the metal thickness. In other words, the "K" factor I was using was 0.5.  Which for steel should have been 0.4.  I only realised this by looking up "sheetmetal developments" on the web, here is a good link, even if it is 1998! (In the link he does something similar, but to my mind, not as useful as my one.)

http://www.oocities.org/wpsmoke/acadsheetmetal/paper.html

The length of the neutral axis polyline is the length of the development.  To get the position of the fold lines, I used to use midpoint snap to put a line on the corner and used it to trim the pline: 
Then it was just a matter of clicking on that pine and checking out it's length on the properties palette, to give me the position of the fold line.

All this horsing around: surely I have better things to do? The upshot is an afternoon spent doing the following Lisp routines, which have not been fully tested by hordes of draftees, (apart from me!). So if you like to try them, make sure you cross check the first few by doing the manual stuff above.

To make sure you can check what you keyed in, a piece of text is generated at the end, and put on Defpoints layer (ie it does not print, but you can see it on the screen).

It uses the layer names "MED" for medium thickness lines, "hid" for hidden lines -ie the fold line , and "dim"
for the dimension lines.  If these layers are not there, it should still work.

(Feed back??? Anyone out there????Hullooooo??) 

A typical output in Autocad looks like this:


Here are the two routines: (cut and paste from here into Notepad.)
(These routines are free)
;Program written by Bill Le Couteur
;Auckland NZ
;Rev 0 date 3 JAN 2013
;THIS PROGRAM DOES ONLY SIMPLE SHEETMETAL BEND OF A 90 DEG BEND - U SHAPED TROUGH-BOTH UPSTANDS EQUAL

(defun  c:DEVU()
(setvar "osmode" 0)
(setq KFactor 0.4)
(setq MetalThickness (getreal "\n Enter Metal Thickness"))
(setq InnerBendRadius MetalThickness)

(setq Length1 (getreal "\n Enter Upstand - Outside Dim"))
(setq Length2 (getreal "\n Enter Middle Section - Outside Dim"))
(setq MiddleSection Length2);;;keep this for later use in text
(setq MiddleSections (rtos MiddleSection))
(setq Length2 (/ Length2 2))
(setq TheWidth (getreal "\n Enter the width"))


(setq NeutralInnerOffset (* KFactor MetalThickness))
(setq NeutralOuterOffset (- MetalThickness NeutralInnerOffset))

(setq NeutralBendArcRad (+ NeutralInnerOffset InnerBendRadius))


(setq Length1Neutral (- (- Length1 NeutralBendArcRad) NeutralOuterOffset))
(setq Length2Neutral (- (- Length2 NeutralBendArcRad) NeutralOuterOffset))

(setq ArcLength (/ (* pi 2 NeutralBendArcRad) 4))

(setq DevLength (+ Length1Neutral Length2Neutral Length2Neutral ArcLength ArcLength Length1Neutral))

(setq HalfArcLength (/ ArcLength 2))

(setq DistanceToFold (+ Length1Neutral HalfArcLength))
(setq FarDistanceToFold (- DevLength DistanceToFold))

(setq TheOrigin (getpoint "\n Pick a point for the development"))

(command "UCS" "n" TheOrigin )

(if (tblsearch "layer" "MED") (command "layer" "s" "MED" ""))
(command "_rectangle" "0,0" (list DevLength TheWidth))

(if (tblsearch "layer" "dim") (command "layer" "s" "dim" ""))
(command "_dimlinear" "0,0"  (list DevLength 0) "0,-50" )
(command "_dimlinear" "0,0"  (list 0 TheWidth) "-50,0" )
(command "_dimlinear" "0,0"  (list DistanceToFold 0) "0,-25" )
(command "_dimlinear"  (list FarDistanceToFold 0)  (list DevLength 0) "0,-25" )
(command "-text" (list DistanceToFold 20) "" "90" "BEND UP 90%%D") 
(command "-text" (list FarDistanceToFold 20) "" "90" "BEND UP 90%%D")
(if (tblsearch "layer" "hid") (command "layer" "s" "hid" ""))
(command "_line" (list DistanceToFold 0) (list DistanceToFold TheWidth) "")
(command "_line" (list FarDistanceToFold 0) (list FarDistanceToFold TheWidth) "")



;;;;;;;;;;;;;;;NOW DOING THE TEXT TO ENABLE CHECKING THE INPUT DATA;;;;;;;;;;;;;;;;;;;;;
(command "layer" "s" "Defpoints" "")
(command "UCS" "W"  )
(setq apt (getpoint "\nInsertion Point for Text: "))
(setq TheText "Data for this development input as follows: ")
(setq MetalThicknesss (rtos MetalThickness))
(setq Length1s (rtos Length1))
(setq Length2s (rtos Length2))
(setq TheWidths (rtos Thewidth))
(setq booText (strcat TheText "\nThickness: " MetalThicknesss "\nUpstand : " Length1s "\nMiddle Section : " MiddleSections "\nWidth : " TheWidths "\nK Factor Used is 0.4"))
(command "UCS" "n" apt )
(command "-mtext" "0,0" "200,-100" booText "") 
(command "UCS" "W"  )
(command "layer" "s" "0" "")
   (princ)
)

 Here is the other Routine:
;Program written by Bill Le Couteur
;Auckland NZ
;Rev 0 date 3 JAN 2013
;THIS PROGRAM DOES ONLY SIMPLE SHEETMETAL BEND OF A 90 DEG BEND ANGLE

(defun  c:DEVL()
(setvar "osmode" 0)
(setq KFactor 0.4)
(setq MetalThickness (getreal "\n Enter Metal Thickness"))
(setq InnerBendRadius MetalThickness)

(setq Length1 (getreal "\n Enter Outer Length 1"))
(setq Length2 (getreal "\n Enter Outer Length 2"))
(setq TheWidth (getreal "\n Enter the width"))


(setq NeutralInnerOffset (* KFactor MetalThickness))
(setq NeutralOuterOffset (- MetalThickness NeutralInnerOffset))

(setq NeutralBendArcRad (+ NeutralInnerOffset InnerBendRadius))


(setq Length1Neutral (- (- Length1 NeutralBendArcRad) NeutralOuterOffset))
(setq Length2Neutral (- (- Length2 NeutralBendArcRad) NeutralOuterOffset))

(setq ArcLength (/ (* pi 2 NeutralBendArcRad) 4))

(setq DevLength (+ Length1Neutral Length2Neutral ArcLength))

(setq HalfArcLength (/ ArcLength 2))

(setq DistanceToFold (+ Length1Neutral HalfArcLength))

(setq TheOrigin (getpoint "\n Pick a point for the development"))

(command "UCS" "n" TheOrigin )

(if (tblsearch "layer" "MED") (command "layer" "s" "MED" ""))
(command "_rectangle" "0,0" (list DevLength TheWidth))

(if (tblsearch "layer" "dim") (command "layer" "s" "dim" ""))
(command "_dimlinear" "0,0"  (list DevLength 0) "0,-50" )
(command "_dimlinear" "0,0"  (list 0 TheWidth) "-50,0" )
(command "_dimlinear" "0,0"  (list DistanceToFold 0) "0,-25" )
(command "-text" (list DistanceToFold 20) "" "90" "BEND UP 90%%D") 

(if (tblsearch "layer" "hid") (command "layer" "s" "hid" ""))
(command "_line" (list DistanceToFold 0) (list DistanceToFold TheWidth) "")



;;;;;;;;;;;;;;;NOW DOING THE TEXT TO ENABLE CHECKING THE INPUT DATA;;;;;;;;;;;;;;;;;;;;;
(command "layer" "s" "Defpoints" "")
(command "UCS" "W"  )
(setq apt (getpoint "\nInsertion Point for Text: "))
(setq TheText "Data for this development input as follows: ")
(setq MetalThicknesss (rtos MetalThickness))
(setq Length1s (rtos Length1))
(setq Length2s (rtos Length2))
(setq TheWidths (rtos Thewidth))
(setq booText (strcat TheText "\nThickness: " MetalThicknesss "\nLength 1: " Length1s "\nLength 2: " Length2s "\nWidth : " TheWidths "\nK Factor Used is 0.4"))
(command "UCS" "n" apt )
(command "-mtext" "0,0" "200,-100" booText "") 
(command "UCS" "W"  )
(command "layer" "s" "0" "")
   (princ)
)
Happy developing!