Welcome to Lee Mac Programming
Custom Programming Services
Want to harness the power of custom programming to save your company countless hours of repetitive work?
If there is a specific task that you wish to automate using custom programming, feel free to contact me to hire my services.
Want to know what you're missing out on? Read the testimonials of those who have worked with me and my programs.
Increase your AutoCAD Productivity
Make AutoCAD work for you by using custom programming to automate many repetitive tasks.
This site is primarily aimed towards utilising the AutoLISP & Visual LISP Application Programming Interfaces (APIs) to create custom programs which may be run within full versions of AutoCAD (not LT versions) and many of its derivative programs.
A Sample of my Work...
In addition to my custom programming services, I offer a plethora of free LISP programs available for you to download, covering a huge range of applications: from text manipulation to attribute extraction and everything inbetween.
The Tutorials page also offers an insight into how you can learn to create your own AutoLISP programs and quickly increase your AutoCAD efficiency and productivity.
Whether you are a complete beginner or perhaps more experienced, I have no doubt that you can benefit from the help & resources available here.
What is AutoLISP?
AutoLISP is a dialect of the LISP programming language engineered to enable manipulation & customisation of AutoCAD and many of its derivative programs such as AutoCAD Mechanical and AutoCAD Architecture. AutoLISP is restricted to full versions of AutoCAD and cannot be run in versions of AutoCAD LT without the use of an extender. Other applications such as Bricscad and IntelliCAD also have the ability to run AutoLISP programs.
Visual LISP is an extension of AutoLISP introduced as an add-on to AutoCAD R14, and subsequently fully incorporated into the release of AutoCAD 2000. Visual LISP uses the ActiveX/COM interop and offers many advanced functions to aid with customisation.
New to AutoLISP?
Not sure how to run a program? Be sure to see my tutorial on Running an AutoLISP Program.
17th May 2013
I have now updated my old Copy to Drawing program to Version 1.2 and have renamed the program: Copy to Drawings. As the new name suggests, I have now lifted the single drawing restriction, with the updated version allowing the user to copy a selection of objects to an entire set of drawings, without opening each drawing in the AutoCAD Editor.
4th May 2013
I have now included a new tutorial on the topic of Selection Set Processing to the AutoLISP & Visual LISP Tutorials section of the site. This tutorial demonstrates a variety of different methods of how to iterate over all objects in a selection set, together with a brief explanation of how each method works and the efficiency of its operation.
1st May 2013
Updated my recently released Associative Textbox program to Version 1.2 to fix a bug causing MText & LWPolyline objects residing in Paperspace Layouts to be transferred to Modelspace.
30th April 2013
Updated Associative Textbox program to Version 1.1 to fix a bug causing the program to crash during loading if other reactors with reactor data with non-string data type are already running in the active drawing session.
Added Associative Textbox program to the site. This reactor-based program enables the user to create an associative textbox surrounding a Text or MText object, with the size, position, orientation & rotation of the textbox frame automatically updated following modification to the associated Text or MText object.
Added Filtered List Box function to the Subfunction Library section of the site. Similar to my existing List Box function, this function also presents the user with a dialog interface containing a list box tile from which the user may select one or more items, however, the displayed dialog for this function also includes an edit box tile, enabling the user to filter the list of items displayed.
23rd April 2013
I have updated my Align Text program to Version 1.3; this version allows the user to reposition a selection of single-line text objects with any rotation, aligned in a direction perpendicular to the text rotation. The updated program will furthermore perform successfully with text constructed in any UCS plane.
18th April 2013
I have updated my Total Length & Area Programs to simplify the code and improve the readability & consistency of the programs.
My Get Files function has been completely rewritten and updated to Version 1.2. The updated version implements a bug fix to account for Library folders encountered with Windows 7, and also incorporates a new and improved file sorting function.
ObjectDBX Wrapper function completely rewritten and updated to Version 1.2 to include more error trapping and to condense the code, improving both readability & performance. Directory Dialog function also updated and renamed to BrowseForFolder for consistency with the method used by the function.
28th March 2013
I have updated my GrText function to Version 1.1. The function has been completely rewritten with the previous 'Extended ASCII' version now included in the main function for consistency. The redundant colour argument has also now been removed to improve compatibility when the function is used with DCL. The program page has also been overhauled to provide a far better description of the various demonstration programs, which have also been rewritten and updated.
8th March 2013
Added Text to Words program to the site. This program enables the user to convert a selection of single-line text objects into separate text objects for every word in the selection, whilst retaining all properties of the original objects.
5th March 2013
I have added the functions Matrix Inverse (gile / Lee Mac) & Identity Matrix to the Matrix & Vector Functions section of my Mathematical Functions page. The Matrix Inverse function uses the technique of Gauss-Jordan elimination to calculate the inverse of a given nxn non-singular matrix. The original version of this function was written by the talented gile (Gilles Chanteau), which I have modified for increased performance & concision. The included Identity Matrix function will return an nxn Identity Matrix with dimension given by the supplied integer parameter.
Updated my Dump Object utility function to Version 1.1 to improve the function structure & readability.
4th March 2013
My Automatic Block Break program has been mostly rewritten and updated to Version 1.5 to incorporate a new & improved function to calculate the rectangular bounding box of a block, resulting in accurate results when applied to Dynamic Block references; and furthermore to fix a bug wherein the program would attempt to break Multiline objects. Other minor changes have also been implemented to improve and streamline the program.
I have also updated the Automatic Block Break program page, rewriting the description to describe each available command in greater detail and to include several new animations to better demonstrate the program capabilities.
Updated my Mapcar & Lambda tutorial to reformat the examples and fix a reported broken link.
10th February 2013
Following recent development of my 5-Point Ellipse function, I have added a new Advanced Polyline Outline program to the General Programs section of the site. The program allows the user to construct an outline silhouette of an LWPolyline with straight and/or arc segments with varying or constant width.
Added 5-Point Ellipse function to the Subfunction Library section of the site. This function will return the parameters of the unique ellipse passing through five supplied points, if such an ellipse exists. The method used to determine these parameters is described on the function page linked above.
Added Matrix Determinant (by ElpanovEvgeniy) & Matrix Trace functions to the Matrix & Vector Functions section of my Mathematical Functions page; as the names indicate, these functions will respectively calculate the determinant and trace of a given nxn matrix.
6th February 2013
Updated Background Mask program to Version 1.1 to alter the command syntax for the program to bmask, since mask is an existing command in AutoCAD Civil 3D. The update also implements several other minor improvements to the code.
2nd February 2013
Added Ellipse to Arc program to the site. This program will allow the user to convert a selection of circular Ellipses & Elliptical Arcs (that is, Ellipses or Elliptical Arcs with axes of equal length) into Circles & Arcs respectively, whilst retaining all properties of the original objects.
I have also updated my Circular Wipeout program to Version 1.1. This updated version includes an additional command, c2wipe, which enables the user to convert a selection of circles to circular wipeouts.
1st February 2013
29th January 2013
Added Circular Wipeout program to the site. As the name implies, this program enables the user to create a circular wipeout with a given center & radius in the drawing.
28th January 2013
I have updated my set of Unique & Duplicate List Functions to rewrite & improve many of the existing functions and moreover to include iterative versions of every function listed. I have also added a table of contents to facilitate navigation of the page.
It's a bit late in the month, but I wish all of my readers best wishes for 2013!
24th December 2012
To keep with the festive theme of this time of year, I have published an article exploring the curious & intriguing geometrical properties of the Koch Snowflake. This program may be found under the Mathematical Endeavours section of the site.
I have also updated my study of various chaotic Attractors to include a table of contents, clearer systems of equations for each attractor, greatly improved & more readable code, and finally, a derivation for the Duffing Oscillator.
Finally, I wish all of my readers a very Merry Christmas!
18th December 2012
Added Chain Selection program to the site. This program prompts the user to select an object and generates a 'chain selection' of all objects sharing endpoints with objects in the accumulative selection.
14th December 2012
Updated Align Objects to Curve program to Version 1.3 to enable the user to align the selection of objects to a nested curve within a Standard or Dynamic Block or XRef, nested to any level.
11th December 2012
My Align Objects to Curve program has now been completely rewritten and updated to Version 1.2 to enable the program to perform successfully in all UCS & Views. The alignment controls offered by the program have also been refined, with the additional option to allow the user to rotate the set of objects relative to the selected curve.
6th November 2012
Added functions LM:Reflect & LM:InsideTriangle-p to my set of Mathematical Functions. The former will reflect a given point in the axis defined by two supplied points in the plane; the latter is a predicate function which will return T if a given point lies within a triangle defined by three supplied points. In addition to the inclusion of these supplementary functions, I have also organised the library of Geometric Functions into appropriate sub-categories for ease of navigation.
31st October 2012
As a treat for Halloween, I have added a new novelty program to the site. Lottery Numbers is a relatively simple novelty program generating a sequence of random numbers in the form of lottery balls in the drawing. Good luck!
21st October 2012
I have updated my library of Intersection Functions; this set of functions provides the ability to retrieve points of intersection between either two objects, all objects within a Selection Set or list, or between objects of two Selection Sets or lists. The functions have been completely rewritten to improve readability, concision & performance, and the entire function page has been overhauled to provide detailed information about every function, including animated demonstrations and diagrams.
16th October 2012
I have updated my Mathematical Functions page to incorporate a set of Complex Number Functions, pertaining to the arithmetic manipulation of complex numbers; and Factorial Functions, which may be used to calculate the factorial of a positive integer, in addition to the multiplication and division of two factorials. I have also renamed several of the Matrix & Vector Functions present on the page to improve consistency. Various Geometric Functions have also been updated to reflect the renamed function names and earlier modifications to the Polygon Centroid function.
Updated Polygon Centroid function to account for the case in which the coordinate scale factor is zero, and hence eliminating a potential divide-by-zero error.
I have updated the Testimonials section of the site to include a testimonial kindly received from John Hailey at CBI/Matrix Engineering - thanks John!
12th October 2012
Added set of Random Number Functions to the site. These functions involve the generation and manipulation of pseudo-random numbers using a linear congruential generator.
Updated Popup function to Version 1.1 to revise the code formatting and improve the readability of the function.
8th October 2012
I am pleased to list Paul Munford's blog The CAD Setter Out as an affiliate site of Lee Mac Programming. Paul's blog is packed with useful information on AutoCAD and Inventor, including a cornucopia of tips, tricks and tutorials exuding Paul's evident enthusiasm for everything CAD related. I also encourage followers of my site to vote for my link as your favourite CAD site on his links page here.
5th October 2012
Added Isometric Polygon program to the site. This program enables the user to construct a regular polygon projected in the active isometric plane.
19th September 2012
I have updated my Update Titleblock Attributes program to Version 1.5. The new version of the code revises the CSV file parser function to account for the use of alternative cell delimiter characters (such as a semi-colon) used by some systems.
18th September 2012
Updated Steal program to Version 1.8. This revision fixes a minor bug present in the recently released Version 1.7 wherein the program would error if all items in a selected collection were deselected by the user using the Ctrl key, and then the Import button is pressed. Furthermore, in this updated version, the active drawing will only be regenerated (following program completion) if one or more items have been imported by the program.
16th September 2012
Steal Version 1.7 released.
After evaluating the excellent feedback submitted by numerous users for this program, and having reviewed the many suggestions for improvement that were submitted since the program was first released to the public, I have invested some time implementing many of the proposed ideas and have injected a few additional features of my own into this new release of my Steal from Drawing program.
This release also improves the general performance of the program, with much of the original source code rewritten and restructured, furthermore, some previously undetected bugs have now been ironed out to provide a more stable and reliable program.
A number of the more significant changes and new features are detailed below:
- The Steal file selection dialog will now remember the directory of the last selected drawing between drawing sessions so that the user will spend less time navigating a project folder structure when selecting a drawing to steal from.
- Groups, Drawing Properties and Custom Properties have all been added to the list of collections from which the user can steal items. The inclusion of Drawing Properties was a popular request for the last program, so this new addition should hopefully benefit a large proportion of users.
- A Refresh button has now been incorporated into the dialog to enable the user to refresh the drawing data after importing items with object dependencies (for example, importing blocks or groups will also import dependent layers, linetypes, nested blocks etc.).
- The Search button has been exchanged for an appropriate bitmap icon and I have replaced the multiple alert dialogs with a rather more subtle dialog error tile for a more streamlined user experience.
- Two new commands have been added to the program: StealLast allows the user to immediately steal from the last selected drawing (if available); and StealTemplates enables the user to steal items from a specific template file, selected from a list of template files found in the template drawing path.
- Several other general improvements and bug fixes have also been implemented and are detailed in the program code header.
9th August 2012
Added Polyline Information program to the General Programs section of the site. This program provides the user with detailed information about every segment of a selected LWPolyline in the form of an AutoCAD Table (if available), Text file, or CSV file.
2nd August 2012
Updated my Batch Attribute Editor program to Version 1.4. This version implements a refined file and folder sorting function to emulate the Windows Explorer filename sort when selecting drawings to be processed by the program. The updated program also increases the character limits of the edit_box tiles in the dialog to allow for the use of long Field Expressions in attribute values. Other general bug fixes are noted in the program code header.
27th July 2012
Added HTML versions of many of the programs available for download on the site, allowing the user to view the program source code directly in the web browser, with the choice of three syntax-highlighting themes. Take a look at the various programs under the General Programs section of the site, and click on the 'View HTML Version' link try this new feature of the site.
21st July 2012
Added Delete Blocks program to the site. This program enables the user to quickly remove all traces of multiple blocks from a drawing.
20th July 2012
Updated List Box function to standardise code formatting and rewrite several expressions to improve clarity and readability.
18th July 2012
17th July 2012
I have once again updated my Nested Block Counter to Version 1.4 to implement another fix for an issue relating to counting Standard Blocks nested within Dynamic Blocks which are using different Visibility States. This issue should now (hopefully) be fully resolved.
12th July 2012
I have restructured and rewritten several sections of my Error Handling tutorial to provide clearer explanations and cleaner code samples.
11th July 2012
I have updated my Nested Block Counter program to Version 1.3. This update provides a fix for an issue arising when counting Standard Blocks nested within Dynamic Blocks which are using different Visibility States. The new version also offers the ability to extract the block report to either a Text or CSV file.
3rd July 2012
Added Write CSV function to enable a user to write a list of cell values to a CSV file. An example program is also included on the program page, demonstrating the ease of constructing a program to extract point data to a CSV file by utilising the LM:WriteCSV function.
Updated my Read CSV function to restructure the code for better readability and performance, provide support for international systems which do not necessarily use a comma as a CSV delimiter character, and improve the cell parsing function to return more accurate results for cells containing commas and quotes.
Minor updates to my Bulge Conversion Functions to update the code formatting, shorten and improve the test functions and re-order the returned values for my Arc->Bulge function to reflect the order in which the values are used when constructing an LWPolyline.
23rd June 2012
Updated set of Draw Order Functions to Version 1.1. This update is a complete overhaul of the code for both the draw order functions and example custom draw order programs found on the program page. The functions now provide support for 64-bit systems, and the example programs will now process objects on locked layers.
18th June 2012
Incremental Numbering Suite Version 3.3 released.
After much planning, experimentation, redesign and deliberation of ideas for new features, I have finally released the new version of by far my largest, most popular and also most extensively developed program:
I present Version 3.3 of my Incremental Numbering Suite.
This release includes more changes and is packed with more new features than any other release since the program was first drafted. The Program Description has also been predominantly rewritten to document all of the new program functionality.
A number of the more significant changes and new features are detailed below:
- I have added the ability to increment multiple sections of the incrementing string: the previous radio button controls which were used to allow the user to decide which section of the string is to be incremented have now been replaced with toggle controls to enable the user to increment any or all sections of the string, alphabetically or numerically simultaneously.
- I have added the ability to create an array of incrementing Text, MText or Block objects, with the selected object aligned or perpendicular to the array, or with rotation set to an entered arbitrary angle, or an angle picked from the drawing. This is probably the most significant addition to the program operation, providing an additional method for the user to generate the incrementing text in a drawing, with all of the existing formatting options applied. This new functionality is described in more detail on the program page under the section Creating an Array, which also includes several animated examples to demonstrate.
- Included a set of controls within the Formatting section of the dialog to give the user the ability to control MText Background Mask offset factor and colour. The controls are very similar to my existing Background Mask program, so frequent users of my programs will already be familiar with how to operate this section.
- Added the ability to specify the block scale as an arbitrary value, a value picked from the drawing, or based on the value of a selected System Variable. In previous versions of the program, a block would always be inserted at 1:1 scale, offering no option to change this scale. This new version not only allows the user to enter or pick any scale value, but the scale can also be directly dependent upon the current settings of a selected System Variable.
- Provided the user the option to pick the Text Height value from the drawing. This change is to conform with the other edit box input sections of the dialog which require a numerical value, allowing the user to pick a value from the drawing itself.
- Text & MText Border Offset is now a factor of text height where an offset factor of 1.0 exactly fits the Text or MText object, a factor of 1.5 extends the border by 0.5 times the text height etc. This emulates the behaviour of the newly implemented MText Background Mask, and enables the user to easily create a rectangular border around the background mask by specifying the same offset factor for both. This to me seemed more intuitive.
- Added the ability to increment the string during placement by pressing the I / i key. This change followed from the 'toggle counter' control (T / t), and allows the user to increment the string independently.
- As a rather more aesthetic change: I have redesigned 'About' dialog to include appropriate bitmap images and a stylized program title. Following with the aesthetic theme, I have also redesigned all object selection and pick buttons to conform with standard AutoCAD dialog interfaces to make users feel more 'at home' with the program.
- Finally, where general bug maintenance is concerned: I have fixed a bug causing program to crash if the Object type is set to 'Text' and Text Alignment is set to 'Left', then the Object type is switched to 'MText'.
- I have also fixed a bug in which the program would check for possible incorrect border parameters when the Object type is set to 'Block' (in which no border may be used).
16th June 2012
Added Consistent rtos function to the Subfunction Library section of the site. This fairly simple wrapper for the rtos function will always return the result of evaluating the rtos function with the DIMZIN System Variable set to 0, thus eradicating any incongruency when using this function in different drafting environments.
14th June 2012
Added Version 1.1 of my Label program to the site. This program is a stripped down, faster & improved version of my previously published Align Text to Curve program; the program has been streamlined to allow the user to create MText 'labels' dynamically aligned to a selected primary or nested object, with additional placement controls available at the command-line.
10th June 2012
Modified the following programs to both update code formatting and improve the flow & readability of the code:
- Updated Align Text program to Version 1.2.
- Updated Centreline program to Version 1.1.
- Updated Multilines to Polylines program to Version 1.1.
18th May 2012
Added Extract Nested Block program to the General Programs section of the site. This program will allow the user to convert a nested block into a primary block inserted at the same position for each reference of the nested block, with the same scale, rotation, orientation and all other properties possessed by the original nested block.
5th May 2012
My Batch Attribute Editor has now been upgraded to Version 1.3. This update implements several new features in addition to remedying a couple of minor bugs present in the previous versions.
A brief summary of the notable improvements have been included below:
- The attribute modification module has been completely rewritten to utilise Visual LISP methods, enabling processing of Multiline Attributes and also permitting the use of Field Expressions in attribute values.
- I have added the ability to use incrementing attribute values in attribute data. If an attribute value contains markers <# and #> surrounding numerical data, the numerical section between these markers will be incremented by one for each drawing processed by the program. More information about this feature is detailed in the program description, under the section entitled: Incrementing Attribute Values.
29th April 2012
Updated my Steal program to Version 1.6. Amongst other general updates to the program code, this version fixes a bug causing the program to crash for versions in which some collections are not available.
24th April 2012
Updated Layer Director to Version 1.1. In this version, the majority of the program has been rewritten to streamline the code. The previous Command Reactor toggle has been removed in lieu of two separate commands to switch the program on & off; this alteration follows reports by users that the previous version would toggle on then promptly off when loaded through the Startup Suite.
20th April 2012
Updated Quick Field program to Version 1.1. This version implements a fix for a reported bug which was causing the program to crash when used in 64-bit environments.
16th April 2012
Added Background Mask program to the site. This program allows the user to manipulate all properties of the background mask for a selection of Multiline Text (MText) and Multileader (MLeader) objects.
14th March 2012
Areas to Field program completely rewritten to incorporate better support for 64-bit systems and also improve code readability. GIF demonstration added to the program description page.
5th March 2012
I have updated my Batch Attribute Editor program to Version 1.2. This update hopefully implements a fix for the scripting bug present in previous versions of the program, and also offers the user the ability to select multiple attributed blocks from the active drawing whose attribute values may be added to the list of items to be modified. This should no doubt greatly reduce the tediousness of manually inputting the attribute information.
2nd March 2012
Updated Incremental Numbering Suite program to Version 3.2. This update fixes a number of bugs, the most prominent pertaining to the collection of attributed block data.
26th February 2012
Rewritten the code for Copy Block from Drawing program to make it consistent with many of my more recent programs and furthermore to improve code readability.
22nd February 2012
I have completely rewritten my Slinky Text program and have updated the program to Version 1.4. This new version has cleaner code and includes several performance enhancements which should allow the program to run smoother.
18th February 2012
Added Format DCL program to the Utilities section of the program page. This program will read a selected DCL file and create a formatted version of the DCL code in the same directory as the selected file.
10th February 2012
Updated Batch Attribute Editor to Version 1.1. This update fixes some scripting issues reported in the last version and splits the main dialog into two separate screens to account for those users without access to a widescreen resolution. More information about the update can be found in the program code header.
8th February 2012
30th January 2012
In June of 2009 I put together the first version of my Global Attribute Extractor & Editor program, offering the user the ability to extract attribute data from multiple blocks in many drawings, and edit several attributes in a block across multiple drawings.
This program used ObjectDBX to process many drawings very quickly, but this approach also included drawbacks stemming from the underdevelopment of the ObjectDBX interface, which, to this day, still has bugs. Furthermore, the Editor part of the program only offered the ability to modify attributes in a single block.
Almost three years later, I am now offering a new Batch Attribute Editor program. This program allows the user to modify the values of multiple attributes residing within multiple attributed blocks across multiple drawings. A full description of this new and improved program may be found on the dedicated program page.
20th January 2012
19th January 2012
Added LISP Command Logger program to the site. This program will automatically (and silently) record daily LISP command usage in every drawing to a CSV Log File, saved to a folder specified in the program source code.
17th January 2012
Added Nested Block Counter program to the list of General Programs. This program will generate a report detailing the individual quantities of primary and nested blocks, dynamic blocks & XRefs in a selection or an entire drawing.
16th January 2012
Updated Read CSV function to return the correct content of CSV cells containing commas and quotes, and to correctly read CSV files generated using OpenOffice software.
Previously, when reading a CSV file with the following content:
The old ReadCSV function would incorrectly return the list:
(("abc" "\"a" "b" "c\"" "\"\"\"abc\"\"\"" "\"\"\"a" "b" "c\"\"\""))
The updated function now correctly returns:
(("abc" "a,b,c" "\"abc\"" "\"a,b,c\""))
12th January 2012
I found a few minor bugs in the code for my recently added Get Files Dialog function pertaining to the behaviour of mode_tile statements for the Add Files and Remove Files buttons. These have now been fixed and the code has been updated to Version 1.1.
11th January 2012
9th January 2012
First post of 2012: a Happy New Year to my readers!
Added Read CSV function to the Subfunction Library. This function will read an Excel Comma Separated Value (CSV) file and return a matrix list of the cell values, that is, a list of lists where each sublist is a row of cell values.
30th December 2011
The code for my Unformat String function has been completely rewritten; the new version should be more robust with far more error trapping. The Unformat String function will remove all MText formatting codes from a supplied string.
29th December 2011
Updated Open function code and included an extra example demonstrating how the function may be used to open an arbitrary file selected by the user.
Reformatted the code for the Ortho Point function and included a 'Vector Calculus' version of the same function to demonstrate another approach.
27th December 2011
Revised the Update Titleblock Attributes program to Version 1.3. This version implements a modification to allow the program to correctly process CSV files generated using OpenOffice software.
24th December 2011
Updated the Iterated Function Systems mathematical program to Version 1.2. This is a complete rewrite of the program, including an update to the Barnsley's Fern program on the main page.
23rd December 2011
Updated Fractal code to remove unnecessary expressions and hence improve performance.
21st December 2011
Updated the Dynamic Block Functions page and added a Contents section to ease navigation of the various functions.
17th December 2011
Added Polygon Centroid function to the Subfunction Library. This function will return the centroid (expressed relative to WCS) of an LWPolyline Polygon, that is, a non-self-intersecting closed LWPolyline consisting entirely of straight segments.
Also added PolyCentroid function to my set of Geometric Functions.
Updated Attribute Functions page to reformat all code and include new function: SetAttributeValues.
Added a Contents section to the Attribute Functions page.
7th December 2011
Added Get Anonymous References function to the Subfunction Library. This function will iterate over the block table and return a list of the names of all anonymous references associated with a supplied block name; armed with such a list, an appropriate ssget filter list may be constructed to include only those references which are relevant to a specific dynamic block.
2nd December 2011
Added 3-Point Circle & Arc Functions to the Subfunction Library. These functions return the data required to construct a Circle or Arc from three supplied points. A variety of non-dynamic and dynamic test programs are also included.
Added mid, 3PCircle & 3PArc to my set of Geometric Functions.
Added v1 function to my set of Matrix & Vector Functions. This function will return a unit vector representation of a supplied vector.
27th November 2011
Updated Reset XRef Layers program to Version 1.1. This version incorporates code to search the working directory and AutoCAD support directories for the XRef source file, should such file not be found at the filepath encoded in the XRef.
24th November 2011
Tweaked the style of the Programs page.
19th November 2011
Added Reset XRef Layers program to the General Programs section of the site. This program enables the user to reset all or specific layer properties of XRef dependent layers to match the properties present in the XRef source drawing file.
16th November 2011
Added Minimum Enclosing Circle program to the General Programs section of the site. This program offers two commands to allow the user to make a selection of one or more objects, then proceed to construct the unique minimum enclosing circle containing all objects in the selection.
A minor update to the Entity to Point List function to include Point Entities.
11th November 2011
9th November 2011
Added Entity to Point List function to the Subfunction Library. This function will return a list of points describing or approximating a supplied entity, whilst minimising the length of the returned point list where possible.
6th November 2011
Added Quick Field program to the site. This function is designed to enable the user to quickly and easily design & create custom programs for inserting multiple fields into a drawing. This could be for use in situations in which the user is required to create many fields in a drawing, with each field referencing the same object property, and continued use of the Field Command Dialog can become tedious.
5th November 2011
Added Get Field Objects function to the Subfunction Library. This function requires a single parameter: an entity containing a Field, and will return a list of entities referenced by the supplied Field.
3rd November 2011
Added Friends of Lee Mac Programming to the homepage sidebar. If you wish to become a friend of Lee Mac Programming and feel that your site has suitable content which is relevant to my site, feel free to contact me.
Whether or not your site is suitable to become an affiliate of Lee Mac Programming feel free to display my microbar on your site, I appreciate you linking to my site.
1st November 2011
Added to the Subfunction Library a function to compute the Convex Hull of a set of points. The Convex Hull is the set of points describing the minimum convex polygon enclosing all points in a given set. The function shown implements the Graham Scan algorithm to compute the Convex Hull - a description of this algorithm including a visual demonstration of the process is included on the program page.
In other news... Lee Mac Programming is a year old!
30th October 2011
Updated Area Label program to Version 1.9. This update fixes a bug causing the program to crash when Region Objects were selected.
29th October 2011
Tweaked the code for the Entity List utility. The program has now been renamed and more accreditation has been included to recognise the author of the program on which the utility is based.
Redesigned the site Contact Form.
24th October 2011
If you or your company wish to share your thoughts about my site, or working with me or my programs in the form of a testimonial, feel free to contact me.
23rd October 2011
Added Draw Grid program to the site. This program will prompt the user for a number of rows and columns then proceed to dynamically construct a grid composed of Line Entities between two corner points.
20th October 2011
Added Automatically Label Attributes program to the site. This program uses multiple reactors to automatically label / number a specific attribute in a set of blocks, automatically renumbering if blocks are added, copied or erased.
11th October 2011
Updated Incremental Numbering Suite to Version 3.1. This fixes a bug concerning a null variable when an Annotative Text Style is set and the Object type is set to use an Attributed Block.
10th October 2011
Incremental Numbering Suite Version 3.0 released.
The program is now faster & smoother and has become my largest and most developed application, with many new features and updates included in the new version, a handful of which I have listed below.
I have also completely rewritten the program description to give a more complete overview of the program capabilities.
- Program completely rewritten to improve program performance, update code formatting to improve readability and include the following new features:
- Ability to use Text, MText or an arbitrary Attributed Block to house incrementing string.
- Ability to change Text / MText Alignment.
- Ability to toggle the use of a Background Mask with MText.
- Ability to specify and pick both dimensions for the fixed size Slot / Rectangular border.
- Vastly improved alphabetical text incrementing.
- Improved handling of negative numbers with decimals or leading zeros.
- Dialog interface completely redesigned to make it more user-friendly and intuitive to navigate.
- Immensely improved non-dynamic mode interface & functionality.
- Program works in all UCS/Views correctly.
7th October 2011
Version 3.0 of my Incremental Numbering Suite program.
Following the popularity of this program on my site, I am currently working on a new version which promises to be smoother, faster and packed with new features.
Click here to read about some of the planned new features and see a preview of the new interface.
3rd October 2011
Added set of Text Case Functions to the Subfunction Library. These functions demonstrate how to convert a text string to various text cases and formats. Included are functions to enable conversion of a text string to Sentence Case, Title Case, or finally, the case of each character in a string may be switched using the Toggle Case function.
2nd October 2011
Copy to Drawing program completely rewritten and updated to Version 1.1. When rewriting this program I have significantly condensed the code, reformatted the code style to make the source code more readable and easier to follow, and hopefully improved the performance of the program.
30th September 2011
Updated Automatic Block Break program to Version 1.4. Included in this version is an option to enable or disable the automatic rotation of the block if a curve object is found at the block insertion point.
Added set of Assoc++ Functions to the Subfunction Library. These functions may be used to increment the associated value of a key in an association list, or a nested key as part of a hierarchy of keys in a nested association list. Such functions are useful when counting the number of occurrences of distinct items in a set, or when counting items which are dependent upon other items. These functions are used in many of my programs: Block Counter, Text Counter, Count Attribute Values & Dynamic Block Counter to name a few.
Updated Incremental Array program to Version 1.4. This version fixes a bug when arraying and incrementing attributes on locked layers.
28th September 2011
Added Clockwise-p and ListClockwise-p to my set of Geometric Functions. These functions may be utilised to determine whether 3 or more points are clockwise oriented, that is, whether a path passing through the points follows a clockwise direction.
24th September 2011
Implemented a facility to allow users to change the width of pages on the site, depending on their preference. Users may select a Fluid, Wide, Medium or Narrow width setting. The default width is Fluid in which the width of the page is set by the width of the browser. Other settings may be more suitable for various screen resolutions.
21st September 2011
Added Pad Between Strings function to the subfunction library. This function returns a string of a minimum specified length which is the concatenation of two supplied strings, padded between using a supplied character. Such a function is extremely useful when printing reports or lists to the command-line, and is used extensively in my Dynamic Block Counter program.
20th September 2011
Implemented a facility to allow users to alter the size of text on my site, increasing readability.
Added Custom Programming Services section to the Home page, for those companies looking to automate repetitive tasks in their procedures via the use of custom programming, potentially saving hours of valuable time.
11th September 2011
Added Dynamic Block Counter program to the site. Very similar to my Block Counter program, this program will count all blocks in the current layout of a drawing - be they standard, dynamic, or XRef; generating a report of the quantities at the command-line. Furthermore, for every dynamic block with a Visibility Parameter present, the number of blocks assuming every Visibility State of the dynamic block is detailed in the output report.
10th September 2011
Added Get Visibility Parameter Name, Get Visibility State, & Set Visibility State functions my set of Dynamic Block Functions. These functions allow the user to manipulate the Visibility Parameter of a Dynamic Block.
Updated SelectionSet Bounding Box function and test program to make the code more succinct and increase function performance.
7th September 2011
Updated Steal from Drawing program to Version 1.5. This version implements a number of changes to improve the program:
- Added the ability to use Wildcard Patterns in the ItemList parameter to allow all items in a collection which match the supplied wildcard pattern to be imported.
- Added Materials and Named Viewports to the list of collections.
- Added StealAll command to allow the user to automatically steal everything from a selected drawing file.
- Added StealTemplate command to enable the user to quickly steal items from the QNew template file (or other template file, if the QNew template file is not set).
5th September 2011
Updated Polyline Outline program to Version 1.1. This version includes a fix for a minor bug relating to incorrect processing of the ending width of the final polyline segment.
3rd September 2011
Added Polyline Outline program to the site. This program will create one or more LWPolylines along the boundary of a supplied LWPolyline with varying or constant width.
28th August 2011
Upgraded Update Titleblock Attributes program to Version 1.2. This version removes case-sensitivity from the 'Drawing Filename' column of the CSV Drawing Register so that both the drawing filename data (first column) and layout data (optional, second column) are not case-sensitive. I have furthermore added a GIF animation providing a succinct demonstration of how the program may be used to link a set of drawings to a drawing register.
25th August 2011
Updated Copy or Rename Block program to Version 1.3. This version allows the user to copy and rename External References (XRefs) in addition to Standard and Dynamic Blocks; retaining any XClips associated with the selected block.
24th August 2011
Added Incremental Array program to the site. This program will array a selection of objects, whilst incrementing any numerical content found in objects containing text within the selection.
19th August 2011
Added Elevation Marker program to the site. This relatively simple program allows the user to continuously place elevation markers composed of an LWPolyline and Text object at specific points in a drawing.
14th August 2011
Added Minimum Bounding Box function to the subfunction library. This function uses a brute-force method to determine the minimum rectangular bounding box framing all objects in a supplied selection set.
6th August 2011
Added Visual LISP IDE tutorial: A Shortcut to Localising Variables to help relieve the tedium of localising many variables in larger programs, reducing the task to a simple copy & paste operation.
5th August 2011
Updated Text Counter to Version 1.1. This program will count the number of occurrences of distinct text strings in a selection of objects. In addition to reformatting the code for this program, this updated version includes the ability to count MLeader text and Dimensions with a text override. Annotative text styles have also been taken into consideration when determining the size of the resultant table object.
3rd August 2011
Added Error Message Troubleshooter to the Tutorials page. This page provides a brief guide detailing the possible causes of a selection of common error messages received when executing an AutoLISP program.
Updated my Automatic Block Break program to Version 1.3. This update implements a complete change to the method used to detect intersections between the inserted block and surrounding objects, improving program performance. The new version of the program will now exclude attributes from the trimming operation, and will trim objects surrounding blocks whose insertion points do not lie on a curve object (in previous versions such objects were not trimmed). Finally, a new command: 'ABBS' (AutoBlockBreakSelection) has been added to allow users to make a selection of multiple blocks to be processed by the AutoBlockBreak subfunction.
27th July 2011
Added Edit Box subfunction to the site. This very simple function utilises a predefined AutoCAD dialog definition to display an interface allowing the user to input a text string.
22nd July 2011
It has been almost a year since I have worked on my Batch Find & Replace Text program, and considering its apparent popularity amongst the other programs on my site, I felt it was about time that I updated it.
The majority of the program code has hence been rewritten and reformatted in line with my other more recent programs, and the following enhancements have been incorporated:
- Added 'Where to Search' panel to the Options dialog to enable users to restrict the Find & Replace operation to Model space, Layout space or both.
- Added ability to perform the Find and Replace operation on objects within Block Definitions.
- Added ability to process All Open Drawings.
- Changed format of Saved Searches file for easier manual editing.
- Added Current Directory toggle to directory selection panel to allow the user to quickly select the current working directory of drawings for processing.
- Fixed tab stops in main dialog so that the user may navigate between the Find and Replace edit boxes more intuitively.
- Incorporated ability to add items to the Find & Replace list by pressing Enter from within either edit box.
- Added ability to press Enter after specifying Save Reference to avoid the need to click the OK button.
- Added ability to press Enter from within either edit box of the Edit Entry dialog, to avoid the need to click the OK button.
- General bug fixes and function improvements.
15th July 2011
Added String Wrap function to the site. This subfunction will break a supplied string at spaces (if possible) into a list of substrings, each of a specified length or less.
9th July 2011
Added set of Bulge Conversion Functions to the subfunction library. These functions demonstrate various methods to convert between the quantities used to define a Polyline Arc segment and those used to define an Arc Entity, with diagrammatic explanations of the calculations used in each method.
8th July 2011
Updated List Box Synchronisation tutorial to fix a few typos.
2nd July 2011
Added set of List Box Functions to the subfunction library. These functions may be used to manipulate the order of multiple items in a DCL List Box, as demonstrated by my TabSort program and Layer Draw Order program.
1st July 2011
Added Centered Measure program to the site. This program is designed to emulate the behaviour of the standard AutoCAD Measure command, however, the resultant measured intervals are centered on the selected object, as opposed to extending along the object from one end.
28th June 2011
Added SubList function to the subfunction library. This subfunction is the list equivalent of the AutoLISP substr function, and will return the sublist of a supplied list from a specified starting index and with a specified length.
Added List Collinear-p, Coplanar-p and List Coplanar-p predicate functions to set of Geometric Functions. These functions offer the ability to test the collinearity of a list of points, or the coplanarity of four or more points.
27th June 2011
Added Collinear-p and Perpendicular-p functions to set of Geometric Functions. These predicate functions may be used to test the collinearity of three points, or the perpendicularity of two vectors.
23rd June 2011
Updated Change Block Insertion program to Version 1.3. This version fixes a reported bug pertaining to the position of the selected block reference not being retained when nested in other blocks in the drawing. When called with 'CBIR', the program will now update the position of every reference of the selected block (nested to any level) in all block definitions.
20th June 2011
Updated Layer Draw Order program to Version 1.2. This version allows the user to select specific layers for which to change the draw-order from a filterable list of non-XRef dependent layers, whilst retaining the inherent draw-order of entities on the other remaining layers in the drawing. Furthermore, selected layers may be ordered above or below the other layers in the drawing. A Help button is also included to assist the user.
18th June 2011
Updated Layer Draw Order program to Version 1.1. This version increases the height of the layer list to ease use in drawings with a large number of layers. The updated program also offers the ability to add a wildcard pattern to the list of layers in order to group a set of layers matching the pattern.
16th June 2011
Added Layer Draw Order program to the site. Similar to the Express Tools' CDOrder program, this program enables the user to control the draw order of all entities on each layer in a drawing, relative to other layers.
13th June 2011
Added Parse Numbers function to the site. This function will extract numbers represented in decimal format from a supplied string, returning a list of all numerical values found in the string.
12th June 2011
Added both a Visual & Vanilla LISP version of an Effective Block Name function to the site. These subfunctions demonstrate methods to obtain the true name of a block reference as per its associated block definition in the block collection of the drawing in which it resides.
Tweaked ArcSine and ArcCosine functions as part of the set of Trigonometric Functions to make the code more readable.
11th June 2011
Added List Difference function to the site. This function will return a list expressing the difference or relative complement of two or more lists, that is, a list of items appearing exclusively in one list but not the other(s).
Added List Symmetric Difference function to the site. This subfunction will return a list expressing the symmetric difference of two or more lists, that is, a list of items appearing exclusively in each list and not in the intersection of any pair of lists.
10th June 2011
Added List Union and List Intersection functions to the subfunction library section of the site. These functions will return a list expressing the union and intersection, respectively, of two or more supplied lists.
Added Line-Circle Intersection function to set of Geometric Functions. This function will return the point(s) of intersection between a line and a circle.
9th June 2011
8th June 2011
Added some extra functions to the Unique & Duplicate List Functions page. This page contains various functions engineered for manipulating lists in which items appear more than once.
7th June 2011
Added List Box subfunction to the subfunction library of the programs page. This subfunction displays a dialog with a List Box interface enabling the user to select one or more items from the supplied data set.
5th June 2011
Added Strikethrough Text program to the site. This program will create an LWPolyline passing through the centre of selected Text or MText objects to create a strikethrough text effect.
Updated set of Intersection Functions to include functions to return the intersection points between objects in a list, two sets, or two lists.
4th June 2011
Updated Circle Break program to Version 1.2 following a received bug report.
3rd June 2011
Added RGB->HSL and HSL->RGB conversion functions to set of Colour Conversion Functions. These functions will convert between Red, Green, & Blue colour values and Hue, Saturation & Luminance values for the two colour models.
2nd June 2011
Updated Copy Block program once more to Version 1.2. I realised there was a much easier way to implement the transference of block properties from the source block to the copied block. This approach has consequently removed a lot of excess code from the previous version.
1st June 2011
Completely rewrote my Copy Block program, which has now been updated to Version 1.1. This program will allow the user to copy and rename a block (which may be dynamic) in the working drawing. The program uses an ObjectDBX Document as an intermediary in which the block definition can be copied and renamed without resulting in a duplicate key in the Block Collection of the working drawing.
Added 'Preview' GIF animation to Copy Block page demonstrating program usage on a dynamic block example.
Updated the Change Block Insertion program to Version 1.2. This program was written around the same time (if not earlier) as my recently updated Add Objects to Block program. Hence this update carries forward many of the changes applied to that program.
31st May 2011
Updated the Add Objects to Block program to Version 1.1. I first wrote the code for this program in June of last year and have now implemented knowledge I have since gained to remove some excess code from the program to hopefully streamline the process. The AddObjectstoBlock subfunction has also been rewritten to require a VLA Document Object parameter, enabling the developer to utilise the subfunction on blocks in arbitrary documents (i.e. also through ObjectDBX).
Updated the Align Text program to Version 1.1. Once again, removing excess code to increase the performance of the program and to bring the coding style in line with my other programs.
30th May 2011
Added Popup subfunction to the site. This function uses the Popup method of the Windows Script Host Shell Object to display a customisable pop-up message box.
29th May 2011
Added Permutations function to subfunction library. This recursive subfunction will return a list of all possible permutations of elements in a supplied list.
Added Insert Nth function to subfunction library. This function will insert an item at the nth position in a list.
Added Remove Items function to the site. This function will remove items at specified indexes from a list.
28th May 2011
Added set of Geometric Functions to Mathematical functions page.
27th May 2011
Added 3D Reflection function (including test functions) to set of Matrix Transformation Functions. This function will reflect a target (VLA-Object or List of 3D Points) in an arbitrary plane.
26th May 2011
Added 3D Rotation function (including test functions) to set of Matrix Transformation Functions. This function will rotate a target (VLA-Object or List of 3D Points) by a given angle about an axis defined by two 3D points.
25th May 2011
Added set of Base Conversion functions to demonstrate methods of converting a number between numeral systems using different bases or radixes.
Updated Directory Dialog subfunction to incorporate better error trapping and a more concise and structured code layout.
Updated Get All Files subfunction to remove excess code and hence improve performance and readability.
Updated subfunctions enabling the user to Add & Remove Support Paths to make the code more concise and readable.
Added Remove Once subfunction to the site, a function which enables the developer to remove the first occurrence of an item from a list.
Added Apply to Block Objects subfunction to the site. This subfunction will evaluate a supplied function on all objects in a block definition and return a list of the return of each function evaluation.
24th May 2011
Tweaked site formatting to make table text on program pages more readable.
19th May 2011
Added Update Titleblock Attributes program to the site. This program offers the ability to automatically update drawing titleblock attributes with values sourced from a CSV drawing register. When a drawing is opened, a CSV Drawing Register may be automatically read by the program, and titleblock attributes are updated using values corresponding to the drawing entry in the register.
18th May 2011
Updated Select If subfunction to apply the optional predicate function to the entity selection list returned by the selection function, and also return this entity selection list; this provides the developer with the ability to use other elements in the selection list to validate the predicate function in addition to the selected entity name. An optional keyword argument (in the form of a list of parameters to be supplied to the initget function) is also included.
Added a selection of Clockwise-p subfunctions to determine whether three points are oriented clockwise; complete with brief explanations of the mathematical methods utilised by each function.
Added 'Jump To' quick navigation bar to sidepanel of site so that visitors can find what they need faster.
17th May 2011
Updated TabSort program to Version 2.2. This program was written back in late 2009 and so I figured it needed a little updating. In the end, I decided to rewrite the entire program. I haven't added any new functionality, but the program should be more robust and run smoother than the previous version, with a few bugs squashed in the process. The Find and Replace engine has been completely overhauled, now permitting the user to use self-referencing find and replace terms (for example, replacing 'ABC' with 'AB'), and the visual feedback during the find and replace process has been improved significantly. With the vast number of changes to the program, I expect there are still a few bugs lurking, but in my preliminary tests, I haven't found anything as yet.
15th May 2011
Added Object Lock program to the site - a purely academic piece of code demonstrating the ability to prevent modification of a set of objects using reactors.
14th May 2011
Added Associative Centerlines program to the site. This reactor based program enables the user to create associative circle centerlines which will automatically update following modification of the associated circle.
Updated the set of Attribute Functions to remove case-sensitivity from the attribute tag argument and also add a couple of recursive variations to the Vanilla subfunctions.
Updated the set of Dynamic Block Functions to remove case-sensitivity from the dynamic block property argument.
Fixed a bug found in the Area Label program (updated to Version 1.8).
12th May 2011
Added Area Label program to the site. This versatile program enables the user to annotate picked areas or selected objects with custom labels and either display the labels and associated areas in an AutoCAD Table Object, or write the data to file.
Added Steal from Drawing program to the site. This program allows the user to import (humourously: 'steal') items from another drawing into the current drawing. The user can choose to import multiple items from a list of Blocks, Layers, Linetypes, Dimension Styles, Text Styles, Table Styles, MLeader Styles, MLine Styles, Layouts, Page Setups, User Coordinate Systems, Views, Layer States & Scales.
8th May 2011
Updated the ObjectDBX Wrapper subfunction and associated test function.
7th May 2011
Added program to allow the user to dynamically align a selection of objects to a selected curve. The user is prompted to make a selection of objects to align to a selected curve, and a base point to use during alignment. The objects are then dynamically aligned to the curve in real-time, whilst the user may refine the alignment using additional controls offered at the command-line.