Saturday, January 20, 2024

Autolisp Routines for labelling piping PIDs

I am now working at a product process consultancy and one of the tasks is to 
look at a PID, and work out where the pipes on the diagram go.

Sometimes, there are no line numbers, so to make things easier on me, I decided to give all the pipes line numbers.  Normally these look like HW-50-001, ie they give an idea of what is in the pipe, it's size and lastly a number.

In line with my dubious philosophy of keeping life simple, I made a copy of the PID and set about numbering all the pipes with just a simple number , ie 1,2 and so on.

My cunning plan was to have an Excel spreadsheet with a From/To list, which would have product and size on there instead.

I also set up the 3d drawing of the pipes with a set of layers labelled 1, 2 and so on.

To save my sanity, I developed several lisp routines to help automate this process as the plant was quite large.

This first one sets up layer numbers in the 3D drawing.  It asks you for the first number and the last number. Then it creates all the layers, and makes the colour of the layer to be the colour number.  Yes, you are correct....this limits this idea to 250 layers.

I could modify the routine to allow for this at some stage.  I did notice that some colours are pretty dark, so this is a drawback that might have to be addressed.

(defun c:laysnum()
  (setq startno (getint "/n Start no: "))
  (setq finishno (getint "/n Finish no: "))
  (setq thenolayers (- finishno startno))

  (while (< startno finishno)
    (progn
      (setq thelayers (itoa startno))
      (command "-layer" "m" thelayers "c" thelayers "" "")
      (setq startno (+ startno 1))
    ) ; end progn
  ) ; end while
  (princ)
)

The second is for use on the PID and asks the user to select a line, then key in a number, eg 4, and then asks for a text position.  The routine changes the layer of the line to 4 and puts the text of "4" above the line.

All while assuming zero height text of course;)

(defun c:CLAT ()
(setq theent (car (entsel "\nSelect a line: ")))
(setq layerNumbers (getstring "\nEnter a number (X): "))
(setq textPosition (getpoint "\nSpecify text position: "))
(setq edata(entget theent))
(setq edata (subst (cons 8 layerNumbers) (assoc 8 ed) edata ))
(entmod edata)
(command "text" textPosition "" "" layernumbers)
  (princ)
);end defun

The next one does the same, just that it does not ask for a text position-this is for when you have the numbers already on the drawing.

(defun c:zzCLAT ()
(setq theent (car (entsel "\nSelect a line: ")))
(setq layerNumbers (getstring "\nEnter a number (X): "))
(setq edata(entget theent))
(setq edata (subst (cons 8 layerNumbers) (assoc 8 ed) edata ))
(entmod edata)
(princ)
);end defun

This one just puts in numbers only, sequentially.

(defun C:zzn( /  z b x y )
(setvar "CMDECHO" 0)
(command "osnap" "none")
(setq oldsnap (getvar "osmode"))
    (if (equal numberf nil)
        (setq numberf 1)
    )
(setq numbers (rtos numberf))
(while (not(equal numbers "299"))
(progn
(setq x (getpoint "\n Pick Number Position "))
(command "Text" x "" "" numbers)
(setq numberf(atof numbers))
(setq numberf (+ numberf 1))
(setq numbers (rtos numberf))
);end progn
);end while
(setvar "osmode" oldsnap)
(setvar "CMDECHO" 1)
 (princ)
)

Notice that there is a variable in there called numberf.  If you have used the routine once, it will persist and will pick up again where you left off.  To start again at a specified number use:

(defun  c:zzNUM()
(setq numberf (getreal "/nEnter your start number "))
(princ)
 )

If all this is confusing, try blecouteur14 the at thing at jeeeeemail, asking me to do a short video.




Monday, June 12, 2023

Drawing a Roof Structure Using Autocad Solids

Yes, completely mad.  I have drawn a rammed earth house roof from whoa to go in 11 x 15 minute videos. I did not design this building.

These were rendered in Autodesk Showcase, as I had problems bringing it into Twinmotion.

Well, no difficulty, but my way of doing materials did not quite fit with Twinmotion.

It came into Twinmotion quite nicely, just my materials were not playing nicely.

Not the fault of Twinmotion, which is a very good program. I have used it with Revit on several jobs and it works well.





You can see video 1 of 11 at:

