sketchup-api-stubs 0.7.8 → 0.7.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +3 -0
  3. data/lib/sketchup-api-stubs/stubs/Array.rb +1 -1
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +1 -1
  5. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +1 -1
  6. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +1 -1
  7. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +1 -1
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +1 -1
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +1 -1
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +4 -18
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +17 -19
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +1 -1
  13. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +1 -1
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +1 -1
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +3 -3
  16. data/lib/sketchup-api-stubs/stubs/Geom.rb +1 -1
  17. data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +1 -1
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +1 -1
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +50 -1
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +1 -1
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +1 -1
  22. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +56 -3
  23. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +1 -1
  24. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +1 -1
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +4 -1
  26. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +1 -1
  27. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +1 -1
  28. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +1 -1
  29. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +1 -1
  30. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +1 -1
  31. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +1 -1
  32. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +1 -1
  33. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +1 -1
  34. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +1 -1
  35. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +1 -1
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +1 -1
  37. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +1 -1
  38. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +73 -1
  39. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +1 -1
  40. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +7 -7
  41. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +1 -1
  42. data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -0
  43. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +24 -2
  44. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1 -1
  45. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +1 -1
  46. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +1 -1
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +1 -1
  48. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +1 -1
  49. data/lib/sketchup-api-stubs/stubs/Layout.rb +1 -1
  50. data/lib/sketchup-api-stubs/stubs/Length.rb +1 -1
  51. data/lib/sketchup-api-stubs/stubs/Numeric.rb +1 -1
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +1 -1
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +1 -1
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +18 -1
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +3 -5
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +4 -9
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +1 -1
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +1 -1
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +1 -1
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +1 -1
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +4 -5
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +1 -1
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +44 -4
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +2 -2
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +1 -1
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +1 -1
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +1 -1
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +1 -1
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +25 -2
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +1 -1
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +1 -1
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +1 -1
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +1 -1
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +1 -1
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +1 -1
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +13 -3
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +62 -167
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +1 -1
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +246 -209
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +3 -14
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +1 -1
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +10 -36
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +1 -1
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +4 -5
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +1 -1
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +1 -3
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +1 -1
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +16 -26
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +2 -2
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +1 -1
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +1 -1
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +1 -1
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +1 -1
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +29 -30
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +1 -1
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +2 -2
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +1 -1
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +1 -1
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +1 -1
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +1 -1
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +2 -2
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +1 -1
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +9 -7
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +1 -1
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +1 -1
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +2 -3
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +1 -1
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +1 -1
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +28 -23
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +1 -1
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +4 -5
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +5 -18
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +1 -1
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +490 -0
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +116 -0
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +1 -1
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +15 -17
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +1 -1
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +21 -18
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +1 -1
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +18 -9
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +1 -1
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +1 -1
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +4 -5
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +1 -1
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +1 -1
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +15 -20
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +1 -1
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +1 -1
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +1 -1
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +1 -1
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +1 -1
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +1 -1
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +1 -1
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +17 -20
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +1 -1
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +1 -1
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +1 -1
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +1 -1
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +30 -18
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +1 -1
  143. data/lib/sketchup-api-stubs/stubs/Sketchup.rb +48 -14
  144. data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +2 -2
  145. data/lib/sketchup-api-stubs/stubs/String.rb +1 -1
  146. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +29 -31
  147. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +18 -9
  148. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +3 -3
  149. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +5 -4
  150. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +16 -18
  151. data/lib/sketchup-api-stubs/stubs/UI.rb +71 -26
  152. data/lib/sketchup-api-stubs/stubs/_top_level.rb +1 -9
  153. metadata +10 -7
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2022 Trimble Inc.
1
+ # Copyright:: Copyright 2024 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The {Sketchup::Entities} class is a collection of Entity objects, either in a
@@ -39,8 +39,10 @@ class Sketchup::Entities
39
39
  # section plane in the Entities object.
40
40
  #
41
41
  # @example
42
- # sp = Sketchup.active_model.entities.active_section_plane
43
- # puts "Active section plane is #{sp}" if !sp.nil?
42
+ # entities = Sketchup.active_model.entities
43
+ # section_plane = entities.add_section_plane([50, 50, 0], [1.0, 1.0, 0])
44
+ # entities.active_section_plane = section_plane
45
+ # section_plane = entities.active_section_plane
44
46
  #
45
47
  # @return [Sketchup::SectionPlane, nil] the active SectionPlane or nil if none is active.
46
48
  #
@@ -53,8 +55,8 @@ class Sketchup::Entities
53
55
  #
54
56
  # @example
55
57
  # entities = Sketchup.active_model.entities
56
- # sp = entities.add_section_plane([50, 50, 0], [1.0, 1.0, 0])
57
- # entities.active_section_plane = sp
58
+ # section_plane = entities.add_section_plane([50, 50, 0], [1.0, 1.0, 0])
59
+ # entities.active_section_plane = section_plane
58
60
  #
59
61
  # @param [Sketchup::SectionPlane, nil] sec_plane
60
62
  # the SectionPlane object to be set active. Pass nil to
@@ -66,70 +68,66 @@ class Sketchup::Entities
66
68
  def active_section_plane=(sec_plane)
67
69
  end
68
70
 
69
- # The add_3d_text is used to create 3D text. It will be added as edges and
71
+ # The {#add_3d_text} method is used to create 3D text. It will be added as edges and
70
72
  # faces drawn at the origin.
