Showing posts with label Dimension and Geometry. Show all posts
Showing posts with label Dimension and Geometry. Show all posts

Saturday, November 24, 2012

Automated Drawing List Update Acad LT (revised)

As indicated in earlier posts I use Acad LT, and automate using Excel/vba to generate AutoCAD script (.scr) file.

One of the most regularly used scripts is that for updating the drawing title blocks. This operates across multiple paperspace layouts and multiple files.

Whilst paperspace layouts can be beneficial they do have some disadvantages when it comes to repetitive detail across projects, consequently I have been tending to move back towards individual file for each drawing sheet, and lots of xref's, especially for workshop details. For example it is a lot easier to copy a file, and modify the detail, than messing around copying detail modifying and setting up new paperspace viewports. Other times it may be easier to copy layouts, and add some extra layers for some additional detail. Hence need to update drawing title blocks across multiple layouts and drawing files.

Last year I made a simple modifications, by writing the script file to a common default folder, and automatically launching Acad LT, compared to previously generating script in drawing folder and then dropping in Acad LT editor. At that time also added extra worksheets to allow different title blocks, to cover common variations: such as calc's sheets used for simple sketches, versus drawing sheet used for residential footings, and the typical drawing sheet for all other project types. To do that I also added look up tables which listed the attributes for each title block. Providing drop down lists to select which of drawings the title block script should be generated for. That was all working good, and saved a little bit of extra time over the previous version of the script.

But work shop detailing involves a lot of drawings and tend to get slightly lost in all the drawings. Also the batch of drawings did use two title blocks: proper drawing sheet and frame for the main part details and then a simple document control block for some steel sheet setouts. The current project however introduced the need for a larger sheet. Most part details are standard and on A4 sheets, but the larger building currently working on as parts which are too large to conveniently fit on A4, I can squeeze them onto A4, but have chosen to place on A3 instead.

So for the batch of drawings have three different title blocks which want to automatically update, and a problem working through all the files and details, to determine which exist and which are relevant.

So modified the Excel/vba script. It now permits each drawing to have a unique title block, on condition that it has attributes which belong to a common sets. The vba macro now checks if the attributes are in the title block, if so then writes the value from Excel to the Acad script (.scr), if not then skips to next attribute. Also the macro now checks if the drawing file exists before including in the script, if not then the cell is coloured red.

At one stage I also experimented with Hyperlinks to open the Acad drawing files from Excel worksheet, this didn't work to well because of need to keep paths updated. But now created a vba macro and short cut key (Ctrl-e), to open drawing file currently selected in the worksheet. This didn't work too well using the vba shell command as it opened each drawing in a separate instance of Acad LT. However a simple experiment with vbs, and determined that the windows scripting host (WSH), shell object run command was able to open files by association, whilst the vba shell command required the executable command. That is using vba I needed to build correct command line including reference to Acad LT as well as file name, whilst using WSH shell command only need to pass the drawing file reference. Therefore created a WScript.Shell object in Excel/vba.

So I can now get from Excel description of drawing file, to the actual Acad LT drawing. Now that is something I wanted to do for a while.

For now have potential to mesh my bill of materials (BoM), or product structure tree to workshop details, and otherwise build model in Excel. For can otherwise get lost figuring out which part files belongs to which part, and have I drawn all the necessary parts and counted them all. Sure I could buy building information model (BIM) software, but where's the fun in that. Plus BIM software is expensive and I don't have the demand for workshop detailing to justify its purchase. Programming, well that's just kind of play time.

I had experimented with XYplorer, attaching tags to part drawings, but problem with that, I need two sets of tags: one for local work on laptop, and another for files on shared drive in office. Additionally adding tags to files, produces an ever increasing database of tags which have to be scanned through. By using Excel tables, I am not adding to over head of using XYplorer, and I can add data fields as I choose on an as needs basis, sort and filter and otherwise connect to other data sources.

