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,659 +1,673 @@
1
- # Copyright:: Copyright 2023 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # The {Sketchup::ComponentDefinition} class is used to define the contents for
5
- # a SketchUp component. Components are a collection of entities that can be
6
- # instanced and reused multiple times throughout a model. For example, you
7
- # could draw a chair once, turn it into a component, and then use 6 instances
8
- # of it to surround a table. Edits to the original "definition" will then
9
- # propagate across all of its instances.
10
- #
11
- # The ComponentDefinition class contains the global entities and settings for
12
- # each definition. See the {Sketchup::ComponentInstance} class for how each
13
- # copy is defined.
14
- #
15
- # Starting from SketchUp 2018+, the {Sketchup::ComponentDefinition} class
16
- # contains a new default attribute dictionary named "SU_DefinitionSet" with
17
- # default keys named named "Price", "Size", "Url". See the
18
- # {https://help.sketchup.com/en/article/3000124 Help article} for more
19
- # information. The dictionary cannot be deleted via ruby and an ArgumentError
20
- # will be raised. The key/value pairs in the dictionary can be deleted safely.
21
- #
22
- # @version SketchUp 6.0
23
- class Sketchup::ComponentDefinition < Sketchup::Drawingelement
24
-
25
- # Includes
26
-
27
- include Comparable
28
-
29
- # Instance Methods
30
-
31
- # The <=> method is used to compare two ComponentDefinition objects for
32
- # sorting. The comparison is done based on the component name.
33
- #
34
- # @example
35
- # c1=Sketchup.find_support_file "Bed.skp",
36
- # "Components/Components Sampler/"
37
- # c2=Sketchup.find_support_file "Fence.skp",
38
- # "Components/Components Sampler/"
39
- # if c1 <=> c2
40
- # UI.messagebox("c1 sorts before c2")
41
- # end
42
- #
43
- # @param [Sketchup::ComponentDefinition] compdef2
44
- # The second component definition in the comparison.
45
- #
46
- # @return [Integer] a -1 if component1 is less then component2. A 1
47
- # if component1 greater than component2
48
- #
49
- # @version SketchUp 6.0
50
- def <=>(compdef2)
51
- end
52
-
53
- # The == method is used to test if two ComponentDefinition objects are the
54
- # same (based on their address in memory).
55
- #
56
- # @example
57
- # c1=Sketchup.find_support_file "Bed.skp",
58
- # "Components/Components Sampler/"
59
- # c2=Sketchup.find_support_file "Fence.skp",
60
- # "Components/Components Sampler/"
61
- # if c1 == c2
62
- # UI.messagebox("These definitions are the same.")
63
- # end
64
- #
65
- # @param [Sketchup::ComponentDefinition] compdef2
66
- # The second component definition in the comparison.
67
- #
68
- # @return [Boolean] true if the ComponentDefinition objects are
69
- # the same object. False if the objects are not the same.
70
- #
71
- # @version SketchUp 6.0
72
- def ==(compdef2)
73
- end
74
-
75
- # The add_classification method is used to add a given classification to
76
- # the component.
77
- #
78
- # Note that you cannot classify image definitions.
79
- #
80
- # @example
81
- # definition = Sketchup.active_model.definitions.first
82
- # success = definition.add_classification("IFC 2x3", "IfcDoor")
83
- #
84
- # @param [String] schema_name
85
- # a String - Schema name to add
86
- #
87
- # @param [String] schema_type
88
- # a String - Schema type to add
89
- #
90
- # @return [Boolean] true if the classification succeeds. Otherwise false.
91
- #
92
- # @version SketchUp 2015
93
- def add_classification(schema_name, schema_type)
94
- end
95
-
96
- # The add_observer method is used to add an observer to the current object.
97
- #
98
- # @example
99
- # componentdefinition = Sketchup.active_model.definitions[0]
100
- # status = componentdefinition.add_observer observer
101
- #
102
- # @param [Object] observer
103
- # An observer.
104
- #
105
- # @return [Boolean] true if successful, false if unsuccessful.
106
- #
107
- # @version SketchUp 6.0
108
- def add_observer(observer)
109
- end
110
-
111
- # The behavior method is used to retrieve the Behavior object associated with
112
- # a component definition.
113
- #
114
- # @example
115
- # path = Sketchup.find_support_file "Bed.skp",
116
- # "Components/Components Sampler/"
117
- # model = Sketchup.active_model
118
- # definitions = model.definitions
119
- # componentdefinition = definitions.load path
120
- # behavior = componentdefinition.behavior
121
- #
122
- # @return [Sketchup::Behavior] a Behavior object if successful
123
- #
124
- # @version SketchUp 6.0
125
- def behavior
126
- end
127
-
128
- # The count_instances method is used to count the number of unique component
129
- # instances in a model using this component definition. This does not represent
130
- # the total number of instances placed in the model as it doesn't take into
131
- # account instances inside unused definitions.
132
- #
133
- # @example
134
- # path = Sketchup.find_support_file('Bed.skp',
135
- # 'Components/Components Sampler/')
136
- # definitions = Sketchup.active_model.definitions
137
- # definition = definitions.load(path)
138
- # number = definition.count_instances
139
- #
140
- # @return [Integer] the number of component instances of this
141
- # component definition (if successful)
142
- #
143
- # @version SketchUp 6.0
144
- def count_instances
145
- end
146
-
147
- # The count_used_instances method is used to count the total number of
148
- # component instances in a model using this component definition. This method
149
- # takes into account the full hierarchy of the model.
150
- #
151
- # @example
152
- # path = Sketchup.find_support_file('Bed.skp',
153
- # 'Components/Components Sampler/')
154
- # definitions = Sketchup.active_model.definitions
155
- # definition = definitions.load(path)
156
- # number = definition.count_used_instances
157
- #
158
- # @return [Integer] the number of component instances of this
159
- # component definition (if successful)
160
- #
161
- # @version SketchUp 2016
162
- def count_used_instances
163
- end
164
-
165
- # The description method is used to retrieve the description of the component
166
- # definition.
167
- #
168
- # Component definitions do not have a description, by default.
169
- #
170
- # @example
171
- # # Get the description
172
- # componentdefinition = Sketchup.active_model.definitions[0]
173
- # description = componentdefinition.description
174
- #
175
- # @return [String] the description of the component definition if successful
176
- #
177
- # @version SketchUp 6.0
178
- def description
179
- end
180
-
181
- # The description= method is used to set the description for the component
182
- # definition.
183
- #
184
- # @example
185
- # componentdefinition = Sketchup.active_model.definitions[0]
186
- # componentdefinition.description = "This is a traditional bed"
187
- # description = componentdefinition.description
188
- #
189
- # @param [String] description
190
- #
191
- # @return [String] the description if successful, false if
192
- # unsuccessful
193
- #
194
- # @version SketchUp 6.0
195
- def description=(description)
196
- end
197
-
198
- # The entities method retrieves a collection of all the entities in the
199
- # component definition
200
- #
201
- # @example
202
- # componentdefinition = Sketchup.active_model.definitions[0]
203
- # entities = componentdefinition.entities
204
- #
205
- # @return [Sketchup::Entities] an Entities object if successful
206
- #
207
- # @version SketchUp 6.0
208
- def entities
209
- end
210
-
211
- # The get_classification_value method is used to retrieve the value from
212
- # a classification attribute given a key path.
213
- #
214
- # @example
215
- # definition = Sketchup.active_model.definitions.first
216
- # definition.add_classification("IFC 2x3", "IfcDoor")
217
- #
218
- # path = ["IFC 2x3", "IfcDoor", "ObjectType", "IfcLabel"]
219
- # value = definition.get_classification_value(path)
220
- #
221
- # @param [Array<String>] path
222
- # An array composed of the key path to the value.
223
- #
224
- # @return [Object, nil] a Ruby object if successful, nil otherwise.
225
- #
226
- # @version SketchUp 2015
227
- def get_classification_value(path)
228
- end
229
-
230
- # The group? method is used to determine if this component definition is used
231
- # to hold the elements of a group.
232
- #
233
- # @example
234
- # path = Sketchup.find_support_file "Bed.skp",
235
- # "Components/Components Sampler/"
236
- # model = Sketchup.active_model
237
- # definitions = model.definitions
238
- # componentdefinition = definitions.load path
239
- # status = componentdefinition.group?
240
- #
241
- # @return [Boolean]
242
- #
243
- # @version SketchUp 6.0
244
- def group?
245
- end
246
-
247
- # The guid method is used to retrieve the unique identifier of this component
248
- # definition. The guid changes after the component definition is modified and
249
- # the component edit is exited.
250
- #
251
- # @example
252
- # componentdefinition = Sketchup.active_model.definitions[0]
253
- # guid = componentdefinition.guid
254
- #
255
- # @return [String] a string guid if successful
256
- #
257
- # @version SketchUp 6.0
258
- def guid
259
- end
260
-
261
- # The hidden method is used to determine if this component definition should
262
- # be hidden on the component browser.
263
- #
264
- # @example
265
- # componentdefinition = Sketchup.active_model.definitions[0]
266
- # status = componentdefinition.hidden?
267
- #
268
- # @return [Boolean]
269
- #
270
- # @version SketchUp 6.0
271
- def hidden?
272
- end
273
-
274
- # The image? method is used to determine if this component definition is used
275
- # to define an image.
276
- #
277
- # @example
278
- # componentdefinition = Sketchup.active_model.definitions[0]
279
- # status = componentdefinition.image?
280
- # if (status)
281
- # UI.messagebox "Component definition defines an image"
282
- # else
283
- # UI.messagebox status.to_s
284
- # UI.messagebox "Component definition does not define an image"
285
- # end
286
- #
287
- # @return [Boolean]
288
- #
289
- # @version SketchUp 6.0
290
- def image?
291
- end
292
-
293
- # The insertion_point method is used to retrieve the Point3d object where the
294
- # component was inserted.
295
- #
296
- # @deprecated SketchUp 2020.0 removed the insertion point feature.
297
- # The getter will always return the origin point and the
298
- # setter becomes a no-op.
299
- #
300
- # @example
301
- # point = Geom::Point3d.new 10,20,30
302
- # transform = Geom::Transformation.new point
303
- # model = Sketchup.active_model
304
- # entities = model.active_entities
305
- # path = Sketchup.find_support_file "Bed.skp",
306
- # "Components/Components Sampler/"
307
- # definitions = model.definitions
308
- # componentdefinition = definitions.load path
309
- # instance = entities.add_instance componentdefinition, transform
310
- # point = componentdefinition.insertion_point
311
- #
312
- # @return [Geom::Point3d] the Point3d where the component was inserted if
313
- # successful. False if unsuccessful.
314
- #
315
- # @version SketchUp 6.0
316
- def insertion_point
317
- end
318
-
319
- # Sets the insertion point of your definition.
320
- #
321
- # @deprecated SketchUp 2020.0 removed the insertion point feature.
322
- # The getter will always return the origin point and the
323
- # setter becomes a no-op.
324
- #
325
- # @example
326
- # point = Geom::Point3d.new(10, 20, 0)
327
- # componentdefinition = Sketchup.active_model.definitions[0]
328
- # componentdefinition.insertion_point = point
329
- #
330
- # @param [Geom::Point3d] point
331
- # The Point3d object to use as the
332
- # insertion point.
333
- #
334
- # @return [Geom::Point3d] The Point3d object used as the insertion point.
335
- #
336
- # @version SketchUp 6.0
337
- def insertion_point=(point)
338
- end
339
-
340
- # The instances method is used to return any array of ComponentInstancesfor
341
- # this ComponentDefinition.
342
- #
343
- # @example
344
- # componentdefinition = Sketchup.active_model.definitions[0]
345
- # instances = componentdefinition.instances
346
- #
347
- # @return [Array<Sketchup::ComponentInstance>] an array of ComponentInstances
348
- # (if successful)
349
- #
350
- # @version SketchUp 6.0
351
- def instances
352
- end
353
-
354
- # The internal? method is used to determine if the component definition is
355
- # internal to the Component Browser
356
- #
357
- # @example
358
- # point = Geom::Point3d.new 10,20,30
359
- # transform = Geom::Transformation.new point
360
- # model = Sketchup.active_model
361
- # entities = model.active_entities
362
- # path = Sketchup.find_support_file "Bed.skp",
363
- # "Components/Components Sampler/"
364
- # definitions = model.definitions
365
- # componentdefinition = definitions.load path
366
- # status = componentdefinition.internal?
367
- #
368
- # @return [Boolean]
369
- #
370
- # @version SketchUp 6.0
371
- def internal?
372
- end
373
-
374
- # Invalidates the bounding box of your definition. This command forces the
375
- # update of the bounding box of definition while inside an operation.
376
- # See Model.start_operation for how to start an operation.
377
- #
378
- # This method is useful if you make changes to your geometry using the Ruby
379
- # API and then need to know your bounding box size. This method forces
380
- # SketchUp to recalculate the definition's bounding box when you choose.
381
- #
382
- # @example
383
- # componentdefinition = Sketchup.active_model.definitions[0]
384
- # componentdefinition.invalidate_bounds
385
- #
386
- # @return [Boolean] true if successful
387
- #
388
- # @version SketchUp 6.0
389
- def invalidate_bounds
390
- end
391
-
392
- # The {#live_component?} method is used to identify Live Components and
393
- # sub-definitions of Live Components.
394
- #
395
- # @example Skipping Live Components
396
- # model = Sketchup.active_model
397
- # model.definitions.each { |definition|
398
- # next if definition.live_component?
399
- # puts definition.name
400
- # }
401
- #
402
- # @note These components are parametrically generated and API users should not
403
- # modify them.
404
- #
405
- # @return [Boolean]
406
- #
407
- # @version SketchUp 2021.0
408
- def live_component?
409
- end
410
-
411
- # The name method retrieves the name of the component definition.
412
- #
413
- # @example
414
- # path = Sketchup.find_support_file "Bed.skp",
415
- # "Components/Components Sampler/"
416
- # model = Sketchup.active_model
417
- # definitions = model.definitions
418
- # componentdefinition = definitions.load path
419
- # name = componentdefinition.name
420
- #
421
- # @return [String] the component definition's name if successful
422
- #
423
- # @version SketchUp 6.0
424
- def name
425
- end
426
-
427
- # The {name=} method is used to set the name of the component definition.
428
- #
429
- # The name should be unique to the model, if it's not the name will automatically
430
- # be made unique.
431
- #
432
- # @bug In SketchUp 2022.0 a bug might lead to an available name being incorrectly renamed. Or
433
- # a name that should be unavailable would be duplicated. This was fixed in SketchUp 2022.0.1.
434
- #
435
- # @example
436
- # path = Sketchup.find_support_file "Bed.skp",
437
- # "Components/Components Sampler/"
438
- # model = Sketchup.active_model
439
- # definitions = model.definitions
440
- # componentdefinition = definitions.load path
441
- # name = componentdefinition.name="Bed"
442
- #
443
- # @param [String] name
444
- #
445
- # @return [String]
446
- #
447
- # @version SketchUp 6.0
448
- def name=(name)
449
- end
450
-
451
- # The path method is used to retrieve the path where the component was loaded.
452
- #
453
- # @example
454
- # path = Sketchup.find_support_file("Bed.skp", "Components/Components Sampler/")
455
- # model = Sketchup.active_model
456
- # definitions = model.definitions
457
- # componentdefinition = definitions.load(path)
458
- # path = componentdefinition.path
459
- #
460
- # @return [String] Returns empty string if it is an internal component.
461
- #
462
- # @version SketchUp 6.0
463
- def path
464
- end
465
-
466
- # The refresh_thumbnail method is used to force SketchUp to regenerate the
467
- # thumbnail image that appears in the component browser. This is useful if
468
- # you've used the API to change the geometry of your component and would
469
- # like the thumbnail to match.
470
- #
471
- # @example
472
- # componentdefinition = Sketchup.active_model.definitions[0]
473
- # componentdefinition.refresh_thumbnail
474
- #
475
- # @return [nil]
476
- #
477
- # @version SketchUp 7.0
478
- def refresh_thumbnail
479
- end
480
-
481
- # The remove_classification method is used to remove a given classification
482
- # from the component.
483
- #
484
- # Note that you cannot classify image definitions.
485
- #
486
- # @example
487
- # definition = Sketchup.active_model.definitions.first
488
- # success = definition.remove_classification("IFC 2x3", "IfcDoor")
489
- #
490
- # @param [String] schema_name
491
- # Schema name to remove
492
- #
493
- # @param [String] schema_type
494
- # Schema type to remove. If not provided or an
495
- # empty string, the currently applied schema type for the
496
- # given schema name will be removed.
497
- #
498
- # @return [Boolean] true if the removal succeeds. Otherwise false.
499
- #
500
- # @version SketchUp 2015
501
- def remove_classification(schema_name, schema_type)
502
- end
503
-
504
- # The remove_observer method is used to remove an observer from the current
505
- # object.
506
- #
507
- # @example
508
- # componentdefinition = Sketchup.active_model.definitions[0]
509
- # status = componentdefinition.remove_observer observer
510
- #
511
- # @param [Object] observer
512
- # An observer.
513
- #
514
- # @return [Boolean] true if successful, false if unsuccessful.
515
- #
516
- # @version SketchUp 6.0
517
- def remove_observer(observer)
518
- end
519
-
520
- # The {#save_as} method is used to save your definition as a SketchUp file at the
521
- # specified file destination.
522
- #
523
- # Use this method when the user has chosen a path. If you want to "silently" save
524
- # out the definition, without changing the path it is associated with, use
525
- # {#save_copy} instead.
526
- #
527
- # @example
528
- # my_definition = Sketchup.active_model.definitions[0]
529
- # my_definition.save_as("c:\\myComponent.skp")
530
- #
531
- # @overload save_as(file_path)
532
- #
533
- # Save as the current SketchUp version.
534
- # @param [String] file_path
535
- # @version SketchUp 7.0
536
- #
537
- # @overload save_as(file_path, version)
538
- #
539
- # Save as a specific SketchUp version.
540
- # @param [String] file_path
541
- # @param [Integer] version
542
- # See {Sketchup::Model#save} for supported values.
543
- # @version SketchUp 2022.0
544
- #
545
- # @return [Boolean] true if successful
546
- def save_as(*args)
547
- end
548
-
549
- # The {#save_copy} method is used to save your definition as a SketchUp file
550
- # without changing the file path it is already associated with.
551
- #
552
- # This can be used to save out to a temporary file used by some other process,
553
- # without having the temporary path permanentely written to the SketchUp
554
- # model.
555
- #
556
- # @example
557
- # my_definition = Sketchup.active_model.definitions[0]
558
- # my_definition.save_copy("c:\\myComponent.skp")
559
- #
560
- # @overload save_copy(file_path)
561
- #
562
- # Save as the current SketchUp version.
563
- # @param [String] file_path
564
- #
565
- # @overload save_copy(file_path, version)
566
- #
567
- # Save as a specific SketchUp version.
568
- # @param [String] file_path
569
- # @param [Integer] version
570
- # See {Sketchup::Model#save} for supported values.
571
- #
572
- # @return [Boolean] true if successful
573
- #
574
- # @version SketchUp 2022.0
575
- def save_copy(*args)
576
- end
577
-
578
- # Saves a component thumbnail image. The image format is specified by the
579
- # file extension of filePath. Supported image formats are bmp, jpg, png,
580
- # tif, pct, and gif.
581
- #
582
- # @example
583
- # componentdefinition = Sketchup.active_model.definitions[0]
584
- # componentdefinition.save_thumbnail "test_thumb.png"
585
- #
586
- # @param [String] filename
587
- #
588
- # @return [Boolean] true if successful, false otherwise.
589
- #
590
- # @version SketchUp 7.0
591
- def save_thumbnail(filename)
592
- end
593
-
594
- # The set_classification_value method is used to set the value of a
595
- # classification attribute given a key path.
596
- #
597
- # @example
598
- # definition = Sketchup.active_model.definitions.first
599
- # definition.add_classification("IFC 2x3", "IfcDoor")
600
- #
601
- # path = ["IFC 2x3", "IfcDoor", "ObjectType", "IfcLabel"]
602
- # success = definition.set_classification_value(path, "Room 101")
603
- #
604
- # @param [Array<String>] path
605
- # An array composed of the key path to the value.
606
- #
607
- # @param [Object] value
608
- # A value valid for that specific attribute.
609
- #
610
- # @raise [NotImplementedError] when trying to set the value of "choice"
611
- # attributes.
612
- #
613
- # @raise [RuntimeError] if the attributes being set are corrupt.
614
- #
615
- # @raise [TypeError] when trying to set a value that is not valid for the
616
- # attribute.
617
- #
618
- # @return [Boolean] true if the path was valid, false otherwise.
619
- #
620
- # @version SketchUp 2015
621
- def set_classification_value(path, value)
622
- end
623
-
624
- # The {#thumbnail_camera} method is used to retrieve a camera representing
625
- # the thumbnail associated with the component definition.
626
- #
627
- # @example
628
- # # Get the thumbnail camera
629
- # componentdefinition = Sketchup.active_model.definitions[0]
630
- # thumbnail_camera = componentdefinition.thumbnail_camera
631
- #
632
- # @return [Sketchup::Camera] the camera associated with the thumbnail.
633
- #
634
- # @version SketchUp 2023.0
635
- def thumbnail_camera
636
- end
637
-
638
- # The {#thumbnail_camera=} method is used to set the camera for the
639
- # thumbnail associated with the component definition.
640
- #
641
- # @example
642
- # componentdefinition = Sketchup.active_model.definitions[0]
643
- # eye = Geom::Point3d.new(20, 5, 30)
644
- # target = Geom::Point3d.new(20, 60, 25)
645
- # up = Z_AXIS
646
- # camera = Sketchup::Camera.new(eye, target, up)
647
- # # Assign camera to the thumbnail's camera and refresh.
648
- # componentdefinition.thumbnail_camera = camera
649
- # componentdefinition.refresh_thumbnail
650
- #
651
- # @param [Sketchup::Camera] camera
652
- #
653
- # @raise [TypeError] if the passed argument is not of {#Sketchup::Camera} type.
654
- #
655
- # @version SketchUp 2023.0
656
- def thumbnail_camera=(camera)
657
- end
658
-
659
- end
1
+ # Copyright:: Copyright 2026 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # The {Sketchup::ComponentDefinition} class is used to define the contents for
5
+ # a SketchUp component. Components are a collection of entities that can be
6
+ # instanced and reused multiple times throughout a model. For example, you
7
+ # could draw a chair once, turn it into a component, and then use 6 instances
8
+ # of it to surround a table. Edits to the original "definition" will then
9
+ # propagate across all of its instances.
10
+ #
11
+ # The ComponentDefinition class contains the global entities and settings for
12
+ # each definition. See the {Sketchup::ComponentInstance} class for how each
13
+ # copy is defined.
14
+ #
15
+ # Starting from SketchUp 2018+, the {Sketchup::ComponentDefinition} class
16
+ # contains a new default attribute dictionary named "SU_DefinitionSet" with
17
+ # default keys named named "Price", "Size", "Url". See the
18
+ # {https://help.sketchup.com/en/article/3000124 Help article} for more
19
+ # information. The dictionary cannot be deleted via ruby and an ArgumentError
20
+ # will be raised. The key/value pairs in the dictionary can be deleted safely.
21
+ #
22
+ # @version SketchUp 6.0
23
+ class Sketchup::ComponentDefinition < Sketchup::Drawingelement
24
+
25
+ # Includes
26
+
27
+ include Comparable
28
+
29
+ # Instance Methods
30
+
31
+ # The <=> method is used to compare two ComponentDefinition objects for
32
+ # sorting. The comparison is done based on the component name.
33
+ #
34
+ # @example
35
+ # c1=Sketchup.find_support_file "Bed.skp",
36
+ # "Components/Components Sampler/"
37
+ # c2=Sketchup.find_support_file "Fence.skp",
38
+ # "Components/Components Sampler/"
39
+ # if c1 <=> c2
40
+ # puts "c1 sorts before c2"
41
+ # end
42
+ #
43
+ # @param [Sketchup::ComponentDefinition] compdef2
44
+ # The second component definition in the comparison.
45
+ #
46
+ # @return [Integer] a -1 if component1 is less then component2. A 1
47
+ # if component1 greater than component2
48
+ #
49
+ # @version SketchUp 6.0
50
+ def <=>(compdef2)
51
+ end
52
+
53
+ # The == method is used to test if two ComponentDefinition objects are the
54
+ # same (based on their address in memory).
55
+ #
56
+ # @example
57
+ # c1=Sketchup.find_support_file "Bed.skp",
58
+ # "Components/Components Sampler/"
59
+ # c2=Sketchup.find_support_file "Fence.skp",
60
+ # "Components/Components Sampler/"
61
+ # c1 == c2
62
+ #
63
+ # @param [Sketchup::ComponentDefinition] compdef2
64
+ # The second component definition in the comparison.
65
+ #
66
+ # @return [Boolean] true if the ComponentDefinition objects are
67
+ # the same object. False if the objects are not the same.
68
+ #
69
+ # @version SketchUp 6.0
70
+ def ==(compdef2)
71
+ end
72
+
73
+ # The add_classification method is used to add a given classification to
74
+ # the component.
75
+ #
76
+ # Note that you cannot classify image definitions.
77
+ #
78
+ # @example
79
+ # definition = Sketchup.active_model.definitions.first
80
+ # success = definition.add_classification("IFC 2x3", "IfcDoor")
81
+ #
82
+ # @param [String] schema_name
83
+ # a String - Schema name to add
84
+ #
85
+ # @param [String] schema_type
86
+ # a String - Schema type to add
87
+ #
88
+ # @return [Boolean] true if the classification succeeds. Otherwise false.
89
+ #
90
+ # @version SketchUp 2015
91
+ def add_classification(schema_name, schema_type)
92
+ end
93
+
94
+ # The add_observer method is used to add an observer to the current object.
95
+ #
96
+ # @example
97
+ # componentdefinition = Sketchup.active_model.definitions[0]
98
+ # status = componentdefinition.add_observer observer
99
+ #
100
+ # @param [Object] observer
101
+ # An observer.
102
+ #
103
+ # @return [Boolean] true if successful, false if unsuccessful.
104
+ #
105
+ # @version SketchUp 6.0
106
+ def add_observer(observer)
107
+ end
108
+
109
+ # The behavior method is used to retrieve the Behavior object associated with
110
+ # a component definition.
111
+ #
112
+ # @example
113
+ # path = Sketchup.find_support_file "Bed.skp",
114
+ # "Components/Components Sampler/"
115
+ # model = Sketchup.active_model
116
+ # definitions = model.definitions
117
+ # componentdefinition = definitions.load path
118
+ # behavior = componentdefinition.behavior
119
+ #
120
+ # @return [Sketchup::Behavior] a Behavior object if successful
121
+ #
122
+ # @version SketchUp 6.0
123
+ def behavior
124
+ end
125
+
126
+ # The count_instances method is used to count the number of unique component
127
+ # instances in a model using this component definition. This does not represent
128
+ # the total number of instances placed in the model as it doesn't take into
129
+ # account instances inside unused definitions.
130
+ #
131
+ # @example
132
+ # path = Sketchup.find_support_file('Bed.skp',
133
+ # 'Components/Components Sampler/')
134
+ # definitions = Sketchup.active_model.definitions
135
+ # definition = definitions.load(path)
136
+ # number = definition.count_instances
137
+ #
138
+ # @return [Integer] the number of component instances of this
139
+ # component definition (if successful)
140
+ #
141
+ # @version SketchUp 6.0
142
+ def count_instances
143
+ end
144
+
145
+ # The count_used_instances method is used to count the total number of
146
+ # component instances in a model using this component definition. This method
147
+ # takes into account the full hierarchy of the model.
148
+ #
149
+ # @example
150
+ # path = Sketchup.find_support_file('Bed.skp',
151
+ # 'Components/Components Sampler/')
152
+ # definitions = Sketchup.active_model.definitions
153
+ # definition = definitions.load(path)
154
+ # number = definition.count_used_instances
155
+ #
156
+ # @return [Integer] the number of component instances of this
157
+ # component definition (if successful)
158
+ #
159
+ # @version SketchUp 2016
160
+ def count_used_instances
161
+ end
162
+
163
+ # The description method is used to retrieve the description of the component
164
+ # definition.
165
+ #
166
+ # Component definitions do not have a description, by default.
167
+ #
168
+ # @example
169
+ # # Get the description
170
+ # componentdefinition = Sketchup.active_model.definitions[0]
171
+ # description = componentdefinition.description
172
+ #
173
+ # @return [String] the description of the component definition if successful
174
+ #
175
+ # @version SketchUp 6.0
176
+ def description
177
+ end
178
+
179
+ # The description= method is used to set the description for the component
180
+ # definition.
181
+ #
182
+ # @example
183
+ # componentdefinition = Sketchup.active_model.definitions[0]
184
+ # componentdefinition.description = "This is a traditional bed"
185
+ # description = componentdefinition.description
186
+ #
187
+ # @param [String] description
188
+ #
189
+ # @return [String] the description if successful, false if
190
+ # unsuccessful
191
+ #
192
+ # @version SketchUp 6.0
193
+ def description=(description)
194
+ end
195
+
196
+ # The entities method retrieves a collection of all the entities in the
197
+ # component definition
198
+ #
199
+ # @example
200
+ # componentdefinition = Sketchup.active_model.definitions[0]
201
+ # entities = componentdefinition.entities
202
+ #
203
+ # @return [Sketchup::Entities] an Entities object if successful
204
+ #
205
+ # @version SketchUp 6.0
206
+ def entities
207
+ end
208
+
209
+ # The get_classification_value method is used to retrieve the value from
210
+ # a classification attribute given a key path.
211
+ #
212
+ # @example
213
+ # definition = Sketchup.active_model.definitions.first
214
+ # definition.add_classification("IFC 2x3", "IfcDoor")
215
+ #
216
+ # path = ["IFC 2x3", "IfcDoor", "ObjectType", "IfcLabel"]
217
+ # value = definition.get_classification_value(path)
218
+ #
219
+ # @param [Array<String>] path
220
+ # An array composed of the key path to the value.
221
+ #
222
+ # @return [Object, nil] a Ruby object if successful, nil otherwise.
223
+ #
224
+ # @version SketchUp 2015
225
+ def get_classification_value(path)
226
+ end
227
+
228
+ # The group? method is used to determine if this component definition is used
229
+ # to hold the elements of a group.
230
+ #
231
+ # @example
232
+ # path = Sketchup.find_support_file "Bed.skp",
233
+ # "Components/Components Sampler/"
234
+ # model = Sketchup.active_model
235
+ # definitions = model.definitions
236
+ # componentdefinition = definitions.load path
237
+ # status = componentdefinition.group?
238
+ #
239
+ # @return [Boolean]
240
+ #
241
+ # @version SketchUp 6.0
242
+ def group?
243
+ end
244
+
245
+ # The guid method is used to retrieve the unique identifier of this component
246
+ # definition. The guid changes after the component definition is modified and
247
+ # the component edit is exited.
248
+ #
249
+ # @example
250
+ # componentdefinition = Sketchup.active_model.definitions[0]
251
+ # guid = componentdefinition.guid
252
+ #
253
+ # @return [String] a string guid if successful
254
+ #
255
+ # @version SketchUp 6.0
256
+ def guid
257
+ end
258
+
259
+ # The {#hidden?} method is used to determine if this component definition is
260
+ # hidden in the component browser.
261
+ #
262
+ # This is based on how its instances are placed
263
+ # in the model hierarchy. For more details, see
264
+ # {this article}[https://developer.sketchup.com/article-hiddensubcomponents].
265
+ #
266
+ # In addition, component definitions used by Groups and Images are always hidden
267
+ # in the Component Browser. See {#group?} and {#image?}.
268
+ #
269
+ # @example
270
+ # componentdefinition = Sketchup.active_model.definitions[0]
271
+ # status = componentdefinition.hidden?
272
+ #
273
+ # @return [Boolean]
274
+ #
275
+ # @version SketchUp 6.0
276
+ def hidden?
277
+ end
278
+
279
+ # The image? method is used to determine if this component definition is used
280
+ # to define an image.
281
+ #
282
+ # @example
283
+ # componentdefinition = Sketchup.active_model.definitions[0]
284
+ # status = componentdefinition.image?
285
+ #
286
+ # @return [Boolean]
287
+ #
288
+ # @version SketchUp 6.0
289
+ def image?
290
+ end
291
+
292
+ # The insertion_point method is used to retrieve the Point3d object where the
293
+ # component was inserted.
294
+ #
295
+ # @deprecated SketchUp 2020.0 removed the insertion point feature.
296
+ # The getter will always return the origin point and the
297
+ # setter becomes a no-op.
298
+ #
299
+ # @example
300
+ # point = Geom::Point3d.new 10,20,30
301
+ # transform = Geom::Transformation.new point
302
+ # model = Sketchup.active_model
303
+ # entities = model.active_entities
304
+ # path = Sketchup.find_support_file "Bed.skp",
305
+ # "Components/Components Sampler/"
306
+ # definitions = model.definitions
307
+ # componentdefinition = definitions.load path
308
+ # instance = entities.add_instance componentdefinition, transform
309
+ # point = componentdefinition.insertion_point
310
+ #
311
+ # @return [Geom::Point3d] the Point3d where the component was inserted if
312
+ # successful. False if unsuccessful.
313
+ #
314
+ # @version SketchUp 6.0
315
+ def insertion_point
316
+ end
317
+
318
+ # Sets the insertion point of your definition.
319
+ #
320
+ # @deprecated SketchUp 2020.0 removed the insertion point feature.
321
+ # The getter will always return the origin point and the
322
+ # setter becomes a no-op.
323
+ #
324
+ # @example
325
+ # point = Geom::Point3d.new(10, 20, 0)
326
+ # componentdefinition = Sketchup.active_model.definitions[0]
327
+ # componentdefinition.insertion_point = point
328
+ #
329
+ # @param [Geom::Point3d] point
330
+ # The Point3d object to use as the
331
+ # insertion point.
332
+ #
333
+ # @return [Geom::Point3d] The Point3d object used as the insertion point.
334
+ #
335
+ # @version SketchUp 6.0
336
+ def insertion_point=(point)
337
+ end
338
+
339
+ # The instances method is used to return any array of ComponentInstancesfor
340
+ # this ComponentDefinition.
341
+ #
342
+ # @example
343
+ # componentdefinition = Sketchup.active_model.definitions[0]
344
+ # instances = componentdefinition.instances
345
+ #
346
+ # @return [Array<Sketchup::ComponentInstance>] an array of ComponentInstances
347
+ # (if successful)
348
+ #
349
+ # @version SketchUp 6.0
350
+ def instances
351
+ end
352
+
353
+ # The internal? method is used to determine if the component definition is
354
+ # internal to the Component Browser
355
+ #
356
+ # @example
357
+ # point = Geom::Point3d.new 10,20,30
358
+ # transform = Geom::Transformation.new point
359
+ # model = Sketchup.active_model
360
+ # entities = model.active_entities
361
+ # path = Sketchup.find_support_file "Bed.skp",
362
+ # "Components/Components Sampler/"
363
+ # definitions = model.definitions
364
+ # componentdefinition = definitions.load path
365
+ # status = componentdefinition.internal?
366
+ #
367
+ # @return [Boolean]
368
+ #
369
+ # @version SketchUp 6.0
370
+ def internal?
371
+ end
372
+
373
+ # Invalidates the bounding box of your definition. This command forces the
374
+ # update of the bounding box of definition while inside an operation.
375
+ # See Model.start_operation for how to start an operation.
376
+ #
377
+ # This method is useful if you make changes to your geometry using the Ruby
378
+ # API and then need to know your bounding box size. This method forces
379
+ # SketchUp to recalculate the definition's bounding box when you choose.
380
+ #
381
+ # @example
382
+ # componentdefinition = Sketchup.active_model.definitions[0]
383
+ # componentdefinition.invalidate_bounds
384
+ #
385
+ # @return [Boolean] true if successful
386
+ #
387
+ # @version SketchUp 6.0
388
+ def invalidate_bounds
389
+ end
390
+
391
+ # The {#live_component?} method is used to identify Live Components and
392
+ # sub-definitions of Live Components.
393
+ #
394
+ # @example Skipping Live Components
395
+ # model = Sketchup.active_model
396
+ # model.definitions.each { |definition|
397
+ # next if definition.live_component?
398
+ # puts definition.name
399
+ # }
400
+ #
401
+ # @note These components are parametrically generated and API users should not
402
+ # modify them.
403
+ #
404
+ # @return [Boolean]
405
+ #
406
+ # @version SketchUp 2021.0
407
+ def live_component?
408
+ end
409
+
410
+ # The {#load_time} method gets the load time of the component definition. For an internal
411
+ # component definition, this is the time that it was created. For an external component
412
+ # definition, this is the time that it was added to the model.
413
+ #
414
+ # @example
415
+ # model = Sketchup.active_model
416
+ # definition = model.definitions.first
417
+ # definition.load_time
418
+ #
419
+ # @return [Time]
420
+ #
421
+ # @version SketchUp 2025.0
422
+ def load_time
423
+ end
424
+
425
+ # The name method retrieves the name of the component definition.
426
+ #
427
+ # @example
428
+ # path = Sketchup.find_support_file "Bed.skp",
429
+ # "Components/Components Sampler/"
430
+ # model = Sketchup.active_model
431
+ # definitions = model.definitions
432
+ # componentdefinition = definitions.load path
433
+ # name = componentdefinition.name
434
+ #
435
+ # @return [String] the component definition's name if successful
436
+ #
437
+ # @version SketchUp 6.0
438
+ def name
439
+ end
440
+
441
+ # The {name=} method is used to set the name of the component definition.
442
+ #
443
+ # The name should be unique to the model, if it's not the name will automatically
444
+ # be made unique.
445
+ #
446
+ # @bug In SketchUp 2022.0 a bug might lead to an available name being incorrectly renamed. Or
447
+ # a name that should be unavailable would be duplicated. This was fixed in SketchUp 2022.0.1.
448
+ #
449
+ # @example
450
+ # path = Sketchup.find_support_file "Bed.skp",
451
+ # "Components/Components Sampler/"
452
+ # model = Sketchup.active_model
453
+ # definitions = model.definitions
454
+ # componentdefinition = definitions.load path
455
+ # name = componentdefinition.name="Bed"
456
+ #
457
+ # @param [String] name
458
+ #
459
+ # @return [String]
460
+ #
461
+ # @version SketchUp 6.0
462
+ def name=(name)
463
+ end
464
+
465
+ # The path method is used to retrieve the path where the component was loaded.
466
+ #
467
+ # @example
468
+ # path = Sketchup.find_support_file("Bed.skp", "Components/Components Sampler/")
469
+ # model = Sketchup.active_model
470
+ # definitions = model.definitions
471
+ # componentdefinition = definitions.load(path)
472
+ # path = componentdefinition.path
473
+ #
474
+ # @return [String] Returns empty string if it is an internal component.
475
+ #
476
+ # @version SketchUp 6.0
477
+ def path
478
+ end
479
+
480
+ # The refresh_thumbnail method is used to force SketchUp to regenerate the
481
+ # thumbnail image that appears in the component browser. This is useful if
482
+ # you've used the API to change the geometry of your component and would
483
+ # like the thumbnail to match.
484
+ #
485
+ # @example
486
+ # componentdefinition = Sketchup.active_model.definitions[0]
487
+ # componentdefinition.refresh_thumbnail
488
+ #
489
+ # @return [nil]
490
+ #
491
+ # @version SketchUp 7.0
492
+ def refresh_thumbnail
493
+ end
494
+
495
+ # The remove_classification method is used to remove a given classification
496
+ # from the component.
497
+ #
498
+ # Note that you cannot classify image definitions.
499
+ #
500
+ # @example
501
+ # definition = Sketchup.active_model.definitions.first
502
+ # success = definition.remove_classification("IFC 2x3", "IfcDoor")
503
+ #
504
+ # @param [String] schema_name
505
+ # Schema name to remove
506
+ #
507
+ # @param [String] schema_type
508
+ # Schema type to remove. If not provided or an
509
+ # empty string, the currently applied schema type for the
510
+ # given schema name will be removed.
511
+ #
512
+ # @return [Boolean] true if the removal succeeds. Otherwise false.
513
+ #
514
+ # @version SketchUp 2015
515
+ def remove_classification(schema_name, schema_type)
516
+ end
517
+
518
+ # The remove_observer method is used to remove an observer from the current
519
+ # object.
520
+ #
521
+ # @example
522
+ # componentdefinition = Sketchup.active_model.definitions[0]
523
+ # status = componentdefinition.remove_observer observer
524
+ #
525
+ # @param [Object] observer
526
+ # An observer.
527
+ #
528
+ # @return [Boolean] true if successful, false if unsuccessful.
529
+ #
530
+ # @version SketchUp 6.0
531
+ def remove_observer(observer)
532
+ end
533
+
534
+ # The {#save_as} method is used to save your definition as a SketchUp file at the
535
+ # specified file destination.
536
+ #
537
+ # Use this method when the user has chosen a path. If you want to "silently" save
538
+ # out the definition, without changing the path it is associated with, use
539
+ # {#save_copy} instead.
540
+ #
541
+ # @example
542
+ # my_definition = Sketchup.active_model.definitions[0]
543
+ # my_definition.save_as("c:\\myComponent.skp")
544
+ #
545
+ # @overload save_as(file_path)
546
+ #
547
+ # Save as the current SketchUp version.
548
+ # @param [String] file_path
549
+ # @version SketchUp 7.0
550
+ #
551
+ # @overload save_as(file_path, version)
552
+ #
553
+ # Save as a specific SketchUp version.
554
+ # @param [String] file_path
555
+ # @param [Integer] version
556
+ # See {Sketchup::Model#save} for supported values.
557
+ # @version SketchUp 2022.0
558
+ #
559
+ # @return [Boolean] true if successful, false otherwise
560
+ def save_as(*args)
561
+ end
562
+
563
+ # The {#save_copy} method is used to save your definition as a SketchUp file
564
+ # without changing the file path it is already associated with.
565
+ #
566
+ # This can be used to save out to a temporary file used by some other process,
567
+ # without having the temporary path permanentely written to the SketchUp
568
+ # model.
569
+ #
570
+ # @example
571
+ # my_definition = Sketchup.active_model.definitions[0]
572
+ # my_definition.save_copy("c:\\myComponent.skp")
573
+ #
574
+ # @overload save_copy(file_path)
575
+ #
576
+ # Save as the current SketchUp version.
577
+ # @param [String] file_path
578
+ #
579
+ # @overload save_copy(file_path, version)
580
+ #
581
+ # Save as a specific SketchUp version.
582
+ # @param [String] file_path
583
+ # @param [Integer] version
584
+ # See {Sketchup::Model#save} for supported values.
585
+ #
586
+ # @return [Boolean] true if successful
587
+ #
588
+ # @version SketchUp 2022.0
589
+ def save_copy(*args)
590
+ end
591
+
592
+ # Saves a component thumbnail image. The image format is specified by the
593
+ # file extension of filePath. Supported image formats are bmp, jpg, png,
594
+ # tif, pct, and gif.
595
+ #
596
+ # @example
597
+ # componentdefinition = Sketchup.active_model.definitions[0]
598
+ # componentdefinition.save_thumbnail "test_thumb.png"
599
+ #
600
+ # @param [String] filename
601
+ #
602
+ # @return [Boolean] true if successful, false otherwise.
603
+ #
604
+ # @version SketchUp 7.0
605
+ def save_thumbnail(filename)
606
+ end
607
+
608
+ # The set_classification_value method is used to set the value of a
609
+ # classification attribute given a key path.
610
+ #
611
+ # @example
612
+ # definition = Sketchup.active_model.definitions.first
613
+ # definition.add_classification("IFC 2x3", "IfcDoor")
614
+ #
615
+ # path = ["IFC 2x3", "IfcDoor", "ObjectType", "IfcLabel"]
616
+ # success = definition.set_classification_value(path, "Room 101")
617
+ #
618
+ # @param [Array<String>] path
619
+ # An array composed of the key path to the value.
620
+ #
621
+ # @param [Object] value
622
+ # A value valid for that specific attribute.
623
+ #
624
+ # @raise [NotImplementedError] when trying to set the value of "choice"
625
+ # attributes.
626
+ #
627
+ # @raise [RuntimeError] if the attributes being set are corrupt.
628
+ #
629
+ # @raise [TypeError] when trying to set a value that is not valid for the
630
+ # attribute.
631
+ #
632
+ # @return [Boolean] true if the path was valid, false otherwise.
633
+ #
634
+ # @version SketchUp 2015
635
+ def set_classification_value(path, value)
636
+ end
637
+
638
+ # The {#thumbnail_camera} method is used to retrieve a camera representing
639
+ # the thumbnail associated with the component definition.
640
+ #
641
+ # @example
642
+ # # Get the thumbnail camera
643
+ # componentdefinition = Sketchup.active_model.definitions[0]
644
+ # thumbnail_camera = componentdefinition.thumbnail_camera
645
+ #
646
+ # @return [Sketchup::Camera] the camera associated with the thumbnail.
647
+ #
648
+ # @version SketchUp 2023.0
649
+ def thumbnail_camera
650
+ end
651
+
652
+ # The {#thumbnail_camera=} method is used to set the camera for the
653
+ # thumbnail associated with the component definition.
654
+ #
655
+ # @example
656
+ # componentdefinition = Sketchup.active_model.definitions[0]
657
+ # eye = Geom::Point3d.new(20, 5, 30)
658
+ # target = Geom::Point3d.new(20, 60, 25)
659
+ # up = Z_AXIS
660
+ # camera = Sketchup::Camera.new(eye, target, up)
661
+ # # Assign camera to the thumbnail's camera and refresh.
662
+ # componentdefinition.thumbnail_camera = camera
663
+ # componentdefinition.refresh_thumbnail
664
+ #
665
+ # @param [Sketchup::Camera] camera
666
+ #
667
+ # @raise [TypeError] if the passed argument is not of {#Sketchup::Camera} type.
668
+ #
669
+ # @version SketchUp 2023.0
670
+ def thumbnail_camera=(camera)
671
+ end
672
+
673
+ end