I want a Horizontal Curve tool like Civil 3d have. I want to give transition curve(Spiral) and radius between two tangent IN AUTOCAD AS A LSP OR VBA OR VLX

I want a Horizontal Curve tool like Civil 3d have. I want to give transition curve(Spiral) and radius between two tangent IN AUTOCAD AS A LSP OR VBA OR VLX

sdhara.hit
Advocate Advocate
400 Views
2 Replies
Message 1 of 3

I want a Horizontal Curve tool like Civil 3d have. I want to give transition curve(Spiral) and radius between two tangent IN AUTOCAD AS A LSP OR VBA OR VLX

sdhara.hit
Advocate
Advocate

I want a Horizontal Curve tool like Civil 3d have. I want to give transition curve(Spiral) and radius between two tangent(LINE) IN AUTOCAD AS A LSP OR VBA OR VLX

0 Likes
401 Views
2 Replies
Replies (2)
Message 2 of 3

wispoxy
Advisor
Advisor
# Python code snippet for creating a horizontal curve tool
def create_horizontal_curve(tangent1, tangent2, radius, spiral_length):
    """
    Creates a horizontal curve (circular arc + spiral) between two tangents.
    :param tangent1: First tangent point (x1, y1)
    :param tangent2: Second tangent point (x2, y2)
    :param radius: Radius of the circular arc
    :param spiral_length: Length of the spiral (transition curve)
    :return: List of points representing the curve
    """
    # Calculate the center of the circular arc
    center_x = (tangent1[0] + tangent2[0]) / 2
    center_y = (tangent1[1] + tangent2[1]) / 2

    # Create the circular arc
    circular_arc_points = []
    for angle in range(0, 181):  # Half of the circle
        x = center_x + radius * cos(radians(angle))
        y = center_y + radius * sin(radians(angle))
        circular_arc_points.append((x, y))

    # Create the spiral (transition curve)
    spiral_points = []
    for s in range(0, spiral_length):
        x = tangent1[0] + s * (tangent2[0] - tangent1[0]) / spiral_length
        y = tangent1[1] + s * (tangent2[1] - tangent1[1]) / spiral_length
        spiral_points.append((x, y))

    # Combine circular arc and spiral points
    curve_points = circular_arc_points + spiral_points

    return curve_points

# Example usage
tangent1 = (0, 0)
tangent2 = (10, 0)
radius = 5
spiral_length = 10
horizontal_curve = create_horizontal_curve(tangent1, tangent2, radius, spiral_length)

# Print the points of the horizontal curve
for point in horizontal_curve:
    print(point)
Message 3 of 3

sdhara.hit
Advocate
Advocate
0 Likes