On BIM
One other objection I have to BIM, is that it is an enforced approach to building design, and that approach is built around 3D graphics, whilst the majority of people in the supply chain have no use of 3D graphics. Revisiting the concept of data as raw material, and information as data organised to assist decision and action, then the typical BIM software application, is a long way from being an information model. It is largely a data model BDM, and less than informative to other parties who don't want the graphics but do want to get at the data and present in formats which suit them, rather than formats that suit the authors and or users of  3D graphic software.

Consider that it is inappropriate to use a multi-million dollar flexible machining centre to make bolts and other high volume repetitive parts. It is preferable to have highly specialised machines to make bolts. The current BIM software tends towards being highly flexible, that makes it ill suited to more specialised purposes.

It is a common trend in software development that more and more features and flexibility are added, the problem is that something which previously took a few clicks now requires a multitude of irrelevant parameters to be set.

For example the modification I have just made to my spreadsheet, now requires I define the title block for each and every drawing, where as previously I only needed to identify the title block once. However, it is not a major problem because it is simple to copy cells in Excel, or to make one cell equal to another. It is that reason why I type project titles and drawing titles into Excel rather than directly into Acad.

By making software too flexible it then becomes necessary to expend time customising the software for something more specific and repetitive. The problem of creating a front end, to simplify input, is that there is a lot of over head associated with the flexibility. So whilst using an advanced flexible system may reduce development time, it does not produce a tool which is efficient. The resultant product uses more resources than necessary and operates slower than required.

Hence there is a need for custom tools. So comments like if not using the newest tools then behind the times, are largely nonsense. Should not be using the newest tools, but the tools most appropriate to the job at hand. A lot of modern software is becoming more video game than productive tool, whilst it may ease people getting familiar with the software and using, its not all that productive there after.

So some of these high end software vendors really need to pay more attention to the needs of the end-users rather than how they consider design and documentation should be carried out. There are still people producing workshop details freehand, and buildings plans freehand, that is people who are not using any form of drawing instruments and not drawing to scale: they produce simple concept sketches and that is all they need to get approval and to build. Drawing is a tool to solve problems, and many of those problems only need resolving by freehand concept sketches. So builders for example are not going to start using CAD, because drawing is not their business, they produce drawings as an aid, a means to an end. Whilst many modern architects, engineers and drafters are producing drawings as an end in itself: more concerned with document control than what is conveyed by the documents.

End-users buying BIM software also need to pay more attention to where they need productivity improvements. If 3D graphics contributes little value to an end-users activities then current array of BIM products probably of little value. That is do you really need a picture of an object to input all the other data and extract useful information about that object. If not then BIM is not a suitable solution, and other software likely to be more useful. For example MS Excel/ MS Access, or the array of MRP I, MRP II, software and various other specialist packages.

I go from Excel to Acad, because with Acad scripts (.scr) I can only really generate Acad drawings, there is little that I can do to extract Acad data other than extract block attributes, or export a DXF file, and extract data from that.

The first data for most things is symbolic, some kind of analogy, this then has to be expanded into graphics and other data. For example want a building or a machine. These are word symbols and not very specific, the definition thus has to be  refined until define something specific. This refinement can take place using more words, various kinds of charts and diagrams, or using pictorial graphics. Much can be done long before any graphics are produced, but seems in the modern world consultants dive straight into CAD drawings, when should have dismissed an idea almost immediately using simple freehand sketches.

A crazy world in which it seems only typed reports and CAD drawings seem to be accepted. Very wasteful.


Related Posts:

AutoCAD Speed Test
Automated Drawing List Update Acad LT (revised)

Cold-Formed Steel Shed Industry: part:#1 (Shed Framing Drawings)
Cold-Formed Steel Shed Industry: part:#2 (Shed Framing Drawings)


Tuesday, November 01, 2011

Cold-Formed Steel Shed Industry: part:#2

As explained previously an Excel/vba macro is used to generate an AutoCAD script which is written to a default folder, and then AcadLT is launched from vba using command line parameters to run the Acad script automatically as Acad loads. The model space output of the script is shown in Fig 1, and the paper space output shown in Figs 2 to 6.

