sketchup-api-stubs 0.7.7 → 0.7.9

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 (154) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +151 -147
  3. data/lib/sketchup-api-stubs/stubs/{array.rb → Array.rb} +741 -741
  4. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
  5. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
  6. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
  7. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -400
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
  10. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +509 -509
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +476 -478
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
  13. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -522
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +693 -691
  16. data/lib/sketchup-api-stubs/stubs/{geom.rb → Geom.rb} +351 -351
  17. data/lib/sketchup-api-stubs/stubs/{languagehandler.rb → LanguageHandler.rb} +93 -92
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -573
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +747 -411
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -179
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +517 -515
  23. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  24. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
  26. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -349
  27. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
  28. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
  29. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
  30. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
  31. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
  32. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
  33. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
  34. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -567
  35. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
  36. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
  37. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
  38. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
  39. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
  40. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
  41. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
  42. data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -0
  43. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +692 -694
  44. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
  45. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  46. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  48. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  49. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  50. data/lib/sketchup-api-stubs/stubs/{length.rb → Length.rb} +278 -278
  51. data/lib/sketchup-api-stubs/stubs/{numeric.rb → Numeric.rb} +249 -249
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -144
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -157
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +150 -152
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -286
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -302
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -478
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -122
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +659 -577
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -594
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +449 -425
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +406 -396
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -502
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1239 -1126
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -0
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -545
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -126
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -917
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -104
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -750
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +282 -292
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +468 -468
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +406 -405
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -306
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -327
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -422
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -427
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -249
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -112
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -414
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +317 -318
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1652 -1654
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -357
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +130 -131
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -284
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +490 -0
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +116 -0
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -797
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +361 -363
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +478 -478
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +361 -364
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +458 -459
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +255 -257
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -217
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
  134. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -217
  135. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  136. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +834 -835
  137. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  138. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
  139. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -71
  140. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
  141. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1311 -1307
  142. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -45
  143. data/lib/sketchup-api-stubs/stubs/{sketchup.rb → Sketchup.rb} +1377 -1353
  144. data/lib/sketchup-api-stubs/stubs/{sketchupextension.rb → SketchupExtension.rb} +353 -353
  145. data/lib/sketchup-api-stubs/stubs/{string.rb → String.rb} +24 -24
  146. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -317
  147. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +494 -478
  148. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -269
  149. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +241 -240
  150. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -633
  151. data/lib/sketchup-api-stubs/stubs/{ui.rb → UI.rb} +683 -672
  152. data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -311
  153. data/lib/sketchup-api-stubs.rb +1 -1
  154. metadata +20 -16