https://www.youtube.com/watch?v=3vEf8vWkF9U

I have gone on about this idea in previous posts.  The nice thing about using Autocad this way is that you have complete control over what is modelled. 

This job had timber windows and it just so happened that I had made a lisp routine to draw a window in 3D solids some time ago.  This was a bit of a time saver, but even so I still took 2 and 1/2 hours for the videos and around another 2.5 hours for off camera stuff, so around 5 hours all up.

I have an idea that if I had a timber window family organised,it would have taken less time in Revit. Designing one that had wall thickness as a parameter might have been tricky.

Possibly a private hell I should put myself through?






Tuesday, April 11, 2023

Using ChatGPT as an Autocad help

 Interested in such things, I logged on when I had a problem recently.

I had a 3D model and in wireframe mode all the solids showed up.  Switching to Conceptual mode and one of them disappeared.

I checked all the usual things, still no good.

So I asked ChatGPT.  I got a very good answer, but unfortunately none of it's suggestions worked.

I was impressed though.

My solution involved hiding a 2d block that I had in the drawing, and all was good!

Apparently you can ask it to write scripts, macros and autolisp, so that might be fun to try out.







Saturday, December 18, 2021

The Angry Draftsman and a Door Plan View Never Seen Before on the Internet!

 Maybe it is because I have just spent 77 hours on a framing job (3 different houses, one set of drawings) that ended up with about 62 panels drawn.

One thing as an architectural draftsman I would do when drawing interior doors would be to just slam them in the corner of a room, with no precision about 100mm away from the framing, not bothering to show the door frame details at all.  Which works out ok as the precut man will put things in to make it work in reality.

The problem was: now I was that man!  The drawings I received, were done by someone, who like me, lived in a little drafting la la land.....so we have cupboard doors that are much narrower. Doors that will not fit in the available corridor space......so how to get a bed into the bedroom?

Which is fine, who cares?  Except when you need to put a hot water cylinder in.....or get a bed in a bedroom...



The thing which I never really took on board is that to have a door, you need a lintel.  This needs 2 studs, one to go from top to bottom, and one to support the lintel, that is if this wall needs to butt into another one.  So the soonest the gap can start is 45 + 45 away from the other wall, ie 90mm.  Then you have the door frame to consider and a gap at the other end.

>>>>>July 2024 note: see below, the 90mm can be 45mm<<<<<<<<<<<<<<<<<<<<<<<<<<<<

Easy, I thought, just go on the net and look up door manufacturers.  The number of different door frame options out there is eye watering.  No nice plan views as shown here though. Hence the anger.

If you can see anything obvious wrong, please comment.

In my early architectural drawings I always made all doors the same size, 760mm.  After about 5 drawings the architect noticed this and informed me that bathrooms and toilets were supposed to be 710mm.  

NEW NOTES MADE 24 JULY 2023.

I have had occasion today to make a lisp routine to insert doors and revisited the dimensions given above.

I found a firm called J & G Doors Ltd, at https://jgdoors.co.nz/technical-info/

and their figuring is at odds with mine.  Seeing as that is their business to make doors, I have to 

bow to their superior wisdom. So the above sketches should appear as revised below:



Just to add to the confusion, the apartment where I live has dimensions where 70 shown above

turns out to be 85-90mm, so the jury is still out!  It seems common practice to just have 1 x 90x45

against the adjacent wall, so the idea of 2  45x90's promoted above is probably suspect as well!

From here on I am working on 45mm only not 90mm.

My comment when asked to do some pre-cut drawings was: "How hard could it be?"

Turns out, hard work.  Little things like where do you put the first stud?  No books to guide me I settled eventually on 610mm, on the grounds that you need to allow for the gib on the adjoining wall. Fingers crossed this is ok!

Regarding angry draftsmen, I have noticed that Architects and Architectural Draftsmen are quite often grumpy people.  Maybe it is dealing with clients and council that brings this on.  Or is it that drawing houses is rife with things that are plainly a silly way to do things, for instance, every one has a different set of drawn details. Still, maybe it keeps us all in a job?









Saturday, September 4, 2021

Down Autocad memory Lane

Around 1991,  I remember spending $2400 on an AT, IBM clone, it had a 80286 processor and probably 1k of ram....My daughter and and I used to play Captain Comic on it.