Fig 1: Model Space output of script.

Fig 2: Paper Space output of script. Footing plan showing stiffened raft (not typically required).


Fig 3: Framing Plan & Member Schedule


Fig 4: Side (Front) and End Elevation (Right)

Fig 5: Side (back) and End Elevation (Left)

Fig 6: Detail Section of Portal Frame

At present the script doesn't modify the paper space layouts to match the paper size. This is largely because in the first instance it requires using "print" and adjusting the layout parameters and then cancelling the print command. It can crash if invalid paper size names and printer names are provided, so it was left out. Text is all placed in paper space, with exception of the grid labels which are written in model space. The input parameters allow varying the paper size, the scale, and forcing either one view per sheet or everything to a single sheet. The scale can also be selected to be calculated. Either way the vba macro will determine one of a few different preferred layouts, and attempt to use as few sheets as possible. All the parameters to define the structural frame can be varied. Spacing of frames, girts and purlins are assumed to be constant. Except for the simplest of buildings, usually after the script has run a great deal of manual editing is required to produce finished drawings for development approval.

Fig 7: Screen Capture of Time Script Takes.


As can be seen from the screen capture, Fig 7, the script takes less than 9 seconds to run, this is significant decrease on the 5 to 20 hours that may be required for drawing such stick diagrams from scratch. Another 5 to 40 hours may be required for drawing connection details and other relevant detail sections. Given that the shed industry typically does not produce formal drawings, only a freehand sketch on square ruled paper order form, taking some 10 to 60 minutes whilst salesperson talks to customer: collapsing the drafting time is important. Whilst the freehand sketch is suitable for a small garden shed, its not suitable for a 4000 sq.m industrial warehouse with office space. But people go to the shed suppliers on the assumption that they have solved all the problems before and have standard designs which can be modified. Whilst the industry advertises custom manufacture it cannot provide custom design. The industry relies heavily on the local council, requesting further information, before they go and get architectural and engineering input. This results in delays for the customer as issues of  non-compliance with building codes are resolved.

Whilst high end building information modelling (BIM) software may be useful for the task, it is too complex for sales people to be using at the point-of-sale, and with costs from $5000 to $25,000 (AUD) per license it is also far too expensive. {Though any shed supplier setting up own engineering staff and making  use of such software, has the potential to make it financially viable, taking advantage of the software to improve their product and increase sales.}

Whilst the suppliers run around from one consultant to another, requesting standard designs for one shed or a range of sheds, there is a need to develop low cost, highly product specific software which produces drawings, and structural calculation reports, along with material take-off's,  cost estimates, and work shop details, along with any CNC machine instructions if appropriate, to resolve the problems of not using standard designs correctly.

There is already precedent for such software with the nail plated timber roof truss manufacturers, however their software started in the wrong direction: it failed to provide adequate evidence-of-suitability and was proprietary. This made it difficult for council to check the adequacy of the proposed trusses, and there is still need for improvement, but there is now a guide line for such software, put out by Planning SA.

Minister’s Specification: SA A2.2 : Structural engineering software


The problem with such software is that it tends to only produce specifications, and it can do so in a short period of time, a few minutes. Compare this to a few hours to check all the different roof trusses in a typical house, using either manual methods or standard frame analysis software. It seems no consultants providing technical certification services has automated their standard frame analysis software for checking timber roof trusses. Similarly they also haven't produced automation for sheds, carports and verandahs. So the industry can do fast, but the checkers and certifiers are slow. The big question though is the industry fast because its not doing engineering checks, or because it has fast design tools, and have those design tools been checked and are they being used correctly. Hence developing and releasing the software not just a matter of writing source code. Hence these things tend to get part developed as useful in-house productivity tools rather than commercial products. But not everyone has the time to develop such tools in-house, and that causes hindrance, and delays, when at the certifier level. So tools need to be readily available to all, not just limited to manufacturers, possibly under a GPL, so that source code viewable by all.

