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,545 +1,545 @@
|
|
1
|
-
# Copyright:: Copyright
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# This is the base class for all SketchUp entities. Entities are basically
|
5
|
-
# anything that can be contained in a model, including Drawingelements
|
6
|
-
# such as Edges, SectionPlanes, Groups, etc. and entities that relate to
|
7
|
-
# those Drawingelements, such as Loops, Layers, etc.
|
8
|
-
#
|
9
|
-
# Keep in mind that the methods below are available on all subclasses.
|
10
|
-
# For example, an Edge's parent class is Drawingelement, and a
|
11
|
-
# Drawingelement's parent class is Entity. Therefore an Edge has all of the
|
12
|
-
# methods defined in Drawingelement and Entity.
|
13
|
-
#
|
14
|
-
# The Object.is_a? method is the common way of determining what sort of Entity
|
15
|
-
# you're dealing with.
|
16
|
-
#
|
17
|
-
# @example
|
18
|
-
# # Count how many faces are in the current selection.
|
19
|
-
# selection = Sketchup.active_model.selection
|
20
|
-
# face_count = 0
|
21
|
-
#
|
22
|
-
# # Look at all of the entities in the selection.
|
23
|
-
# selection.each { |entity|
|
24
|
-
# if entity.is_a? Sketchup::Face
|
25
|
-
# face_count = face_count + 1
|
26
|
-
# end
|
27
|
-
# }
|
28
|
-
#
|
29
|
-
# UI.messagebox("There are " + face_count.to_s + " faces selected.")
|
30
|
-
#
|
31
|
-
# @version SketchUp 6.0
|
32
|
-
class Sketchup::Entity
|
33
|
-
|
34
|
-
# Instance Methods
|
35
|
-
|
36
|
-
# The add_observer method is used to add an observer to the current object.
|
37
|
-
#
|
38
|
-
# @example
|
39
|
-
# entity = Sketchup.active_model.entities[0]
|
40
|
-
# if entity.valid?
|
41
|
-
# status = entity.add_observer observer
|
42
|
-
# end
|
43
|
-
#
|
44
|
-
# @param [Object] observer
|
45
|
-
# An observer.
|
46
|
-
#
|
47
|
-
# @return [Boolean] true if successful, false if unsuccessful.
|
48
|
-
#
|
49
|
-
# @version SketchUp 6.0
|
50
|
-
def add_observer(observer)
|
51
|
-
end
|
52
|
-
|
53
|
-
# The attribute_dictionaries method is used to retrieve the
|
54
|
-
# AttributeDictionaries collection attached to the entity.
|
55
|
-
#
|
56
|
-
# @example
|
57
|
-
# depth = 100
|
58
|
-
# width = 100
|
59
|
-
# model = Sketchup.active_model
|
60
|
-
# entities = model.active_entities
|
61
|
-
# pts = []
|
62
|
-
# pts[0] = [0, 0, 0]
|
63
|
-
# pts[1] = [width, 0, 0]
|
64
|
-
# pts[2] = [width, depth, 0]
|
65
|
-
# pts[3] = [0, depth, 0]
|
66
|
-
#
|
67
|
-
# # Add the face to the entities in the model
|
68
|
-
# face = entities.add_face pts
|
69
|
-
#
|
70
|
-
# # I just happen to know that the second and third entities in the
|
71
|
-
# # entities objects are edges.
|
72
|
-
# entity1 = entities[1]
|
73
|
-
# status = entity1.set_attribute "testdictionary", "test", 115
|
74
|
-
# attrdicts = entity1.attribute_dictionaries
|
75
|
-
#
|
76
|
-
# @note The return value may be either +nil+ or an empty
|
77
|
-
# {Sketchup::AttributeDictionaries} collection if this entity has no
|
78
|
-
# {Sketchup::AttributeDictionary}s.
|
79
|
-
#
|
80
|
-
# @return [Sketchup::AttributeDictionaries, nil]
|
81
|
-
#
|
82
|
-
# @version SketchUp 6.0
|
83
|
-
def attribute_dictionaries
|
84
|
-
end
|
85
|
-
|
86
|
-
# The attribute_dictionary method is used to retrieve an attribute dictionary
|
87
|
-
# with a given name that is attached to an Entity.
|
88
|
-
#
|
89
|
-
# @example
|
90
|
-
# depth = 100
|
91
|
-
# width = 100
|
92
|
-
# model = Sketchup.active_model
|
93
|
-
# entities = model.active_entities
|
94
|
-
# pts = []
|
95
|
-
# pts[0] = [0, 0, 0]
|
96
|
-
# pts[1] = [width, 0, 0]
|
97
|
-
# pts[2] = [width, depth, 0]
|
98
|
-
# pts[3] = [0, depth, 0]
|
99
|
-
#
|
100
|
-
# # Add the face to the entities in the model
|
101
|
-
# face = entities.add_face pts
|
102
|
-
#
|
103
|
-
# # I just happen to know that the second and third entities in the
|
104
|
-
# # entities objects are edges.
|
105
|
-
# entity1 = entities[1]
|
106
|
-
# status = entity1.set_attribute "testdictionary", "test", 115
|
107
|
-
# attrdict = entity1.attribute_dictionary "testdictionary"
|
108
|
-
#
|
109
|
-
# @param [String] name
|
110
|
-
# The name of the attribute dictionary.
|
111
|
-
#
|
112
|
-
# @param [Boolean] create
|
113
|
-
# boolean, if set to true then the attribute
|
114
|
-
# dictionary will be created if it does not exist.
|
115
|
-
#
|
116
|
-
# @return [Sketchup::AttributeDictionary, nil] - an AttributeDictionary object
|
117
|
-
# if successful, or nil if there is no attribute dictionary
|
118
|
-
#
|
119
|
-
# @version SketchUp 6.0
|
120
|
-
def attribute_dictionary(name, create = false)
|
121
|
-
end
|
122
|
-
|
123
|
-
# The {#delete_attribute} method is used to delete an attribute from an entity.
|
124
|
-
#
|
125
|
-
# If only the dictionary_name is given, then it deletes the entire
|
126
|
-
# AttributeDictionary. Otherwise, {#delete_attribute} deletes the attribute with
|
127
|
-
# the given key from the given dictionary.
|
128
|
-
#
|
129
|
-
# @bug Prior to SketchUp 2019.0 the return values was always +true+.
|
130
|
-
#
|
131
|
-
# @example
|
132
|
-
# depth = 100
|
133
|
-
# width = 100
|
134
|
-
# model = Sketchup.active_model
|
135
|
-
# entities = model.active_entities
|
136
|
-
# pts = []
|
137
|
-
# pts[0] = [0, 0, 0]
|
138
|
-
# pts[1] = [width, 0, 0]
|
139
|
-
# pts[2] = [width, depth, 0]
|
140
|
-
# pts[3] = [0, depth, 0]
|
141
|
-
# # Add the face to the entities in the model
|
142
|
-
# face = entities.add_face pts
|
143
|
-
#
|
144
|
-
# # I just happen to know that the second and third entities in the
|
145
|
-
# # entities objects are edges.
|
146
|
-
# entity1 = entities[1]
|
147
|
-
# status = entity1.set_attribute "testdictionary", "test", 115
|
148
|
-
# status = entity1.delete_attribute "testdictionary"
|
149
|
-
#
|
150
|
-
# @note In SketchUp 2018, special attribute dictionaries have been added.
|
151
|
-
# The name of these dictionaries are "SU_InstanceSet" and "SU_DefinitionSet".
|
152
|
-
# The dictionaries cannot be deleted via ruby and an ArgumentError will be
|
153
|
-
# raised. The key/value pairs in the dictionary can be deleted safely.
|
154
|
-
#
|
155
|
-
# @overload delete_attribute(dictionary_name)
|
156
|
-
#
|
157
|
-
# @param [String] dictionary_name The name of an attribute dictionary.
|
158
|
-
# @return [Boolean]
|
159
|
-
#
|
160
|
-
# @overload delete_attribute(dictionary_name, key)
|
161
|
-
#
|
162
|
-
# @param [String] dictionary_name The name of an attribute dictionary.
|
163
|
-
# @param [String] key An attribute key.
|
164
|
-
# @return [Boolean]
|
165
|
-
#
|
166
|
-
# @version SketchUp 6.0
|
167
|
-
def delete_attribute(*args)
|
168
|
-
end
|
169
|
-
|
170
|
-
# The deleted? method is used to determine if your entity is still valid (not
|
171
|
-
# deleted by another script, for example.)
|
172
|
-
#
|
173
|
-
# @example
|
174
|
-
# depth = 100
|
175
|
-
# width = 100
|
176
|
-
# model = Sketchup.active_model
|
177
|
-
# entities = model.active_entities
|
178
|
-
# pts = []
|
179
|
-
# pts[0] = [0, 0, 0]
|
180
|
-
# pts[1] = [width, 0, 0]
|
181
|
-
# pts[2] = [width, depth, 0]
|
182
|
-
# pts[3] = [0, depth, 0]
|
183
|
-
#
|
184
|
-
# # Add the face to the entities in the model
|
185
|
-
# face = entities.add_face pts
|
186
|
-
# entity1 = entities[1]
|
187
|
-
# status = entity1.deleted?
|
188
|
-
#
|
189
|
-
# @return [Boolean]
|
190
|
-
#
|
191
|
-
# @version SketchUp 6.0
|
192
|
-
def deleted?
|
193
|
-
end
|
194
|
-
|
195
|
-
# The entityID method is used to retrieve a unique ID assigned to an entity.
|
196
|
-
#
|
197
|
-
# The entityID is not persistent between sessions.
|
198
|
-
#
|
199
|
-
# @example
|
200
|
-
# depth = 100
|
201
|
-
# width = 100
|
202
|
-
# model = Sketchup.active_model
|
203
|
-
# entities = model.active_entities
|
204
|
-
# pts = []
|
205
|
-
# pts[0] = [0, 0, 0]
|
206
|
-
# pts[1] = [width, 0, 0]
|
207
|
-
# pts[2] = [width, depth, 0]
|
208
|
-
# pts[3] = [0, depth, 0]
|
209
|
-
#
|
210
|
-
# # Add the face to the entities in the model
|
211
|
-
# face = entities.add_face pts
|
212
|
-
# entity1 = entities[1]
|
213
|
-
# id = entity1.entityID
|
214
|
-
#
|
215
|
-
# @return [Integer] the id for the Entity object
|
216
|
-
#
|
217
|
-
# @version SketchUp 6.0
|
218
|
-
def entityID
|
219
|
-
end
|
220
|
-
|
221
|
-
# The {#get_attribute} method is used to retrieve the value of an attribute in
|
222
|
-
# the entity's attribute dictionary.
|
223
|
-
#
|
224
|
-
# If the third parameter, +default_value+, is not passed and there is no
|
225
|
-
# attribute that matches the given name, it returns +nil+.
|
226
|
-
#
|
227
|
-
# If +default_value+ is provided and there is no matching attribute it returns
|
228
|
-
# the given value. It does not create an attribute with that name though.
|
229
|
-
#
|
230
|
-
# @example
|
231
|
-
# # Add an entity to the model:
|
232
|
-
# model = Sketchup.active_model
|
233
|
-
# entities = model.active_entities
|
234
|
-
# edge = entities.add_line([0, 0, 0], [9, 9, 9])
|
235
|
-
#
|
236
|
-
# # Read an attribute value from the edge. In this case this will return the
|
237
|
-
# # default value provided; 42.
|
238
|
-
# value = edge.get_attribute("MyExtension", "MyProperty", 42)
|
239
|
-
#
|
240
|
-
# @param [String] dict_name
|
241
|
-
# The name of an attribute dictionary.
|
242
|
-
#
|
243
|
-
# @param [String] key
|
244
|
-
# An attribute key.
|
245
|
-
#
|
246
|
-
# @param [Object] default_value
|
247
|
-
# A default value to return if no attribute is found.
|
248
|
-
#
|
249
|
-
# @return [Object] the retrieved value
|
250
|
-
#
|
251
|
-
# @version SketchUp 6.0
|
252
|
-
def get_attribute(dict_name, key, default_value = nil)
|
253
|
-
end
|
254
|
-
|
255
|
-
# The to_s method is used to retrieve the string representation of the entity.
|
256
|
-
#
|
257
|
-
# @example
|
258
|
-
# depth = 100
|
259
|
-
# width = 100
|
260
|
-
# model = Sketchup.active_model
|
261
|
-
# entities = model.active_entities
|
262
|
-
# pts = []
|
263
|
-
# pts[0] = [0, 0, 0]
|
264
|
-
# pts[1] = [width, 0, 0]
|
265
|
-
# pts[2] = [width, depth, 0]
|
266
|
-
# pts[3] = [0, depth, 0]
|
267
|
-
#
|
268
|
-
# # Add the face to the entities in the model
|
269
|
-
# face = entities.add_face pts
|
270
|
-
#
|
271
|
-
# # I just happen to know that the second and third entities in the
|
272
|
-
# # entities objects are edges.
|
273
|
-
# entity1 = entities[1]
|
274
|
-
# st = entity1.to_s
|
275
|
-
#
|
276
|
-
# @return [String] the string representation of the entity if
|
277
|
-
# successful
|
278
|
-
#
|
279
|
-
# @version SketchUp 6.0
|
280
|
-
def inspect
|
281
|
-
end
|
282
|
-
|
283
|
-
# The model method is used to retrieve the model for the entity.
|
284
|
-
#
|
285
|
-
# @example
|
286
|
-
# depth = 100
|
287
|
-
# width = 100
|
288
|
-
# model = Sketchup.active_model
|
289
|
-
# entities = model.active_entities
|
290
|
-
# pts = []
|
291
|
-
# pts[0] = [0, 0, 0]
|
292
|
-
# pts[1] = [width, 0, 0]
|
293
|
-
# pts[2] = [width, depth, 0]
|
294
|
-
# pts[3] = [0, depth, 0]
|
295
|
-
#
|
296
|
-
# # Add the face to the entities in the model
|
297
|
-
# face = entities.add_face pts
|
298
|
-
#
|
299
|
-
# # I just happen to know that the second and third entities in the
|
300
|
-
# # entities objects are edges.
|
301
|
-
# entity1 = entities[1]
|
302
|
-
# m = entity1.model
|
303
|
-
#
|
304
|
-
# @return [Sketchup::Model] the model that contains the Entity object
|
305
|
-
#
|
306
|
-
# @version SketchUp 6.0
|
307
|
-
def model
|
308
|
-
end
|
309
|
-
|
310
|
-
# The parent method is used to retrieve the parent of the entity.
|
311
|
-
#
|
312
|
-
# The parent will be a ComponentDefinition, a Group, or a Model, whatever
|
313
|
-
# the entity is contained within.
|
314
|
-
#
|
315
|
-
# @example
|
316
|
-
# depth = 100
|
317
|
-
# width = 100
|
318
|
-
# model = Sketchup.active_model
|
319
|
-
# entities = model.active_entities
|
320
|
-
# pts = []
|
321
|
-
# pts[0] = [0, 0, 0]
|
322
|
-
# pts[1] = [width, 0, 0]
|
323
|
-
# pts[2] = [width, depth, 0]
|
324
|
-
# pts[3] = [0, depth, 0]
|
325
|
-
#
|
326
|
-
# # Add the face to the entities in the model
|
327
|
-
# face = entities.add_face pts
|
328
|
-
#
|
329
|
-
# # I just happen to know that the second and third entities in the
|
330
|
-
# # entities objects are edges.
|
331
|
-
# entity1 = entities[1]
|
332
|
-
# parent = entity1.parent
|
333
|
-
#
|
334
|
-
# @return [Sketchup::ComponentDefinition, Sketchup::Model] a Entity object
|
335
|
-
# representing the parent of this entity
|
336
|
-
#
|
337
|
-
# @version SketchUp 6.0
|
338
|
-
def parent
|
339
|
-
end
|
340
|
-
|
341
|
-
# The {#persistent_id} method is used to retrieve a unique persistent id
|
342
|
-
# assigned to an entity.
|
343
|
-
#
|
344
|
-
# The persistent id persistent between sessions.
|
345
|
-
#
|
346
|
-
# [SketchUp 2020.1]
|
347
|
-
# - {Sketchup::ComponentDefinition}
|
348
|
-
# - {Sketchup::Material}
|
349
|
-
# - {Sketchup::Style}
|
350
|
-
# [SketchUp 2020.0]
|
351
|
-
# - {Sketchup::Layer}
|
352
|
-
# - {Sketchup::LineStyle}
|
353
|
-
# [SketchUp 2018]
|
354
|
-
# - {Sketchup::Page}
|
355
|
-
# [SketchUp 2017]
|
356
|
-
# - {Sketchup::ComponentInstance}
|
357
|
-
# - {Sketchup::ConstructionLine}
|
358
|
-
# - {Sketchup::ConstructionPoint}
|
359
|
-
# - {Sketchup::Curve}
|
360
|
-
# - {Sketchup::Dimension}
|
361
|
-
# - {Sketchup::Edge}
|
362
|
-
# - {Sketchup::Face}
|
363
|
-
# - {Sketchup::Group}
|
364
|
-
# - {Sketchup::Image}
|
365
|
-
# - {Sketchup::SectionPlane}
|
366
|
-
# - {Sketchup::Text}
|
367
|
-
# - {Sketchup::Vertex}
|
368
|
-
# - Polyline3d entities exposed only as {Sketchup::Drawingelement} Use
|
369
|
-
# {#typename} to determine if a {Sketchup::Drawingelement} is
|
370
|
-
# a +"Polyline3d"+.
|
371
|
-
#
|
372
|
-
# @example
|
373
|
-
# model = Sketchup.active_model
|
374
|
-
# entities = model.active_entities
|
375
|
-
# pts = [
|
376
|
-
# Geom::Point3d.new(0, 0, 0),
|
377
|
-
# Geom::Point3d.new(9, 0, 0),
|
378
|
-
# Geom::Point3d.new(9, 9, 0),
|
379
|
-
# Geom::Point3d.new(0, 9, 0),
|
380
|
-
# ]
|
381
|
-
#
|
382
|
-
# # Add the face to the entities in the model
|
383
|
-
# group = entities.add_group
|
384
|
-
# face = group.entities.add_face(pts)
|
385
|
-
# pid = face.persistent_id
|
386
|
-
# # Exploding the group will preserve the pid.
|
387
|
-
# pid == face.persistent_id # Should return true
|
388
|
-
#
|
389
|
-
# @note Only a subset of entity types support PIDs. Refer to the table
|
390
|
-
# below for which and when support was added. In general it is entities that
|
391
|
-
# you can iterate over in a {Sketchup::Entities} collection.
|
392
|
-
#
|
393
|
-
# @return [Integer] the id for the {Sketchup::Entity} object
|
394
|
-
#
|
395
|
-
# @version SketchUp 2017
|
396
|
-
def persistent_id
|
397
|
-
end
|
398
|
-
|
399
|
-
# The remove_observer method is used to remove an observer from the current
|
400
|
-
# object.
|
401
|
-
#
|
402
|
-
# @example
|
403
|
-
# entity = Sketchup.active_model.entities[0]
|
404
|
-
# if entity.valid?
|
405
|
-
# status = entity.remove_observer observer
|
406
|
-
# end
|
407
|
-
#
|
408
|
-
# @param [Object] observer
|
409
|
-
# An observer.
|
410
|
-
#
|
411
|
-
# @return [Boolean] true if successful, false if unsuccessful.
|
412
|
-
#
|
413
|
-
# @version SketchUp 6.0
|
414
|
-
def remove_observer(observer)
|
415
|
-
end
|
416
|
-
|
417
|
-
# The set attribute is used to set the value of an attribute in an attribute
|
418
|
-
# dictionary with the given name.
|
419
|
-
#
|
420
|
-
# This method will create a new AttributeDictionary if none exists.
|
421
|
-
#
|
422
|
-
# Note, a bug prior to SketchUp 2015 would corrupt the model if the key is
|
423
|
-
# an empty string. This also includes values that will evaluate to empty
|
424
|
-
# strings, such as nil.
|
425
|
-
#
|
426
|
-
# @example
|
427
|
-
# depth = 100
|
428
|
-
# width = 100
|
429
|
-
# model = Sketchup.active_model
|
430
|
-
# entities = model.active_entities
|
431
|
-
# pts = []
|
432
|
-
# pts[0] = [0, 0, 0]
|
433
|
-
# pts[1] = [width, 0, 0]
|
434
|
-
# pts[2] = [width, depth, 0]
|
435
|
-
# pts[3] = [0, depth, 0]
|
436
|
-
#
|
437
|
-
# # Add the face to the entities in the model
|
438
|
-
# face = entities.add_face pts
|
439
|
-
#
|
440
|
-
# # I just happen to know that the second and third entities in the
|
441
|
-
# # entities objects are edges.
|
442
|
-
# entity1 = entities[1]
|
443
|
-
# status = entity1.set_attribute "testdictionary", "test", 115
|
444
|
-
#
|
445
|
-
# @param [String] dict_name
|
446
|
-
# The name of an attribute dictionary.
|
447
|
-
#
|
448
|
-
# @param [String] key
|
449
|
-
# An attribute key.
|
450
|
-
#
|
451
|
-
# @param [Object] value
|
452
|
-
# The value for the attribute.
|
453
|
-
#
|
454
|
-
# @return [Object] the newly set value if successful
|
455
|
-
#
|
456
|
-
# @version SketchUp 6.0
|
457
|
-
def set_attribute(dict_name, key, value)
|
458
|
-
end
|
459
|
-
|
460
|
-
# The to_s method is used to retrieve the string representation of the entity.
|
461
|
-
#
|
462
|
-
# @example
|
463
|
-
# depth = 100
|
464
|
-
# width = 100
|
465
|
-
# model = Sketchup.active_model
|
466
|
-
# entities = model.active_entities
|
467
|
-
# pts = []
|
468
|
-
# pts[0] = [0, 0, 0]
|
469
|
-
# pts[1] = [width, 0, 0]
|
470
|
-
# pts[2] = [width, depth, 0]
|
471
|
-
# pts[3] = [0, depth, 0]
|
472
|
-
#
|
473
|
-
# # Add the face to the entities in the model
|
474
|
-
# face = entities.add_face pts
|
475
|
-
#
|
476
|
-
# # I just happen to know that the second and third entities in the
|
477
|
-
# # entities objects are edges.
|
478
|
-
# entity1 = entities[1]
|
479
|
-
# st = entity1.to_s
|
480
|
-
#
|
481
|
-
# @return [String] the string representation of the entity if
|
482
|
-
# successful
|
483
|
-
#
|
484
|
-
# @version SketchUp 6.0
|
485
|
-
def to_s
|
486
|
-
end
|
487
|
-
|
488
|
-
# The typename method retrieves the type of the entity, which will be a string
|
489
|
-
# such as "Face", "Edge", or "Group".
|
490
|
-
#
|
491
|
-
# @example
|
492
|
-
# depth = 100
|
493
|
-
# width = 100
|
494
|
-
# model = Sketchup.active_model
|
495
|
-
# entities = model.active_entities
|
496
|
-
# pts = []
|
497
|
-
# pts[0] = [0, 0, 0]
|
498
|
-
# pts[1] = [width, 0, 0]
|
499
|
-
# pts[2] = [width, depth, 0]
|
500
|
-
# pts[3] = [0, depth, 0]
|
501
|
-
#
|
502
|
-
# # Add the face to the entities in the model
|
503
|
-
# face = entities.add_face pts
|
504
|
-
#
|
505
|
-
# # I just happen to know that the second and third entities in the
|
506
|
-
# # entities objects are edges.
|
507
|
-
# entity1 = entities[1]
|
508
|
-
# type = entity1.typename
|
509
|
-
#
|
510
|
-
# @note Prefer +is_a?+ over +typename+ when possible as it is faster.
|
511
|
-
#
|
512
|
-
# @return [String] the type of the entity
|
513
|
-
#
|
514
|
-
# @version SketchUp 6.0
|
515
|
-
def typename
|
516
|
-
end
|
517
|
-
|
518
|
-
# The {#valid?} method is used to determine if your entity is still valid (not
|
519
|
-
# deleted by another script, for example).
|
520
|
-
#
|
521
|
-
# This method is functionally the inverse to the {#deleted?} method.
|
522
|
-
#
|
523
|
-
# @example
|
524
|
-
# depth = 100
|
525
|
-
# width = 100
|
526
|
-
# model = Sketchup.active_model
|
527
|
-
# entities = model.active_entities
|
528
|
-
# pts = []
|
529
|
-
# pts[0] = [0, 0, 0]
|
530
|
-
# pts[1] = [width, 0, 0]
|
531
|
-
# pts[2] = [width, depth, 0]
|
532
|
-
# pts[3] = [0, depth, 0]
|
533
|
-
#
|
534
|
-
# # Add the face to the entities in the model
|
535
|
-
# face = entities.add_face pts
|
536
|
-
# entity1 = entities[1]
|
537
|
-
# status = entity1.valid?
|
538
|
-
#
|
539
|
-
# @return [Boolean]
|
540
|
-
#
|
541
|
-
# @version SketchUp 6.0
|
542
|
-
def valid?
|
543
|
-
end
|
544
|
-
|
545
|
-
end
|
1
|
+
# Copyright:: Copyright 2023 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# This is the base class for all SketchUp entities. Entities are basically
|
5
|
+
# anything that can be contained in a model, including Drawingelements
|
6
|
+
# such as Edges, SectionPlanes, Groups, etc. and entities that relate to
|
7
|
+
# those Drawingelements, such as Loops, Layers, etc.
|
8
|
+
#
|
9
|
+
# Keep in mind that the methods below are available on all subclasses.
|
10
|
+
# For example, an Edge's parent class is Drawingelement, and a
|
11
|
+
# Drawingelement's parent class is Entity. Therefore an Edge has all of the
|
12
|
+
# methods defined in Drawingelement and Entity.
|
13
|
+
#
|
14
|
+
# The Object.is_a? method is the common way of determining what sort of Entity
|
15
|
+
# you're dealing with.
|
16
|
+
#
|
17
|
+
# @example
|
18
|
+
# # Count how many faces are in the current selection.
|
19
|
+
# selection = Sketchup.active_model.selection
|
20
|
+
# face_count = 0
|
21
|
+
#
|
22
|
+
# # Look at all of the entities in the selection.
|
23
|
+
# selection.each { |entity|
|
24
|
+
# if entity.is_a? Sketchup::Face
|
25
|
+
# face_count = face_count + 1
|
26
|
+
# end
|
27
|
+
# }
|
28
|
+
#
|
29
|
+
# UI.messagebox("There are " + face_count.to_s + " faces selected.")
|
30
|
+
#
|
31
|
+
# @version SketchUp 6.0
|
32
|
+
class Sketchup::Entity
|
33
|
+
|
34
|
+
# Instance Methods
|
35
|
+
|
36
|
+
# The add_observer method is used to add an observer to the current object.
|
37
|
+
#
|
38
|
+
# @example
|
39
|
+
# entity = Sketchup.active_model.entities[0]
|
40
|
+
# if entity.valid?
|
41
|
+
# status = entity.add_observer observer
|
42
|
+
# end
|
43
|
+
#
|
44
|
+
# @param [Object] observer
|
45
|
+
# An observer.
|
46
|
+
#
|
47
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
48
|
+
#
|
49
|
+
# @version SketchUp 6.0
|
50
|
+
def add_observer(observer)
|
51
|
+
end
|
52
|
+
|
53
|
+
# The attribute_dictionaries method is used to retrieve the
|
54
|
+
# AttributeDictionaries collection attached to the entity.
|
55
|
+
#
|
56
|
+
# @example
|
57
|
+
# depth = 100
|
58
|
+
# width = 100
|
59
|
+
# model = Sketchup.active_model
|
60
|
+
# entities = model.active_entities
|
61
|
+
# pts = []
|
62
|
+
# pts[0] = [0, 0, 0]
|
63
|
+
# pts[1] = [width, 0, 0]
|
64
|
+
# pts[2] = [width, depth, 0]
|
65
|
+
# pts[3] = [0, depth, 0]
|
66
|
+
#
|
67
|
+
# # Add the face to the entities in the model
|
68
|
+
# face = entities.add_face pts
|
69
|
+
#
|
70
|
+
# # I just happen to know that the second and third entities in the
|
71
|
+
# # entities objects are edges.
|
72
|
+
# entity1 = entities[1]
|
73
|
+
# status = entity1.set_attribute "testdictionary", "test", 115
|
74
|
+
# attrdicts = entity1.attribute_dictionaries
|
75
|
+
#
|
76
|
+
# @note The return value may be either +nil+ or an empty
|
77
|
+
# {Sketchup::AttributeDictionaries} collection if this entity has no
|
78
|
+
# {Sketchup::AttributeDictionary}s.
|
79
|
+
#
|
80
|
+
# @return [Sketchup::AttributeDictionaries, nil]
|
81
|
+
#
|
82
|
+
# @version SketchUp 6.0
|
83
|
+
def attribute_dictionaries
|
84
|
+
end
|
85
|
+
|
86
|
+
# The attribute_dictionary method is used to retrieve an attribute dictionary
|
87
|
+
# with a given name that is attached to an Entity.
|
88
|
+
#
|
89
|
+
# @example
|
90
|
+
# depth = 100
|
91
|
+
# width = 100
|
92
|
+
# model = Sketchup.active_model
|
93
|
+
# entities = model.active_entities
|
94
|
+
# pts = []
|
95
|
+
# pts[0] = [0, 0, 0]
|
96
|
+
# pts[1] = [width, 0, 0]
|
97
|
+
# pts[2] = [width, depth, 0]
|
98
|
+
# pts[3] = [0, depth, 0]
|
99
|
+
#
|
100
|
+
# # Add the face to the entities in the model
|
101
|
+
# face = entities.add_face pts
|
102
|
+
#
|
103
|
+
# # I just happen to know that the second and third entities in the
|
104
|
+
# # entities objects are edges.
|
105
|
+
# entity1 = entities[1]
|
106
|
+
# status = entity1.set_attribute "testdictionary", "test", 115
|
107
|
+
# attrdict = entity1.attribute_dictionary "testdictionary"
|
108
|
+
#
|
109
|
+
# @param [String] name
|
110
|
+
# The name of the attribute dictionary.
|
111
|
+
#
|
112
|
+
# @param [Boolean] create
|
113
|
+
# boolean, if set to true then the attribute
|
114
|
+
# dictionary will be created if it does not exist.
|
115
|
+
#
|
116
|
+
# @return [Sketchup::AttributeDictionary, nil] - an AttributeDictionary object
|
117
|
+
# if successful, or nil if there is no attribute dictionary
|
118
|
+
#
|
119
|
+
# @version SketchUp 6.0
|
120
|
+
def attribute_dictionary(name, create = false)
|
121
|
+
end
|
122
|
+
|
123
|
+
# The {#delete_attribute} method is used to delete an attribute from an entity.
|
124
|
+
#
|
125
|
+
# If only the dictionary_name is given, then it deletes the entire
|
126
|
+
# AttributeDictionary. Otherwise, {#delete_attribute} deletes the attribute with
|
127
|
+
# the given key from the given dictionary.
|
128
|
+
#
|
129
|
+
# @bug Prior to SketchUp 2019.0 the return values was always +true+.
|
130
|
+
#
|
131
|
+
# @example
|
132
|
+
# depth = 100
|
133
|
+
# width = 100
|
134
|
+
# model = Sketchup.active_model
|
135
|
+
# entities = model.active_entities
|
136
|
+
# pts = []
|
137
|
+
# pts[0] = [0, 0, 0]
|
138
|
+
# pts[1] = [width, 0, 0]
|
139
|
+
# pts[2] = [width, depth, 0]
|
140
|
+
# pts[3] = [0, depth, 0]
|
141
|
+
# # Add the face to the entities in the model
|
142
|
+
# face = entities.add_face pts
|
143
|
+
#
|
144
|
+
# # I just happen to know that the second and third entities in the
|
145
|
+
# # entities objects are edges.
|
146
|
+
# entity1 = entities[1]
|
147
|
+
# status = entity1.set_attribute "testdictionary", "test", 115
|
148
|
+
# status = entity1.delete_attribute "testdictionary"
|
149
|
+
#
|
150
|
+
# @note In SketchUp 2018, special attribute dictionaries have been added.
|
151
|
+
# The name of these dictionaries are "SU_InstanceSet" and "SU_DefinitionSet".
|
152
|
+
# The dictionaries cannot be deleted via ruby and an ArgumentError will be
|
153
|
+
# raised. The key/value pairs in the dictionary can be deleted safely.
|
154
|
+
#
|
155
|
+
# @overload delete_attribute(dictionary_name)
|
156
|
+
#
|
157
|
+
# @param [String] dictionary_name The name of an attribute dictionary.
|
158
|
+
# @return [Boolean]
|
159
|
+
#
|
160
|
+
# @overload delete_attribute(dictionary_name, key)
|
161
|
+
#
|
162
|
+
# @param [String] dictionary_name The name of an attribute dictionary.
|
163
|
+
# @param [String] key An attribute key.
|
164
|
+
# @return [Boolean]
|
165
|
+
#
|
166
|
+
# @version SketchUp 6.0
|
167
|
+
def delete_attribute(*args)
|
168
|
+
end
|
169
|
+
|
170
|
+
# The deleted? method is used to determine if your entity is still valid (not
|
171
|
+
# deleted by another script, for example.)
|
172
|
+
#
|
173
|
+
# @example
|
174
|
+
# depth = 100
|
175
|
+
# width = 100
|
176
|
+
# model = Sketchup.active_model
|
177
|
+
# entities = model.active_entities
|
178
|
+
# pts = []
|
179
|
+
# pts[0] = [0, 0, 0]
|
180
|
+
# pts[1] = [width, 0, 0]
|
181
|
+
# pts[2] = [width, depth, 0]
|
182
|
+
# pts[3] = [0, depth, 0]
|
183
|
+
#
|
184
|
+
# # Add the face to the entities in the model
|
185
|
+
# face = entities.add_face pts
|
186
|
+
# entity1 = entities[1]
|
187
|
+
# status = entity1.deleted?
|
188
|
+
#
|
189
|
+
# @return [Boolean]
|
190
|
+
#
|
191
|
+
# @version SketchUp 6.0
|
192
|
+
def deleted?
|
193
|
+
end
|
194
|
+
|
195
|
+
# The entityID method is used to retrieve a unique ID assigned to an entity.
|
196
|
+
#
|
197
|
+
# The entityID is not persistent between sessions.
|
198
|
+
#
|
199
|
+
# @example
|
200
|
+
# depth = 100
|
201
|
+
# width = 100
|
202
|
+
# model = Sketchup.active_model
|
203
|
+
# entities = model.active_entities
|
204
|
+
# pts = []
|
205
|
+
# pts[0] = [0, 0, 0]
|
206
|
+
# pts[1] = [width, 0, 0]
|
207
|
+
# pts[2] = [width, depth, 0]
|
208
|
+
# pts[3] = [0, depth, 0]
|
209
|
+
#
|
210
|
+
# # Add the face to the entities in the model
|
211
|
+
# face = entities.add_face pts
|
212
|
+
# entity1 = entities[1]
|
213
|
+
# id = entity1.entityID
|
214
|
+
#
|
215
|
+
# @return [Integer] the id for the Entity object
|
216
|
+
#
|
217
|
+
# @version SketchUp 6.0
|
218
|
+
def entityID
|
219
|
+
end
|
220
|
+
|
221
|
+
# The {#get_attribute} method is used to retrieve the value of an attribute in
|
222
|
+
# the entity's attribute dictionary.
|
223
|
+
#
|
224
|
+
# If the third parameter, +default_value+, is not passed and there is no
|
225
|
+
# attribute that matches the given name, it returns +nil+.
|
226
|
+
#
|
227
|
+
# If +default_value+ is provided and there is no matching attribute it returns
|
228
|
+
# the given value. It does not create an attribute with that name though.
|
229
|
+
#
|
230
|
+
# @example
|
231
|
+
# # Add an entity to the model:
|
232
|
+
# model = Sketchup.active_model
|
233
|
+
# entities = model.active_entities
|
234
|
+
# edge = entities.add_line([0, 0, 0], [9, 9, 9])
|
235
|
+
#
|
236
|
+
# # Read an attribute value from the edge. In this case this will return the
|
237
|
+
# # default value provided; 42.
|
238
|
+
# value = edge.get_attribute("MyExtension", "MyProperty", 42)
|
239
|
+
#
|
240
|
+
# @param [String] dict_name
|
241
|
+
# The name of an attribute dictionary.
|
242
|
+
#
|
243
|
+
# @param [String] key
|
244
|
+
# An attribute key.
|
245
|
+
#
|
246
|
+
# @param [Object] default_value
|
247
|
+
# A default value to return if no attribute is found.
|
248
|
+
#
|
249
|
+
# @return [Object] the retrieved value
|
250
|
+
#
|
251
|
+
# @version SketchUp 6.0
|
252
|
+
def get_attribute(dict_name, key, default_value = nil)
|
253
|
+
end
|
254
|
+
|
255
|
+
# The to_s method is used to retrieve the string representation of the entity.
|
256
|
+
#
|
257
|
+
# @example
|
258
|
+
# depth = 100
|
259
|
+
# width = 100
|
260
|
+
# model = Sketchup.active_model
|
261
|
+
# entities = model.active_entities
|
262
|
+
# pts = []
|
263
|
+
# pts[0] = [0, 0, 0]
|
264
|
+
# pts[1] = [width, 0, 0]
|
265
|
+
# pts[2] = [width, depth, 0]
|
266
|
+
# pts[3] = [0, depth, 0]
|
267
|
+
#
|
268
|
+
# # Add the face to the entities in the model
|
269
|
+
# face = entities.add_face pts
|
270
|
+
#
|
271
|
+
# # I just happen to know that the second and third entities in the
|
272
|
+
# # entities objects are edges.
|
273
|
+
# entity1 = entities[1]
|
274
|
+
# st = entity1.to_s
|
275
|
+
#
|
276
|
+
# @return [String] the string representation of the entity if
|
277
|
+
# successful
|
278
|
+
#
|
279
|
+
# @version SketchUp 6.0
|
280
|
+
def inspect
|
281
|
+
end
|
282
|
+
|
283
|
+
# The model method is used to retrieve the model for the entity.
|
284
|
+
#
|
285
|
+
# @example
|
286
|
+
# depth = 100
|
287
|
+
# width = 100
|
288
|
+
# model = Sketchup.active_model
|
289
|
+
# entities = model.active_entities
|
290
|
+
# pts = []
|
291
|
+
# pts[0] = [0, 0, 0]
|
292
|
+
# pts[1] = [width, 0, 0]
|
293
|
+
# pts[2] = [width, depth, 0]
|
294
|
+
# pts[3] = [0, depth, 0]
|
295
|
+
#
|
296
|
+
# # Add the face to the entities in the model
|
297
|
+
# face = entities.add_face pts
|
298
|
+
#
|
299
|
+
# # I just happen to know that the second and third entities in the
|
300
|
+
# # entities objects are edges.
|
301
|
+
# entity1 = entities[1]
|
302
|
+
# m = entity1.model
|
303
|
+
#
|
304
|
+
# @return [Sketchup::Model] the model that contains the Entity object
|
305
|
+
#
|
306
|
+
# @version SketchUp 6.0
|
307
|
+
def model
|
308
|
+
end
|
309
|
+
|
310
|
+
# The parent method is used to retrieve the parent of the entity.
|
311
|
+
#
|
312
|
+
# The parent will be a ComponentDefinition, a Group, or a Model, whatever
|
313
|
+
# the entity is contained within.
|
314
|
+
#
|
315
|
+
# @example
|
316
|
+
# depth = 100
|
317
|
+
# width = 100
|
318
|
+
# model = Sketchup.active_model
|
319
|
+
# entities = model.active_entities
|
320
|
+
# pts = []
|
321
|
+
# pts[0] = [0, 0, 0]
|
322
|
+
# pts[1] = [width, 0, 0]
|
323
|
+
# pts[2] = [width, depth, 0]
|
324
|
+
# pts[3] = [0, depth, 0]
|
325
|
+
#
|
326
|
+
# # Add the face to the entities in the model
|
327
|
+
# face = entities.add_face pts
|
328
|
+
#
|
329
|
+
# # I just happen to know that the second and third entities in the
|
330
|
+
# # entities objects are edges.
|
331
|
+
# entity1 = entities[1]
|
332
|
+
# parent = entity1.parent
|
333
|
+
#
|
334
|
+
# @return [Sketchup::ComponentDefinition, Sketchup::Model] a Entity object
|
335
|
+
# representing the parent of this entity
|
336
|
+
#
|
337
|
+
# @version SketchUp 6.0
|
338
|
+
def parent
|
339
|
+
end
|
340
|
+
|
341
|
+
# The {#persistent_id} method is used to retrieve a unique persistent id
|
342
|
+
# assigned to an entity.
|
343
|
+
#
|
344
|
+
# The persistent id persistent between sessions.
|
345
|
+
#
|
346
|
+
# [SketchUp 2020.1]
|
347
|
+
# - {Sketchup::ComponentDefinition}
|
348
|
+
# - {Sketchup::Material}
|
349
|
+
# - {Sketchup::Style}
|
350
|
+
# [SketchUp 2020.0]
|
351
|
+
# - {Sketchup::Layer}
|
352
|
+
# - {Sketchup::LineStyle}
|
353
|
+
# [SketchUp 2018]
|
354
|
+
# - {Sketchup::Page}
|
355
|
+
# [SketchUp 2017]
|
356
|
+
# - {Sketchup::ComponentInstance}
|
357
|
+
# - {Sketchup::ConstructionLine}
|
358
|
+
# - {Sketchup::ConstructionPoint}
|
359
|
+
# - {Sketchup::Curve}
|
360
|
+
# - {Sketchup::Dimension}
|
361
|
+
# - {Sketchup::Edge}
|
362
|
+
# - {Sketchup::Face}
|
363
|
+
# - {Sketchup::Group}
|
364
|
+
# - {Sketchup::Image}
|
365
|
+
# - {Sketchup::SectionPlane}
|
366
|
+
# - {Sketchup::Text}
|
367
|
+
# - {Sketchup::Vertex}
|
368
|
+
# - Polyline3d entities exposed only as {Sketchup::Drawingelement} Use
|
369
|
+
# {#typename} to determine if a {Sketchup::Drawingelement} is
|
370
|
+
# a +"Polyline3d"+.
|
371
|
+
#
|
372
|
+
# @example
|
373
|
+
# model = Sketchup.active_model
|
374
|
+
# entities = model.active_entities
|
375
|
+
# pts = [
|
376
|
+
# Geom::Point3d.new(0, 0, 0),
|
377
|
+
# Geom::Point3d.new(9, 0, 0),
|
378
|
+
# Geom::Point3d.new(9, 9, 0),
|
379
|
+
# Geom::Point3d.new(0, 9, 0),
|
380
|
+
# ]
|
381
|
+
#
|
382
|
+
# # Add the face to the entities in the model
|
383
|
+
# group = entities.add_group
|
384
|
+
# face = group.entities.add_face(pts)
|
385
|
+
# pid = face.persistent_id
|
386
|
+
# # Exploding the group will preserve the pid.
|
387
|
+
# pid == face.persistent_id # Should return true
|
388
|
+
#
|
389
|
+
# @note Only a subset of entity types support PIDs. Refer to the table
|
390
|
+
# below for which and when support was added. In general it is entities that
|
391
|
+
# you can iterate over in a {Sketchup::Entities} collection.
|
392
|
+
#
|
393
|
+
# @return [Integer] the id for the {Sketchup::Entity} object
|
394
|
+
#
|
395
|
+
# @version SketchUp 2017
|
396
|
+
def persistent_id
|
397
|
+
end
|
398
|
+
|
399
|
+
# The remove_observer method is used to remove an observer from the current
|
400
|
+
# object.
|
401
|
+
#
|
402
|
+
# @example
|
403
|
+
# entity = Sketchup.active_model.entities[0]
|
404
|
+
# if entity.valid?
|
405
|
+
# status = entity.remove_observer observer
|
406
|
+
# end
|
407
|
+
#
|
408
|
+
# @param [Object] observer
|
409
|
+
# An observer.
|
410
|
+
#
|
411
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
412
|
+
#
|
413
|
+
# @version SketchUp 6.0
|
414
|
+
def remove_observer(observer)
|
415
|
+
end
|
416
|
+
|
417
|
+
# The set attribute is used to set the value of an attribute in an attribute
|
418
|
+
# dictionary with the given name.
|
419
|
+
#
|
420
|
+
# This method will create a new AttributeDictionary if none exists.
|
421
|
+
#
|
422
|
+
# Note, a bug prior to SketchUp 2015 would corrupt the model if the key is
|
423
|
+
# an empty string. This also includes values that will evaluate to empty
|
424
|
+
# strings, such as nil.
|
425
|
+
#
|
426
|
+
# @example
|
427
|
+
# depth = 100
|
428
|
+
# width = 100
|
429
|
+
# model = Sketchup.active_model
|
430
|
+
# entities = model.active_entities
|
431
|
+
# pts = []
|
432
|
+
# pts[0] = [0, 0, 0]
|
433
|
+
# pts[1] = [width, 0, 0]
|
434
|
+
# pts[2] = [width, depth, 0]
|
435
|
+
# pts[3] = [0, depth, 0]
|
436
|
+
#
|
437
|
+
# # Add the face to the entities in the model
|
438
|
+
# face = entities.add_face pts
|
439
|
+
#
|
440
|
+
# # I just happen to know that the second and third entities in the
|
441
|
+
# # entities objects are edges.
|
442
|
+
# entity1 = entities[1]
|
443
|
+
# status = entity1.set_attribute "testdictionary", "test", 115
|
444
|
+
#
|
445
|
+
# @param [String] dict_name
|
446
|
+
# The name of an attribute dictionary.
|
447
|
+
#
|
448
|
+
# @param [String] key
|
449
|
+
# An attribute key.
|
450
|
+
#
|
451
|
+
# @param [Object] value
|
452
|
+
# The value for the attribute.
|
453
|
+
#
|
454
|
+
# @return [Object] the newly set value if successful
|
455
|
+
#
|
456
|
+
# @version SketchUp 6.0
|
457
|
+
def set_attribute(dict_name, key, value)
|
458
|
+
end
|
459
|
+
|
460
|
+
# The to_s method is used to retrieve the string representation of the entity.
|
461
|
+
#
|
462
|
+
# @example
|
463
|
+
# depth = 100
|
464
|
+
# width = 100
|
465
|
+
# model = Sketchup.active_model
|
466
|
+
# entities = model.active_entities
|
467
|
+
# pts = []
|
468
|
+
# pts[0] = [0, 0, 0]
|
469
|
+
# pts[1] = [width, 0, 0]
|
470
|
+
# pts[2] = [width, depth, 0]
|
471
|
+
# pts[3] = [0, depth, 0]
|
472
|
+
#
|
473
|
+
# # Add the face to the entities in the model
|
474
|
+
# face = entities.add_face pts
|
475
|
+
#
|
476
|
+
# # I just happen to know that the second and third entities in the
|
477
|
+
# # entities objects are edges.
|
478
|
+
# entity1 = entities[1]
|
479
|
+
# st = entity1.to_s
|
480
|
+
#
|
481
|
+
# @return [String] the string representation of the entity if
|
482
|
+
# successful
|
483
|
+
#
|
484
|
+
# @version SketchUp 6.0
|
485
|
+
def to_s
|
486
|
+
end
|
487
|
+
|
488
|
+
# The typename method retrieves the type of the entity, which will be a string
|
489
|
+
# such as "Face", "Edge", or "Group".
|
490
|
+
#
|
491
|
+
# @example
|
492
|
+
# depth = 100
|
493
|
+
# width = 100
|
494
|
+
# model = Sketchup.active_model
|
495
|
+
# entities = model.active_entities
|
496
|
+
# pts = []
|
497
|
+
# pts[0] = [0, 0, 0]
|
498
|
+
# pts[1] = [width, 0, 0]
|
499
|
+
# pts[2] = [width, depth, 0]
|
500
|
+
# pts[3] = [0, depth, 0]
|
501
|
+
#
|
502
|
+
# # Add the face to the entities in the model
|
503
|
+
# face = entities.add_face pts
|
504
|
+
#
|
505
|
+
# # I just happen to know that the second and third entities in the
|
506
|
+
# # entities objects are edges.
|
507
|
+
# entity1 = entities[1]
|
508
|
+
# type = entity1.typename
|
509
|
+
#
|
510
|
+
# @note Prefer +is_a?+ over +typename+ when possible as it is faster.
|
511
|
+
#
|
512
|
+
# @return [String] the type of the entity
|
513
|
+
#
|
514
|
+
# @version SketchUp 6.0
|
515
|
+
def typename
|
516
|
+
end
|
517
|
+
|
518
|
+
# The {#valid?} method is used to determine if your entity is still valid (not
|
519
|
+
# deleted by another script, for example).
|
520
|
+
#
|
521
|
+
# This method is functionally the inverse to the {#deleted?} method.
|
522
|
+
#
|
523
|
+
# @example
|
524
|
+
# depth = 100
|
525
|
+
# width = 100
|
526
|
+
# model = Sketchup.active_model
|
527
|
+
# entities = model.active_entities
|
528
|
+
# pts = []
|
529
|
+
# pts[0] = [0, 0, 0]
|
530
|
+
# pts[1] = [width, 0, 0]
|
531
|
+
# pts[2] = [width, depth, 0]
|
532
|
+
# pts[3] = [0, depth, 0]
|
533
|
+
#
|
534
|
+
# # Add the face to the entities in the model
|
535
|
+
# face = entities.add_face pts
|
536
|
+
# entity1 = entities[1]
|
537
|
+
# status = entity1.valid?
|
538
|
+
#
|
539
|
+
# @return [Boolean]
|
540
|
+
#
|
541
|
+
# @version SketchUp 6.0
|
542
|
+
def valid?
|
543
|
+
end
|
544
|
+
|
545
|
+
end
|