sketchup-api-stubs 0.7.0 → 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.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +2 -0
  3. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +14 -10
  4. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +4 -4
  5. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +4 -4
  6. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +4 -5
  7. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +17 -17
  8. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +6 -0
  9. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +1 -2
  10. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +3 -3
  11. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +4 -0
  12. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +6 -13
  13. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +60 -4
  14. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +6 -13
  15. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +188 -0
  16. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +8 -3
  17. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +1 -2
  18. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +6 -13
  19. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +5 -1
  20. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +6 -13
  21. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +147 -4
  22. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +4 -0
  23. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +3 -3
  24. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +2 -2
  25. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +5 -0
  26. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +31 -57
  27. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +109 -208
  28. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +23 -10
  29. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +22 -7
  30. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +23 -12
  31. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +15 -8
  32. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +60 -27
  33. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +5 -3
  34. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +5 -3
  35. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +2 -8
  36. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +4 -0
  37. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +9 -3
  38. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +7 -13
  39. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +54 -25
  40. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +5 -3
  41. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +19 -14
  42. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +5 -4
  43. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +8 -7
  44. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +8 -7
  45. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +46 -44
  46. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +8 -0
  47. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +46 -6
  48. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +10 -11
  49. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +32 -20
  50. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +5 -3
  51. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +4 -1
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +112 -69
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -0
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +224 -28
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +117 -4
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +1 -12
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +7 -9
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +14 -7
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +5 -4
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +8 -10
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +122 -72
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +4 -3
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +1 -2
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +6 -6
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +3 -3
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +142 -39
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +21 -11
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +5 -4
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +36 -14
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +4 -3
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +9 -4
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +19 -19
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +4 -4
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +5 -3
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -0
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +8 -2
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +13 -21
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +30 -24
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +1 -1
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +5 -3
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +31 -21
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +72 -66
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +5 -3
  84. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +12 -5
  85. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +34 -3
  86. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +36 -10
  87. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +2 -2
  88. data/lib/sketchup-api-stubs/stubs/_top_level.rb +2 -0
  89. data/lib/sketchup-api-stubs/stubs/geom.rb +3 -0
  90. data/lib/sketchup-api-stubs/stubs/sketchup.rb +54 -22
  91. data/lib/sketchup-api-stubs/stubs/ui.rb +9 -8
  92. metadata +4 -16
@@ -2,9 +2,11 @@
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # This observer interface is implemented to react to events on a definitions
5
- # collection. To implement this observer, create a Ruby class of this type,
6
- # override the desired methods, and add an instance of the observer to the
7
- # collection of interest.
5
+ # collection.
6
+ #
7
+ # @abstract To implement this observer, create a Ruby class of this type,
8
+ # override the desired methods, and add an instance of the observer to the
9
+ # collection of interest.
8
10
  #
9
11
  # @example
10
12
  # class MyDefinitionsObserver < Sketchup::DefinitionsObserver
@@ -168,17 +168,11 @@ class Sketchup::DimensionLinear < Sketchup::Dimension
168
168
  #
169
169
  # @example
170
170
  # dim.offset_vector = Geom::Vector3d.new(0, 0, 10)
171
- # # or
172
- # dim.offset_vector = [0, 0, 10]
173
171
  #
174
- # @param vec
175
- # the offset vector to be set, either a Vector3d or in
176
- # array form.
177
- #
178
- # @return the offset vector that was set
172
+ # @param [Geom::Vector3d] offset_vector
179
173
  #
180
174
  # @version SketchUp 2014
181
- def offset_vector=(vec)
175
+ def offset_vector=(offset_vector)
182
176
  end
183
177
 
184
178
  # The start method returns the point or entity the dimension is referencing at
@@ -3,6 +3,10 @@
3
3
 
4
4
  # This observer interface is implemented to react to changes in dimension text.
5
5
  #
6
+ # @abstract To implement this observer, create a Ruby class of this type,
7
+ # override the desired methods, and add an instance of the observer to the
8
+ # dimensions of interest.
9
+ #
6
10
  # @example
7
11
  # # This is an example of a DimensionObserver
8
12
  # class MyDimensionObserver < Sketchup::DimensionObserver
@@ -11,8 +11,14 @@ class Sketchup::Drawingelement < Sketchup::Entity
11
11
 
12
12
  # Instance Methods