Any case primary task at moment is to reduce the drafting effort, since calculation effort has largely been reduced already for the typical gable frame shed.

AutoCAD Speed Test

As a simple test of the comparison between speed of manual CAD drafting and scripting (*.scr), a simple test can be carried out. This test comprises of drawing a rectangle and then diagonal lines and bisectors of the sides. All entities should be ordinary lines, no polylines or rectangles, and no drawing as such and exploding to ordinary lines. Running osnaps can be switched on to save time. I typically have osnaps switched off, it interferes with running scripts, and otherwise tends to waste time in manual drafting selecting the wrong points, so I typically select snaps manually, the right one at the right time. Anycase for the test I used running osnaps, because it is a situation where it clearly provides benefit rather than an hindrance. The dimensions of the rectangle are @10000,5000.

It should be noted that the larger the screen the longer the distance to travel from one corner to the other and therefore the longer the drawing time. So larger screens not altogether a benefit. Faster times can be achieved by reducing the size of the AutoCAD window, or by zooming to a fraction of the screen (eg. zoom 0.5x).

Fig 1: Screen image of finished drawing test.
{NB: click image to enlarge and scroll all images.}

Fig 2: Screen capture of time taken for manual drafting

The time taken with manual drafting is approx 26 seconds. With practice it may be possible to get the time down further. Starting out today it took 55 seconds, but for some reason I was typing the command "Line" rather than using the alias "L", also wasn't using running osnaps. But since I knew last time I did the test I did it in 26 seconds, I kept trying until could capture such time from screen. Faster  computers and faster operators may be able to get lower times, but unlikely to achieve the less than 1 second that the script takes to run.

Fig 3: Screen capture time taken by script, drag and drop onto CAD drawing.

Fig 4: Screen capture time taken when macro added to a toolbar button.

Not sure why but the script runs slower when called from a toolbar button than when script file is "drag and dropped" onto the drawing. However the button saves operator  time finding the script.

The script:
;---------------------------------
TIME RESET

LINE 0,0
0,5000
10000,5000
10000,0
C
LINE 0,0 10000,5000

LINE 0,5000 10000,0

LINE 5000,0 5000,5000

LINE 0,2500 10000,2500

ZOOM E
ZOOM s 0.5x
TIME

;---------------------------------

The button macro:

'_script speedTest1.scr 


Faster computers and larger monitors save time, but only when there is a great deal of interaction between the operator and the machine. To really save time and increase productivity need to get the computer to do the work, and a slow computer may be adequate for such purpose. If it takes a person 2 minutes to enter data, and the computer 1 second to respond, it does not make any perceptible difference if get a computer twice as fast to complete its task in 0.5 seconds. Its the 2 minutes of human interaction with the machine that needs to be reduced: and that is likely to become a political issue. There has to be some acceptable need to reduce the production time before effort gets applied to do so. After all what are you going to do with the free time if just reduce production time just because you can.


Related Posts:

Programming/Automating #Autocad LT
Automated Drawing List Update Acad LT (revised)

Cold-Formed Steel Shed Industry: part:#1 (Shed Framing Drawings)
Cold-Formed Steel Shed Industry: part:#2 (Shed Framing Drawings)

Monday, October 31, 2011

Cold-Formed Steel Shed Industry: part:#1

Sample drawings of framing plans for cold-formed steel shed, partially automated by the scripts(*.scr) mentioned in earlier blog, then extensively modified using manual CAD editing, using AcadLT 2000, to match the custom features of the project. Project is from a few years back, and drawing title blocks have been removed so as not to identify the project, client and supplier. The drawings have additional detail on them compared to that required for development approval, so as to assist with workshop detailing. The cold-formed shed industry typically does not produce drawings beyond scribble on the back of an order form: not for development approval and not for fabrication. The industry typically has salespeople and possibly estimators sketching out what they believe is required. The whole benefit of the cold-formed steel shed industry is that need little infrastructure, and simply need to fill in some purlin detail sheets and send of to local roll former of c-sections, and have a bundle of fabricated steel delivered straight to site depending on connection details. This typically fine for the smaller sheds but for larger warehouses with office space it is inappropriate.

