Class: ModraUp::Edge
- Inherits:
-
ModraUp::Drawingelement
- Object
- ModraUp::Entity
- ModraUp::Drawingelement
- ModraUp::Edge
Overview
An edge. Inspect its soft and smooth flags, its owning ModraUp::Curve, and its connections to adjacent geometry. Use ModraUp::Edge#find_faces to form faces and ModraUp::Edge#split to split the edge.
Instance Method Summary # collapse
-
#soft? ⇒ Boolean
Soft Edge (hides geometry, selects faces as surfaces).
-
#soft=(value) ⇒ Boolean
Set the soft edge. Begin a model transaction (if an existing start_operation is provided, include it in the operation).
-
#smooth? ⇒ Boolean
Smooth Edge (adjacent face shading transition).
-
#smooth=(value) ⇒ Boolean
Set the edge to smooth. Go through a model transaction.
-
#start ⇒ ModraUp::Vertex
The start point of an edge.
-
#end ⇒ ModraUp::Vertex
The endpoint of an edge.
-
#curve ⇒ ModraUp::Curve, nil
Belongs to a curve, edge, circle, or arc. An independent edge is nil.
-
#all_connected ⇒ Array<ModraUp::Face, ModraUp::Edge>
Returns the faces and edges connected to this edge, including the edge itself.
-
#common_face(edge2) ⇒ ModraUp::Face, nil
The face common to two edges.
-
#explode_curve ⇒ ModraUp::Edge
Remove the associated circle or arc; the edge remains. If not a curve, return it unchanged.
-
#faces ⇒ Array<ModraUp::Face>
Return the faces that use this edge.
-
#find_faces ⇒ Integer
Create all faces that can be formed using this edge, return the count of new faces created. Operates within a model transaction.
-
#length ⇒ Length
Length (in inches Length). An optional transformation can be applied to calculate the scaled length.
-
#line(Geom::Point3d, Geom::Vector3d) ⇒ Array(Geom::Point3d, Geom::Vector3d)
Geometric Line: Start Point Plus Direction.
-
#other_vertex(vertex) ⇒ ModraUp::Vertex
Given one endpoint, return the other endpoint.
-
#reversed_in?(face) ⇒ Boolean, nil
Does the edge run in the opposite direction of start→end within the face ring? Returns nil if not adjacent.
-
#split(position) ⇒ ModraUp::Edge, nil
Split an edge into new edges. The position is a point on the edge or a parameter (between 0 and 1) along the edge, starting from @link #start. The original edge remains from the start to the split point; a new edge is returned from the split point to the end.
-
#used_by?(element) ⇒ Boolean
Does the edge use a given vertex or face.
-
#vertices ⇒ Array<ModraUp::Vertex>
Start and end points.
Inherited from ModraUp::Drawingelement
-
#layer ⇒ ModraUp::Layer
Layer it belongs to (Tag). Defaults to Layer0 if not specified.
-
#layer=(layer) ⇒ ModraUp::Layer, String
Set the layer. The string must be an existing layer name, otherwise an error is thrown.
-
#bounds ⇒ Geom::BoundingBox
Axis-aligned bounding box.
-
#locked? ⇒ Boolean
Locked. Locked faces/edges cannot be erased.
-
#locked=(value) ⇒ Boolean
Set the lock. Begin a model transaction (if an existing start_operation is present, incorporate it into this operation).
-
#casts_shadows? ⇒ Boolean
Casts shadows. Defaults to true. Viewport shadows are not yet enabled.
-
#casts_shadows=(value) ⇒ Boolean
Sets whether the drawing element casts shadows.
-
#receives_shadows? ⇒ Boolean
Returns whether the drawing element receives shadows. Defaults to true. Viewport shadows are not enabled yet.
-
#receives_shadows=(value) ⇒ Boolean
Sets whether the drawing element receives shadows.
-
#material ⇒ ModraUp::Material, nil
Materials. If unspecified, it defaults to nil. ModraUp::Edge, ModraUp::Face (front), ModraUp::Group, ModraUp::ComponentInstance, ModraUp::Image, ModraUp::Text, ModraUp::Dimension, ModraUp::ConstructionLine, ModraUp::ConstructionPoint, and ModraUp::SectionPlane all inherit this method. The back of a ModraUp::Face uses Face#back_material.
-
#material=(material) ⇒ ModraUp::Material, String, ModraUp::Color, nil
Set the material. nil clears it. The string is first interpreted as a material name, then as a CSS/X11 color name. Subclasses inherit this method;
-
#hidden? ⇒ Boolean
Returns whether the element itself is hidden. Layer hiding is not considered.
-
#hidden=(hidden) ⇒ Boolean
Sets itself to hidden. Transacts the model (if an existing start_operation is present, it is included in that operation).
-
#visible? ⇒ Boolean
Returns true if the element is not hidden (opposite of #hidden?). The layer may still hide it.
-
#visible=(visibility) ⇒ Boolean
Opposite of #hidden=.
-
#erase! ⇒ nil
Delete this face, edge, group, component instance, or linear dimension. The containing set does not have to be the active drawing context.
Inherited from ModraUp::Entity
-
#typename ⇒ String
Type name (e.g., Face / Edge / Group).
-
#entityID ⇒ Integer
Entity ID within the current session: A small integer starting from 1 that increments and remains constant for the lifetime of the entity, unchanged by undo/redo operations. This ID is not preserved when saving the file; it will be renumbered upon reopening the model. For cross-session identification, use #persistent_id. Copied entities will receive new IDs.
-
#add_observer(observer) ⇒ Boolean
Register a ModraUp::EntityObserver. Adding the same object a second time returns false. Locking, property, and material changes will dispatch an onChangeEntity event.
-
#remove_observer(observer) ⇒ Boolean
Remove the entity observer.
-
#persistent_id ⇒ Integer
Number assigned with the model: A unique, incrementing small integer starting from 1 that persists across model saves and reloads, independent of #entityID. Copied entities receive new numbers, and deleted entities do not reuse their numbers. Edges, faces, vertices, curves, groups, component instances/definitions, dimensions, leader lines/points, section planes, materials, layers, layer folders, and drawing sheets have assigned numbers; all others (rings, EdgeUses, attribute dictionaries, line types, sets, etc.) return 0.
-
#parent ⇒ ModraUp::Model, ModraUp::ComponentDefinition
Returns the owner of this drawing context. At the root this is the model. Inside a definition it is the definition itself.
-
#model ⇒ ModraUp::Model
The model it belongs to.
-
#to_s ⇒ String
String form. Returns "#<Deleted Entity>” when the entity has been deleted.
-
#inspect ⇒ String
Same as #to_s.
-
#attribute_dictionaries ⇒ ModraUp::AttributeDictionaries, nil
Collection of attribute dictionaries. Returns nil (evaluates to false) if there are no dictionaries.
-
#attribute_dictionary(name) ⇒ ModraUp::AttributeDictionary, nil
Retrieve an attribute dictionary by name. If none exists, return nil; if create is true, create an empty dictionary. ModraUp::Loop / ModraUp::EdgeUse / ModraUp::Curve always return nil.
-
#valid? ⇒ Boolean
Returns true if the entity is valid, meaning it has not been deleted from the model. Revoked entities are false; even if new geometry is drawn occupying its original position, this object remains an invalid entity (still false). Repeating the action to restore it makes it valid again.
-
#deleted? ⇒ Boolean
Opposite of #valid?.
-
#set_attribute(dict_name, key, value) ⇒ Object
Write attribute values. Materials, groups, component instances, faces, and edges are supported. When dict_name and key are Symbols, they are converted to strings. The type of data written is the same type that will be read back.
-
#get_attribute(dict_name, key, default = nil) ⇒ Object
Read the attribute. If dict_name and key are Symbols, convert them to strings (similar to SketchUp). If the dictionary or key does not exist, return default. The return value type is the same as what is written by #set_attribute.
-
#delete_attribute(dict_name) ⇒ Boolean
Delete a key, or delete the entire dictionary when the key is omitted.
Instance Method Details
edge.soft? ⇒ Boolean
Soft Edge (hides geometry, selects faces as surfaces).
edge.soft=(value) ⇒ Boolean
Set the soft edge. Begin a model transaction (if an existing start_operation is provided, include it in the operation).
edge.smooth? ⇒ Boolean
Smooth Edge (adjacent face shading transition).
edge.smooth=(value) ⇒ Boolean
Set the edge to smooth. Go through a model transaction.
edge.start ⇒ ModraUp::Vertex
The start point of an edge.
edge.end ⇒ ModraUp::Vertex
The endpoint of an edge.
edge.curve ⇒ ModraUp::Curve, nil
Belongs to a curve, edge, circle, or arc. An independent edge is nil.
edge.all_connected ⇒ Array
Returns the faces and edges connected to this edge, including the edge itself.
edge.common_face(edge2) ⇒ ModraUp::Face, nil
The face common to two edges.
edge.explode_curve ⇒ ModraUp::Edge
Remove the associated circle or arc; the edge remains. If not a curve, return it unchanged.
edge.faces ⇒ Array<ModraUp::Face>
Return the faces that use this edge.
edge.find_faces ⇒ Integer
Create all faces that can be formed using this edge, return the count of new faces created. Operates within a model transaction.
edge.length ⇒ Lengthedge.length(transform) ⇒ Length
Length (in inches Length). An optional transformation can be applied to calculate the scaled length.
edge.line ⇒ Array(Geom::Point3d, Geom::Vector3d)
Geometric Line: Start Point Plus Direction.
edge.other_vertex(vertex) ⇒ ModraUp::Vertex
Given one endpoint, return the other endpoint.
edge.reversed_in?(face) ⇒ Boolean, nil
Does the edge run in the opposite direction of start→end within the face ring? Returns nil if not adjacent.
edge.split(position) ⇒ ModraUp::Edge, nil
Split an edge into new edges. The position is a point on the edge or a parameter (between 0 and 1) along the edge, starting from @link #start. The original edge remains from the start to the split point; a new edge is returned from the split point to the end.
edge.used_by?(element) ⇒ Boolean
Does the edge use a given vertex or face.
edge.vertices ⇒ Array<ModraUp::Vertex>
Start and end points.