Class: Sketchup::Entities
- Inherits:
-
Object
- Object
- Sketchup::Entities
- Includes:
- Enumerable
- Defined in:
- lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb
Overview
The Entities class is a collection of Entity objects, either in a ComponentDefinition or directly in the Model. A Entities object corresponds to a drawing context in the GUI.
Instance Method Summary collapse
-
#[](entity_index) ⇒ Sketchup::Entity?
The #[] method is used to retrieve an entity by its index in an array of entities.
-
#active_section_plane ⇒ Sketchup::SectionPlane?
The active_section_plane method is used to access the currently active section plane in the Entities object.
-
#active_section_plane=(sec_plane) ⇒ Sketchup::SectionPlane?
The active_section_plane= method is used to set the active section plane in the Entities object.
-
#add_3d_text(string, alignment, font, is_bold = false, is_italic = false, letter_height = 1.0, tolerance = 0.0, z = 0.0, is_filled = true, extrusion = 0.0) ⇒ Boolean
The add_3d_text is used to create 3D text.
-
#add_arc(*args) ⇒ Object
The add_arc method is used to create an arc curve segment.
-
#add_circle(center, normal, radius, numsegs = 24) ⇒ Array<Sketchup::Edge>
The add_circle method is used to create a circle.
-
#add_cline(*args) ⇒ Sketchup::ConstructionLine
The #add_cline method is used to create a construction line.
-
#add_cpoint(point) ⇒ Sketchup::ConstructionPoint
The add_cpoint method is used to create a construction point.
-
#add_curve(*args) ⇒ Array<Sketchup::Edge>
The add_curve method is used to create a curve from a collection of edges.
-
#add_dimension_linear(*args) ⇒ Sketchup::DimensionLinear
The #add_dimension_linear method adds a linear dimension to the entities.
-
#add_dimension_radial(arc_curve, leader_break_pt) ⇒ Sketchup::DimensionRadial
The add_dimension_radial method adds a radial dimension (i.e arc/circle radius/diameter dimension) to the entities.
-
#add_edges(*args) ⇒ Array<Sketchup::Edge>
The #add_edges method is used to add a set of connected edges to the Entities collection.
-
#add_face(*args) ⇒ Sketchup::Face?
The add_face method is used to create a face.
-
#add_faces_from_mesh(polygon_mesh, smooth_flags = Geom::PolygonMesh::AUTO_SOFTEN|Geom::PolygonMesh::SMOOTH_SOFT_EDGES, f_material = nil, b_material = nil) ⇒ Integer
The #add_faces_from_mesh method is used to add Face objects to the collection of entities from a PolygonMesh.
-
#add_group(*args) ⇒ Sketchup::Group
The add_group method is used to create an empty group or a group with entities.
-
#add_image(path, point, width, height = 0.0) ⇒ Sketchup::Image?
The add_image method is used to add an image to the collection of entities.
-
#add_instance(definition, transform) ⇒ Sketchup::ComponentInstance
The add_instance method adds a component instance to the collection of entities.
-
#add_line(point1, point2) ⇒ Sketchup::Edge
The add_line method is used to add an edge to the collection of entities.
-
#add_ngon(center, normal, radius, numsides = 24) ⇒ Array<Sketchup::Edge>
The add_ngon method is used to create a multi-sided polygon.
-
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the current object.
-
#add_section_plane(plane) ⇒ Sketchup::SectionPlane?
The add_section_plane method adds a section plane object to the entities.
-
#add_text(*args) ⇒ Sketchup::Text
The #add_text method adds a note or label text entity to the entities.
- #at(entity_index) ⇒ Sketchup::Entity?
-
#clear! ⇒ Boolean
The clear! method is used to remove all entities from the collection of entities.
- #count ⇒ Integer
-
#each {|entity| ... } ⇒ nil
The #each method is used to iterate through the entities in the collection of entities.
-
#erase_entities(*args) ⇒ nil
The erase_entities method is used to erase one or more entities from the model.
-
#fill_from_mesh(polygon_mesh, weld_vertices = true, smooth_flags = Geom::PolygonMesh::AUTO_SOFTEN|Geom::PolygonMesh::SMOOTH_SOFT_EDGES, f_material = nil, b_material = nil) ⇒ Boolean
The #fill_from_mesh method is used to add faces and edges to the collection of entities from a Geom::PolygonMesh.
-
#intersect_with(recurse, transform1, entities1, transform2, hidden, entities2) ⇒ nil
The intersect_with method is used to intersect an entities, component instance, or group object with a entities object.
-
#length ⇒ Integer
The #length method is used to retrieve the number of entities in the collection of entities.
-
#model ⇒ Sketchup::Model
The model method is used to retrieve the model that contains the collection of entities.
-
#parent ⇒ Sketchup::ComponentDefinition, Sketchup::Model
The parent method is used to retrieve the parent or object that contains the collection of entities.
-
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the current object.
- #size ⇒ Integer
-
#transform_by_vectors(sub_entities, vectors) ⇒ Sketchup::Entities
The transform_by_vectors method is used to apply several vectors to several sub-entities all at once.
-
#transform_entities(transform, entities) ⇒ Boolean
The transform_entities method is used to apply a transform to several sub-entities all at once.
- #weld(edges) ⇒ Array<Sketchup::Curve>
Instance Method Details
#[](entity_index) ⇒ Sketchup::Entity?
35 36 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 35 def [](entity_index) end |
#active_section_plane ⇒ Sketchup::SectionPlane?
The active_section_plane method is used to access the currently active section plane in the Entities object.
48 49 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 48 def active_section_plane end |
#active_section_plane=(sec_plane) ⇒ Sketchup::SectionPlane?
The active_section_plane= method is used to set the active section plane in the Entities object.
66 67 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 66 def active_section_plane=(sec_plane) end |
#add_3d_text(string, alignment, font, is_bold = false, is_italic = false, letter_height = 1.0, tolerance = 0.0, z = 0.0, is_filled = true, extrusion = 0.0) ⇒ Boolean
The add_3d_text is used to create 3D text. It will be added as edges and faces drawn at the origin.
116 117 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 116 def add_3d_text(string, alignment, font, is_bold = false, is_italic = false, letter_height = 1.0, tolerance = 0.0, z = 0.0, is_filled = true, extrusion = 0.0) end |
#add_arc(center, xaxis, normal, radius, start_angle, end_angle) ⇒ Array<Sketchup::Edge> #add_arc(center, xaxis, normal, radius, start_angle, end_angle, num_segments) ⇒ Array<Sketchup::Edge>
The add_arc method is used to create an arc curve segment.
154 155 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 154 def add_arc(*args) end |
#add_circle(center, normal, radius, numsegs = 24) ⇒ Array<Sketchup::Edge>
The add_circle method is used to create a circle.
183 184 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 183 def add_circle(center, normal, radius, numsegs = 24) end |
#add_cline(start_point, end_point, stipple = '-') ⇒ Sketchup::ConstructionLine #add_cline(point, vector, stipple = '-') ⇒ Sketchup::ConstructionLine
The #add_cline method is used to create a construction line. This can be finite or infinite.
215 216 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 215 def add_cline(*args) end |
#add_cpoint(point) ⇒ Sketchup::ConstructionPoint
The add_cpoint method is used to create a construction point.
238 239 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 238 def add_cpoint(point) end |
#add_curve(points) ⇒ Array<Sketchup::Edge> #add_curve(*points) ⇒ Array<Sketchup::Edge>
The add_curve method is used to create a curve from a collection of edges.
The arguments are either Points or an Array of Points. At least 2 points are required.
261 262 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 261 def add_curve(*args) end |
#add_dimension_linear(start_pt_or_entity, end_pt_or_entity, offset_vector) ⇒ Sketchup::DimensionLinear #add_dimension_linear(start_instance_path, end_instance_path, offset_vector) ⇒ Sketchup::DimensionLinear #add_dimension_linear(start_array, end_array, offset_vector) ⇒ Sketchup::DimensionLinear
The #add_dimension_linear method adds a linear dimension to the entities.
348 349 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 348 def add_dimension_linear(*args) end |
#add_dimension_radial(arc_curve, leader_break_pt) ⇒ Sketchup::DimensionRadial
The add_dimension_radial method adds a radial dimension (i.e arc/circle radius/diameter dimension) to the entities.
374 375 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 374 def add_dimension_radial(arc_curve, leader_break_pt) end |
#add_edges(points) ⇒ Array<Sketchup::Edge> #add_edges(*points) ⇒ Array<Sketchup::Edge>
If the points form a closed loop, the first and last vertex will not merge. If you intend to create a face from the edges, use #add_face directly.
The #add_edges method is used to add a set of connected edges to the Sketchup::Entities collection.
404 405 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 404 def add_edges(*args) end |
#add_face(entities) ⇒ Sketchup::Face? #add_face(*entities) ⇒ Sketchup::Face?
The add_face method is used to create a face. You can call this method a number of ways:
- entities.add_face(edge1, edge2, edge3, ...)
- entities.add_face(edgearray)
- entities.add_face(pt1, pt2, pt3, ...)
- entities.add_face([pt1, pt2, pt3,...])
- entities.add_face(curve)
For the last form that takes a Curve, the curve must be closed - like a circle.
Note that a special case exists for any face created on the ground plane, in which case the vertex order is ignored and the face is always facing down.
446 447 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 446 def add_face(*args) end |
#add_faces_from_mesh(polygon_mesh, smooth_flags = Geom::PolygonMesh::AUTO_SOFTEN|Geom::PolygonMesh::SMOOTH_SOFT_EDGES, f_material = nil, b_material = nil) ⇒ Integer
The #add_faces_from_mesh method is used to add Face objects to the collection of entities from a PolygonMesh.
The smooth_flags
parameter can contain any of the following values if passed. The constants were added in SketchUp 2014. For previous versions, numeric values have to be specified instead of the Ruby constants.
-
1: Geom::PolygonMesh::HIDE_BASED_ON_INDEX (Negative point index will hide the edge.)
-
2: Geom::PolygonMesh::SOFTEN_BASED_ON_INDEX (Negative point index will soften the edge.)
-
4: Geom::PolygonMesh::AUTO_SOFTEN (Interior edges are softened.)
-
8: Geom::PolygonMesh::SMOOTH_SOFT_EDGES (All soft edges will also be smooth.)
The 3rd and 4th parameters will accept a Sketchup::Entities.sketchupsketchup::Material object or a string name of a material currently in the model.
496 497 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 496 def add_faces_from_mesh(polygon_mesh, smooth_flags = Geom::PolygonMesh::AUTO_SOFTEN|Geom::PolygonMesh::SMOOTH_SOFT_EDGES, f_material = nil, b_material = nil) end |
#add_group(entities) ⇒ Sketchup::Group #add_group(*entities) ⇒ Sketchup::Group
Calling add_group with entities in its parameters has been known to crash SketchUp before version 8.0. It is preferable to create an empty group and then add things to its Entities collection.
The add_group method is used to create an empty group or a group with entities.
524 525 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 524 def add_group(*args) end |
#add_image(path, point, width, height = 0.0) ⇒ Sketchup::Image?
The add_image method is used to add an image to the collection of entities.
The width and height are measured in model units (i.e. inches). If the height is not given, then it is computed from the width to preserve the aspect ratio of the image.
562 563 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 562 def add_image(path, point, width, height = 0.0) end |
#add_instance(definition, transform) ⇒ Sketchup::ComponentInstance
The add_instance method adds a component instance to the collection of entities.
593 594 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 593 def add_instance(definition, transform) end |
#add_line(point1, point2) ⇒ Sketchup::Edge
The add_line method is used to add an edge to the collection of entities. This is not to be confused with the concept of a “line” from a geometric sense, which is an invisible object represented by an Array of a point and a vector. (See the Array class for more information on geometric lines in SketchUp.)
This method is the same as add_edges method, but returns a single edge.
625 626 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 625 def add_line(point1, point2) end |
#add_ngon(center, normal, radius, numsides = 24) ⇒ Array<Sketchup::Edge>
The add_ngon method is used to create a multi-sided polygon.
654 655 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 654 def add_ngon(center, normal, radius, numsides = 24) end |
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the current object.
669 670 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 669 def add_observer(observer) end |
#add_section_plane(plane) ⇒ Sketchup::SectionPlane?
The add_section_plane method adds a section plane object to the entities.
692 693 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 692 def add_section_plane(plane) end |
#add_text(text, point, vector) ⇒ Sketchup::Text #add_text(text, instance_path_and_pt, vector) ⇒ Sketchup::Text #add_text(text, instance_array_and_pt, vector) ⇒ Sketchup::Text
The #add_text method adds a note or label text entity to the entities.
753 754 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 753 def add_text(*args) end |
#at(entity_index) ⇒ Sketchup::Entity?
770 771 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 770 def at(entity_index) end |
#clear! ⇒ Boolean
The clear! method is used to remove all entities from the collection of entities.
788 789 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 788 def clear! end |
#count ⇒ Integer
807 808 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 807 def count end |
#each {|entity| ... } ⇒ nil
Don’t remove content from this collection while iterating over it with #each. This would change the size of the collection and cause elements to be skipped as the indices change. Instead copy the current collection to an array using to_a
and then use each
on the array, when removing content.
The #each method is used to iterate through the entities in the collection of entities.
831 832 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 831 def each end |
#erase_entities(entities) ⇒ nil #erase_entities(*entities) ⇒ nil
The erase_entities method is used to erase one or more entities from the model.
868 869 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 868 def erase_entities(*args) end |
#fill_from_mesh(polygon_mesh, weld_vertices = true, smooth_flags = Geom::PolygonMesh::AUTO_SOFTEN|Geom::PolygonMesh::SMOOTH_SOFT_EDGES, f_material = nil, b_material = nil) ⇒ Boolean
The #fill_from_mesh method is used to add faces and edges to the collection of entities from a Geom::PolygonMesh. It requires that the entities collection to be filled is empty. It has higher performance than #add_faces_from_mesh, but does less error checking as it builds the geometry.
The smooth_flags
parameter can contain any of the following values if passed. The constants were added in SketchUp 2014. For previous versions, numeric values have to be specified instead of the Ruby constants:
-
1: Geom::PolygonMesh::HIDE_BASED_ON_INDEX (Negative point index will hide the edge.)
-
2: Geom::PolygonMesh::SOFTEN_BASED_ON_INDEX (Negative point index will soften the edge.)
-
4: Geom::PolygonMesh::AUTO_SOFTEN (Interior edges are softened.)
-
8: Geom::PolygonMesh::SMOOTH_SOFT_EDGES (All soft edges will also be smooth.)
The 4rd and 5th parameters will accept a Material object or a string name of a material currently in the model.
926 927 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 926 def fill_from_mesh(polygon_mesh, weld_vertices = true, smooth_flags = Geom::PolygonMesh::AUTO_SOFTEN|Geom::PolygonMesh::SMOOTH_SOFT_EDGES, f_material = nil, b_material = nil) end |
#intersect_with(recurse, transform1, entities1, transform2, hidden, entities2) ⇒ nil
The intersect_with method is used to intersect an entities, component instance, or group object with a entities object.
961 962 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 961 def intersect_with(recurse, transform1, entities1, transform2, hidden, entities2) end |
#length ⇒ Integer
The #length method is used to retrieve the number of entities in the collection of entities.
978 979 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 978 def length end |
#model ⇒ Sketchup::Model
The model method is used to retrieve the model that contains the collection of entities.
996 997 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 996 def model end |
#parent ⇒ Sketchup::ComponentDefinition, Sketchup::Model
The parent method is used to retrieve the parent or object that contains the collection of entities. A parent can be either a Model or ComponentDefinition object.
1015 1016 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 1015 def parent end |
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the current object.
1031 1032 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 1031 def remove_observer(observer) end |
#size ⇒ Integer
1047 1048 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 1047 def size end |
#transform_by_vectors(sub_entities, vectors) ⇒ Sketchup::Entities
The transform_by_vectors method is used to apply several vectors to several sub-entities all at once.
1073 1074 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 1073 def transform_by_vectors(sub_entities, vectors) end |
#transform_entities(transform, entities) ⇒ Boolean
The transform_entities method is used to apply a transform to several sub-entities all at once.
If you are transforming entities in the active drawing context or any of its parent drawing contexts, the transformation will be interpreted as relative to the global coordinate system. Otherwise the transformation will be interpreted as being on the local coordinate system.
1101 1102 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 1101 def transform_entities(transform, entities) end |
#weld(edges) ⇒ Array<Sketchup::Curve>
1123 1124 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb', line 1123 def weld(edges) end |