71
73
  #
72
- # = 1.0, tolerance = 0.0, z = 0.0, is_filled = true, extrusion = 0.0)
73
- #
74
- # @param [String] string
75
- # The text to create.
74
+ # @example
75
+ # # Draw the word "test" at the origin of the model, aligned left, in
76
+ # # Arial Bold, not italics, 1" in size, best tolerance quality, filled,
77
+ # # with an extrusion size of 5".
78
+ # entities = Sketchup.active_model.entities
79
+ # success = entities.add_3d_text('test', TextAlignLeft, "Arial",
80
+ # true, false, 1.inch, 0.0, 0.5.inch, true, 5.0.inch)
76
81
  #
77
- # @param [Integer] alignment
78
- # Number that defines the alignment. There are constants
79
- # called TextAlignLeft, TextAlignRight, and
80
- # TextAlignCenter that can be passed.
82
+ # @param [String] string
83
+ # The text to create.
81
84
  #
82
- # @param [String] font
83
- # font name.
85
+ # @param [Integer] alignment
86
+ # Number that defines the alignment. There are constants
87
+ # called TextAlignLeft, TextAlignRight, and
88
+ # TextAlignCenter that can be passed.
84
89
  #
85
- # @param [Boolean] is_bold
86
- # true for bold.
90
+ # @param [String] font
91
+ # font name.
87
92
  #
88
- # @param [Boolean] is_italic
89
- # true for italic.
93
+ # @param [Boolean] is_bold
94
+ # true for bold.
90
95
  #
91
- # @param [Numeric] letter_height
92
- # Height of the text in inches.
96
+ # @param [Boolean] is_italic
97
+ # true for italic.
93
98
  #
94
- # @param [Numeric] tolerance
95
- # Tolerance of the curve creation. Defaults to
96
- # 0.0, which creates the highest possible curve quality.
99
+ # @param [Length] letter_height
100
+ # Height of the text
97
101
  #
98
- # @param [Numeric] z
99
- # z position in inches.
102
+ # @param [Numeric] tolerance
103
+ # Tolerance of the curve creation. Defaults to
104
+ # 0.0, which creates the highest possible curve quality.
100
105
  #
101
- # @param [Boolean] is_filled
102
- # true for filled, which will put a face between the edges of the letters.
106
+ # @param [Length] z
107
+ # z position of the text
103
108
  #
104
- # @param [Numeric] extrusion
105
- # Extrusion depth in inches.
109
+ # @param [Boolean] is_filled
110
+ # true for filled, which will put a face between the edges of the letters.
106
111
  #
107
- # @example
108
- # # Draw the word "test" at the origin of the model, aligned left, in
109
- # # Arial Bold, not italics, 1" in size, best tolerance quality, filled,
110
- # # with an extrusion size of 5".
111
- # entities = Sketchup.active_model.entities
112
- # success = entities.add_3d_text('test', TextAlignLeft, "Arial",
113
- # true, false, 1.0, 0.0, 0.5, true, 5.0)
112
+ # @param [Length] extrusion
113
+ # Extrusion depth
114
114
  #
115
115
  # @return [Boolean] true if successful
116
116
  #
117
117
  # @version SketchUp 6.0
118
- def add_3d_text(string, alignment, font, is_bold = false, is_italic = false, letter_height)
118
+ 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)
119
119
  end
120
120
 
121
121
  # The add_arc method is used to create an arc curve segment.
122
122
  #
123
123
  # @example
124
- # centerpoint = Geom::Point3d.new
125
- # # Create a circle perpendicular to the normal or Z axis
126
- # vector = Geom::Vector3d.new 0,0,1
127
- # vector2 = Geom::Vector3d.new 1,0,0
128
- # vector3 = vector.normalize!
129
124
  # model = Sketchup.active_model
130
125
  # entities = model.active_entities
131
- # edges = entities.add_arc centerpoint, vector2, vector3, 10, 15.degrees, 135.degrees
132
- # arccurve = edges.first.curve
126
+ # center_point = Geom::Point3d.new
127
+ # # Create an arc perpendicular to the normal or Z axis
128
+ # normal = Geom::Vector3d.new(0, 0, 1)
129
+ # xaxis = Geom::Vector3d.new(1, 0, 0)
130
+ # edges = entities.add_arc(center_point, xaxis, normal, 10, 15.degrees, 135.degrees)
133
131
  #
134
132
  # @overload add_arc(center, xaxis, normal, radius, start_angle, end_angle)
135
133
  #
@@ -159,13 +157,12 @@ class Sketchup::Entities
159
157
  # The add_circle method is used to create a circle.
160
158
  #
161
159
  # @example
162
- # centerpoint = Geom::Point3d.new
163
- # # Create a circle perpendicular to the normal or Z axis
164
- # vector = Geom::Vector3d.new 0,0,1
165
- # vector2 = vector.normalize!
166
160
  # model = Sketchup.active_model
167
161
  # entities = model.active_entities
168
- # edges = entities.add_circle centerpoint, vector2, 10
162
+ # center_point = Geom::Point3d.new
163
+ # # Create a circle perpendicular to the provided vector.
164
+ # normal = Z_AXIS
165
+ # edges = entities.add_circle(center_point, vector, 10)
169
166
  #
170
167
  # @param [Geom::Point3d] center
171
168
  # A Point3d object representing the center.