13
13
 
14
- # The bounds method is used to retrieve the BoundingBox for an drawing
15
- # element.
14
+ # The {#bounds} method is used to retrieve the {Geom::BoundingBox} bounding a
15
+ # {Sketchup::Drawingelement}.
16
+ #
17
+ # For a {Sketchup::Edge}, {Sketchup::ComponentInstance} and most other
18
+ # {Sketchup::Drawingelement}s, the boundingbox follows the coordinate system
19
+ # the drawing element is placed in.
20
+ # For {Sketchup::ComponentDefinition}, the box bounds the contents of the
21
+ # component and follows the component's own internal coordinate system.
16
22
  #
17
23
  # @example
18
24
  # depth = 100
@@ -31,7 +37,7 @@ class Sketchup::Drawingelement < Sketchup::Entity
31
37
  # # is a sub-class of Drawingelement.
32
38
  # boundingbox = face.bounds
33
39
  #
34
- # @return [Geom::BoundingBox] A BoundingBox object if successful
40
+ # @return [Geom::BoundingBox]
35
41
  #
36
42
  # @version SketchUp 6.0
37
43
  def bounds
@@ -155,20 +155,13 @@ class Sketchup::Edge < Sketchup::Drawingelement
155
155
  def explode_curve
156
156
  end
157
157
 
158
- # The faces method is used to retrieve all of the faces common to the edge.
158
+ # The {#faces} method is used to retrieve all of the faces common to the edge.
159
159
  #
160
160
  # @example
161
- # edge = Sketchup.active_model.entities.add_line([0,0,0],[100,100,0])
161
+ # edge = Sketchup.active_model.entities.add_line([0, 0, 0], [100, 100, 0])
162
162
  # faces = edge.faces
163
- # if (faces)
164
- # # Display the pointer to the first face returned in the array
165
- # UI.messagebox faces[0]
166
- # else
167
- # UI.messagebox "Failure: No Faces Found"
168
- # end
169
163
  #
170
- # @return [Array<Sketchup::Face>] an array of Face objects if successful, false
171
- # if unsuccessful
164
+ # @return [Array<Sketchup::Face>]
172
165
  #
173
166
  # @version SketchUp 6.0
174
167
  def faces
@@ -229,8 +222,9 @@ class Sketchup::Edge < Sketchup::Drawingelement
229
222
  #
230
223
  # @overload length(transform)
231
224
  #
232
- # @param transform [Geom::Transformation] A Transformation object or array
233
- # that can be interpreted as a Transformation object.
225
+ # @param [Geom::Transformation] transform
226
+ # A Transformation object or array that can be interpreted as a
227
+ # Transformation object.
234
228
  # @return [Length] the length of the edge
235
229
  #
236
230
  # @version SketchUp 6.0
@@ -416,7 +410,7 @@ class Sketchup::Edge < Sketchup::Drawingelement
416
410
  def soft?
417
411
  end
418
412
 
419
- # The split method is used to to split an edge into to or more distinct
413
+ # The split method is used to to split an edge into two or more distinct
420
414
  # edges. If a Point3d is given, it must be a point that is on the Edge.
421
415
  #
422
416
  # If a Float is given, it is a number between 0 and 1 that gives the
@@ -1,8 +1,9 @@
1
1
  # Copyright:: Copyright 2020 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
- # The Entities class is a container class for all entities in a model (it is a
5
- # collection of Entity objects).
4
+ # The {Sketchup::Entities} class is a collection of Entity objects, either in a
5
+ # {Sketchup::ComponentDefinition} or directly in the {Sketchup::Model}. A
6
+ # {Sketchup::Entities} object corresponds to a drawing context in the GUI.
6
7
  #
7
8
  # @version SketchUp 6.0
8
9
  class Sketchup::Entities
@@ -540,8 +541,8 @@ class Sketchup::Entities
540
541
  # UI.messagebox "Failure"
541
542
  # end
542
543
  #
543
- # @param [String] filename
544
- # A filename for the image file.
544
+ # @param [String] path
545
+ # A path for the image file.
545
546
  #
546
547
  # @param [Geom::Point3d] point
547
548
  # A Point3d object representing the insertion point of
@@ -558,7 +559,7 @@ class Sketchup::Entities
558
559
  # @return [Sketchup::Image, nil] an Image object if successful.
559
560
  #