@@ -1,468 +1,468 @@
1
- # Copyright:: Copyright 2021 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # An Image object represents a raster image placed in the Model.
5
- #
6
- # @example Create material from image (SU 2018 and later)
7
- # model = Sketchup.active_model
8
- # entities = model.active_entities
9
- # image = entities.grep(Sketchup::Image).first
10
- # img_rep = image.image_rep
11
- # material = model.materials.add("New Name")
12
- # material.texture = img_rep
13
- #
14
- # @version SketchUp 6.0
15
- class Sketchup::Image < Sketchup::Drawingelement
16
-
17
- # Instance Methods
18
-
19
- # The explode method is used to explode an image into a face with a texture
20
- # on it.
21
- #
22
- # Note that current versions of SketchUp will return an empty array here.
23
- # To work around this limitation you can iterate over your entities collection
24
- # to determine which new entities were created.
25
- #
26
- # Versions prior to SketchUp 2015 returned an empty array due to a bug.
27
- #
28
- # @example
29
- # model = Sketchup.active_model
30
- # path = "Plugins/su_dynamiccomponents/images"
31
- # image_file = Sketchup.find_support_file("report_tool.png", path)
32
- # image = model.active_entities.add_image(image_file, ORIGIN, 300)
33
- # entities = image.explode
34
- #
35
- # @return entitiesarray - an Array object of entities if
36
- # successful
37
- #
38
- # @version SketchUp 6.0
39
- def explode
40
- end
41
-
42
- # The {#glued_to} method is used to retrieve the entity that this image is
43
- # glued to.
44
- #
45
- # @example
46
- # point = Geom::Point3d.new(10, 20, 30)
47
- # transform = Geom::Transformation.new(point)
48
- # model = Sketchup.active_model
49
- # entities = model.active_entities
50
- # group = entities.add_group
51
- # group.entities.add_face([[0, 0, 0], [10, 0, 0], [10, 10, 0], [0, 10, 0]])
52
- # status = group.glued_to
53
- #
54
- # @return [Sketchup::Face, Sketchup::Group, Sketchup::ComponentInstance, Sketchup::Image, nil]
55
- #
56
- # @version SketchUp 2021.1
57
- def glued_to
58
- end
59
-
60
- # The {glued_to=} method glues this image to a drawing element.
61
- # When moving this other drawing elment with the Move tool, the image moves with it.
62
- #
63
- # @example
64
- # model = Sketchup.active_model
65
- # entities = model.active_entities
66
- #
67
- # # Create a face
68
- # face = entities.add_face([[0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0]])
69
- #
70
- # # Create a group
71
- # path = "Plugins/su_dynamiccomponents/images"
72
- # image_file = Sketchup.find_support_file("report_tool.png", path)
73
- # image = model.active_entities.add_image(image_file, ORIGIN, 300)
74
- #
75
- # # Glue the group to the face.
76
- # # If you now move the face, the group will follow.
77
- # image.glued_to = face
78
- #
79
- # @param [Sketchup::Face, Sketchup::Group, Sketchup::ComponentInstance, Sketchup::Image, nil] drawing_element
80
- #
81
- # @raise ArgumentError if this would lead to cyclic gluing.
82
- #
83
- # @return [Sketchup::Face, Sketchup::Group, Sketchup::ComponentInstance, Sketchup::Image, nil] the entity the group was glued to.
84
- #
85
- # @version SketchUp 2021.1
86
- def glued_to=(drawing_element)
87
- end
88
-
89
- # The height method is used to retrieve the height of the image.
90
- #
91
- # The height is given in inches.
92
- #
93
- # @example
94
- # model = Sketchup.active_model
95
- # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
96
- # pt = Geom::Point3d.new
97
- # entities = model.active_entities
98
- # image = entities.add_image path, pt, 300
99
- # height = image.height
100
- # if (height)
101
- # UI.messagebox height
102
- # else
103
- # UI.messagebox "Failure"
104
- # end
105
- #
106
- # @return height - the height of the model if successful
107
- #
108
- # @version SketchUp 6.0
109
- def height
110
- end
111
-
112
- # The height= method is used to set the height of the image.
113
- #
114
- # The height is set in inches.
115
- #
116
- # @example
117
- # model = Sketchup.active_model
118
- # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
119
- # pt = Geom::Point3d.new
120
- # entities = model.active_entities
121
- # image = entities.add_image path, pt, 300
122
- # UI.messagebox "Before adjustment"
123
- # height = image.height = 400
124
- # if (height)
125
- # UI.messagebox height
126
- # else
127
- # UI.messagebox "Failure"
128
- # end
129
- #
130
- # @param height
131
- # The height, in inches, to set the image.
132
- #
133
- # @return height - the new height if successful
134
- #
135
- # @version SketchUp 6.0
136
- def height=(height)
137
- end
138
-
139
- # The {#image_rep} method returns a copy of a {Sketchup::ImageRep} object
140
- # representing the pixel data.
141
- #
142
- # @bug Prior to SketchUp 2021.1, SketchUp crashes when the Image is corrupt and lacks image data.
143
- #
144
- # @example
145
- # model = Sketchup.active_model
146
- # path = "Plugins/su_dynamiccomponents/images"
147
- # image_file = Sketchup.find_support_file("report_tool.png", path)
148
- # image = model.active_entities.add_image(image_file, ORIGIN, 300)
149
- # image_rep = image.image_rep
150
- #
151
- # @raise ArgumentError if the Image is corrupt and lacks image data.
152
- #
153
- # @return [Sketchup::ImageRep]
154
- #
155
- # @version SketchUp 2018
156
- def image_rep
157
- end
158
-
159
- # The normal method is used to retrieve the 3D Vector that is perpendicular to
160
- # the plane of the image.
161
- #
162
- # @example
163
- # model = Sketchup.active_model
164
- # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
165
- # pt = Geom::Point3d.new
166
- # entities = model.active_entities
167
- # image = entities.add_image path, pt, 300
168
- # vector = image.normal
169
- # if (vector)
170
- # UI.messagebox vector
171
- # else
172
- # UI.messagebox "Failure"
173
- # end
174
- #
175
- # @return vector - a Vector3d object if successful
176
- #
177
- # @version SketchUp 6.0
178
- def normal
179
- end
180
-
181
- # The origin method is used to retrieve the 3D point that defines the origin
182
- # of the image.
183
- #
184
- # @example
185
- # model = Sketchup.active_model
186
- # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
187
- # pt = Geom::Point3d.new
188
- # entities = model.active_entities
189
- # image = entities.add_image path, pt, 300
190
- # origin = image.origin
191
- # if (origin)
192
- # UI.messagebox origin
193
- # else
194
- # UI.messagebox "Failure"
195
- # end
196
- #
197
- # @return point - a Point3d object containing the origin location
198
- # if successful
199
- #
200
- # @version SketchUp 6.0
201
- def origin
202
- end
203
-
204
- # The origin= method is used to set the 3D point as the origin of the image.
205
- #
206
- # @example
207
- # model = Sketchup.active_model
208
- # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
209
- # pt = Geom::Point3d.new
210
- # pt2 = Geom::Point3d.new 100,100,100
211
- # entities = model.active_entities
212
- # image = entities.add_image path, pt, 300
213
- # UI.messagebox "Before Move"
214
- # origin = image.origin=pt2
215
- # if (origin)
216
- # UI.messagebox origin
217
- # else
218
- # UI.messagebox "Failure"
219
- # end
220
- #
221
- # @param point
222
- # A Point3d object with the new origin.
223
- #
224
- # @return point - the Point3d object representing the newly
225
- # established origin if successful
226
- #
227
- # @version SketchUp 6.0
228
- def origin=(point)
229
- end
230
-
231
- # The path method is used to retrieve the path of the file defining the image.
232
- #
233
- # @example
234
- # model = Sketchup.active_model
235
- # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
236
- # pt = Geom::Point3d.new
237
- # entities = model.active_entities
238
- # image = entities.add_image path, pt, 300
239
- # path = image.path
240
- # if (path)
241
- # UI.messagebox path
242
- # else
243
- # UI.messagebox "Failure"
244
- # end
245
- #
246
- # @return path - the path for the image file if successful
247
- #
248
- # @version SketchUp 6.0
249
- def path
250
- end
251
-
252
- # The pixelheight method is used to retrieve the height of the image file in
253
- # pixels.
254
- #
255
- # @example
256
- # model = Sketchup.active_model
257
- # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
258
- # pt = Geom::Point3d.new
259
- # entities = model.active_entities
260
- # image = entities.add_image path, pt, 300
261
- # pixelheight = image.pixelheight
262
- # if (pixelheight)
263
- # UI.messagebox pixelheight
264
- # else
265
- # UI.messagebox "Failure"
266
- # end
267
- #
268
- # @return height - the height of the image in pixels if
269
- # successful
270
- #
271
- # @version SketchUp 6.0
272
- def pixelheight
273
- end
274
-
275
- # The pixelwidth method is used to retrieve the width of the image file in
276
- # pixels.
277
- #
278
- # @example
279
- # model = Sketchup.active_model
280
- # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
281
- # pt = Geom::Point3d.new
282
- # entities = model.active_entities
283
- # image = entities.add_image path, pt, 300
284
- # pixelwidth = image.pixelwidth
285
- # if (pixelwidth)
286
- # UI.messagebox pixelwidth
287
- # else
288
- # UI.messagebox "Failure"
289
- # end
290
- #
291
- # @return width - the width of the image in pixels if successful
292
- #
293
- # @version SketchUp 6.0
294
- def pixelwidth
295
- end
296
-
297
- # The size= method is used to set the width and height of the image, in inches.
298
- #
299
- # @example
300
- # model = Sketchup.active_model
301
- # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
302
- # pt = Geom::Point3d.new
303
- # entities = model.active_entities
304
- # image = entities.add_image path, pt, 300
305
- # UI.messagebox "Before Resize"
306
- # size = image.size= 500,500
307
- # if (size)
308
- # UI.messagebox size
309
- # else
310
- # UI.messagebox "Failure"
311
- # end
312
- #
313
- # @param width
314
- # The width of the image.
315
- #
316
- # @param height
317
- # The height of the image.
318
- #
319
- # @return size - the new width and height of the image if
320
- # successful
321
- #
322
- # @version SketchUp 6.0
323
- def size=(width, height)
324
- end
325
-
326
- # The transform! method is used to apply a transformation to the image.
327
- #
328
- # @example
329
- # model = Sketchup.active_model
330
- # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
331
- # point = Geom::Point3d.new 100,100,100
332
- # t = Geom::Transformation.new point
333
- # pt = Geom::Point3d.new
334
- # entities = model.active_entities
335
- # image = entities.add_image path, pt, 300
336
- # UI.messagebox "Before Move"
337
- # image = image.transform! t
338
- # if (image)
339
- # UI.messagebox image
340
- # else
341
- # UI.messagebox "Failure"
342
- # end
343
- #
344
- # @param transform
345
- # A Transformation object.
346
- #
347
- # @return image - the transformed Image object if successful
348
- #
349
- # @version SketchUp 6.0
350
- def transform!(transform)
351
- end
352
-
353
- # The transformation method is used to retrieve the transformation for the
354
- # image.
355
- #
356
- # @example
357
- # # Add an image to the model.
358
- # model = Sketchup.active_model
359
- # entities = model.active_entities
360
- # path = Sketchup.find_support_file('report_tool.png', 'Plugins/su_dynamiccomponents/images')
361
- # point = Geom::Point3d.new(100,100,100)
362
- # image = entities.add_image(path, point, 300)
363
- #
364
- # trans = image.transformation
365
- #
366
- # @return transformation - a Transformation object if successful
367
- #
368
- # @version SketchUp 2014
369
- def transformation
370
- end
371
-
372
- # The transformation= method is used to set the transformation for the
373
- # image.
374
- #
375
- # @example
376
- # # Add an image to the model.
377
- # model = Sketchup.active_model
378
- # entities = model.active_entities
379
- # path = Sketchup.find_support_file('report_tool.png', 'Plugins/su_dynamiccomponents/images')
380
- # point = Geom::Point3d.new(100,100,100)
381
- # image = entities.add_image(path, point, 300)
382
- #
383
- # new_transform = Geom::Transformation.new([100,0,0])
384
- # image.transformation = new_transform
385
- #
386
- # @param transform
387
- # The Transformation object to apply
388
- #
389
- # @return image - the newly transformed image
390
- #
391
- # @version SketchUp 2014
392
- def transformation=(transform)
393
- end
394
-
395
- # The width method is used to retrieve the width of the image.
396
- #
397
- # The width is given in inches.
398
- #
399
- # @example
400
- # model = Sketchup.active_model
401
- # path = Sketchup.find_support_file "report_tool.png",
402
- # "Tools/DynamicComponents/images"
403
- # pt = Geom::Point3d.new
404
- # entities = model.active_entities
405
- # image = entities.add_image path, pt, 300
406
- # width = image.width
407
- # if (width)
408
- # UI.messagebox width
409
- # else
410
- # UI.messagebox "Failure"
411
- # end
412
- #
413
- # @return width - the width of the image if successful
414
- #
415
- # @version SketchUp 6.0
416
- def width
417
- end
418
-
419
- # The width= method is used to set the width of the image.
420
- #
421
- # The width is set in inches.
422
- #
423
- # @example
424
- # model = Sketchup.active_model
425
- # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
426
- # pt = Geom::Point3d.new
427
- # entities = model.active_entities
428
- # image = entities.add_image path, pt, 300
429
- # UI.messagebox "Before adjustment"
430
- # width = image.width=400
431
- # if (width)
432
- # UI.messagebox width
433
- # else
434
- # UI.messagebox "Failure"
435
- # end
436
- #
437
- # @param width
438
- # The width, in inches, to set the image.
439
- #
440
- # @return width - the new width if successful
441
- #
442
- # @version SketchUp 6.0
443
- def width=(width)
444
- end
445
-
446
- # The zrotation method is used to get the angle that the image is rotated
447
- # about the normal vector from an arbitrary X axis.
448
- #
449
- # @example
450
- # model = Sketchup.active_model
451
- # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
452
- # pt = Geom::Point3d.new
453
- # entities = model.active_entities
454
- # image = entities.add_image path, pt, 300
455
- # zrotation = image.zrotation
456
- # if (zrotation)
457
- # UI.messagebox zrotation
458
- # else
459
- # UI.messagebox "Failure"
460
- # end
461
- #
462
- # @return vector - a Vector3d object if successful
463
- #
464
- # @version SketchUp 6.0
465
- def zrotation
466
- end
467
-
468
- end
1
+ # Copyright:: Copyright 2023 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # An Image object represents a raster image placed in the Model.
5
+ #
6
+ # @example Create material from image (SU 2018 and later)
7
+ # model = Sketchup.active_model
8
+ # entities = model.active_entities
9
+ # image = entities.grep(Sketchup::Image).first
10
+ # img_rep = image.image_rep
11
+ # material = model.materials.add("New Name")
12
+ # material.texture = img_rep
13
+ #
14
+ # @version SketchUp 6.0
15
+ class Sketchup::Image < Sketchup::Drawingelement
16
+
17
+ # Instance Methods
18
+
19
+ # The explode method is used to explode an image into a face with a texture
20
+ # on it.
21
+ #
22
+ # Note that current versions of SketchUp will return an empty array here.
23
+ # To work around this limitation you can iterate over your entities collection
24
+ # to determine which new entities were created.
25
+ #
26
+ # Versions prior to SketchUp 2015 returned an empty array due to a bug.
27
+ #
28
+ # @example
29
+ # model = Sketchup.active_model
30
+ # path = "Plugins/su_dynamiccomponents/images"
31
+ # image_file = Sketchup.find_support_file("report_tool.png", path)
32
+ # image = model.active_entities.add_image(image_file, ORIGIN, 300)
33
+ # entities = image.explode
34
+ #
35
+ # @return entitiesarray - an Array object of entities if
36
+ # successful
37
+ #
38
+ # @version SketchUp 6.0
39
+ def explode
40
+ end
41
+
42
+ # The {#glued_to} method is used to retrieve the entity that this image is
43
+ # glued to.
44
+ #
45
+ # @example
46
+ # point = Geom::Point3d.new(10, 20, 30)
47
+ # transform = Geom::Transformation.new(point)
48
+ # model = Sketchup.active_model
49
+ # entities = model.active_entities
50
+ # group = entities.add_group
51
+ # group.entities.add_face([[0, 0, 0], [10, 0, 0], [10, 10, 0], [0, 10, 0]])
52
+ # status = group.glued_to
53
+ #
54
+ # @return [Sketchup::Face, Sketchup::Group, Sketchup::ComponentInstance, Sketchup::Image, nil]
55
+ #
56
+ # @version SketchUp 2021.1
57
+ def glued_to
58
+ end
59
+
60
+ # The {glued_to=} method glues this image to a drawing element.
61
+ # When moving this other drawing elment with the Move tool, the image moves with it.
62
+ #
63
+ # @example
64
+ # model = Sketchup.active_model
65
+ # entities = model.active_entities
66
+ #
67
+ # # Create a face
68
+ # face = entities.add_face([[0, 0, 0], [100, 0, 0], [100, 100, 0], [0, 100, 0]])
69
+ #
70
+ # # Create a group
71
+ # path = "Plugins/su_dynamiccomponents/images"
72
+ # image_file = Sketchup.find_support_file("report_tool.png", path)
73
+ # image = model.active_entities.add_image(image_file, ORIGIN, 300)
74
+ #
75
+ # # Glue the group to the face.
76
+ # # If you now move the face, the group will follow.
77
+ # image.glued_to = face
78
+ #
79
+ # @param [Sketchup::Face, Sketchup::Group, Sketchup::ComponentInstance, Sketchup::Image, nil] drawing_element
80
+ #
81
+ # @raise ArgumentError if this would lead to cyclic gluing.
82
+ #
83
+ # @return [Sketchup::Face, Sketchup::Group, Sketchup::ComponentInstance, Sketchup::Image, nil] the entity the group was glued to.
84
+ #
85
+ # @version SketchUp 2021.1
86
+ def glued_to=(drawing_element)
87
+ end
88
+
89
+ # The height method is used to retrieve the height of the image.
90
+ #
91
+ # The height is given in inches.
92
+ #
93
+ # @example
94
+ # model = Sketchup.active_model
95
+ # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
96
+ # pt = Geom::Point3d.new
97
+ # entities = model.active_entities
98
+ # image = entities.add_image path, pt, 300
99
+ # height = image.height
100
+ # if (height)
101
+ # UI.messagebox height
102
+ # else
103
+ # UI.messagebox "Failure"
104
+ # end
105
+ #
106
+ # @return height - the height of the model if successful
107
+ #
108
+ # @version SketchUp 6.0
109
+ def height
110
+ end
111
+
112
+ # The height= method is used to set the height of the image.
113
+ #
114
+ # The height is set in inches.
115
+ #
116
+ # @example
117
+ # model = Sketchup.active_model
118
+ # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
119
+ # pt = Geom::Point3d.new
120
+ # entities = model.active_entities
121
+ # image = entities.add_image path, pt, 300
122
+ # UI.messagebox "Before adjustment"
123
+ # height = image.height = 400
124
+ # if (height)
125
+ # UI.messagebox height
126
+ # else
127
+ # UI.messagebox "Failure"
128
+ # end
129
+ #
130
+ # @param height
131
+ # The height, in inches, to set the image.
132
+ #
133
+ # @return height - the new height if successful
134
+ #
135
+ # @version SketchUp 6.0
136
+ def height=(height)
137
+ end
138
+
139
+ # The {#image_rep} method returns a copy of a {Sketchup::ImageRep} object
140
+ # representing the pixel data.
141
+ #
142
+ # @bug Prior to SketchUp 2021.1, SketchUp crashes when the Image is corrupt and lacks image data.
143
+ #
144
+ # @example
145
+ # model = Sketchup.active_model
146
+ # path = "Plugins/su_dynamiccomponents/images"
147
+ # image_file = Sketchup.find_support_file("report_tool.png", path)
148
+ # image = model.active_entities.add_image(image_file, ORIGIN, 300)
149
+ # image_rep = image.image_rep
150
+ #
151
+ # @raise ArgumentError if the Image is corrupt and lacks image data.
152
+ #
153
+ # @return [Sketchup::ImageRep]
154
+ #
155
+ # @version SketchUp 2018
156
+ def image_rep
157
+ end
158
+
159
+ # The normal method is used to retrieve the 3D Vector that is perpendicular to
160
+ # the plane of the image.
161
+ #
162
+ # @example
163
+ # model = Sketchup.active_model
164
+ # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
165
+ # pt = Geom::Point3d.new
166
+ # entities = model.active_entities
167
+ # image = entities.add_image path, pt, 300
168
+ # vector = image.normal
169
+ # if (vector)
170
+ # UI.messagebox vector
171
+ # else
172
+ # UI.messagebox "Failure"
173
+ # end
174
+ #
175
+ # @return vector - a Vector3d object if successful
176
+ #
177
+ # @version SketchUp 6.0
178
+ def normal
179
+ end
180
+
181
+ # The origin method is used to retrieve the 3D point that defines the origin
182
+ # of the image.
183
+ #
184
+ # @example
185
+ # model = Sketchup.active_model
186
+ # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
187
+ # pt = Geom::Point3d.new
188
+ # entities = model.active_entities
189
+ # image = entities.add_image path, pt, 300
190
+ # origin = image.origin
191
+ # if (origin)
192
+ # UI.messagebox origin
193
+ # else
194
+ # UI.messagebox "Failure"
195
+ # end
196
+ #
197
+ # @return point - a Point3d object containing the origin location
198
+ # if successful
199
+ #
200
+ # @version SketchUp 6.0
201
+ def origin
202
+ end
203
+
204
+ # The origin= method is used to set the 3D point as the origin of the image.
205
+ #
206
+ # @example
207
+ # model = Sketchup.active_model
208
+ # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
209
+ # pt = Geom::Point3d.new
210
+ # pt2 = Geom::Point3d.new 100,100,100
211
+ # entities = model.active_entities
212
+ # image = entities.add_image path, pt, 300
213
+ # UI.messagebox "Before Move"
214
+ # origin = image.origin=pt2
215
+ # if (origin)
216
+ # UI.messagebox origin
217
+ # else
218
+ # UI.messagebox "Failure"
219
+ # end
220
+ #
221
+ # @param point
222
+ # A Point3d object with the new origin.
223
+ #
224
+ # @return point - the Point3d object representing the newly
225
+ # established origin if successful
226
+ #
227
+ # @version SketchUp 6.0
228
+ def origin=(point)
229
+ end
230
+
231
+ # The path method is used to retrieve the path of the file defining the image.
232
+ #
233
+ # @example
234
+ # model = Sketchup.active_model
235
+ # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
236
+ # pt = Geom::Point3d.new
237
+ # entities = model.active_entities
238
+ # image = entities.add_image path, pt, 300
239
+ # path = image.path
240
+ # if (path)
241
+ # UI.messagebox path
242
+ # else
243
+ # UI.messagebox "Failure"
244
+ # end
245
+ #
246
+ # @return path - the path for the image file if successful
247
+ #
248
+ # @version SketchUp 6.0
249
+ def path
250
+ end
251
+
252
+ # The pixelheight method is used to retrieve the height of the image file in
253
+ # pixels.
254
+ #
255
+ # @example
256
+ # model = Sketchup.active_model
257
+ # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
258
+ # pt = Geom::Point3d.new
259
+ # entities = model.active_entities
260
+ # image = entities.add_image path, pt, 300
261
+ # pixelheight = image.pixelheight
262
+ # if (pixelheight)
263
+ # UI.messagebox pixelheight
264
+ # else
265
+ # UI.messagebox "Failure"
266
+ # end
267
+ #
268
+ # @return height - the height of the image in pixels if
269
+ # successful
270
+ #
271
+ # @version SketchUp 6.0
272
+ def pixelheight
273
+ end
274
+
275
+ # The pixelwidth method is used to retrieve the width of the image file in
276
+ # pixels.
277
+ #
278
+ # @example
279
+ # model = Sketchup.active_model
280
+ # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
281
+ # pt = Geom::Point3d.new
282
+ # entities = model.active_entities
283
+ # image = entities.add_image path, pt, 300
284
+ # pixelwidth = image.pixelwidth
285
+ # if (pixelwidth)
286
+ # UI.messagebox pixelwidth
287
+ # else
288
+ # UI.messagebox "Failure"
289
+ # end
290
+ #
291
+ # @return width - the width of the image in pixels if successful
292
+ #
293
+ # @version SketchUp 6.0
294
+ def pixelwidth
295
+ end
296
+
297
+ # The size= method is used to set the width and height of the image, in inches.
298
+ #
299
+ # @example
300
+ # model = Sketchup.active_model
301
+ # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
302
+ # pt = Geom::Point3d.new
303
+ # entities = model.active_entities
304
+ # image = entities.add_image path, pt, 300
305
+ # UI.messagebox "Before Resize"
306
+ # size = image.size= 500,500
307
+ # if (size)
308
+ # UI.messagebox size
309
+ # else
310
+ # UI.messagebox "Failure"
311
+ # end
312
+ #
313
+ # @param width
314
+ # The width of the image.
315
+ #
316
+ # @param height
317
+ # The height of the image.
318
+ #
319
+ # @return size - the new width and height of the image if
320
+ # successful
321
+ #
322
+ # @version SketchUp 6.0
323
+ def size=(width, height)
324
+ end
325
+
326
+ # The transform! method is used to apply a transformation to the image.
327
+ #
328
+ # @example
329
+ # model = Sketchup.active_model
330
+ # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
331
+ # point = Geom::Point3d.new 100,100,100
332
+ # t = Geom::Transformation.new point
333
+ # pt = Geom::Point3d.new
334
+ # entities = model.active_entities
335
+ # image = entities.add_image path, pt, 300
336
+ # UI.messagebox "Before Move"
337
+ # image = image.transform! t
338
+ # if (image)
339
+ # UI.messagebox image
340
+ # else
341
+ # UI.messagebox "Failure"
342
+ # end
343
+ #
344
+ # @param transform
345
+ # A Transformation object.
346
+ #
347
+ # @return image - the transformed Image object if successful
348
+ #
349
+ # @version SketchUp 6.0
350
+ def transform!(transform)
351
+ end
352
+
353
+ # The transformation method is used to retrieve the transformation for the
354
+ # image.
355
+ #
356
+ # @example
357
+ # # Add an image to the model.
358
+ # model = Sketchup.active_model
359
+ # entities = model.active_entities
360
+ # path = Sketchup.find_support_file('report_tool.png', 'Plugins/su_dynamiccomponents/images')
361
+ # point = Geom::Point3d.new(100,100,100)
362
+ # image = entities.add_image(path, point, 300)
363
+ #
364
+ # trans = image.transformation
365
+ #
366
+ # @return transformation - a Transformation object if successful
367
+ #
368
+ # @version SketchUp 2014
369
+ def transformation
370
+ end
371
+
372
+ # The transformation= method is used to set the transformation for the
373
+ # image.
374
+ #
375
+ # @example
376
+ # # Add an image to the model.
377
+ # model = Sketchup.active_model
378
+ # entities = model.active_entities
379
+ # path = Sketchup.find_support_file('report_tool.png', 'Plugins/su_dynamiccomponents/images')
380
+ # point = Geom::Point3d.new(100,100,100)
381
+ # image = entities.add_image(path, point, 300)
382
+ #
383
+ # new_transform = Geom::Transformation.new([100,0,0])
384
+ # image.transformation = new_transform
385
+ #
386
+ # @param transform
387
+ # The Transformation object to apply
388
+ #
389
+ # @return image - the newly transformed image
390
+ #
391
+ # @version SketchUp 2014
392
+ def transformation=(transform)
393
+ end
394
+
395
+ # The width method is used to retrieve the width of the image.
396
+ #
397
+ # The width is given in inches.
398
+ #
399
+ # @example
400
+ # model = Sketchup.active_model
401
+ # path = Sketchup.find_support_file "report_tool.png",
402
+ # "Tools/DynamicComponents/images"
403
+ # pt = Geom::Point3d.new
404
+ # entities = model.active_entities
405
+ # image = entities.add_image path, pt, 300
406
+ # width = image.width
407
+ # if (width)
408
+ # UI.messagebox width
409
+ # else
410
+ # UI.messagebox "Failure"
411
+ # end
412
+ #
413
+ # @return width - the width of the image if successful
414
+ #
415
+ # @version SketchUp 6.0
416
+ def width
417
+ end
418
+
419
+ # The width= method is used to set the width of the image.
420
+ #
421
+ # The width is set in inches.
422
+ #
423
+ # @example
424
+ # model = Sketchup.active_model
425
+ # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
426
+ # pt = Geom::Point3d.new
427
+ # entities = model.active_entities
428
+ # image = entities.add_image path, pt, 300
429
+ # UI.messagebox "Before adjustment"
430
+ # width = image.width=400
431
+ # if (width)
432
+ # UI.messagebox width
433
+ # else
434
+ # UI.messagebox "Failure"
435
+ # end
436
+ #
437
+ # @param width
438
+ # The width, in inches, to set the image.
439
+ #
440
+ # @return width - the new width if successful
441
+ #
442
+ # @version SketchUp 6.0
443
+ def width=(width)
444
+ end
445
+
446
+ # The zrotation method is used to get the angle that the image is rotated
447
+ # about the normal vector from an arbitrary X axis.
448
+ #
449
+ # @example
450
+ # model = Sketchup.active_model
451
+ # path = Sketchup.find_support_file "report_tool.png", "Tools/DynamicComponents/images"
452
+ # pt = Geom::Point3d.new
453
+ # entities = model.active_entities
454
+ # image = entities.add_image path, pt, 300
455
+ # zrotation = image.zrotation
456
+ # if (zrotation)
457
+ # UI.messagebox zrotation
458
+ # else
459
+ # UI.messagebox "Failure"
460
+ # end
461
+ #
462
+ # @return vector - a Vector3d object if successful
463
+ #
464
+ # @version SketchUp 6.0
465
+ def zrotation
466
+ end
467
+
468
+ end