In the past we typically worked with the suppliers and manufacturers and couldn't get them to change, very little interest in their product. Then  one day a steel erector turned up, he was unhappy about various issues with construction, and wanted to refine the design. Also turned out that supplier/manufacturers often failed to deliver all required parts for construction, and unable to get these parts from the suppliers on basis they contended that the parts not required. We recommended that the steel erector insist on workshop drawings being produced. The shed suppliers wouldn't provide, and workshop detailers not able to fit in with the nature of the shed industry. The result was the workshop detailing returned to my office, along with designing the sheds on a project by project basis, rather than the typical industry approach of having standard calculations and relying on local council to request further information to get calculations which match the proposed shed.

As long as the shed stays as a simple plain frame, then can analyse it using Kleinlogel formula in MS Excel, and the calculations are dropped to a few minutes. The time consuming effort is producing the framing plans for development approval, and the workshop details. Connection details are basically the same from one project to the next, and standard drawings simply need project name changing, though each new project may introduced additional detailing.

Now software like Autodesk Revit structural, or Tekla Structure, and other BIM  software, may be the ideal tool for such project: however they are far to expensive to justify given the amount of work involved and the relative simplicity of the structures. Also in terms of developing tools to improve point-of-sale decision making in the industry, tools like AutoCAD are too expensive to use as a graphics engine, whilst Multiframe is too expensive to use as an analysis engine. So MS Excel/VBA is typically the product to choose with possibly some low end CAD package, alternatively use the Excel shapes layer, and draw in Excel itself.

So slowly developing in-house tools to handle custom projects, whilst also developing tools which ultimately can be used by sales people at the point-of-sale. The objective is to reduce the problems caused, by bad design decisions at the point-of-sale. In particular the buildings that the industry can supply simply do not meet the needs of the buyers. But this is not identified until council rejects the suppliers development proposal, and requests further information, then everyone turns to consulting engineers to get calcs-for-council, as if that was all that was needed.

So the objective is to develop low cost automation tools based on simple parameters, which flags the need for custom engineering at the point-of-sale. Currently these buildings basically  sold like cars, except can ask for three of the wheels to be removed to cut costs and the sales person will say yes we can do that.

The real issue is developing a simply interface, at no point do want the sales-people operating a CAD package, but need to know the custom requirements for doors along the length of the building, and also know the different gable-end framing requirements. Also need to expand beyond the simple gable, to allow for double span, and the American barn type structure (gable, with lean-to each side).

So currently have a collection of different tools written in Excel/VBA, also some of which I originally wrote in Turbo C and others in Delphi. A part of development problem is deciding on application language, a great deal has now been written in Excel/VBA, but MS Access maybe better, and VB.net better again with respect to data storage and suitable user interface. In particular I can program a treeview in VB.net for my bill of materials (BOM) but not in VBA. On the otherhand I don't really like Basic programming language, its just that VBA is built into so many applications: and controlling anything and everything from Excel/VBA has been so convenient. For speed developing the Excel/VBA, and AutoCAD LT approach, with Microstran and Multiframe data file generation, seems to be the way to go, then slowly remove dependencies on other applications, and make stand alone. Part of which requires developing a 3D frame analysis program, already have 2D, but ultimately going to need it to be 3D.

Anycase currently finding all the bits and pieces cumbersome to use. So given that the purpose of this blog is to document the background as to how things develop, I thought I would document the current process, whilst I figure out in which direction to go and what to program next.


Fig:S01: Footing Layout

Fig:S02: Framing Plan

Fig:S03: Elevations:1

Fig:S04: Elevations:2

Fig:S05: Sections/ Portal Frames

Fig:S06: Gable End Wall Detail Section: Office End

Fig:S07: Gable End Wall Detail Section: Rear