It had a 14" Colour monitor, not flat screen but cathode ray tube.

About 1993, I decided to go contract drafting and bought a copy of Autocad 12 for NZ$6500.  I got a man to upgrade it to an 80386, still with not much ram.  

I could draw things ok, but a bunch of 2D pipes in a factory, and it would give up.

One of my first jobs was for an engineering consultancy specializing in rendering.
No, not as in producing pretty pictures, but dealing with slaughtered animal wastes.

Everything was all 2D, as the computers then did not have the power to do 3D.

Release 14 which came out in 1997 had some handy 3D capability, just as computers became more powerful, and I became more convinced and proficient with 3D.

What followed was a succession of contracts here and there, which were all good learning experiences, until I ended up at a large factory where I more or less stayed until I retired.

With a few breaks to work on other things.

Autocad 2007 I remember as the really ground breaking release, for the extra 3D pieces which it had in it.








Thursday, September 10, 2020

Housing Crisis?

Housing seems to cost a lot.   At least it does in New Zealand, where I live.
I thought it might be fun to design a cheap way of building, using commonly available products.

This represents the minimum size possible. Hey, it keeps the rain out!



You can check out the video  I made, link is below:
This system just needs some young person with access to a shed, along with some basic tools. More sophisticated manufacturing systems could be added if you were successful.
This one is 3.6m x 7.2m long, and includes a bathroom/laundry. The materials cost is around NZ$15,000, so even if the labour costs were another $15,000, it would still be a cheap house. The hardest part would be the dealing with all the rule makers....in NZ you cannot build a building unless you are a Licensed Building Professional. The other hard part is this is not architecturally designed-yes it does look like a shack. But it would do the job. Speed of build would be very quick, as the walls just lock together. Nothing in here is patented, and better designs for locking mechanisms could be done. The prices are straight from retail outfits in New Zealand, so further reductions in prices would be certain. In NZ today, and average 3 bedroom house(no land) would be around $300,0000. They are obviously a lot bigger!
The strange part is the land would be the biggest cost.
In the following costings, I do not include electrical,plumbing or the special fixing system.
Item Price each Qty Extd
Module1 1200x2400 Exterior $304.45 7 $2,131.15
Module1 1110x2400 Exterior $302.66 4 $1,210.64
Module3 1200x2400 Interior $115.45 1 $115.45
Module5  1200x2400 Interior with door $276.46 1 $276.46
Module6 998x2400 Interior $111.42 1 $111.42
Module7 1200x2400 Exterior with 1175hx1010w window $1,458.85 2 $2,917.70
Module8 1200x2400 Exterior with front door $420.45 1 $420.45
Module9 1110x2400 Exterior with 1175hx400w window $847.85 1 $847.85
Particle Board 20x1200x3600  $165.00 6 $990.00
Gib for Ceiling 13 x 1200 x 2400 $31.56 9 $284.04
Truss $62.13 9 $559.13
Purlins $276.40 1 $276.40
Ceiling Battens $259.12 1 $259.12
Fascia $339.23 1 $339.23
Guttering $195.46 1 $195.46
Barge Flashing $493.00 1 $493.00
Soffit $222.00 1 $222.00
Ceiling Batts 3.6x7.2=26, 3 packs at 8.4sqm $76.50 3 $229.50
Sub Floor Timber $1,345.33 1 $1,345.33
Downpipe $29.00 1 $29.00
Roofing Iron $70.00 11 $770.00
Toilet Mondella  $289.00 1 $289.00
Handbasin Roccoco $109.00 1 $109.00
Shower-lining $270.00 1 $270.00
Shower-door $305.00 1 $305.00
Shower-base $200.00 1 $200.00
Shower-support for lining $200.00 1 $200.00
Shower-tap $100.00 1 $100.00
Shower-plumbing waste $159.00 1 $159.00
Laundry Tub with tap $400.00 1 $400.00
Mirror $100.00 1 $100.00
Kitchen-Kaboodle-Bunnings $1,753.00 1 $1,753.00
Stove/Oven $779.00 1 $779.00
Kitchen sink $100.00 1 $100.00
Total $15,196.33

This overall costing uses the modules costed below:

Item Price-each Price/m Length Qty Extd
Module1 1200x2400 Exterior
Shadowclad 12x1200x2440 $162.00 1 $162.00
Gib 10x1200x2400 $24.00 1 $24.00
Top 90x45 $5.00 1.2 1 $6.00
Bottom 90x45 $5.00 1.2 1 $6.00
Stud 90x45 $5.00 2.32 3 $34.80
Nog 90x45 $5.00 0.5325 4 $10.65
Nails $10.00
Batts R3.6, 3 sq m at $17/ sq m $51.00
Clips
Paint
Total $304.45
Module2 1110x2400 Exterior
Shadowclad 12x1200x2440 $162.00 1 $162.00
Gib 10x1200x2400 $24.00 1 $24.00
Top 90x45 $5.00 1.11 1 $5.55
Bottom 90x45 $5.00 1.11 1 $5.55
Stud 90x45 $5.00 2.32 3 $34.80
Nog 90x45 $5.00 0.5325 2 $5.33
Nog 90x45 $5.00 0.4435 2 $4.44
Nails $10.00
Batts R3.6, 3 sq m at $17/ sq m $51.00
Clips
Paint
Total $302.66
Module3 1200x2400 Interior
Gib 10x1200x2400 $24.00 2 $48.00
Top 90x45 $5.00 1.2 1 $6.00
Bottom 90x45 $5.00 1.2 1 $6.00
Stud 90x45 $5.00 2.32 3 $34.80
Nog 90x45 $5.00 0.5325 4 $10.65
Nails $10.00
Clips
Paint
Total $115.45
Module5  1200x2400 Interior with door
Gib 10x1200x2400 $24.00 2 $48.00
Top 90x45 $5.00 1.2 1 $6.00
Bottom 90x45 $5.00 0.445 1 $2.23
Bottom 90x45 $5.00 0.09 1 $0.45
Stud 90x45 $5.00 2.32 3 $34.80
Nog 90x45 $5.00 0.5325 3 $7.99
Door $100.00 1 $100.00
Door Handle $50.00 1 $50.00
Nails $10.00
Batts R3.6, 1 sq m at $17/ sq m $17.00
Clips
Paint
Total $276.46
Module6 998x2400 Interior
Gib 10x1200x2400 $24.00 2 $48.00
Top 90x45 $5.00 0.998 1 $4.99
Bottom 90x45 $5.00 0.998 1 $4.99
Stud 90x45 $5.00 2.32 3 $34.80
Nog 90x45 $5.00 0.432 4 $8.64
Nails $10.00
Clips
Paint
Total $111.42
Module7 1200x2400 Exterior with 1175hx1010w window
Shadowclad 12x1200x2440 $162.00 1 $162.00
Gib 10x1200x2400 $24.00 1 $24.00
Top 90x45 $5.00 1.2 1 $6.00
Bottom 90x45 $5.00 1.2 1 $6.00
Stud 90x45 $5.00 2.32 2 $23.20
Nog 90x45 $5.00 0.5325 4 $10.65
Glass-1275x1110x18 $200.00 1.4 4 $1,120.00
Gasket $10.00 1 $10.00
Frame $10.00 1 $10.00
Window clips $5.00 12 $60.00
Nails $10.00
Batts R3.6, 1 sq m at $17/ sq m $17.00
Clips
Paint
Total $1,458.85
Module8 1200x2400 Exterior with front door
Shadowclad 12x1200x2440 $162.00 1 $162.00
Gib 10x1200x2400 $24.00 1 $24.00
Top 90x45 $5.00 1.2 1 $6.00
Bottom 90x45 $5.00 1.2 1 $6.00
Stud 90x45 $5.00 2.32 3 $34.80
Nog 90x45 $5.00 0.5325 4 $10.65
Door $100.00 1 $100.00
Door Handle $50.00 1 $50.00
Nails $10.00
Batts R3.6, 1 sq m at $17/ sq m $17.00
Clips
Paint
Total $420.45
Module9 1110x2400 Exterior with 1175hx400w window
Shadowclad 12x1200x2440 $162.00 1 $162.00
Gib 10x1200x2400 $24.00 1 $24.00
Top 90x45 $5.00 1.2 1 $6.00
Bottom 90x45 $5.00 1.2 1 $6.00
Stud 90x45 $5.00 2.32 2 $23.20
Nog 90x45 $5.00 0.5325 4 $10.65
Glass-1275x500x18 $200.00 0.64 4 $512.00
Gasket $10.00 1 $10.00
Frame $10.00 1 $10.00
Window clips $5.00 8 $40.00
Nails $10.00
Batts R3.6, 2 sq m at $17/ sq m $34.00
Clips
Paint
Total $847.85
Truss
Top 90x45 $5.00 4.6 1 $23.00
Bottom 90x45 $5.00 3.6 1 $18.00
Vertical 90x45 $5.00 0.545 1 $2.73
Vertical 90x45 $5.00 0.28 1 $1.40
Nail Plates $1.40 5 $7.00
Nails $10.00
Total $62.13
Purlins
70x45 $4.00 7.4 9 $266.40
Nails $10.00
Total $276.40
Ceiling Battens
70x45 $4.00 6.92 9 $249.12
Nails $10.00
Total $259.12
Fascia
180x18 $15.00 7.4 2 $222.00
135x18 $11.17 4.8 2 $107.23
Paint
Nails $10.00
Total $339.23
Gutter
Gutter-Marley Stormcloud 5 m length $60.57 2 $121.14
Gutter-Marley Stormcloud Joiner $3.25 1 $3.25
Gutter-Marley Stormcloud Outlet $30.49 1 $30.49
Gutter-Marley Stormcloud ends $4.85 2 $9.70
Gutter Clips $2.61 8 $20.88
Nails $10.00
Total $195.46
Soffit
400x4.5 $15.00 7.4 2 $222.00
100x3.5 $11.17 4.8 2 $107.23
Paint
Nails $10.00
Total $339.23
Barge Flashing
Long side-top $29.00 7.4 1 $214.60
Sides $29.00 4.8 2 $278.40
Total $493.00
Sub Floor Timber
140x45 Joists $11.00 3.51 19 $733.59
90x45 Bearers $5.00 7.2 6 $216.00
Wire Dogs $0.43 34 $14.62
Joist Hangers $4.36 30 $130.80
125x125 Piles - $24/1.2m so $20/m, ie  $10 for 0.5m $10.00 21 $210.00
Concrete-pad is 0.0064 cu m $300.00 0.0064 21 $40.32
Total $1,345.33