@@ -220,15 +217,9 @@ class Sketchup::Entities
220
217
  # The add_cpoint method is used to create a construction point.
221
218
  #
222
219
  # @example
223
- # model = Sketchup.active_model
224
- # entities = model.active_entities
225
- # point1 = Geom::Point3d.new(100,200,300)
226
- # constpoint = entities.add_cpoint point1
227
- # if (constpoint)
228
- # UI.messagebox constpoint
229
- # else
230
- # UI.messagebox "Failure"
231
- # end
220
+ # entities = Sketchup.active_model.active_entities
221
+ # point1 = Geom::Point3d.new(100, 200, 300)
222
+ # constpoint = entities.add_cpoint(point1)
232
223
  #
233
224
  # @param [Geom::Point3d] point
234
225
  # A Point3d object.
@@ -247,7 +238,7 @@ class Sketchup::Entities
247
238
  #
248
239
  # @example
249
240
  # entities = Sketchup.active_model.entities
250
- # curve = entities.add_curve [0,0,0], [0,10,0], [1,20,0]
241
+ # curve = entities.add_curve([0, 0, 0], [0, 10, 0], [10, 20, 0])
251
242
  #
252
243
  # @overload add_curve(points)
253
244
  #
@@ -265,45 +256,52 @@ class Sketchup::Entities
265
256
 
266
257
  # The {#add_dimension_linear} method adds a linear dimension to the entities.
267
258
  #
268
- # [instance_path, end_point], vector)
269
- #
270
- # vector)
271
- #
272
259
  # @example
273
260
  # entities = Sketchup.active_model.entities
274
261
  # # From point to point
275
- # dim = entities.add_dimension_linear [50, 10, 0], [100, 10, 0], [0, 20, 0]
262
+ # dim = entities.add_dimension_linear([0, 0, 0], [50, 0, 0], [0, 20, 0])
263
+ #
276
264
  # # Between edge vertices
277
- # edge = entities.add_edges([50,50,0], [40,10,0])[0]
278
- # v0 = edge.start
279
- # v1 = edge.end
280
- # dim = entities.add_dimension_linear v0, v1, [0, 0, 20]
265
+ # edge1 = entities.add_edges([70, 0, 0], [120, 0, 0])[0]
266
+ # v0 = edge1.start
267
+ # v1 = edge1.end
268
+ # dim = entities.add_dimension_linear(v0, v1, [0, 20, 0])
269
+ #
281
270
  # # From an edge's midpoint to a construction point
282
- # p0 = edge.start.position
283
- # p1 = edge.end.position
284
- # mp = Geom::Point3d.new((p0.x+p1.x)/2.0, (p0.y+p1.y)/2.0, (p0.z+p1.z)/2.0)
285
- # cp = entities.add_cpoint [50, 10, 0]
286
- # dim = entities.add_dimension_linear [edge, mp], cp, [20, 0, 0]
287
- # # alternatively, the start params could be passed in separately
288
- # dim = entities.add_dimension_linear edge, mp, cp, [20, 0, 0]
271
+ # edge2 = entities.add_edges([150, 0, 0], [200, 0, 0])[0]
272
+ # p0 = edge2.start.position
273
+ # p1 = edge2.end.position
274
+ # mp = Geom::Point3d.new((p0.x + p1.x) / 2.0, (p0.y + p1.y) / 2.0, (p0.z + p1.z) / 2.0)
275
+ # cp = entities.add_cpoint([150, 40, 0])
276
+ # dim = entities.add_dimension_linear([edge2, mp], cp, [20, 0, 0])
289
277
  #
290
278
  # @example Instance path
291
- # instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
279
+ # entities = Sketchup.active_model.entities
280
+ # group = entities.add_group
281
+ # group.entities.add_face([0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0])
282
+ # instance = group.to_component
283
+ # transformation = instance.transformation
292
284
  # edge = instance.definition.entities.grep(Sketchup::Edge).first
293
285
  # instance_path = Sketchup::InstancePath.new([instance, edge])
294
- # start_point = edge.start.position
295
- # end_point = edge.end.position
296
- # vector = Geom::Vector3d.new(30, 30, 0)
297
- # Sketchup.active_model.entities.add_dimension_linear([instance_path, start_point],
286
+ # start_point = edge.start.position.transform(transformation)
287
+ # end_point = edge.end.position.transform(transformation)
288
+ # vector = Geom::Vector3d.new(0, 30, 0)
289
+ # Sketchup.active_model.entities.add_dimension_linear(
290
+ # [instance_path, start_point], [instance_path, end_point], vector)
298
291
  #
299
292
  # @example Instance path as an array
300
- # instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
293
+ # entities = Sketchup.active_model.entities
294
+ # group = entities.add_group
295
+ # group.entities.add_face([0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0])
296
+ # instance = group.to_component
297
+ # transformation = instance.transformation
301
298
  # edge = instance.definition.entities.grep(Sketchup::Edge).first
302
299
  # path = [instance, edge]
303
- # start_point = edge.start.position
304
- # end_point = edge.end.position
305
- # vector = Geom::Vector3d.new(30, 30, 0)
306
- # Sketchup.active_model.entities.add_dimension_linear([path, start_point], [path, end_point],
300
+ # start_point = edge.start.position.transform(transformation)
301
+ # end_point = edge.end.position.transform(transformation)
302
+ # vector = Geom::Vector3d.new(0, 30, 0)
303
+ # Sketchup.active_model.entities.add_dimension_linear(
304
+ # [path, start_point], [path, end_point], vector)
307
305
  #