Foot Note: Sample drawings printed to pdf file using pdfactory, then borders and title blocks removed, by taking snap shops using Bluebeam, and saving to jpeg using MS Paint, then file size reduced using Microsoft Office Picture Manager.


Related Posts:

Cold-Formed Steel Shed Industry: part:#2 : Dimension & Geometry (Acad LT)
Cold-Formed Steel Shed Industry: part:#3 : Summary of other requirements

Feasibility of Cold-formed Steel Shed (Simple Structural Software Application)


Other Blogs:

Other Information:

Sunday, October 16, 2011

Programming/Automating #Autocad LT


As far as I am aware the main reasons for opting for the full version of Acad are:

1) AutoLISP
2) COM automation
3) Database connectivity and SQL
4) Extended data
5) Complex entities/objects, 3D and otherwise

The seemingly most dominant reason that full Acad is chosen is because it is programmable through AutoLISP. The common myth is that AutoLISP is required to program AutoCAD. Since AcadLT does not have AutoLISP it is not programmable or customisable. Wrong!

AcadLT can be customised and its is programmable without any tricks or add-in LISP engines. Forget about the pretty toolbars, AutoCAD has a command langauge, and supports script files for those commands. The command language and script support is not as powerful as that in say the old DBase II/III, but it is none the less available.

The common criticism aimed at scripting is that it cannot do anything. For example to draw a line, the script would be:

Line 0,0 1000,1000

where as in AutoLISP it would be:

(command "line" pt1 pt2 "")

Where pt1 and pt2 can have any coordinates desired, thus the AutoLISP script can draw different lines, whilst the command script can only draw one line. However, the AutoLISP script is part of a much larger program which determines the values of pt1 and pt2, and instead of sending instructions to the Acad command line, it could equally well write the instructions to a file as follows:

(write-line (strcat "LINE " (ptstr pt1) " " (ptStr pt2) " ") fp)

Where (ptstr) is a user written function to convert the point coordinate lists to text strings, which can be written to a file (fp). The resultant plain text file can then be excuted from within Acad or Acad LT via the run script command. For simplified usage the script can always be written to the same location and file, such as default.scr, and this script can be executed from either a menu macro or toolbar button: once again in either Acad or Acad LT.

'_script default.scr 

Now such plain text files containing Acad command line instructions can be generated by any available programming language. On old MS DOS machines the most readily available programming language was GWBASIC, but other high level programming languages like Turbo Pascal and Turbo C may have been available. In the world of Windows XP and higher, every machine has available windows scripting host and can run VBscript or JScript.

For example in VBscript, can replace the AutoLISP instruction with:

fp.WriteLine("LINE " & ptStr(x1,y1) & " " & ptStr(x2,y2) & " ")

However most offices have MS Excel installed on most machines, and a few may have access to MS Access, in which case vba can be used to generate scripts. Script instructions can be generated in an Excel worksheet then copy/pasted into a text file, and run by the script command, alternatively the instructions can be pasted directly to the Acad LT command line. Similarly queries in MS Access can be used to generate a sequence of script commands either pasted to a file or direct to the Acad Lt command line. This approach is useful when converting simple data into graphics.

Example of Coldformed steel section generated from script pasted to Acad command line, from Excel worksheet. Worksheet can be found here.

For more advanced automation Excel/vba combination provides the means of collecting input in the worksheet and then writing a script file based on this worksheet data. In vba the typical script would be something like:


Print #fp, "LINE " & ptStr(pt1) & " " & ptStr(pt2) & " "

Where pt1 and pt2 are coordinates stored in a data structure as follows:

Public Type TCoord
  x As Double
  y As Double
  z As Double
End Type

To avoid keep writing the instructions for a line the following subroutine can be defined and used.

Public Sub write_line(fp As Integer, pt1 As TCoord, pt2 As TCoord)
  Print #fp, "LINE " & ptStr(pt1) & " " & ptStr(pt2) & " "
End Sub

call write_line(fp, pt1,pt2)