560
561
  # @version SketchUp 6.0
561
- def add_image(filename, point, width, height = 0.0)
562
+ def add_image(path, point, width, height = 0.0)
562
563
  end
563
564
 
564
565
  # The add_instance method adds a component instance to the collection of
@@ -806,8 +807,8 @@ class Sketchup::Entities
806
807
  def count
807
808
  end
808
809
 
809
- # The each method is used to iterate through the entities in the collection of
810
- # entities.
810
+ # The {#each} method is used to iterate through the entities in the collection
811
+ # of entities.
811
812
  #
812
813
  # @example
813
814
  # coordinates = [10, 10, 10]
@@ -815,7 +816,12 @@ class Sketchup::Entities
815
816
  # entities = model.entities
816
817
  # point = Geom::Point3d.new coordinates
817
818
  # text = entities.add_text "This is a Test", point
818
- # entities.each { | entity| UI.messagebox entity }
819
+ # entities.each { | entity| puts entity }
820
+ #
821
+ # @note Don't remove content from this collection while iterating over it with
822
+ # {#each}. This would change the size of the collection and cause elements to
823
+ # be skipped as the indices change. Instead copy the current collection to an
824
+ # array using +to_a+ and then use +each+ on the array, when removing content.
819
825
  #
820
826
  # @return [nil]
821
827
  #
@@ -1045,8 +1051,15 @@ class Sketchup::Entities
1045
1051
  # sub-entities all at once.
1046
1052
  #
1047
1053
  # @example
1048
- # # Need better Ruby example.
1049
- # entities = entities.transform_by_vectors sub_entities, vector_array
1054
+ # # Raise vertices in selection by their distance to the origin.
1055
+ # model = Sketchup.active_model
1056
+ # entities = model.active_entities
1057
+ # with_vertices = entities.select { |entity| entity.respond_to?(:vertices) }
1058
+ # vertices = with_vertices.flat_map(&:vertices).uniq
1059
+ # lengths = vertices.map { |vertex| vertex.position.distance(ORIGIN) }
1060
+ # vectors = lengths.map { |length| Geom::Vector3d.new(0, 0, length) }
1061
+ #
1062
+ # entities.transform_by_vectors(vertices, vectors)
1050
1063
  #
1051
1064
  # @param [Array<Sketchup::Entity>] sub_entities
1052
1065
  # An array of entities to transform.
@@ -1063,24 +1076,18 @@ class Sketchup::Entities
1063
1076
  # The transform_entities method is used to apply a transform to several
1064
1077
  # sub-entities all at once.
1065
1078
  #
1066
- # Important note: If you apply a transformation to entities that are
1067
- # not in the current edit context (i.e. faces that are inside a group),
1068
- # SketchUp will apply the transformation incorrectly, since the geometry
1069
- # has one origin and the current edit context has another. You can correct
1070
- # for this by watching the Model.edit_transform and Model.active_path. See
1071
- # ModelObserver.onActivePathChanged for more information.
1079
+ # If you are transforming entities in the active drawing context or any of its
1080
+ # parent drawing contexts, the transformation will be interpreted as relative
1081
+ # to the global coordinate system. Otherwise the transformation will be
1082
+ # interpreted as being on the local coordinate system.
1072
1083
  #
1073
1084
  # @example
1074
1085
  # entities = Sketchup.active_model.entities
1075
- # entities.add_line([0,0,0],[100,100,100])
1076
- # entities.add_line([0,0,0],[200,-10,-10])
1077
- #
1078
- # entities_to_transform = []
1079
- # entities_to_transform.push(entities[0])
1080
- # entities_to_transform.push(entities[1])
1086
+ # entity1 = entities.add_line([0,0,0],[100,100,100])
1087
+ # entity2 = entities.add_line([0,0,0],[200,-10,-10])
1081
1088
  #
1082
- # transform = Geom::Transformation.new([100,0,0])
1083
- # entities.transform_entities(transform, ent1, ent2, ent3)
1089
+ # transformation = Geom::Transformation.new([100,0,0])
1090
+ # entities.transform_entities(transformation, [entity1, entity2])
1084
1091
  #
1085
1092
  # @param [Geom::Transformation] transform
1086
1093
  # The Transformation to apply.
@@ -1088,10 +1095,32 @@ class Sketchup::Entities
1088
1095
  # @param [Array<Sketchup::Entity>] entities