308
306
  # @overload add_dimension_linear(start_pt_or_entity, end_pt_or_entity, offset_vector)
309
307
  #
@@ -334,13 +332,13 @@ class Sketchup::Entities
334
332
  # @overload add_dimension_linear(start_array, end_array, offset_vector)
335
333
  #
336
334
  # @note Added in SketchUp 2019.
337
- # @param [Array(Array<Entity>, Geom::Point3d)] start_array
338
- # The {Array<Entity>} must contain one or more {Sketchup::ComponentInstance}'s
335
+ # @param [Array(Array<Sketchup::Entity>, Geom::Point3d)] start_array
336
+ # The {Array<Sketchup::Entity>} must contain one or more {Sketchup::ComponentInstance}'s
339
337
  # and a leaf entity. The leaf entity can be a {Sketchup::Vertex},
340
338
  # {Sketchup::ConstructionPoint}, {Sketchup::ConstructionLine}, or
341
339
  # {Sketchup::Edge}. The {Geom::Point3d} is the point associated with the leaf entity.
342
- # @param [Array(Array<Entity>, Geom::Point3d)] end_array
343
- # The {Array<Entity>} must contain one or more {Sketchup::ComponentInstance}'s
340
+ # @param [Array(Array<Sketchup::Entity>, Geom::Point3d)] end_array
341
+ # The {Array<Sketchup::Entity>} must contain one or more {Sketchup::ComponentInstance}'s
344
342
  # and a leaf entity. The leaf entity can be a {Sketchup::Vertex},
345
343
  # {Sketchup::ConstructionPoint}, {Sketchup::ConstructionLine}, or
346
344
  # {Sketchup::Edge}. The {Geom::Point3d} is the point associated with the leaf entity.
@@ -360,11 +358,11 @@ class Sketchup::Entities
360
358
  # @example
361
359
  # entities = Sketchup.active_model.entities
362
360
  # # Create a circle
363
- # centerpoint = Geom::Point3d.new(10, 10, 0)
361
+ # center_point = Geom::Point3d.new(10, 10, 0)
364
362
  # vector = Geom::Vector3d.new(0, 0, 1)
365
- # edges = entities.add_circle centerpoint, vector, 10
363
+ # edges = entities.add_circle(center_point, vector, 10)
366
364
  # circle = edges[0].curve
367
- # dim = entities.add_dimension_radial circle, [30, 30, 0]
365
+ # dim = entities.add_dimension_radial(circle, [30, 30, 0])
368
366
  #
369
367
  # @param [Sketchup::ArcCurve] arc_curve
370
368
  # an ArcCurve object to which the dimension is to be
@@ -386,9 +384,10 @@ class Sketchup::Entities
386
384
  # @example
387
385
  # model = Sketchup.active_model
388
386
  # entities = model.active_entities
389
- # point1 = Geom::Point3d.new(0,0,0)
390
- # point2 = Geom::Point3d.new(20,20,20)
391
- # edges = entities.add_edges point1, point2
387
+ # point1 = Geom::Point3d.new(0, 0, 0)
388
+ # point2 = Geom::Point3d.new(20, 20, 20)
389
+ # point3 = Geom::Point3d.new(20, 40, 20)
390
+ # edges = entities.add_edges(point1, point2, point3)
392
391
  #
393
392
  # @note If the points form a closed loop, the first and last vertex will not
394
393
  # merge. If you intend to create a face from the edges, use {#add_face}
@@ -427,17 +426,15 @@ class Sketchup::Entities
427
426
  # circle.
428
427
  #
429
428
  # @example
430
- # depth = 100
431
- # width = 100
432
429
  # model = Sketchup.active_model
433
430
  # entities = model.active_entities
434
- # pts = []
435
- # pts[0] = [0, 0, 0]
436
- # pts[1] = [width, 0, 0]
437
- # pts[2] = [width, depth, 0]
438
- # pts[3] = [0, depth, 0]
431
+ # points = []
432
+ # points << [0, 0, 0]
433
+ # points << [100, 0, 0]
434
+ # points << [100, 100, 0]
435
+ # points << [0, 100, 0]
439
436
  # # Add the face to the entities in the model
440
- # face = entities.add_face(pts)
437
+ # face = entities.add_face(points)
441
438
  #
442
439
  # @note A special case exists for any face created on the ground plane, in
443
440
  # which case the vertex order is ignored and the face is always facing down.
@@ -483,18 +480,21 @@ class Sketchup::Entities
483
480
  # pm = Geom::PolygonMesh.new
484
481
  # pm.add_point([ 0, 0, 0]) # 1
485
482
  # pm.add_point([10, 0, 0]) # 2
486
- # pm.add_point([10,10, 0]) # 3
487
- # pm.add_point([ 0,10, 0]) # 4
483
+ # pm.add_point([10, 10, 0]) # 3
484
+ # pm.add_point([0, 10, 0]) # 4
488
485
  # pm.add_point([20, 0, 5]) # 5
489
- # pm.add_point([20,10, 5]) # 6
486
+ # pm.add_point([20, 10, 5]) # 6
490
487
  # pm.add_polygon(1, -2, 3, 4)
491
- # pm.add_polygon(2, 5,6, -3)
488
+ # pm.add_polygon(2, 5, 6, -3)
492
489
  #
