sketchup-api-stubs 0.7.8 → 0.7.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs/sketchup.rb +151 -148
- data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -400
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +509 -523
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +476 -478
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -522
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +693 -693
- data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
- data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +747 -698
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +517 -516
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -567
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
- data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -0
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +692 -692
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Length.rb +278 -278
- data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -144
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +150 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -286
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -302
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -478
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +659 -619
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +449 -426
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +406 -396
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -502
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1239 -1205
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -272
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -545
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -126
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -937
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +282 -292
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +468 -468
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +406 -407
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -326
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -422
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -427
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -112
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -414
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +317 -318
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1652 -1651
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -357
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +130 -131
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -284
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +490 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +116 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -797
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +361 -363
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +478 -477
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +361 -364
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +458 -459
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +255 -260
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +834 -837
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1311 -1317
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1377 -1360
- data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -389
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +494 -496
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -269
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +241 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -635
- data/lib/sketchup-api-stubs/stubs/UI.rb +683 -683
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -311
- data/lib/sketchup-api-stubs.rb +1 -1
- metadata +10 -7
@@ -1,619 +1,659 @@
|
|
1
|
-
# Copyright:: Copyright
|
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
|
-
#
|
430
|
-
#
|
431
|
-
#
|
432
|
-
#
|
433
|
-
#
|
434
|
-
#
|
435
|
-
#
|
436
|
-
#
|
437
|
-
#
|
438
|
-
#
|
439
|
-
#
|
440
|
-
#
|
441
|
-
#
|
442
|
-
#
|
443
|
-
|
444
|
-
|
445
|
-
|
446
|
-
#
|
447
|
-
#
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
#
|
452
|
-
#
|
453
|
-
#
|
454
|
-
#
|
455
|
-
#
|
456
|
-
#
|
457
|
-
#
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
#
|
462
|
-
#
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
#
|
467
|
-
#
|
468
|
-
#
|
469
|
-
#
|
470
|
-
#
|
471
|
-
#
|
472
|
-
#
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
#
|
477
|
-
#
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
#
|
482
|
-
#
|
483
|
-
#
|
484
|
-
#
|
485
|
-
#
|
486
|
-
#
|
487
|
-
#
|
488
|
-
#
|
489
|
-
#
|
490
|
-
#
|
491
|
-
#
|
492
|
-
#
|
493
|
-
# @
|
494
|
-
#
|
495
|
-
#
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
#
|
500
|
-
#
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
#
|
505
|
-
#
|
506
|
-
#
|
507
|
-
#
|
508
|
-
#
|
509
|
-
#
|
510
|
-
#
|
511
|
-
# @
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
#
|
516
|
-
#
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
# {#
|
521
|
-
#
|
522
|
-
#
|
523
|
-
#
|
524
|
-
#
|
525
|
-
#
|
526
|
-
#
|
527
|
-
#
|
528
|
-
#
|
529
|
-
#
|
530
|
-
#
|
531
|
-
#
|
532
|
-
#
|
533
|
-
#
|
534
|
-
#
|
535
|
-
# @
|
536
|
-
#
|
537
|
-
#
|
538
|
-
#
|
539
|
-
#
|
540
|
-
#
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
#
|
545
|
-
#
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
#
|
550
|
-
#
|
551
|
-
#
|
552
|
-
#
|
553
|
-
#
|
554
|
-
#
|
555
|
-
#
|
556
|
-
#
|
557
|
-
#
|
558
|
-
#
|
559
|
-
#
|
560
|
-
# @overload save_copy(file_path
|
561
|
-
#
|
562
|
-
# Save as
|
563
|
-
# @param [String] file_path
|
564
|
-
#
|
565
|
-
#
|
566
|
-
#
|
567
|
-
#
|
568
|
-
#
|
569
|
-
#
|
570
|
-
|
571
|
-
|
572
|
-
|
573
|
-
#
|
574
|
-
#
|
575
|
-
|
576
|
-
|
577
|
-
|
578
|
-
#
|
579
|
-
#
|
580
|
-
#
|
581
|
-
#
|
582
|
-
#
|
583
|
-
#
|
584
|
-
#
|
585
|
-
#
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
#
|
590
|
-
#
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
#
|
595
|
-
#
|
596
|
-
#
|
597
|
-
#
|
598
|
-
#
|
599
|
-
#
|
600
|
-
#
|
601
|
-
#
|
602
|
-
#
|
603
|
-
#
|
604
|
-
#
|
605
|
-
#
|
606
|
-
#
|
607
|
-
#
|
608
|
-
#
|
609
|
-
#
|
610
|
-
# @raise [
|
611
|
-
#
|
612
|
-
#
|
613
|
-
# @
|
614
|
-
#
|
615
|
-
# @
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
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
|