sketchup-api-stubs 0.7.9 → 0.7.11

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 (160) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +157 -151
  3. data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
  5. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +182 -172
  6. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +111 -126
  7. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +423 -400
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +693 -661
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +535 -509
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +500 -476
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +267 -263
  13. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +133 -141
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +547 -522
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +678 -693
  16. data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
  17. data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +751 -747
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Dictionary.rb +234 -0
  23. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +683 -517
  24. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
  26. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +464 -353
  27. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
  28. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
  29. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
  30. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
  31. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
  32. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
  33. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
  34. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
  35. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +614 -567
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
  37. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
  38. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +282 -183
  39. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +458 -387
  40. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
  41. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +346 -344
  42. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
  43. data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -82
  44. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +714 -692
  45. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1565 -1519
  46. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  48. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  49. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  50. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  51. data/lib/sketchup-api-stubs/stubs/Length.rb +286 -278
  52. data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +196 -144
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +226 -209
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +145 -150
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +294 -281
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +296 -302
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +473 -478
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -121
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +673 -659
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +600 -593
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +252 -257
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +443 -449
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +167 -165
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +403 -406
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -397
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1282 -1239
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -261
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +519 -545
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Environment.rb +406 -0
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/Environments.rb +185 -0
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/EnvironmentsObserver.rb +113 -0
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +122 -125
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +1006 -937
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -102
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +740 -750
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +289 -282
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +64 -62
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +405 -468
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +432 -406
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +307 -306
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +332 -326
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +380 -422
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +409 -427
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +241 -249
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +55 -48
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -114
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/LoadHandler.rb +70 -0
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +1115 -414
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +330 -317
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1714 -1652
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +372 -357
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +133 -130
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -271
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +463 -490
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +104 -116
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +939 -797
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +388 -361
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +501 -478
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +385 -361
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +451 -458
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +211 -212
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +259 -255
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Snap.rb +125 -0
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +88 -69
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +263 -217
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +283 -262
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +199 -217
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +924 -834
  143. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  144. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
  145. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
  146. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +143 -142
  147. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1566 -1311
  148. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +71 -45
  149. data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1429 -1377
  150. data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
  151. data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
  152. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +399 -389
  153. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +580 -494
  154. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +280 -269
  155. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +258 -241
  156. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +636 -635
  157. data/lib/sketchup-api-stubs/stubs/UI.rb +791 -683
  158. data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -303
  159. data/lib/sketchup-api-stubs.rb +1 -1
  160. metadata +10 -24
