sketchup-api-stubs 0.7.4 → 0.7.5
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.rb +1 -1
- data/lib/sketchup-api-stubs/sketchup.rb +147 -145
- 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 +498 -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 +691 -691
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +573 -573
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +411 -411
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +179 -174
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +515 -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 +349 -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 +694 -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/Sketchup/Animation.rb +144 -140
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +157 -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 +577 -562
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +604 -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 +362 -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 +1126 -1119
- 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 +751 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +699 -697
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +285 -285
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +417 -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 +405 -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 +327 -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.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- 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 +478 -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 +257 -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 +835 -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 +71 -61
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1307 -1301
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -43
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +317 -310
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +387 -356
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +255 -229
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +240 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +633 -633
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/geom.rb +351 -348
- data/lib/sketchup-api-stubs/stubs/languagehandler.rb +92 -92
- 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.rb +1342 -1310
- 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.rb +668 -667
- metadata +4 -2
@@ -1,125 +1,127 @@
|
|
1
|
-
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# This observer interface is implemented to react to {Sketchup::Entities}
|
5
|
-
# collection events.
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
13
|
-
#
|
14
|
-
#
|
15
|
-
#
|
16
|
-
#
|
17
|
-
#
|
18
|
-
#
|
19
|
-
#
|
20
|
-
#
|
21
|
-
#
|
22
|
-
#
|
23
|
-
#
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
#
|
32
|
-
|
33
|
-
#
|
34
|
-
#
|
35
|
-
#
|
36
|
-
#
|
37
|
-
#
|
38
|
-
#
|
39
|
-
#
|
40
|
-
# puts "
|
41
|
-
#
|
42
|
-
#
|
43
|
-
#
|
44
|
-
#
|
45
|
-
#
|
46
|
-
# @
|
47
|
-
#
|
48
|
-
# @
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
#
|
55
|
-
#
|
56
|
-
#
|
57
|
-
#
|
58
|
-
#
|
59
|
-
#
|
60
|
-
#
|
61
|
-
#
|
62
|
-
# @param [Sketchup::
|
63
|
-
#
|
64
|
-
# @
|
65
|
-
#
|
66
|
-
# @
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
#
|
73
|
-
#
|
74
|
-
#
|
75
|
-
#
|
76
|
-
#
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
# @param [Sketchup::
|
81
|
-
#
|
82
|
-
# @
|
83
|
-
#
|
84
|
-
# @
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
#
|
96
|
-
#
|
97
|
-
#
|
98
|
-
#
|
99
|
-
#
|
100
|
-
# @param [Sketchup::
|
101
|
-
#
|
102
|
-
#
|
103
|
-
#
|
104
|
-
#
|
105
|
-
#
|
106
|
-
# @
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
#
|
117
|
-
#
|
118
|
-
#
|
119
|
-
# @
|
120
|
-
#
|
121
|
-
# @
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
end
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# This observer interface is implemented to react to {Sketchup::Entities}
|
5
|
+
# collection events.
|
6
|
+
#
|
7
|
+
# @abstract To implement this observer, create a Ruby class of this
|
8
|
+
# type, override the desired methods, and add an instance of the observer to
|
9
|
+
# the objects of interests.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# # This is an example of an observer that watches the entities collection
|
13
|
+
# # new added elements and writes a message on the console.
|
14
|
+
# class MyEntitiesObserver < Sketchup::EntitiesObserver
|
15
|
+
# def onElementAdded(entities, entity)
|
16
|
+
# puts "onElementAdded: #{entity}"
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
#
|
20
|
+
# # Attach the observer
|
21
|
+
# Sketchup.active_model.entities.add_observer(MyEntitiesObserver.new)
|
22
|
+
#
|
23
|
+
# @note The methods of this observer fire in such a way that making changes
|
24
|
+
# to the model while inside of them is dangerous. If you experience sudden
|
25
|
+
# crashes, it could be because of this observer. A potential workaround is to
|
26
|
+
# use a {Sketchup::ToolsObserver} to watch what the user is doing instead.
|
27
|
+
#
|
28
|
+
# @version SketchUp 6.0
|
29
|
+
class Sketchup::EntitiesObserver
|
30
|
+
|
31
|
+
# Instance Methods
|
32
|
+
|
33
|
+
# The {#onActiveSectionPlaneChanged} method is invoked when a section plane
|
34
|
+
# within this entities is activated or the active one is deactivated.
|
35
|
+
#
|
36
|
+
# @example
|
37
|
+
# def onActiveSectionPlaneChanged(entities)
|
38
|
+
# sp = entities.active_section_plane
|
39
|
+
# if sp.nil?
|
40
|
+
# puts "Section plane is deactivated on #{entities}"
|
41
|
+
# else
|
42
|
+
# puts "#{sp} is activated on #{entities}"
|
43
|
+
# end
|
44
|
+
# end
|
45
|
+
#
|
46
|
+
# @param [Sketchup::Entities] entities
|
47
|
+
#
|
48
|
+
# @return [nil]
|
49
|
+
#
|
50
|
+
# @version SketchUp 2014
|
51
|
+
def onActiveSectionPlaneChanged(entities)
|
52
|
+
end
|
53
|
+
|
54
|
+
# The onElementAdded method is invoked when a single element is added
|
55
|
+
# to the {Sketchup::Entities} collection.
|
56
|
+
#
|
57
|
+
# @example
|
58
|
+
# def onElementAdded(entities, entity)
|
59
|
+
# puts "onElementAdded: #{entity}"
|
60
|
+
# end
|
61
|
+
#
|
62
|
+
# @param [Sketchup::Entities] entities
|
63
|
+
#
|
64
|
+
# @param [Sketchup::Entity] entity
|
65
|
+
#
|
66
|
+
# @return [nil]
|
67
|
+
#
|
68
|
+
# @version SketchUp 6.0
|
69
|
+
def onElementAdded(entities, entity)
|
70
|
+
end
|
71
|
+
|
72
|
+
# The {#onElementModified} method is invoked whenever one or more elements in
|
73
|
+
# the collection are modified.
|
74
|
+
#
|
75
|
+
# @example
|
76
|
+
# def onElementModified(entities, entity)
|
77
|
+
# puts "onElementModified: #{entity}"
|
78
|
+
# end
|
79
|
+
#
|
80
|
+
# @param [Sketchup::Entities] entities
|
81
|
+
#
|
82
|
+
# @param [Sketchup::Entity] entity
|
83
|
+
#
|
84
|
+
# @return [nil]
|
85
|
+
#
|
86
|
+
# @version SketchUp 8.0
|
87
|
+
def onElementModified(entities, entity)
|
88
|
+
end
|
89
|
+
|
90
|
+
# The {#onElementRemoved} method is invoked when a single element is removed
|
91
|
+
# from the {Sketchup::Entities} collection. Note that the entity has been
|
92
|
+
# deleted and should not be used in anyway except to know that the entity has
|
93
|
+
# been deleted.
|
94
|
+
#
|
95
|
+
# @example
|
96
|
+
# def onElementRemoved(entities, entity_id)
|
97
|
+
# puts "onElementRemoved: #{entity_id}"
|
98
|
+
# end
|
99
|
+
#
|
100
|
+
# @param [Sketchup::Entities] entities
|
101
|
+
#
|
102
|
+
# @param [Sketchup::Entity] entity_id
|
103
|
+
# The id of the entity that was
|
104
|
+
# deleted/removed.
|
105
|
+
#
|
106
|
+
# @return [nil]
|
107
|
+
#
|
108
|
+
# @version SketchUp 6.0
|
109
|
+
def onElementRemoved(entities, entity_id)
|
110
|
+
end
|
111
|
+
|
112
|
+
# The {#onEraseEntities} method is invoked when one or more entities are erased.
|
113
|
+
#
|
114
|
+
# @example
|
115
|
+
# def onEraseEntities(entities)
|
116
|
+
# puts "onEraseEntities: #{entities}"
|
117
|
+
# end
|
118
|
+
#
|
119
|
+
# @param [Sketchup::Entities] entities
|
120
|
+
#
|
121
|
+
# @return [nil]
|
122
|
+
#
|
123
|
+
# @version SketchUp 6.0
|
124
|
+
def onEraseEntities(entities)
|
125
|
+
end
|
126
|
+
|
127
|
+
end
|
@@ -1,544 +1,545 @@
|
|
1
|
-
# Copyright:: Copyright 2020 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
|
-
# @return
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
#
|
81
|
-
#
|
82
|
-
#
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
#
|
88
|
-
#
|
89
|
-
#
|
90
|
-
#
|
91
|
-
#
|
92
|
-
#
|
93
|
-
#
|
94
|
-
#
|
95
|
-
# pts = []
|
96
|
-
# pts[
|
97
|
-
# pts[
|
98
|
-
# pts[
|
99
|
-
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
#
|
103
|
-
#
|
104
|
-
# #
|
105
|
-
#
|
106
|
-
#
|
107
|
-
#
|
108
|
-
#
|
109
|
-
#
|
110
|
-
#
|
111
|
-
#
|
112
|
-
#
|
113
|
-
#
|
114
|
-
#
|
115
|
-
#
|
116
|
-
#
|
117
|
-
#
|
118
|
-
#
|
119
|
-
#
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
#
|
125
|
-
#
|
126
|
-
#
|
127
|
-
#
|
128
|
-
#
|
129
|
-
#
|
130
|
-
#
|
131
|
-
#
|
132
|
-
#
|
133
|
-
#
|
134
|
-
#
|
135
|
-
#
|
136
|
-
#
|
137
|
-
# pts = []
|
138
|
-
# pts[
|
139
|
-
# pts[
|
140
|
-
# pts[
|
141
|
-
#
|
142
|
-
#
|
143
|
-
#
|
144
|
-
#
|
145
|
-
# #
|
146
|
-
#
|
147
|
-
#
|
148
|
-
# status = entity1.
|
149
|
-
#
|
150
|
-
#
|
151
|
-
#
|
152
|
-
# The
|
153
|
-
# The
|
154
|
-
#
|
155
|
-
#
|
156
|
-
#
|
157
|
-
#
|
158
|
-
# @
|
159
|
-
#
|
160
|
-
#
|
161
|
-
#
|
162
|
-
#
|
163
|
-
# @param
|
164
|
-
# @
|
165
|
-
#
|
166
|
-
#
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
#
|
172
|
-
#
|
173
|
-
#
|
174
|
-
#
|
175
|
-
#
|
176
|
-
#
|
177
|
-
#
|
178
|
-
#
|
179
|
-
# pts = []
|
180
|
-
# pts[
|
181
|
-
# pts[
|
182
|
-
# pts[
|
183
|
-
#
|
184
|
-
#
|
185
|
-
#
|
186
|
-
#
|
187
|
-
#
|
188
|
-
#
|
189
|
-
#
|
190
|
-
#
|
191
|
-
#
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
#
|
197
|
-
#
|
198
|
-
#
|
199
|
-
#
|
200
|
-
#
|
201
|
-
#
|
202
|
-
#
|
203
|
-
#
|
204
|
-
#
|
205
|
-
# pts = []
|
206
|
-
# pts[
|
207
|
-
# pts[
|
208
|
-
# pts[
|
209
|
-
#
|
210
|
-
#
|
211
|
-
#
|
212
|
-
#
|
213
|
-
#
|
214
|
-
#
|
215
|
-
#
|
216
|
-
#
|
217
|
-
#
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
#
|
223
|
-
#
|
224
|
-
#
|
225
|
-
#
|
226
|
-
#
|
227
|
-
#
|
228
|
-
#
|
229
|
-
#
|
230
|
-
#
|
231
|
-
#
|
232
|
-
#
|
233
|
-
#
|
234
|
-
#
|
235
|
-
#
|
236
|
-
#
|
237
|
-
# #
|
238
|
-
#
|
239
|
-
#
|
240
|
-
#
|
241
|
-
#
|
242
|
-
#
|
243
|
-
#
|
244
|
-
#
|
245
|
-
#
|
246
|
-
#
|
247
|
-
#
|
248
|
-
#
|
249
|
-
#
|
250
|
-
#
|
251
|
-
#
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
#
|
257
|
-
#
|
258
|
-
#
|
259
|
-
#
|
260
|
-
#
|
261
|
-
#
|
262
|
-
#
|
263
|
-
# pts = []
|
264
|
-
# pts[
|
265
|
-
# pts[
|
266
|
-
# pts[
|
267
|
-
#
|
268
|
-
#
|
269
|
-
#
|
270
|
-
#
|
271
|
-
#
|
272
|
-
# #
|
273
|
-
#
|
274
|
-
#
|
275
|
-
#
|
276
|
-
#
|
277
|
-
#
|
278
|
-
#
|
279
|
-
#
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
#
|
285
|
-
#
|
286
|
-
#
|
287
|
-
#
|
288
|
-
#
|
289
|
-
#
|
290
|
-
#
|
291
|
-
# pts = []
|
292
|
-
# pts[
|
293
|
-
# pts[
|
294
|
-
# pts[
|
295
|
-
#
|
296
|
-
#
|
297
|
-
#
|
298
|
-
#
|
299
|
-
#
|
300
|
-
# #
|
301
|
-
#
|
302
|
-
#
|
303
|
-
#
|
304
|
-
#
|
305
|
-
#
|
306
|
-
#
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
#
|
312
|
-
#
|
313
|
-
#
|
314
|
-
#
|
315
|
-
#
|
316
|
-
#
|
317
|
-
#
|
318
|
-
#
|
319
|
-
#
|
320
|
-
#
|
321
|
-
# pts = []
|
322
|
-
# pts[
|
323
|
-
# pts[
|
324
|
-
# pts[
|
325
|
-
#
|
326
|
-
#
|
327
|
-
#
|
328
|
-
#
|
329
|
-
#
|
330
|
-
# #
|
331
|
-
#
|
332
|
-
#
|
333
|
-
#
|
334
|
-
#
|
335
|
-
#
|
336
|
-
#
|
337
|
-
#
|
338
|
-
|
339
|
-
|
340
|
-
|
341
|
-
|
342
|
-
#
|
343
|
-
#
|
344
|
-
#
|
345
|
-
#
|
346
|
-
#
|
347
|
-
#
|
348
|
-
# - {Sketchup::
|
349
|
-
# - {Sketchup::
|
350
|
-
#
|
351
|
-
#
|
352
|
-
# - {Sketchup::
|
353
|
-
#
|
354
|
-
#
|
355
|
-
#
|
356
|
-
#
|
357
|
-
# - {Sketchup::
|
358
|
-
# - {Sketchup::
|
359
|
-
# - {Sketchup::
|
360
|
-
# - {Sketchup::
|
361
|
-
# - {Sketchup::
|
362
|
-
# - {Sketchup::
|
363
|
-
# - {Sketchup::
|
364
|
-
# - {Sketchup::
|
365
|
-
# - {Sketchup::
|
366
|
-
# - {Sketchup::
|
367
|
-
# - {Sketchup::
|
368
|
-
# - {Sketchup::
|
369
|
-
#
|
370
|
-
#
|
371
|
-
#
|
372
|
-
#
|
373
|
-
#
|
374
|
-
#
|
375
|
-
#
|
376
|
-
#
|
377
|
-
# Geom::Point3d.new(
|
378
|
-
# Geom::Point3d.new(9,
|
379
|
-
# Geom::Point3d.new(
|
380
|
-
#
|
381
|
-
#
|
382
|
-
#
|
383
|
-
#
|
384
|
-
#
|
385
|
-
#
|
386
|
-
#
|
387
|
-
#
|
388
|
-
#
|
389
|
-
#
|
390
|
-
#
|
391
|
-
#
|
392
|
-
#
|
393
|
-
#
|
394
|
-
#
|
395
|
-
#
|
396
|
-
|
397
|
-
|
398
|
-
|
399
|
-
|
400
|
-
#
|
401
|
-
#
|
402
|
-
#
|
403
|
-
#
|
404
|
-
# entity
|
405
|
-
#
|
406
|
-
#
|
407
|
-
#
|
408
|
-
#
|
409
|
-
#
|
410
|
-
#
|
411
|
-
#
|
412
|
-
#
|
413
|
-
#
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
#
|
419
|
-
#
|
420
|
-
#
|
421
|
-
#
|
422
|
-
#
|
423
|
-
#
|
424
|
-
#
|
425
|
-
#
|
426
|
-
#
|
427
|
-
#
|
428
|
-
#
|
429
|
-
#
|
430
|
-
#
|
431
|
-
#
|
432
|
-
# pts = []
|
433
|
-
# pts[
|
434
|
-
# pts[
|
435
|
-
# pts[
|
436
|
-
#
|
437
|
-
#
|
438
|
-
#
|
439
|
-
#
|
440
|
-
#
|
441
|
-
# #
|
442
|
-
#
|
443
|
-
#
|
444
|
-
#
|
445
|
-
#
|
446
|
-
#
|
447
|
-
#
|
448
|
-
#
|
449
|
-
#
|
450
|
-
#
|
451
|
-
#
|
452
|
-
#
|
453
|
-
#
|
454
|
-
#
|
455
|
-
#
|
456
|
-
#
|
457
|
-
|
458
|
-
|
459
|
-
|
460
|
-
|
461
|
-
#
|
462
|
-
#
|
463
|
-
#
|
464
|
-
#
|
465
|
-
#
|
466
|
-
#
|
467
|
-
#
|
468
|
-
# pts = []
|
469
|
-
# pts[
|
470
|
-
# pts[
|
471
|
-
# pts[
|
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
|
-
# pts = []
|
498
|
-
# pts[
|
499
|
-
# pts[
|
500
|
-
# pts[
|
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
|
-
# pts
|
529
|
-
# pts[
|
530
|
-
# pts[
|
531
|
-
# pts[
|
532
|
-
#
|
533
|
-
#
|
534
|
-
# face
|
535
|
-
#
|
536
|
-
#
|
537
|
-
#
|
538
|
-
#
|
539
|
-
#
|
540
|
-
#
|
541
|
-
|
542
|
-
|
543
|
-
|
544
|
-
|
1
|
+
# Copyright:: Copyright 2020 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
|