sketchup-api-stubs 0.7.4 → 0.7.8
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.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs/sketchup.rb +148 -145
- data/lib/sketchup-api-stubs/stubs/{array.rb → Array.rb} +741 -741
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -318
- 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 +523 -492
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +478 -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 -691
- data/lib/sketchup-api-stubs/stubs/{geom.rb → Geom.rb} +351 -348
- data/lib/sketchup-api-stubs/stubs/{languagehandler.rb → LanguageHandler.rb} +93 -92
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -573
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +698 -411
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -174
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +516 -514
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -143
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -349
- 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 -371
- 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 -220
- 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 -204
- 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/SketchUpModel.rb +692 -694
- 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 → Length.rb} +278 -278
- data/lib/sketchup-api-stubs/stubs/{numeric.rb → Numeric.rb} +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -140
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -157
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +152 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +286 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -328
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -577
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +122 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +619 -562
- 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 -194
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +426 -329
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -72
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -102
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -312
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -38
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +396 -390
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +502 -508
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1205 -1119
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +272 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -544
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +126 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -697
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +292 -285
- 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 -409
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -226
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -190
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +407 -393
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -82
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -303
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -285
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -244
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -136
- 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 +112 -112
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -416
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +318 -311
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -141
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -95
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1651 -1638
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -356
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +131 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +284 -284
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -770
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +363 -353
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +477 -456
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +364 -364
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -44
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +459 -454
- 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 +260 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -57
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -225
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +837 -829
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -154
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -61
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1317 -1301
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -43
- data/lib/sketchup-api-stubs/stubs/{sketchup.rb → Sketchup.rb} +1360 -1310
- data/lib/sketchup-api-stubs/stubs/{sketchupextension.rb → SketchupExtension.rb} +353 -353
- data/lib/sketchup-api-stubs/stubs/{string.rb → String.rb} +24 -24
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -310
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +496 -356
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -229
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +240 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -633
- data/lib/sketchup-api-stubs/stubs/{ui.rb → UI.rb} +683 -667
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +311 -311
- data/lib/sketchup-api-stubs.rb +1 -1
- metadata +15 -12
@@ -1,562 +1,619 @@
|
|
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
|
393
|
-
#
|
394
|
-
#
|
395
|
-
#
|
396
|
-
#
|
397
|
-
# model
|
398
|
-
#
|
399
|
-
#
|
400
|
-
#
|
401
|
-
#
|
402
|
-
# @
|
403
|
-
#
|
404
|
-
#
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
|
411
|
-
#
|
412
|
-
#
|
413
|
-
#
|
414
|
-
#
|
415
|
-
#
|
416
|
-
#
|
417
|
-
#
|
418
|
-
#
|
419
|
-
#
|
420
|
-
#
|
421
|
-
#
|
422
|
-
#
|
423
|
-
# @version SketchUp 6.0
|
424
|
-
def name
|
425
|
-
end
|
426
|
-
|
427
|
-
# The
|
428
|
-
#
|
429
|
-
#
|
430
|
-
#
|
431
|
-
#
|
432
|
-
#
|
433
|
-
#
|
434
|
-
#
|
435
|
-
#
|
436
|
-
#
|
437
|
-
#
|
438
|
-
#
|
439
|
-
# @return [String
|
440
|
-
#
|
441
|
-
#
|
442
|
-
# @version SketchUp 6.0
|
443
|
-
def
|
444
|
-
end
|
445
|
-
|
446
|
-
# The
|
447
|
-
#
|
448
|
-
#
|
449
|
-
#
|
450
|
-
#
|
451
|
-
#
|
452
|
-
# componentdefinition =
|
453
|
-
# componentdefinition.
|
454
|
-
#
|
455
|
-
# @return [
|
456
|
-
#
|
457
|
-
# @version SketchUp
|
458
|
-
def
|
459
|
-
end
|
460
|
-
|
461
|
-
# The
|
462
|
-
#
|
463
|
-
#
|
464
|
-
#
|
465
|
-
#
|
466
|
-
# @example
|
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
|
-
|
561
|
-
|
562
|
-
|
1
|
+
# Copyright:: Copyright 2022 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
|
+
# @example
|
430
|
+
# path = Sketchup.find_support_file "Bed.skp",
|
431
|
+
# "Components/Components Sampler/"
|
432
|
+
# model = Sketchup.active_model
|
433
|
+
# definitions = model.definitions
|
434
|
+
# componentdefinition = definitions.load path
|
435
|
+
# name = componentdefinition.name="Bed"
|
436
|
+
#
|
437
|
+
# @param [String] name
|
438
|
+
#
|
439
|
+
# @return [String] the name assigned to the component definition if
|
440
|
+
# successful
|
441
|
+
#
|
442
|
+
# @version SketchUp 6.0
|
443
|
+
def name=(name)
|
444
|
+
end
|
445
|
+
|
446
|
+
# The path method is used to retrieve the path where the component was loaded.
|
447
|
+
#
|
448
|
+
# @example
|
449
|
+
# path = Sketchup.find_support_file("Bed.skp", "Components/Components Sampler/")
|
450
|
+
# model = Sketchup.active_model
|
451
|
+
# definitions = model.definitions
|
452
|
+
# componentdefinition = definitions.load(path)
|
453
|
+
# path = componentdefinition.path
|
454
|
+
#
|
455
|
+
# @return [String] Returns empty string if it is an internal component.
|
456
|
+
#
|
457
|
+
# @version SketchUp 6.0
|
458
|
+
def path
|
459
|
+
end
|
460
|
+
|
461
|
+
# The refresh_thumbnail method is used to force SketchUp to regenerate the
|
462
|
+
# thumbnail image that appears in the component browser. This is useful if
|
463
|
+
# you've used the API to change the geometry of your component and would
|
464
|
+
# like the thumbnail to match.
|
465
|
+
#
|
466
|
+
# @example
|
467
|
+
# componentdefinition = Sketchup.active_model.definitions[0]
|
468
|
+
# componentdefinition.refresh_thumbnail
|
469
|
+
#
|
470
|
+
# @return [nil]
|
471
|
+
#
|
472
|
+
# @version SketchUp 7.0
|
473
|
+
def refresh_thumbnail
|
474
|
+
end
|
475
|
+
|
476
|
+
# The remove_classification method is used to remove a given classification
|
477
|
+
# from the component.
|
478
|
+
#
|
479
|
+
# Note that you cannot classify image definitions.
|
480
|
+
#
|
481
|
+
# @example
|
482
|
+
# definition = Sketchup.active_model.definitions.first
|
483
|
+
# success = definition.remove_classification("IFC 2x3", "IfcDoor")
|
484
|
+
#
|
485
|
+
# @param [String] schema_name
|
486
|
+
# Schema name to remove
|
487
|
+
#
|
488
|
+
# @param [String] schema_type
|
489
|
+
# Schema type to remove. If not provided or an
|
490
|
+
# empty string, the currently applied schema type for the
|
491
|
+
# given schema name will be removed.
|
492
|
+
#
|
493
|
+
# @return [Boolean] true if the removal succeeds. Otherwise false.
|
494
|
+
#
|
495
|
+
# @version SketchUp 2015
|
496
|
+
def remove_classification(schema_name, schema_type)
|
497
|
+
end
|
498
|
+
|
499
|
+
# The remove_observer method is used to remove an observer from the current
|
500
|
+
# object.
|
501
|
+
#
|
502
|
+
# @example
|
503
|
+
# componentdefinition = Sketchup.active_model.definitions[0]
|
504
|
+
# status = componentdefinition.remove_observer observer
|
505
|
+
#
|
506
|
+
# @param [Object] observer
|
507
|
+
# An observer.
|
508
|
+
#
|
509
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
510
|
+
#
|
511
|
+
# @version SketchUp 6.0
|
512
|
+
def remove_observer(observer)
|
513
|
+
end
|
514
|
+
|
515
|
+
# The {#save_as} method is used to save your definition as a SketchUp file at the
|
516
|
+
# specified file destination.
|
517
|
+
#
|
518
|
+
# Use this method when the user has chosen a path. If you want to "silently" save
|
519
|
+
# out the definition, without changing the path it is associated with, use
|
520
|
+
# {#save_copy} instead.
|
521
|
+
#
|
522
|
+
# @example
|
523
|
+
# my_definition = Sketchup.active_model.definitions[0]
|
524
|
+
# my_definition.save_as("c:\\myComponent.skp")
|
525
|
+
#
|
526
|
+
# @overload save_as(file_path)
|
527
|
+
#
|
528
|
+
# Save as the current SketchUp version.
|
529
|
+
# @param [String] file_path
|
530
|
+
# @version SketchUp 7.0
|
531
|
+
#
|
532
|
+
# @overload save_as(file_path, version)
|
533
|
+
#
|
534
|
+
# Save as a specific SketchUp version.
|
535
|
+
# @param [String] file_path
|
536
|
+
# @param [Integer] version
|
537
|
+
# See {Sketchup::Model#save} for supported values.
|
538
|
+
# @version SketchUp 2022.0
|
539
|
+
#
|
540
|
+
# @return [Boolean] true if successful
|
541
|
+
def save_as(*args)
|
542
|
+
end
|
543
|
+
|
544
|
+
# The {#save_copy} method is used to save your definition as a SketchUp file
|
545
|
+
# without changing the file path it is already associated with.
|
546
|
+
#
|
547
|
+
# This can be used to save out to a temporary file used by some other process,
|
548
|
+
# without having the temporary path permanentely written to the SketchUp
|
549
|
+
# model.
|
550
|
+
#
|
551
|
+
# @example
|
552
|
+
# my_definition = Sketchup.active_model.definitions[0]
|
553
|
+
# my_definition.save_copy("c:\\myComponent.skp")
|
554
|
+
#
|
555
|
+
# @overload save_copy(file_path)
|
556
|
+
#
|
557
|
+
# Save as the current SketchUp version.
|
558
|
+
# @param [String] file_path
|
559
|
+
#
|
560
|
+
# @overload save_copy(file_path, version)
|
561
|
+
#
|
562
|
+
# Save as a specific SketchUp version.
|
563
|
+
# @param [String] file_path
|
564
|
+
# @param [Integer] version
|
565
|
+
# See {Sketchup::Model#save} for supported values.
|
566
|
+
#
|
567
|
+
# @return [Boolean] true if successful
|
568
|
+
#
|
569
|
+
# @version SketchUp 2022.0
|
570
|
+
def save_copy(*args)
|
571
|
+
end
|
572
|
+
|
573
|
+
# Saves a component thumbnail image. The image format is specified by the
|
574
|
+
# file extension of filePath. Supported image formats are bmp, jpg, png,
|
575
|
+
# tif, pct, and gif.
|
576
|
+
#
|
577
|
+
# @example
|
578
|
+
# componentdefinition = Sketchup.active_model.definitions[0]
|
579
|
+
# componentdefinition.save_thumbnail "test_thumb.png"
|
580
|
+
#
|
581
|
+
# @param [String] filename
|
582
|
+
#
|
583
|
+
# @return [Boolean] true if successful, false otherwise.
|
584
|
+
#
|
585
|
+
# @version SketchUp 7.0
|
586
|
+
def save_thumbnail(filename)
|
587
|
+
end
|
588
|
+
|
589
|
+
# The set_classification_value method is used to set the value of a
|
590
|
+
# classification attribute given a key path.
|
591
|
+
#
|
592
|
+
# @example
|
593
|
+
# definition = Sketchup.active_model.definitions.first
|
594
|
+
# definition.add_classification("IFC 2x3", "IfcDoor")
|
595
|
+
#
|
596
|
+
# path = ["IFC 2x3", "IfcDoor", "ObjectType", "IfcLabel"]
|
597
|
+
# success = definition.set_classification_value(path, "Room 101")
|
598
|
+
#
|
599
|
+
# @param [Array<String>] path
|
600
|
+
# An array composed of the key path to the value.
|
601
|
+
#
|
602
|
+
# @param [Object] value
|
603
|
+
# A value valid for that specific attribute.
|
604
|
+
#
|
605
|
+
# @raise [NotImplementedError] when trying to set the value of "choice"
|
606
|
+
# attributes.
|
607
|
+
#
|
608
|
+
# @raise [RuntimeError] if the attributes being set are corrupt.
|
609
|
+
#
|
610
|
+
# @raise [TypeError] when trying to set a value that is not valid for the
|
611
|
+
# attribute.
|
612
|
+
#
|
613
|
+
# @return [Boolean] true if the path was valid, false otherwise.
|
614
|
+
#
|
615
|
+
# @version SketchUp 2015
|
616
|
+
def set_classification_value(path, value)
|
617
|
+
end
|
618
|
+
|
619
|
+
end
|