Generating linear arrangements along a trajectory is a routine task for many technical designers. While AutoCAD’s standard ARRAYPATH command functions optimally for straight paths, it often falls short when dealing with non-linear trajectories, such as splines or complex curves. For professionals in fields like event planning or site layout design, arranging linear segments—such as security fencing—along a curved perimeter can cause the objects to separate at the joints.
The core challenge lies in the limitation of the native path array engine, which relies on a single alignment anchor point. When the path curves, subsequent blocks rotate along a single tangent point, causing the ends of the segments to drift off the curve and break continuity. Achieving a seamless layout requires forcing both the insertion point and a secondary reference point of each block to maintain strict contact with the target curve.
The Core Challenge: Maintaining Segment Continuity
When utilizing standard path arrays on curved lines, AutoCAD aligns the base point of the block to the path and rotates the block relative to the path’s tangent at that specific position. For rigid, rectangular objects like fence panels or modular barriers, this creates a visible geometric disconnect.
Because the curve bends away from the straight segment of the block, the endpoints do not meet perfectly. Moving the base point to the center of the block can mitigate this variation slightly, but it fails to deliver the precision required for accurate construction documents or spatial budgeting.
The Solution: Combining Chord Division and Block Alignment via AutoLISP
Since native geometric constraints do not support multi-point snapping along arrays automatically, implementing a custom AutoLISP solution is the most effective approach. By combining a chord-length division technique with an automated insertion script, you can place blocks so that both their entry and exit points remain locked onto the curve.
1. Step 1: Segmenting the Path Equally
To prevent geometric drift, the path must first be divided by true chord lengths (the straight-line distance between the panel ends) rather than distance measured along the arc itself. Using an adjusted chord-length division routine ensures that each segment matches the exact physical dimension of your block.
2. Step 2: Running the AutoLISP Alignment Routine
Once the target curve is properly segmented, an insertion script can programmatically place each block and align its X-axis to the exact intersection points on the spline.
Below is the specialized AutoLISP utility designed to automate this operation:
(defun C:BlocksOnSpline( / blockname delta d path osm endpar dToEnd n p1 p2)
; Adds blocks along a spline with the base point and a second point of the block also on the spline.
; The second point is specified as a distance along the x axis of the block from the base point.
; Developed by L. Minardi
(command "ucs" "w")
(setvar 'osmode 0)
(setq blockname (getstring "nEnter block name: "))
(setq delta (getreal "nEnter distance to second point on x axis of block: " ) )
(setq d 0
path (car (entsel))
endpar (vlax-curve-getEndParam path)
osm (getvar 'osmode)
)
(setq dToEnd (vlax-curve-getDistAtParam path endpar)
n (atoi (rtos (/ dToEnd delta) 2 2))
)
(setvar "cmdecho" 0)
(setq p1 (vlax-curve-getPointAtParam path 0))
(repeat n
(setq d (+ d delta))
(setq p2 (vlax-curve-getPointAtDist path d))
(command "-insert" blockname '(0 0 0) 1 1 0)
(command "_align" "last" "" '(0 0 0) p1 '(1 0 0) p2 "" "n")
(setq p1 p2)
) ; end repeat
(setvar 'osmode osm)
(setvar "cmdecho" 1)
(princ)
)
Step-by-Step Implementation Guide
To implement this workflow successfully within your drawing environment, follow these operational steps:
- Prepare Your Block: Ensure your block (e.g., a fence panel) is drawn horizontally along the X-axis. Set the insertion base point exactly at the left-hand start point of the object.
- Load the Routine: Type
APPLOADin the AutoCAD command line, navigate to your saved.lspfile containing the code above, and select Load. - Execute the Command: Type
BlocksOnSplinein the command line and pressEnter. - Input Parameters:
- Provide the exact case-sensitive name of your defined block.
- Input the precise physical length of the block (the distance from the base point to the secondary reference point on the X-axis).
- Select the Trajectory: Click on the spline, polyline, or curve where the objects need to be deployed.
By pre-dividing the path with a segment-length tool and using the alignment script, each module adapts perfectly to the curvature. This technique eliminates gaps and overlaps, ensuring complete geometric consistency across complex trajectories.
References
- Autodesk Community Forums – AutoCAD Forum. Create a path array with 2 points of the object on the curve. Thread ID: 13145429.
- Minardi, L. (2024). BlocksOnSpline Custom AutoLISP Developer Library contribution.

