sketchup-api-stubs 0.6.1 → 0.7.4

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 (149) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +2 -0
  3. data/lib/sketchup-api-stubs.rb +1 -1
  4. data/lib/sketchup-api-stubs/sketchup.rb +145 -145
  5. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +318 -318
  6. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
  7. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
  8. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -401
  10. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
  11. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +492 -492
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +478 -478
  13. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
  14. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -523
  16. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +691 -691
  17. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +573 -569
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +411 -411
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +174 -186
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +514 -455
  23. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  24. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +143 -155
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -359
  26. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +349 -349
  27. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -123
  28. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
  29. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -86
  30. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +371 -371
  31. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
  32. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
  33. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +220 -232
  34. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -563
  35. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
  37. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
  38. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
  39. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +204 -216
  40. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
  41. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
  42. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +694 -547
  43. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
  44. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  45. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  46. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  48. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +140 -140
  49. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +157 -157
  50. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
  51. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +152 -152
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -281
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +328 -328
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +577 -577
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +122 -122
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +281 -281
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +562 -554
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +194 -194
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +329 -329
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +72 -72
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +102 -102
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +312 -312
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +38 -38
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +390 -390
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +508 -508
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1119 -1097
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +125 -125
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +544 -537
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +59 -59
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -125
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +750 -750
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +697 -697
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +285 -285
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +409 -409
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +226 -226
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +190 -190
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +393 -393
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +82 -82
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +303 -303
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +285 -262
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +244 -231
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +136 -136
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +112 -123
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +416 -416
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +311 -311
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +141 -141
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +95 -95
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1638 -1483
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +356 -356
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +132 -132
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +284 -282
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +770 -650
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +353 -353
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +76 -76
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +456 -456
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +364 -356
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +44 -44
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +454 -454
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +257 -257
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +57 -57
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +211 -211
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +225 -225
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +829 -829
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +154 -154
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +61 -61
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1301 -995
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +43 -43
  134. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +310 -310
  135. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +356 -356
  136. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +229 -229
  137. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +240 -240
  138. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +633 -633
  139. data/lib/sketchup-api-stubs/stubs/_top_level.rb +311 -303
  140. data/lib/sketchup-api-stubs/stubs/array.rb +741 -741
  141. data/lib/sketchup-api-stubs/stubs/geom.rb +348 -233
  142. data/lib/sketchup-api-stubs/stubs/languagehandler.rb +92 -92
  143. data/lib/sketchup-api-stubs/stubs/length.rb +278 -262
  144. data/lib/sketchup-api-stubs/stubs/numeric.rb +249 -249
  145. data/lib/sketchup-api-stubs/stubs/sketchup.rb +1310 -1310
  146. data/lib/sketchup-api-stubs/stubs/sketchupextension.rb +353 -353
  147. data/lib/sketchup-api-stubs/stubs/string.rb +24 -24
  148. data/lib/sketchup-api-stubs/stubs/ui.rb +667 -660
  149. metadata +2 -16
