cadquery
Sketch
Workplane
Assembly

Workplane.vLine()

The vLine() method of the Workplane class in the cadquery module is used to add a vertical line to the current workplane.

Syntax

The syntax for using the vLine() method is as follows:

Workplane.vLine(length)

Parameters:

  • length: It is the length of the line to be created.

Return Value

The vLine() method returns a Workplane object, which represents the current workplane with the vertical line added.

Description

The vLine() method creates a vertical line on the current workplane. The starting point of the line is at the current position of the workplane, and the end point is at a specified distance (length) above the starting point.

The length of the line should be specified as a positive float value. If a negative value is used, a horizontal line is created instead of a vertical line.

Example

import cadquery as cq

# Create a box with a vertical line
result = cq.Workplane().box(10, 10, 10).vLine(5)

# Display the result
show_object(result)

Output

The above code creates a box with a vertical line and displays the result. The output will be a solid box with a vertical line extending from one of its top edges.

Conclusion

The vLine() method of the Workplane class in the cadquery module is a useful tool for creating vertical lines on a workplane. It is easy to use and can be incorporated into various CAD designs.