493
490
  # # Create a new group that we will populate with the mesh.
494
491
  # group = Sketchup.active_model.entities.add_group
495
- # material = Sketchup.active_model.materials.add('green')
492
+ # material1 = Sketchup.active_model.materials.add('My Green Material')
493
+ # material1.color = 'green'
494
+ # material2 = Sketchup.active_model.materials.add('My Red Material')
495
+ # material2.color = 'red'
496
496
  # smooth_flags = Geom::PolygonMesh::NO_SMOOTH_OR_HIDE
497
- # group.entities.add_faces_from_mesh(pm, smooth_flags, material)
497
+ # group.entities.add_faces_from_mesh(pm, smooth_flags, material1, material2)
498
498
  #
499
499
  # @param [Geom::PolygonMesh] polygon_mesh
500
500
  #
@@ -557,13 +557,9 @@ class Sketchup::Entities
557
557
  # @example
558
558
  # model = Sketchup.active_model
559
559
  # entities = model.active_entities
560
- # point = Geom::Point3d.new 10,20,30
561
- # image = entities.add_image "Shapes.jpg", point, 300
562
- # if (image)
563
- # UI.messagebox image
564
- # else
565
- # UI.messagebox "Failure"
566
- # end
560
+ # point = Geom::Point3d.new(10, 20, 30)
561
+ # image = entities.add_image(Sketchup.find_support_file('ColorWheel.png',
562
+ # 'Resources/../..'), point, 300)
567
563
  #
568
564
  # @param [String] path
569
565
  # A path for the image file.
@@ -590,20 +586,14 @@ class Sketchup::Entities
590
586
  # entities.
591
587
  #
592
588
  # @example
593
- # point = Geom::Point3d.new 10,20,30
594
- # transform = Geom::Transformation.new point
595
589
  # model = Sketchup.active_model
596
590
  # entities = model.active_entities
597
- # path = Sketchup.find_support_file "Bed.skp",
598
- # "Components/Components Sampler/"
591
+ # point = Geom::Point3d.new(10, 20, 30)
592
+ # transform = Geom::Transformation.new(point)
593
+ # path = Sketchup.find_support_file("Bed.skp", "Components/Components Sampler/")
599
594
  # definitions = model.definitions
600
- # componentdefinition = definitions.load path
601
- # instance = entities.add_instance componentdefinition, transform
602
- # if (instance)
603
- # UI.messagebox instance
604
- # else
605
- # UI.messagebox "Failure"
606
- # end
595
+ # componentdefinition = definitions.load(path)
596
+ # instance = entities.add_instance(componentdefinition, transform)
607
597
  #
608
598
  # @param [Sketchup::ComponentDefinition] definition
609
599
  # A ComponentDefinition object.
@@ -628,14 +618,9 @@ class Sketchup::Entities
628
618
  # @example
629
619
  # model = Sketchup.active_model
630
620
  # entities = model.active_entities
631
- # point1 = Geom::Point3d.new(0,0,0)
632
- # point2 = Geom::Point3d.new(20,20,20)
633
- # line = entities.add_line point1,point2
634
- # if (line)
635
- # UI.messagebox line
636
- # else
637
- # UI.messagebox "Failure"
638
- # end
621
+ # point1 = Geom::Point3d.new(0, 0, 0)
622
+ # point2 = Geom::Point3d.new(20, 20, 20)
623
+ # line = entities.add_line(point1, point2)
639
624
  #
640
625
  # @param [Geom::Point3d] point1
641
626
  # Point3d object representing the edge's starting point.
@@ -661,10 +646,10 @@ class Sketchup::Entities
661
646
  # @example
662
647
  # entities = Sketchup.active_model.entities
663
648
  # center = Geom::Point3d.new
664
- # normal = Geom::Vector3d.new(0,0,1)
649
+ # normal = Geom::Vector3d.new(0, 0, 1)
665
650
  # radius = 100
666
651
  # numsides = 6
667
- # edges = entities.add_ngon center, normal, radius, numsides
652
+ # edges = entities.add_ngon(center, normal, radius, numsides)
668
653
  #
669
654
  # @param [Geom::Point3d] center
670
655
  # A Point3d object representing the center of the polygon.
@@ -688,8 +673,17 @@ class Sketchup::Entities
688
673
  # The add_observer method is used to add an observer to the current object.
689
674
  #
690
675
  # @example
676
+ # # This is an example of an observer that watches the entities collection.
677
+ # # It writes to the console everytime new entities are added to the model.
678
+ # class MyEntitiesObserver < Sketchup::EntitiesObserver
679
+ # def onElementAdded(entities, entity)
680
+ # puts "onElementAdded: #{entity} was added to the model."
681
+ # end
682
+ # end
683
+ #
684
+ # # Attach the observer
691
685
  # entities = Sketchup.active_model.entities
692
- # status = entities.add_observer observer
686
+ # entities.add_observer(MyEntitiesObserver.new)
693
687
  #
694
688
  # @param [Object] observer
695
689
  # An observer.
@@ -705,9 +699,9 @@ class Sketchup::Entities
705
699
  # @example
706
700
  # # Create a section plane
707
701
  # model = Sketchup.active_model
708
- # sp = model.entities.add_section_plane([50, 50, 0], [1.0, 1.0, 0])
702
+ # section_plane = model.entities.add_section_plane([50, 50, 0], [1.0, 1.0, 0])
709
703
  # # Activate it
