Class: Autocad::Line
Overview
Represents a line entity in AutoCAD, providing access to geometric properties and spatial relationships.
Key Features:
-
Length calculation
-
Start/end point coordinates
-
3D orientation properties
-
Thickness control
-
Geometric vector analysis
Geometric Relationships:
Normal (Z-axis)
↑
│
Start ●───┼───● End
│
└─── Delta Vector
Instance Attribute Summary
Attributes inherited from Element
#acad_type, #app, #ole_obj, #original
Instance Method Summary collapse
-
#delta ⇒ Point3d
Directional vector from start to end point (equivalent to ‘end_point - start_point`).
-
#end_point ⇒ Point3d
3D coordinates of the line’s endpoint in World Coordinate System (WCS).
-
#length ⇒ Float
Calculates the linear length of the line segment.
-
#line? ⇒ Boolean
Type-check method confirming this is a line entity.
-
#normal ⇒ Point3d
Unit vector perpendicular to the line’s plane (Z-axis direction by default).
-
#start_point ⇒ Point3d
3D coordinates of the line’s starting point in World Coordinate System (WCS).
-
#thickness ⇒ Float
Extrusion thickness along the normal vector (3D effect).
Methods inherited from Element
#[], #app_ole_obj, #clone, convert_item, #delete, #do_update, #each_complex, #get_property_handler, #in_cell?, #initialize, #method_missing, #move, #move_ole, #move_x, #move_y, #ole_cell, ole_object?, #property_handler, #read_ole, #redraw, #update, #updated?, #write_ole
Methods included from ElementTrait
#autocad_type, #block_reference?, #bounds, #cell?, #def, #drawing, #explode, #graphical?, #has_tags?, #highlight, #id_from_record, #inspect, #model, #parent, #pviewport?, #select, #text?, #to_ole, #visible?
Constructor Details
This class inherits a constructor from Autocad::Element
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Autocad::Element
Instance Method Details
#delta ⇒ Point3d
Directional vector from start to end point (equivalent to ‘end_point - start_point`).
Mathematical Properties:
-
X/Y/Z components = coordinate differences
-
Magnitude = line length
118 119 120 |
# File 'lib/autocad/line.rb', line 118 def delta Point3d.new ole_obj.Delta end |
#end_point ⇒ Point3d
3D coordinates of the line’s endpoint in World Coordinate System (WCS).
71 72 73 |
# File 'lib/autocad/line.rb', line 71 def end_point Point3d.new(ole_obj.EndPoint) end |
#length ⇒ Float
Calculates the linear length of the line segment.
36 37 38 |
# File 'lib/autocad/line.rb', line 36 def length ole_obj.length end |
#line? ⇒ Boolean
Type-check method confirming this is a line entity.
47 48 49 |
# File 'lib/autocad/line.rb', line 47 def line? true end |
#normal ⇒ Point3d
Unit vector perpendicular to the line’s plane (Z-axis direction by default).
Properties:
-
Always returns unit vector (magnitude = 1)
-
Affects shading and 3D operations
86 87 88 |
# File 'lib/autocad/line.rb', line 86 def normal Point3d.new ole_obj.Normal end |
#start_point ⇒ Point3d
3D coordinates of the line’s starting point in World Coordinate System (WCS).
59 60 61 |
# File 'lib/autocad/line.rb', line 59 def start_point Point3d.new(ole_obj.StartPoint) end |
#thickness ⇒ Float
Extrusion thickness along the normal vector (3D effect).
Note:
-
Positive values extrude in normal direction
-
Negative values extrude opposite direction
-
0 = 2D line
102 103 104 |
# File 'lib/autocad/line.rb', line 102 def thickness ole_obj.Thickness end |