1089
1096
  # An array or series of entities to transform.
1090
1097
  #
1091
- # @return [Boolean] results of the transform.
1098
+ # @return [Boolean] +false+ if the entities array was empty.
1092
1099
  #
1093
1100
  # @version SketchUp 6.0
1094
1101
  def transform_entities(transform, entities)
1095
1102
  end
1096
1103
 
1104
+ # The {#weld} method takes a set of edges and find all possible chains of edges
1105
+ # and connect them with a {Sketchup::Curve}.
1106
+ #
1107
+ # A curve will not cross another curve. They will split where multiple curves
1108
+ # meet.
1109
+ #
1110
+ # @example
1111
+ # model = Sketchup.active_model
1112
+ # edges = model.selection.grep(Sketchup::Edge)
1113
+ # curves = model.active_entities.weld(edges)
1114
+ #
1115
+ # @param [Array<Sketchup::Edge>] edges
1116
+ #
1117
+ # @raise [ArgumentError] if the given entities are not part of the same
1118
+ # {Sketchup::Entities} collection.
1119
+ #
1120
+ # @return [Array<Sketchup::Curve>]
1121
+ #
1122
+ # @version SketchUp 2020.1
1123
+ def weld(edges)
1124
+ end
1125
+
1097
1126
  end
@@ -2,9 +2,11 @@
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # This observer interface is implemented to react to {Sketchup::Entities}
5
- # collection events. To implement this observer, create a Ruby class of this
6
- # type, override the desired methods, and add an instance of the observer to
7
- # the objects of interests.
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.
8
10
  #
9
11
  # @example
10
12
  # # This is an example of an observer that watches the entities collection
@@ -73,12 +73,11 @@ class Sketchup::Entity
73
73
  # status = entity1.set_attribute "testdictionary", "test", 115
74
74
  # attrdicts = entity1.attribute_dictionaries
75
75
  #
76
- # @return [Sketchup::AttributeDictionaries, nil] the AttributeDictionaries
77
- # object associated with the entity, or nil if there are
78
- # no attribute_dictionary objects associated with the
79
- # model. Care must be taken if nil is returned, for
80
- # example: invoking attribute_dictionaries.length will
81
- # throw a NoMethodError exception, not return 0.
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]
82
81
  #
83
82
  # @version SketchUp 6.0
84
83
  def attribute_dictionaries
@@ -155,14 +154,14 @@ class Sketchup::Entity
155
154
  #
156
155
  # @overload delete_attribute(dictionary_name)
157
156
  #
158
- # @param dictionary_name [String] The name of an attribute dictionary.
159
- # @return [Boolean]
157
+ # @param [String] dictionary_name The name of an attribute dictionary.
158
+ # @return [Boolean]
160
159
  #
161
160
  # @overload delete_attribute(dictionary_name, key)
162
161
  #
163
- # @param dictionary_name [String] The name of an attribute dictionary.
164
- # @param key [String] An attribute key.
165
- # @return [Boolean]
162
+ # @param [String] dictionary_name The name of an attribute dictionary.
163
+ # @param [String] key An attribute key.
164
+ # @return [Boolean]
166
165
  #
167
166
  # @version SketchUp 6.0
168
167
  def delete_attribute(*args)
@@ -344,6 +343,10 @@ class Sketchup::Entity
344
343
  #
345
344
  # The persistent id persistent between sessions.
346
345
  #
346
+ # [SketchUp 2020.1]
347
+ # - {Sketchup::ComponentDefinition}
348
+ # - {Sketchup::Material}
349
+ # - {Sketchup::Style}
347
350
  # [SketchUp 2020.0]
348
351
  # - {Sketchup::Layer}
349
352
  # - {Sketchup::LineStyle}
@@ -504,16 +507,18 @@ class Sketchup::Entity
504
507
  # entity1 = entities[1]
505
508
  # type = entity1.typename
506
509
  #
510
+ # @note Prefer +is_a?+ over +typename+ when possible as it is faster.
511
+ #
507
512
  # @return [String] the type of the entity
508
513
  #
509
514
  # @version SketchUp 6.0
510
515
  def typename
511
516
  end
512
517
 