710
- # sp.activate
704
+ # section_plane.activate
711
705
  # # Make sure section planes are visible
712
706
  # model.rendering_options['DisplaySectionPlanes'] = true
713
707
  #
@@ -726,26 +720,33 @@ class Sketchup::Entities
726
720
  # The {#add_text} method adds a note or label text entity to the entities.
727
721
  #
728
722
  # @example
729
- # coordinates = [10, 10, 10]
730
723
  # model = Sketchup.active_model
731
724
  # entities = model.entities
732
- # point = Geom::Point3d.new coordinates
733
- # text = entities.add_text "This is a Test", point
725
+ # point = Geom::Point3d.new(10, 10, 10)
726
+ # text = entities.add_text("This is a Test", point)
734
727
  #
735
728
  # @example Instance path
736
- # instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
729
+ # entities = Sketchup.active_model.entities
730
+ # group = entities.add_group
731
+ # group.entities.add_face([0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0])
732
+ # instance = group.to_component
733
+ # transformation = instance.transformation
737
734
  # edge = instance.definition.entities.grep(Sketchup::Edge).first
738
735
  # instance_path = Sketchup::InstancePath.new([instance, edge])
739
- # point = edge.start.position
740
- # vector = Geom::Vector3d.new(30, 30, 0)
736
+ # point = edge.start.position.transform(transformation)
737
+ # vector = Geom::Vector3d.new(45, 45, 45)
741
738
  # Sketchup.active_model.entities.add_text("mytext", [instance_path, point], vector)
742
739
  #
743
740
  # @example Instance path as an array
744
- # instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
741
+ # entities = Sketchup.active_model.entities
742
+ # group = entities.add_group
743
+ # group.entities.add_face([0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0])
744
+ # instance = group.to_component
745
+ # transformation = instance.transformation
745
746
  # edge = instance.definition.entities.grep(Sketchup::Edge).first
746
747
  # path = [instance, edge]
747
- # point = edge.start.position
748
- # vector = Geom::Vector3d.new(30, 30, 0)
748
+ # point = edge.start.position.transform(transformation)
749
+ # vector = Geom::Vector3d.new(45, 45, 45)
749
750
  # Sketchup.active_model.entities.add_text("mytext", [path, point], vector)
750
751
  #
751
752
  # @overload add_text(text, point, vector)
@@ -814,14 +815,12 @@ class Sketchup::Entities
814
815
  #
815
816
  # Refer to the documentation of {Sketchup::EntitiesBuilder} for more details.
816
817
  #
817
- # @api EntitiesBuilder
818
- #
819
818
  # @example
820
819
  # model = Sketchup.active_model
821
820
  # model.entities.build { |builder|
822
821
  # edge = builder.add_edge([0, 0, 0], [9, 0, 0])
823
822
  # edge.material = 'red'
824
- # face = builder.add_face([[0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0]])
823
+ # face = builder.add_face([0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0])
825
824
  # face.material = 'maroon'
826
825
  # }
827
826
  #
@@ -846,12 +845,7 @@ class Sketchup::Entities
846
845
  # entities.
847
846
  #
848
847
  # @example
849
- # coordinates = [10, 10, 10]
850
- # model = Sketchup.active_model
851
- # entities = model.entities
852
- # point = Geom::Point3d.new coordinates
853
- # text = entities.add_text "This is a Test", point
854
- # UI.messagebox "Clearing All"
848
+ # entities = Sketchup.active_model.entities
855
849
  # status = entities.clear!
856
850
  #
857
851
  # @return [Boolean] true if successful, false if unsuccessful
@@ -862,9 +856,7 @@ class Sketchup::Entities
862
856
 
863
857
  #
864
858
  # @example
865
- # model = Sketchup.active_model
866
- # entities = model.entities
867
- # entities.add_cpoint([10, 10, 10])
859
+ # entities = Sketchup.active_model.entities
868
860
  # number = entities.count
869
861
  #
870
862
  # @note Since SketchUp 2014 the count method is inherited from Ruby's
@@ -883,11 +875,8 @@ class Sketchup::Entities
883
875
  # of entities.
884
876
  #
885
877
  # @example
886
- # coordinates = [10, 10, 10]
887
878
  # model = Sketchup.active_model
888
879
  # entities = model.entities
889
- # point = Geom::Point3d.new coordinates
890
- # text = entities.add_text "This is a Test", point
891
880
  # entities.each { | entity| puts entity }
892
881
  #
893
882
  # @note Don't remove content from this collection while iterating over it with
@@ -903,28 +892,31 @@ class Sketchup::Entities
903
892
  def each
904
893
  end
905
894
 
906
- # The erase_entities method is used to erase one or more entities from the
895
+ # The {#erase_entities} method is used to erase one or more entities from the
907
896
  # model.
908
897
  #
898
+ # @bug Prior to SketchUp 2023.0 this could crash SketchUp if you erased an
899
+ # instance used by the active edit path.
900
+ #
901
+ # @bug SketchUp 2023.0 and SketchUp 2023.0.1 could incorrectly raise an
902
+ # `ArgumentError` when there was an open editing path.
903
+ #
909
904
  # @example
910
- # depth = 100
911
- # width = 100
912
905
  # model = Sketchup.active_model
913
906
  # entities = model.active_entities