@@ -1,211 +1,211 @@
1
- # Copyright:: Copyright 2019 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # The EdgeUse class defines how an Edge is used in the definition of a Face.
5
- #
6
- # @version SketchUp 6.0
7
- class Sketchup::EdgeUse < Sketchup::Entity
8
-
9
- # Instance Methods
10
-
11
- # The edge method is used to retrieve the edge for the edge use.
12
- #
13
- # @example
14
- # entities = Sketchup.active_model.active_entities
15
- # points = []
16
- # points << Geom::Point3d.new(0, 0, 0)
17
- # points << Geom::Point3d.new(100, 0, 0)
18
- # points << Geom::Point3d.new(100, 200, 0)
19
- # points << Geom::Point3d.new(0, 200, 0)
20
- # face = entities.add_face(points)
21
- # loop = face.outer_loop
22
- # edgeuses = loop.edgeuses
23
- # edgeuse = edgeuses[0]
24
- # edge = edgeuse.edge
25
- #
26
- # @return edge - an Edge object used by this edge use
27
- #
28
- # @version SketchUp 6.0
29
- def edge
30
- end
31
-
32
- # The end_vertex_normal method is used to retrieve the vertex normal for the
33
- # end point of this edgeuse.
34
- #
35
- # @example
36
- # entities = Sketchup.active_model.active_entities
37
- # points = []
38
- # points << Geom::Point3d.new(0, 0, 0)
39
- # points << Geom::Point3d.new(100, 0, 0)
40
- # points << Geom::Point3d.new(100, 200, 0)
41
- # points << Geom::Point3d.new(0, 200, 0)
42
- # face = entities.add_face(points)
43
- # loop = face.outer_loop
44
- # edgeuses = loop.edgeuses
45
- # edgeuse = edgeuses[0]
46
- # vector3d = edgeuse.end_vertex_normal
47
- #
48
- # @return vector3d - a vector3d object if successful.
49
- #
50
- # @version SketchUp 6.0
51
- def end_vertex_normal
52
- end
53
-
54
- # The face method is used to retrieve the face used by this edge use.
55
- #
56
- # @example
57
- # entities = Sketchup.active_model.active_entities
58
- # points = []
59
- # points << Geom::Point3d.new(0, 0, 0)
60
- # points << Geom::Point3d.new(100, 0, 0)
61
- # points << Geom::Point3d.new(100, 200, 0)
62
- # points << Geom::Point3d.new(0, 200, 0)
63
- # face = entities.add_face(points)
64
- # loop = face.outer_loop
65
- # edgeuses = loop.edgeuses
66
- # edgeuse = edgeuses[0]
67
- # face = edgeuse.face
68
- #
69
- # @return face - a Face object used by this edge use
70
- #
71
- # @version SketchUp 6.0
72
- def face
73
- end
74
-
75
- # The loop method is used to retrieve the loop for this edge use.
76
- #
77
- # @example
78
- # entities = Sketchup.active_model.active_entities
79
- # points = []
80
- # points << Geom::Point3d.new(0, 0, 0)
81
- # points << Geom::Point3d.new(100, 0, 0)
82
- # points << Geom::Point3d.new(100, 200, 0)
83
- # points << Geom::Point3d.new(0, 200, 0)
84
- # face = entities.add_face(points)
85
- # loop = face.outer_loop
86
- # edgeuses = loop.edgeuses
87
- # edgeuse = edgeuses[0]
88
- # loop = edgeuse.loop
89
- #
90
- # @return loop - a Loop object that contains this edge use.
91
- #
92
- # @version SketchUp 6.0
93
- def loop
94
- end
95
-
96
- # The next method is used to retrieve the next edge use in a loop.
97
- #
98
- # @example
99
- # entities = Sketchup.active_model.active_entities
100
- # points = []
101
- # points << Geom::Point3d.new(0, 0, 0)
102
- # points << Geom::Point3d.new(100, 0, 0)
103
- # points << Geom::Point3d.new(100, 200, 0)
104
- # points << Geom::Point3d.new(0, 200, 0)
105
- # face = entities.add_face(points)
106
- # loop = face.outer_loop
107
- # edgeuses = loop.edgeuses
108
- # edgeuse = edgeuses[0]
109
- # next_edgeuse = edgeuse.next
110
- #
111
- # @return edgeuse - the next EdgeUse object in a loop
112
- #
113
- # @version SketchUp 6.0
114
- def next
115
- end
116
-
117
- # The partners method is used to retrieve all of the partner edge uses that
118
- # uses the same edge.
119
- #
120
- # @example
121
- # entities = Sketchup.active_model.active_entities
122
- # points1 = []
123
- # points1 << Geom::Point3d.new(0, 0, 0)
124
- # points1 << Geom::Point3d.new(100, 0, 0)
125
- # points1 << Geom::Point3d.new(100, 200, 0)
126
- # points1 << Geom::Point3d.new(0, 200, 0)
127
- # face1 = entities.add_face(points1)
128
- # points2 = []
129
- # points2 << Geom::Point3d.new(100, 0, 0)
130
- # points2 << Geom::Point3d.new(200, 0, 0)
131
- # points2 << Geom::Point3d.new(200, 200, 0)
132
- # points2 << Geom::Point3d.new(100, 200, 0)
133
- # face2 = entities.add_face(points2)
134
- # loop = face1.outer_loop
135
- # edgeuses = loop.edgeuses
136
- # edgeuse = edgeuses[1]
137
- # partners = edgeuse.partners
138
- #
139
- # @return array - an array of partner Edge Use objects.
140
- #
141
- # @version SketchUp 6.0
142
- def partners
143
- end
144
-
145
- # The previous method is used to retrieve the previous edge use in a loop.
146
- #
147
- # @example
148
- # entities = Sketchup.active_model.active_entities
149
- # points = []
150
- # points << Geom::Point3d.new(0, 0, 0)
151
- # points << Geom::Point3d.new(100, 0, 0)
152
- # points << Geom::Point3d.new(100, 200, 0)
153
- # points << Geom::Point3d.new(0, 200, 0)
154
- # face = entities.add_face(points)
155
- # loop = face.outer_loop
156
- # edgeuses = loop.edgeuses
157
- # edgeuse = edgeuses[0]
158
- # previous_edgeuse = edgeuse.previous
159
- #
160
- # @return edgeuse - the previous Edge Use object in the loop
161
- #
162
- # @version SketchUp 6.0
163
- def previous
164
- end
165
-
166
- # The reversed? method is used to determine if the edge direction is opposite
167
- # of the edge use direction. The edge use direction is the same as the loop
168
- # it belongs to.
169
- #
170
- # @example
171
- # entities = Sketchup.active_model.active_entities
172
- # points = []
173
- # points << Geom::Point3d.new(0, 0, 0)
174
- # points << Geom::Point3d.new(100, 0, 0)
175
- # points << Geom::Point3d.new(100, 200, 0)
176
- # points << Geom::Point3d.new(0, 200, 0)
177
- # face = entities.add_face(points)
178
- # loop = face.outer_loop
179
- # edgeuses = loop.edgeuses
180
- # edgeuse = edgeuses[0]
181
- # reversed = edgeuse.reversed?
182
- #
183
- # @return [Boolean] boolean - true if reversed, false if not reversed.
184
- #
185
- # @version SketchUp 6.0
186
- def reversed?
187
- end
188
-
189
- # The start_vertex_normal method is used to retrieve the vertex normal for
190
- # the start point of this edgeuse.
191
- #
192
- # @example
193
- # entities = Sketchup.active_model.active_entities
194
- # points = []
195
- # points << Geom::Point3d.new(0, 0, 0)
196
- # points << Geom::Point3d.new(100, 0, 0)
197
- # points << Geom::Point3d.new(100, 200, 0)
198
- # points << Geom::Point3d.new(0, 200, 0)
199
- # face = entities.add_face(points)
200
- # loop = face.outer_loop
201
- # edgeuses = loop.edgeuses
202
- # edgeuse = edgeuses[0]
203
- # vector3d = edgeuse.start_vertex_normal
204
- #
205
- # @return vector3d - a vector3d object if successful.
206
- #
207
- # @version SketchUp 6.0
208
- def start_vertex_normal
209
- end
210
-
211
- end
1
+ # Copyright:: Copyright 2020 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # The EdgeUse class defines how an Edge is used in the definition of a Face.
5
+ #
6
+ # @version SketchUp 6.0
7
+ class Sketchup::EdgeUse < Sketchup::Entity
8
+
9
+ # Instance Methods
10
+
11
+ # The edge method is used to retrieve the edge for the edge use.
12
+ #
13
+ # @example
14
+ # entities = Sketchup.active_model.active_entities
15
+ # points = []
16
+ # points << Geom::Point3d.new(0, 0, 0)
17
+ # points << Geom::Point3d.new(100, 0, 0)
18
+ # points << Geom::Point3d.new(100, 200, 0)
19
+ # points << Geom::Point3d.new(0, 200, 0)
20
+ # face = entities.add_face(points)
21
+ # loop = face.outer_loop
22
+ # edgeuses = loop.edgeuses
23
+ # edgeuse = edgeuses[0]
24
+ # edge = edgeuse.edge
25
+ #
26
+ # @return edge - an Edge object used by this edge use
27
+ #
28
+ # @version SketchUp 6.0
29
+ def edge
30
+ end
31
+
32
+ # The end_vertex_normal method is used to retrieve the vertex normal for the
33
+ # end point of this edgeuse.
34
+ #
35
+ # @example
36
+ # entities = Sketchup.active_model.active_entities
37
+ # points = []
38
+ # points << Geom::Point3d.new(0, 0, 0)
39
+ # points << Geom::Point3d.new(100, 0, 0)
40
+ # points << Geom::Point3d.new(100, 200, 0)
41
+ # points << Geom::Point3d.new(0, 200, 0)
42
+ # face = entities.add_face(points)
43
+ # loop = face.outer_loop
44
+ # edgeuses = loop.edgeuses
45
+ # edgeuse = edgeuses[0]
46
+ # vector3d = edgeuse.end_vertex_normal
47
+ #
48
+ # @return vector3d - a vector3d object if successful.
49
+ #
50
+ # @version SketchUp 6.0
51
+ def end_vertex_normal
52
+ end
53
+
54
+ # The face method is used to retrieve the face used by this edge use.
55
+ #
56
+ # @example
57
+ # entities = Sketchup.active_model.active_entities
58
+ # points = []
59
+ # points << Geom::Point3d.new(0, 0, 0)
60
+ # points << Geom::Point3d.new(100, 0, 0)
61
+ # points << Geom::Point3d.new(100, 200, 0)
62
+ # points << Geom::Point3d.new(0, 200, 0)
63
+ # face = entities.add_face(points)
64
+ # loop = face.outer_loop
65
+ # edgeuses = loop.edgeuses
66
+ # edgeuse = edgeuses[0]
67
+ # face = edgeuse.face
68
+ #
69
+ # @return face - a Face object used by this edge use
70
+ #
71
+ # @version SketchUp 6.0
72
+ def face
73
+ end
74
+
75
+ # The loop method is used to retrieve the loop for this edge use.
76
+ #
77
+ # @example
78
+ # entities = Sketchup.active_model.active_entities
79
+ # points = []
80
+ # points << Geom::Point3d.new(0, 0, 0)
81
+ # points << Geom::Point3d.new(100, 0, 0)
82
+ # points << Geom::Point3d.new(100, 200, 0)
83
+ # points << Geom::Point3d.new(0, 200, 0)
84
+ # face = entities.add_face(points)
85
+ # loop = face.outer_loop
86
+ # edgeuses = loop.edgeuses
87
+ # edgeuse = edgeuses[0]
88
+ # loop = edgeuse.loop
89
+ #
90
+ # @return loop - a Loop object that contains this edge use.
91
+ #
92
+ # @version SketchUp 6.0
93
+ def loop
94
+ end
95
+
96
+ # The next method is used to retrieve the next edge use in a loop.
97
+ #
98
+ # @example
99
+ # entities = Sketchup.active_model.active_entities
100
+ # points = []
101
+ # points << Geom::Point3d.new(0, 0, 0)
102
+ # points << Geom::Point3d.new(100, 0, 0)
103
+ # points << Geom::Point3d.new(100, 200, 0)
104
+ # points << Geom::Point3d.new(0, 200, 0)
105
+ # face = entities.add_face(points)
106
+ # loop = face.outer_loop
107
+ # edgeuses = loop.edgeuses
108
+ # edgeuse = edgeuses[0]
109
+ # next_edgeuse = edgeuse.next
110
+ #
111
+ # @return edgeuse - the next EdgeUse object in a loop
112
+ #
113
+ # @version SketchUp 6.0
114
+ def next
115
+ end
116
+
117
+ # The partners method is used to retrieve all of the partner edge uses that
118
+ # uses the same edge.
119
+ #
120
+ # @example
121
+ # entities = Sketchup.active_model.active_entities
122
+ # points1 = []
123
+ # points1 << Geom::Point3d.new(0, 0, 0)
124
+ # points1 << Geom::Point3d.new(100, 0, 0)
125
+ # points1 << Geom::Point3d.new(100, 200, 0)
126
+ # points1 << Geom::Point3d.new(0, 200, 0)
127
+ # face1 = entities.add_face(points1)
128
+ # points2 = []
129
+ # points2 << Geom::Point3d.new(100, 0, 0)
130
+ # points2 << Geom::Point3d.new(200, 0, 0)
131
+ # points2 << Geom::Point3d.new(200, 200, 0)
132
+ # points2 << Geom::Point3d.new(100, 200, 0)
133
+ # face2 = entities.add_face(points2)
134
+ # loop = face1.outer_loop
135
+ # edgeuses = loop.edgeuses
136
+ # edgeuse = edgeuses[1]
137
+ # partners = edgeuse.partners
138
+ #
139
+ # @return array - an array of partner Edge Use objects.
140
+ #
141
+ # @version SketchUp 6.0
142
+ def partners
143
+ end
144
+
145
+ # The previous method is used to retrieve the previous edge use in a loop.
146
+ #
147
+ # @example
148
+ # entities = Sketchup.active_model.active_entities
149
+ # points = []
150
+ # points << Geom::Point3d.new(0, 0, 0)
151
+ # points << Geom::Point3d.new(100, 0, 0)
152
+ # points << Geom::Point3d.new(100, 200, 0)
153
+ # points << Geom::Point3d.new(0, 200, 0)
154
+ # face = entities.add_face(points)
155
+ # loop = face.outer_loop
156
+ # edgeuses = loop.edgeuses
157
+ # edgeuse = edgeuses[0]
158
+ # previous_edgeuse = edgeuse.previous
159
+ #
160
+ # @return edgeuse - the previous Edge Use object in the loop
161
+ #
162
+ # @version SketchUp 6.0
163
+ def previous
164
+ end
165
+
166
+ # The reversed? method is used to determine if the edge direction is opposite
167
+ # of the edge use direction. The edge use direction is the same as the loop
168
+ # it belongs to.
169
+ #
170
+ # @example
171
+ # entities = Sketchup.active_model.active_entities
172
+ # points = []
173
+ # points << Geom::Point3d.new(0, 0, 0)
174
+ # points << Geom::Point3d.new(100, 0, 0)
175
+ # points << Geom::Point3d.new(100, 200, 0)
176
+ # points << Geom::Point3d.new(0, 200, 0)
177
+ # face = entities.add_face(points)
178
+ # loop = face.outer_loop
179
+ # edgeuses = loop.edgeuses
180
+ # edgeuse = edgeuses[0]
181
+ # reversed = edgeuse.reversed?
182
+ #
183
+ # @return [Boolean] boolean - true if reversed, false if not reversed.
184
+ #
185
+ # @version SketchUp 6.0
186
+ def reversed?
187
+ end
188
+
189
+ # The start_vertex_normal method is used to retrieve the vertex normal for
190
+ # the start point of this edgeuse.
191
+ #
192
+ # @example
193
+ # entities = Sketchup.active_model.active_entities
194
+ # points = []
195
+ # points << Geom::Point3d.new(0, 0, 0)
196
+ # points << Geom::Point3d.new(100, 0, 0)
197
+ # points << Geom::Point3d.new(100, 200, 0)
198
+ # points << Geom::Point3d.new(0, 200, 0)
199
+ # face = entities.add_face(points)
200
+ # loop = face.outer_loop
201
+ # edgeuses = loop.edgeuses
202
+ # edgeuse = edgeuses[0]
203
+ # vector3d = edgeuse.start_vertex_normal
204
+ #
205
+ # @return vector3d - a vector3d object if successful.
206
+ #
207
+ # @version SketchUp 6.0
208
+ def start_vertex_normal
209
+ end
210
+
211
+ end
@@ -1,1097 +1,1119 @@
1
- # Copyright:: Copyright 2019 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # The Entities class is a container class for all entities in a model (it is a
5
- # collection of Entity objects).
6
- #
7
- # @version SketchUp 6.0
8
- class Sketchup::Entities
9
-
10
- # Includes
11
-
12
- include Enumerable
13
-
14
- # Instance Methods
15
-
16
- # The {#[]} method is used to retrieve an entity by its index in an array of
17
- # entities. The index is a number between +0+ and entities.length - 1. In
18
- # general, it is preferable to use the {#each} method to iterate though all
19
- # of the entities in the collection as it will be much more efficient.
20
- #
21
- # @example
22
- # entities = Sketchup.active_model.entities
23
- # entity = entities[0]
24
- #
25
- # @param [Integer] entity_index
26
- # The index for a specific entity.
27
- #
28
- # @return [Sketchup::Entity, nil] an {Sketchup::Entity} object if successful,
29
- # +nil+ if not found
30
- #
31
- # @see #at
32
- #
33
- # @version SketchUp 6.0
34
- def [](entity_index)
35
- end
36
-
37
- # The active_section_plane method is used to access the currently active
38
- # section plane in the Entities object.
39
- #
40
- # @example
41
- # sp = Sketchup.active_model.entities.active_section_plane
42
- # puts "Active section plane is #{sp}" if !sp.nil?
43
- #
44
- # @return [Sketchup::SectionPlane, nil] the active SectionPlane or nil if none is active.
45
- #
46
- # @version SketchUp 2014
47
- def active_section_plane
48
- end
49
-
50
- # The active_section_plane= method is used to set the active section plane in
51
- # the Entities object.
52
- #
53
- # @example
54
- # entities = Sketchup.active_model.entities
55
- # sp = entities.add_section_plane([50, 50, 0], [1.0, 1.0, 0])
56
- # entities.active_section_plane = sp
57
- #
58
- # @param [Sketchup::SectionPlane, nil] sec_plane
59
- # the SectionPlane object to be set active. Pass nil to
60
- # deactivate any active section plane.
61
- #
62
- # @return [Sketchup::SectionPlane, nil] the SectionPlane object that was set active.
63
- #
64
- # @version SketchUp 2014
65
- def active_section_plane=(sec_plane)
66
- end
67
-
68
- # The add_3d_text is used to create 3D text. It will be added as edges and
69
- # faces drawn at the origin.
70
- #
71
- # @example
72
- # # Draw the word "test" at the origin of the model, aligned left, in
73
- # # Arial Bold, not italics, 1" in size, best tolerance quality, filled,
74
- # # with an extrusion size of 5".
75
- # entities = Sketchup.active_model.entities
76
- # success = entities.add_3d_text('test', TextAlignLeft, "Arial",
77
- # true, false, 1.0, 0.0, 0.5, true, 5.0)
78
- #
79
- # @param [String] string
80
- # The text to create.
81
- #
82
- # @param [Integer] alignment
83
- # Number that defines the alignment. There are constants
84
- # called TextAlignLeft, TextAlignRight, and
85
- # TextAlignCenter that can be passed.
86
- #
87
- # @param [String] font
88
- # font name.
89
- #
90
- # @param [Boolean] is_bold
91
- # true for bold.
92
- #
93
- # @param [Boolean] is_italic
94
- # true for italic.
95
- #
96
- # @param [Numeric] letter_height
97
- # Height of the text in inches.
98
- #
99
- # @param [Numeric] tolerance
100
- # Tolerance of the curve creation. Defaults to
101
- # 0.0, which creates the highest possible curve quality.
102
- #
103
- # @param [Numeric] z
104
- # z position in inches.
105
- #
106
- # @param [Boolean] is_filled
107
- # true for filled, which will put a face between the edges of the letters.
108
- #
109
- # @param [Numeric] extrusion
110
- # Extrusion depth in inches.
111
- #
112
- # @return [Boolean] true if successful
113
- #
114
- # @version SketchUp 6.0
115
- 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)
116
- end
117
-
118
- # The add_arc method is used to create an arc curve segment.
119
- #
120
- # @example
121
- # centerpoint = Geom::Point3d.new
122
- # # Create a circle perpendicular to the normal or Z axis
123
- # vector = Geom::Vector3d.new 0,0,1
124
- # vector2 = Geom::Vector3d.new 1,0,0
125
- # vector3 = vector.normalize!
126
- # model = Sketchup.active_model
127
- # entities = model.active_entities
128
- # edges = entities.add_arc centerpoint, vector2, vector3, 10, 15.degrees, 135.degrees
129
- # arccurve = edges.first.curve
130
- #
131
- # @overload add_arc(center, xaxis, normal, radius, start_angle, end_angle)
132
- #
133
- # @param [Geom::Point3d] center A Point3d object representing the center .
134
- # @param [Geom::Vector3d] xaxis A Vector3d object representing xaxis for the arc.
135
- # @param [Geom::Vector3d] normal A Vector3d object representing normal for the arc.
136
- # @param [Numeric] radius The radius of the arc.
137
- # @param [Numeric] start_angle Start angle for the arc, in radians.
138
- # @param [Numeric] end_angle End angle for the arc, in radians.
139
- # @return [Array<Sketchup::Edge>] an array of Edge objects that define the arc.
140
- #
141
- # @overload add_arc(center, xaxis, normal, radius, start_angle, end_angle, num_segments)
142
- #
143
- # @param [Geom::Point3d] center A Point3d object representing the center .
144
- # @param [Geom::Vector3d] xaxis A Vector3d object representing xaxis for the arc.
145
- # @param [Geom::Vector3d] normal A Vector3d object representing normal for the arc.
146
- # @param [Numeric] radius The radius of the arc.
147
- # @param [Numeric] start_angle Start angle for the arc, in radians.
148
- # @param [Numeric] end_angle End angle for the arc, in radians.
149
- # @param [Integer] num_segments How many segments to draw.
150
- # @return [Array<Sketchup::Edge>] an array of Edge objects that define the arc.
151
- #
152
- # @version SketchUp 6.0
153
- def add_arc(*args)
154
- end
155
-
156
- # The add_circle method is used to create a circle.
157
- #
158
- # @example
159
- # centerpoint = Geom::Point3d.new
160
- # # Create a circle perpendicular to the normal or Z axis
161
- # vector = Geom::Vector3d.new 0,0,1
162
- # vector2 = vector.normalize!
163
- # model = Sketchup.active_model
164
- # entities = model.active_entities
165
- # edges = entities.add_circle centerpoint, vector2, 10
166
- #
167
- # @param [Geom::Point3d] center
168
- # A Point3d object representing the center.
169
- #
170
- # @param [Geom::Vector3d] normal
171
- # A Vector3d object representing normal for the arc.
172
- #
173
- # @param [Numeric] radius
174
- # The radius of the arc.
175
- #
176
- # @param [Integer] numsegs
177
- # The number of segments.
178
- #
179
- # @return [Array<Sketchup::Edge>] an Array object containing edges if successful
180
- #
181
- # @version SketchUp 6.0
182
- def add_circle(center, normal, radius, numsegs = 24)
183
- end
184
-
185
- # The {#add_cline} method is used to create a construction line. This can be
186
- # finite or infinite.
187
- #
188
- # @example
189
- # model = Sketchup.active_model
190
- # entities = model.active_entities
191
- # point1 = Geom::Point3d.new(0, 0, 0)
192
- # point2 = Geom::Point3d.new(20, 20, 20)
193
- # cline = entities.add_cline(point1, point2)
194
- #
195
- # @overload add_cline(start_point, end_point, stipple = '-')
196
- #
197
- # Creates a finite construction line.
198
- # @param [Geom::Point3d] start_point
199
- # @param [Geom::Point3d] end_point
200
- # @param [String] stipple See {ConstructionLine#stipple=} for acceptable
201
- # patterns.
202
- #
203
- # @overload add_cline(point, vector, stipple = '-')
204
- #
205
- # Creates an infinite construction line.
206
- # @param [Geom::Point3d] point
207
- # @param [Geom::Point3d] vector
208
- # @param [String] stipple See {ConstructionLine#stipple=} for acceptable
209
- # patterns.
210
- #
211
- # @return [Sketchup::ConstructionLine]
212
- #
213
- # @version SketchUp 6.0
214
- def add_cline(*args)
215
- end
216
-
217
- # The add_cpoint method is used to create a construction point.
218
- #
219
- # @example
220
- # model = Sketchup.active_model
221
- # entities = model.active_entities
222
- # point1 = Geom::Point3d.new(100,200,300)
223
- # constpoint = entities.add_cpoint point1
224
- # if (constpoint)
225
- # UI.messagebox constpoint
226
- # else
227
- # UI.messagebox "Failure"
228
- # end
229
- #
230
- # @param [Geom::Point3d] point
231
- # A Point3d object.
232
- #
233
- # @return [Sketchup::ConstructionPoint] a ConstructionPoint object if
234
- # successful
235
- #
236
- # @version SketchUp 6.0
237
- def add_cpoint(point)
238
- end
239
-
240
- # The add_curve method is used to create a curve from a collection of edges.
241
- #
242
- # The arguments are either Points or an Array of Points. At least 2 points are
243
- # required.
244
- #
245
- # @example
246
- # entities = Sketchup.active_model.entities
247
- # curve = entities.add_curve [0,0,0], [0,10,0], [1,20,0]
248
- #
249
- # @overload add_curve(points)
250
- #
251
- # @param [Array<Geom::Point3d>] points
252
- #
253
- # @overload add_curve(*points)
254
- #
255
- # @param [Array<Geom::Point3d>] points
256
- #
257
- # @return [Array<Sketchup::Edge>]
258
- #
259
- # @version SketchUp 6.0
260
- def add_curve(*args)
261
- end
262
-
263
- # The {#add_dimension_linear} method adds a linear dimension to the entities.
264
- #
265
- # @example
266
- # entities = Sketchup.active_model.entities
267
- # # From point to point
268
- # dim = entities.add_dimension_linear [50, 10, 0], [100, 10, 0], [0, 20, 0]
269
- # # Between edge vertices
270
- # edge = entities.add_edges([50,50,0], [40,10,0])[0]
271
- # v0 = edge.start
272
- # v1 = edge.end
273
- # dim = entities.add_dimension_linear v0, v1, [0, 0, 20]
274
- # # From an edge's midpoint to a construction point
275
- # p0 = edge.start.position
276
- # p1 = edge.end.position
277
- # mp = Geom::Point3d.new((p0.x+p1.x)/2.0, (p0.y+p1.y)/2.0, (p0.z+p1.z)/2.0)
278
- # cp = entities.add_cpoint [50, 10, 0]
279
- # dim = entities.add_dimension_linear [edge, mp], cp, [20, 0, 0]
280
- # # alternatively, the start params could be passed in separately
281
- # dim = entities.add_dimension_linear edge, mp, cp, [20, 0, 0]
282
- #
283
- # @example Instance path
284
- # instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
285
- # edge = instance.definition.entities.grep(Sketchup::Edge).first
286
- # instance_path = Sketchup::InstancePath.new([instance, edge])
287
- # start_point = edge.start.position
288
- # end_point = edge.end.position
289
- # vector = Geom::Vector3d.new(30, 30, 0)
290
- # Sketchup.active_model.entities.add_dimension_linear([instance_path, start_point], [instance_path, end_point], vector)
291
- #
292
- # @example Instance path as an array
293
- # instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
294
- # edge = instance.definition.entities.grep(Sketchup::Edge).first
295
- # path = [instance, edge]
296
- # start_point = edge.start.position
297
- # end_point = edge.end.position
298
- # vector = Geom::Vector3d.new(30, 30, 0)
299
- # Sketchup.active_model.entities.add_dimension_linear([path, start_point], [path, end_point], vector)
300
- #
301
- # @overload add_dimension_linear(start_pt_or_entity, end_pt_or_entity, offset_vector)
302
- #
303
- # @param [Geom::Point3d, Sketchup::Entity] start_pt_or_entity
304
- # the reference point and/or entity at the start of
305
- # the dimension. This parameter can take several
306
- # forms:
307
- # @param [Geom::Point3d, Sketchup::Entity] end_pt_or_entity
308
- # the reference point and/or entity at the end
309
- # of the dimension. This parameter takes the exact
310
- # same forms as 'start_pt_or_entity'.
311
- # @param [Geom::Vector3d] offset_vector
312
- # the parallel offset vector from the reference line
313
- # to the dimension line measured from the 'start'
314
- # reference point.
315
- #
316
- # @overload add_dimension_linear(start_instance_path, end_instance_path, offset_vector)
317
- #
318
- # @note Added in SketchUp 2019.
319
- # @param [Array<Sketchup::InstancePath, Geom::Point3d>] start_instance_path An array
320
- # containing a {Sketchup::InstancePath} and a {Geom::Point3d}.
321
- # @param [Array<Sketchup::InstancePath, Geom::Point3d>] end_instance_path An array
322
- # containing a {Sketchup::InstancePath} and a {Geom::Point3d}.
323
- # @param [Geom::Vector3d] offset_vector The parallel offset vector from the
324
- # reference line to the dimension line measured from the start reference
325
- # point.
326
- #
327
- # @overload add_dimension_linear(start_array, end_array, offset_vector)
328
- #
329
- # @note Added in SketchUp 2019.
330
- # @param [Array(Array<Entity>, Geom::Point3d)] start_array
331
- # The {Array<Entity>} must contain one or more {Sketchup::ComponentInstance}'s
332
- # and a leaf entity. The leaf entity can be a {Sketchup::Vertex},
333
- # {Sketchup::ConstructionPoint}, {Sketchup::ConstructionLine}, or
334
- # {Sketchup::Edge}. The {Geom::Point3d} is the point associated with the leaf entity.
335
- # @param [Array(Array<Entity>, Geom::Point3d)] end_array
336
- # The {Array<Entity>} must contain one or more {Sketchup::ComponentInstance}'s
337
- # and a leaf entity. The leaf entity can be a {Sketchup::Vertex},
338
- # {Sketchup::ConstructionPoint}, {Sketchup::ConstructionLine}, or
339
- # {Sketchup::Edge}. The {Geom::Point3d} is the point associated with the leaf entity.
340
- # @param [Geom::Vector3d] offset_vector The parallel offset vector from the
341
- # reference line to the dimension line measured form the start reference
342
- # point.
343
- #
344
- # @return [Sketchup::DimensionLinear] the created dimension
345
- #
346
- # @version SketchUp 2014
347
- def add_dimension_linear(*args)
348
- end
349
-
350
- # The add_dimension_radial method adds a radial dimension (i.e arc/circle
351
- # radius/diameter dimension) to the entities.
352
- #
353
- # @example
354
- # entities = Sketchup.active_model.entities
355
- # # Create a circle
356
- # centerpoint = Geom::Point3d.new(10, 10, 0)
357
- # vector = Geom::Vector3d.new(0, 0, 1)
358
- # edges = entities.add_circle centerpoint, vector, 10
359
- # circle = edges[0].curve
360
- # dim = entities.add_dimension_radial circle, [30, 30, 0]
361
- #
362
- # @param [Sketchup::ArcCurve] arc_curve
363
- # an ArcCurve object to which the dimension is to be
364
- # attached.
365
- #
366
- # @param [Geom::Point3d] leader_break_pt
367
- # a Point3d for the break point on the leader where the
368
- # dimension text is attached.
369
- #
370
- # @return [Sketchup::DimensionRadial] the created dimension
371
- #
372
- # @version SketchUp 2014
373
- def add_dimension_radial(arc_curve, leader_break_pt)
374
- end
375
-
376
- # The {#add_edges} method is used to add a set of connected edges to the
377
- # {Sketchup::Entities} collection.
378
- #
379
- # @example
380
- # model = Sketchup.active_model
381
- # entities = model.active_entities
382
- # point1 = Geom::Point3d.new(0,0,0)
383
- # point2 = Geom::Point3d.new(20,20,20)
384
- # edges = entities.add_edges point1, point2
385
- #
386
- # @note If the points form a closed loop, the first and last vertex will not
387
- # merge. If you intend to create a face from the edges, use {#add_face}
388
- # directly.
389
- #
390
- # @overload add_edges(points)
391
- #
392
- # @param [Array<Geom::Point3d>] points At least two points required.
393
- # @return [Array<Sketchup::Edge>]
394
- #
395
- # @overload add_edges(*points)
396
- #
397
- # @param [Array<Geom::Point3d>] points At least two points required.
398
- # @return [Array<Sketchup::Edge>]
399
- #
400
- # @return [Array<Sketchup::Edge>] an array of Edge objects if successful
401
- #
402
- # @version SketchUp 6.0
403
- def add_edges(*args)
404
- end
405
-
406
- # The add_face method is used to create a face. You can call this method a
407
- # number of ways:
408
- #
409
- # - entities.add_face(edge1, edge2, edge3, ...)
410
- # - entities.add_face(edgearray)
411
- # - entities.add_face(pt1, pt2, pt3, ...)
412
- # - entities.add_face([pt1, pt2, pt3,...])
413
- # - entities.add_face(curve)
414
- #
415
- # For the last form that takes a Curve, the curve must be closed - like a
416
- # circle.
417
- #
418
- # Note that a special case exists for any face created on the ground plane, in
419
- # which case the vertex order is ignored and the face is always facing down.
420
- #
421
- # @example
422
- # depth = 100
423
- # width = 100
424
- # model = Sketchup.active_model
425
- # entities = model.active_entities
426
- # pts = []
427
- # pts[0] = [0, 0, 0]
428
- # pts[1] = [width, 0, 0]
429
- # pts[2] = [width, depth, 0]
430
- # pts[3] = [0, depth, 0]
431
- # # Add the face to the entities in the model
432
- # face = entities.add_face(pts)
433
- #
434
- # @overload add_face(entities)
435
- #
436
- # @param [Array<Sketchup::Edge>, Array<Geom::Point3d>, Sketchup::Curve] entities
437
- #
438
- # @overload add_face(*entities)
439
- #
440
- # @param [Array<Sketchup::Edge>, Array<Geom::Point3d>] entities
441
- #
442
- # @return [Sketchup::Face, nil]
443
- #
444
- # @version SketchUp 6.0
445
- def add_face(*args)
446
- end
447
-
448
- # The {#add_faces_from_mesh} method is used to add Face objects to the
449
- # collection of entities from a PolygonMesh.
450
- #
451
- # The +smooth_flags+ parameter can contain any of the following values if
452
- # passed. The constants were added in SketchUp 2014. For previous versions,
453
- # numeric values have to be specified instead of the Ruby constants.
454
- #
455
- # - 0: {Geom::PolygonMesh::NO_SMOOTH_OR_HIDE}
456
- # - 1: {Geom::PolygonMesh::HIDE_BASED_ON_INDEX} (Negative point index will hide the edge.)
457
- # - 2: {Geom::PolygonMesh::SOFTEN_BASED_ON_INDEX} (Negative point index will soften the edge.)
458
- # - 4: {Geom::PolygonMesh::AUTO_SOFTEN} (Interior edges are softened.)
459
- # - 8: {Geom::PolygonMesh::SMOOTH_SOFT_EDGES} (All soft edges will also be smooth.)
460
- #
461
- # The 3rd and 4th parameters will accept a {sketchup::Material} object or a
462
- # string name of a material currently in the model.
463
- #
464
- # @example
465
- # pm = Geom::PolygonMesh.new
466
- # pm.add_point([ 0, 0, 0]) # 1
467
- # pm.add_point([10, 0, 0]) # 2
468
- # pm.add_point([10,10, 0]) # 3
469
- # pm.add_point([ 0,10, 0]) # 4
470
- # pm.add_point([20, 0, 5]) # 5
471
- # pm.add_point([20,10, 5]) # 6
472
- # pm.add_polygon(1, -2, 3, 4)
473
- # pm.add_polygon(2, 5,6, -3)
474
- #
475
- # # Create a new group that we will populate with the mesh.
476
- # group = Sketchup.active_model.entities.add_group
477
- # material = Sketchup.active_model.materials.add('green')
478
- # smooth_flags = Geom::PolygonMesh::NO_SMOOTH_OR_HIDE
479
- # group.entities.add_faces_from_mesh(pm, smooth_flags, material)
480
- #
481
- # @param [Geom::PolygonMesh] polygon_mesh
482
- #
483
- # @param [Integer] smooth_flags
484
- # flags for softening and smoothing of edges.
485
- #
486
- # @param [Sketchup::Material, String] f_material
487
- # material to paint front faces with.
488
- #
489
- # @param [Sketchup::Material, String] b_material
490
- # material to paint back faces with.
491
- #
492
- # @return [Integer] Number of faces created
493
- #
494
- # @version SketchUp 6.0
495
- def add_faces_from_mesh(polygon_mesh, smooth_flags = Geom::PolygonMesh::AUTO_SOFTEN|Geom::PolygonMesh::SMOOTH_SOFT_EDGES, f_material = nil, b_material = nil)
496
- end
497
-
498
- # The add_group method is used to create an empty group or a group with
499
- # entities.
500
- #
501
- # @example
502
- # model = Sketchup.active_model
503
- # entities = model.active_entities
504
- # group = entities.add_group
505
- #
506
- # @note Calling add_group with entities in its parameters has been known to
507
- # crash SketchUp before version 8.0. It is preferable to create an empty
508
- # group and then add things to its Entities collection.
509
- #
510
- # @overload add_group(entities)
511
- #
512
- # @param [Array<Sketchup::Entity>] entities
513
- # an entities collection to add to the group.
514
- #
515
- # @overload add_group(*entities)
516
- #
517
- # @param [Array<Sketchup::Entity>] entities
518
- # an entities collection to add to the group.
519
- #
520
- # @return [Sketchup::Group]
521
- #
522
- # @version SketchUp 6.0
523
- def add_group(*args)
524
- end
525
-
526
- # The add_image method is used to add an image to the collection of entities.
527
- #
528
- # The width and height are measured in model units (i.e. inches). If the
529
- # height is not given, then it is computed from the width to preserve the
530
- # aspect ratio of the image.
531
- #
532
- # @example
533
- # model = Sketchup.active_model
534
- # entities = model.active_entities
535
- # point = Geom::Point3d.new 10,20,30
536
- # image = entities.add_image "Shapes.jpg", point, 300
537
- # if (image)
538
- # UI.messagebox image
539
- # else
540
- # UI.messagebox "Failure"
541
- # end
542
- #
543
- # @param [String] filename
544
- # A filename for the image file.
545
- #
546
- # @param [Geom::Point3d] point
547
- # A Point3d object representing the insertion point of
548
- # the image.
549
- #
550
- # @param [Numeric] width
551
- # Width for the image.
552
- #
553
- # @param [Numeric] height
554
- # height for the image if you want to control
555
- # width and height independently. Leave as default +0.0+ when you want it
556
- # to be relative to the aspect ratio.
557
- #
558
- # @return [Sketchup::Image, nil] an Image object if successful.
559
- #
560
- # @version SketchUp 6.0
561
- def add_image(filename, point, width, height = 0.0)
562
- end
563
-
564
- # The add_instance method adds a component instance to the collection of
565
- # entities.
566
- #
567
- # @example
568
- # point = Geom::Point3d.new 10,20,30
569
- # transform = Geom::Transformation.new point
570
- # model = Sketchup.active_model
571
- # entities = model.active_entities
572
- # path = Sketchup.find_support_file "Bed.skp",
573
- # "Components/Components Sampler/"
574
- # definitions = model.definitions
575
- # componentdefinition = definitions.load path
576
- # instance = entities.add_instance componentdefinition, transform
577
- # if (instance)
578
- # UI.messagebox instance
579
- # else
580
- # UI.messagebox "Failure"
581
- # end
582
- #
583
- # @param [Sketchup::ComponentDefinition] definition
584
- # A ComponentDefinition object.
585
- #
586
- # @param [Geom::Transformation] transform
587
- # A Transformation object.
588
- #
589
- # @return [Sketchup::ComponentInstance] a ComponentInstance object if successful
590
- #
591
- # @version SketchUp 6.0
592
- def add_instance(definition, transform)
593
- end
594
-
595
- # The add_line method is used to add an edge to the collection of entities.
596
- # This is not to be confused with the concept of a "line" from a geometric
597
- # sense, which is an invisible object represented by an Array of a point
598
- # and a vector. (See the Array class for more information on geometric lines in
599
- # SketchUp.)
600
- #
601
- # This method is the same as add_edges method, but returns a single edge.
602
- #
603
- # @example
604
- # model = Sketchup.active_model
605
- # entities = model.active_entities
606
- # point1 = Geom::Point3d.new(0,0,0)
607
- # point2 = Geom::Point3d.new(20,20,20)
608
- # line = entities.add_line point1,point2
609
- # if (line)
610
- # UI.messagebox line
611
- # else
612
- # UI.messagebox "Failure"
613
- # end
614
- #
615
- # @param [Geom::Point3d] point1
616
- # Point3d object representing the edge's starting point.
617
- #
618
- # @param [Geom::Point3d] point2
619
- # Point3d object representing the edge's ending point.
620
- #
621
- # @return [Sketchup::Edge] a Edge object if successful
622
- #
623
- # @version SketchUp 6.0
624
- def add_line(point1, point2)
625
- end
626
-
627
- # The add_ngon method is used to create a multi-sided polygon.
628
- #
629
- # @example
630
- # entities = Sketchup.active_model.entities
631
- # center = Geom::Point3d.new
632
- # normal = Geom::Vector3d.new(0,0,1)
633
- # radius = 100
634
- # numsides = 6
635
- # edges = entities.add_ngon center, normal, radius, numsides
636
- #
637
- # @param [Geom::Point3d] center
638
- # A Point3d object representing the center of the polygon.
639
- #
640
- # @param [Geom::Vector3d] normal
641
- # A Vector3d object.
642
- #
643
- # @param [Numeric] radius
644
- # A radius.
645
- #
646
- # @param [Integer] numsides
647
- # The number of sides for the polygon.
648
- #
649
- # @return [Array<Sketchup::Edge>] an array of Edges that make up the polygon if
650
- # successful
651
- #
652
- # @version SketchUp 6.0
653
- def add_ngon(center, normal, radius, numsides = 24)
654
- end
655
-
656
- # The add_observer method is used to add an observer to the current object.
657
- #
658
- # @example
659
- # entities = Sketchup.active_model.entities
660
- # status = entities.add_observer observer
661
- #
662
- # @param [Object] observer
663
- # An observer.
664
- #
665
- # @return [Boolean] true if successful, false if unsuccessful.
666
- #
667
- # @version SketchUp 6.0
668
- def add_observer(observer)
669
- end
670
-
671
- # The add_section_plane method adds a section plane object to the entities.
672
- #
673
- # @example
674
- # # Create a section plane
675
- # model = Sketchup.active_model
676
- # sp = model.entities.add_section_plane([50, 50, 0], [1.0, 1.0, 0])
677
- # # Activate it
678
- # sp.activate
679
- # # Make sure section planes are visible
680
- # model.rendering_options['DisplaySectionPlanes'] = true
681
- #
682
- # @param plane
683
- # the geometric plane where the SectionPlane object is to
684
- # be created. Refer to the Geom module for information on
685
- # how planes are represented.
686
- #
687
- # @return [Sketchup::SectionPlane, nil] the created SectionPlane object if
688
- # successful, nil on failure.
689
- #
690
- # @version SketchUp 2014
691
- def add_section_plane(plane)
692
- end
693
-
694
- # The {#add_text} method adds a note or label text entity to the entities.
695
- #
696
- # @example
697
- # coordinates = [10, 10, 10]
698
- # model = Sketchup.active_model
699
- # entities = model.entities
700
- # point = Geom::Point3d.new coordinates
701
- # text = entities.add_text "This is a Test", point
702
- #
703
- # @example Instance path
704
- # instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
705
- # edge = instance.definition.entities.grep(Sketchup::Edge).first
706
- # instance_path = Sketchup::InstancePath.new([instance, edge])
707
- # point = edge.start.position
708
- # vector = Geom::Vector3d.new(30, 30, 0)
709
- # Sketchup.active_model.entities.add_text("mytext", [instance_path, point], vector)
710
- #
711
- # @example Instance path as an array
712
- # instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
713
- # edge = instance.definition.entities.grep(Sketchup::Edge).first
714
- # path = [instance, edge]
715
- # point = edge.start.position
716
- # vector = Geom::Vector3d.new(30, 30, 0)
717
- # Sketchup.active_model.entities.add_text("mytext", [path, point], vector)
718
- #
719
- # @overload add_text(text, point, vector)
720
- #
721
- # @bug SketchUp 2019.0 had a regression bug where an error was thrown if
722
- # +point+ was provided as a {Sketchup::Vertex} or {Sketchup::InputPoint}.
723
- # This was fixed in SketchUp 2019.1.
724
- # @param [String] text The text string to add.
725
- # @param [Geom::Point3d, Sketchup::Vertex, Sketchup::InputPoint] point
726
- # A Point3d object representing the insertion point.
727
- # @param [Geom::Vector3d] vector The Vector representing an arrow leader.
728
- #
729
- # @overload add_text(text, instance_path_and_pt, vector)
730
- #
731
- # @version SketchUp 2019
732
- # @param [String] text The text to add.
733
- # @param [Array<Sketchup::InstancePath, Geom::Point3d>] instance_path_and_pt
734
- # The array containing a {Sketchup::InstancePath} and a {Geom::Point3d}.
735
- # @param [Geom::Vector3d] vector The vector representing an arrow leader.
736
- #
737
- # @overload add_text(text, instance_array_and_pt, vector)
738
- #
739
- # @version SketchUp 2019
740
- # @param [String] text The text to add.
741
- # @param [Array(Array<Sketchup::Entity>, Geom::Point3d)] instance_array_with_pt
742
- # The array containing one or more {Sketchup::ComponentInstance}'s and a
743
- # leaf entity. The leaf entity can be a {Sketchup::Vertex},
744
- # {Sketchup::ConstructionPoint}, {Sketchup::ConstructionLine}, or
745
- # {Sketchup::Edge}. The {Geom::Point3d} is the point associated with the
746
- # leaf entity.
747
- # @param [Geom::Vector3d] vector The vector representing an arrow leader.
748
- #
749
- # @return [Sketchup::Text] a Text object if successful
750
- #
751
- # @version SketchUp 6.0
752
- def add_text(*args)
753
- end
754
-
755
- # The {#at} method is an alias for {#[]}.
756
- #
757
- # @example
758
- # entities = Sketchup.active_model.entities
759
- # entity = entities.at(0)
760
- #
761
- # @param [Integer] entity_index
762
- # The index for a specific entity.
763
- #
764
- # @return [Sketchup::Entity, nil]
765
- #
766
- # @see #[]
767
- #
768
- # @version SketchUp 6.0
769
- def at(entity_index)
770
- end
771
-
772
- # The clear! method is used to remove all entities from the collection of
773
- # entities.
774
- #
775
- # @example
776
- # coordinates = [10, 10, 10]
777
- # model = Sketchup.active_model
778
- # entities = model.entities
779
- # point = Geom::Point3d.new coordinates
780
- # text = entities.add_text "This is a Test", point
781
- # UI.messagebox "Clearing All"
782
- # status = entities.clear!
783
- #
784
- # @return [Boolean] true if successful, false if unsuccessful
785
- #
786
- # @version SketchUp 6.0
787
- def clear!
788
- end
789
-
790
- #
791
- # @example
792
- # model = Sketchup.active_model
793
- # entities = model.entities
794
- # entities.add_cpoint([10, 10, 10])
795
- # number = entities.count
796
- #
797
- # @note Since SketchUp 2014 the count method is inherited from Ruby's
798
- # +Enumable+ mix-in module. Prior to that the {#count} method is an alias
799
- # for {#length}.
800
- #
801
- # @return [Integer]
802
- #
803
- # @see #length
804
- #
805
- # @version SketchUp 6.0
806
- def count
807
- end
808
-
809
- # The each method is used to iterate through the entities in the collection of
810
- # entities.
811
- #
812
- # @example
813
- # coordinates = [10, 10, 10]
814
- # model = Sketchup.active_model
815
- # entities = model.entities
816
- # point = Geom::Point3d.new coordinates
817
- # text = entities.add_text "This is a Test", point
818
- # entities.each { | entity| UI.messagebox entity }
819
- #
820
- # @return [nil]
821
- #
822
- # @version SketchUp 6.0
823
- #
824
- # @yieldparam [Sketchup::Entity] entity
825
- def each
826
- end
827
-
828
- # The erase_entities method is used to erase one or more entities from the
829
- # model.
830
- #
831
- # @example
832
- # depth = 100
833
- # width = 100
834
- # model = Sketchup.active_model
835
- # entities = model.active_entities
836
- # pts = []
837
- # pts[0] = [0, 0, 0]
838
- # pts[1] = [width, 0, 0]
839
- # pts[2] = [width, depth, 0]
840
- # pts[3] = [0, depth, 0]
841
- #
842
- # # Add the face to the entities in the model
843
- # face = entities.add_face pts
844
- #
845
- # # I just happen to know that the second entity in the
846
- # # entities objects is an edge, so erase it.
847
- # UI.messagebox entities
848
- # entities.erase_entities entities[1]
849
- # UI.messagebox entities
850
- #
851
- # @overload erase_entities(entities)
852
- #
853
- # @param [Array<Sketchup::Entity>] entities
854
- #
855
- # @overload erase_entities(*entities)
856
- #
857
- # @param [Array<Sketchup::Entity>] entities
858
- #
859
- # @return [nil]
860
- #
861
- # @version SketchUp 6.0
862
- def erase_entities(*args)
863
- end
864
-
865
- # The {#fill_from_mesh} method is used to add faces and edges to the collection
866
- # of entities from a {Geom::PolygonMesh}. It requires that the entities
867
- # collection to be filled is empty. It has higher performance than
868
- # {#add_faces_from_mesh}, but does less error checking as it builds the
869
- # geometry.
870
- #
871
- # The +smooth_flags+ parameter can contain any of the following values if
872
- # passed. The constants were added in SketchUp 2014. For previous versions,
873
- # numeric values have to be specified instead of the Ruby constants:
874
- #
875
- # - 0: {Geom::PolygonMesh::NO_SMOOTH_OR_HIDE}
876
- # - 1: {Geom::PolygonMesh::HIDE_BASED_ON_INDEX} (Negative point index will hide the edge.)
877
- # - 2: {Geom::PolygonMesh::SOFTEN_BASED_ON_INDEX} (Negative point index will soften the edge.)
878
- # - 4: {Geom::PolygonMesh::AUTO_SOFTEN} (Interior edges are softened.)
879
- # - 8: {Geom::PolygonMesh::SMOOTH_SOFT_EDGES} (All soft edges will also be smooth.)
880
- #
881
- # The 4rd and 5th parameters will accept a {Sketchup::Material} object or a
882
- # string name of a material currently in the model.
883
- #
884
- # @example
885
- # pm = Geom::PolygonMesh.new
886
- # pm.add_point([ 0, 0, 0]) # 1
887
- # pm.add_point([10, 0, 0]) # 2
888
- # pm.add_point([10,10, 0]) # 3
889
- # pm.add_point([ 0,10, 0]) # 4
890
- # pm.add_point([20, 0, 5]) # 5
891
- # pm.add_point([20,10, 5]) # 6
892
- # pm.add_polygon(1, -2, 3, 4)
893
- # pm.add_polygon(2, 5, 6, -3)
894
- #
895
- # # Create a new group that we will populate with the mesh.
896
- # group = Sketchup.active_model.entities.add_group
897
- # material = Sketchup.active_model.materials.add('red')
898
- # smooth_flags = Geom::PolygonMesh::HIDE_BASED_ON_INDEX
899
- # group.entities.fill_from_mesh(pm, true, smooth_flags, material)
900
- #
901
- # @param [Geom::PolygonMesh] polygon_mesh
902
- #
903
- # @param [Boolean] weld_vertices
904
- # This argument has no effect and is kept for
905
- # compatibility reasons. Points are always
906
- # merged.
907
- #
908
- # @param [Integer] smooth_flags
909
- # flags for softening and smoothing of edges.
910
- #
911
- # @param [Sketchup::Material, String] f_material
912
- # material to paint front faces with.
913
- #
914
- # @param [Sketchup::Material, String] b_material
915
- # material to paint back faces with.
916
- #
917
- # @return [Boolean]
918
- #
919
- # @version SketchUp 6.0
920
- 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)
921
- end
922
-
923
- # The intersect_with method is used to intersect an entities, component
924
- # instance, or group object with a entities object.
925
- #
926
- # @example
927
- # entities.intersect_with recurse, transformation1, entities1,
928
- # transformation2, hidden, entities2
929
- #
930
- # @param [Boolean] recurse
931
- # true if you want this entities object to be recursed
932
- # (intersection lines will be put inside of groups and
933
- # components within this entities object).
934
- #
935
- # @param [Geom::Transformation] transform1
936
- # The transformation for this entities object.
937
- #
938
- # @param [Sketchup::Entities] entities1
939
- # The entities object where you want the intersection
940
- # lines to appear.
941
- #
942
- # @param [Geom::Transformation] transform2
943
- # The transformation for entities1.
944
- #
945
- # @param [Boolean] hidden
946
- # true if you want hidden geometry in this entities
947
- # object to be used in the intersection.
948
- #
949
- # @param [Sketchup::Entity, Array<Sketchup::Entity>] entities2
950
- # A single entity, or an array of entities.
951
- #
952
- # @return [nil]
953
- #
954
- # @version SketchUp 6.0
955
- def intersect_with(recurse, transform1, entities1, transform2, hidden, entities2)
956
- end
957
-
958
- # The {#length} method is used to retrieve the number of entities in the
959
- # collection of entities.
960
- #
961
- # @example
962
- # model = Sketchup.active_model
963
- # entities = model.entities
964
- # entities.add_cpoint([10, 10, 10])
965
- # number = entities.length
966
- #
967
- # @return [Integer]
968
- #
969
- # @see #size
970
- #
971
- # @version SketchUp 6.0
972
- def length
973
- end
974
-
975
- # The model method is used to retrieve the model that contains the collection
976
- # of entities.
977
- #
978
- # @example
979
- # coordinates = [10, 10, 10]
980
- # model = Sketchup.active_model
981
- # entities = model.entities
982
- # point = Geom::Point3d.new coordinates
983
- # text = entities.add_text "This is a Test", point
984
- # model = entities.model
985
- #
986
- # @return [Sketchup::Model] the model that contains the collection of
987
- # entities if successful.
988
- #
989
- # @version SketchUp 6.0
990
- def model
991
- end
992
-
993
- # The parent method is used to retrieve the parent or object that contains the
994
- # collection of entities. A parent can be either a Model or
995
- # ComponentDefinition object.
996
- #
997
- # @example
998
- # coordinates = [10, 10, 10]
999
- # model = Sketchup.active_model
1000
- # entities = model.entities
1001
- # point = Geom::Point3d.new coordinates
1002
- # text = entities.add_text "This is a Test", point
1003
- # parent = entities.parent
1004
- #
1005
- # @return [Sketchup::ComponentDefinition, Sketchup::Model] the object that
1006
- # contains the collection of entities if successful
1007
- #
1008
- # @version SketchUp 6.0
1009
- def parent
1010
- end
1011
-
1012
- # The remove_observer method is used to remove an observer from the current
1013
- # object.
1014
- #
1015
- # @example
1016
- # entities = Sketchup.active_model.entities
1017
- # status = entities.remove_observer observer
1018
- #
1019
- # @param [Object] observer
1020
- # An observer.
1021
- #
1022
- # @return [Boolean] true if successful, false if unsuccessful.
1023
- #
1024
- # @version SketchUp 6.0
1025
- def remove_observer(observer)
1026
- end
1027
-
1028
- # The {#size} method is an alias for the {#length} method.
1029
- #
1030
- # @example
1031
- # model = Sketchup.active_model
1032
- # entities = model.entities
1033
- # entities.add_cpoint([10, 10, 10])
1034
- # number = entities.size
1035
- #
1036
- # @return [Integer]
1037
- #
1038
- # @see #length
1039
- #
1040
- # @version SketchUp 2014
1041
- def size
1042
- end
1043
-
1044
- # The transform_by_vectors method is used to apply several vectors to several
1045
- # sub-entities all at once.
1046
- #
1047
- # @example
1048
- # # Need better Ruby example.
1049
- # entities = entities.transform_by_vectors sub_entities, vector_array
1050
- #
1051
- # @param [Array<Sketchup::Entity>] sub_entities
1052
- # An array of entities to transform.
1053
- #
1054
- # @param [Array<Geom::Vector3d>] vectors
1055
- # An array of vectors to apply.
1056
- #
1057
- # @return [Sketchup::Entities]
1058
- #
1059
- # @version SketchUp 6.0
1060
- def transform_by_vectors(sub_entities, vectors)
1061
- end
1062
-
1063
- # The transform_entities method is used to apply a transform to several
1064
- # sub-entities all at once.
1065
- #
1066
- # Important note: If you apply a transformation to entities that are
1067
- # not in the current edit context (i.e. faces that are inside a group),
1068
- # SketchUp will apply the transformation incorrectly, since the geometry
1069
- # has one origin and the current edit context has another. You can correct
1070
- # for this by watching the Model.edit_transform and Model.active_path. See
1071
- # ModelObserver.onActivePathChanged for more information.
1072
- #
1073
- # @example
1074
- # entities = Sketchup.active_model.entities
1075
- # entities.add_line([0,0,0],[100,100,100])
1076
- # entities.add_line([0,0,0],[200,-10,-10])
1077
- #
1078
- # entities_to_transform = []
1079
- # entities_to_transform.push(entities[0])
1080
- # entities_to_transform.push(entities[1])
1081
- #
1082
- # transform = Geom::Transformation.new([100,0,0])
1083
- # entities.transform_entities(transform, ent1, ent2, ent3)
1084
- #
1085
- # @param [Geom::Transformation] transform
1086
- # The Transformation to apply.
1087
- #
1088
- # @param [Array<Sketchup::Entity>] entities
1089
- # An array or series of entities to transform.
1090
- #
1091
- # @return [Boolean] results of the transform.
1092
- #
1093
- # @version SketchUp 6.0
1094
- def transform_entities(transform, entities)
1095
- end
1096
-
1097
- end
1
+ # Copyright:: Copyright 2020 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # The Entities class is a container class for all entities in a model (it is a
5
+ # collection of Entity objects).
6
+ #
7
+ # @version SketchUp 6.0
8
+ class Sketchup::Entities
9
+
10
+ # Includes
11
+
12
+ include Enumerable
13
+
14
+ # Instance Methods
15
+
16
+ # The {#[]} method is used to retrieve an entity by its index in an array of
17
+ # entities. The index is a number between +0+ and entities.length - 1. In
18
+ # general, it is preferable to use the {#each} method to iterate though all
19
+ # of the entities in the collection as it will be much more efficient.
20
+ #
21
+ # @example
22
+ # entities = Sketchup.active_model.entities
23
+ # entity = entities[0]
24
+ #
25
+ # @param [Integer] entity_index
26
+ # The index for a specific entity.
27
+ #
28
+ # @return [Sketchup::Entity, nil] an {Sketchup::Entity} object if successful,
29
+ # +nil+ if not found
30
+ #
31
+ # @see #at
32
+ #
33
+ # @version SketchUp 6.0
34
+ def [](entity_index)
35
+ end
36
+
37
+ # The active_section_plane method is used to access the currently active
38
+ # section plane in the Entities object.
39
+ #
40
+ # @example
41
+ # sp = Sketchup.active_model.entities.active_section_plane
42
+ # puts "Active section plane is #{sp}" if !sp.nil?
43
+ #
44
+ # @return [Sketchup::SectionPlane, nil] the active SectionPlane or nil if none is active.
45
+ #
46
+ # @version SketchUp 2014
47
+ def active_section_plane
48
+ end
49
+
50
+ # The active_section_plane= method is used to set the active section plane in
51
+ # the Entities object.
52
+ #
53
+ # @example
54
+ # entities = Sketchup.active_model.entities
55
+ # sp = entities.add_section_plane([50, 50, 0], [1.0, 1.0, 0])
56
+ # entities.active_section_plane = sp
57
+ #
58
+ # @param [Sketchup::SectionPlane, nil] sec_plane
59
+ # the SectionPlane object to be set active. Pass nil to
60
+ # deactivate any active section plane.
61
+ #
62
+ # @return [Sketchup::SectionPlane, nil] the SectionPlane object that was set active.
63
+ #
64
+ # @version SketchUp 2014
65
+ def active_section_plane=(sec_plane)
66
+ end
67
+
68
+ # The add_3d_text is used to create 3D text. It will be added as edges and
69
+ # faces drawn at the origin.
70
+ #
71
+ # @example
72
+ # # Draw the word "test" at the origin of the model, aligned left, in
73
+ # # Arial Bold, not italics, 1" in size, best tolerance quality, filled,
74
+ # # with an extrusion size of 5".
75
+ # entities = Sketchup.active_model.entities
76
+ # success = entities.add_3d_text('test', TextAlignLeft, "Arial",
77
+ # true, false, 1.0, 0.0, 0.5, true, 5.0)
78
+ #
79
+ # @param [String] string
80
+ # The text to create.
81
+ #
82
+ # @param [Integer] alignment
83
+ # Number that defines the alignment. There are constants
84
+ # called TextAlignLeft, TextAlignRight, and
85
+ # TextAlignCenter that can be passed.
86
+ #
87
+ # @param [String] font
88
+ # font name.
89
+ #
90
+ # @param [Boolean] is_bold
91
+ # true for bold.
92
+ #
93
+ # @param [Boolean] is_italic
94
+ # true for italic.
95
+ #
96
+ # @param [Numeric] letter_height
97
+ # Height of the text in inches.
98
+ #
99
+ # @param [Numeric] tolerance
100
+ # Tolerance of the curve creation. Defaults to
101
+ # 0.0, which creates the highest possible curve quality.
102
+ #
103
+ # @param [Numeric] z
104
+ # z position in inches.
105
+ #
106
+ # @param [Boolean] is_filled
107
+ # true for filled, which will put a face between the edges of the letters.
108
+ #
109
+ # @param [Numeric] extrusion
110
+ # Extrusion depth in inches.
111
+ #
112
+ # @return [Boolean] true if successful
113
+ #
114
+ # @version SketchUp 6.0
115
+ 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)
116
+ end
117
+
118
+ # The add_arc method is used to create an arc curve segment.
119
+ #
120
+ # @example
121
+ # centerpoint = Geom::Point3d.new
122
+ # # Create a circle perpendicular to the normal or Z axis
123
+ # vector = Geom::Vector3d.new 0,0,1
124
+ # vector2 = Geom::Vector3d.new 1,0,0
125
+ # vector3 = vector.normalize!
126
+ # model = Sketchup.active_model
127
+ # entities = model.active_entities
128
+ # edges = entities.add_arc centerpoint, vector2, vector3, 10, 15.degrees, 135.degrees
129
+ # arccurve = edges.first.curve
130
+ #
131
+ # @overload add_arc(center, xaxis, normal, radius, start_angle, end_angle)
132
+ #
133
+ # @param [Geom::Point3d] center A Point3d object representing the center .
134
+ # @param [Geom::Vector3d] xaxis A Vector3d object representing xaxis for the arc.
135
+ # @param [Geom::Vector3d] normal A Vector3d object representing normal for the arc.
136
+ # @param [Numeric] radius The radius of the arc.
137
+ # @param [Numeric] start_angle Start angle for the arc, in radians.
138
+ # @param [Numeric] end_angle End angle for the arc, in radians.
139
+ # @return [Array<Sketchup::Edge>] an array of Edge objects that define the arc.
140
+ #
141
+ # @overload add_arc(center, xaxis, normal, radius, start_angle, end_angle, num_segments)
142
+ #
143
+ # @param [Geom::Point3d] center A Point3d object representing the center .
144
+ # @param [Geom::Vector3d] xaxis A Vector3d object representing xaxis for the arc.
145
+ # @param [Geom::Vector3d] normal A Vector3d object representing normal for the arc.
146
+ # @param [Numeric] radius The radius of the arc.
147
+ # @param [Numeric] start_angle Start angle for the arc, in radians.
148
+ # @param [Numeric] end_angle End angle for the arc, in radians.
149
+ # @param [Integer] num_segments How many segments to draw.
150
+ # @return [Array<Sketchup::Edge>] an array of Edge objects that define the arc.
151
+ #
152
+ # @version SketchUp 6.0
153
+ def add_arc(*args)
154
+ end
155
+
156
+ # The add_circle method is used to create a circle.
157
+ #
158
+ # @example
159
+ # centerpoint = Geom::Point3d.new
160
+ # # Create a circle perpendicular to the normal or Z axis
161
+ # vector = Geom::Vector3d.new 0,0,1
162
+ # vector2 = vector.normalize!
163
+ # model = Sketchup.active_model
164
+ # entities = model.active_entities
165
+ # edges = entities.add_circle centerpoint, vector2, 10
166
+ #
167
+ # @param [Geom::Point3d] center
168
+ # A Point3d object representing the center.
169
+ #
170
+ # @param [Geom::Vector3d] normal
171
+ # A Vector3d object representing normal for the arc.
172
+ #
173
+ # @param [Numeric] radius
174
+ # The radius of the arc.
175
+ #
176
+ # @param [Integer] numsegs
177
+ # The number of segments.
178
+ #
179
+ # @return [Array<Sketchup::Edge>] an Array object containing edges if successful
180
+ #
181
+ # @version SketchUp 6.0
182
+ def add_circle(center, normal, radius, numsegs = 24)
183
+ end
184
+
185
+ # The {#add_cline} method is used to create a construction line. This can be
186
+ # finite or infinite.
187
+ #
188
+ # @example
189
+ # model = Sketchup.active_model
190
+ # entities = model.active_entities
191
+ # point1 = Geom::Point3d.new(0, 0, 0)
192
+ # point2 = Geom::Point3d.new(20, 20, 20)
193
+ # cline = entities.add_cline(point1, point2)
194
+ #
195
+ # @overload add_cline(start_point, end_point, stipple = '-')
196
+ #
197
+ # Creates a finite construction line.
198
+ # @param [Geom::Point3d] start_point
199
+ # @param [Geom::Point3d] end_point
200
+ # @param [String] stipple See {ConstructionLine#stipple=} for acceptable
201
+ # patterns.
202
+ #
203
+ # @overload add_cline(point, vector, stipple = '-')
204
+ #
205
+ # Creates an infinite construction line.
206
+ # @param [Geom::Point3d] point
207
+ # @param [Geom::Point3d] vector
208
+ # @param [String] stipple See {ConstructionLine#stipple=} for acceptable
209
+ # patterns.
210
+ #
211
+ # @return [Sketchup::ConstructionLine]
212
+ #
213
+ # @version SketchUp 6.0
214
+ def add_cline(*args)
215
+ end
216
+
217
+ # The add_cpoint method is used to create a construction point.
218
+ #
219
+ # @example
220
+ # model = Sketchup.active_model
221
+ # entities = model.active_entities
222
+ # point1 = Geom::Point3d.new(100,200,300)
223
+ # constpoint = entities.add_cpoint point1
224
+ # if (constpoint)
225
+ # UI.messagebox constpoint
226
+ # else
227
+ # UI.messagebox "Failure"
228
+ # end
229
+ #
230
+ # @param [Geom::Point3d] point
231
+ # A Point3d object.
232
+ #
233
+ # @return [Sketchup::ConstructionPoint] a ConstructionPoint object if
234
+ # successful
235
+ #
236
+ # @version SketchUp 6.0
237
+ def add_cpoint(point)
238
+ end
239
+
240
+ # The add_curve method is used to create a curve from a collection of edges.
241
+ #
242
+ # The arguments are either Points or an Array of Points. At least 2 points are
243
+ # required.
244
+ #
245
+ # @example
246
+ # entities = Sketchup.active_model.entities
247
+ # curve = entities.add_curve [0,0,0], [0,10,0], [1,20,0]
248
+ #
249
+ # @overload add_curve(points)
250
+ #
251
+ # @param [Array<Geom::Point3d>] points
252
+ #
253
+ # @overload add_curve(*points)
254
+ #
255
+ # @param [Array<Geom::Point3d>] points
256
+ #
257
+ # @return [Array<Sketchup::Edge>]
258
+ #
259
+ # @version SketchUp 6.0
260
+ def add_curve(*args)
261
+ end
262
+
263
+ # The {#add_dimension_linear} method adds a linear dimension to the entities.
264
+ #
265
+ # @example
266
+ # entities = Sketchup.active_model.entities
267
+ # # From point to point
268
+ # dim = entities.add_dimension_linear [50, 10, 0], [100, 10, 0], [0, 20, 0]
269
+ # # Between edge vertices
270
+ # edge = entities.add_edges([50,50,0], [40,10,0])[0]
271
+ # v0 = edge.start
272
+ # v1 = edge.end
273
+ # dim = entities.add_dimension_linear v0, v1, [0, 0, 20]
274
+ # # From an edge's midpoint to a construction point
275
+ # p0 = edge.start.position
276
+ # p1 = edge.end.position
277
+ # mp = Geom::Point3d.new((p0.x+p1.x)/2.0, (p0.y+p1.y)/2.0, (p0.z+p1.z)/2.0)
278
+ # cp = entities.add_cpoint [50, 10, 0]
279
+ # dim = entities.add_dimension_linear [edge, mp], cp, [20, 0, 0]
280
+ # # alternatively, the start params could be passed in separately
281
+ # dim = entities.add_dimension_linear edge, mp, cp, [20, 0, 0]
282
+ #
283
+ # @example Instance path
284
+ # instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
285
+ # edge = instance.definition.entities.grep(Sketchup::Edge).first
286
+ # instance_path = Sketchup::InstancePath.new([instance, edge])
287
+ # start_point = edge.start.position
288
+ # end_point = edge.end.position
289
+ # vector = Geom::Vector3d.new(30, 30, 0)
290
+ # Sketchup.active_model.entities.add_dimension_linear([instance_path, start_point], [instance_path, end_point], vector)
291
+ #
292
+ # @example Instance path as an array
293
+ # instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
294
+ # edge = instance.definition.entities.grep(Sketchup::Edge).first
295
+ # path = [instance, edge]
296
+ # start_point = edge.start.position
297
+ # end_point = edge.end.position
298
+ # vector = Geom::Vector3d.new(30, 30, 0)
299
+ # Sketchup.active_model.entities.add_dimension_linear([path, start_point], [path, end_point], vector)
300
+ #
301
+ # @overload add_dimension_linear(start_pt_or_entity, end_pt_or_entity, offset_vector)
302
+ #
303
+ # @param [Geom::Point3d, Sketchup::Entity] start_pt_or_entity
304
+ # the reference point and/or entity at the start of
305
+ # the dimension. This parameter can take several
306
+ # forms:
307
+ # @param [Geom::Point3d, Sketchup::Entity] end_pt_or_entity
308
+ # the reference point and/or entity at the end
309
+ # of the dimension. This parameter takes the exact
310
+ # same forms as 'start_pt_or_entity'.
311
+ # @param [Geom::Vector3d] offset_vector
312
+ # the parallel offset vector from the reference line
313
+ # to the dimension line measured from the 'start'
314
+ # reference point.
315
+ #
316
+ # @overload add_dimension_linear(start_instance_path, end_instance_path, offset_vector)
317
+ #
318
+ # @note Added in SketchUp 2019.
319
+ # @param [Array<Sketchup::InstancePath, Geom::Point3d>] start_instance_path An array
320
+ # containing a {Sketchup::InstancePath} and a {Geom::Point3d}.
321
+ # @param [Array<Sketchup::InstancePath, Geom::Point3d>] end_instance_path An array
322
+ # containing a {Sketchup::InstancePath} and a {Geom::Point3d}.
323
+ # @param [Geom::Vector3d] offset_vector The parallel offset vector from the
324
+ # reference line to the dimension line measured from the start reference
325
+ # point.
326
+ #
327
+ # @overload add_dimension_linear(start_array, end_array, offset_vector)
328
+ #
329
+ # @note Added in SketchUp 2019.
330
+ # @param [Array(Array<Entity>, Geom::Point3d)] start_array
331
+ # The {Array<Entity>} must contain one or more {Sketchup::ComponentInstance}'s
332
+ # and a leaf entity. The leaf entity can be a {Sketchup::Vertex},
333
+ # {Sketchup::ConstructionPoint}, {Sketchup::ConstructionLine}, or
334
+ # {Sketchup::Edge}. The {Geom::Point3d} is the point associated with the leaf entity.
335
+ # @param [Array(Array<Entity>, Geom::Point3d)] end_array
336
+ # The {Array<Entity>} must contain one or more {Sketchup::ComponentInstance}'s
337
+ # and a leaf entity. The leaf entity can be a {Sketchup::Vertex},
338
+ # {Sketchup::ConstructionPoint}, {Sketchup::ConstructionLine}, or
339
+ # {Sketchup::Edge}. The {Geom::Point3d} is the point associated with the leaf entity.
340
+ # @param [Geom::Vector3d] offset_vector The parallel offset vector from the
341
+ # reference line to the dimension line measured form the start reference
342
+ # point.
343
+ #
344
+ # @return [Sketchup::DimensionLinear] the created dimension
345
+ #
346
+ # @version SketchUp 2014
347
+ def add_dimension_linear(*args)
348
+ end
349
+
350
+ # The add_dimension_radial method adds a radial dimension (i.e arc/circle
351
+ # radius/diameter dimension) to the entities.
352
+ #
353
+ # @example
354
+ # entities = Sketchup.active_model.entities
355
+ # # Create a circle
356
+ # centerpoint = Geom::Point3d.new(10, 10, 0)
357
+ # vector = Geom::Vector3d.new(0, 0, 1)
358
+ # edges = entities.add_circle centerpoint, vector, 10
359
+ # circle = edges[0].curve
360
+ # dim = entities.add_dimension_radial circle, [30, 30, 0]
361
+ #
362
+ # @param [Sketchup::ArcCurve] arc_curve
363
+ # an ArcCurve object to which the dimension is to be
364
+ # attached.
365
+ #
366
+ # @param [Geom::Point3d] leader_break_pt
367
+ # a Point3d for the break point on the leader where the
368
+ # dimension text is attached.
369
+ #
370
+ # @return [Sketchup::DimensionRadial] the created dimension
371
+ #
372
+ # @version SketchUp 2014
373
+ def add_dimension_radial(arc_curve, leader_break_pt)
374
+ end
375
+
376
+ # The {#add_edges} method is used to add a set of connected edges to the
377
+ # {Sketchup::Entities} collection.
378
+ #
379
+ # @example
380
+ # model = Sketchup.active_model
381
+ # entities = model.active_entities
382
+ # point1 = Geom::Point3d.new(0,0,0)
383
+ # point2 = Geom::Point3d.new(20,20,20)
384
+ # edges = entities.add_edges point1, point2
385
+ #
386
+ # @note If the points form a closed loop, the first and last vertex will not
387
+ # merge. If you intend to create a face from the edges, use {#add_face}
388
+ # directly.
389
+ #
390
+ # @overload add_edges(points)
391
+ #
392
+ # @param [Array<Geom::Point3d>] points At least two points required.
393
+ # @return [Array<Sketchup::Edge>]
394
+ #
395
+ # @overload add_edges(*points)
396
+ #
397
+ # @param [Array<Geom::Point3d>] points At least two points required.
398
+ # @return [Array<Sketchup::Edge>]
399
+ #
400
+ # @return [Array<Sketchup::Edge>] an array of Edge objects if successful
401
+ #
402
+ # @version SketchUp 6.0
403
+ def add_edges(*args)
404
+ end
405
+
406
+ # The add_face method is used to create a face. You can call this method a
407
+ # number of ways:
408
+ #
409
+ # - entities.add_face(edge1, edge2, edge3, ...)
410
+ # - entities.add_face(edgearray)
411
+ # - entities.add_face(pt1, pt2, pt3, ...)
412
+ # - entities.add_face([pt1, pt2, pt3,...])
413
+ # - entities.add_face(curve)
414
+ #
415
+ # For the last form that takes a Curve, the curve must be closed - like a
416
+ # circle.
417
+ #
418
+ # Note that a special case exists for any face created on the ground plane, in
419
+ # which case the vertex order is ignored and the face is always facing down.
420
+ #
421
+ # @example
422
+ # depth = 100
423
+ # width = 100
424
+ # model = Sketchup.active_model
425
+ # entities = model.active_entities
426
+ # pts = []
427
+ # pts[0] = [0, 0, 0]
428
+ # pts[1] = [width, 0, 0]
429
+ # pts[2] = [width, depth, 0]
430
+ # pts[3] = [0, depth, 0]
431
+ # # Add the face to the entities in the model
432
+ # face = entities.add_face(pts)
433
+ #
434
+ # @overload add_face(entities)
435
+ #
436
+ # @param [Array<Sketchup::Edge>, Array<Geom::Point3d>, Sketchup::Curve] entities
437
+ #
438
+ # @overload add_face(*entities)
439
+ #
440
+ # @param [Array<Sketchup::Edge>, Array<Geom::Point3d>] entities
441
+ #
442
+ # @return [Sketchup::Face, nil]
443
+ #
444
+ # @version SketchUp 6.0
445
+ def add_face(*args)
446
+ end
447
+
448
+ # The {#add_faces_from_mesh} method is used to add Face objects to the
449
+ # collection of entities from a PolygonMesh.
450
+ #
451
+ # The +smooth_flags+ parameter can contain any of the following values if
452
+ # passed. The constants were added in SketchUp 2014. For previous versions,
453
+ # numeric values have to be specified instead of the Ruby constants.
454
+ #
455
+ # - 0: {Geom::PolygonMesh::NO_SMOOTH_OR_HIDE}
456
+ # - 1: {Geom::PolygonMesh::HIDE_BASED_ON_INDEX} (Negative point index will hide the edge.)
457
+ # - 2: {Geom::PolygonMesh::SOFTEN_BASED_ON_INDEX} (Negative point index will soften the edge.)
458
+ # - 4: {Geom::PolygonMesh::AUTO_SOFTEN} (Interior edges are softened.)
459
+ # - 8: {Geom::PolygonMesh::SMOOTH_SOFT_EDGES} (All soft edges will also be smooth.)
460
+ #
461
+ # The 3rd and 4th parameters will accept a {sketchup::Material} object or a
462
+ # string name of a material currently in the model.
463
+ #
464
+ # @example
465
+ # pm = Geom::PolygonMesh.new
466
+ # pm.add_point([ 0, 0, 0]) # 1
467
+ # pm.add_point([10, 0, 0]) # 2
468
+ # pm.add_point([10,10, 0]) # 3
469
+ # pm.add_point([ 0,10, 0]) # 4
470
+ # pm.add_point([20, 0, 5]) # 5
471
+ # pm.add_point([20,10, 5]) # 6
472
+ # pm.add_polygon(1, -2, 3, 4)
473
+ # pm.add_polygon(2, 5,6, -3)
474
+ #
475
+ # # Create a new group that we will populate with the mesh.
476
+ # group = Sketchup.active_model.entities.add_group
477
+ # material = Sketchup.active_model.materials.add('green')
478
+ # smooth_flags = Geom::PolygonMesh::NO_SMOOTH_OR_HIDE
479
+ # group.entities.add_faces_from_mesh(pm, smooth_flags, material)
480
+ #
481
+ # @param [Geom::PolygonMesh] polygon_mesh
482
+ #
483
+ # @param [Integer] smooth_flags
484
+ # flags for softening and smoothing of edges.
485
+ #
486
+ # @param [Sketchup::Material, String] f_material
487
+ # material to paint front faces with.
488
+ #
489
+ # @param [Sketchup::Material, String] b_material
490
+ # material to paint back faces with.
491
+ #
492
+ # @return [Integer] Number of faces created
493
+ #
494
+ # @version SketchUp 6.0
495
+ def add_faces_from_mesh(polygon_mesh, smooth_flags = Geom::PolygonMesh::AUTO_SOFTEN|Geom::PolygonMesh::SMOOTH_SOFT_EDGES, f_material = nil, b_material = nil)
496
+ end
497
+
498
+ # The add_group method is used to create an empty group or a group with
499
+ # entities.
500
+ #
501
+ # @example
502
+ # model = Sketchup.active_model
503
+ # entities = model.active_entities
504
+ # group = entities.add_group
505
+ #
506
+ # @note Calling add_group with entities in its parameters has been known to
507
+ # crash SketchUp before version 8.0. It is preferable to create an empty
508
+ # group and then add things to its Entities collection.
509
+ #
510
+ # @overload add_group(entities)
511
+ #
512
+ # @param [Array<Sketchup::Entity>] entities
513
+ # an entities collection to add to the group.
514
+ #
515
+ # @overload add_group(*entities)
516
+ #
517
+ # @param [Array<Sketchup::Entity>] entities
518
+ # an entities collection to add to the group.
519
+ #
520
+ # @return [Sketchup::Group]
521
+ #
522
+ # @version SketchUp 6.0
523
+ def add_group(*args)
524
+ end
525
+
526
+ # The add_image method is used to add an image to the collection of entities.
527
+ #
528
+ # The width and height are measured in model units (i.e. inches). If the
529
+ # height is not given, then it is computed from the width to preserve the
530
+ # aspect ratio of the image.
531
+ #
532
+ # @example
533
+ # model = Sketchup.active_model
534
+ # entities = model.active_entities
535
+ # point = Geom::Point3d.new 10,20,30
536
+ # image = entities.add_image "Shapes.jpg", point, 300
537
+ # if (image)
538
+ # UI.messagebox image
539
+ # else
540
+ # UI.messagebox "Failure"
541
+ # end
542
+ #
543
+ # @param [String] filename
544
+ # A filename for the image file.
545
+ #
546
+ # @param [Geom::Point3d] point
547
+ # A Point3d object representing the insertion point of
548
+ # the image.
549
+ #
550
+ # @param [Numeric] width
551
+ # Width for the image.
552
+ #
553
+ # @param [Numeric] height
554
+ # height for the image if you want to control
555
+ # width and height independently. Leave as default +0.0+ when you want it
556
+ # to be relative to the aspect ratio.
557
+ #
558
+ # @return [Sketchup::Image, nil] an Image object if successful.
559
+ #
560
+ # @version SketchUp 6.0
561
+ def add_image(filename, point, width, height = 0.0)
562
+ end
563
+
564
+ # The add_instance method adds a component instance to the collection of
565
+ # entities.
566
+ #
567
+ # @example
568
+ # point = Geom::Point3d.new 10,20,30
569
+ # transform = Geom::Transformation.new point
570
+ # model = Sketchup.active_model
571
+ # entities = model.active_entities
572
+ # path = Sketchup.find_support_file "Bed.skp",
573
+ # "Components/Components Sampler/"
574
+ # definitions = model.definitions
575
+ # componentdefinition = definitions.load path
576
+ # instance = entities.add_instance componentdefinition, transform
577
+ # if (instance)
578
+ # UI.messagebox instance
579
+ # else
580
+ # UI.messagebox "Failure"
581
+ # end
582
+ #
583
+ # @param [Sketchup::ComponentDefinition] definition
584
+ # A ComponentDefinition object.
585
+ #
586
+ # @param [Geom::Transformation] transform
587
+ # A Transformation object.
588
+ #
589
+ # @return [Sketchup::ComponentInstance] a ComponentInstance object if successful
590
+ #
591
+ # @version SketchUp 6.0
592
+ def add_instance(definition, transform)
593
+ end
594
+
595
+ # The add_line method is used to add an edge to the collection of entities.
596
+ # This is not to be confused with the concept of a "line" from a geometric
597
+ # sense, which is an invisible object represented by an Array of a point
598
+ # and a vector. (See the Array class for more information on geometric lines in
599
+ # SketchUp.)
600
+ #
601
+ # This method is the same as add_edges method, but returns a single edge.
602
+ #
603
+ # @example
604
+ # model = Sketchup.active_model
605
+ # entities = model.active_entities
606
+ # point1 = Geom::Point3d.new(0,0,0)
607
+ # point2 = Geom::Point3d.new(20,20,20)
608
+ # line = entities.add_line point1,point2
609
+ # if (line)
610
+ # UI.messagebox line
611
+ # else
612
+ # UI.messagebox "Failure"
613
+ # end
614
+ #
615
+ # @param [Geom::Point3d] point1
616
+ # Point3d object representing the edge's starting point.
617
+ #
618
+ # @param [Geom::Point3d] point2
619
+ # Point3d object representing the edge's ending point.
620
+ #
621
+ # @return [Sketchup::Edge] a Edge object if successful
622
+ #
623
+ # @version SketchUp 6.0
624
+ def add_line(point1, point2)
625
+ end
626
+
627
+ # The add_ngon method is used to create a multi-sided polygon.
628
+ #
629
+ # @example
630
+ # entities = Sketchup.active_model.entities
631
+ # center = Geom::Point3d.new
632
+ # normal = Geom::Vector3d.new(0,0,1)
633
+ # radius = 100
634
+ # numsides = 6
635
+ # edges = entities.add_ngon center, normal, radius, numsides
636
+ #
637
+ # @param [Geom::Point3d] center
638
+ # A Point3d object representing the center of the polygon.
639
+ #
640
+ # @param [Geom::Vector3d] normal
641
+ # A Vector3d object.
642
+ #
643
+ # @param [Numeric] radius
644
+ # A radius.
645
+ #
646
+ # @param [Integer] numsides
647
+ # The number of sides for the polygon.
648
+ #
649
+ # @return [Array<Sketchup::Edge>] an array of Edges that make up the polygon if
650
+ # successful
651
+ #
652
+ # @version SketchUp 6.0
653
+ def add_ngon(center, normal, radius, numsides = 24)
654
+ end
655
+
656
+ # The add_observer method is used to add an observer to the current object.
657
+ #
658
+ # @example
659
+ # entities = Sketchup.active_model.entities
660
+ # status = entities.add_observer observer
661
+ #
662
+ # @param [Object] observer
663
+ # An observer.
664
+ #
665
+ # @return [Boolean] true if successful, false if unsuccessful.
666
+ #
667
+ # @version SketchUp 6.0
668
+ def add_observer(observer)
669
+ end
670
+
671
+ # The add_section_plane method adds a section plane object to the entities.
672
+ #
673
+ # @example
674
+ # # Create a section plane
675
+ # model = Sketchup.active_model
676
+ # sp = model.entities.add_section_plane([50, 50, 0], [1.0, 1.0, 0])
677
+ # # Activate it
678
+ # sp.activate
679
+ # # Make sure section planes are visible
680
+ # model.rendering_options['DisplaySectionPlanes'] = true
681
+ #
682
+ # @param plane
683
+ # the geometric plane where the SectionPlane object is to
684
+ # be created. Refer to the Geom module for information on
685
+ # how planes are represented.
686
+ #
687
+ # @return [Sketchup::SectionPlane, nil] the created SectionPlane object if
688
+ # successful, nil on failure.
689
+ #
690
+ # @version SketchUp 2014
691
+ def add_section_plane(plane)
692
+ end
693
+
694
+ # The {#add_text} method adds a note or label text entity to the entities.
695
+ #
696
+ # @example
697
+ # coordinates = [10, 10, 10]
698
+ # model = Sketchup.active_model
699
+ # entities = model.entities
700
+ # point = Geom::Point3d.new coordinates
701
+ # text = entities.add_text "This is a Test", point
702
+ #
703
+ # @example Instance path
704
+ # instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
705
+ # edge = instance.definition.entities.grep(Sketchup::Edge).first
706
+ # instance_path = Sketchup::InstancePath.new([instance, edge])
707
+ # point = edge.start.position
708
+ # vector = Geom::Vector3d.new(30, 30, 0)
709
+ # Sketchup.active_model.entities.add_text("mytext", [instance_path, point], vector)
710
+ #
711
+ # @example Instance path as an array
712
+ # instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
713
+ # edge = instance.definition.entities.grep(Sketchup::Edge).first
714
+ # path = [instance, edge]
715
+ # point = edge.start.position
716
+ # vector = Geom::Vector3d.new(30, 30, 0)
717
+ # Sketchup.active_model.entities.add_text("mytext", [path, point], vector)
718
+ #
719
+ # @overload add_text(text, point, vector)
720
+ #
721
+ # @bug SketchUp 2019.0 had a regression bug where an error was thrown if
722
+ # +point+ was provided as a {Sketchup::Vertex} or {Sketchup::InputPoint}.
723
+ # This was fixed in SketchUp 2019.1.
724
+ # @param [String] text The text string to add.
725
+ # @param [Geom::Point3d, Sketchup::Vertex, Sketchup::InputPoint] point
726
+ # A Point3d object representing the insertion point.
727
+ # @param [Geom::Vector3d] vector The Vector representing an arrow leader.
728
+ #
729
+ # @overload add_text(text, instance_path_and_pt, vector)
730
+ #
731
+ # @version SketchUp 2019
732
+ # @param [String] text The text to add.
733
+ # @param [Array<Sketchup::InstancePath, Geom::Point3d>] instance_path_and_pt
734
+ # The array containing a {Sketchup::InstancePath} and a {Geom::Point3d}.
735
+ # @param [Geom::Vector3d] vector The vector representing an arrow leader.
736
+ #
737
+ # @overload add_text(text, instance_array_and_pt, vector)
738
+ #
739
+ # @version SketchUp 2019
740
+ # @param [String] text The text to add.
741
+ # @param [Array(Array<Sketchup::Entity>, Geom::Point3d)] instance_array_with_pt
742
+ # The array containing one or more {Sketchup::ComponentInstance}'s and a
743
+ # leaf entity. The leaf entity can be a {Sketchup::Vertex},
744
+ # {Sketchup::ConstructionPoint}, {Sketchup::ConstructionLine}, or
745
+ # {Sketchup::Edge}. The {Geom::Point3d} is the point associated with the
746
+ # leaf entity.
747
+ # @param [Geom::Vector3d] vector The vector representing an arrow leader.
748
+ #
749
+ # @return [Sketchup::Text] a Text object if successful
750
+ #
751
+ # @version SketchUp 6.0
752
+ def add_text(*args)
753
+ end
754
+
755
+ # The {#at} method is an alias for {#[]}.
756
+ #
757
+ # @example
758
+ # entities = Sketchup.active_model.entities
759
+ # entity = entities.at(0)
760
+ #
761
+ # @param [Integer] entity_index
762
+ # The index for a specific entity.
763
+ #
764
+ # @return [Sketchup::Entity, nil]
765
+ #
766
+ # @see #[]
767
+ #
768
+ # @version SketchUp 6.0
769
+ def at(entity_index)
770
+ end
771
+
772
+ # The clear! method is used to remove all entities from the collection of
773
+ # entities.
774
+ #
775
+ # @example
776
+ # coordinates = [10, 10, 10]
777
+ # model = Sketchup.active_model
778
+ # entities = model.entities
779
+ # point = Geom::Point3d.new coordinates
780
+ # text = entities.add_text "This is a Test", point
781
+ # UI.messagebox "Clearing All"
782
+ # status = entities.clear!
783
+ #
784
+ # @return [Boolean] true if successful, false if unsuccessful
785
+ #
786
+ # @version SketchUp 6.0
787
+ def clear!
788
+ end
789
+
790
+ #
791
+ # @example
792
+ # model = Sketchup.active_model
793
+ # entities = model.entities
794
+ # entities.add_cpoint([10, 10, 10])
795
+ # number = entities.count
796
+ #
797
+ # @note Since SketchUp 2014 the count method is inherited from Ruby's
798
+ # +Enumable+ mix-in module. Prior to that the {#count} method is an alias
799
+ # for {#length}.
800
+ #
801
+ # @return [Integer]
802
+ #
803
+ # @see #length
804
+ #
805
+ # @version SketchUp 6.0
806
+ def count
807
+ end
808
+
809
+ # The each method is used to iterate through the entities in the collection of
810
+ # entities.
811
+ #
812
+ # @example
813
+ # coordinates = [10, 10, 10]
814
+ # model = Sketchup.active_model
815
+ # entities = model.entities
816
+ # point = Geom::Point3d.new coordinates
817
+ # text = entities.add_text "This is a Test", point
818
+ # entities.each { | entity| UI.messagebox entity }
819
+ #
820
+ # @return [nil]
821
+ #
822
+ # @version SketchUp 6.0
823
+ #
824
+ # @yieldparam [Sketchup::Entity] entity
825
+ def each
826
+ end
827
+
828
+ # The erase_entities method is used to erase one or more entities from the
829
+ # model.
830
+ #
831
+ # @example
832
+ # depth = 100
833
+ # width = 100
834
+ # model = Sketchup.active_model
835
+ # entities = model.active_entities
836
+ # pts = []
837
+ # pts[0] = [0, 0, 0]
838
+ # pts[1] = [width, 0, 0]
839
+ # pts[2] = [width, depth, 0]
840
+ # pts[3] = [0, depth, 0]
841
+ #
842
+ # # Add the face to the entities in the model
843
+ # face = entities.add_face pts
844
+ #
845
+ # # I just happen to know that the second entity in the
846
+ # # entities objects is an edge, so erase it.
847
+ # UI.messagebox entities
848
+ # entities.erase_entities entities[1]
849
+ # UI.messagebox entities
850
+ #
851
+ # @overload erase_entities(entities)
852
+ #
853
+ # @param [Array<Sketchup::Entity>] entities
854
+ #
855
+ # @overload erase_entities(*entities)
856
+ #
857
+ # @param [Array<Sketchup::Entity>] entities
858
+ #
859
+ # @return [nil]
860
+ #
861
+ # @version SketchUp 6.0
862
+ def erase_entities(*args)
863
+ end
864
+
865
+ # The {#fill_from_mesh} method is used to add faces and edges to the collection
866
+ # of entities from a {Geom::PolygonMesh}. It requires that the entities
867
+ # collection to be filled is empty. It has higher performance than
868
+ # {#add_faces_from_mesh}, but does less error checking as it builds the
869
+ # geometry.
870
+ #
871
+ # The +smooth_flags+ parameter can contain any of the following values if
872
+ # passed. The constants were added in SketchUp 2014. For previous versions,
873
+ # numeric values have to be specified instead of the Ruby constants:
874
+ #
875
+ # - 0: {Geom::PolygonMesh::NO_SMOOTH_OR_HIDE}
876
+ # - 1: {Geom::PolygonMesh::HIDE_BASED_ON_INDEX} (Negative point index will hide the edge.)
877
+ # - 2: {Geom::PolygonMesh::SOFTEN_BASED_ON_INDEX} (Negative point index will soften the edge.)
878
+ # - 4: {Geom::PolygonMesh::AUTO_SOFTEN} (Interior edges are softened.)
879
+ # - 8: {Geom::PolygonMesh::SMOOTH_SOFT_EDGES} (All soft edges will also be smooth.)
880
+ #
881
+ # The 4rd and 5th parameters will accept a {Sketchup::Material} object or a
882
+ # string name of a material currently in the model.
883
+ #
884
+ # @example
885
+ # pm = Geom::PolygonMesh.new
886
+ # pm.add_point([ 0, 0, 0]) # 1
887
+ # pm.add_point([10, 0, 0]) # 2
888
+ # pm.add_point([10,10, 0]) # 3
889
+ # pm.add_point([ 0,10, 0]) # 4
890
+ # pm.add_point([20, 0, 5]) # 5
891
+ # pm.add_point([20,10, 5]) # 6
892
+ # pm.add_polygon(1, -2, 3, 4)
893
+ # pm.add_polygon(2, 5, 6, -3)
894
+ #
895
+ # # Create a new group that we will populate with the mesh.
896
+ # group = Sketchup.active_model.entities.add_group
897
+ # material = Sketchup.active_model.materials.add('red')
898
+ # smooth_flags = Geom::PolygonMesh::HIDE_BASED_ON_INDEX
899
+ # group.entities.fill_from_mesh(pm, true, smooth_flags, material)
900
+ #
901
+ # @param [Geom::PolygonMesh] polygon_mesh
902
+ #
903
+ # @param [Boolean] weld_vertices
904
+ # This argument has no effect and is kept for
905
+ # compatibility reasons. Points are always
906
+ # merged.
907
+ #
908
+ # @param [Integer] smooth_flags
909
+ # flags for softening and smoothing of edges.
910
+ #
911
+ # @param [Sketchup::Material, String] f_material
912
+ # material to paint front faces with.
913
+ #
914
+ # @param [Sketchup::Material, String] b_material
915
+ # material to paint back faces with.
916
+ #
917
+ # @return [Boolean]
918
+ #
919
+ # @version SketchUp 6.0
920
+ 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)
921
+ end
922
+
923
+ # The intersect_with method is used to intersect an entities, component
924
+ # instance, or group object with a entities object.
925
+ #
926
+ # @example
927
+ # entities.intersect_with recurse, transformation1, entities1,
928
+ # transformation2, hidden, entities2
929
+ #
930
+ # @param [Boolean] recurse
931
+ # true if you want this entities object to be recursed
932
+ # (intersection lines will be put inside of groups and
933
+ # components within this entities object).
934
+ #
935
+ # @param [Geom::Transformation] transform1
936
+ # The transformation for this entities object.
937
+ #
938
+ # @param [Sketchup::Entities] entities1
939
+ # The entities object where you want the intersection
940
+ # lines to appear.
941
+ #
942
+ # @param [Geom::Transformation] transform2
943
+ # The transformation for entities1.
944
+ #
945
+ # @param [Boolean] hidden
946
+ # true if you want hidden geometry in this entities
947
+ # object to be used in the intersection.
948
+ #
949
+ # @param [Sketchup::Entity, Array<Sketchup::Entity>] entities2
950
+ # A single entity, or an array of entities.
951
+ #
952
+ # @return [nil]
953
+ #
954
+ # @version SketchUp 6.0
955
+ def intersect_with(recurse, transform1, entities1, transform2, hidden, entities2)
956
+ end
957
+
958
+ # The {#length} method is used to retrieve the number of entities in the
959
+ # collection of entities.
960
+ #
961
+ # @example
962
+ # model = Sketchup.active_model
963
+ # entities = model.entities
964
+ # entities.add_cpoint([10, 10, 10])
965
+ # number = entities.length
966
+ #
967
+ # @return [Integer]
968
+ #
969
+ # @see #size
970
+ #
971
+ # @version SketchUp 6.0
972
+ def length
973
+ end
974
+
975
+ # The model method is used to retrieve the model that contains the collection
976
+ # of entities.
977
+ #
978
+ # @example
979
+ # coordinates = [10, 10, 10]
980
+ # model = Sketchup.active_model
981
+ # entities = model.entities
982
+ # point = Geom::Point3d.new coordinates
983
+ # text = entities.add_text "This is a Test", point
984
+ # model = entities.model
985
+ #
986
+ # @return [Sketchup::Model] the model that contains the collection of
987
+ # entities if successful.
988
+ #
989
+ # @version SketchUp 6.0
990
+ def model
991
+ end
992
+
993
+ # The parent method is used to retrieve the parent or object that contains the
994
+ # collection of entities. A parent can be either a Model or
995
+ # ComponentDefinition object.
996
+ #
997
+ # @example
998
+ # coordinates = [10, 10, 10]
999
+ # model = Sketchup.active_model
1000
+ # entities = model.entities
1001
+ # point = Geom::Point3d.new coordinates
1002
+ # text = entities.add_text "This is a Test", point
1003
+ # parent = entities.parent
1004
+ #
1005
+ # @return [Sketchup::ComponentDefinition, Sketchup::Model] the object that
1006
+ # contains the collection of entities if successful
1007
+ #
1008
+ # @version SketchUp 6.0
1009
+ def parent
1010
+ end
1011
+
1012
+ # The remove_observer method is used to remove an observer from the current
1013
+ # object.
1014
+ #
1015
+ # @example
1016
+ # entities = Sketchup.active_model.entities
1017
+ # status = entities.remove_observer observer
1018
+ #
1019
+ # @param [Object] observer
1020
+ # An observer.
1021
+ #
1022
+ # @return [Boolean] true if successful, false if unsuccessful.
1023
+ #
1024
+ # @version SketchUp 6.0
1025
+ def remove_observer(observer)
1026
+ end
1027
+
1028
+ # The {#size} method is an alias for the {#length} method.
1029
+ #
1030
+ # @example
1031
+ # model = Sketchup.active_model
1032
+ # entities = model.entities
1033
+ # entities.add_cpoint([10, 10, 10])
1034
+ # number = entities.size
1035
+ #
1036
+ # @return [Integer]
1037
+ #
1038
+ # @see #length
1039
+ #
1040
+ # @version SketchUp 2014
1041
+ def size
1042
+ end
1043
+
1044
+ # The transform_by_vectors method is used to apply several vectors to several
1045
+ # sub-entities all at once.
1046
+ #
1047
+ # @example
1048
+ # # Need better Ruby example.
1049
+ # entities = entities.transform_by_vectors sub_entities, vector_array
1050
+ #
1051
+ # @param [Array<Sketchup::Entity>] sub_entities
1052
+ # An array of entities to transform.
1053
+ #
1054
+ # @param [Array<Geom::Vector3d>] vectors
1055
+ # An array of vectors to apply.
1056
+ #
1057
+ # @return [Sketchup::Entities]
1058
+ #
1059
+ # @version SketchUp 6.0
1060
+ def transform_by_vectors(sub_entities, vectors)
1061
+ end
1062
+
1063
+ # The transform_entities method is used to apply a transform to several
1064
+ # sub-entities all at once.
1065
+ #
1066
+ # Important note: If you apply a transformation to entities that are
1067
+ # not in the current edit context (i.e. faces that are inside a group),
1068
+ # SketchUp will apply the transformation incorrectly, since the geometry
1069
+ # has one origin and the current edit context has another. You can correct
1070
+ # for this by watching the Model.edit_transform and Model.active_path. See
1071
+ # ModelObserver.onActivePathChanged for more information.
1072
+ #
1073
+ # @example
1074
+ # entities = Sketchup.active_model.entities
1075
+ # entities.add_line([0,0,0],[100,100,100])
1076
+ # entities.add_line([0,0,0],[200,-10,-10])
1077
+ #
1078
+ # entities_to_transform = []
1079
+ # entities_to_transform.push(entities[0])
1080
+ # entities_to_transform.push(entities[1])
1081
+ #
1082
+ # transform = Geom::Transformation.new([100,0,0])
1083
+ # entities.transform_entities(transform, ent1, ent2, ent3)
1084
+ #
1085
+ # @param [Geom::Transformation] transform
1086
+ # The Transformation to apply.
1087
+ #
1088
+ # @param [Array<Sketchup::Entity>] entities
1089
+ # An array or series of entities to transform.
1090
+ #
1091
+ # @return [Boolean] results of the transform.
1092
+ #
1093
+ # @version SketchUp 6.0
1094
+ def transform_entities(transform, entities)
1095
+ end
1096
+
1097
+ # The {#weld} method takes a set of edges and find all possible chains of edges
1098
+ # and connect them with a {Sketchup::Curve}.
1099
+ #
1100
+ # A curve will not cross another curve. They will split where multiple curves
1101
+ # meet.
1102
+ #
1103
+ # @example
1104
+ # entities = Sketchup.active_model.entities
1105
+ # edges = model.selection.grep(Sketchup::Edge)
1106
+ # curves = entities.weld(edges)
1107
+ #
1108
+ # @param [Array<Sketchup::Edge>] edges
1109
+ #
1110
+ # @raise [ArgumentError] if the given entities are not part of the same
1111
+ # {Sketchup::Entities} collection.
1112
+ #
1113
+ # @return [Array<Sketchup::Curve>]
1114
+ #
1115
+ # @version SketchUp 2020.1
1116
+ def weld(edges)
1117
+ end
1118
+
1119
+ end