513
- # The valid? method is used to determine if your entity is still valid (not
514
- # deleted by another script, for example.)
518
+ # The {#valid?} method is used to determine if your entity is still valid (not
519
+ # deleted by another script, for example).
515
520
  #
516
- # This method is functionally identical to the deleted? method.
521
+ # This method is functionally the inverse to the {#deleted?} method.
517
522
  #
518
523
  # @example
519
524
  # depth = 100
@@ -1,10 +1,11 @@
1
1
  # Copyright:: Copyright 2020 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
- # This observer interface is implemented to react to entity events. To
5
- # implement this observer, create a Ruby class of this type, override the
6
- # desired methods, and add an instance of the observer to the entity of
7
- # interests.
4
+ # This observer interface is implemented to react to entity events.
5
+ #
6
+ # @abstract To implement this observer, create a Ruby class of this type, override the
7
+ # desired methods, and add an instance of the observer to the entity of
8
+ # interests.
8
9
  #
9
10
  # @example
10
11
  # class MyEntityObserver < Sketchup::EntityObserver
@@ -21,11 +21,11 @@ class Sketchup::ExtensionsManager
21
21
  #
22
22
  # @example
23
23
  # manager = Sketchup.extensions
24
- # extension = manager[0]
24
+ # extension = manager[1]
25
25
  # if (extension)
26
- # UI.messagebox extension.name
26
+ # puts extension.name
27
27
  # else
28
- # UI.messagebox "Failure"
28
+ # puts "No Extensions installed"
29
29
  # end
30
30
  #
31
31
  # # You can also get extensions by name.
@@ -34,11 +34,12 @@ class Sketchup::ExtensionsManager
34
34
  # # You can also get extensions by ID.
35
35
  # my_extension = manager['2475A758-6503-46D5-AC5E-16AEA0A3162A']
36
36
  #
37
- # @param index_or_name
37
+ # @note Index starts at 1.
38
+ #
39
+ # @param [Integer, String] index_or_name
38
40
  # The index, name or ID of the SketchupExtension object.
39
41
  #
40
- # @return extension - an SketchupExtension object if
41
- # successful, otherwise nil.
42
+ # @return [SketchupExtension, nil]
42
43
  #
43
44
  # @version SketchUp 8.0 M2
44
45
  def [](index_or_name)
@@ -66,7 +67,7 @@ class Sketchup::ExtensionsManager
66
67
  # @example
67
68
  # manager = Sketchup.extensions
68
69
  # # Retrieves each extension
69
- # manager.each { |extension| UI.messagebox extension.name }
70
+ # manager.each { |extension| puts extension.name }
70
71
  #
71
72
  # @return nil
72
73
  #
@@ -41,7 +41,7 @@ class Sketchup::Face < Sketchup::Drawingelement
41
41
  def all_connected
42
42
  end
43
43
 
44
- # The area method is used to retrieve the area of a face in current units.
44
+ # The area method is used to retrieve the area of a face.
45
45
  #
46
46
  # You can pass in an optional Transformation (or an array that can represent a
47
47
  # transformation), to correct for a parent group's transformation. For example,
@@ -66,13 +66,14 @@ class Sketchup::Face < Sketchup::Drawingelement
66
66
  #
67
67
  # @overload area
68
68
  #
69
- # @return [Float] the area of the face in current units (if successful)
69
+ # @return [Float] the area of the face in square inches.
70
70
  #
71
71
  # @overload area(transform)
72
72
  #
73
- # @param transform [Geom::Transformation] A Transformation object or array
74
- # that can be interpreted as a Transformation object.
75
- # @return [Float] the area of the face in current units (if successful)
73
+ # @param [Geom::Transformation] transform
74
+ # A Transformation object or array that can be interpreted as a
75
+ # Transformation object.
76
+ # @return [Float] the area of the face in square inches.
76
77
  #
77
78
  # @version SketchUp 6.0
78
79
  def area(*args)
@@ -639,8 +640,8 @@ class Sketchup::Face < Sketchup::Drawingelement
639
640
  # face = entities.add_face(pts)
640
641
  # status = face.pushpull(100, true)
641
642
  #
642
- # @param [Numeric] distance
643
- # The distance, in current units, to push/pull the face.
643
+ # @param [Length] distance
644
+ # The distance to push/pull the face.
644
645
  #
645
646
  # @param [Boolean] copy
646
647
  # Create a new push/pull starting face if true (equivalent