914
- # pts = []
915
- # pts[0] = [0, 0, 0]
916
- # pts[1] = [width, 0, 0]
917
- # pts[2] = [width, depth, 0]
918
- # pts[3] = [0, depth, 0]
907
+ # points = []
908
+ # points << [0, 0, 0]
909
+ # points << [100, 0, 0]
910
+ # points << [100, 100, 0]
911
+ # points << [0, 100, 0]
919
912
  #
920
- # # Add the face to the entities in the model
921
- # face = entities.add_face pts
913
+ # # Add the face to the entities in the model.
914
+ # face = entities.add_face(pts)
915
+ # faces = entities.grep(Sketchup::Face)
916
+ # entities.erase_entities(faces)
922
917
  #
923
- # # I just happen to know that the second entity in the
924
- # # entities objects is an edge, so erase it.
925
- # UI.messagebox entities
926
- # entities.erase_entities entities[1]
927
- # UI.messagebox entities
918
+ # @note It's faster to use this method and erase in bulk than to iterate
919
+ # individual drawing elements calling {Sketchup::Drawingelement#erase!}.
928
920
  #
929
921
  # @overload erase_entities(entities)
930
922
  #
@@ -934,6 +926,9 @@ class Sketchup::Entities
934
926
  #
935
927
  # @param [Array<Sketchup::Entity>] entities
936
928
  #
929
+ # @raise [ArgumentError] if the given entities contains instances or
930
+ # definitions are used by {Sketchup::Model#active_path}.
931
+ #
937
932
  # @return [nil]
938
933
  #
939
934
  # @version SketchUp 6.0
@@ -961,18 +956,19 @@ class Sketchup::Entities
961
956
  #
962
957
  # @example
963
958
  # pm = Geom::PolygonMesh.new
964
- # pm.add_point([ 0, 0, 0]) # 1
965
- # pm.add_point([10, 0, 0]) # 2
966
- # pm.add_point([10,10, 0]) # 3
967
- # pm.add_point([ 0,10, 0]) # 4
968
- # pm.add_point([20, 0, 5]) # 5
969
- # pm.add_point([20,10, 5]) # 6
959
+ # pm.add_point([ 0, 0, 0]) # 1
960
+ # pm.add_point([ 10, 0, 0]) # 2
961
+ # pm.add_point([ 10, 10, 0]) # 3
962
+ # pm.add_point([ 0, 10, 0]) # 4
963
+ # pm.add_point([ 20, 0, 5]) # 5
964
+ # pm.add_point([ 20, 10, 5]) # 6
970
965
  # pm.add_polygon(1, -2, 3, 4)
971
966
  # pm.add_polygon(2, 5, 6, -3)
972
967
  #
973
968
  # # Create a new group that we will populate with the mesh.
974
969
  # group = Sketchup.active_model.entities.add_group
975
- # material = Sketchup.active_model.materials.add('red')
970
+ # material = Sketchup.active_model.materials.add('My Red Material')
971
+ # material.color = 'red'
976
972
  # smooth_flags = Geom::PolygonMesh::HIDE_BASED_ON_INDEX
977
973
  # group.entities.fill_from_mesh(pm, true, smooth_flags, material)
978
974
  #
@@ -1009,8 +1005,26 @@ class Sketchup::Entities
1009
1005
  # instance, or group object with a entities object.
1010
1006
  #
1011
1007
  # @example
1012
- # entities.intersect_with recurse, transformation1, entities1,
1013
- # transformation2, hidden, entities2
1008
+ # model = Sketchup.active_model
1009
+ # entities = model.active_entities
1010
+ #
1011
+ # # Create a group to intersect with the model
1012
+ # group1 = entities.add_group
1013
+ # face1 = group1.entities.add_face([0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0])
1014
+ # face1.pushpull(-40)
1015
+ #
1016
+ # # Add geometry into the model
1017
+ # face2 = entities.add_face([50, 50, 0], [200, 50, 0], [200, 200, 0], [50, 200, 0])
1018
+ # face2.pushpull(-100)
1019
+ #
1020
+ # entities1 = group1.entities
1021
+ # entities2 = entities.to_a
1022
+ #
1023
+ # transformation1 = Geom::Transformation.new
1024
+ # transformation2 = group1.transformation
1025
+ #
1026
+ # # Intersect the group and model geometry
1027
+ # entities.intersect_with(true, transformation1, entities1, transformation2, true, entities2)
1014
1028
  #
1015
1029
  # @param [Boolean] recurse
1016
1030
  # true if you want this entities object to be recursed
@@ -1046,7 +1060,6 @@ class Sketchup::Entities
1046
1060
  # @example
1047
1061
  # model = Sketchup.active_model
1048
1062
  # entities = model.entities
1049
- # entities.add_cpoint([10, 10, 10])
1050
1063
  # number = entities.length
1051
1064
  #
1052
1065
  # @return [Integer]
@@ -1061,12 +1074,11 @@ class Sketchup::Entities
1061
1074
  # of entities.
1062
1075
  #
1063
1076
  # @example
1064
- # coordinates = [10, 10, 10]
1065
1077
  # model = Sketchup.active_model
1066
1078
  # entities = model.entities
1067
- # point = Geom::Point3d.new coordinates
1068
- # text = entities.add_text "This is a Test", point
1069
- # model = entities.model
1079
+ # group = entities.add_group
1080
+ # face = group.entities.add_face([0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0])
1081
+ # model = group.entities.model
1070
1082
  #