@@ -1,1652 +1,1714 @@
1
- # Copyright:: Copyright 2023 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # This is the interface to a SketchUp model. The model is the 3D drawing that
5
- # the user is working with, and it serves as the "entry point" for most Ruby
6
- # API interactions. The Sketchup.active_model method gives you a handle to the
7
- # current model, and from there you can use the model-level methods to start
8
- # getting information and making changes.
9
- #
10
- # Constants:
11
- # Product Family
12
- # - Model::ProTrial
13
- # - Model::ProLicensed
14
- # - Model::MakeTrial
15
- # - Model::MakeTrialExpired
16
- #
17
- # @bug Prior to SketchUp 2019.0 this class would yield +TypeError+ for all
18
- # method calls if +#singleton_class+ was called on the model object.
19
- #
20
- # @example
21
- # # Grab a handle to the currently active model (aka the one the user is
22
- # # looking at in SketchUp.)
23
- # model = Sketchup.active_model
24
- #
25
- # # Grab other handles to commonly used collections inside the model.
26
- # entities = model.entities
27
- # layers = model.layers
28
- # materials = model.materials
29
- # component_definitions = model.definitions
30
- # selection = model.selection
31
- #
32
- # # Now that we have our handles, we can start pulling objects and making
33
- # # method calls that are useful.
34
- # first_entity = entities[0]
35
- # UI.messagebox("First thing in your model is a #{first_entity.typename}")
36
- #
37
- # number_materials = materials.length
38
- # UI.messagebox("Your model has #{number_materials} materials.")
39
- #
40
- # new_edge = entities.add_line([0,0,0], [500,500,0])
41
- #
42
- # @version SketchUp 6.0
43
- class Sketchup::Model
44
-
45
- # Constants
46
-
47
- LOAD_STATUS_SUCCESS = nil # Stub value.
48
- LOAD_STATUS_SUCCESS_MORE_RECENT = nil # Stub value.
49
-
50
- Make = nil # Stub value.
51
- MakeTrial = nil # Stub value.
52
- ProLicensed = nil # Stub value.
53
- ProTrial = nil # Stub value.
54
-
55
- VERSION_2013 = nil # Stub value.
56
- VERSION_2014 = nil # Stub value.
57
- VERSION_2015 = nil # Stub value.
58
- VERSION_2016 = nil # Stub value.
59
- VERSION_2017 = nil # Stub value.
60
- VERSION_2018 = nil # Stub value.
61
- VERSION_2019 = nil # Stub value.
62
- VERSION_2020 = nil # Stub value.
63
- VERSION_2021 = nil # Stub value.
64
- VERSION_3 = nil # Stub value.
65
- VERSION_4 = nil # Stub value.
66
- VERSION_5 = nil # Stub value.
67
- VERSION_6 = nil # Stub value.
68
- VERSION_7 = nil # Stub value.
69
- VERSION_8 = nil # Stub value.
70
-
71
- # Instance Methods
72
-
73
- # The {#abort_operation} method aborts the current operation started with the
74
- # start_operation method.
75
- #
76
- # The {#abort_operation} method is normally called from inside of a rescue
77
- # clause to cancel an operation if something goes wrong.
78
- #
79
- # @example
80
- # status = model.abort_operation
81
- #
82
- # @note Never abort a transparent operation. Doing so would abort the operation
83
- # it chains to. Instead, try to clean up and simply commit in order to make
84
- # sure the operation is closed.
85
- #
86
- # @return [Boolean] true if successful, false if unsuccessful
87
- #
88
- # @version SketchUp 6.0
89
- def abort_operation
90
- end
91
-
92
- # Returns an {Sketchup::Entities} object which contains
93
- # the entities in the open group or component instance. If no group or
94
- # component is open for editing then this will be the same as {#entities}.
95
- #
96
- # To perform actions upon the current set of entities the user is working with
97
- # then this is the method to use. Entities selected by the user will be a
98
- # subset of the active entities.
99
- #
100
- # @example
101
- # model = Sketchup.active_model
102
- # entities = model.active_entities
103
- # entities.each { |entity| puts "#{entity} (#{entity.class})" }
104
- #
105
- # @return [Sketchup::Entities]
106
- #
107
- # @see #edit_transform
108
- #
109
- # @version SketchUp 6.0
110
- def active_entities
111
- end
112
-
113
- # The {#active_layer} method retrieves the active Layer.
114
- #
115
- # The default layer in SketchUp is layer 0.
116
- #
117
- # @example
118
- # model = Sketchup.active_model
119
- # layer = model.active_layer
120
- #
121
- # @return [Sketchup::Layer]
122
- #
123
- # @version SketchUp 6.0
124
- def active_layer
125
- end
126
-
127
- # The {#active_layer=} method sets the active {Sketchup::Layer} object.
128
- #
129
- # @example
130
- # model = Sketchup.active_model
131
- # layers = model.layers
132
- # layer = layers.add('My Layer')
133
- # model.active_layer = layer
134
- #
135
- # @param [Sketchup::Layer] layer
136
- # The layer to be set as the active layer.
137
- #
138
- # @return [Sketchup::Layer]
139
- #
140
- # @version SketchUp 6.0
141
- def active_layer=(layer)
142
- end
143
-
144
- # Returns an array containing the sequence of entities the user has
145
- # double-clicked on for editing. This allows one to determine whether they are
146
- # in component edit mode and where in the model they are.
147
- #
148
- # For example, if a user has double-clicked into a component to
149
- # edit its geometry, and then double clicked into a sub-group to edit that,
150
- # the active_path might contain:
151
- #
152
- # <code>[<Sketchup::ComponentInstance>, <Sketchup::Group>]</code>
153
- #
154
- # @example
155
- # active_path = Sketchup.active_model.active_path
156
- #
157
- # @return [Array<Sketchup::Drawingelement>, nil] array of entities showing where the user is
158
- # currently editing.
159
- #
160
- # @version SketchUp 7.0
161
- def active_path
162
- end
163
-
164
- # The {#active_path=} method is used to open a given instance path for editing.
165
- #
166
- # @example Open an instance
167
- # model = Sketchup.active_model
168
- # instance = model.active_entities.grep(Sketchup::ComponentInstance).first
169
- # instance_path = Sketchup::InstancePath.new([instance])
170
- # model.active_path = instance_path
171
- #
172
- # @example Close all instances
173
- # model = Sketchup.active_model
174
- # model.active_path = nil
175
- #
176
- # @note An instance path can only be opened if the instances are not locked.
177
- # This also include instances of the same component definition that are not
178
- # on the given path. A definition cannot be edited if any of its instances
179
- # are locked.
180
- #
181
- # @note Since changing the active entities in SketchUp also changes what
182
- # coordinate system is used, entities can't be modified in the same operation
183
- # as the active entities changes. The API handles this automatically by
184
- # starting and committing transparent operations as needed.
185
- #
186
- # If the API user tries to do this:
187
- #
188
- # model.start_operation('...', true)
189
- # model.active_entities.add_face(...)
190
- # model.active_path = instance_path
191
- # model.active_entities.add_face(...)
192
- # model.commit_operation
193
- #
194
- # Then SketchUp will automatically break it up to something like to this:
195
- #
196
- # model.start_operation('...', true)
197
- # model.active_entities.add_face(...)
198
- # model.commit_operation
199
- #
200
- # model.start_operation('...', true, false, true)
201
- # model.active_path = instance_path
202
- # model.commit_operation
203
- #
204
- # model.start_operation('...', true, false, true)
205
- # model.active_entities.add_face(...)
206
- # model.commit_operation
207
- #
208
- # For the end user this will be experienced as a single operation.
209
- #
210
- # For the API user the side-effect is multiple transaction notifications to
211
- # {Sketchup::ModelObserver}s.
212
- #
213
- # @param [Sketchup::InstancePath, Array<Sketchup::ComponentInstance, Sketchup::Group>, nil] instance_path
214
- # Passing +nil+ or an empty array will close all open instances.
215
- #
216
- # @raise [ArgumentError] if the instance path is not valid.
217
- #
218
- # @raise [ArgumentError] if the instance path contains locked instances.
219
- #
220
- # @raise [ArgumentError] if the instance path contains instances who's
221
- # siblings are locked.
222
- #
223
- # @raise [ArgumentError] if the instance path contains Live Components.
224
- #
225
- # @return [Sketchup::Model]
226
- #
227
- # @version SketchUp 2020.0
228
- def active_path=(instance_path)
229
- end
230
-
231
- # The {#active_view} method returns the active View object for this model.
232
- #
233
- # @example
234
- # model = Sketchup.active_model
235
- # view = model.active_view
236
- #
237
- # @return [Sketchup::View]
238
- #
239
- # @version SketchUp 6.0
240
- def active_view
241
- end
242
-
243
- # Add a text note to the Model. The position of the note is given as relative
244
- # window positions between 0 and 1. For example, the following command
245
- # would create a note that start 1/10 of the ways down the screen from the
246
- # upper left corner of the window.
247
- #
248
- # @example
249
- # model = Sketchup.active_model
250
- # # Add a note 1/10 ways down the screen and 1/10 ways right from the
251
- # # upper left corner of model window.
252
- # note = Sketchup.active_model.add_note('Hello World', 0.1, 0.1)
253
- #
254
- # @param [String] note
255
- # A string note.
256
- #
257
- # @param [Numeric] x
258
- # A distance along the x axis between 0 and 1.
259
- #
260
- # @param [Numeric] y
261
- # A distance along the y axis between 0 and 1.
262
- #
263
- # @return [Sketchup::Text] a note object or an exception if it is
264
- # unsuccessful.
265
- #
266
- # @version SketchUp 6.0
267
- def add_note(note, x, y)
268
- end
269
-
270
- # The add_observer method is used to add an observer to the current object.
271
- #
272
- # @example
273
- # model = Sketchup.active_model
274
- # observer = Sketchup::ModelObserver.new
275
- # status = model.add_observer(observer)
276
- #
277
- # @param [Object] observer
278
- # An observer.
279
- #
280
- # @return [Boolean] true if successful, false if unsuccessful.
281
- #
282
- # @version SketchUp 6.0
283
- def add_observer(observer)
284
- end
285
-
286
- # The {#attribute_dictionaries} method retrieves the AttributeDictionaries
287
- # object that is associated with the Model.
288
- #
289
- # @example
290
- # model = Sketchup.active_model
291
- # dictionaries = model.attribute_dictionaries
292
- # if dictionaries
293
- # # Code to do something if attribute dictionaries exist (usually you
294
- # # parse the array of dictionaries.
295
- # else
296
- # # Code to do something if attribute dictionaries do not exist.
297
- # end
298
- #
299
- # @return [Sketchup::AttributeDictionaries] the AttributeDictionaries
300
- # object associated with the entity, or nil if there are
301
- # no attribute_dictionary objects associated with the
302
- # model. Care must be taken if nil is returned, for
303
- # example: invoking attribute_dictionaries.length will
304
- # throw a NoMethodError exception, not return 0.
305
- #
306
- # @version SketchUp 6.0
307
- def attribute_dictionaries
308
- end
309
-
310
- # Returns the Sketchup::AttributeDictionary object that is specified by
311
- # name. If the model does not have an attribute dictionary that
312
- # corresponds to name, returns either nil, or a creates an attribute
313
- # dictionary. If the optional second argument is true, and there is no
314
- # attribute dictionary that corresponds to name, a new attribute
315
- # dictionary is created.
316
- #
317
- # @example
318
- # model = Sketchup.active_model
319
- # create_if_empty = true
320
- # dictionary = model.attribute_dictionary('name', create_if_empty)
321
- #
322
- # @param [String] name
323
- # The name of the dictionary you are attempting to
324
- # retrieve.
325
- #
326
- # @param [Boolean] create
327
- # if set to true an attribute dictionary of the
328
- # given "name" will be created if not found.
329
- #
330
- # @return [Sketchup::AttributeDictionary] an attribute dictionary object if
331
- # successful, nil if unsuccessful
332
- #
333
- # @version SketchUp 6.0
334
- def attribute_dictionary(name, create = false)
335
- end
336
-
337
- # The {#axes} method returns the drawing axes for the model.
338
- #
339
- # @example
340
- # # Point for a rectangle.
341
- # points = [
342
- # Geom::Point3d.new( 0, 0, 0),
343
- # Geom::Point3d.new(10, 0, 0),
344
- # Geom::Point3d.new(10, 20, 0),
345
- # Geom::Point3d.new( 0, 20, 0)
346
- # ]
347
- # # Transform the points so they are local to the model axes. Otherwise
348
- # # they would be local to the model origin.
349
- # tr = Sketchup.active_model.axes.transformation
350
- # points.each { |point| point.transform!(tr) }
351
- # Sketchup.active_model.active_entities.add_face(points)
352
- #
353
- # @return [Sketchup::Axes] the axes for the model.
354
- #
355
- # @version SketchUp 2016
356
- def axes
357
- end
358
-
359
- # The behavior method retrieves the behavior of the model.
360
- #
361
- # @example
362
- # model = Sketchup.active_model
363
- # behavior = model.behavior
364
- #
365
- # @return [Sketchup::Behavior] behavior object for the model if successful
366
- #
367
- # @version SketchUp 6.0
368
- def behavior
369
- end
370
-
371
- # The {#bounds} method is used to retrieve the {Geom::BoundingBox} bounding the
372
- # contents of a {Sketchup::Model}.
373
- #
374
- # @example
375
- # model = Sketchup.active_model
376
- # bounds = model.bounds
377
- #
378
- # @return [Geom::BoundingBox]
379
- #
380
- # @version SketchUp 6.0
381
- def bounds
382
- end
383
-
384
- # The {#classifications} method is used to retrieve the Classifications object
385
- # for this model.
386
- #
387
- # @example
388
- # model = Sketchup.active_model
389
- # c = model.classifications
390
- #
391
- # @return [Sketchup::Classifications] a Classifications object.
392
- #
393
- # @version SketchUp 2015
394
- def classifications
395
- end
396
-
397
- # The close method is used to close this model. On Mac OS, only the active
398
- # model can be closed. On Windows, since there can be only one document open,
399
- # this method will perform a File/New operation.
400
- #
401
- # @example
402
- # Sketchup.file_new
403
- # model = Sketchup.active_model
404
- # model.close
405
- #
406
- # @param [Boolean] ignore_changes
407
- # If true, model changes will be
408
- # ignored and save prompts will be suppressed.
409
- # If false, changes will not be ignored and save
410
- # prompts will be displayed normally.
411
- #
412
- # @return [nil]
413
- #
414
- # @version SketchUp 2015
415
- def close(ignore_changes = false)
416
- end
417
-
418
- # The {#close_active} method is used to close the currently active (open) group
419
- # or component.
420
- #
421
- # @example
422
- # model = Sketchup.active_model
423
- # status = model.close_active
424
- #
425
- # @note Before SketchUp 2014 this method had a bug where it didn't create an
426
- # undo operation and that could lead to corrupted geometry when undo/redo was
427
- # used after invoking this method.
428
- #
429
- # @return [Boolean] true if successful, false if unsuccessful.
430
- #
431
- # @version SketchUp 6.0
432
- def close_active
433
- end
434
-
435
- # The commit_operation method commits an operation for undo.
436
- #
437
- # The commit_operation method is normally called at the end of a method to
438
- # commit the operation that the method performs.
439
- #
440
- # @example
441
- # status = model.commit_operation
442
- #
443
- # @return [Boolean] true if successful, false if unsuccessful
444
- #
445
- # @version SketchUp 6.0
446
- def commit_operation
447
- end
448
-
449
- # The {#definitions} method retrieves a definition list containing all of the
450
- # component definitions in the model.
451
- #
452
- # @example
453
- # model = Sketchup.active_model
454
- # definitions = model.definitions
455
- #
456
- # @return [Sketchup::DefinitionList]
457
- #
458
- # @version SketchUp 6.0
459
- def definitions
460
- end
461
-
462
- # The description method retrieves a description of the model as found in the
463
- # Model Info > Files panel.
464
- #
465
- # The returned description can be empty. The default description for all models
466
- # is empty.
467
- #
468
- # @example
469
- # model = Sketchup.active_model
470
- # description = model.description
471
- #
472
- # @return [String] a description if successful.
473
- #
474
- # @version SketchUp 6.0
475
- def description
476
- end
477
-
478
- # The {#description=} method sets the description of the model.
479
- #
480
- # @example
481
- # model = Sketchup.active_model
482
- # description = model.description = "This is a model of a house on the " <<
483
- # "North West Corner of 10th and Dolores Street in Carmel, California"
484
- #
485
- # @param [String] description
486
- # the description string to be set.
487
- #
488
- # @return [String]
489
- #
490
- # @version SketchUp 6.0
491
- def description=(description)
492
- end
493
-
494
- # The {#drawing_element_visible?} method reports whether the given drawing
495
- # element in an instance path is visible given the current model options.
496
- #
497
- # @example Traversing every visible entity in the model
498
- # module Example
499
- #
500
- # def self.instance?(entity)
501
- # entity.is_a?(Sketchup::ComponentInstance) || entity.is_a?(Sketchup::Group)
502
- # end
503
- #
504
- # # Walk the visible entities in the model, taking into account
505
- # # "DrawHiddenGeometry" and "DrawHiddenObjects" rendering options.
506
- # def self.walk(entities, transformation = IDENTITY, path = [], &block)
507
- # entities.each { |entity|
508
- # entity_path = path + [entity]
509
- # next unless entity.model.drawing_element_visible?(entity_path)
510
- # block.call(entity, transformation, path)
511
- # if instance?(entity)
512
- # child_entities = entity.definition.entities
513
- # child_transformation = transformation * entity.transformation
514
- # walk(child_entities, child_transformation, entity_path, &block)
515
- # end
516
- # }
517
- # end
518
- #
519
- # end
520
- #
521
- # model = Sketchup.active_model
522
- # Example.walk(model.entities) do |entity, transformation, path|
523
- # # Do something to every visible entity in the model...
524
- # end
525
- #
526
- # @param [Sketchup::InstancePath, Array<Sketchup::Drawingelement>] instance_path
527
- #
528
- # @raise [ArgumentError] if the +instance_path+ is not valid.
529
- #
530
- # @return [Boolean]
531
- #
532
- # @see Sketchup::RenderingOptions
533
- #
534
- # @see Sketchup::Drawingelement#visible?
535
- #
536
- # @see Sketchup::Layer#visible?
537
- #
538
- # @version SketchUp 2020.0
539
- def drawing_element_visible?(instance_path)
540
- end
541
-
542
- # Returns the transformation of the current component edit session. If a user
543
- # has double-clicked to edit a component's geometry, this will
544
- # return the transformation of that component, relative to its parent's
545
- # origin. This allows one to correctly calculate "local" transformations of
546
- # a given entity regardless of whether the user is in edit mode.
547
- #
548
- # @example
549
- # Sketchup.active_model.edit_transform
550
- #
551
- # @return [Geom::Transformation] the current edit Transformation
552
- #
553
- # @version SketchUp 7.0
554
- def edit_transform
555
- end
556
-
557
- # The {#entities} method returns an {Sketchup::Entities} object containing the
558
- # entities in the root of model.
559
- #
560
- # @example
561
- # model = Sketchup.active_model
562
- # entities = model.entities
563
- #
564
- # @note This does not return a collection of all the entities in the model,
565
- # only the top level node of the model hierarchy. To get to all entities in
566
- # a model you must recursivly traverse the model.
567
- #
568
- # @return [Sketchup::Entities] an Entities object if successful
569
- #
570
- # @version SketchUp 6.0
571
- def entities
572
- end
573
-
574
- # The export method is used to export a given file format. It knows which
575
- # format to export based on the file extension you place on the file name.
576
- # For example, a filename of "thing.obj" will export an OBJ file, whereas
577
- # "thing.dae" will export a COLLADA file.
578
- #
579
- # For SketchUp Pro 7.1+, valid extensions include dae, kmz, 3ds, dwg,
580
- # dxf, fbx, obj, wrl, and xsi. SketchUp Free only supports dae and kmz.
581
- #
582
- # Format Support Changes:
583
- # * SketchUp 7.1 added COLLADA (.dae) export capability.
584
- # * SketchUp Pro 2015+ added IFC export capability.
585
- # * SketchUp Pro 2016+ added PDF export capability.
586
- # * SketchUp Pro 2018+ added options for all 3D exporters.
587
- #
588
- # See the {file:pages/exporter_options.md Exporter Options} file for information
589
- # on creating a valid hash for the various exporters.
590
- #
591
- # @example General use
592
- # model = Sketchup.active_model
593
- # show_summary = true
594
- #
595
- # # Export dwg file on a PC, showing a summary when complete.
596
- # status = model.export('c:\my_export.dwg', show_summary)
597
- #
598
- # # Export kmz file on Mac (note the absolute file path), without summary.
599
- # status = model.export('/Library/my_export.kmz')
600
- #
601
- # # Export pdf file on a PC, showing a summary when complete.
602
- # options_hash = { :show_summary => true,
603
- # :output_profile_lines => false,
604
- # :map_fonts => false,
605
- # :model_units => Length::Meter }
606
- # status = model.export('c:/my_export.pdf', options_hash)
607
- #
608
- # # Or for a COLLADA (.dae) file.
609
- # options_hash = { :triangulated_faces => true,
610
- # :doublesided_faces => true,
611
- # :edges => false,
612
- # :author_attribution => false,
613
- # :texture_maps => true,
614
- # :selectionset_only => false,
615
- # :preserve_instancing => true }
616
- # status = model.export('c:/my_export.dae', options_hash)
617
- #
618
- # @example IFC Example
619
- # model = Sketchup.active_model
620
- # # If no IFC types are passed in, then no geometry will be exported.
621
- # options_hash = { :hidden_geometry => true,
622
- # :ifc_mapped_items => true,
623
- # :ifc_types => ['IfcBuilding', 'IfcDoor']}
624
- # status = model.export('c:/my_export.ifc', options_hash)
625
- #
626
- # @overload export(path, show_summary = false)
627
- #
628
- # @param [String] path The name of the file to export.
629
- # @param [Boolean] show_summary Boolean to show summary dialog.
630
- # @return [Boolean]
631
- #
632
- # @overload export(path, options)
633
- #
634
- # @param [String] path The path to save the export at.
635
- # @param [Hash] options
636
- # @return [Boolean]
637
- #
638
- # @raise [ArgumentError] If the file extension is unsupported.
639
- #
640
- # @version SketchUp 6.0
641
- def export(*args)
642
- end
643
-
644
- # Finds and returns entities by their entityID or GUID.
645
- #
646
- # GUIDs looked up are only relevant to Group and ComponentInstance as these
647
- # GUIDs are persistent. ComponentDefinition and Model GUIDs are not persistent
648
- # and are not looked up.
649
- #
650
- # When given an array of IDs, an array is returned with a 1:1 mapping to the
651
- # input arguments. This array may contain nil values if some ids were not
652
- # found. You cannot look up a mix of entityIDs and GUIDs in the same call.
653
- #
654
- # @example
655
- # model = Sketchup.active_model
656
- #
657
- # # Look up by entityID.
658
- # entity_id = model.entities.add_line([0,0,0], [9,9,9]).entityID
659
- # entity = model.find_entity_by_id(entity_id)
660
- #
661
- # # Look up by GUID.
662
- # guid = model.entities.add_group.guid
663
- # entity = model.find_entity_by_id(guid)
664
- #
665
- # # Look up multiple.
666
- # entities = model.find_entity_by_id(id1, id2, id3)
667
- # entities = model.find_entity_by_id([id1, id2, id3])
668
- # entities = model.find_entity_by_id(guid1, guid2, guid3)
669
- # entities = model.find_entity_by_id([guid1, guid2, guid3])
670
- #
671
- # @param [Array<Integer, String>] ids_or_array
672
- # Pass either a series of ids or a single array containing
673
- # ids. Ids must either be entityID Integers or GUID
674
- # Strings.
675
- #
676
- # @return [Array<Sketchup::Entity, nil>] Returns an array with Entity objects for each id
677
- # found and nil otherwise. Single Entity or nil when
678
- # called with a single id.
679
- #
680
- # @version SketchUp 2015
681
- def find_entity_by_id(ids_or_array)
682
- end
683
-
684
- # Finds and returns entities by their persistent id.
685
- #
686
- # When given an array of IDs, an array is returned with a 1:1 mapping to the
687
- # input arguments. This array may contain `nil` values if some ids were not
688
- # found.
689
- #
690
- # @example
691
- # model = Sketchup.active_model
692
- #
693
- # # Look up by persistent_id.
694
- # pid = model.entities.add_line([0,0,0], [9,9,9]).persistent_id
695
- # entity = model.find_entity_by_persistent_id(pid)
696
- #
697
- # # Look up multiple.
698
- # entities = model.find_entity_by_persistent_id(id1, id2, id3)
699
- # entities = model.find_entity_by_persistent_id([id1, id2, id3])
700
- #
701
- # @example Limit search by scope
702
- # model = Sketchup.active_model
703
- # edge_pid = model.entities.add_line([0,0,0], [9,9,9]).persistent_id
704
- # layer_pid = model.layers.add('Hello World').persistent_id
705
- #
706
- # # Search in all scopes:
707
- # entities = model.find_entity_by_persistent_id(edge_pid, layer_pid)
708
- # # => [#<Sketchup::Edge:0x000002567da4a8f0>, #<Sketchup::Layer:0x000002567da49e50>]
709
- #
710
- # # Search in layer scope:
711
- # entities = model.find_entity_by_persistent_id(edge_pid, layer_pid, layers: true)
712
- # # => [nil, #<Sketchup::Layer:0x000002567da49e50>]
713
- #
714
- # @overload find_entity_by_persistent_id(ids_or_array)
715
- #
716
- # @param [Array<Integer>] ids_or_array Pass either a series of ids or a
717
- # single array containing persistent ids.
718
- #
719
- # @return [Array<Sketchup::Entity, nil>] Returns an array with
720
- # {Sketchup::Entity} objects for each id found and nil otherwise.
721
- #
722
- # @overload find_entity_by_persistent_id(ids_or_array, **scope)
723
- #
724
- # @version SketchUp 2020.2
725
- # @param [Array<Integer>] ids_or_array Pass either a series of ids or a
726
- # single array containing persistent ids.
727
- # @param [Hash<Symbol, Boolean>] scope Limit the scope of the search to the
728
- # given scope categories.
729
- # @option [Boolean] scope :entities Search entities parent to
730
- # {Sketchup::Entities}.
731
- # @option [Boolean] scope :layers Search {Sketchup::Layers} for
732
- # {Sketchup::Layer} entities.
733
- # @option [Boolean] scope :layer_folders Search {Sketchup::Layers} for
734
- # {Sketchup::LayerFolder} entities.
735
- # @option [Boolean] scope :materials Search {Sketchup::Materials} for
736
- # {Sketchup::Material} entities.
737
- # @option [Boolean] scope :pages Search {Sketchup::Pages} for
738
- # {Sketchup::Page} entities.
739
- # @option [Boolean] scope :styles Search {Sketchup::Styles} for
740
- # {Sketchup::Style} entities.
741
- # @option [Boolean] scope :definitions Search {Sketchup::DefinitionList} for
742
- # {Sketchup::ComponentDefinition} entities.
743
- #
744
- # @return [Array<Sketchup::Entity, nil>] Returns an array with
745
- # {Sketchup::Entity} objects for each id found and nil otherwise.
746
- #
747
- # @version SketchUp 2017
748
- def find_entity_by_persistent_id(*args)
749
- end
750
-
751
- # This methods determines if the model is georeferenced.
752
- #
753
- # @example
754
- # if model.georeferenced?
755
- # UI.messagebox('This model is georeferenced.')
756
- # else
757
- # UI.messagebox('This model is NOT georeferenced.')
758
- # end
759
- #
760
- # @return [Boolean]
761
- #
762
- # @version SketchUp 7.1
763
- def georeferenced?
764
- end
765
-
766
- # The get_attribute method gets the value of an attribute that in the
767
- # AttributeDictionary with the given name. If no value is associated
768
- # with key, or if the model does not have an attribute dictionary
769
- # specified by name, the optional third parameter will be returned.
770
- #
771
- # @example
772
- # model = Sketchup.active_model
773
- # model.set_attribute('testdictionary', 'test', 115)
774
- # value = model.get_attribute('testdictionary', 'test', 42)
775
- #
776
- # @param [String] dictname
777
- # The name of the dictionary containing the value.
778
- #
779
- # @param [String] key
780
- # The key containing the value.
781
- #
782
- # @param [Object] defaultvalue
783
- # default value that will be returned if a
784
- # value does not exist.
785
- #
786
- # @return [Object, nil] the value for a given key in the given
787
- # dictionary if a value exists; the default value if a
788
- # defaultvalue is provided and the value does not exist;
789
- # nil if the value does not exist and no defaultvalue is
790
- # provided.
791
- #
792
- # @version SketchUp 6.0
793
- def get_attribute(dictname, key, defaultvalue = nil)
794
- end
795
-
796
- # the get_datum method retrieves the datum, in the form of a string, used in
797
- # UTM conversions.
798
- #
799
- # @example
800
- # model = Sketchup.active_model
801
- # datum = model.get_datum
802
- #
803
- # @return [String] a datum represented as a string if successful.
804
- #
805
- # @version SketchUp 6.0
806
- def get_datum
807
- end
808
-
809
- # Returns a value which indicates the product family of the installed SketchUp
810
- # application.
811
- # As of SketchUp 2013, the return values are:
812
- # - +0+ = Unknown
813
- # - +1+ = Pro Trial
814
- # - +2+ = Pro
815
- # - +3+ = Pro Expired
816
- # - +4+ = Make Trial
817
- # - +5+ = Make Expired
818
- # - +6+ = Make
819
- # - +7+ = Pro License Unavailable
820
- #
821
- # The Model class defines some of these values as constants as of SketchUp
822
- # 2016.
823
- #
824
- # @example
825
- # model = Sketchup.active_model
826
- # product_family = model.get_product_family
827
- # if product_family == Sketchup::Model::ProLicensed then
828
- # puts "You are running licensed SketchUp Pro!"
829
- # end
830
- #
831
- # @return [Integer] the product family number.
832
- #
833
- # @version SketchUp 6.0
834
- def get_product_family
835
- end
836
-
837
- # The guid method retrieves the globally unique identifier, in the form of a
838
- # string, for the Model. The guid will change after the model is modified and
839
- # saved. The Model guid is stored with the SketchUp file; it will not change if the
840
- # file is moved to another computer.
841
- #
842
- # @example
843
- # model = Sketchup.active_model
844
- # guid = model.guid
845
- #
846
- # @return [String] a globally unique identifier, in the form of a
847
- # string, for the model
848
- #
849
- # @version SketchUp 6.0
850
- def guid
851
- end
852
-
853
- # The import method is used to load a file by recognizing the file extension
854
- # and calling appropriate importer.
855
- #
856
- # See {Sketchup::DefinitionList#import} for importing a 3d model file as a
857
- # component definition, without activating the UI for placing an instance.
858
- #
859
- # See the {file:pages/importer_options.md Importer Options} file for information
860
- # on creating a valid hash for the various importers.
861
- #
862
- # @example Import for SketchUp 2017 and older
863
- # model = Sketchup.active_model
864
- # show_summary = true
865
- # status = model.import("filename", show_summary)
866
- #
867
- # @example Import for SketchUp 2018+ and newer
868
- # model = Sketchup.active_model
869
- # options = { :units => "model",
870
- # :merge_coplanar_faces => true,
871
- # :show_summary => true }
872
- # status = model.import("filename", options)
873
- #
874
- # @overload import(path, options)
875
- #
876
- # @param [String] path The input file path.
877
- # @param [Hash] options The options.
878
- # @return [Boolean]
879
- #
880
- # @overload import(path, show_summary = false)
881
- #
882
- # @note This variant is for SketchUp 2017 and earlier.
883
- # @param [String] path The input file path.
884
- # @param [Boolean] show_summary Show the summary dialog.
885
- # @return [Boolean]
886
- #
887
- # @version SketchUp 6.0
888
- def import(*args)
889
- end
890
-
891
- # The {#instance_path_from_pid_path} method returns a instance path given a
892
- # string with persistent ids representing the path to the entity.
893
- #
894
- # @example
895
- # points = [
896
- # Geom::Point3d.new( 0, 0, 0),
897
- # Geom::Point3d.new(10, 0, 0),
898
- # Geom::Point3d.new(10, 20, 0),
899
- # Geom::Point3d.new( 0, 20, 0)
900
- # ]
901
- # model = Sketchup.active_model
902
- # entities = model.active_entities
903
- # group = entities.add_group
904
- # face = group.entities.add_face(points)
905
- # pid_path = "#{group.persistent_id}.#{face.persistent_id}"
906
- # # pid_path will look something like this: "658.723"
907
- # instance_path = model.instance_path_from_pid_path(pid_path)
908
- #
909
- # @param [String] pid_path
910
- # a string with persistent ids delimited by period.
911
- #
912
- # @raise [ArgumentError] if a valid instance path cannot be created from the
913
- # given input path string.
914
- #
915
- # @return [Sketchup::InstancePath]
916
- #
917
- # @see Sketchup::InstancePath#persistent_id_path
918
- #
919
- # @version SketchUp 2017
920
- def instance_path_from_pid_path(pid_path)
921
- end
922
-
923
- # The latlong_to_point method converts a latitude and longitude to a Point3d
924
- # object in the model. It does not actually work with a LatLong object, but
925
- # operates on a 2-element array. The returned point will always be on the
926
- # ground (z=0).
927
- #
928
- # @example
929
- # # Draw a point in Boulder, Colorado (40.0170N, 105.2830W)
930
- # lnglat_array = [-105.28300, 40.01700]
931
- # model = Sketchup.active_model
932
- # local_point = model.latlong_to_point(lnglat_array)
933
- # model.entities.add_cpoint(local_point)
934
- #
935
- # @param [Array(Numeric, Numeric)] lnglat_array
936
- # A 2-element array containing first the longitude then
937
- # the latitude.
938
- #
939
- # @return [Geom::Point3d] a point3d object if successful, false if
940
- # unsuccessful.
941
- #
942
- # @version SketchUp 6.0
943
- def latlong_to_point(lnglat_array)
944
- end
945
-
946
- # The {#layers} method retrieves a collection of all {Sketchup::Layers} objects
947
- # in the model.
948
- #
949
- # @example
950
- # model = Sketchup.active_model
951
- # layers = model.layers
952
- #
953
- # @return [Sketchup::Layers] a Layers object containing a collection of
954
- # layers in the model
955
- #
956
- # @version SketchUp 6.0
957
- def layers
958
- end
959
-
960
- # The {#line_styles} method returns the line styles manager.
961
- #
962
- # @example
963
- # line_styles = Sketchup.active_model.line_styles
964
- #
965
- # @return [Sketchup::LineStyles] The line styles manager.
966
- #
967
- # @version SketchUp 2019
968
- def line_styles
969
- end
970
-
971
- # This method retrieves an Array of all of the datums recognized by SketchUp.
972
- #
973
- # @example
974
- # model = Sketchup.active_model
975
- # datums = model.list_datums
976
- #
977
- # @return [Array<String>] An Array object containing the datums
978
- # supported by SketchUp
979
- #
980
- # @version SketchUp 6.0
981
- def list_datums
982
- end
983
-
984
- # The {#materials} method returns a collection of all of the materials in the
985
- # model.
986
- #
987
- # @example
988
- # model = Sketchup.active_model
989
- # materials = model.materials
990
- #
991
- # @return [Sketchup::Materials]
992
- #
993
- # @version SketchUp 6.0
994
- def materials
995
- end
996
-
997
- # This method can be used to turn mipmapping on or off.
998
- #
999
- # @example
1000
- # Sketchup.active_model.mipmapping = false
1001
- #
1002
- # @param [Boolean] mipmap
1003
- # whether mipmapping is turned on or off.
1004
- #
1005
- # @return [Boolean] the new mipmapping setting
1006
- #
1007
- # @version SketchUp 7.0
1008
- def mipmapping=(mipmap)
1009
- end
1010
-
1011
- # This method can be used to find out if mipmapping is on or off.
1012
- #
1013
- # @example
1014
- # mipmapping = Sketchup.active_model.mipmapping?
1015
- #
1016
- # @return [Boolean]
1017
- #
1018
- # @version SketchUp 7.0
1019
- def mipmapping?
1020
- end
1021
-
1022
- # The modified? method determines if the Model has been modified since the
1023
- # last save.
1024
- #
1025
- # @example
1026
- # model = Sketchup.active_model
1027
- # entities = model.active_entities
1028
- # # Add a group to force the status return value to be true
1029
- # entities.add_group
1030
- # status = model.modified?
1031
- #
1032
- # @return [Boolean]
1033
- #
1034
- # @version SketchUp 6.0
1035
- def modified?
1036
- end
1037
-
1038
- # The {#name} method retrieves the name of the model.
1039
- #
1040
- # This property can be seen in Model Info and maps to the component
1041
- # name if the model is inserted into another model. This property should not
1042
- # be confused with the model {#path}.
1043
- #
1044
- # @example
1045
- # model = Sketchup.active_model
1046
- # name = model.name
1047
- #
1048
- # @return [String] string name of the model
1049
- #
1050
- # @version SketchUp 6.0
1051
- def name
1052
- end
1053
-
1054
- # The {#name=} method sets the string name of the model.
1055
- #
1056
- # @example
1057
- # Sketchup.active_model.name = "My New Model Name"
1058
- #
1059
- # @param [String] name
1060
- #
1061
- # @version SketchUp 6.0
1062
- def name=(name)
1063
- end
1064
-
1065
- # Returns the number faces in a model.
1066
- #
1067
- # @example
1068
- # model = Sketchup.active_model
1069
- # number_of_faces = model.number_faces
1070
- # puts "There are #{number_of_faces} faces in the model."
1071
- #
1072
- # @return [Integer]
1073
- #
1074
- # @version SketchUp 7.1
1075
- def number_faces
1076
- end
1077
-
1078
- # The {#options} method retrieves the options manager that defines the options
1079
- # settings for the model.
1080
- #
1081
- # Use the string keys instead of numerical indicies when accessing the options
1082
- # as the indicies are not consistent between SketchUp versions.
1083
- #
1084
- # @example
1085
- # # Output all options available.
1086
- # options_manager = Sketchup.active_model.options
1087
- # options_manager.each { |options_provider|
1088
- # puts options_provider.name
1089
- # options_provider.each { |key, value|
1090
- # puts "> #{key} - #{value}"
1091
- # }
1092
- # }
1093
- #
1094
- # @return [Sketchup::OptionsManager]
1095
- #
1096
- # @version SketchUp 6.0
1097
- def options
1098
- end
1099
-
1100
- #
1101
- # @api Overlays
1102
- #
1103
- # @example
1104
- # Sketchup.active_model.overlays.each { |overlay|
1105
- # puts "#{overlay.name} (#{overlay.overlay_id}) Enabled: #{overlay.enabled?}"
1106
- # }
1107
- #
1108
- # @return [Sketchup::OverlaysManager]
1109
- #
1110
- # @version SketchUp 2023.0
1111
- def overlays
1112
- end
1113
-
1114
- # The {#pages} method retrieves a {Sketchup::Pages} object containing all of
1115
- # the pages in the model.
1116
- #
1117
- # @example
1118
- # model = Sketchup.active_model
1119
- # pages = model.pages
1120
- #
1121
- # @return [Sketchup::Pages]
1122
- #
1123
- # @version SketchUp 6.0
1124
- def pages
1125
- end
1126
-
1127
- # The path method retrieves the path of the file from which the model was
1128
- # opened.
1129
- #
1130
- # An empty string is returned for a model that has not been saved.
1131
- #
1132
- # @example
1133
- # model = Sketchup.active_model
1134
- # path = model.path
1135
- #
1136
- # @return [String]
1137
- #
1138
- # @version SketchUp 6.0
1139
- def path
1140
- end
1141
-
1142
- # The place_component method places a new component in the Model using the
1143
- # component placement tool.
1144
- #
1145
- # @example
1146
- # model.place_component componentdefinition, repeat
1147
- #
1148
- # @param [Sketchup::ComponentDefinition] componentdef
1149
- # A component definition object containing the
1150
- # definition (blueprint) for the component.
1151
- #
1152
- # @param [Boolean] repeat
1153
- # If set to true, stay in the component
1154
- # placement tool and place multiple components.
1155
- #
1156
- # @return [Sketchup::Model, nil] The model object on success or Nil
1157
- #
1158
- # @version SketchUp 6.0
1159
- def place_component(componentdef, repeat = false)
1160
- end
1161
-
1162
- # The point_to_latlong method converts a point in the model to a LatLong so
1163
- # that you can get its latitude and longitude.
1164
- #
1165
- # This method uses the location information set in ShadowInfo.
1166
- #
1167
- # NOTE: SketchUp 6.0 and higher has a change where this method returns a
1168
- # Point3d instead of a LatLong, where the x and y values contain the LatLong
1169
- # coordinates.
1170
- #
1171
- # @example
1172
- # model = Sketchup.active_model
1173
- # local_point = Geom::Point3d.new(10, 10, 10)
1174
- # world_point = model.point_to_latlong(local_point)
1175
- #
1176
- # @param [Geom::Point3d] point
1177
- # A Point3d object.
1178
- #
1179
- # @return [Geom::Point3d, Geom::LatLong] a LatLong or Point3d object. See
1180
- # details for information.
1181
- #
1182
- # @version SketchUp 6.0
1183
- def point_to_latlong(point)
1184
- end
1185
-
1186
- # This method converts a Point3d object in the Model to UTM coordinates.
1187
- #
1188
- # This method uses the location information set in ShadowInfo. See also UTM.
1189
- #
1190
- # @example
1191
- # model = Sketchup.active_model
1192
- # point = Geom::Point3d.new(10, 10, 10)
1193
- # utm = model.point_to_utm(point)
1194
- #
1195
- # @param [Geom::Point3d] point
1196
- # A Point3d object.
1197
- #
1198
- # @return [Geom::UTM] a UTM object
1199
- #
1200
- # @version SketchUp 6.0
1201
- def point_to_utm(point)
1202
- end
1203
-
1204
- # The raytest method is used to cast a ray (line) through the model and return
1205
- # the first thing that the ray hits.
1206
- #
1207
- # A ray is a two element array containing a point and a vector
1208
- # [Geom::Point3d(), Geom::Vector3d()]. The point defines the start point of
1209
- # the ray and the vector defines the direction. If direction can not be
1210
- # normalized (e.g. direction = [0, 0, 0]), direction is taken as a point the
1211
- # ray intersects.
1212
- #
1213
- # first value is a Point3d where the item that the ray passed through exists. The second element is
1214
- # the instance path array of the entity that the ray hit. For example, if the ray hits a face that
1215
- # is contained by a component instance the instance path would be [Component1]. If the ray hit a
1216
- # face that is contained by a component instance, which
1217
- # is contained by another component instance and so on,
1218
- # the instance path would be [Component1, Component2,
1219
- # Component3...].
1220
- #
1221
- # @example
1222
- # model = Sketchup.active_model
1223
- # ray = [Geom::Point3d.new(1, 2, 3), Geom::Vector3d.new(4, 5, 6)]
1224
- # item = model.raytest(ray, false) # Consider hidden geometry when
1225
- # # computing intersections.
1226
- #
1227
- # @note The parameter wysiwyg_flag was added in SU8 M1.
1228
- #
1229
- # @param [Array(Geom::Point3d, Geom::Vector3d)] ray
1230
- # A two element array containing a point and a vector.
1231
- #
1232
- # @param [Boolean] wysiwyg_flag
1233
- # An optional boolean, added in SU8 M1, indicating
1234
- # whether or not to consider hidden geometry in intersect
1235
- # computations. If this flag is not specified, it
1236
- # defaults to true (WYSIWYG) - i.e. hidden geometry is
1237
- # not intersected against.
1238
- #
1239
- # @return [Array(Geom::Point3d, Array<Sketchup::Drawingelement>), nil] an array of two values. The
1240
- #
1241
- # @version SketchUp 6.0
1242
- def raytest(ray, wysiwyg_flag = true)
1243
- end
1244
-
1245
- # The remove_observer method is used to remove an observer from the current
1246
- # object.
1247
- #
1248
- # @example
1249
- # model = Sketchup.active_model
1250
- # observer = Sketchup::ModelObserver.new
1251
- # model.add_observer(observer)
1252
- # status = model.remove_observer(observer)
1253
- #
1254
- # @param [Object] observer
1255
- # An observer.
1256
- #
1257
- # @return [Boolean] true if successful, false if unsuccessful.
1258
- #
1259
- # @version SketchUp 6.0
1260
- def remove_observer(observer)
1261
- end
1262
-
1263
- # The {#rendering_options} method retrieves the RenderingOptions object for
1264
- # this model.
1265
- #
1266
- # @example
1267
- # model = Sketchup.active_model
1268
- # renderingoptions = model.rendering_options
1269
- #
1270
- # @return [Sketchup::RenderingOptions]
1271
- #
1272
- # @version SketchUp 6.0
1273
- def rendering_options
1274
- end
1275
-
1276
- # This method is used to save the model to a file.
1277
- #
1278
- # @example
1279
- # model = Sketchup.active_model
1280
- # # Save the model using the current SketchUp format
1281
- # path = File.join(ENV['HOME'], 'Desktop', 'mysketchup.skp')
1282
- # status = model.save(path)
1283
- #
1284
- # # Save the model to the current file using the current SketchUp format
1285
- # status = model.save
1286
- #
1287
- # # Save the model to the current file in SketchUp 8 format
1288
- # status = model.save("", Sketchup::Model::VERSION_8)
1289
- #
1290
- # # Save the model in SketchUp 8 format
1291
- # path = File.join(ENV['Home'], 'Desktop', 'mysketchup_v8.skp')
1292
- # status = model.save(path, Sketchup::Model::VERSION_8)
1293
- #
1294
- # @note A bug in SketchUp 2016 and older caused the +.skb+ backup file
1295
- # written during save to be empty. The +.skp+ file was however valid.
1296
- #
1297
- # @note Starting with SketchUp 2021, SketchUp is using a the same file format across versions.
1298
- # For instance, SketchUp 2021 can open a file made in SketchUp 2022.
1299
- #
1300
- # @overload save
1301
- #
1302
- # Save model to the path it is already associated with.
1303
- # @raise ArgumentError if the model is not previosly saved.
1304
- # @version SketchUp 2014
1305
- #
1306
- # @overload save(path)
1307
- #
1308
- # Save the model to a given path.
1309
- # @version SketchUp 6.0
1310
- # @param [String] path
1311
- # If empty, the model saves to the path it is already associated with.
1312
- #
1313
- # @overload save(path, version)
1314
- #
1315
- # Save the model as a specific SketchUp file version to a given path.
1316
- # @version SketchUp 2014
1317
- # @param [String] path
1318
- # @param [Integer] version
1319
- # Possible values are:
1320
- # - Sketchup::Model::VERSION_3,
1321
- # - Sketchup::Model::VERSION_4,
1322
- # - Sketchup::Model::VERSION_5,
1323
- # - Sketchup::Model::VERSION_6,
1324
- # - Sketchup::Model::VERSION_7,
1325
- # - Sketchup::Model::VERSION_8,
1326
- # - Sketchup::Model::VERSION_2013,
1327
- # - Sketchup::Model::VERSION_2014,
1328
- # - Sketchup::Model::VERSION_2015,
1329
- # - Sketchup::Model::VERSION_2016,
1330
- # - Sketchup::Model::VERSION_2017,
1331
- # - Sketchup::Model::VERSION_2018,
1332
- # - Sketchup::Model::VERSION_2019,
1333
- # - Sketchup::Model::VERSION_2020,
1334
- # - Sketchup::Model::VERSION_2021
1335
- #
1336
- # @return [Boolean] +true+ if successful, +false+ if unsuccessful
1337
- def save(*args)
1338
- end
1339
-
1340
- # This method is used to save the copy of the current model to a file.
1341
- #
1342
- # @example
1343
- # model = Sketchup.active_model
1344
- # # Save copy of the model using the current SketchUp format
1345
- # path = File.join(ENV['Home'], 'Desktop', 'myModelCopy.skp')
1346
- # status = model.save_copy(path)
1347
- #
1348
- # # Save copy of the model in SketchUp 8 format
1349
- # path = File.join(ENV['Home'], 'Desktop', 'mysketchupcopy_v8.skp')
1350
- # status = model.save_copy(path, Sketchup::Model::VERSION_8)
1351
- #
1352
- # @param [String] path
1353
- # The path of the file to save the model copy to.
1354
- #
1355
- # @param [Integer] version
1356
- # See {Sketchup::Model#save} for supported values.
1357
- #
1358
- # @return [Boolean] true if successful, false if unsuccessful
1359
- #
1360
- # @version SketchUp 2014
1361
- def save_copy(path, version)
1362
- end
1363
-
1364
- # The save_thumbnail method is used to save a thumbnail image to a file.
1365
- # The image format is specified by the file extension of filename. Supported
1366
- # formats are bmp, jpg, png, tif, pct, and gif.
1367
- #
1368
- # @example
1369
- # model = Sketchup.active_model
1370
- # status = model.save_thumbnail('testthumbnail2.jpg')
1371
- #
1372
- # @param [String] filename
1373
- # The name of the file, with extension, to save the
1374
- # thumbnail as.
1375
- #
1376
- # @return [Boolean] true if successful, false if unsuccessful
1377
- #
1378
- # @version SketchUp 6.0
1379
- def save_thumbnail(filename)
1380
- end
1381
-
1382
- # This method is used to select a SketchUp Tool object s the active tool. You
1383
- # must implement the SketchUp Tool interface to create a tool prior to calling
1384
- # this method.
1385
- #
1386
- # The select tool is activated if you pass nil to the select_tool method. You
1387
- # must implement the SketchUp Tool interface to create a tool, prior to calling
1388
- # this method, and then instance the tool implementation and pass the object to
1389
- # this method. If you attempt to set the select_tool to nil in the initialize
1390
- # method of a tool you have written, it will be ignored.
1391
- #
1392
- # @example
1393
- # model = Sketchup.active_model
1394
- # tool = model.select_tool(nil)
1395
- #
1396
- # @param [Object] tool
1397
- # The Tool object you want to select.
1398
- #
1399
- # @return [Sketchup::Model] The Model object.
1400
- #
1401
- # @version SketchUp 6.0
1402
- def select_tool(tool)
1403
- end
1404
-
1405
- # This method retrieves a Selection object for the model, containing the
1406
- # currently selected entities. The entries in the selection list are not
1407
- # necessarily in the same order in which the user selected them.
1408
- #
1409
- # @example
1410
- # model = Sketchup.active_model
1411
- # selection = model.selection
1412
- #
1413
- # @return [Sketchup::Selection] A Selection object with 0 or more entities
1414
- # that are currently selected.
1415
- #
1416
- # @version SketchUp 6.0
1417
- def selection
1418
- end
1419
-
1420
- # This method is used to set the value of an attribute in an attribute
1421
- # dictionary with the given name.
1422
- #
1423
- # This method can be used create a new AttributeDictionary object, if needed.
1424
- #
1425
- # @example
1426
- # model = Sketchup.active_model
1427
- # value = model.set_attribute('attributedictionaryname', 'key', 'value')
1428
- #
1429
- # @param [String] attrdictname
1430
- # The name of the attribute dictionary whose attribute
1431
- # you wish to set.
1432
- #
1433
- # @param [String] key
1434
- # The attribute name.
1435
- #
1436
- # @param [Object] value
1437
- # The value to set.
1438
- #
1439
- # @return [Object] the value that was set
1440
- #
1441
- # @version SketchUp 6.0
1442
- def set_attribute(attrdictname, key, value)
1443
- end
1444
-
1445
- # This method sets the datum used in conversions between the internal
1446
- # coordinate system and UTM.
1447
- #
1448
- # The default datum is WGS84. You can use the method list_datums to get a list
1449
- # of all of the datums supported in SketchUp. If you pass an invalid datum to
1450
- # set_datum, set_datum returns the default datum.
1451
- #
1452
- # @example
1453
- # model = Sketchup.active_model
1454
- # value = model.set_datum('Adindan')
1455
- #
1456
- # @param [String] datum
1457
- #
1458
- # @return [nil]
1459
- #
1460
- # @version SketchUp 6.0
1461
- def set_datum(datum)
1462
- end
1463
-
1464
- # This method is used to retrieve the shadow information for the Model.
1465
- #
1466
- # @example
1467
- # model = Sketchup.active_model
1468
- # shadowinfo = model.shadow_info
1469
- #
1470
- # @return [Sketchup::ShadowInfo]
1471
- #
1472
- # @version SketchUp 6.0
1473
- def shadow_info
1474
- end
1475
-
1476
- # The {#start_operation} method is used to notify SketchUp that a new
1477
- # operation (which can be undone) is starting.
1478
- #
1479
- # The +op_name+ argument is a description for the operation that is displayed
1480
- # adjacent to the Edit > Undo menu item. Make sure to provide a user friendly
1481
- # name for your operation.
1482
- #
1483
- # Starting with SketchUp 7.0, there are three additional booleans that one can
1484
- # pass in when starting an operation. It is recommended to always set
1485
- # +disable_ui+ to +true+. It's left to +false+ for default for compatibility
1486
- # reasons.
1487
- #
1488
- # @example Observer Operation since SU2016
1489
- # class MyDefinitionsObserver < Sketchup::DefinitionObserver
1490
- # def onComponentAdded(definitions, definition)
1491
- # return if definition.deleted?
1492
- # # The operation name won't be displayed when the fourth argument is
1493
- # # +true+. It will absorb into the previous operation.
1494
- # definition.model.start_operation('Tag It', true, false, true)
1495
- # definition.set_attribute('MyExtension', 'Tag', 'You are it')
1496
- # definition.model.commit_operation
1497
- # end
1498
- # end
1499
- #
1500
- # observer = MyDefinitionsObserver.new
1501
- # model = Sketchup.active_model
1502
- # model.definitions.add_observer(observer)
1503
- #
1504
- # @example Typical Operation
1505
- # model = Sketchup.active_model
1506
- # model.start_operation('Generate House', true)
1507
- # model.entities.add_line([0, 0, 0], [9, 0, 0])
1508
- # model.entities.add_line([9, 0, 0], [9, 0, 9])
1509
- # model.commit_operation
1510
- #
1511
- # @note Operations in SketchUp are sequential and cannot be nested. If you start a
1512
- # new Ruby operation while another is still open, you will implicitly close
1513
- # the first one.
1514
- #
1515
- # @param [String] op_name
1516
- # name of the operation visible in the UI
1517
- #
1518
- # @param [Boolean] disable_ui
1519
- # if set to true, then SketchUp's tendency to
1520
- # update the user interface after each geometry change will be
1521
- # suppressed. This can result in much faster Ruby code execution if the
1522
- # operation involves updating the model in any way.
1523
- #
1524
- # @param [Boolean] next_transparent
1525
- # <b>Deprecated!</b> if set to true, then
1526
- # whatever operation comes after this one will be appended into one
1527
- # combined operation, allowing the user the undo both actions with a
1528
- # single undo command. This flag is a highly difficult one, since there
1529
- # are so many ways that a SketchUp user can interrupt a given operation
1530
- # with one of their own. <b>Use extreme caution</b> and test thoroughly
1531
- # when setting this to true.
1532
- #
1533
- # @param [Boolean] transparent
1534
- # if set to true, then this operation will
1535
- # append to the previous operation. This is particularly useful for
1536
- # creating observers that react to user actions without littering the
1537
- # undo stack with extra steps that Ruby is performing.
1538
- #
1539
- # @raise [RuntimeError] if called within the context of {Sketchup::Entities#build}.
1540
- #
1541
- # @return [Boolean] +true+ if successful, +false+ if unsuccessful
1542
- #
1543
- # @version SketchUp 6.0
1544
- def start_operation(op_name, disable_ui = false, next_transparent = false, transparent = false)
1545
- end
1546
-
1547
- # The {#styles} method retrieves the styles associated with the model.
1548
- #
1549
- # @example
1550
- # model = Sketchup.active_model
1551
- # styles = model.styles
1552
- #
1553
- # @return [Sketchup::Styles]
1554
- #
1555
- # @version SketchUp 6.0
1556
- def styles
1557
- end
1558
-
1559
- # The tags method retrieves the string tags of the model.
1560
- #
1561
- # @example
1562
- # model = Sketchup.active_model
1563
- # tags = model.tags
1564
- #
1565
- # @return [String] string tags of the model
1566
- #
1567
- # @version SketchUp 6.0
1568
- def tags
1569
- end
1570
-
1571
- # The tags= method sets the string tags of the model.
1572
- #
1573
- # @example
1574
- # Sketchup.active_model.tags = "Building, House, Brick"
1575
- #
1576
- # @param [String] tags
1577
- # new tags of the model
1578
- #
1579
- # @return [String] the new tags
1580
- #
1581
- # @version SketchUp 6.0
1582
- def tags=(tags)
1583
- end
1584
-
1585
- # The tile method retrieves the name of the model. If the model is saved on
1586
- # disk, returns the file name without extension. Otherwise returns an empty
1587
- # string.
1588
- #
1589
- # @example
1590
- # model = Sketchup.active_model
1591
- # title = model.title
1592
- #
1593
- # @return [String] the title of the model or an empty string (if
1594
- # the title is not set)
1595
- #
1596
- # @version SketchUp 6.0
1597
- def title
1598
- end
1599
-
1600
- # The {#tools} method is used to retrieve the current {Sketchup::Tools} object.
1601
- #
1602
- # @example
1603
- # model = Sketchup.active_model
1604
- # tools = model.tools
1605
- #
1606
- # @return [Sketchup::Tools] a Tools object.
1607
- #
1608
- # @version SketchUp 6.0
1609
- def tools
1610
- end
1611
-
1612
- # The utm_to_point method converts a position given in UTM coordinates to a
1613
- # Point3d in the Model.
1614
- #
1615
- # @example
1616
- # model = Sketchup.active_model
1617
- # utm = Geom::UTM.new([+1, "A", 0.12333333, 0.12321321])
1618
- # point = model.utm_to_point(utm)
1619
- #
1620
- # @param [Geom::UTM] utm
1621
- # A UTM object.
1622
- #
1623
- # @return [Geom::Point3d] A Point3d object.
1624
- #
1625
- # @version SketchUp 6.0
1626
- def utm_to_point(utm)
1627
- end
1628
-
1629
- # Determine if a model is a valid Sketchup::Model object. Returns false
1630
- # if the model has been closed.
1631
- #
1632
- # This is useful on the mac where one can have multiple models open at the
1633
- # same time. In such a case, this method can tell you if the user has closed
1634
- # the model before you perform operations on it.
1635
- #
1636
- # @example
1637
- # # This is a silly example since the active model is generally going to
1638
- # # be valid, but it illustrates the idea.
1639
- # model = Sketchup.active_model
1640
- # if model.valid?
1641
- # UI.messagebox('This model is valid.')
1642
- # else
1643
- # UI.messagebox('This model is NOT valid.')
1644
- # end
1645
- #
1646
- # @return [Boolean]
1647
- #
1648
- # @version SketchUp 6.0
1649
- def valid?
1650
- end
1651
-
1652
- end
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # This is the interface to a SketchUp model. The model is the 3D drawing that
5
+ # the user is working with, and it serves as the "entry point" for most Ruby
6
+ # API interactions. The Sketchup.active_model method gives you a handle to the
7
+ # current model, and from there you can use the model-level methods to start
8
+ # getting information and making changes.
9
+ #
10
+ # @bug Prior to SketchUp 2019.0 this class would yield +TypeError+ for all
11
+ # method calls if +#singleton_class+ was called on the model object.
12
+ #
13
+ # @example
14
+ # # Grab a handle to the currently active model (aka the one the user is
15
+ # # looking at in SketchUp.)
16
+ # model = Sketchup.active_model
17
+ #
18
+ # # Grab other handles to commonly used collections inside the model.
19
+ # entities = model.entities
20
+ # layers = model.layers
21
+ # materials = model.materials
22
+ # component_definitions = model.definitions
23
+ # selection = model.selection
24
+ #
25
+ # # Now that we have our handles, we can start pulling objects and making
26
+ # # method calls that are useful.
27
+ # first_entity = entities[0]
28
+ # puts "First thing in your model is a #{first_entity.typename}"
29
+ #
30
+ # number_materials = materials.length
31
+ # puts "Your model has #{number_materials} materials."
32
+ #
33
+ # new_edge = entities.add_line([0,0,0], [500,500,0])
34
+ #
35
+ # @version SketchUp 6.0
36
+ class Sketchup::Model
37
+
38
+ # Constants
39
+
40
+ LOAD_STATUS_SUCCESS = nil # Stub value.
41
+ LOAD_STATUS_SUCCESS_MORE_RECENT = nil # Stub value.
42
+
43
+ Make = nil # Stub value.
44
+ MakeTrial = nil # Stub value.
45
+ ProLicensed = nil # Stub value.
46
+ ProTrial = nil # Stub value.
47
+
48
+ VERSION_2013 = nil # Stub value.
49
+ VERSION_2014 = nil # Stub value.
50
+ VERSION_2015 = nil # Stub value.
51
+ VERSION_2016 = nil # Stub value.
52
+ VERSION_2017 = nil # Stub value.
53
+ VERSION_2018 = nil # Stub value.
54
+ VERSION_2019 = nil # Stub value.
55
+ VERSION_2020 = nil # Stub value.
56
+ VERSION_2021 = nil # Stub value.
57
+ VERSION_3 = nil # Stub value.
58
+ VERSION_4 = nil # Stub value.
59
+ VERSION_5 = nil # Stub value.
60
+ VERSION_6 = nil # Stub value.
61
+ VERSION_7 = nil # Stub value.
62
+ VERSION_8 = nil # Stub value.
63
+
64
+ # Instance Methods
65
+
66
+ # The {#abort_operation} method aborts the current operation started with the
67
+ # start_operation method.
68
+ #
69
+ # The {#abort_operation} method is normally called from inside of a rescue
70
+ # clause to cancel an operation if something goes wrong.
71
+ #
72
+ # @example
73
+ # status = model.abort_operation
74
+ #
75
+ # @note Never abort a transparent operation. Doing so would abort the operation
76
+ # it chains to. Instead, try to clean up and simply commit in order to make
77
+ # sure the operation is closed.
78
+ #
79
+ # @return [Boolean] true if successful, false if unsuccessful
80
+ #
81
+ # @version SketchUp 6.0
82
+ def abort_operation
83
+ end
84
+
85
+ # Returns an {Sketchup::Entities} object which contains
86
+ # the entities in the open group or component instance. If no group or
87
+ # component is open for editing then this will be the same as {#entities}.
88
+ #
89
+ # To perform actions upon the current set of entities the user is working with
90
+ # then this is the method to use. Entities selected by the user will be a
91
+ # subset of the active entities.
92
+ #
93
+ # @example
94
+ # model = Sketchup.active_model
95
+ # entities = model.active_entities
96
+ # entities.each { |entity| puts "#{entity} (#{entity.class})" }
97
+ #
98
+ # @return [Sketchup::Entities]
99
+ #
100
+ # @see #edit_transform
101
+ #
102
+ # @version SketchUp 6.0
103
+ def active_entities
104
+ end
105
+
106
+ # The {#active_layer} method retrieves the active Layer.
107
+ #
108
+ # The default layer in SketchUp is layer 0.
109
+ #
110
+ # @example
111
+ # model = Sketchup.active_model
112
+ # layer = model.active_layer
113
+ #
114
+ # @return [Sketchup::Layer]
115
+ #
116
+ # @version SketchUp 6.0
117
+ def active_layer
118
+ end
119
+
120
+ # The {#active_layer=} method sets the active {Sketchup::Layer} object.
121
+ #
122
+ # @example
123
+ # model = Sketchup.active_model
124
+ # layers = model.layers
125
+ # layer = layers.add('My Layer')
126
+ # model.active_layer = layer
127
+ #
128
+ # @param [Sketchup::Layer] layer
129
+ # The layer to be set as the active layer.
130
+ #
131
+ # @return [Sketchup::Layer]
132
+ #
133
+ # @version SketchUp 6.0
134
+ def active_layer=(layer)
135
+ end
136
+
137
+ # Returns an array containing the sequence of entities the user has
138
+ # double-clicked on for editing. This allows one to determine whether they are
139
+ # in component edit mode and where in the model they are.
140
+ #
141
+ # For example, if a user has double-clicked into a component to
142
+ # edit its geometry, and then double clicked into a sub-group to edit that,
143
+ # the active_path might contain:
144
+ #
145
+ # <code>[<Sketchup::ComponentInstance>, <Sketchup::Group>]</code>
146
+ #
147
+ # @example
148
+ # active_path = Sketchup.active_model.active_path
149
+ #
150
+ # @return [Array<Sketchup::Drawingelement>, nil] array of entities showing where the user is
151
+ # currently editing.
152
+ #
153
+ # @version SketchUp 7.0
154
+ def active_path
155
+ end
156
+
157
+ # The {#active_path=} method is used to open a given instance path for editing.
158
+ #
159
+ # @example Open an instance
160
+ # model = Sketchup.active_model
161
+ # instance = model.active_entities.grep(Sketchup::ComponentInstance).first
162
+ # instance_path = Sketchup::InstancePath.new([instance])
163
+ # model.active_path = instance_path
164
+ #
165
+ # @example Close all instances
166
+ # model = Sketchup.active_model
167
+ # model.active_path = nil
168
+ #
169
+ # @note An instance path can only be opened if the instances are not locked.
170
+ # This also include instances of the same component definition that are not
171
+ # on the given path. A definition cannot be edited if any of its instances
172
+ # are locked.
173
+ #
174
+ # @note When changing the active entities in SketchUp, the coordinate system
175
+ # also changes. Therefore, entities cannot be modified in the same operation
176
+ # as the active entities change. The API handles this automatically by
177
+ # starting and committing transparent operations as needed.
178
+ #
179
+ # If the API user tries to do this:
180
+ #
181
+ # model.start_operation('...', true)
182
+ # model.active_entities.add_face(...)
183
+ # model.active_path = instance_path
184
+ # model.active_entities.add_face(...)
185
+ # model.commit_operation
186
+ #
187
+ # Then SketchUp will automatically break it up to something like to this:
188
+ #
189
+ # model.start_operation('...', true)
190
+ # model.active_entities.add_face(...)
191
+ # model.commit_operation
192
+ #
193
+ # model.start_operation('...', true, false, true)
194
+ # model.active_path = instance_path
195
+ # model.commit_operation
196
+ #
197
+ # model.start_operation('...', true, false, true)
198
+ # model.active_entities.add_face(...)
199
+ # model.commit_operation
200
+ #
201
+ # For the end user this will be experienced as a single operation.
202
+ #
203
+ # For the API user the side-effect is multiple transaction notifications to
204
+ # {Sketchup::ModelObserver}s.
205
+ #
206
+ # @param [Sketchup::InstancePath, Array<Sketchup::ComponentInstance, Sketchup::Group>, nil] instance_path
207
+ # Passing +nil+ or an empty array will close all open instances.
208
+ #
209
+ # @raise [ArgumentError] if the instance path is not valid.
210
+ #
211
+ # @raise [ArgumentError] if the instance path contains locked instances.
212
+ #
213
+ # @raise [ArgumentError] if the instance path contains instances who's
214
+ # siblings are locked.
215
+ #
216
+ # @raise [ArgumentError] if the instance path contains Live Components.
217
+ #
218
+ # @return [Sketchup::Model]
219
+ #
220
+ # @version SketchUp 2020.0
221
+ def active_path=(instance_path)
222
+ end
223
+
224
+ # The {#active_section_planes} method returns all of the active section planes in the model.
225
+ #
226
+ # @example SketchUp 2025 and newer
227
+ # model = Sketchup.active_model
228
+ # section_planes = model.active_section_planes
229
+ #
230
+ # @example SketchUp 2024 and older
231
+ # # In older SketchUp versions, you can achieve the same result with:
232
+ # model = Sketchup.active_model
233
+ # entities_collections = [Sketchup.active_model.entities] + model.definitions.map(&:entities)
234
+ # section_planes = entities_collections.map(&:active_section_plane).compact
235
+ #
236
+ # @return [Array<Sketchup::SectionPlane>]
237
+ #
238
+ # @version SketchUp 2026.0
239
+ def active_section_planes
240
+ end
241
+
242
+ # The {#active_view} method returns the active View object for this model.
243
+ #
244
+ # @example
245
+ # model = Sketchup.active_model
246
+ # view = model.active_view
247
+ #
248
+ # @return [Sketchup::View]
249
+ #
250
+ # @version SketchUp 6.0
251
+ def active_view
252
+ end
253
+
254
+ # Add a text note to the Model. The position of the note is given as relative
255
+ # window positions between 0 and 1. For example, the following command
256
+ # would create a note that start 1/10 of the ways down the screen from the
257
+ # upper left corner of the window.
258
+ #
259
+ # @example
260
+ # model = Sketchup.active_model
261
+ # # Add a note 1/10 ways down the screen and 1/10 ways right from the
262
+ # # upper left corner of model window.
263
+ # note = Sketchup.active_model.add_note('Hello World', 0.1, 0.1)
264
+ #
265
+ # @param [String] note
266
+ # A string note.
267
+ #
268
+ # @param [Numeric] x
269
+ # A distance along the x axis between 0 and 1.
270
+ #
271
+ # @param [Numeric] y
272
+ # A distance along the y axis between 0 and 1.
273
+ #
274
+ # @return [Sketchup::Text] a note object or an exception if it is
275
+ # unsuccessful.
276
+ #
277
+ # @version SketchUp 6.0
278
+ def add_note(note, x, y)
279
+ end
280
+
281
+ # The add_observer method is used to add an observer to the current object.
282
+ #
283
+ # @example
284
+ # model = Sketchup.active_model
285
+ # observer = Sketchup::ModelObserver.new
286
+ # status = model.add_observer(observer)
287
+ #
288
+ # @param [Object] observer
289
+ # An observer.
290
+ #
291
+ # @return [Boolean] true if successful, false if unsuccessful.
292
+ #
293
+ # @version SketchUp 6.0
294
+ def add_observer(observer)
295
+ end
296
+
297
+ # The {#attribute_dictionaries} method retrieves the AttributeDictionaries
298
+ # object that is associated with the Model.
299
+ #
300
+ # @example
301
+ # model = Sketchup.active_model
302
+ # dictionaries = model.attribute_dictionaries
303
+ # if dictionaries
304
+ # # Code to do something if attribute dictionaries exist (usually you
305
+ # # parse the array of dictionaries.
306
+ # else
307
+ # # Code to do something if attribute dictionaries do not exist.
308
+ # end
309
+ #
310
+ # @return [Sketchup::AttributeDictionaries] the AttributeDictionaries
311
+ # object associated with the entity, or nil if there are
312
+ # no attribute_dictionary objects associated with the
313
+ # model. Care must be taken if nil is returned, for
314
+ # example: invoking attribute_dictionaries.length will
315
+ # throw a NoMethodError exception, not return 0.
316
+ #
317
+ # @version SketchUp 6.0
318
+ def attribute_dictionaries
319
+ end
320
+
321
+ # Returns the Sketchup::AttributeDictionary object that is specified by
322
+ # name. If the model does not have an attribute dictionary that
323
+ # corresponds to name, returns either nil, or a creates an attribute
324
+ # dictionary. If the optional second argument is true, and there is no
325
+ # attribute dictionary that corresponds to name, a new attribute
326
+ # dictionary is created.
327
+ #
328
+ # @example
329
+ # model = Sketchup.active_model
330
+ # create_if_empty = true
331
+ # dictionary = model.attribute_dictionary('name', create_if_empty)
332
+ #
333
+ # @param [String] name
334
+ # The name of the dictionary you are attempting to
335
+ # retrieve.
336
+ #
337
+ # @param [Boolean] create
338
+ # if set to true an attribute dictionary of the
339
+ # given "name" will be created if not found.
340
+ #
341
+ # @return [Sketchup::AttributeDictionary] an attribute dictionary object if
342
+ # successful, nil if unsuccessful
343
+ #
344
+ # @version SketchUp 6.0
345
+ def attribute_dictionary(name, create = false)
346
+ end
347
+
348
+ # The {#axes} method returns the drawing axes for the model.
349
+ #
350
+ # @example
351
+ # # Point for a rectangle.
352
+ # points = [
353
+ # Geom::Point3d.new( 0, 0, 0),
354
+ # Geom::Point3d.new(10, 0, 0),
355
+ # Geom::Point3d.new(10, 20, 0),
356
+ # Geom::Point3d.new( 0, 20, 0)
357
+ # ]
358
+ # # Transform the points so they are local to the model axes. Otherwise
359
+ # # they would be local to the model origin.
360
+ # tr = Sketchup.active_model.axes.transformation
361
+ # points.each { |point| point.transform!(tr) }
362
+ # Sketchup.active_model.active_entities.add_face(points)
363
+ #
364
+ # @return [Sketchup::Axes] the axes for the model.
365
+ #
366
+ # @version SketchUp 2016
367
+ def axes
368
+ end
369
+
370
+ # The behavior method retrieves the behavior of the model.
371
+ #
372
+ # @example
373
+ # model = Sketchup.active_model
374
+ # behavior = model.behavior
375
+ #
376
+ # @return [Sketchup::Behavior] behavior object for the model if successful
377
+ #
378
+ # @version SketchUp 6.0
379
+ def behavior
380
+ end
381
+
382
+ # The {#bounds} method is used to retrieve the {Geom::BoundingBox} bounding the
383
+ # contents of a {Sketchup::Model}.
384
+ #
385
+ # @example
386
+ # model = Sketchup.active_model
387
+ # bounds = model.bounds
388
+ #
389
+ # @return [Geom::BoundingBox]
390
+ #
391
+ # @version SketchUp 6.0
392
+ def bounds
393
+ end
394
+
395
+ # The {#classifications} method is used to retrieve the Classifications object
396
+ # for this model.
397
+ #
398
+ # @example
399
+ # model = Sketchup.active_model
400
+ # c = model.classifications
401
+ #
402
+ # @return [Sketchup::Classifications] a Classifications object.
403
+ #
404
+ # @version SketchUp 2015
405
+ def classifications
406
+ end
407
+
408
+ # The {#close} method is used to close this model. On Mac OS, only the active
409
+ # model can be closed. On Windows, since there can be only one document open,
410
+ # this method will perform a File/New operation.
411
+ #
412
+ # @example
413
+ # Sketchup.file_new
414
+ # model = Sketchup.active_model
415
+ # model.close
416
+ #
417
+ # @note As of SketchUp 2024.0 this method will ensure the next model window
418
+ # gets focus if there is one. Before that `Sketchup.active_model` might
419
+ # return `nil` after calling this method even though more models where open.
420
+ #
421
+ # @param [Boolean] ignore_changes
422
+ # If `true`, model changes will be
423
+ # ignored and save prompts will be suppressed.
424
+ # If `false`, changes will not be ignored and save
425
+ # prompts will be displayed normally.
426
+ #
427
+ # @return [nil]
428
+ #
429
+ # @version SketchUp 2015
430
+ def close(ignore_changes = false)
431
+ end
432
+
433
+ # The {#close_active} method is used to close the currently active (open) group
434
+ # or component.
435
+ #
436
+ # @example
437
+ # model = Sketchup.active_model
438
+ # status = model.close_active
439
+ #
440
+ # @note Before SketchUp 2014 this method had a bug where it didn't create an
441
+ # undo operation and that could lead to corrupted geometry when undo/redo was
442
+ # used after invoking this method.
443
+ #
444
+ # @return [Boolean] true if successful, false if unsuccessful.
445
+ #
446
+ # @version SketchUp 6.0
447
+ def close_active
448
+ end
449
+
450
+ # The commit_operation method commits an operation for undo.
451
+ #
452
+ # The commit_operation method is normally called at the end of a method to
453
+ # commit the operation that the method performs.
454
+ #
455
+ # @example
456
+ # status = model.commit_operation
457
+ #
458
+ # @return [Boolean] true if successful, false if unsuccessful
459
+ #
460
+ # @version SketchUp 6.0
461
+ def commit_operation
462
+ end
463
+
464
+ # The {#definitions} method retrieves a definition list containing all of the
465
+ # component definitions in the model.
466
+ #
467
+ # @example
468
+ # model = Sketchup.active_model
469
+ # definitions = model.definitions
470
+ #
471
+ # @return [Sketchup::DefinitionList]
472
+ #
473
+ # @version SketchUp 6.0
474
+ def definitions
475
+ end
476
+
477
+ # The description method retrieves a description of the model as found in the
478
+ # Model Info > Files panel.
479
+ #
480
+ # The returned description can be empty. The default description for all models
481
+ # is empty.
482
+ #
483
+ # @example
484
+ # model = Sketchup.active_model
485
+ # description = model.description
486
+ #
487
+ # @return [String] a description if successful.
488
+ #
489
+ # @version SketchUp 6.0
490
+ def description
491
+ end
492
+
493
+ # The {#description=} method sets the description of the model.
494
+ #
495
+ # @example
496
+ # model = Sketchup.active_model
497
+ # description = model.description = "This is a model of a house on the " <<
498
+ # "North West Corner of 10th and Dolores Street in Carmel, California"
499
+ #
500
+ # @param [String] description
501
+ # the description string to be set.
502
+ #
503
+ # @return [String]
504
+ #
505
+ # @version SketchUp 6.0
506
+ def description=(description)
507
+ end
508
+
509
+ # The {#drawing_element_visible?} method reports whether the given drawing
510
+ # element in an instance path is visible given the current model options.
511
+ #
512
+ # @bug Prior to version 2026.0 the method throws an exception when the last
513
+ # element in the instance path is a {Sketchup::Group} or {Sketchup::ComponentInstance}.
514
+ #
515
+ # @example Traversing every visible entity in the model
516
+ # module Example
517
+ #
518
+ # def self.instance?(entity)
519
+ # entity.is_a?(Sketchup::ComponentInstance) || entity.is_a?(Sketchup::Group)
520
+ # end
521
+ #
522
+ # # Walk the visible entities in the model, taking into account
523
+ # # "DrawHiddenGeometry" and "DrawHiddenObjects" rendering options.
524
+ # def self.walk(entities, transformation = IDENTITY, path = [], &block)
525
+ # entities.each { |entity|
526
+ # entity_path = path + [entity]
527
+ # next unless entity.model.drawing_element_visible?(entity_path)
528
+ # block.call(entity, transformation, path)
529
+ # if instance?(entity)
530
+ # child_entities = entity.definition.entities
531
+ # child_transformation = transformation * entity.transformation
532
+ # walk(child_entities, child_transformation, entity_path, &block)
533
+ # end
534
+ # }
535
+ # end
536
+ #
537
+ # end
538
+ #
539
+ # model = Sketchup.active_model
540
+ # Example.walk(model.entities) do |entity, transformation, path|
541
+ # # Do something to every visible entity in the model...
542
+ # end
543
+ #
544
+ # @param [Sketchup::InstancePath, Array<Sketchup::Drawingelement>] instance_path
545
+ #
546
+ # @raise [ArgumentError] if the +instance_path+ is not valid.
547
+ #
548
+ # @return [Boolean]
549
+ #
550
+ # @see Sketchup::RenderingOptions
551
+ #
552
+ # @see Sketchup::Drawingelement#visible?
553
+ #
554
+ # @see Sketchup::Layer#visible?
555
+ #
556
+ # @version SketchUp 2020.0
557
+ def drawing_element_visible?(instance_path)
558
+ end
559
+
560
+ # Returns the transformation of the current component edit session. If a user
561
+ # has double-clicked to edit a component's geometry, this will
562
+ # return the transformation of that component, relative to its parent's
563
+ # origin. This allows one to correctly calculate "local" transformations of
564
+ # a given entity regardless of whether the user is in edit mode.
565
+ #
566
+ # @example
567
+ # Sketchup.active_model.edit_transform
568
+ #
569
+ # @return [Geom::Transformation] the current edit Transformation
570
+ #
571
+ # @version SketchUp 7.0
572
+ def edit_transform
573
+ end
574
+
575
+ # The {#entities} method returns an {Sketchup::Entities} object containing the
576
+ # entities in the root of model.
577
+ #
578
+ # @example
579
+ # model = Sketchup.active_model
580
+ # entities = model.entities
581
+ #
582
+ # @note This does not return a collection of all the entities in the model,
583
+ # only the top level node of the model hierarchy. To get to all entities in
584
+ # a model you must recursivly traverse the model.
585
+ #
586
+ # @return [Sketchup::Entities] an Entities object if successful
587
+ #
588
+ # @version SketchUp 6.0
589
+ def entities
590
+ end
591
+
592
+ # The {#environments} method is used to retrieve the {Sketchup::Environments} object for
593
+ # this model.
594
+ #
595
+ # @example
596
+ # model = Sketchup.active_model
597
+ # environments = model.environments
598
+ #
599
+ # @return [Sketchup::Environments]
600
+ #
601
+ # @version SketchUp 2025.0
602
+ def environments
603
+ end
604
+
605
+ # The export method is used to export a given file format. It knows which
606
+ # format to export based on the file extension you place on the file name.
607
+ # For example, a filename of "thing.obj" will export an OBJ file, whereas
608
+ # "thing.dae" will export a COLLADA file.
609
+ #
610
+ # For SketchUp Pro 7.1+, valid extensions include dae, kmz, 3ds, dwg,
611
+ # dxf, fbx, obj, wrl, and xsi. SketchUp Free only supports dae and kmz.
612
+ #
613
+ # Format Support Changes:
614
+ # * SketchUp 7.1 added COLLADA (.dae) export capability.
615
+ # * SketchUp Pro 2015+ added IFC export capability.
616
+ # * SketchUp Pro 2016+ added PDF export capability.
617
+ # * SketchUp Pro 2018+ added options for all 3D exporters.
618
+ # * SketchUp 2024+ added glb and usdz exporters.
619
+ # * SketchUp 2026+ the IFC exporter has been replaced with a new implementation
620
+ # that provides specific export options.
621
+ #
622
+ # See the {file:pages/exporter_options.md Exporter Options} file for information
623
+ # on creating a valid hash for the various exporters.
624
+ #
625
+ # @bug IFC export on ARM macs isn't working for SketchUp 2022-2025.
626
+ #
627
+ # @example General use
628
+ # model = Sketchup.active_model
629
+ # show_summary = true
630
+ #
631
+ # # Export dwg file on a PC, showing a summary when complete.
632
+ # status = model.export('c:\my_export.dwg', show_summary)
633
+ #
634
+ # # Export kmz file on Mac (note the absolute file path), without summary.
635
+ # status = model.export('/Library/my_export.kmz')
636
+ #
637
+ # # Export pdf file on a PC, showing a summary when complete.
638
+ # options_hash = { :show_summary => true,
639
+ # :output_profile_lines => false,
640
+ # :map_fonts => false,
641
+ # :model_units => Length::Meter }
642
+ # status = model.export('c:/my_export.pdf', options_hash)
643
+ #
644
+ # # Or for a COLLADA (.dae) file.
645
+ # options_hash = { :triangulated_faces => true,
646
+ # :doublesided_faces => true,
647
+ # :edges => false,
648
+ # :author_attribution => false,
649
+ # :texture_maps => true,
650
+ # :selectionset_only => false,
651
+ # :preserve_instancing => true }
652
+ # status = model.export('c:/my_export.dae', options_hash)
653
+ #
654
+ # @example IFC Example
655
+ # model = Sketchup.active_model
656
+ # options_hash = { :ifc_version => "IFC 4",
657
+ # :standard_ifc_hierarchy => true,
658
+ # :selectionset_only => false,
659
+ # :hidden_geometry => true,
660
+ # :tessellated_geometry => true }
661
+ # status = model.export('c:/my_export.ifc', options_hash)
662
+ #
663
+ # @overload export(path, show_summary = false)
664
+ #
665
+ # @param [String] path The name of the file to export.
666
+ # @param [Boolean] show_summary Boolean to show summary dialog.
667
+ # @return [Boolean]
668
+ #
669
+ # @overload export(path, options)
670
+ #
671
+ # @param [String] path The path to save the export at.
672
+ # @param [Hash] options
673
+ # @return [Boolean]
674
+ #
675
+ # @raise [ArgumentError] If the file extension is unsupported.
676
+ #
677
+ # @version SketchUp 6.0
678
+ def export(*args)
679
+ end
680
+
681
+ # Finds and returns entities by their entityID or GUID.
682
+ #
683
+ # GUIDs looked up are only relevant to Group and ComponentInstance as these
684
+ # GUIDs are persistent. ComponentDefinition and Model GUIDs are not persistent
685
+ # and are not looked up.
686
+ #
687
+ # When given an array of IDs, an array is returned with a 1:1 mapping to the
688
+ # input arguments. This array may contain nil values if some ids were not
689
+ # found. You cannot look up a mix of entityIDs and GUIDs in the same call.
690
+ #
691
+ # @example
692
+ # model = Sketchup.active_model
693
+ #
694
+ # # Look up by entityID.
695
+ # entity_id = model.entities.add_line([0,0,0], [9,9,9]).entityID
696
+ # entity = model.find_entity_by_id(entity_id)
697
+ #
698
+ # # Look up by GUID.
699
+ # guid = model.entities.add_group.guid
700
+ # entity = model.find_entity_by_id(guid)
701
+ #
702
+ # # Look up multiple.
703
+ # entities = model.find_entity_by_id(id1, id2, id3)
704
+ # entities = model.find_entity_by_id([id1, id2, id3])
705
+ # entities = model.find_entity_by_id(guid1, guid2, guid3)
706
+ # entities = model.find_entity_by_id([guid1, guid2, guid3])
707
+ #
708
+ # @param [Array<Integer, String>] ids_or_array
709
+ # Pass either a series of ids or a single array containing
710
+ # ids. Ids must either be entityID Integers or GUID
711
+ # Strings.
712
+ #
713
+ # @return [Array<Sketchup::Entity, nil>] Returns an array with Entity objects for each id
714
+ # found and nil otherwise. Single Entity or nil when
715
+ # called with a single id.
716
+ #
717
+ # @version SketchUp 2015
718
+ def find_entity_by_id(ids_or_array)
719
+ end
720
+
721
+ # Finds and returns entities by their persistent id.
722
+ #
723
+ # When given an array of IDs, an array is returned with a 1:1 mapping to the
724
+ # input arguments. This array may contain `nil` values if some ids were not
725
+ # found.
726
+ #
727
+ # @example
728
+ # model = Sketchup.active_model
729
+ #
730
+ # # Look up by persistent_id.
731
+ # pid = model.entities.add_line([0,0,0], [9,9,9]).persistent_id
732
+ # entity = model.find_entity_by_persistent_id(pid)
733
+ #
734
+ # # Look up multiple.
735
+ # entities = model.find_entity_by_persistent_id(id1, id2, id3)
736
+ # entities = model.find_entity_by_persistent_id([id1, id2, id3])
737
+ #
738
+ # @example Limit search by scope
739
+ # model = Sketchup.active_model
740
+ # edge_pid = model.entities.add_line([0,0,0], [9,9,9]).persistent_id
741
+ # layer_pid = model.layers.add('Hello World').persistent_id
742
+ #
743
+ # # Search in all scopes:
744
+ # entities = model.find_entity_by_persistent_id(edge_pid, layer_pid)
745
+ # # => [#<Sketchup::Edge:0x000002567da4a8f0>, #<Sketchup::Layer:0x000002567da49e50>]
746
+ #
747
+ # # Search in layer scope:
748
+ # entities = model.find_entity_by_persistent_id(edge_pid, layer_pid, layers: true)
749
+ # # => [nil, #<Sketchup::Layer:0x000002567da49e50>]
750
+ #
751
+ # @overload find_entity_by_persistent_id(ids_or_array)
752
+ #
753
+ # @param [Array<Integer>] ids_or_array Pass either a series of ids or a
754
+ # single array containing persistent ids.
755
+ #
756
+ # @return [Sketchup::Entity, Array<Sketchup::Entity>, nil] Returns an {Sketchup::Entity} if a
757
+ # single PID was given or an array of {Sketchup::Entity} objects for each id found or nil if
758
+ # nothing was found.
759
+ #
760
+ # @overload find_entity_by_persistent_id(ids_or_array, **scope)
761
+ #
762
+ # @version SketchUp 2020.2
763
+ # @param [Array<Integer>] ids_or_array Pass either a series of ids or a
764
+ # single array containing persistent ids.
765
+ # @param [Hash<Symbol, Boolean>] scope Limit the scope of the search to the
766
+ # given scope categories.
767
+ # @option scope [Boolean] :entities Search entities parent to
768
+ # {Sketchup::Entities}.
769
+ # @option scope [Boolean] :layers Search {Sketchup::Layers} for
770
+ # {Sketchup::Layer} entities.
771
+ # @option scope [Boolean] :layer_folders Search {Sketchup::Layers} for
772
+ # {Sketchup::LayerFolder} entities.
773
+ # @option scope [Boolean] :materials Search {Sketchup::Materials} for
774
+ # {Sketchup::Material} entities.
775
+ # @option scope [Boolean] :pages Search {Sketchup::Pages} for
776
+ # {Sketchup::Page} entities.
777
+ # @option scope [Boolean] :styles Search {Sketchup::Styles} for
778
+ # {Sketchup::Style} entities.
779
+ # @option scope [Boolean] :definitions Search {Sketchup::DefinitionList} for
780
+ # {Sketchup::ComponentDefinition} entities.
781
+ #
782
+ # @return [Sketchup::Entity, Array<Sketchup::Entity>, nil] Returns an {Sketchup::Entity} if a
783
+ # single PID was given or an array of {Sketchup::Entity} objects for each id found if multiple
784
+ # PIDs were given or nil if nothing was found.
785
+ #
786
+ # @version SketchUp 2017
787
+ def find_entity_by_persistent_id(*args)
788
+ end
789
+
790
+ # This methods determines if the model is georeferenced.
791
+ #
792
+ # @example
793
+ # model = Sketchup.active_model
794
+ # model.georeferenced?
795
+ #
796
+ # @return [Boolean]
797
+ #
798
+ # @version SketchUp 7.1
799
+ def georeferenced?
800
+ end
801
+
802
+ # The get_attribute method gets the value of an attribute that in the
803
+ # AttributeDictionary with the given name. If no value is associated
804
+ # with key, or if the model does not have an attribute dictionary
805
+ # specified by name, the optional third parameter will be returned.
806
+ #
807
+ # @example
808
+ # model = Sketchup.active_model
809
+ # model.set_attribute('testdictionary', 'test', 115)
810
+ # value = model.get_attribute('testdictionary', 'test', 42)
811
+ #
812
+ # @param [String] dictname
813
+ # The name of the dictionary containing the value.
814
+ #
815
+ # @param [String] key
816
+ # The key containing the value.
817
+ #
818
+ # @param [Object] defaultvalue
819
+ # default value that will be returned if a
820
+ # value does not exist.
821
+ #
822
+ # @return [Object, nil] the value for a given key in the given
823
+ # dictionary if a value exists; the default value if a
824
+ # defaultvalue is provided and the value does not exist;
825
+ # nil if the value does not exist and no defaultvalue is
826
+ # provided.
827
+ #
828
+ # @version SketchUp 6.0
829
+ def get_attribute(dictname, key, defaultvalue = nil)
830
+ end
831
+
832
+ # the get_datum method retrieves the datum, in the form of a string, used in
833
+ # UTM conversions.
834
+ #
835
+ # @example
836
+ # model = Sketchup.active_model
837
+ # datum = model.get_datum
838
+ #
839
+ # @return [String] a datum represented as a string if successful.
840
+ #
841
+ # @version SketchUp 6.0
842
+ def get_datum
843
+ end
844
+
845
+ # Returns a value which indicates the product family of the installed SketchUp
846
+ # application.
847
+ #
848
+ # The constants for possible return values since SketchUp 2016:
849
+ #
850
+ # - {Sketchup::Model::ProTrial}
851
+ # - {Sketchup::Model::ProLicensed}
852
+ # - {Sketchup::Model::MakeTrial}
853
+ # - {Sketchup::Model::Make}
854
+ #
855
+ # In earlier SketchUp versions there were no defined constants and additional
856
+ # values could be returned. As of SketchUp 2013, the return values were:
857
+ # - +0+ = Unknown
858
+ # - +1+ = Pro Trial
859
+ # - +2+ = Pro
860
+ # - +3+ = Pro Expired
861
+ # - +4+ = Make Trial
862
+ # - +5+ = Make Expired
863
+ # - +6+ = Make
864
+ # - +7+ = Pro License Unavailable
865
+ #
866
+ # @example
867
+ # model = Sketchup.active_model
868
+ # product_family = model.get_product_family
869
+ # if product_family == Sketchup::Model::ProLicensed then
870
+ # puts "You are running licensed SketchUp Pro!"
871
+ # end
872
+ #
873
+ # @return [Integer] the product family number.
874
+ #
875
+ # @version SketchUp 6.0
876
+ def get_product_family
877
+ end
878
+
879
+ # The guid method retrieves the globally unique identifier, in the form of a
880
+ # string, for the Model. The guid will change after the model is modified and
881
+ # saved. The Model guid is stored with the SketchUp file; it will not change if the
882
+ # file is moved to another computer.
883
+ #
884
+ # @example
885
+ # model = Sketchup.active_model
886
+ # guid = model.guid
887
+ #
888
+ # @return [String] a globally unique identifier, in the form of a
889
+ # string, for the model
890
+ #
891
+ # @version SketchUp 6.0
892
+ def guid
893
+ end
894
+
895
+ # The import method is used to load a file by recognizing the file extension
896
+ # and calling appropriate importer.
897
+ #
898
+ # See {Sketchup::DefinitionList#import} for importing a 3d model file as a
899
+ # component definition, without activating the UI for placing an instance.
900
+ #
901
+ # See the {file:pages/importer_options.md Importer Options} file for information
902
+ # on creating a valid hash for the various importers.
903
+ #
904
+ # @example Import for SketchUp 2017 and older
905
+ # model = Sketchup.active_model
906
+ # show_summary = true
907
+ # status = model.import("filename", show_summary)
908
+ #
909
+ # @example Import for SketchUp 2018+ and newer
910
+ # model = Sketchup.active_model
911
+ # options = { :units => "model",
912
+ # :merge_coplanar_faces => true,
913
+ # :show_summary => true }
914
+ # status = model.import("filename", options)
915
+ #
916
+ # @overload import(path, options)
917
+ #
918
+ # @param [String] path The input file path.
919
+ # @param [Hash] options The options.
920
+ # @return [Boolean]
921
+ #
922
+ # @overload import(path, show_summary = false)
923
+ #
924
+ # @note This variant is for SketchUp 2017 and earlier.
925
+ # @param [String] path The input file path.
926
+ # @param [Boolean] show_summary Show the summary dialog.
927
+ # @return [Boolean]
928
+ #
929
+ # @version SketchUp 6.0
930
+ def import(*args)
931
+ end
932
+
933
+ # The {#instance_path_from_pid_path} method returns a instance path given a
934
+ # string with persistent ids representing the path to the entity.
935
+ #
936
+ # @example
937
+ # points = [
938
+ # Geom::Point3d.new( 0, 0, 0),
939
+ # Geom::Point3d.new(10, 0, 0),
940
+ # Geom::Point3d.new(10, 20, 0),
941
+ # Geom::Point3d.new( 0, 20, 0)
942
+ # ]
943
+ # model = Sketchup.active_model
944
+ # entities = model.active_entities
945
+ # group = entities.add_group
946
+ # face = group.entities.add_face(points)
947
+ # pid_path = "#{group.persistent_id}.#{face.persistent_id}"
948
+ # # pid_path will look something like this: "658.723"
949
+ # instance_path = model.instance_path_from_pid_path(pid_path)
950
+ #
951
+ # @param [String] pid_path
952
+ # a string with persistent ids delimited by period.
953
+ #
954
+ # @raise [ArgumentError] if a valid instance path cannot be created from the
955
+ # given input path string.
956
+ #
957
+ # @return [Sketchup::InstancePath]
958
+ #
959
+ # @see Sketchup::InstancePath#persistent_id_path
960
+ #
961
+ # @version SketchUp 2017
962
+ def instance_path_from_pid_path(pid_path)
963
+ end
964
+
965
+ # The latlong_to_point method converts a latitude and longitude to a Point3d
966
+ # object in the model. It does not actually work with a LatLong object, but
967
+ # operates on a 2-element array. The returned point will always be on the
968
+ # ground (z=0).
969
+ #
970
+ # @example
971
+ # # Draw a point in Boulder, Colorado (40.0170N, 105.2830W)
972
+ # lnglat_array = [-105.28300, 40.01700]
973
+ # model = Sketchup.active_model
974
+ # local_point = model.latlong_to_point(lnglat_array)
975
+ # model.entities.add_cpoint(local_point)
976
+ #
977
+ # @param [Array(Numeric, Numeric)] lnglat_array
978
+ # A 2-element array containing first the longitude then
979
+ # the latitude.
980
+ #
981
+ # @return [Geom::Point3d] A Point3d in model coordinates.
982
+ #
983
+ # @return [Geom::Point3d] a point3d object if successful, false if
984
+ # unsuccessful.
985
+ #
986
+ # @version SketchUp 6.0
987
+ def latlong_to_point(lnglat_array)
988
+ end
989
+
990
+ # The {#layers} method retrieves a collection of all {Sketchup::Layers} objects
991
+ # in the model.
992
+ #
993
+ # @example
994
+ # model = Sketchup.active_model
995
+ # layers = model.layers
996
+ #
997
+ # @return [Sketchup::Layers] a Layers object containing a collection of
998
+ # layers in the model
999
+ #
1000
+ # @version SketchUp 6.0
1001
+ def layers
1002
+ end
1003
+
1004
+ # The {#line_styles} method returns the line styles manager.
1005
+ #
1006
+ # @example
1007
+ # line_styles = Sketchup.active_model.line_styles
1008
+ #
1009
+ # @return [Sketchup::LineStyles] The line styles manager.
1010
+ #
1011
+ # @version SketchUp 2019
1012
+ def line_styles
1013
+ end
1014
+
1015
+ # This method retrieves an Array of all of the datums recognized by SketchUp.
1016
+ #
1017
+ # @example
1018
+ # model = Sketchup.active_model
1019
+ # datums = model.list_datums
1020
+ #
1021
+ # @return [Array<String>] An Array object containing the datums
1022
+ # supported by SketchUp
1023
+ #
1024
+ # @version SketchUp 6.0
1025
+ def list_datums
1026
+ end
1027
+
1028
+ # The {#materials} method returns a collection of all of the materials in the
1029
+ # model.
1030
+ #
1031
+ # @example
1032
+ # model = Sketchup.active_model
1033
+ # materials = model.materials
1034
+ #
1035
+ # @return [Sketchup::Materials]
1036
+ #
1037
+ # @version SketchUp 6.0
1038
+ def materials
1039
+ end
1040
+
1041
+ # This method can be used to turn mipmapping on or off.
1042
+ #
1043
+ # @example
1044
+ # Sketchup.active_model.mipmapping = false
1045
+ #
1046
+ # @param [Boolean] mipmap
1047
+ # whether mipmapping is turned on or off.
1048
+ #
1049
+ # @return [Boolean] the new mipmapping setting
1050
+ #
1051
+ # @version SketchUp 7.0
1052
+ def mipmapping=(mipmap)
1053
+ end
1054
+
1055
+ # This method can be used to find out if mipmapping is on or off.
1056
+ #
1057
+ # @example
1058
+ # mipmapping = Sketchup.active_model.mipmapping?
1059
+ #
1060
+ # @return [Boolean]
1061
+ #
1062
+ # @version SketchUp 7.0
1063
+ def mipmapping?
1064
+ end
1065
+
1066
+ # The modified? method determines if the Model has been modified since the
1067
+ # last save.
1068
+ #
1069
+ # @example
1070
+ # model = Sketchup.active_model
1071
+ # entities = model.active_entities
1072
+ # # Add a group to force the status return value to be true
1073
+ # entities.add_group
1074
+ # status = model.modified?
1075
+ #
1076
+ # @return [Boolean]
1077
+ #
1078
+ # @version SketchUp 6.0
1079
+ def modified?
1080
+ end
1081
+
1082
+ # The {#name} method retrieves the name of the model.
1083
+ #
1084
+ # This property can be seen in Model Info and maps to the component
1085
+ # name if the model is inserted into another model. This property should not
1086
+ # be confused with the model {#path}.
1087
+ #
1088
+ # @example
1089
+ # model = Sketchup.active_model
1090
+ # name = model.name
1091
+ #
1092
+ # @return [String] string name of the model
1093
+ #
1094
+ # @version SketchUp 6.0
1095
+ def name
1096
+ end
1097
+
1098
+ # The {#name=} method sets the string name of the model.
1099
+ #
1100
+ # @example
1101
+ # Sketchup.active_model.name = "My New Model Name"
1102
+ #
1103
+ # @param [String] name
1104
+ #
1105
+ # @version SketchUp 6.0
1106
+ def name=(name)
1107
+ end
1108
+
1109
+ # Returns the number faces in a model.
1110
+ #
1111
+ # @example
1112
+ # model = Sketchup.active_model
1113
+ # number_of_faces = model.number_faces
1114
+ # puts "There are #{number_of_faces} faces in the model."
1115
+ #
1116
+ # @return [Integer]
1117
+ #
1118
+ # @version SketchUp 7.1
1119
+ def number_faces
1120
+ end
1121
+
1122
+ # The {#options} method retrieves the options manager that defines the options
1123
+ # settings for the model.
1124
+ #
1125
+ # Use the string keys instead of numerical indicies when accessing the options
1126
+ # as the indicies are not consistent between SketchUp versions.
1127
+ #
1128
+ # @example
1129
+ # # Output all options available.
1130
+ # options_manager = Sketchup.active_model.options
1131
+ # options_manager.each { |options_provider|
1132
+ # puts options_provider.name
1133
+ # options_provider.each { |key, value|
1134
+ # puts "> #{key} - #{value}"
1135
+ # }
1136
+ # }
1137
+ #
1138
+ # @return [Sketchup::OptionsManager]
1139
+ #
1140
+ # @version SketchUp 6.0
1141
+ def options
1142
+ end
1143
+
1144
+ #
1145
+ # @example
1146
+ # Sketchup.active_model.overlays.each { |overlay|
1147
+ # puts "#{overlay.name} (#{overlay.overlay_id}) Enabled: #{overlay.enabled?}"
1148
+ # }
1149
+ #
1150
+ # @return [Sketchup::OverlaysManager]
1151
+ #
1152
+ # @version SketchUp 2023.0
1153
+ def overlays
1154
+ end
1155
+
1156
+ # The {#pages} method retrieves a {Sketchup::Pages} object containing all of
1157
+ # the pages in the model.
1158
+ #
1159
+ # @example
1160
+ # model = Sketchup.active_model
1161
+ # pages = model.pages
1162
+ #
1163
+ # @return [Sketchup::Pages]
1164
+ #
1165
+ # @version SketchUp 6.0
1166
+ def pages
1167
+ end
1168
+
1169
+ # The path method retrieves the path of the file from which the model was
1170
+ # opened.
1171
+ #
1172
+ # An empty string is returned for a model that has not been saved.
1173
+ #
1174
+ # @example
1175
+ # model = Sketchup.active_model
1176
+ # path = model.path
1177
+ #
1178
+ # @return [String]
1179
+ #
1180
+ # @version SketchUp 6.0
1181
+ def path
1182
+ end
1183
+
1184
+ # The place_component method places a new component in the Model using the
1185
+ # component placement tool.
1186
+ #
1187
+ # @bug Before SketchUp 2026.0, attempting to place an empty component
1188
+ # would crash SketchUp. This function will now raise an ArgumentError
1189
+ # when called with an empty component definition.
1190
+ #
1191
+ # @example
1192
+ # model.place_component componentdefinition, repeat
1193
+ #
1194
+ # @param [Sketchup::ComponentDefinition] componentdef
1195
+ # A component definition object containing the
1196
+ # definition (blueprint) for the component.
1197
+ #
1198
+ # @param [Boolean] repeat
1199
+ # If set to true, stay in the component
1200
+ # placement tool and place multiple components.
1201
+ #
1202
+ # @raise [ArgumentError] if the component cannot not be placed
1203
+ # (for example, if it is an empty component definition).
1204
+ # Added in SketchUp 2026.0.
1205
+ #
1206
+ # @return [Sketchup::Model, nil] The model object on success or Nil
1207
+ #
1208
+ # @version SketchUp 6.0
1209
+ def place_component(componentdef, repeat = false)
1210
+ end
1211
+
1212
+ # The point_to_latlong method converts a point in the model to a LatLong so
1213
+ # that you can get its latitude and longitude.
1214
+ #
1215
+ # This method uses the location information set in ShadowInfo.
1216
+ #
1217
+ # NOTE: SketchUp 6.0 and higher has a change where this method returns a
1218
+ # Point3d instead of a LatLong, where the x and y values contain the LatLong
1219
+ # coordinates.
1220
+ #
1221
+ # @example
1222
+ # model = Sketchup.active_model
1223
+ # local_point = Geom::Point3d.new(10, 10, 10)
1224
+ # world_point = model.point_to_latlong(local_point)
1225
+ #
1226
+ # @param [Geom::Point3d] point
1227
+ # A Point3d object.
1228
+ #
1229
+ # @return [Geom::Point3d] Point3d[longitude_deg, latitude_deg, altitude_m]
1230
+ #
1231
+ # @return [Geom::Point3d, Geom::LatLong] a LatLong or Point3d object. See
1232
+ # details for information.
1233
+ #
1234
+ # @version SketchUp 6.0
1235
+ def point_to_latlong(point)
1236
+ end
1237
+
1238
+ # This method converts a Point3d object in the Model to UTM coordinates.
1239
+ #
1240
+ # This method uses the location information set in ShadowInfo. See also UTM.
1241
+ #
1242
+ # @example
1243
+ # model = Sketchup.active_model
1244
+ # point = Geom::Point3d.new(10, 10, 10)
1245
+ # utm = model.point_to_utm(point)
1246
+ #
1247
+ # @param [Geom::Point3d] point
1248
+ # A Point3d object.
1249
+ #
1250
+ # @return [Geom::UTM] a UTM object
1251
+ #
1252
+ # @version SketchUp 6.0
1253
+ def point_to_utm(point)
1254
+ end
1255
+
1256
+ # The {#raytest} method is used to cast a ray (line) through the model and return
1257
+ # the first thing that the ray hits.
1258
+ #
1259
+ # A ray is a two element array containing a point and a vector
1260
+ # +[Geom::Point3d, Geom::Vector3d]+. The point defines the start point of
1261
+ # the ray and the vector defines the direction. If direction can not be
1262
+ # normalized (e.g. +direction = [0, 0, 0]+), direction is taken as a point the
1263
+ # ray intersects.
1264
+ #
1265
+ # @example Using a pickray from the view
1266
+ # model = Sketchup.active_model
1267
+ # ray = model.active_view.pickray(200, 400) # Screen coordinates
1268
+ # item = model.raytest(ray)
1269
+ #
1270
+ # @example Using an arbitrary ray
1271
+ # model = Sketchup.active_model
1272
+ # ray = [Geom::Point3d.new(1, 2, 3), Geom::Vector3d.new(4, 5, 6)]
1273
+ # item = model.raytest(ray, false) # Consider hidden geometry when
1274
+ # # computing intersections.
1275
+ #
1276
+ # @param [Array(Geom::Point3d, Geom::Vector3d)] ray
1277
+ # A two element array containing a point and a vector.
1278
+ #
1279
+ # @param [Boolean] wysiwyg_flag
1280
+ # An optional boolean, added in SU8 M1, indicating
1281
+ # whether or not to consider hidden geometry in intersect
1282
+ # computations. If this flag is not specified, it
1283
+ # defaults to true (WYSIWYG) - i.e. hidden geometry is
1284
+ # not intersected against.
1285
+ #
1286
+ # @return [Array(Geom::Point3d, Array<Sketchup::Drawingelement>), nil] The first value is
1287
+ # a {Geom::Point3d} where the item that the ray passed through exists. The second element is
1288
+ # the instance path array of the entity that the ray hit. For example, if the ray hits a face
1289
+ # that is contained by a component instance the instance path would be [Component1].
1290
+ # If the ray hit a face that is contained by a component instance, which is contained by
1291
+ # another component instance and so on, the instance path would be [Component1, Component2,
1292
+ # Component3...].
1293
+ #
1294
+ # @see Sketchup::View#pickray
1295
+ #
1296
+ # @version SketchUp 6.0
1297
+ def raytest(ray, wysiwyg_flag = true)
1298
+ end
1299
+
1300
+ # The remove_observer method is used to remove an observer from the current
1301
+ # object.
1302
+ #
1303
+ # @example
1304
+ # model = Sketchup.active_model
1305
+ # observer = Sketchup::ModelObserver.new
1306
+ # model.add_observer(observer)
1307
+ # status = model.remove_observer(observer)
1308
+ #
1309
+ # @param [Object] observer
1310
+ # An observer.
1311
+ #
1312
+ # @return [Boolean] true if successful, false if unsuccessful.
1313
+ #
1314
+ # @version SketchUp 6.0
1315
+ def remove_observer(observer)
1316
+ end
1317
+
1318
+ # The {#rendering_options} method retrieves the RenderingOptions object for
1319
+ # this model.
1320
+ #
1321
+ # @example
1322
+ # model = Sketchup.active_model
1323
+ # renderingoptions = model.rendering_options
1324
+ #
1325
+ # @return [Sketchup::RenderingOptions]
1326
+ #
1327
+ # @version SketchUp 6.0
1328
+ def rendering_options
1329
+ end
1330
+
1331
+ # This method is used to save the model to a file.
1332
+ #
1333
+ # @example
1334
+ # model = Sketchup.active_model
1335
+ # # Save the model using the current SketchUp format
1336
+ # path = File.join(ENV['HOME'], 'Desktop', 'mysketchup.skp')
1337
+ # status = model.save(path)
1338
+ #
1339
+ # # Save the model to the current file using the current SketchUp format
1340
+ # status = model.save
1341
+ #
1342
+ # # Save the model to the current file in SketchUp 8 format
1343
+ # status = model.save("", Sketchup::Model::VERSION_8)
1344
+ #
1345
+ # # Save the model in SketchUp 8 format
1346
+ # path = File.join(ENV['Home'], 'Desktop', 'mysketchup_v8.skp')
1347
+ # status = model.save(path, Sketchup::Model::VERSION_8)
1348
+ #
1349
+ # @note A bug in SketchUp 2016 and older caused the +.skb+ backup file
1350
+ # written during save to be empty. The +.skp+ file was however valid.
1351
+ #
1352
+ # @note Starting with SketchUp 2021, SketchUp is using a the same file format across versions.
1353
+ # For instance, SketchUp 2021 can open a file made in SketchUp 2022.
1354
+ #
1355
+ # @overload save
1356
+ #
1357
+ # Save model to the path it is already associated with.
1358
+ # @raise ArgumentError if the model is not previosly saved.
1359
+ # @version SketchUp 2014
1360
+ #
1361
+ # @overload save(path)
1362
+ #
1363
+ # Save the model to a given path.
1364
+ # @version SketchUp 6.0
1365
+ # @param [String] path
1366
+ # If empty, the model saves to the path it is already associated with.
1367
+ #
1368
+ # @overload save(path, version)
1369
+ #
1370
+ # Save the model as a specific SketchUp file version to a given path.
1371
+ # @version SketchUp 2014
1372
+ # @param [String] path
1373
+ # @param [Integer] version
1374
+ # Possible values are:
1375
+ # - {Sketchup::Model::VERSION_3}
1376
+ # - {Sketchup::Model::VERSION_4}
1377
+ # - {Sketchup::Model::VERSION_5}
1378
+ # - {Sketchup::Model::VERSION_6}
1379
+ # - {Sketchup::Model::VERSION_7}
1380
+ # - {Sketchup::Model::VERSION_8}
1381
+ # - {Sketchup::Model::VERSION_2013}
1382
+ # - {Sketchup::Model::VERSION_2014}
1383
+ # - {Sketchup::Model::VERSION_2015}
1384
+ # - {Sketchup::Model::VERSION_2016}
1385
+ # - {Sketchup::Model::VERSION_2017}
1386
+ # - {Sketchup::Model::VERSION_2018}
1387
+ # - {Sketchup::Model::VERSION_2019}
1388
+ # - {Sketchup::Model::VERSION_2020}
1389
+ # - {Sketchup::Model::VERSION_2021}
1390
+ #
1391
+ # @return [Boolean] +true+ if successful, +false+ if unsuccessful
1392
+ #
1393
+ # @see #save_copy
1394
+ def save(*args)
1395
+ end
1396
+
1397
+ # This method is used to save the copy of the current model to a file.
1398
+ #
1399
+ # @example
1400
+ # model = Sketchup.active_model
1401
+ # # Save copy of the model using the current SketchUp format
1402
+ # path = File.join(ENV['Home'], 'Desktop', 'myModelCopy.skp')
1403
+ # status = model.save_copy(path)
1404
+ #
1405
+ # # Save copy of the model in SketchUp 8 format
1406
+ # path = File.join(ENV['Home'], 'Desktop', 'mysketchupcopy_v8.skp')
1407
+ # status = model.save_copy(path, Sketchup::Model::VERSION_8)
1408
+ #
1409
+ # @overload save_copy(path)
1410
+ #
1411
+ # @param [String] path
1412
+ # The path of the file to save the model copy to.
1413
+ #
1414
+ # @overload save_copy(path, version)
1415
+ #
1416
+ # @param [String] path
1417
+ # The path of the file to save the model copy to.
1418
+ #
1419
+ # @param [Integer] version
1420
+ # See {Sketchup::Model#save} for supported values.
1421
+ #
1422
+ # @return [Boolean] true if successful, false if unsuccessful
1423
+ #
1424
+ # @see #save
1425
+ #
1426
+ # @version SketchUp 2014
1427
+ def save_copy(*args)
1428
+ end
1429
+
1430
+ # The save_thumbnail method is used to save a thumbnail image to a file.
1431
+ # The image format is specified by the file extension of filename. Supported
1432
+ # formats are bmp, jpg, png, tif, pct, and gif.
1433
+ #
1434
+ # @example
1435
+ # model = Sketchup.active_model
1436
+ # status = model.save_thumbnail('testthumbnail2.jpg')
1437
+ #
1438
+ # @param [String] filename
1439
+ # The name of the file, with extension, to save the
1440
+ # thumbnail as.
1441
+ #
1442
+ # @return [Boolean] true if successful, false if unsuccessful
1443
+ #
1444
+ # @version SketchUp 6.0
1445
+ def save_thumbnail(filename)
1446
+ end
1447
+
1448
+ # The {#select_tool} method is used to select a SketchUp Tool object as the active tool.
1449
+ # To activate the native Select tool, pass nil as the argument.
1450
+ #
1451
+ # Before calling this method, you need to implement the SketchUp Tool interface
1452
+ # and create a tool object. Then, pass the tool object to this method to activate it.
1453
+ #
1454
+ # the native Select tool.
1455
+ #
1456
+ # @example
1457
+ # model = Sketchup.active_model
1458
+ # tool = model.select_tool(nil)
1459
+ #
1460
+ # @note If you call select_tool from within the initialize method of a custom tool, the call will
1461
+ # be ignored.
1462
+ #
1463
+ # @param [Object] tool
1464
+ # A tool instance object to activate, or nil to activate
1465
+ #
1466
+ # @return [Sketchup::Model] The Model object.
1467
+ #
1468
+ # @version SketchUp 6.0
1469
+ def select_tool(tool)
1470
+ end
1471
+
1472
+ # This method retrieves a Selection object for the model, containing the
1473
+ # currently selected entities. The entries in the selection list are not
1474
+ # necessarily in the same order in which the user selected them.
1475
+ #
1476
+ # @example
1477
+ # model = Sketchup.active_model
1478
+ # selection = model.selection
1479
+ #
1480
+ # @return [Sketchup::Selection] A Selection object with 0 or more entities
1481
+ # that are currently selected.
1482
+ #
1483
+ # @version SketchUp 6.0
1484
+ def selection
1485
+ end
1486
+
1487
+ # This method is used to set the value of an attribute in an attribute
1488
+ # dictionary with the given name.
1489
+ #
1490
+ # This method can be used create a new AttributeDictionary object, if needed.
1491
+ #
1492
+ # @example
1493
+ # model = Sketchup.active_model
1494
+ # value = model.set_attribute('attributedictionaryname', 'key', 'value')
1495
+ #
1496
+ # @param [String] attrdictname
1497
+ # The name of the attribute dictionary whose attribute
1498
+ # you wish to set.
1499
+ #
1500
+ # @param [String] key
1501
+ # The attribute name.
1502
+ #
1503
+ # @param [Object] value
1504
+ # The value to set.
1505
+ #
1506
+ # @return [Object] the value that was set
1507
+ #
1508
+ # @version SketchUp 6.0
1509
+ def set_attribute(attrdictname, key, value)
1510
+ end
1511
+
1512
+ # This method sets the datum used in conversions between the internal
1513
+ # coordinate system and UTM.
1514
+ #
1515
+ # The default datum is WGS84. You can use the method list_datums to get a list
1516
+ # of all of the datums supported in SketchUp. If you pass an invalid datum to
1517
+ # set_datum, set_datum returns the default datum.
1518
+ #
1519
+ # @example
1520
+ # model = Sketchup.active_model
1521
+ # value = model.set_datum('Adindan')
1522
+ #
1523
+ # @param [String] datum
1524
+ #
1525
+ # @return [nil]
1526
+ #
1527
+ # @version SketchUp 6.0
1528
+ def set_datum(datum)
1529
+ end
1530
+
1531
+ # This method is used to retrieve the shadow information for the Model.
1532
+ #
1533
+ # @example
1534
+ # model = Sketchup.active_model
1535
+ # shadowinfo = model.shadow_info
1536
+ #
1537
+ # @return [Sketchup::ShadowInfo]
1538
+ #
1539
+ # @version SketchUp 6.0
1540
+ def shadow_info
1541
+ end
1542
+
1543
+ # The {#start_operation} method is used to notify SketchUp that a new
1544
+ # operation (which can be undone) is starting.
1545
+ #
1546
+ # The +op_name+ argument is a description for the operation that is displayed
1547
+ # adjacent to the Edit > Undo menu item. Make sure to provide a user friendly
1548
+ # name for your operation.
1549
+ #
1550
+ # Starting with SketchUp 7.0, there are three additional booleans that one can
1551
+ # pass in when starting an operation. It is recommended to always set
1552
+ # +disable_ui+ to +true+. It's left to +false+ for default for compatibility
1553
+ # reasons.
1554
+ #
1555
+ # @example Observer Operation since SU2016
1556
+ # class MyDefinitionsObserver < Sketchup::DefinitionObserver
1557
+ # def onComponentAdded(definitions, definition)
1558
+ # return if definition.deleted?
1559
+ # # The operation name won't be displayed when the fourth argument is
1560
+ # # +true+. It will absorb into the previous operation.
1561
+ # definition.model.start_operation('Tag It', true, false, true)
1562
+ # definition.set_attribute('MyExtension', 'Tag', 'You are it')
1563
+ # definition.model.commit_operation
1564
+ # end
1565
+ # end
1566
+ #
1567
+ # observer = MyDefinitionsObserver.new
1568
+ # model = Sketchup.active_model
1569
+ # model.definitions.add_observer(observer)
1570
+ #
1571
+ # @example Typical Operation
1572
+ # model = Sketchup.active_model
1573
+ # model.start_operation('Generate House', true)
1574
+ # model.entities.add_line([0, 0, 0], [9, 0, 0])
1575
+ # model.entities.add_line([9, 0, 0], [9, 0, 9])
1576
+ # model.commit_operation
1577
+ #
1578
+ # @note Operations in SketchUp are sequential and cannot be nested. If you start a
1579
+ # new Ruby operation while another is still open, you will implicitly close
1580
+ # the first one.
1581
+ #
1582
+ # @param [String] op_name
1583
+ # name of the operation visible in the UI
1584
+ #
1585
+ # @param [Boolean] disable_ui
1586
+ # if set to true, then SketchUp's tendency to
1587
+ # update the user interface after each geometry change will be
1588
+ # suppressed. This can result in much faster Ruby code execution if the
1589
+ # operation involves updating the model in any way.
1590
+ #
1591
+ # @param [Boolean] next_transparent
1592
+ # <b>Deprecated!</b> if set to true, then
1593
+ # whatever operation comes after this one will be appended into one
1594
+ # combined operation, allowing the user the undo both actions with a
1595
+ # single undo command. This flag is a highly difficult one, since there
1596
+ # are so many ways that a SketchUp user can interrupt a given operation
1597
+ # with one of their own. <b>Use extreme caution</b> and test thoroughly
1598
+ # when setting this to true.
1599
+ #
1600
+ # @param [Boolean] transparent
1601
+ # if set to true, then this operation will
1602
+ # append to the previous operation. This is particularly useful for
1603
+ # creating observers that react to user actions without littering the
1604
+ # undo stack with extra steps that Ruby is performing.
1605
+ #
1606
+ # @raise [RuntimeError] if called within the context of {Sketchup::Entities#build}.
1607
+ #
1608
+ # @return [Boolean] +true+ if successful, +false+ if unsuccessful
1609
+ #
1610
+ # @version SketchUp 6.0
1611
+ def start_operation(op_name, disable_ui = false, next_transparent = false, transparent = false)
1612
+ end
1613
+
1614
+ # The {#styles} method retrieves the styles associated with the model.
1615
+ #
1616
+ # @example
1617
+ # model = Sketchup.active_model
1618
+ # styles = model.styles
1619
+ #
1620
+ # @return [Sketchup::Styles]
1621
+ #
1622
+ # @version SketchUp 6.0
1623
+ def styles
1624
+ end
1625
+
1626
+ # The tags method retrieves the string tags of the model.
1627
+ #
1628
+ # @example
1629
+ # model = Sketchup.active_model
1630
+ # tags = model.tags
1631
+ #
1632
+ # @return [String] string tags of the model
1633
+ #
1634
+ # @version SketchUp 6.0
1635
+ def tags
1636
+ end
1637
+
1638
+ # The tags= method sets the string tags of the model.
1639
+ #
1640
+ # @example
1641
+ # Sketchup.active_model.tags = "Building, House, Brick"
1642
+ #
1643
+ # @param [String] tags
1644
+ # new tags of the model
1645
+ #
1646
+ # @return [String] the new tags
1647
+ #
1648
+ # @version SketchUp 6.0
1649
+ def tags=(tags)
1650
+ end
1651
+
1652
+ # The {#title} method retrieves the name of the model. If the model is saved on
1653
+ # disk, returns the file name without extension. Otherwise returns an empty
1654
+ # string.
1655
+ #
1656
+ # @example
1657
+ # model = Sketchup.active_model
1658
+ # title = model.title
1659
+ #
1660
+ # @return [String] the title of the model or an empty string (if
1661
+ # the title is not set)
1662
+ #
1663
+ # @version SketchUp 6.0
1664
+ def title
1665
+ end
1666
+
1667
+ # The {#tools} method is used to retrieve the current {Sketchup::Tools} object.
1668
+ #
1669
+ # @example
1670
+ # model = Sketchup.active_model
1671
+ # tools = model.tools
1672
+ #
1673
+ # @return [Sketchup::Tools] a Tools object.
1674
+ #
1675
+ # @version SketchUp 6.0
1676
+ def tools
1677
+ end
1678
+
1679
+ # The utm_to_point method converts a position given in UTM coordinates to a
1680
+ # Point3d in the Model.
1681
+ #
1682
+ # @example
1683
+ # model = Sketchup.active_model
1684
+ # utm = Geom::UTM.new([+1, "A", 0.12333333, 0.12321321])
1685
+ # point = model.utm_to_point(utm)
1686
+ #
1687
+ # @param [Geom::UTM] utm
1688
+ # A UTM object.
1689
+ #
1690
+ # @return [Geom::Point3d] A Point3d object.
1691
+ #
1692
+ # @version SketchUp 6.0
1693
+ def utm_to_point(utm)
1694
+ end
1695
+
1696
+ # Determine if a model is a valid Sketchup::Model object. Returns false
1697
+ # if the model has been closed.
1698
+ #
1699
+ # This is useful on the mac where one can have multiple models open at the
1700
+ # same time. In such a case, this method can tell you if the user has closed
1701
+ # the model before you perform operations on it.
1702
+ #
1703
+ # @example
1704
+ # # This is a silly example since the active model is generally going to
1705
+ # # be valid, but it illustrates the idea.
1706
+ # model = Sketchup.active_model
1707
+ #
1708
+ # @return [Boolean]
1709
+ #
1710
+ # @version SketchUp 6.0
1711
+ def valid?
1712
+ end
1713
+
1714
+ end