@@ -3,13 +3,11 @@
3
3
 
4
4
  # A Group class contains methods for manipulating groups of entities.
5
5
  #
6
- # Groups in SketchUp are very similar to Components, except that there is no
7
- # instancing of groups. That means that you always will have one and only one
8
- # of each of your groups. (In the actual implementation, SketchUp keeps track
9
- # of groups as a special kind of Component that combines properties of
10
- # definitions and instances, which is why you will see deprecated methods
11
- # like Group.make_unique, and the class of observer you attach to Groups are
12
- # ComponentInstance observers.)
6
+ # Groups in SketchUp are very similar to components, but can from a user point
7
+ # of view be thought of as unique objects. Groups can be instanced when copied
8
+ # but are silently made unique when edited through the GUI. To honor this
9
+ # behavior, make sure to call {#make_unique} before modifying a group through
10
+ # the API.
13
11
  #
14
12
  # @version SketchUp 6.0
15
13
  class Sketchup::Group < Sketchup::Drawingelement
@@ -228,6 +226,8 @@ class Sketchup::Group < Sketchup::Drawingelement
228
226
  # group2 = entities[1]
229
227
  # result = group1.intersect(group2)
230
228
  #
229
+ # @note This method is not available in SketchUp Make.
230
+ #
231
231
  # @param [Sketchup::Group, Sketchup::ComponentInstance] group
232
232
  # The group to intersect this group with.
233
233
  #
@@ -239,11 +239,11 @@ class Sketchup::Group < Sketchup::Drawingelement
239
239
  def intersect(group)
240
240
  end
241
241
 
242
- # The local_bounds method returns the BoundingBox object that defines the size
243
- # of the group in an untransformed state. Useful for determining the original
244
- # width, height, and depth of a group regardless of its current position or
245
- # scale. For components, you can get a similar result by checking
246
- # my_instance.definition.bounds.
242
+ # The {#local_bounds} method is used to retrieve the {Geom::BoundingBox}
243
+ # bounding the contents of a {Sketchup::Group}, in the group's own internal
244
+ # coordinate system.
245
+ #
246
+ # @deprecated In favor of `group.definition.bounds`.
247
247
  #
248
248
  # @example
249
249
  # # Add a group to the model.
@@ -257,7 +257,7 @@ class Sketchup::Group < Sketchup::Drawingelement
257
257
  # group.transform! transformation
258
258
  # local_bounds_2 = group.local_bounds
259
259
  #
260
- # @return [Geom::BoundingBox] a BoundingBox object
260
+ # @return [Geom::BoundingBox]
261
261
  #
262
262
  # @version SketchUp 7.0
263
263
  def local_bounds
@@ -303,14 +303,14 @@ class Sketchup::Group < Sketchup::Drawingelement
303
303
  def locked?
304
304
  end
305
305
 
306
- # The make_unique method is used to force a group to have a unique definition.
306
+ # The {#make_unique} method is used to force a group to have a unique
307
+ # definition. If the group is already unique in the model, nothing happens.
307
308
  #
308
- # Copying a group using the copy tool in SketchUp will create copies of the
309
- # group that share a common definition until an instance is edited manually or
310
- # this method is used. If multiple copies are made, all copies share a
311
- # definition until all copies are edited manually, or all copies have this
312
- # method used on them. This method ensures that the group uses a unique
313
- # definition entry in the drawing database.
309
+ # Copying a group in SketchUp will create a group that shares the same
310
+ # definition. SketchUp implicitly makes group unique when edited from the GUI,
311
+ # and from a user point of view groups could be thought of as always being
312
+ # unique. To honor this behavior, call this method before editing a group
313
+ # through the API.
314
314
  #
315
315
  # @example
316
316
  # # Assume we have 2 groups, one copied from the other and sharing definitions
@@ -341,15 +341,16 @@ class Sketchup::Group < Sketchup::Drawingelement
341
341
  def manifold?
342
342
  end
343
343
 
344
- # The move! method is used to apply a transformation to the group.
344
+ # The {#move!} method is used to set the transformation of this group
345
+ # instance, similarly to {#transformation=} but without recording to the undo
346
+ # stack.
345
347
  #
346
- # This method is the same as the transform! method except that it does not
347
- # record the move in an undo operation. This method is useful for
348
- # transparently moving things during an animation.
348
+ # This method is useful for moving entities inside of an animation or page
349
+ # transition.
349
350
  #
