Function Syntax: CPL_2 Version: 1.0 Date: 20.06.2026 6:38:59PM AI + https://www.cadtutor.net/forum/topic/49702-centerline-between-two-polylines/ Description 🧩 MiddleLinePolylines_2 provides the CPL_2 command for generating a simple two vertex centerline between two open curves. 📍 The routine averages the start points of the first and last selected curve and averages their end points. 📐 A new two vertex LWPOLYLINE is created in ModelSpace from those two midpoint positions. Function Syntax Main command: CPL_2 SEO Optimized Overview 🖱️ The command accepts a general AutoCAD selection set and requires at least two selected objects. 1️⃣ The first object in the selection set becomes the first source curve. 2️⃣ The last object in the selection set becomes the second source curve. 📐 Curve API functions read start and end points from LINE LWPOLYLINE POLYLINE ARC SPLINE ELLIPSE and similar open curve objects. 🔒 Closed curves are rejected when the start and end coordinates are equal. ➗ The source start positions are averaged to create the first centerline vertex and the source end positions are averaged to create the second. ⬇️ Z is explicitly forced to 0 because the result is a two dimensional lightweight polyline. 📦 The new LWPOLYLINE is created directly in ModelSpace through COM. Primary Workflow • Run CPL_2. • Select at least two curve objects. • The routine uses the first selected and last selected objects. • Start and end points are read through the AutoCAD curve API. • Start midpoints and end midpoints are calculated. • A two vertex LWPOLYLINE is created in ModelSpace. Functionalities Simple endpoint average - creates the centerline from averaged start and end positions. General curve API - works with several open AutoCAD curve types. First and last selection logic - uses only the first and last objects from the selection set. Closed curve guard - skips processing when a selected source appears closed. Two vertex result - creates a straight LWPOLYLINE with two vertices. COM creation - adds the lightweight polyline directly to ModelSpace. 2D output - forces the generated Z coordinate to zero. Important Commands and Aspects 🧩 vlax-curve-getStartPoint reads source start coordinates. 🧩 vlax-curve-getEndPoint reads source end coordinates. 🧩 vla-AddLightWeightPolyline creates the final two vertex result. Result 🎯 The result is one straight two vertex LWPOLYLINE centered between the start and end positions of the first and last selected source curves. Important Notes ⚠️ The command does not calculate a detailed average path along curved source geometry. ⚠️ Only the first and last objects from the selection set are used. ⚠️ Result Z values are forced to zero. ⚠️ The source comment identifies this as a COM only one go centerline method. SEO Keywords 🏷️ AutoCAD, 🏷️ Civil 3D, 🏷️ AutoLISP, 🏷️ CPL_2, 🏷️ MiddleLinePolylines_2, 🏷️ Centerline, 🏷️ Endpoint midpoint, 🏷️ LWPOLYLINE, 🏷️ COM, 🏷️ CAD automation