Similar subroutines can be written for other commonly used Acad LT commands. By building a library of such commands, it is possible to simply convert the program from one CAD package to another simply by rewriting the library to suit the CAD package. That is the main program written uses the users own subroutines and data structures, and should never need rewriting, but the library can be converted to use the data structures, objects and methods of a chosen CAD package. For example write libraries for scripts, DXF, Acad COM automation, TurboCAD, DesignCAD, MultiFrame, even the Excel shapes layer.

Now the problem with the script is it cannot select Acad entities, nor points. Many AutoLISP routines simply pick a single point on the screen then generate a parametric detail about this point. Most of the time (0,0,0) is a good enough start point and a new file is the place to start drawing, therefore no point needs to be selected. By generating a new file, and using xref to reference this file into the primary drawing, interaction with the Acad drawing editor can be minimised. Unless using handles and links to an external data base it is seldom necessary to modify entities. The primary objective is to automate drawing production, not interact with the drawing editor. If a full set of drawings for some parametric object can be generated in a few seconds there is no need to revise or modify the previous: simply regenerate using the modified parameters. Further more if critical parameters start out in Excel and are used to generate a drawing, then there is no need to extract such information from the Acad drawing database.

Interaction with the drawing editor is not highly productive, nor are dialogue boxes. A common flaw with AutoLISP routines is that they have dialogue boxes collecting mutiple parameters. The number of parameters collected by these dialogue boxes exceeds the number of parameters used by engineering. The problem is that engineering calculates the other parameters, used to specify a part. Due to the division of labour between drafter and engineer: the drafter draws and the engineer crunches numbers, there is consequently a lack of integration in the design activity.

It is more productive to write the AutoLISP routines without dialogue input boxes, rather write as subroutines requiring passing of parameters. Then write additional subroutines using dialogue boxes to collect the parameters and call the routine which does the actual drawing. The reason for this is so that the drawing routine can be used in much larger drawing application. Just as machines and buildings are made from component parts, also is a drawing using blocks and xrefs, and similarly a computer program using functions and subroutines. Just as blocks simplify building large drawings, so to do subroutines simplify writing large programs.

The first use of a drawing subroutine, may be to call it from a routine using dialogue boxes to collect all the drawing parameters. A future use may collect far fewer drawing parameters and calculate the rest. But of far greater value is the potential to string multiple subroutines together in sequence to draw something much larger and more complex from a few simple parameters.
Similarly, if this can be done using AutoLISP it can equally well be done using Excel/vba and the generation of scripts. What is more without the use of Acad or Acad LT, an engineer or other designer can generate a series of scripts in a common location, these scripts are then executed by the drafter using either Acad or Acad LT.

Excel/vba can also be used to grab a list of files, either drawings (dwg), DXF and then execute a set of script commands on each of the drawings. Similarly vba can get a list of scripts, and combine them into a single script to be launched in Acad LT. An alternative approach is to execute each script one at a time by calling Acad LT with command line switches, unfortunately with Windows multitasking causes a a timing problem. It is however the approach that was taken with Acad when using MS DOS. It was the failure of my Turbo C multiScripting program in Windows using Acad LT which led me to experimenting with generating scripts using QuattroPro spreadsheet with which I could easily grab a list of file names.

To launch Acad automatically from an application and run the script call Acad using command line switches, for example.

"C:\Program Files\AutoDesk\AutoCAD LT 2000\aclt.exe" /b default.scr

This can be configured in an Excel worksheet, so that can vary CAD applications used and the script names used. More samples can be found here.

Here is some sample output generated by scripts (*.scr).


From a few parameters steel framing plans, elevations and section for simple building generated in model space and paper space, all text with exception of grids placed in paper space. The above view shows the model space 2D stick diagrams, and the lower view a close up of the framing plan.



The following was originally written using DesignCAD, generating a 3D stick diagram of a shed, but then translated to use Acad scripts and draw more detailed elevation.





Simple stick diagram above. Below, model with detailed elevation, and permitting any number of spans.