350
351
  # @example
351
352
  # point = Geom::Point3d.new 500,500,500
352
- # t = Geom::Transformation.new point
353
+ # transformation = Geom::Transformation.new point
353
354
  # depth = 100
354
355
  # width = 100
355
356
  # model = Sketchup.active_model
@@ -369,21 +370,17 @@ class Sketchup::Group < Sketchup::Drawingelement
369
370
  # # Add a face to within the group
370
371
  # face = entities2.add_face pts
371
372
  # UI.messagebox "Group before Move"
372
- # group = group.move! t
373
- # if (group)
374
- # UI.messagebox "Group after move"
375
- # UI.messagebox group
376
- # else
377
- # UI.messagebox "Failure"
378
- # end
373
+ # group = group.move!(transformation)
379
374
  #
380
- # @param [Geom::Transformation] transform
381
- # A Transformation object.
375
+ # @note Despite the name being similar to {#transform!}, this method closer
376
+ # corresponds to {#transformation=}.
377
+ #
378
+ # @param [Geom::Transformation] transformation
382
379
  #
383
380
  # @return [Sketchup::Group] the transformed Group object if successful
384
381
  #
385
382
  # @version SketchUp 6.0
386
- def move!(transform)
383
+ def move!(transformation)
387
384
  end
388
385
 
389
386
  # The name method is used to retrieve the name of the group.
@@ -503,6 +500,8 @@ class Sketchup::Group < Sketchup::Drawingelement
503
500
  # group2 = entities[1]
504
501
  # result = group1.split(group2)
505
502
  #
503
+ # @note This method is not available in SketchUp Make.
504
+ #
506
505
  # @param [Sketchup::Group, Sketchup::ComponentInstance] group
507
506
  # The group to split this group with.
508
507
  #
@@ -528,6 +527,8 @@ class Sketchup::Group < Sketchup::Drawingelement
528
527
  # group2 = entities[1]
529
528
  # result = group1.subtract(group2)
530
529
  #
530
+ # @note This method is not available in SketchUp Make.
531
+ #
531
532
  # @param [Sketchup::Group, Sketchup::ComponentInstance] group
532
533
  # The group to subtract this group from.
533
534
  #
@@ -613,24 +614,21 @@ class Sketchup::Group < Sketchup::Drawingelement
613
614
  def transformation
614
615
  end
615
616
 
616
- # The transformation= method is used to set the transformation for the
617
- # group.
617
+ # The {#transformation=} method is used to set the transformation of this
618
+ # group
618
619
  #
619
620
  # @example
620
621
  # # Add a group to the model.
621
622
  # group = Sketchup.active_model.entities.add_group
622
623
  # group.entities.add_line([0,0,0],[100,100,100])
623
624
  #
624
- # new_transform = Geom::Transformation.new([100,0,0])
625
- # group.transformation = new_transform
625
+ # new_transformation = Geom::Transformation.new([100,0,0])
626
+ # group.transformation = new_transformation
626
627
  #
627
- # @param [Geom::Transformation] transform
628
- # The Transformation object to apply
629
- #
630
- # @return [Geom::Transformation] the applied transformation
628
+ # @param [Geom::Transformation] transformation
631
629
  #
632
630
  # @version SketchUp 6.0
633
- def transformation=(transform)
631
+ def transformation=(transformation)
634
632
  end
635
633
 
636
634
  # The trim method is used to compute the (non-destructive) boolean difference
@@ -644,6 +642,8 @@ class Sketchup::Group < Sketchup::Drawingelement
644
642
  # group2 = entities[1]
645
643
  # result = group1.trim(group2)
646
644
  #
645
+ # @note This method is not available in SketchUp Make.
646
+ #
647
647
  # @param [Sketchup::Group, Sketchup::ComponentInstance] group
648
648
  # The group to trim this group against.
649
649
  #
@@ -665,6 +665,8 @@ class Sketchup::Group < Sketchup::Drawingelement
665
665
  # group2 = entities[1]
666
666
  # result = group1.union(group2)
667
667
  #
668
+ # @note This method is not available in SketchUp Make.
669
+ #
668
670
  # @param [Sketchup::Group, Sketchup::ComponentInstance] group
669
671
  # The group to union this group with.
670
672
  #