Sunday, January 19, 2020

Rectangle Listing Autolisp

Code as below-see
https://www.youtube.com/watch?v=lus7WLJ2wJQ&feature=youtu.be

It numbers rectangles and then lists their coordintes in a comma delimited file, ie .csv

;Program written by Bill Le Couteur
;Auckland NZ
;Rev 0 date 29/11/17
;This program selects rectangles and labels them with coordinates,length, width and area
;
;

(defun  c:LR()
;(setvar "CMDECHO" 0)
(setq oldsnapmode (getvar "osmode"))
(setvar "osmode" 0)
(command "ucs" "w")
(setq the_count "500"); just a dummy so the while loop keeps going unless user escapes!
(setq count 0)
(setq SerialNo 1)
(setq SerialNos (itoa SerialNo))
(setq the_drg_path (getvar "DWGPREFIX"))
(setq the_file_name (getstring "/nEnter the file name, no prefixes or suffixes: "))
(setq the_text_height (getreal "/nEnter the text height needed: "))


(setq full_file_name (strcat the_drg_path the_file_name ".csv"))

;this makes sure the file is empty if first used!
 (if (not(equal beenthere T))
  (close (open full_file_name  "w"))
 )


;;;;;;;;;;;;;;;;;;WHILE LOOP TO GO PICK RECTANGLES ONE BY ONE;;;;;;;;;;;;

(while (not(equal the_count "1000"))
(progn

(prompt "/npick the rectangle")
(setq edata(entget(car(entsel))))                             ;getting the pline's data
(setq ename (cdr(assoc -1 edata)))
(setq the_item (cdr (assoc 0 edata))) ;IF THE USER PICKS A CIRCLE, IT IS A SIGN TO STOP NOW, IE CLOSE THE FILE
;(if (eq "CIRCLE" the_item)
; (progn
; (print "now closing")
; (close fp)
; (exit)
; )progn
;);end if

(print edata)
;you can see the points in the edata list- they are the dotted pairs that start with 10.

(foreach thing edata
  (progn
        (if(eq (car thing) 10 ); -ie only interested in the points
             (progn;if progn
(print thing)
                (if (eq count 0)(setq the_point0 thing))
(if (eq count 1)(setq the_point1 thing))
(if (eq count 2)(setq the_point2 thing))
(if (eq count 3)(setq the_point3 thing))


(setq count (+ count 1))

         );end progn
    );end if
  );end foreach progn
);end foreach

(setq xvalue1 (nth 1 the_point0))
(setq xvalue1s (rtos xvalue1 2 4))
(setq yvalue1 (nth 2 the_point0))
(setq yvalue1s (rtos yvalue1 2 4))
(setq coordsA (strcat xvalue1s "," yvalue1s))

(setq xvalue2 (nth 1 the_point1))
(setq xvalue2s (rtos xvalue2 2 4))
(setq yvalue2 (nth 2 the_point1))
(setq yvalue2s (rtos yvalue2 2 4))
(setq coordsB (strcat xvalue2s "," yvalue2s))

(setq xvalue3 (nth 1 the_point2))
(setq xvalue3s (rtos xvalue3 2 4))
(setq yvalue3 (nth 2 the_point2))
(setq yvalue3s (rtos yvalue3 2 4))
(setq coordsC (strcat xvalue3s "," yvalue3s))

(setq xvalue4 (nth 1 the_point3))
(setq xvalue4s (rtos xvalue4 2 4))
(setq yvalue4 (nth 2 the_point3))
(setq yvalue4s (rtos yvalue4 2 4))
(setq coordsD (strcat xvalue4s "," yvalue4s))


(setq header_line "Sn,Ax,Ay,Bx,By,Cx,Cy,Dx,Dy,Length,Area")
(setq the_length (- xvalue2 xvalue1))


;;;;;;;;;FOR A NORMAL RECTANGLE;;;;;;;;;;;;;;;;;;;;
(if (> the_length 0)
(progn
(setq the_lengths (rtos the_length 2 4))
(setq the_width (- yvalue3 yvalue1))
(setq insert_pointx (+ xvalue1 (/ the_length 2)))
(setq insert_pointy (+ yvalue1 (/ the_width 2)))
(setq insert_point (list insert_pointx insert_pointy))
);end if progn
);end if
;;;;;;;;END OF FOR A NORMAL RECTANGLE;;;;;;;;;;;;;;;;;;;;


;;;;;;;;;FOR A REVERSE RECTANGLE;;;;;;;;;;;;;;;;;;;;
(if (< the_length 0)
(progn
(print "hello")
(setq the_length (* the_length -1))
(setq the_lengths (rtos the_length 2 4))
(setq the_width (- yvalue3 yvalue1))
(setq insert_pointx (- xvalue1 (/ the_length 2)))
(setq insert_pointy (+ yvalue1 (/ the_width 2)))
(setq insert_point (list insert_pointx insert_pointy))
);end if progn
);end if
;;;;;;;;END OF FOR A REVERSE RECTANGLE;;;;;;;;;;;;;;;;;;;;


(if (< the_width 0)(setq the_width (* the_width -1)))
(setq the_area (* the_length the_width))
(setq the_areas (rtos the_area))

(setq the_line (strcat SerialNos "," CoordsA ","   CoordsB ","  CoordsC ","  CoordsD "," the_lengths "," the_areas))


(setq the_text_height 300)


(setq fp (open full_file_name "a"))
(if (not(equal beenthere2 T)) (write-line header_line  fp))
(write-line the_line  fp)
(command "text" "j" "m" insert_point the_text_height 0 SerialNos)

(setq SerialNo (+ SerialNo 1))
(setq SerialNos (itoa SerialNo))

(setq beenthere2 T)

(setq count 0)

);END OF WHILE PROGN
);END OF WHILE

;;;;;;;;;;;;;;;;;;END OF WHILE LOOP TO GO PICK RECTANGLES ONE BY ONE;;;;;;;;;;;;





(close fp)
 (setq beenthere T)


(command "ucs" "w")
 ;(setvar "CMDECHO" 1)
(setvar "osmode" oldsnapmode)
(princ)
)