1071
1083
  # @return [Sketchup::Model] the model that contains the collection of
1072
1084
  # entities if successful.
@@ -1080,12 +1092,11 @@ class Sketchup::Entities
1080
1092
  # ComponentDefinition object.
1081
1093
  #
1082
1094
  # @example
1083
- # coordinates = [10, 10, 10]
1084
1095
  # model = Sketchup.active_model
1085
1096
  # entities = model.entities
1086
- # point = Geom::Point3d.new coordinates
1087
- # text = entities.add_text "This is a Test", point
1088
- # parent = entities.parent
1097
+ # group = entities.add_group
1098
+ # face = group.entities.add_face([0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0])
1099
+ # model = group.entities.parent
1089
1100
  #
1090
1101
  # @return [Sketchup::ComponentDefinition, Sketchup::Model] the object that
1091
1102
  # contains the collection of entities if successful
@@ -1098,8 +1109,22 @@ class Sketchup::Entities
1098
1109
  # object.
1099
1110
  #
1100
1111
  # @example
1112
+ # # This is an example of an observer that watches the entities collection.
1113
+ # # It writes to the console everytime new entities are added to the model.
1114
+ # class MyEntitiesObserver < Sketchup::EntitiesObserver
1115
+ # def onElementAdded(entities, entity)
1116
+ # puts "onElementAdded: #{entity} was added to the model."
1117
+ # end
1118
+ # end
1119
+ #
1120
+ # # Attach the observer
1101
1121
  # entities = Sketchup.active_model.entities
1102
- # status = entities.remove_observer observer
1122
+ # my_observer = MyEntitiesObserver.new
1123
+ # entities.add_observer(my_observer)
1124
+ # # Add an entity to the model, and the observer will trigger.
1125
+ # entities.add_line([0,0,0], [100,0,0])
1126
+ # # Remove the oberserver and the observer will no longer trigger.
1127
+ # status = entities.remove_observer(my_observer)
1103
1128
  #
1104
1129
  # @param [Object] observer
1105
1130
  # An observer.
@@ -1115,8 +1140,7 @@ class Sketchup::Entities
1115
1140
  # @example
1116
1141
  # model = Sketchup.active_model
1117
1142
  # entities = model.entities
1118
- # entities.add_cpoint([10, 10, 10])
1119
- # number = entities.size
1143
+ # entities.size
1120
1144
  #
1121
1145
  # @return [Integer]
1122
1146
  #
@@ -1130,10 +1154,16 @@ class Sketchup::Entities
1130
1154
  # sub-entities all at once.
1131
1155
  #
1132
1156
  # @example
1133
- # # Raise vertices in selection by their distance to the origin.
1134
1157
  # model = Sketchup.active_model
1135
1158
  # entities = model.active_entities
1136
- # with_vertices = entities.select { |entity| entity.respond_to?(:vertices) }
1159
+ #
1160
+ # # Create a group with geometry to transform
1161
+ # group1 = entities.add_group
1162
+ # face1 = group1.entities.add_face([0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0])
1163
+ # face1.pushpull(-40)
1164
+ #
1165
+ # # Raise vertices in selection by their distance to the origin.
1166
+ # with_vertices = group1.entities.select { |entity| entity.respond_to?(:vertices) }
1137
1167
  # vertices = with_vertices.flat_map(&:vertices).uniq
1138
1168
  # lengths = vertices.map { |vertex| vertex.position.distance(ORIGIN) }
1139
1169
  # vectors = lengths.map { |length| Geom::Vector3d.new(0, 0, length) }
@@ -1162,11 +1192,14 @@ class Sketchup::Entities
1162
1192
  #
1163
1193
  # @example
1164
1194
  # entities = Sketchup.active_model.entities
1165
- # entity1 = entities.add_line([0,0,0],[100,100,100])
1166
- # entity2 = entities.add_line([0,0,0],[200,-10,-10])
1195
+ # # Add edges to the model at the origin.
1196
+ # edge1 = entities.add_line([0, 0, 0], [100, 100, 100])
1197
+ # edge2 = entities.add_line([0, 0, 0], [200, -10, -10])
1167
1198
  #
1168
- # transformation = Geom::Transformation.new([100,0,0])
1169
- # entities.transform_entities(transformation, [entity1, entity2])
1199
+ # # After the transformation, the edges will be moved 100 inches
1200
+ # # away from the origin, on the x axis.
1201
+ # transformation = Geom::Transformation.new([100, 0, 0])
1202
+ # entities.transform_entities(transformation, [edge1, edge2])
1170
1203
  #
1171
1204
  # @param [Geom::Transformation] transform
1172
1205
  # The Transformation to apply.
@@ -1188,7 +1221,11 @@ class Sketchup::Entities
1188
1221
  #
1189
1222
  # @example
1190
1223
  # model = Sketchup.active_model
1191
- # edges = model.selection.grep(Sketchup::Edge)
1224
+ # entities = model.active_entities
1225
+ # edges = []
1226
+ # edges << entities.add_line([0, 0, 0], [100, 20, 0])
1227
+ # edges << entities.add_line([100, 20, 0], [130, 200, 50])
1228
+ # edges << entities.add_line([130, 200, 50], [130, 300, 50])
1192
1229
  # curves = model.active_entities.weld(edges)
1193
1230
  #
1194
1231
  # @param [Array<Sketchup::Edge>] edges