- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone,
I am developing an AutoLISP script designed to generate perpendicular construction lines along a reference curve (which may be a line, polyline, or spline), based on distance values imported from a CSV file. The CSV parsing and initial vertex marking functions are fully implemented and operational.
The next step is to extend the script to insert dynamic blocks between these perpendicular lines, supporting two distinct insertion strategies:
🔹 Type 1 – Single dynamic block with action parameters anchored at segment boundaries
In this mode, a single dynamic block is placed between two consecutive perpendicular lines. The block’s action parameters (e.g., grips or control points) must precisely coincide with the intersection points defining the start and end of the segment, ensuring accurate parametric control and alignment.
Example block name: "Block_With_Grips".
🔹 Type 2 – Multiple repeated dynamic blocks distributed uniformly along the segment
In this case, the script inserts the maximum number of identical dynamic blocks possible between two consecutive perpendicular lines, provided that each block maintains a minimum spacing of 4.5 meters.
The segment length is evenly divided among these blocks, guaranteeing equal spacing without residual gaps.
For example, for a 13-meter segment, two blocks would be inserted at intervals of 6.5 meters.
Each repeated block contains a centered grip (action parameter), which must be properly aligned to the block’s midpoint for user manipulation and parameter adjustment.
Sample CSV snippet:
10.5,Block_single
23.2,Block_Repeated
45.0,Block_Repeated
Hence, the script inserts a "Block_With_Grips" between the 10.5 m and 23.2 m marks, and subsequently replicates the "Block_Repeated" blocks along the following segments according to the calculated spacing.
Currently, I am implementing the CSV second-column parsing logic and developing the algorithm for block insertion, including calculation of insertion points, block rotation to align with the perpendicular lines, and precise positioning of action parameters to ensure dynamic behavior within AutoCAD’s block framework.
I welcome any suggestions or best practices regarding the efficient management of block placement
Thank you in advance for your insights!
Attachments:
corruent .LSP
DWG with the blocks (Far left is the one that has to repeat and can’t be less than 4.5 m spacing, middle is the one that goes only once per segment, and far right is another that has to repeat but can’t be less than 2.25 m spacing)
Solved! Go to Solution.