The following is a close up of the knee connection.




A limitation of Acad Lt is not being able to generate 3D elements. I have used Lights for analysing tension membranes, and whilst it generated an Acad Script file, I was unable to run the file in Acad Lt since it could not create the 3D face elements, whilst intelliCAD 2000 used a different set of parameters to draw 3D faces so the script was incompatible. I therefore modified my Acad script library to use the intelliCAD COM objects. To produce the following, which is viewed in Acad LT.


I could have written the program using scripts in intelliCAD, but I used the opportunity to try out COM automation. The program reads the results from Lights, and then shades membranes elements in tension green, and elements in compression red. It is all on layers, so the membrane can be switched off, and the tension and compression elements of the supporting cables can also be viewed.

Another use of scripting is a simplified geographical information system (GIS). The following made use of MS Access, which was used to count the number of projects in a given area: mainly a UBD map. This data was then transfered to Excel, where a vba macro further sorted the data and generated a script which inserted a block on the appropriate layer. Red blocks represent areas with most projects, and paler blue blocks represent areas with least projects.



Each square represents one map from the UBD Adelaide street directory. The vba routines translate UBD map grid references into Australian Map Grid (AMG) coordinates so that can be located in Acad by (x,y) coordinates. In addition to the coloured blocks. circles were drawn at more localised positions, with the size of circle reflecting the number of projects in the area. The reference grid on each UBD map is about 250m x 250m, so objects typically located at the centre of these grids. For many things don't require the use of a fully blown GIS, since only concerned with relative distances between locations. For example nearest neighbours and hinterlands, or catchments of common facilities like shopping centres, hospitals, business competitors. The map shows that a lot of our work is dependent on the North East Road. It doesn't show projects outside the metropolitan area spread around the state and the country, and the occasional few outside the country. For an alternative GIS can take a look at MapMaker gratis this I have experimented with to generate contours whilst in the trial period with the professional version. The contours being for soil heave, caused by reactive clay soils. We have collected lots of bore logs over 16 years, and therefore, it should be possible to produce a contour map. At the moment I don't have subroutines to generate contours, but have found routines for generating Delaunay triangles, though generating Voronoi polygons would be even better for assessment of catchment areas. This far have written Acad scripts to do the triangulation, the rest is for a future date.

Any case if automation is the primary objective, and doesn't involve creation of 3D entities, then Acad LT can be used to automate a considerable amount of 2D work, or if stick diagrams are all that is required then it can also automate 3D models.


Recommended Reading
1 Microsoft Press (1997),"Micosoft Office 97 Visual Basic Programmers Guide", Microsoft Press
2 Jim Boyce, et al (1997), "Using Microsoft Office 97 Professional: Special Edition", Que
3 George Omura (1989),"AutoCAD instant Reference", Sybex
4 C W Sharp and W W Hamm (1989),"AutoCAD Advanced Techniques",Que
5 D Raker and H Rice (1990), "Inside AutoCAD: 5th Edition (metric)",New Riders Publishing
6 J Smith and R Gesner (1989),"Customising AutoCAD: 2nd Edition",New Riders Publishing
7 J Smith and R Gesner (1989),"Inside AutoLISP",New Riders Publishing
8 George Omura (1990),"The ABC's of AutoLISP", Sybex
9 Dennis N Jump (1989), "AutoCAD Programming", TAB Professional and Reference Books
10 AutoDesk(1995),"Users Guide: AutoCAD LT Release 2 for Windows",AutoDesk
11 Acad LT on line help system.
12 Burchard, Pitzer, Soen, et al (1997), "Inside AutoCAD 14", New Riders Publishing
13 AutoDesk(1999),"Getting Started: AutoCAD LT 2000",AutoDesk

Related Posts:

AutoCAD Speed Test
Automated Drawing List Update Acad LT (revised)

Cold-Formed Steel Shed Industry: part:#1 (Shed Framing Drawings)
Cold-Formed Steel Shed Industry: part:#2 (Shed Framing Drawings)