Short description
Purpose: Duplicate only a chosen segment of a LWPolyline between two picked points and generate it on a selected layer Supported objects: Single LWPOLYLINE only Usage style: Extract partial polyline segments and place them on a different layer using a filterable layer picker dialog
Command:
Command name: CopySelection How to run: Type COPYSELECTION and press Enter Prompts sequence: Select LWPolyline → Specify 1st Point → Specify 2nd Point → Choose Layer Selection rules: Command stops if selected object is missing or not a LWPOLYLINE
Description:
The user selects an LWPolyline and then two points projected onto its geometry to define the segment to duplicate. A dialog appears allowing layer filtering, picking from a list, or selecting an object in the drawing to adopt its layer. The code calculates curve parameters between the two points, reconstructs only that portion with widths and bulges, and creates a new LWPolyline on the chosen layer.
Helper function: (if any)
• tan Computes tangent of an angle while avoiding division by near-zero cosine values • LM:LWVertices Extracts LWPolyline vertex data such as point, widths, and bulge • get-all-layers Collects all non-xref layers, sorts them, and prepares them for the layer picker • update-layer-list Updates layer popup list in the dialog according to the typed filter • DCL builder Creates a temporary dialog file containing filter input, layer list, pick-layer button, and OK/Cancel controls
Functionalities:
• Polyline validation Ensures the selected object is a LWPOLYLINE • Point projection Snaps the picked points to the closest polyline points before using them • Distinct point enforcement Rejects overlapping points and forces user to choose a valid second point • Parameter order correction Swaps start and end parameters when reversed by selection • Layer dialog with memory Recalls last filter and layer using stored environment variables • Layer filtering Dynamically filters layer names using wildcard matching • Pick layer from drawing Lets the user click any object to inherit its layer • Segment extraction Reconstructs only the portion between the two parametric points including widths and bulges • New polyline creation Builds a fresh LWPolyline with original properties but on the new layer • Cleanup Removes temporary DCL file after dialog closes • Cancellation handling Stops with a message if no valid layer is chosen
Result:
• Segment duplication A new LWPolyline reproducing only the selected portion of the original is created • Layer assignment The new polyline is placed on the chosen layer without altering the original object • Workflow benefit Enables quick extraction of partial runs for detailing, highlights, or separate layer control • Session persistence Stores last used filter and layer to speed up future usage
Images, animations etc.
Log in to download.
Log in
Log in
Additional info:
Learn more:
Open Website
Share this page:
Subscribe
Login
0 Comments
Oldest
