sketchup-api-stubs 0.7.3 → 0.7.4

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 (149) hide show
  1. checksums.yaml +5 -5
  2. data/.yardopts +9 -9
  3. data/lib/sketchup-api-stubs.rb +1 -1
  4. data/lib/sketchup-api-stubs/sketchup.rb +145 -145
  5. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +318 -318
  6. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
  7. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
  8. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
  9. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -400
  10. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
  11. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +492 -492
  12. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +478 -478
  13. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
  14. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
  15. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -522
  16. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +691 -691
  17. data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
  18. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +573 -573
  19. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +411 -411
  20. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +174 -186
  21. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
  22. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +514 -514
  23. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
  24. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +143 -155
  25. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
  26. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +349 -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 +371 -371
  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 +220 -232
  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 +204 -216
  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/SketchUpModel.rb +694 -694
  43. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
  44. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
  45. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
  46. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
  47. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
  48. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +140 -140
  49. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +157 -157
  50. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
  51. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +152 -152
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -281
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +328 -328
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +577 -577
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +122 -122
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +281 -281
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +562 -562
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +194 -194
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +329 -329
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +72 -72
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +102 -102
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +312 -312
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +38 -38
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +390 -390
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +508 -508
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1119 -1119
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +125 -125
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +544 -544
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +59 -59
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -125
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +750 -750
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +697 -697
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +285 -285
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +409 -409
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +226 -226
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +190 -190
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +393 -393
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +82 -82
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +303 -303
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +285 -280
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +244 -231
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +136 -136
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +112 -123
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +416 -416
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +311 -311
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +141 -141
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +95 -95
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1638 -1601
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +356 -356
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +132 -132
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +284 -284
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +770 -770
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +353 -353
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +76 -76
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +456 -456
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +364 -364
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +44 -44
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +454 -454
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +257 -257
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +57 -57
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +211 -211
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +225 -225
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +829 -829
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +154 -154
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +61 -61
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1301 -1301
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +43 -43
  134. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +310 -310
  135. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +356 -356
  136. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +229 -229
  137. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +240 -240
  138. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +633 -633
  139. data/lib/sketchup-api-stubs/stubs/_top_level.rb +311 -311
  140. data/lib/sketchup-api-stubs/stubs/array.rb +741 -741
  141. data/lib/sketchup-api-stubs/stubs/geom.rb +348 -348
  142. data/lib/sketchup-api-stubs/stubs/languagehandler.rb +92 -92
  143. data/lib/sketchup-api-stubs/stubs/length.rb +278 -278
  144. data/lib/sketchup-api-stubs/stubs/numeric.rb +249 -249
  145. data/lib/sketchup-api-stubs/stubs/sketchup.rb +1310 -1310
  146. data/lib/sketchup-api-stubs/stubs/sketchupextension.rb +353 -353
  147. data/lib/sketchup-api-stubs/stubs/string.rb +24 -24
  148. data/lib/sketchup-api-stubs/stubs/ui.rb +667 -667
  149. metadata +3 -4
@@ -1,61 +1,61 @@
1
- # Copyright:: Copyright 2020 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # The UV Helper class contains methods allowing you to determine the location
5
- # (UV coordinates) of a texture on a face. This class is particularly useful
6
- # in determining how textures that have been manipulated using the Texture
7
- # Tweaker should appear when exported to another file type
8
- #
9
- # Use the Face.get_UVHelper method to create a UVHelper for a given face.
10
- # See the TextureWriter class as well.
11
- #
12
- # @version SketchUp 6.0
13
- class Sketchup::UVHelper
14
-
15
- # Instance Methods
16
-
17
- # The get_back_UVQ method is used to get the UV coordinates for the back of a
18
- # face.
19
- #
20
- # @example
21
- # uv_helper = face.get_UVHelper true, true, my_texture_writer
22
- # face.outer_loop.vertices.each do |vert|
23
- # uvq = uv_help.get_back_UVQ(vert.position)
24
- # puts "u=" + uvq.x.to_s + " v=" + uvq.y.to_s
25
- # end
26
- #
27
- # @param point
28
- # A Point3d object containing one of the 3D vertexes of
29
- # the face.
30
- #
31
- # @return point - a Point3d containing the UV coordinates where
32
- # the X value is the U value, the Y value is the V value
33
- # and the Z value is a Q value (which is not used).
34
- #
35
- # @version SketchUp 6.0
36
- def get_back_UVQ(point)
37
- end
38
-
39
- # The get_front_UVQ method is used to get the UV coordinates for a front of a
40
- # face.
41
- #
42
- # @example
43
- # uv_helper = face.get_UVHelper true, true, my_texture_writer
44
- # face.outer_loop.vertices.each do |vert|
45
- # uvq = uv_helper.get_front_UVQ(vert.position)
46
- # puts "u=" + uvq.x.to_s + " v=" + uvq.y.to_s
47
- # end
48
- #
49
- # @param point
50
- # A Point3d object containing one of the 3D vertexes of
51
- # the face.
52
- #
53
- # @return point - a Point3d containing the UV coordinates where
54
- # the X value is the U value, the Y value is the V value
55
- # and the Z value is a Q value (which is not used).
56
- #
57
- # @version SketchUp 6.0
58
- def get_front_UVQ(point)
59
- end
60
-
61
- end
1
+ # Copyright:: Copyright 2020 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # The UV Helper class contains methods allowing you to determine the location
5
+ # (UV coordinates) of a texture on a face. This class is particularly useful
6
+ # in determining how textures that have been manipulated using the Texture
7
+ # Tweaker should appear when exported to another file type
8
+ #
9
+ # Use the Face.get_UVHelper method to create a UVHelper for a given face.
10
+ # See the TextureWriter class as well.
11
+ #
12
+ # @version SketchUp 6.0
13
+ class Sketchup::UVHelper
14
+
15
+ # Instance Methods
16
+
17
+ # The get_back_UVQ method is used to get the UV coordinates for the back of a
18
+ # face.
19
+ #
20
+ # @example
21
+ # uv_helper = face.get_UVHelper true, true, my_texture_writer
22
+ # face.outer_loop.vertices.each do |vert|
23
+ # uvq = uv_help.get_back_UVQ(vert.position)
24
+ # puts "u=" + uvq.x.to_s + " v=" + uvq.y.to_s
25
+ # end
26
+ #
27
+ # @param point
28
+ # A Point3d object containing one of the 3D vertexes of
29
+ # the face.
30
+ #
31
+ # @return point - a Point3d containing the UV coordinates where
32
+ # the X value is the U value, the Y value is the V value
33
+ # and the Z value is a Q value (which is not used).
34
+ #
35
+ # @version SketchUp 6.0
36
+ def get_back_UVQ(point)
37
+ end
38
+
39
+ # The get_front_UVQ method is used to get the UV coordinates for a front of a
40
+ # face.
41
+ #
42
+ # @example
43
+ # uv_helper = face.get_UVHelper true, true, my_texture_writer
44
+ # face.outer_loop.vertices.each do |vert|
45
+ # uvq = uv_helper.get_front_UVQ(vert.position)
46
+ # puts "u=" + uvq.x.to_s + " v=" + uvq.y.to_s
47
+ # end
48
+ #
49
+ # @param point
50
+ # A Point3d object containing one of the 3D vertexes of
51
+ # the face.
52
+ #
53
+ # @return point - a Point3d containing the UV coordinates where
54
+ # the X value is the U value, the Y value is the V value
55
+ # and the Z value is a Q value (which is not used).
56
+ #
57
+ # @version SketchUp 6.0
58
+ def get_front_UVQ(point)
59
+ end
60
+
61
+ end
@@ -1,142 +1,142 @@
1
- # Copyright:: Copyright 2020 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # A Vertex. A Vertex represents the end of an Edge or a point inside a Face.
5
- #
6
- # @version SketchUp 6.0
7
- class Sketchup::Vertex < Sketchup::Entity
8
-
9
- # Instance Methods
10
-
11
- # The common_edge method is used to find a common edge that is defined by this
12
- # vertex and another vertex
13
- #
14
- # @example
15
- # edge = entities[0]
16
- # # returns array of vertices that make up the line
17
- # verticies = edge.vertices
18
- # vertex1 = verticies[0]
19
- # vertex2 = verticies[1]
20
- # edge = vertex1.common_edge vertex2
21
- # if (edge)
22
- # UI.messagebox edge
23
- # else
24
- # UI.messagebox "Failure"
25
- # end
26
- #
27
- # @param [Sketchup::Vertex] vertex2
28
- # A Vertex object.
29
- #
30
- # @return [Sketchup::Edge, nil] an Edge object common to both vertices if
31
- # successful. Returns nil if there is no edge between the
32
- # two vertices.
33
- #
34
- # @version SketchUp 6.0
35
- def common_edge(vertex2)
36
- end
37
-
38
- # The {#curve_interior?} method is used to determine if this vertex is on the
39
- # interior of a Curve.
40
- #
41
- # @example
42
- # edge = entities[0]
43
- # # returns array of vertices that make up the line
44
- # verticies = edge.vertices
45
- # vertex1 = verticies[0]
46
- # status = vertex1.curve_interior?
47
- # if (status)
48
- # UI.messagebox status
49
- # else
50
- # #returns nil if vertex is not on interior of a Curve
51
- # UI.messagebox "Failure"
52
- # end
53
- #
54
- # @note This method doesn't actually return a boolean as the question mark
55
- # post-fix would normally indicate. But the result still evaluates to
56
- # truthy or falsy.
57
- #
58
- # @return [Boolean]
59
- #
60
- # @version SketchUp 6.0
61
- def curve_interior?
62
- end
63
-
64
- # The edges method is used to retrieve an Array of edges that use the Vertex.
65
- #
66
- # @example
67
- # edge = entities[0]
68
- # # Returns array of vertices that make up the line.
69
- # verticies = edge.vertices
70
- # vertex1 = verticies[0]
71
- # edges = vertex1.edges
72
- #
73
- # @return [Array<Sketchup::Edge>] an Array of edge objects if successful
74
- #
75
- # @version SketchUp 6.0
76
- def edges
77
- end
78
-
79
- # The faces method is used to retrieve an Array of faces that use the vertex.
80
- #
81
- # @example
82
- # edge = entities[0]
83
- # # Returns array of vertices that make up the line.
84
- # verticies = edge.vertices
85
- # vertex1 = verticies[0]
86
- # faces = vertex1.faces
87
- #
88
- # @return [Array<Sketchup::Face>] an Array of faces that use the vertex if
89
- # successful
90
- #
91
- # @version SketchUp 6.0
92
- def faces
93
- end
94
-
95
- # The loops method is used to retrieve an Array of loops that use the vertex.
96
- #
97
- # @example
98
- # edge = entities[0]
99
- # # Returns array of vertices that make up the line.
100
- # verticies = edge.vertices
101
- # vertex1 = verticies[0]
102
- # loops = vertex1.loops
103
- #
104
- # @return [Array<Sketchup::Loop>] an Array of loops that use the vertex if
105
- # successful
106
- #
107
- # @version SketchUp 6.0
108
- def loops
109
- end
110
-
111
- # The position method is used to retrieve the Point3d position of a vertex.
112
- #
113
- # @example
114
- # edge = entities[0]
115
- # # Returns array of vertices that make up the line.
116
- # verticies = edge.vertices
117
- # vertex1 = verticies[0]
118
- # position = vertex1.position
119
- #
120
- # @return [Geom::Point3d] a Point3d object representing the position of
121
- # the vertex if successful
122
- #
123
- # @version SketchUp 6.0
124
- def position
125
- end
126
-
127
- # The used_by? method is used to determine if the Vertex is used by a given
128
- # Edge or Face.
129
- #
130
- # @example
131
- # used = vertex1.used_by? my_face
132
- #
133
- # @param [Sketchup::Edge, Sketchup::Face] face_or_edge
134
- # A Face or Edge ot test against.
135
- #
136
- # @return [Boolean]
137
- #
138
- # @version SketchUp 6.0
139
- def used_by?(face_or_edge)
140
- end
141
-
142
- end
1
+ # Copyright:: Copyright 2020 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # A Vertex. A Vertex represents the end of an Edge or a point inside a Face.
5
+ #
6
+ # @version SketchUp 6.0
7
+ class Sketchup::Vertex < Sketchup::Entity
8
+
9
+ # Instance Methods
10
+
11
+ # The common_edge method is used to find a common edge that is defined by this
12
+ # vertex and another vertex
13
+ #
14
+ # @example
15
+ # edge = entities[0]
16
+ # # returns array of vertices that make up the line
17
+ # verticies = edge.vertices
18
+ # vertex1 = verticies[0]
19
+ # vertex2 = verticies[1]
20
+ # edge = vertex1.common_edge vertex2
21
+ # if (edge)
22
+ # UI.messagebox edge
23
+ # else
24
+ # UI.messagebox "Failure"
25
+ # end
26
+ #
27
+ # @param [Sketchup::Vertex] vertex2
28
+ # A Vertex object.
29
+ #
30
+ # @return [Sketchup::Edge, nil] an Edge object common to both vertices if
31
+ # successful. Returns nil if there is no edge between the
32
+ # two vertices.
33
+ #
34
+ # @version SketchUp 6.0
35
+ def common_edge(vertex2)
36
+ end
37
+
38
+ # The {#curve_interior?} method is used to determine if this vertex is on the
39
+ # interior of a Curve.
40
+ #
41
+ # @example
42
+ # edge = entities[0]
43
+ # # returns array of vertices that make up the line
44
+ # verticies = edge.vertices
45
+ # vertex1 = verticies[0]
46
+ # status = vertex1.curve_interior?
47
+ # if (status)
48
+ # UI.messagebox status
49
+ # else
50
+ # #returns nil if vertex is not on interior of a Curve
51
+ # UI.messagebox "Failure"
52
+ # end
53
+ #
54
+ # @note This method doesn't actually return a boolean as the question mark
55
+ # post-fix would normally indicate. But the result still evaluates to
56
+ # truthy or falsy.
57
+ #
58
+ # @return [Boolean]
59
+ #
60
+ # @version SketchUp 6.0
61
+ def curve_interior?
62
+ end
63
+
64
+ # The edges method is used to retrieve an Array of edges that use the Vertex.
65
+ #
66
+ # @example
67
+ # edge = entities[0]
68
+ # # Returns array of vertices that make up the line.
69
+ # verticies = edge.vertices
70
+ # vertex1 = verticies[0]
71
+ # edges = vertex1.edges
72
+ #
73
+ # @return [Array<Sketchup::Edge>] an Array of edge objects if successful
74
+ #
75
+ # @version SketchUp 6.0
76
+ def edges
77
+ end
78
+
79
+ # The faces method is used to retrieve an Array of faces that use the vertex.
80
+ #
81
+ # @example
82
+ # edge = entities[0]
83
+ # # Returns array of vertices that make up the line.
84
+ # verticies = edge.vertices
85
+ # vertex1 = verticies[0]
86
+ # faces = vertex1.faces
87
+ #
88
+ # @return [Array<Sketchup::Face>] an Array of faces that use the vertex if
89
+ # successful
90
+ #
91
+ # @version SketchUp 6.0
92
+ def faces
93
+ end
94
+
95
+ # The loops method is used to retrieve an Array of loops that use the vertex.
96
+ #
97
+ # @example
98
+ # edge = entities[0]
99
+ # # Returns array of vertices that make up the line.
100
+ # verticies = edge.vertices
101
+ # vertex1 = verticies[0]
102
+ # loops = vertex1.loops
103
+ #
104
+ # @return [Array<Sketchup::Loop>] an Array of loops that use the vertex if
105
+ # successful
106
+ #
107
+ # @version SketchUp 6.0
108
+ def loops
109
+ end
110
+
111
+ # The position method is used to retrieve the Point3d position of a vertex.
112
+ #
113
+ # @example
114
+ # edge = entities[0]
115
+ # # Returns array of vertices that make up the line.
116
+ # verticies = edge.vertices
117
+ # vertex1 = verticies[0]
118
+ # position = vertex1.position
119
+ #
120
+ # @return [Geom::Point3d] a Point3d object representing the position of
121
+ # the vertex if successful
122
+ #
123
+ # @version SketchUp 6.0
124
+ def position
125
+ end
126
+
127
+ # The used_by? method is used to determine if the Vertex is used by a given
128
+ # Edge or Face.
129
+ #
130
+ # @example
131
+ # used = vertex1.used_by? my_face
132
+ #
133
+ # @param [Sketchup::Edge, Sketchup::Face] face_or_edge
134
+ # A Face or Edge ot test against.
135
+ #
136
+ # @return [Boolean]
137
+ #
138
+ # @version SketchUp 6.0
139
+ def used_by?(face_or_edge)
140
+ end
141
+
142
+ end
@@ -1,1301 +1,1301 @@
1
- # Copyright:: Copyright 2020 Trimble Inc.
2
- # License:: The MIT License (MIT)
3
-
4
- # This class contains methods to manipulate the current point of view of the
5
- # model. The drawing methods here (draw_line, draw_polyline, etc) are meant to
6
- # be invoked within a tool's Tool.draw method. Calling them outside Tool.draw
7
- # will have no effect.
8
- #
9
- # You access the View by calling the Model.active_view method.
10
- #
11
- # @example
12
- # view = Sketchup.active_model.active_view
13
- #
14
- # @version SketchUp 6.0
15
- class Sketchup::View
16
-
17
- # Instance Methods
18
-
19
- # The add_observer method is used to add an observer to the current object.
20
- #
21
- # @example
22
- # view = Sketchup.active_model.active_view
23
- # status = view.add_observer observer
24
- #
25
- # @param [Object] observer
26
- # An observer.
27
- #
28
- # @return [Boolean] true if successful, false if unsuccessful.
29
- #
30
- # @version SketchUp 6.0
31
- def add_observer(observer)
32
- end
33
-
34
- # The animation= method is used to set an animation that is displayed for a
35
- # view. See Animation for details on how to create an animation object.
36
- #
37
- # @example
38
- # animation = ViewSpinner.new
39
- # model = Sketchup.active_model
40
- # view = model.active_view
41
- # anim = view.animation=animation
42
- # if (anim)
43
- # UI.messagebox anim
44
- # else
45
- # UI.messagebox "Failure"
46
- # end
47
- #
48
- # @param [#nextFrame] animation
49
- # An Animation object.
50
- #
51
- # @return [#nextFrame] the newly set Animation object
52
- #
53
- # @version SketchUp 6.0
54
- def animation=(animation)
55
- end
56
-
57
- # The average_refresh_time is used to set the average time used to refresh the
58
- # current model in the view. This can be used to estimate the frame rate for
59
- # an animation.
60
- #
61
- # @example
62
- # model = Sketchup.active_model
63
- # view = model.active_view
64
- # time = view.average_refresh_time
65
- #
66
- # @return [Float] the time in seconds
67
- #
68
- # @version SketchUp 6.0
69
- def average_refresh_time
70
- end
71
-
72
- # The camera method is used to retrieve the camera for the view.
73
- #
74
- # @example
75
- # camera = view.camera
76
- #
77
- # @return [Sketchup::Camera] a Camera object
78
- #
79
- # @version SketchUp 6.0
80
- def camera
81
- end
82
-
83
- # The {#camera=} method is used to set the camera for the view. If a transition
84
- # time is given, then it will animate the transition from the current camera
85
- # to the new one.
86
- #
87
- # @example
88
- # camera = Sketchup::Camera.new([5, 5, 9], [5, 10, 0], Z_AXIS)
89
- # view = Sketchup.active_model.active_view
90
- # view.camera = camera
91
- #
92
- # @overload camera=(camera)
93
- #
94
- # @param camera [Sketchup::Camera] The new Camera object.
95
- # @return [Sketchup::Camera]
96
- #
97
- # @overload camera=(camera_and_transition)
98
- #
99
- # @param camera_and_transition [Array(Sketchup::Camera, Float)]
100
- # The second item in the array represents the transition time from the
101
- # existing camera to the new one
102
- # @return [Array(Sketchup::Camera, Float)]
103
- #
104
- # @version SketchUp 6.0
105
- def camera=(arg)
106
- end
107
-
108
- # The center method is used to retrieve the coordinates of the center of the
109
- # view in pixels. It is returned as an array of 2 values for x and y.
110
- #
111
- # @example
112
- # model = Sketchup.active_model
113
- # view = model.active_view
114
- # c = view.center
115
- #
116
- # @return [Geom::Point3d] the center of the view
117
- #
118
- # @version SketchUp 6.0
119
- def center
120
- end
121
-
122
- # The corner method is used to retrieve the coordinates of one of the corners
123
- # of the view. The argument is an index between 0 and 3 that identifies which
124
- # corner you want. This method returns an array with two integers which are
125
- # the coordinates of the corner of the view in the view space. If the view
126
- # uses a Camera with a fixed aspect ratio, then the corners are the corners of
127
- # the viewing are of the camera which might be different than the actual
128
- # corners of the view itself.
129
- #
130
- # The index numbers are as follows:
131
- # - 0: top left,
132
- # - 1: top right,
133
- # - 2: bottom left,
134
- # - 3: bottom right.
135
- #
136
- # @example
137
- # point = view.corner index
138
- #
139
- # @param [Integer] index
140
- # A value between (or including) 0 and 3 identifying the
141
- # corner whose coordinate you want to retrieve.
142
- #
143
- # @return [Array(Integer, Integer)] a 2d array [w,h] representing the screen point
144
- #
145
- # @version SketchUp 6.0
146
- def corner(index)
147
- end
148
-
149
- # The {#draw} method is used to do basic drawing. This method can only be
150
- # called from within the {Tool#draw} method of a tool that you implement in
151
- # Ruby.
152
- #
153
- # The following constants are all OpenGL terms and have been externalized to
154
- # Ruby. Here is a summary of their meanings:
155
- #
156
- # [GL_POINTS]
157
- # Treats each vertex as a single point. Vertex n defines point n. N
158
- # points are drawn.
159
- #
160
- # [GL_LINES]
161
- # Treats each pair of vertices as
162
- # an independent line segment. Vertices 2n-1 and 2n define line n. N/2 lines
163
- # are drawn.
164
- #
165
- # [GL_LINE_STRIP]
166
- # Draws a connected group of line
167
- # segments from the first vertex to the last. Vertices n and n+1 define
168
- # line n. N-1 lines are drawn.
169
- #
170
- # [GL_LINE_LOOP]
171
- # Draws a connected group of line segments from the first vertex to the last,
172
- # then back to the first. Vertices n and n+1 define line n. The last line,
173
- # however, is defined by vertices N and 1. N lines are drawn.
174
- #
175
- # [GL_TRIANGLES]
176
- # Treats each triplet of vertices as an independent
177
- # triangle. Vertices 3n-2, 3n-1, and 3n define triangle n. N/3 triangles are
178
- # drawn.
179
- #
180
- # [GL_TRIANGLE_STRIP]
181
- # Draws a connected group of triangles. One triangle is defined for each
182
- # vertex presented after the first two vertices. For odd n, vertices n, n+1,
183
- # and n+2 define triangle n. For even n, vertices n+1, n, and n+2 define
184
- # triangle n. N-2 triangles are drawn.
185
- #
186
- # [GL_TRIANGLE_FAN]
187
- # Draws a connected group of triangles.
188
- # One triangle is defined for each vertex presented after the first two
189
- # vertices. Vertices 1, n+1, and n+2 define triangle n. N-2 triangles are
190
- # drawn.
191
- #
192
- # [GL_QUADS]
193
- # Treats each group of four vertices as an
194
- # independent quadrilateral. Vertices 4n-3, 4n-2, 4n-1, and 4n define
195
- # quadrilateral n. N/4 quadrilaterals are drawn.
196
- #
197
- # [GL_QUAD_STRIP]
198
- # Draws a connected group of quadrilaterals. One quadrilateral is
199
- # defined for each pair of vertices presented after the first pair.
200
- # Vertices 2n-1, 2n, 2n+2, and 2n+1 define quadrilateral n. N/2-1
201
- # quadrilaterals are drawn. Note that the order in which vertices are used to
202
- # construct a quadrilateral from strip data is different from that used with
203
- # independent data.
204
- #
205
- # [GL_POLYGON]
206
- # Draws a single, convex polygon. Vertices 1
207
- # through N define this polygon.
208
- #
209
- # @example
210
- # points = [
211
- # Geom::Point3d.new(0, 0, 0),
212
- # Geom::Point3d.new(9, 0, 0),
213
- # Geom::Point3d.new(9, 9, 0),
214
- # Geom::Point3d.new(0, 9, 0)
215
- # ]
216
- # view.draw(GL_LINE_LOOP, points)
217
- #
218
- # @note If you draw outside the model bounds you need to implement
219
- # {Tool#getExtents} which returns a bounding box large enough to include the
220
- # points you draw. Otherwise your drawing will be clipped.
221
- #
222
- # @overload draw(openglenum, points)
223
- #
224
- # @param [Integer] openglenum
225
- # The item you are going to draw, one of the constants
226
- # from the comments, such as +GL_LINES+.
227
- # @param [Array<Geom::Point3d>] points
228
- #
229
- # @overload draw(openglenum, *points)
230
- #
231
- # @param [Integer] openglenum
232
- # The item you are going to draw, one of the constants
233
- # from the comments, such as +GL_LINES+.
234
- # @param [Array<Geom::Point3d>] points
235
- #
236
- # @overload draw(openglenum, points, **options)
237
- #
238
- # @version SketchUp 2020.0
239
- # @param [Integer] openglenum
240
- # The item you are going to draw, one of the constants
241
- # from the comments, such as +GL_LINES+.
242
- # @param [Array<Geom::Point3d>] points
243
- # @param [Hash] options
244
- # @option options [Array<Geom::Vector3d>] :normals
245
- # Without normals the polygons will be rendered with flat shading. No
246
- # light will affect it. By providing an array of vertex normals lighting
247
- # is turned on and will use the model's current light. Note that the number
248
- # of normals must match the number of points provided.
249
- # @option options [Integer] :texture_id
250
- # A texture id provided by {#load_texture}.
251
- # @option options [Array<Geom::Vector3d>] :uvs
252
- # Set of UV (Not UVQ) coordinates matching the number of points provided.
253
- # This must be used along with the +:texture_id+ option.
254
- #
255
- # @overload draw(openglenum, *points, **options)
256
- #
257
- # @version SketchUp 2020.0
258
- # @param [Integer] openglenum
259
- # The item you are going to draw, one of the constants
260
- # from the comments, such as +GL_LINES+.
261
- # @param [Array<Geom::Point3d>] points
262
- # @param [Hash] options
263
- # @option options [Array<Geom::Vector3d>] :normals ([])
264
- # Without normals the polygons will be rendered with flat shading. No
265
- # light will affect it. By providing an array of vertex normals lighting
266
- # is turned on and will use the model's current light. Note that the number
267
- # of normals must match the number of points provided.
268
- # @option options [Integer] :texture_id
269
- # A texture id provided by {#load_texture}.
270
- # @option options [Array<Geom::Vector3d>] :uvs
271
- # Set of UV (Not UVQ) coordinates matching the number of points provided.
272
- # This must be used along with the +:texture_id+ option.
273
- #
274
- # @return [Sketchup::View]
275
- #
276
- # @see Tool#getExtents
277
- #
278
- # @version SketchUp 6.0
279
- def draw(*args)
280
- end
281
-
282
- # The {#draw2d} method is used to draw in screen space (using 2D screen
283
- # coordinates) instead of 3D space.
284
- #
285
- # The second parameter is an {Array} of {Geom::Point3d} objects (or several
286
- # individual {Geom::Point3d} objects). These {Geom::Point3d} objects are in
287
- # screen space, not 3D space.
288
- # The X value corresponds to the number of pixels from the left edge of the
289
- # drawing area. The Y value corresponds to the number of pixels down from
290
- # the top of the drawing area. The Z value is not used.
291
- #
292
- # @example
293
- # points = [
294
- # Geom::Point3d.new(0, 0, 0),
295
- # Geom::Point3d.new(8, 0, 0),
296
- # Geom::Point3d.new(8, 4, 0),
297
- # Geom::Point3d.new(0, 4, 0)
298
- # ]
299
- # view.draw2d(GL_LINE_STRIP, points)
300
- #
301
- # @overload draw2d(openglenum, points)
302
- #
303
- # @param [Integer] openglenum
304
- # The item you are going to draw, one of the constants
305
- # from the comments, such as +GL_LINES+.
306
- # @param [Array<Geom::Point3d>] points
307
- #
308
- # @overload draw2d(openglenum, *points)
309
- #
310
- # @param [Integer] openglenum
311
- # The item you are going to draw, one of the constants
312
- # from the comments, such as +GL_LINES+.
313
- # @param [Array<Geom::Point3d>] points
314
- #
315
- # @overload draw2d(openglenum, points, **options)
316
- #
317
- # @version SketchUp 2020.0
318
- # @param [Integer] openglenum
319
- # The item you are going to draw, one of the constants
320
- # from the comments, such as +GL_LINES+.
321
- # @param [Array<Geom::Point3d>] points
322
- # @param [Hash] options
323
- # @option options [Integer] :texture_id
324
- # A texture id provided by {#load_texture}.
325
- # @option options [Array<Geom::Vector3d>] :uvs
326
- # Set of UV (Not UVQ) coordinates matching the number of points provided.
327
- # This must be used along with the +:texture_id+ option.
328
- #
329
- # @overload draw2d(openglenum, *points, **options)
330
- #
331
- # @version SketchUp 2020.0
332
- # @param [Integer] openglenum
333
- # The item you are going to draw, one of the constants
334
- # from the comments, such as +GL_LINES+.
335
- # @param [Array<Geom::Point3d>] points
336
- # @param [Hash] options
337
- # @option options [Integer] :texture_id
338
- # A texture id provided by {#load_texture}.
339
- # @option options [Array<Geom::Vector3d>] :uvs
340
- # Set of UV (Not UVQ) coordinates matching the number of points provided.
341
- # This must be used along with the +:texture_id+ option.
342
- #
343
- # @return [Sketchup::View]
344
- #
345
- # @see #draw
346
- #
347
- # @see UI.scale_factor
348
- #
349
- # @version SketchUp 6.0
350
- def draw2d(*args)
351
- end
352
-
353
- # The draw_lines method is used to draw disconnected lines.
354
- #
355
- # You must have an even number of points. This method is usually invoked
356
- # within the draw method of a tool.
357
- #
358
- # @example
359
- # point4 = Geom::Point3d.new 0,0,0
360
- # point5 = Geom::Point3d.new 100,100,100
361
- # # returns a view
362
- # status = view.drawing_color="red"
363
- # status = view.draw_lines point4, point5
364
- #
365
- # @overload draw_lines(point_list, ...)
366
- #
367
- # @param point_list [Array<Geom::Point3d>] An even number of Point3d objects.
368
- # @return [Sketchup::View] returns the View object
369
- #
370
- # @overload draw_lines(pts)
371
- #
372
- # @param pts [Array<Geom::Point3d>] An array of Point3d objects.
373
- # @return [Sketchup::View] returns the View object
374
- #
375
- # @version SketchUp 6.0
376
- def draw_line(*args)
377
- end
378
-
379
- # The draw_lines method is used to draw disconnected lines.
380
- #
381
- # You must have an even number of points. This method is usually invoked
382
- # within the draw method of a tool.
383
- #
384
- # @example
385
- # point4 = Geom::Point3d.new 0,0,0
386
- # point5 = Geom::Point3d.new 100,100,100
387
- # # returns a view
388
- # status = view.drawing_color="red"
389
- # status = view.draw_lines point4, point5
390
- #
391
- # @overload draw_lines(point_list, ...)
392
- #
393
- # @param point_list [Array<Geom::Point3d>] An even number of Point3d objects.
394
- # @return [Sketchup::View] returns the View object
395
- #
396
- # @overload draw_lines(pts)
397
- #
398
- # @param pts [Array<Geom::Point3d>] An array of Point3d objects.
399
- # @return [Sketchup::View] returns the View object
400
- #
401
- # @version SketchUp 6.0
402
- def draw_lines(*args)
403
- end
404
-
405
- # This method is used to draw points.
406
- #
407
- # This method is usually invoked within the draw method of a tool.
408
- #
409
- # @example
410
- # point3 = Geom::Point3d.new 0,0,0
411
- # # returns a view
412
- # status = view.draw_points point3, 10, 1, "red"
413
- #
414
- # @param [Array<Geom::Point3d>] pts
415
- # An array of Point3d objects.
416
- #
417
- # @param [Integer] pointsize
418
- # Size of the point in pixels.
419
- #
420
- # @param [Sketchup::Color] pointcolor
421
- # Color of the point.
422
- #
423
- # @param [Integer] pointstyle
424
- # Style of the point. 1 = open square,
425
- # 2 = filled square, 3 = "+", 4 = "X", 5 = "*",
426
- # 6 = open triangle, 7 = filled triangle.
427
- #
428
- # @return [Sketchup::View] a View object
429
- #
430
- # @version SketchUp 6.0
431
- def draw_points(pts, pointsize = 6, pointstyle = 3, pointcolor = 'black')
432
- end
433
-
434
- # The draw_polyline method is used to draw a series of connected line segments
435
- # from pt1 to pt2 to pt3, and so on.
436
- #
437
- # This method is usually invoked within the draw method of a tool.
438
- #
439
- # @example
440
- # point12 = Geom::Point3d.new 0,0,0
441
- # point13 = Geom::Point3d.new 10,10,10
442
- # point14 = Geom::Point3d.new 20,20,20
443
- # point15 = Geom::Point3d.new 30,30,30
444
- # status = view.draw_polyline point12, point13, point14, point15
445
- #
446
- # @overload draw_polyline(point_list, ...)
447
- #
448
- # @param point_list [Array<Geom::Point3d>] An even number of Point3d objects.
449
- # @return [Sketchup::View] a View object
450
- #
451
- # @overload draw_polyline(pts)
452
- #
453
- # @param pts [Array<Geom::Point3d>] An array of Point3d objects.
454
- # @return [Sketchup::View] a View object
455
- #
456
- # @version SketchUp 6.0
457
- def draw_polyline(*args)
458
- end
459
-
460
- # This method is used to draw text on the screen and is usually invoked within
461
- # the draw method of a tool.
462
- #
463
- # The {TextVerticalAlignCenter} option will align the text to the center of the
464
- # height of the first line, not the whole boundingbox of the text. To align
465
- # around the full bounds of the text, use {#text_bounds} to compute the
466
- # desired alignment.
467
- #
468
- # <b>Example of different vertical alignment and text bounds:</b>
469
- #
470
- # rdoc-image:../images/view-draw-text-with-bounds.png
471
- #
472
- # @example
473
- # class ExampleTool
474
- # def draw(view)
475
- # # This works in all SketchUp versions and draws the text using the
476
- # # default font, color and size.
477
- # point = Geom::Point3d.new(200, 100, 0)
478
- # view.draw_text(point, "This is a test")
479
- #
480
- # # This works in SketchUp 2016 and up.
481
- # options = {
482
- # :font => "Arial",
483
- # :size => 20,
484
- # :bold => true,
485
- # :align => TextAlignRight
486
- # }
487
- # point = Geom::Point3d.new(200, 200, 0)
488
- # view.draw_text(point, "This is another\ntest", options)
489
- #
490
- # # You can also use Ruby 2.0's named arguments:
491
- # point = Geom::Point3d.new(200, 200, 0)
492
- # view.draw_text(point, "Hello world!", color: "Red")
493
- # end
494
- # end
495
- #
496
- # @example Cross Platform Font Size
497
- # class ExampleTool
498
- # IS_WIN = Sketchup.platform == :platform_win
499
- #
500
- # def draw(view)
501
- # draw_text(view, [100, 200, 0], "Hello World", size: 20)
502
- # end
503
- #
504
- # private
505
- #
506
- # # This will ensure text is drawn with consistent size across platforms,
507
- # # using pixels as size units.
508
- # def draw_text(view, position, text, **options)
509
- # native_options = options.dup
510
- # if IS_WIN && options.key?(:size)
511
- # native_options[:size] = pixels_to_points(size)
512
- # end
513
- # view.draw_text(position, text, **native_options)
514
- # end
515
- #
516
- # def pixels_to_points(pixels)
517
- # ((pixels.to_f / 96.0) * 72.0).round
518
- # end
519
- # end
520
- #
521
- # @note Under Windows the font name must be less than 32 characters - due to
522
- # system limitations.
523
- #
524
- # @note As of SU2017 this will automatically scale the font-size by the same
525
- # factor as {UI.scale_factor}.
526
- #
527
- # @note The font size is platform dependent. On Windows the method expects
528
- # points, where on Mac it's pixels. See "Cross Platform Font Size" example
529
- # for details.
530
- #
531
- # @overload draw_text(point, text)
532
- #
533
- # @param [Geom::Point3d] point A Point3d object representing a 2D coordinate
534
- # in view space.
535
- # @param [String] text The text string to draw.
536
- #
537
- # @overload draw_text(point, text, options = {})
538
- #
539
- # @version SketchUp 2016
540
- # @param [Geom::Point3d] point A Point3d object representing a 2D coordinate
541
- # in view space.
542
- # @param [String] text The text string to draw.
543
- # @param [Hash] options The text can be customized by providing a hash or
544
- # named arguments of options.
545
- # @option options [String] :font The name of the font to use. If it does not
546
- # exist on the system, a default font will be used instead.
547
- # @option options [Integer] :size The size of the font in points
548
- # @option options [Boolean] :bold Controls the Bold property of the font.
549
- # @option options [Boolean] :italic Controls the Italic property of the font.
550
- # @option options [Sketchup::Color] :color The color to draw the text with.
551
- # @option options [Integer] :align The text alignment, one of the following
552
- # constants: {TextAlignLeft}, {TextAlignCenter} or {TextAlignRight}.
553
- # @option options [Integer] :vertical_align <b>Added SketchUp 2020.0.</b>
554
- # The vertical text alignment, one of the following constants:
555
- # {TextVerticalAlignBoundsTop}, {TextVerticalAlignBaseline},
556
- # {TextVerticalAlignCapHeight} or {TextVerticalAlignCenter}. Note that
557
- # some fonts on Mac might not align as expected due to the system
558
- # reporting incorrect font metrics.
559
- #
560
- # @return [Sketchup::View]
561
- #
562
- # @version SketchUp 6.0
563
- def draw_text(*args)
564
- end
565
-
566
- # The drawing_color method is used to set the color that is used for drawing
567
- # to the view.
568
- #
569
- # This method is usually invoked within the draw method of a tool.
570
- #
571
- # @example
572
- # view = view.drawing_color = color
573
- #
574
- # @param [Sketchup::Color, String] color
575
- # A Color object.
576
- #
577
- # @return [Sketchup::View]
578
- #
579
- # @version SketchUp 6.0
580
- def drawing_color=(color)
581
- end
582
-
583
- # The dynamic= method allows you to degrade visual quality while improving
584
- # performance when a model is large and view refresh time is slow. For
585
- # example, if you were using a Ruby script to animate the camera through
586
- # a large scene, you may want to set dynamic to true during that time.
587
- #
588
- # See also camera.rb which is part of the film and stage ruby
589
- # scripts.
590
- #
591
- # @deprecated This method is no longer doing anything.
592
- #
593
- # @example
594
- # view.dynamic = true
595
- #
596
- # @param [Boolean] value
597
- #
598
- # @return [Boolean]
599
- #
600
- # @version SketchUp 6.0
601
- def dynamic=(value)
602
- end
603
-
604
- # The field_of_view method is used get the view's field of view setting, in
605
- # degrees.
606
- #
607
- # @example
608
- # fov = Sketchup.active_model.active_view.field_of_view
609
- #
610
- # @return [Float] the field of view
611
- #
612
- # @version SketchUp 6.0
613
- def field_of_view
614
- end
615
-
616
- # The field_of_view= method is used set the view's field of view setting,
617
- # in degrees.
618
- #
619
- # @example
620
- # my_view = Sketchup.active_model.active_view
621
- # my_view.field_of_view = 45
622
- # my_view.invalidate
623
- #
624
- # @param [Numeric] fov
625
- # the field of view
626
- #
627
- # @return [Numeric]
628
- #
629
- # @version SketchUp 6.0
630
- def field_of_view=(fov)
631
- end
632
-
633
- # The guess_target method is used to guess at what the user is looking at when
634
- # you have a perspective view.
635
- #
636
- # This method is useful when writing a viewing tool. See also camera.rb which
637
- # is part of the film and stage ruby scripts.
638
- #
639
- # @example
640
- # target = view.guess_target
641
- #
642
- # @return [Geom::Point3d] a Point3d object representing the point in the
643
- # model that the user is likely interested in.
644
- #
645
- # @version SketchUp 6.0
646
- def guess_target(*args)
647
- end
648
-
649
- # The inference_locked? method is used to determine if inference locking is on
650
- # for the view.
651
- #
652
- # @example
653
- # model = Sketchup.active_model
654
- # view = model.active_view
655
- # status = view.inference_locked
656
- #
657
- # @return [Boolean]
658
- #
659
- # @version SketchUp 6.0
660
- def inference_locked?
661
- end
662
-
663
- # The inputpoint method is used to retrieve an input point.
664
- #
665
- # This will normally be used inside one of the mouse event handling methods in
666
- # a tool. Usually, it is preferable to create the InputPoint first and then
667
- # use the pick method on it.
668
- #
669
- # @example
670
- # inputpoint = view.inputpoint x, y, inputpoint1
671
- #
672
- # @param [Numeric] x
673
- # A x value.
674
- #
675
- # @param [Numeric] y
676
- # A y value.
677
- #
678
- # @param [Sketchup::InputPoint] inputpoint1
679
- # An InputPoint object.
680
- #
681
- # @return [Sketchup::InputPoint]
682
- #
683
- # @version SketchUp 6.0
684
- def inputpoint(x, y, inputpoint1)
685
- end
686
-
687
- # The invalidate method is used mark the view as in need of a redraw.
688
- #
689
- # @example
690
- # model = Sketchup.active_model
691
- # view = model.active_view
692
- # invalidated_view = view.invalidate
693
- #
694
- # @note This is the preferred method to update the viewport. Use this before
695
- # trying to use {#refresh}.
696
- #
697
- # @return [Sketchup::View] the invalidated View object
698
- #
699
- # @version SketchUp 6.0
700
- def invalidate
701
- end
702
-
703
- # The last_refresh_time method is used to retrieve the time for the last full
704
- # view refresh.
705
- #
706
- # @example
707
- # time = view.last_refresh_time
708
- #
709
- # @return [Float] time in milliseconds
710
- #
711
- # @version SketchUp 6.0
712
- def last_refresh_time(*args)
713
- end
714
-
715
- # The line_stipple= method is used to set the line pattern to use for drawing.
716
- # The stipple pattern is given as a string.
717
- # Valid strings are:
718
- # "." (Dotted Line),
719
- # "-" (Short Dashes Line),
720
- # "_" (Long Dashes Line),
721
- # "-.-" (Dash Dot Dash Line),
722
- # "" (Solid Line).
723
- #
724
- # This method is usually invoked within the draw method of a tool.
725
- #
726
- # @example
727
- # point8 = Geom::Point3d.new 0,0,0
728
- # point9 = Geom::Point3d.new 100,100,100
729
- # view.line_stipple = "-.-"
730
- # view = view.draw_lines point8, point9
731
- #
732
- # @param [String] pattern
733
- # A string stipple pattern, such as "-.-"
734
- #
735
- # @return [Sketchup::View] the View object
736
- #
737
- # @version SketchUp 6.0
738
- def line_stipple=(pattern)
739
- end
740
-
741
- # The line_width= method is used to set the line width to use for drawing. The
742
- # value is a Double indicating the desired width in pixels.
743
- #
744
- # This method is usually invoked within the draw method of a tool.
745
- #
746
- # @example
747
- # view.line_width = width
748
- #
749
- # @note As of SU2017 this will automatically scale the line width by the same
750
- # factor as {UI.scale_factor}.
751
- #
752
- # @param [Integer] width
753
- # The width in pixels.
754
- #
755
- # @return [Integer]
756
- #
757
- # @version SketchUp 6.0
758
- def line_width=(width)
759
- end
760
-
761
- # Loads a texture to be drawn with {#draw} or {#draw2d}.
762
- #
763
- # @example
764
- # module Example
765
- # class MyTool
766
- #
767
- # def activate
768
- # view = Sketchup.active_model.active_view
769
- # image_rep = view.model.materials.current.texture.image_rep
770
- # @texture_id = view.load_texture(image_rep)
771
- # end
772
- #
773
- # def deactivate(view)
774
- # view.release_texture(@texture_id)
775
- # end
776
- #
777
- # def draw(view)
778
- # points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
779
- # uvs = [ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] ]
780
- # view.draw(points, texture_id: @texture_id, uvs: uvs)
781
- # end
782
- #
783
- # end
784
- # end
785
- # Sketchup.active_model.select_tool(Example::MyTool.new)
786
- #
787
- # @note To conserve resources on the user's machine, textures can be loaded
788
- # only when there is a Ruby tool on the tool stack. Make sure to release the
789
- # texture when it's no longer needed. Any textures not already released
790
- # when the last Ruby tool on the tool stack is removed will be automatically
791
- # released by SketchUp.
792
- #
793
- # @note Avoid loading and releasing textures within the {Sketchup::Tool#draw}
794
- # event as that is not efficient.
795
- #
796
- # @param [Sketchup::ImageRep] image_rep
797
- #
798
- # @raise [ArgumentError] if the provided {Sketchup::ImageRep} is not valid.
799
- #
800
- # @raise [RuntimeError] if a Ruby tool was not on the tool stack.
801
- #
802
- # @return [Integer] A resource ID referring to the image loaded.
803
- #
804
- # @see #release_texture
805
- #
806
- # @see #draw
807
- def load_texture(image_rep)
808
- end
809
-
810
- # The lock_inference method is used to lock or unlock an inference.
811
- #
812
- # This method will typically be called from inside a tool class when the user
813
- # presses the shift key.
814
- #
815
- # With no arguments it unlocks all inferences. With one or two arguments, it
816
- # locks the inference based on the given InputPoint(s).
817
- #
818
- # @example
819
- # view = view.lock_inference
820
- # view = view.lock_inference(inputpoint)
821
- # view = view.lock_inference(inputpoint1, inputpoint2)
822
- #
823
- # @overload lock_inference
824
- #
825
- #
826
- # @overload lock_inference(inputpoint)
827
- #
828
- # @param [Sketchup::InputPoint] inputpoint
829
- # 1st InputPoint to inference to.
830
- #
831
- # @overload lock_inference(inputpoint, inputpoint2)
832
- #
833
- # @param [Sketchup::InputPoint] inputpoint
834
- # 1st InputPoint to inference to.
835
- # @param [Sketchup::InputPoint] inputpoint2
836
- # 2nd InputPoint to inference to.
837
- #
838
- # @return [Sketchup::View] a View object
839
- #
840
- # @version SketchUp 6.0
841
- def lock_inference(*args)
842
- end
843
-
844
- # The model method is used to retrieve the model for the current view.
845
- #
846
- # @example
847
- # model = view.model
848
- #
849
- # @return [Sketchup::Model] the model for this view
850
- #
851
- # @version SketchUp 6.0
852
- def model
853
- end
854
-
855
- # The pick_helper method is used to retrieve a pick helper for the view. See
856
- # the PickHelper class for information on pick helpers.
857
- #
858
- # This call returns an initialized PickHelper.
859
- #
860
- # @example
861
- # model = Sketchup.active_model
862
- # view = model.active_view
863
- # ph = view.pick_helper
864
- #
865
- # @overload pick_helper
866
- #
867
- # @return [Sketchup::PickHelper] a PickHelper object
868
- #
869
- # @overload pick_helper(x, y, aperture = 0)
870
- #
871
- # @param [Integer] x
872
- # @param [Integer] y
873
- # @param [Integer] aperture
874
- # @return [Sketchup::PickHelper] a PickHelper object
875
- #
876
- # @version SketchUp 6.0
877
- def pick_helper(*args)
878
- end
879
-
880
- # The pickray method is used to retrieve a ray passing through a given screen
881
- # position in the viewing direction.
882
- #
883
- # @example
884
- # ray = view.pickray x, y
885
- #
886
- # @overload pickray(screen_point)
887
- #
888
- # @param [Array(Integer, Integer)] screen_point
889
- # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
890
- #
891
- # @overload pickray(x, y)
892
- #
893
- # @param [Integer] x
894
- # @param [Integer] y
895
- # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
896
- #
897
- # @version SketchUp 6.0
898
- def pickray(*args)
899
- end
900
-
901
- # The pixels_to_model method is used to compute a model size from a pixel size
902
- # at a given point.
903
- #
904
- # This method is useful for deciding how big to draw something based on a
905
- # desired size in pixels.
906
- #
907
- # @example
908
- # size = view.pixels_to_model(pixels, point)
909
- #
910
- # @note As of SU2017 this will automatically scale the pixel-size by the same
911
- # factor as {UI.scale_factor}.
912
- #
913
- # @param [Numeric] pixels
914
- # The pixel size.
915
- #
916
- # @param [Geom::Point3d] point
917
- # A Point3d object where the size will be calculated from.
918
- #
919
- # @return [Float] the model size
920
- #
921
- # @version SketchUp 6.0
922
- def pixels_to_model(pixels, point)
923
- end
924
-
925
- # The refresh method is used to immediately force a redraw of the view.
926
- #
927
- # @example
928
- # model = Sketchup.active_model
929
- # view = model.active_view
930
- # refreshed_view = view.refresh
931
- #
932
- # @note This method might impact performance and if used incorrectly cause
933
- # instability or crashes. Don't use this unless you have verified that
934
- # you cannot use {#invalidate} instead.
935
- #
936
- # @return [Sketchup::View] the refreshed View object
937
- #
938
- # @version SketchUp 7.1
939
- def refresh
940
- end
941
-
942
- # Releases a texture loaded via {#load_texture}, freeing up it's memory.
943
- # It's good practice to do so whenever there is no longer any need for the
944
- # resource.
945
- #
946
- # For example, when your tool deactivates you probably want to release your
947
- # resources as you don't know if your tool will be used again.
948
- #
949
- # @example
950
- # module Example
951
- # class MyTool
952
- #
953
- # def activate
954
- # view = Sketchup.active_model.active_view
955
- # image_rep = view.model.materials.current.texture.image_rep
956
- # @texture_id = view.load_texture(image_rep)
957
- # end
958
- #
959
- # def deactivate(view)
960
- # view.release_texture(@texture_id)
961
- # end
962
- #
963
- # def draw(view)
964
- # points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
965
- # uvs = [ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] ]
966
- # view.draw(points, texture_id: @texture_id, uvs: uvs)
967
- # end
968
- #
969
- # end
970
- # end
971
- # Sketchup.active_model.select_tool(Example::MyTool.new)
972
- #
973
- # @param [Integer] texture_id
974
- #
975
- # @return [Boolean] +true+ if texture was released. +false+ otherwise.
976
- #
977
- # @see #load_texture
978
- def release_texture(texture_id)
979
- end
980
-
981
- # The remove_observer method is used to remove an observer from the current
982
- # object.
983
- #
984
- # @example
985
- # view = Sketchup.active_model.active_view
986
- # status = view.remove_observer observer
987
- #
988
- # @param [Object] observer
989
- # An observer.
990
- #
991
- # @return [Boolean] true if successful, false if unsuccessful.
992
- #
993
- # @version SketchUp 6.0
994
- def remove_observer(observer)
995
- end
996
-
997
- # The screen_coords method is used to retrieve the screen coordinates of the
998
- # given point on the screen.
999
- #
1000
- # The x and y values returned correspond to the x and y screen coordinates.
1001
- # Ignore the z values. If the referenced point is not in the current
1002
- # viewport, the x and/or y value may be negative.
1003
- #
1004
- # @example
1005
- # point = view.screen_coords(ORIGIN)
1006
- #
1007
- # @param [Geom::Point3d] point3d
1008
- # A Point3d object.
1009
- #
1010
- # @return [Geom::Point3d] A Point3d containing the screen position
1011
- #
1012
- # @version SketchUp 6.0
1013
- def screen_coords(point3d)
1014
- end
1015
-
1016
- # Set the drawing color for the view based on the direction of a line that you
1017
- # want to draw. These colors will match the axes colors in the SketchUp model
1018
- # (typically blue for straight up and down, etc.)
1019
- #
1020
- # This method is usually invoked within the draw method of a tool.
1021
- #
1022
- # @example
1023
- # view = view.set_color_from_line point1, point2
1024
- #
1025
- # @param [Geom::Point3d] point1
1026
- # Point3d object representing first point in the line.
1027
- #
1028
- # @param [Geom::Point3d] point2
1029
- # Point3d object representing the second point in the line.
1030
- #
1031
- # @return [Sketchup::View] a View object
1032
- #
1033
- # @version SketchUp 6.0
1034
- def set_color_from_line(point1, point2)
1035
- end
1036
-
1037
- # The show_frame method is used to show a frame of an Animation object in the
1038
- # current view.
1039
- #
1040
- # You can supply an optional delay in seconds to wait before showing the next
1041
- # frame. This can be useful to control the speed at which the animation runs.
1042
- #
1043
- # @example
1044
- # status = view.show_frame delay
1045
- #
1046
- # @param [Numeric] delay
1047
- # An optional delay in seconds.
1048
- #
1049
- # @return [Sketchup::View]
1050
- #
1051
- # @version SketchUp 6.0
1052
- def show_frame(delay)
1053
- end
1054
-
1055
- # This method is used to compute the bounds of the text when
1056
- # using {#draw_text}. The bounds are not a tight fit around the top and bottom
1057
- # as they include varying amount of line spacing depending on the font used.
1058
- #
1059
- # The {TextVerticalAlignCenter} option will align the text to the center of the
1060
- # height of the first line, not the whole boundingbox of the text.
1061
- #
1062
- # <b>Example of different vertical alignment and text bounds:</b>
1063
- #
1064
- # rdoc-image:../images/view-draw-text-with-bounds.png
1065
- #
1066
- # @example
1067
- # class ExampleTool
1068
- # TEXT_OPTIONS = {
1069
- # :font => "Arial",
1070
- # :size => 20,
1071
- # :bold => true,
1072
- # :align => TextAlignRight,
1073
- # :align => TextVerticalAlignBaseline
1074
- # }
1075
- #
1076
- # # Since `draw` is called frequently it can be useful to pre-compute and
1077
- # # cache values used by `draw`.
1078
- # def activate
1079
- # @text = "Hello SketchUp"
1080
- # @position = Geom::Point3d.new(200, 200, 0)
1081
- #
1082
- # # Compute text bounds
1083
- # view = Sketchup.active_model.active_view
1084
- # bounds = view.text_bounds(@position, @text, TEXT_OPTIONS)
1085
- #
1086
- # # Compute polygon for the text bounds
1087
- # x1, y1 = bounds.upper_left.to_a
1088
- # x2, y2 = bounds.lower_right.to_a
1089
- # @points = [
1090
- # Geom::Point3d.new(x1, y1),
1091
- # Geom::Point3d.new(x1, y2),
1092
- # Geom::Point3d.new(x2, y2),
1093
- # Geom::Point3d.new(x2, y1),
1094
- # ]
1095
- # end
1096
- #
1097
- # def draw(view)
1098
- # # Draw text bounds
1099
- # view.drawing_color = Sketchup::Color.new(255, 0, 0, 64)
1100
- # view.draw2d(GL_QUADS, @points)
1101
- #
1102
- # # Draw text
1103
- # view.draw_text(@position, @text, TEXT_OPTIONS)
1104
- # end
1105
- # end
1106
- #
1107
- # @note Under Windows the font name must be less than 32 characters - due to
1108
- # system limitations.
1109
- #
1110
- # @option options [String] :font The name of the font to use. If it does not
1111
- # exist on the system, a default font will be used instead.
1112
- #
1113
- # @option options [Integer] :size The size of the font in points
1114
- #
1115
- # @option options [Boolean] :bold Controls the Bold property of the font.
1116
- #
1117
- # @option options [Boolean] :italic Controls the Italic property of the font.
1118
- #
1119
- # @option options [Integer] :align The text alignment, one of the following
1120
- # constants: {TextAlignLeft}, {TextAlignCenter} or {TextAlignRight}.
1121
- #
1122
- # @option options [Integer] :vertical_align The vertical text alignment
1123
- # one of the following constants:
1124
- # {TextVerticalAlignBoundsTop}, {TextVerticalAlignBaseline},
1125
- # {TextVerticalAlignCapHeight} or {TextVerticalAlignCenter}.
1126
- #
1127
- # @param [Geom::Point3d] point
1128
- # A Point3d object representing a 2D coordinate
1129
- # in view space.
1130
- #
1131
- # @param [String] text
1132
- # The text string to draw.
1133
- #
1134
- # @param [Hash] options
1135
- # The text can be customized by providing a hash or
1136
- # named arguments of options.
1137
- #
1138
- # @return [Geom::Bounds2d]
1139
- #
1140
- # @see #draw_text
1141
- #
1142
- # @version SketchUp 2020.0
1143
- def text_bounds(point, text, options = {})
1144
- end
1145
-
1146
- # Set a tooltip to display in the view. This is useful for displaying tooltips
1147
- # in a tool that you write in Ruby.
1148
- #
1149
- # @example
1150
- # tooltip = view.tooltip = string
1151
- #
1152
- # @param [String] string
1153
- # The string tooltip.
1154
- #
1155
- # @return [String] the new tooltip string
1156
- #
1157
- # @version SketchUp 6.0
1158
- def tooltip=(string)
1159
- end
1160
-
1161
- # The vpheight method is used to retrieve the height of the viewport for the
1162
- # view.
1163
- #
1164
- # @example
1165
- # model = Sketchup.active_model
1166
- # view = model.active_view
1167
- # height = view.vpheight
1168
- #
1169
- # @return [Integer] the height of the viewport in pixels.
1170
- #
1171
- # @version SketchUp 6.0
1172
- def vpheight
1173
- end
1174
-
1175
- # The vpwidth method is used to retrieve the width of the viewport for the
1176
- # view.
1177
- #
1178
- # @example
1179
- # width = view.vpwidth
1180
- #
1181
- # @return [Integer] the width of the viewport in pixels.
1182
- #
1183
- # @version SketchUp 6.0
1184
- def vpwidth
1185
- end
1186
-
1187
- # The {#write_image} method is used to write the current view to an image file.
1188
- #
1189
- # @overload write_image(filename, width = view.vpwidth, height = view.vpheight, antialias = false, compression = 1.0)
1190
- #
1191
- # @note Prefer the overload with option hash instead of this variant. This
1192
- # overload is not updated with new options.
1193
- #
1194
- # @example
1195
- # filename => "c:/tmp/write_image.png"
1196
- # antialias => false
1197
- # compression => 0.9
1198
- # model = Sketchup.active_model
1199
- # view = model.active_view
1200
- # view.write_image(filename, 640, 480, antialias, compression)
1201
- #
1202
- # @param [String] filename
1203
- # The filename for the saved image
1204
- # @param [Integer] width
1205
- # Width in pixels, defaults to the current viewport width {#vpwidth}.
1206
- # @param [Integer] height
1207
- # Height in pixels, defaults to the current viewport height {#vpheight}.
1208
- # @param [Boolean] antialias
1209
- # @param [Float] compression
1210
- # Compression factor for JPEG images, between +0.0+ and +1.0+.
1211
- #
1212
- # @overload write_image(options)
1213
- #
1214
- # @example
1215
- # options = {
1216
- # :filename => "c:/tmp/write_image.png",
1217
- # :width => 640,
1218
- # :height => 480,
1219
- # :antialias => false,
1220
- # :compression => 0.9,
1221
- # :transparent => true
1222
- # }
1223
- # model = Sketchup.active_model
1224
- # view = model.active_view
1225
- # view.write_image(options)
1226
- #
1227
- # @version SketchUp 7
1228
- # @param [Hash] options
1229
- # @option options [String] filename The filename for the saved image.
1230
- # @option options [Integer] width (#vpwidth) Width in pixels (max +1600+).
1231
- # @option options [Integer] height (#vpheight) Height in pixels (max +16000+).
1232
- # @option options [Float] scale_factor (1.0) Scaling factor for
1233
- # elements that are viewport dependent, such as text heights, arrow heads,
1234
- # line widths, stipple patterns, etc. (Added in SketchUp 2019.2)
1235
- # @option options [Boolean] antialias (false)
1236
- # @option options [Float] compression (1.0) Compression factor for JPEG,
1237
- # images between +0.0+ and +1.0+.
1238
- # @option options [Boolean] transparent (false) Added in SketchUp 8.
1239
- #
1240
- # @overload write_image(options)
1241
- #
1242
- # It is possible to dump the framebuffer to file by setting +:source+ to
1243
- # +:framebuffer+. When saving the framebuffer only the following options are
1244
- # valid.
1245
- #
1246
- # @example
1247
- # options = {
1248
- # :filename => "c:/tmp/write_image.png",
1249
- # :source => :framebuffer,
1250
- # :compression => 0.9,
1251
- # }
1252
- # model = Sketchup.active_model
1253
- # view = model.active_view
1254
- # view.write_image(options)
1255
- #
1256
- # @version SketchUp 7
1257
- # @param [Hash] options
1258
- # @option options [String] filename The filename for the saved image.
1259
- # @option options [Boolean] source (:image) Set to +:framebuffer+ to dump the
1260
- # current framebuffer.
1261
- # @option options [Float] compression (1.0) Compression factor for JPEG,
1262
- # images between +0.0+ and +1.0+.
1263
- #
1264
- # @return [Boolean]
1265
- #
1266
- # @version SketchUp 6.0
1267
- def write_image(*args)
1268
- end
1269
-
1270
- # The zoom method is used to zoom in or out by some zoom factor.
1271
- #
1272
- # @example
1273
- # view = view.zoom factor
1274
- # view = view.zoom selection
1275
- # view = view.zoom entity
1276
- # view = view.zoom array_of_entities
1277
- #
1278
- # @param [Numeric, Sketchup::Selection, Sketchup::Entity, Array<Sketchup::Entity>] zoom_or_ents
1279
- # A Float zoom factor from 1.0 or larger or an Array or
1280
- # collection of entities to "zoom extents" around.
1281
- #
1282
- # @return [Sketchup::View] the zoomed View object
1283
- #
1284
- # @version SketchUp 6.0
1285
- def zoom(zoom_or_ents)
1286
- end
1287
-
1288
- # The zoom_extents method is used to zoom to the extents about the entire
1289
- # model, as if the user has selected the zoom extents command from the menu.
1290
- #
1291
- # @example
1292
- # view = Sketchup.active_model.active_view
1293
- # new_view = view.zoom_extents
1294
- #
1295
- # @return [Sketchup::View] the zoomed View object
1296
- #
1297
- # @version SketchUp 6.0
1298
- def zoom_extents
1299
- end
1300
-
1301
- end
1
+ # Copyright:: Copyright 2020 Trimble Inc.
2
+ # License:: The MIT License (MIT)
3
+
4
+ # This class contains methods to manipulate the current point of view of the
5
+ # model. The drawing methods here (draw_line, draw_polyline, etc) are meant to
6
+ # be invoked within a tool's Tool.draw method. Calling them outside Tool.draw
7
+ # will have no effect.
8
+ #
9
+ # You access the View by calling the Model.active_view method.
10
+ #
11
+ # @example
12
+ # view = Sketchup.active_model.active_view
13
+ #
14
+ # @version SketchUp 6.0
15
+ class Sketchup::View
16
+
17
+ # Instance Methods
18
+
19
+ # The add_observer method is used to add an observer to the current object.
20
+ #
21
+ # @example
22
+ # view = Sketchup.active_model.active_view
23
+ # status = view.add_observer observer
24
+ #
25
+ # @param [Object] observer
26
+ # An observer.
27
+ #
28
+ # @return [Boolean] true if successful, false if unsuccessful.
29
+ #
30
+ # @version SketchUp 6.0
31
+ def add_observer(observer)
32
+ end
33
+
34
+ # The animation= method is used to set an animation that is displayed for a
35
+ # view. See Animation for details on how to create an animation object.
36
+ #
37
+ # @example
38
+ # animation = ViewSpinner.new
39
+ # model = Sketchup.active_model
40
+ # view = model.active_view
41
+ # anim = view.animation=animation
42
+ # if (anim)
43
+ # UI.messagebox anim
44
+ # else
45
+ # UI.messagebox "Failure"
46
+ # end
47
+ #
48
+ # @param [#nextFrame] animation
49
+ # An Animation object.
50
+ #
51
+ # @return [#nextFrame] the newly set Animation object
52
+ #
53
+ # @version SketchUp 6.0
54
+ def animation=(animation)
55
+ end
56
+
57
+ # The average_refresh_time is used to set the average time used to refresh the
58
+ # current model in the view. This can be used to estimate the frame rate for
59
+ # an animation.
60
+ #
61
+ # @example
62
+ # model = Sketchup.active_model
63
+ # view = model.active_view
64
+ # time = view.average_refresh_time
65
+ #
66
+ # @return [Float] the time in seconds
67
+ #
68
+ # @version SketchUp 6.0
69
+ def average_refresh_time
70
+ end
71
+
72
+ # The camera method is used to retrieve the camera for the view.
73
+ #
74
+ # @example
75
+ # camera = view.camera
76
+ #
77
+ # @return [Sketchup::Camera] a Camera object
78
+ #
79
+ # @version SketchUp 6.0
80
+ def camera
81
+ end
82
+
83
+ # The {#camera=} method is used to set the camera for the view. If a transition
84
+ # time is given, then it will animate the transition from the current camera
85
+ # to the new one.
86
+ #
87
+ # @example
88
+ # camera = Sketchup::Camera.new([5, 5, 9], [5, 10, 0], Z_AXIS)
89
+ # view = Sketchup.active_model.active_view
90
+ # view.camera = camera
91
+ #
92
+ # @overload camera=(camera)
93
+ #
94
+ # @param camera [Sketchup::Camera] The new Camera object.
95
+ # @return [Sketchup::Camera]
96
+ #
97
+ # @overload camera=(camera_and_transition)
98
+ #
99
+ # @param camera_and_transition [Array(Sketchup::Camera, Float)]
100
+ # The second item in the array represents the transition time from the
101
+ # existing camera to the new one
102
+ # @return [Array(Sketchup::Camera, Float)]
103
+ #
104
+ # @version SketchUp 6.0
105
+ def camera=(arg)
106
+ end
107
+
108
+ # The center method is used to retrieve the coordinates of the center of the
109
+ # view in pixels. It is returned as an array of 2 values for x and y.
110
+ #
111
+ # @example
112
+ # model = Sketchup.active_model
113
+ # view = model.active_view
114
+ # c = view.center
115
+ #
116
+ # @return [Geom::Point3d] the center of the view
117
+ #
118
+ # @version SketchUp 6.0
119
+ def center
120
+ end
121
+
122
+ # The corner method is used to retrieve the coordinates of one of the corners
123
+ # of the view. The argument is an index between 0 and 3 that identifies which
124
+ # corner you want. This method returns an array with two integers which are
125
+ # the coordinates of the corner of the view in the view space. If the view
126
+ # uses a Camera with a fixed aspect ratio, then the corners are the corners of
127
+ # the viewing are of the camera which might be different than the actual
128
+ # corners of the view itself.
129
+ #
130
+ # The index numbers are as follows:
131
+ # - 0: top left,
132
+ # - 1: top right,
133
+ # - 2: bottom left,
134
+ # - 3: bottom right.
135
+ #
136
+ # @example
137
+ # point = view.corner index
138
+ #
139
+ # @param [Integer] index
140
+ # A value between (or including) 0 and 3 identifying the
141
+ # corner whose coordinate you want to retrieve.
142
+ #
143
+ # @return [Array(Integer, Integer)] a 2d array [w,h] representing the screen point
144
+ #
145
+ # @version SketchUp 6.0
146
+ def corner(index)
147
+ end
148
+
149
+ # The {#draw} method is used to do basic drawing. This method can only be
150
+ # called from within the {Tool#draw} method of a tool that you implement in
151
+ # Ruby.
152
+ #
153
+ # The following constants are all OpenGL terms and have been externalized to
154
+ # Ruby. Here is a summary of their meanings:
155
+ #
156
+ # [GL_POINTS]
157
+ # Treats each vertex as a single point. Vertex n defines point n. N
158
+ # points are drawn.
159
+ #
160
+ # [GL_LINES]
161
+ # Treats each pair of vertices as
162
+ # an independent line segment. Vertices 2n-1 and 2n define line n. N/2 lines
163
+ # are drawn.
164
+ #
165
+ # [GL_LINE_STRIP]
166
+ # Draws a connected group of line
167
+ # segments from the first vertex to the last. Vertices n and n+1 define
168
+ # line n. N-1 lines are drawn.
169
+ #
170
+ # [GL_LINE_LOOP]
171
+ # Draws a connected group of line segments from the first vertex to the last,
172
+ # then back to the first. Vertices n and n+1 define line n. The last line,
173
+ # however, is defined by vertices N and 1. N lines are drawn.
174
+ #
175
+ # [GL_TRIANGLES]
176
+ # Treats each triplet of vertices as an independent
177
+ # triangle. Vertices 3n-2, 3n-1, and 3n define triangle n. N/3 triangles are
178
+ # drawn.
179
+ #
180
+ # [GL_TRIANGLE_STRIP]
181
+ # Draws a connected group of triangles. One triangle is defined for each
182
+ # vertex presented after the first two vertices. For odd n, vertices n, n+1,
183
+ # and n+2 define triangle n. For even n, vertices n+1, n, and n+2 define
184
+ # triangle n. N-2 triangles are drawn.
185
+ #
186
+ # [GL_TRIANGLE_FAN]
187
+ # Draws a connected group of triangles.
188
+ # One triangle is defined for each vertex presented after the first two
189
+ # vertices. Vertices 1, n+1, and n+2 define triangle n. N-2 triangles are
190
+ # drawn.
191
+ #
192
+ # [GL_QUADS]
193
+ # Treats each group of four vertices as an
194
+ # independent quadrilateral. Vertices 4n-3, 4n-2, 4n-1, and 4n define
195
+ # quadrilateral n. N/4 quadrilaterals are drawn.
196
+ #
197
+ # [GL_QUAD_STRIP]
198
+ # Draws a connected group of quadrilaterals. One quadrilateral is
199
+ # defined for each pair of vertices presented after the first pair.
200
+ # Vertices 2n-1, 2n, 2n+2, and 2n+1 define quadrilateral n. N/2-1
201
+ # quadrilaterals are drawn. Note that the order in which vertices are used to
202
+ # construct a quadrilateral from strip data is different from that used with
203
+ # independent data.
204
+ #
205
+ # [GL_POLYGON]
206
+ # Draws a single, convex polygon. Vertices 1
207
+ # through N define this polygon.
208
+ #
209
+ # @example
210
+ # points = [
211
+ # Geom::Point3d.new(0, 0, 0),
212
+ # Geom::Point3d.new(9, 0, 0),
213
+ # Geom::Point3d.new(9, 9, 0),
214
+ # Geom::Point3d.new(0, 9, 0)
215
+ # ]
216
+ # view.draw(GL_LINE_LOOP, points)
217
+ #
218
+ # @note If you draw outside the model bounds you need to implement
219
+ # {Tool#getExtents} which returns a bounding box large enough to include the
220
+ # points you draw. Otherwise your drawing will be clipped.
221
+ #
222
+ # @overload draw(openglenum, points)
223
+ #
224
+ # @param [Integer] openglenum
225
+ # The item you are going to draw, one of the constants
226
+ # from the comments, such as +GL_LINES+.
227
+ # @param [Array<Geom::Point3d>] points
228
+ #
229
+ # @overload draw(openglenum, *points)
230
+ #
231
+ # @param [Integer] openglenum
232
+ # The item you are going to draw, one of the constants
233
+ # from the comments, such as +GL_LINES+.
234
+ # @param [Array<Geom::Point3d>] points
235
+ #
236
+ # @overload draw(openglenum, points, **options)
237
+ #
238
+ # @version SketchUp 2020.0
239
+ # @param [Integer] openglenum
240
+ # The item you are going to draw, one of the constants
241
+ # from the comments, such as +GL_LINES+.
242
+ # @param [Array<Geom::Point3d>] points
243
+ # @param [Hash] options
244
+ # @option options [Array<Geom::Vector3d>] :normals
245
+ # Without normals the polygons will be rendered with flat shading. No
246
+ # light will affect it. By providing an array of vertex normals lighting
247
+ # is turned on and will use the model's current light. Note that the number
248
+ # of normals must match the number of points provided.
249
+ # @option options [Integer] :texture_id
250
+ # A texture id provided by {#load_texture}.
251
+ # @option options [Array<Geom::Vector3d>] :uvs
252
+ # Set of UV (Not UVQ) coordinates matching the number of points provided.
253
+ # This must be used along with the +:texture_id+ option.
254
+ #
255
+ # @overload draw(openglenum, *points, **options)
256
+ #
257
+ # @version SketchUp 2020.0
258
+ # @param [Integer] openglenum
259
+ # The item you are going to draw, one of the constants
260
+ # from the comments, such as +GL_LINES+.
261
+ # @param [Array<Geom::Point3d>] points
262
+ # @param [Hash] options
263
+ # @option options [Array<Geom::Vector3d>] :normals ([])
264
+ # Without normals the polygons will be rendered with flat shading. No
265
+ # light will affect it. By providing an array of vertex normals lighting
266
+ # is turned on and will use the model's current light. Note that the number
267
+ # of normals must match the number of points provided.
268
+ # @option options [Integer] :texture_id
269
+ # A texture id provided by {#load_texture}.
270
+ # @option options [Array<Geom::Vector3d>] :uvs
271
+ # Set of UV (Not UVQ) coordinates matching the number of points provided.
272
+ # This must be used along with the +:texture_id+ option.
273
+ #
274
+ # @return [Sketchup::View]
275
+ #
276
+ # @see Tool#getExtents
277
+ #
278
+ # @version SketchUp 6.0
279
+ def draw(*args)
280
+ end
281
+
282
+ # The {#draw2d} method is used to draw in screen space (using 2D screen
283
+ # coordinates) instead of 3D space.
284
+ #
285
+ # The second parameter is an {Array} of {Geom::Point3d} objects (or several
286
+ # individual {Geom::Point3d} objects). These {Geom::Point3d} objects are in
287
+ # screen space, not 3D space.
288
+ # The X value corresponds to the number of pixels from the left edge of the
289
+ # drawing area. The Y value corresponds to the number of pixels down from
290
+ # the top of the drawing area. The Z value is not used.
291
+ #
292
+ # @example
293
+ # points = [
294
+ # Geom::Point3d.new(0, 0, 0),
295
+ # Geom::Point3d.new(8, 0, 0),
296
+ # Geom::Point3d.new(8, 4, 0),
297
+ # Geom::Point3d.new(0, 4, 0)
298
+ # ]
299
+ # view.draw2d(GL_LINE_STRIP, points)
300
+ #
301
+ # @overload draw2d(openglenum, points)
302
+ #
303
+ # @param [Integer] openglenum
304
+ # The item you are going to draw, one of the constants
305
+ # from the comments, such as +GL_LINES+.
306
+ # @param [Array<Geom::Point3d>] points
307
+ #
308
+ # @overload draw2d(openglenum, *points)
309
+ #
310
+ # @param [Integer] openglenum
311
+ # The item you are going to draw, one of the constants
312
+ # from the comments, such as +GL_LINES+.
313
+ # @param [Array<Geom::Point3d>] points
314
+ #
315
+ # @overload draw2d(openglenum, points, **options)
316
+ #
317
+ # @version SketchUp 2020.0
318
+ # @param [Integer] openglenum
319
+ # The item you are going to draw, one of the constants
320
+ # from the comments, such as +GL_LINES+.
321
+ # @param [Array<Geom::Point3d>] points
322
+ # @param [Hash] options
323
+ # @option options [Integer] :texture_id
324
+ # A texture id provided by {#load_texture}.
325
+ # @option options [Array<Geom::Vector3d>] :uvs
326
+ # Set of UV (Not UVQ) coordinates matching the number of points provided.
327
+ # This must be used along with the +:texture_id+ option.
328
+ #
329
+ # @overload draw2d(openglenum, *points, **options)
330
+ #
331
+ # @version SketchUp 2020.0
332
+ # @param [Integer] openglenum
333
+ # The item you are going to draw, one of the constants
334
+ # from the comments, such as +GL_LINES+.
335
+ # @param [Array<Geom::Point3d>] points
336
+ # @param [Hash] options
337
+ # @option options [Integer] :texture_id
338
+ # A texture id provided by {#load_texture}.
339
+ # @option options [Array<Geom::Vector3d>] :uvs
340
+ # Set of UV (Not UVQ) coordinates matching the number of points provided.
341
+ # This must be used along with the +:texture_id+ option.
342
+ #
343
+ # @return [Sketchup::View]
344
+ #
345
+ # @see #draw
346
+ #
347
+ # @see UI.scale_factor
348
+ #
349
+ # @version SketchUp 6.0
350
+ def draw2d(*args)
351
+ end
352
+
353
+ # The draw_lines method is used to draw disconnected lines.
354
+ #
355
+ # You must have an even number of points. This method is usually invoked
356
+ # within the draw method of a tool.
357
+ #
358
+ # @example
359
+ # point4 = Geom::Point3d.new 0,0,0
360
+ # point5 = Geom::Point3d.new 100,100,100
361
+ # # returns a view
362
+ # status = view.drawing_color="red"
363
+ # status = view.draw_lines point4, point5
364
+ #
365
+ # @overload draw_lines(point_list, ...)
366
+ #
367
+ # @param point_list [Array<Geom::Point3d>] An even number of Point3d objects.
368
+ # @return [Sketchup::View] returns the View object
369
+ #
370
+ # @overload draw_lines(pts)
371
+ #
372
+ # @param pts [Array<Geom::Point3d>] An array of Point3d objects.
373
+ # @return [Sketchup::View] returns the View object
374
+ #
375
+ # @version SketchUp 6.0
376
+ def draw_line(*args)
377
+ end
378
+
379
+ # The draw_lines method is used to draw disconnected lines.
380
+ #
381
+ # You must have an even number of points. This method is usually invoked
382
+ # within the draw method of a tool.
383
+ #
384
+ # @example
385
+ # point4 = Geom::Point3d.new 0,0,0
386
+ # point5 = Geom::Point3d.new 100,100,100
387
+ # # returns a view
388
+ # status = view.drawing_color="red"
389
+ # status = view.draw_lines point4, point5
390
+ #
391
+ # @overload draw_lines(point_list, ...)
392
+ #
393
+ # @param point_list [Array<Geom::Point3d>] An even number of Point3d objects.
394
+ # @return [Sketchup::View] returns the View object
395
+ #
396
+ # @overload draw_lines(pts)
397
+ #
398
+ # @param pts [Array<Geom::Point3d>] An array of Point3d objects.
399
+ # @return [Sketchup::View] returns the View object
400
+ #
401
+ # @version SketchUp 6.0
402
+ def draw_lines(*args)
403
+ end
404
+
405
+ # This method is used to draw points.
406
+ #
407
+ # This method is usually invoked within the draw method of a tool.
408
+ #
409
+ # @example
410
+ # point3 = Geom::Point3d.new 0,0,0
411
+ # # returns a view
412
+ # status = view.draw_points point3, 10, 1, "red"
413
+ #
414
+ # @param [Array<Geom::Point3d>] pts
415
+ # An array of Point3d objects.
416
+ #
417
+ # @param [Integer] pointsize
418
+ # Size of the point in pixels.
419
+ #
420
+ # @param [Sketchup::Color] pointcolor
421
+ # Color of the point.
422
+ #
423
+ # @param [Integer] pointstyle
424
+ # Style of the point. 1 = open square,
425
+ # 2 = filled square, 3 = "+", 4 = "X", 5 = "*",
426
+ # 6 = open triangle, 7 = filled triangle.
427
+ #
428
+ # @return [Sketchup::View] a View object
429
+ #
430
+ # @version SketchUp 6.0
431
+ def draw_points(pts, pointsize = 6, pointstyle = 3, pointcolor = 'black')
432
+ end
433
+
434
+ # The draw_polyline method is used to draw a series of connected line segments
435
+ # from pt1 to pt2 to pt3, and so on.
436
+ #
437
+ # This method is usually invoked within the draw method of a tool.
438
+ #
439
+ # @example
440
+ # point12 = Geom::Point3d.new 0,0,0
441
+ # point13 = Geom::Point3d.new 10,10,10
442
+ # point14 = Geom::Point3d.new 20,20,20
443
+ # point15 = Geom::Point3d.new 30,30,30
444
+ # status = view.draw_polyline point12, point13, point14, point15
445
+ #
446
+ # @overload draw_polyline(point_list, ...)
447
+ #
448
+ # @param point_list [Array<Geom::Point3d>] An even number of Point3d objects.
449
+ # @return [Sketchup::View] a View object
450
+ #
451
+ # @overload draw_polyline(pts)
452
+ #
453
+ # @param pts [Array<Geom::Point3d>] An array of Point3d objects.
454
+ # @return [Sketchup::View] a View object
455
+ #
456
+ # @version SketchUp 6.0
457
+ def draw_polyline(*args)
458
+ end
459
+
460
+ # This method is used to draw text on the screen and is usually invoked within
461
+ # the draw method of a tool.
462
+ #
463
+ # The {TextVerticalAlignCenter} option will align the text to the center of the
464
+ # height of the first line, not the whole boundingbox of the text. To align
465
+ # around the full bounds of the text, use {#text_bounds} to compute the
466
+ # desired alignment.
467
+ #
468
+ # <b>Example of different vertical alignment and text bounds:</b>
469
+ #
470
+ # rdoc-image:../images/view-draw-text-with-bounds.png
471
+ #
472
+ # @example
473
+ # class ExampleTool
474
+ # def draw(view)
475
+ # # This works in all SketchUp versions and draws the text using the
476
+ # # default font, color and size.
477
+ # point = Geom::Point3d.new(200, 100, 0)
478
+ # view.draw_text(point, "This is a test")
479
+ #
480
+ # # This works in SketchUp 2016 and up.
481
+ # options = {
482
+ # :font => "Arial",
483
+ # :size => 20,
484
+ # :bold => true,
485
+ # :align => TextAlignRight
486
+ # }
487
+ # point = Geom::Point3d.new(200, 200, 0)
488
+ # view.draw_text(point, "This is another\ntest", options)
489
+ #
490
+ # # You can also use Ruby 2.0's named arguments:
491
+ # point = Geom::Point3d.new(200, 200, 0)
492
+ # view.draw_text(point, "Hello world!", color: "Red")
493
+ # end
494
+ # end
495
+ #
496
+ # @example Cross Platform Font Size
497
+ # class ExampleTool
498
+ # IS_WIN = Sketchup.platform == :platform_win
499
+ #
500
+ # def draw(view)
501
+ # draw_text(view, [100, 200, 0], "Hello World", size: 20)
502
+ # end
503
+ #
504
+ # private
505
+ #
506
+ # # This will ensure text is drawn with consistent size across platforms,
507
+ # # using pixels as size units.
508
+ # def draw_text(view, position, text, **options)
509
+ # native_options = options.dup
510
+ # if IS_WIN && options.key?(:size)
511
+ # native_options[:size] = pixels_to_points(size)
512
+ # end
513
+ # view.draw_text(position, text, **native_options)
514
+ # end
515
+ #
516
+ # def pixels_to_points(pixels)
517
+ # ((pixels.to_f / 96.0) * 72.0).round
518
+ # end
519
+ # end
520
+ #
521
+ # @note Under Windows the font name must be less than 32 characters - due to
522
+ # system limitations.
523
+ #
524
+ # @note As of SU2017 this will automatically scale the font-size by the same
525
+ # factor as {UI.scale_factor}.
526
+ #
527
+ # @note The font size is platform dependent. On Windows the method expects
528
+ # points, where on Mac it's pixels. See "Cross Platform Font Size" example
529
+ # for details.
530
+ #
531
+ # @overload draw_text(point, text)
532
+ #
533
+ # @param [Geom::Point3d] point A Point3d object representing a 2D coordinate
534
+ # in view space.
535
+ # @param [String] text The text string to draw.
536
+ #
537
+ # @overload draw_text(point, text, options = {})
538
+ #
539
+ # @version SketchUp 2016
540
+ # @param [Geom::Point3d] point A Point3d object representing a 2D coordinate
541
+ # in view space.
542
+ # @param [String] text The text string to draw.
543
+ # @param [Hash] options The text can be customized by providing a hash or
544
+ # named arguments of options.
545
+ # @option options [String] :font The name of the font to use. If it does not
546
+ # exist on the system, a default font will be used instead.
547
+ # @option options [Integer] :size The size of the font in points
548
+ # @option options [Boolean] :bold Controls the Bold property of the font.
549
+ # @option options [Boolean] :italic Controls the Italic property of the font.
550
+ # @option options [Sketchup::Color] :color The color to draw the text with.
551
+ # @option options [Integer] :align The text alignment, one of the following
552
+ # constants: {TextAlignLeft}, {TextAlignCenter} or {TextAlignRight}.
553
+ # @option options [Integer] :vertical_align <b>Added SketchUp 2020.0.</b>
554
+ # The vertical text alignment, one of the following constants:
555
+ # {TextVerticalAlignBoundsTop}, {TextVerticalAlignBaseline},
556
+ # {TextVerticalAlignCapHeight} or {TextVerticalAlignCenter}. Note that
557
+ # some fonts on Mac might not align as expected due to the system
558
+ # reporting incorrect font metrics.
559
+ #
560
+ # @return [Sketchup::View]
561
+ #
562
+ # @version SketchUp 6.0
563
+ def draw_text(*args)
564
+ end
565
+
566
+ # The drawing_color method is used to set the color that is used for drawing
567
+ # to the view.
568
+ #
569
+ # This method is usually invoked within the draw method of a tool.
570
+ #
571
+ # @example
572
+ # view = view.drawing_color = color
573
+ #
574
+ # @param [Sketchup::Color, String] color
575
+ # A Color object.
576
+ #
577
+ # @return [Sketchup::View]
578
+ #
579
+ # @version SketchUp 6.0
580
+ def drawing_color=(color)
581
+ end
582
+
583
+ # The dynamic= method allows you to degrade visual quality while improving
584
+ # performance when a model is large and view refresh time is slow. For
585
+ # example, if you were using a Ruby script to animate the camera through
586
+ # a large scene, you may want to set dynamic to true during that time.
587
+ #
588
+ # See also camera.rb which is part of the film and stage ruby
589
+ # scripts.
590
+ #
591
+ # @deprecated This method is no longer doing anything.
592
+ #
593
+ # @example
594
+ # view.dynamic = true
595
+ #
596
+ # @param [Boolean] value
597
+ #
598
+ # @return [Boolean]
599
+ #
600
+ # @version SketchUp 6.0
601
+ def dynamic=(value)
602
+ end
603
+
604
+ # The field_of_view method is used get the view's field of view setting, in
605
+ # degrees.
606
+ #
607
+ # @example
608
+ # fov = Sketchup.active_model.active_view.field_of_view
609
+ #
610
+ # @return [Float] the field of view
611
+ #
612
+ # @version SketchUp 6.0
613
+ def field_of_view
614
+ end
615
+
616
+ # The field_of_view= method is used set the view's field of view setting,
617
+ # in degrees.
618
+ #
619
+ # @example
620
+ # my_view = Sketchup.active_model.active_view
621
+ # my_view.field_of_view = 45
622
+ # my_view.invalidate
623
+ #
624
+ # @param [Numeric] fov
625
+ # the field of view
626
+ #
627
+ # @return [Numeric]
628
+ #
629
+ # @version SketchUp 6.0
630
+ def field_of_view=(fov)
631
+ end
632
+
633
+ # The guess_target method is used to guess at what the user is looking at when
634
+ # you have a perspective view.
635
+ #
636
+ # This method is useful when writing a viewing tool. See also camera.rb which
637
+ # is part of the film and stage ruby scripts.
638
+ #
639
+ # @example
640
+ # target = view.guess_target
641
+ #
642
+ # @return [Geom::Point3d] a Point3d object representing the point in the
643
+ # model that the user is likely interested in.
644
+ #
645
+ # @version SketchUp 6.0
646
+ def guess_target(*args)
647
+ end
648
+
649
+ # The inference_locked? method is used to determine if inference locking is on
650
+ # for the view.
651
+ #
652
+ # @example
653
+ # model = Sketchup.active_model
654
+ # view = model.active_view
655
+ # status = view.inference_locked
656
+ #
657
+ # @return [Boolean]
658
+ #
659
+ # @version SketchUp 6.0
660
+ def inference_locked?
661
+ end
662
+
663
+ # The inputpoint method is used to retrieve an input point.
664
+ #
665
+ # This will normally be used inside one of the mouse event handling methods in
666
+ # a tool. Usually, it is preferable to create the InputPoint first and then
667
+ # use the pick method on it.
668
+ #
669
+ # @example
670
+ # inputpoint = view.inputpoint x, y, inputpoint1
671
+ #
672
+ # @param [Numeric] x
673
+ # A x value.
674
+ #
675
+ # @param [Numeric] y
676
+ # A y value.
677
+ #
678
+ # @param [Sketchup::InputPoint] inputpoint1
679
+ # An InputPoint object.
680
+ #
681
+ # @return [Sketchup::InputPoint]
682
+ #
683
+ # @version SketchUp 6.0
684
+ def inputpoint(x, y, inputpoint1)
685
+ end
686
+
687
+ # The invalidate method is used mark the view as in need of a redraw.
688
+ #
689
+ # @example
690
+ # model = Sketchup.active_model
691
+ # view = model.active_view
692
+ # invalidated_view = view.invalidate
693
+ #
694
+ # @note This is the preferred method to update the viewport. Use this before
695
+ # trying to use {#refresh}.
696
+ #
697
+ # @return [Sketchup::View] the invalidated View object
698
+ #
699
+ # @version SketchUp 6.0
700
+ def invalidate
701
+ end
702
+
703
+ # The last_refresh_time method is used to retrieve the time for the last full
704
+ # view refresh.
705
+ #
706
+ # @example
707
+ # time = view.last_refresh_time
708
+ #
709
+ # @return [Float] time in milliseconds
710
+ #
711
+ # @version SketchUp 6.0
712
+ def last_refresh_time(*args)
713
+ end
714
+
715
+ # The line_stipple= method is used to set the line pattern to use for drawing.
716
+ # The stipple pattern is given as a string.
717
+ # Valid strings are:
718
+ # "." (Dotted Line),
719
+ # "-" (Short Dashes Line),
720
+ # "_" (Long Dashes Line),
721
+ # "-.-" (Dash Dot Dash Line),
722
+ # "" (Solid Line).
723
+ #
724
+ # This method is usually invoked within the draw method of a tool.
725
+ #
726
+ # @example
727
+ # point8 = Geom::Point3d.new 0,0,0
728
+ # point9 = Geom::Point3d.new 100,100,100
729
+ # view.line_stipple = "-.-"
730
+ # view = view.draw_lines point8, point9
731
+ #
732
+ # @param [String] pattern
733
+ # A string stipple pattern, such as "-.-"
734
+ #
735
+ # @return [Sketchup::View] the View object
736
+ #
737
+ # @version SketchUp 6.0
738
+ def line_stipple=(pattern)
739
+ end
740
+
741
+ # The line_width= method is used to set the line width to use for drawing. The
742
+ # value is a Double indicating the desired width in pixels.
743
+ #
744
+ # This method is usually invoked within the draw method of a tool.
745
+ #
746
+ # @example
747
+ # view.line_width = width
748
+ #
749
+ # @note As of SU2017 this will automatically scale the line width by the same
750
+ # factor as {UI.scale_factor}.
751
+ #
752
+ # @param [Integer] width
753
+ # The width in pixels.
754
+ #
755
+ # @return [Integer]
756
+ #
757
+ # @version SketchUp 6.0
758
+ def line_width=(width)
759
+ end
760
+
761
+ # Loads a texture to be drawn with {#draw} or {#draw2d}.
762
+ #
763
+ # @example
764
+ # module Example
765
+ # class MyTool
766
+ #
767
+ # def activate
768
+ # view = Sketchup.active_model.active_view
769
+ # image_rep = view.model.materials.current.texture.image_rep
770
+ # @texture_id = view.load_texture(image_rep)
771
+ # end
772
+ #
773
+ # def deactivate(view)
774
+ # view.release_texture(@texture_id)
775
+ # end
776
+ #
777
+ # def draw(view)
778
+ # points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
779
+ # uvs = [ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] ]
780
+ # view.draw(points, texture_id: @texture_id, uvs: uvs)
781
+ # end
782
+ #
783
+ # end
784
+ # end
785
+ # Sketchup.active_model.select_tool(Example::MyTool.new)
786
+ #
787
+ # @note To conserve resources on the user's machine, textures can be loaded
788
+ # only when there is a Ruby tool on the tool stack. Make sure to release the
789
+ # texture when it's no longer needed. Any textures not already released
790
+ # when the last Ruby tool on the tool stack is removed will be automatically
791
+ # released by SketchUp.
792
+ #
793
+ # @note Avoid loading and releasing textures within the {Sketchup::Tool#draw}
794
+ # event as that is not efficient.
795
+ #
796
+ # @param [Sketchup::ImageRep] image_rep
797
+ #
798
+ # @raise [ArgumentError] if the provided {Sketchup::ImageRep} is not valid.
799
+ #
800
+ # @raise [RuntimeError] if a Ruby tool was not on the tool stack.
801
+ #
802
+ # @return [Integer] A resource ID referring to the image loaded.
803
+ #
804
+ # @see #release_texture
805
+ #
806
+ # @see #draw
807
+ def load_texture(image_rep)
808
+ end
809
+
810
+ # The lock_inference method is used to lock or unlock an inference.
811
+ #
812
+ # This method will typically be called from inside a tool class when the user
813
+ # presses the shift key.
814
+ #
815
+ # With no arguments it unlocks all inferences. With one or two arguments, it
816
+ # locks the inference based on the given InputPoint(s).
817
+ #
818
+ # @example
819
+ # view = view.lock_inference
820
+ # view = view.lock_inference(inputpoint)
821
+ # view = view.lock_inference(inputpoint1, inputpoint2)
822
+ #
823
+ # @overload lock_inference
824
+ #
825
+ #
826
+ # @overload lock_inference(inputpoint)
827
+ #
828
+ # @param [Sketchup::InputPoint] inputpoint
829
+ # 1st InputPoint to inference to.
830
+ #
831
+ # @overload lock_inference(inputpoint, inputpoint2)
832
+ #
833
+ # @param [Sketchup::InputPoint] inputpoint
834
+ # 1st InputPoint to inference to.
835
+ # @param [Sketchup::InputPoint] inputpoint2
836
+ # 2nd InputPoint to inference to.
837
+ #
838
+ # @return [Sketchup::View] a View object
839
+ #
840
+ # @version SketchUp 6.0
841
+ def lock_inference(*args)
842
+ end
843
+
844
+ # The model method is used to retrieve the model for the current view.
845
+ #
846
+ # @example
847
+ # model = view.model
848
+ #
849
+ # @return [Sketchup::Model] the model for this view
850
+ #
851
+ # @version SketchUp 6.0
852
+ def model
853
+ end
854
+
855
+ # The pick_helper method is used to retrieve a pick helper for the view. See
856
+ # the PickHelper class for information on pick helpers.
857
+ #
858
+ # This call returns an initialized PickHelper.
859
+ #
860
+ # @example
861
+ # model = Sketchup.active_model
862
+ # view = model.active_view
863
+ # ph = view.pick_helper
864
+ #
865
+ # @overload pick_helper
866
+ #
867
+ # @return [Sketchup::PickHelper] a PickHelper object
868
+ #
869
+ # @overload pick_helper(x, y, aperture = 0)
870
+ #
871
+ # @param [Integer] x
872
+ # @param [Integer] y
873
+ # @param [Integer] aperture
874
+ # @return [Sketchup::PickHelper] a PickHelper object
875
+ #
876
+ # @version SketchUp 6.0
877
+ def pick_helper(*args)
878
+ end
879
+
880
+ # The pickray method is used to retrieve a ray passing through a given screen
881
+ # position in the viewing direction.
882
+ #
883
+ # @example
884
+ # ray = view.pickray x, y
885
+ #
886
+ # @overload pickray(screen_point)
887
+ #
888
+ # @param [Array(Integer, Integer)] screen_point
889
+ # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
890
+ #
891
+ # @overload pickray(x, y)
892
+ #
893
+ # @param [Integer] x
894
+ # @param [Integer] y
895
+ # @return [Array(Geom::Point3d, Geom::Vector3d)] a ray
896
+ #
897
+ # @version SketchUp 6.0
898
+ def pickray(*args)
899
+ end
900
+
901
+ # The pixels_to_model method is used to compute a model size from a pixel size
902
+ # at a given point.
903
+ #
904
+ # This method is useful for deciding how big to draw something based on a
905
+ # desired size in pixels.
906
+ #
907
+ # @example
908
+ # size = view.pixels_to_model(pixels, point)
909
+ #
910
+ # @note As of SU2017 this will automatically scale the pixel-size by the same
911
+ # factor as {UI.scale_factor}.
912
+ #
913
+ # @param [Numeric] pixels
914
+ # The pixel size.
915
+ #
916
+ # @param [Geom::Point3d] point
917
+ # A Point3d object where the size will be calculated from.
918
+ #
919
+ # @return [Float] the model size
920
+ #
921
+ # @version SketchUp 6.0
922
+ def pixels_to_model(pixels, point)
923
+ end
924
+
925
+ # The refresh method is used to immediately force a redraw of the view.
926
+ #
927
+ # @example
928
+ # model = Sketchup.active_model
929
+ # view = model.active_view
930
+ # refreshed_view = view.refresh
931
+ #
932
+ # @note This method might impact performance and if used incorrectly cause
933
+ # instability or crashes. Don't use this unless you have verified that
934
+ # you cannot use {#invalidate} instead.
935
+ #
936
+ # @return [Sketchup::View] the refreshed View object
937
+ #
938
+ # @version SketchUp 7.1
939
+ def refresh
940
+ end
941
+
942
+ # Releases a texture loaded via {#load_texture}, freeing up it's memory.
943
+ # It's good practice to do so whenever there is no longer any need for the
944
+ # resource.
945
+ #
946
+ # For example, when your tool deactivates you probably want to release your
947
+ # resources as you don't know if your tool will be used again.
948
+ #
949
+ # @example
950
+ # module Example
951
+ # class MyTool
952
+ #
953
+ # def activate
954
+ # view = Sketchup.active_model.active_view
955
+ # image_rep = view.model.materials.current.texture.image_rep
956
+ # @texture_id = view.load_texture(image_rep)
957
+ # end
958
+ #
959
+ # def deactivate(view)
960
+ # view.release_texture(@texture_id)
961
+ # end
962
+ #
963
+ # def draw(view)
964
+ # points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
965
+ # uvs = [ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] ]
966
+ # view.draw(points, texture_id: @texture_id, uvs: uvs)
967
+ # end
968
+ #
969
+ # end
970
+ # end
971
+ # Sketchup.active_model.select_tool(Example::MyTool.new)
972
+ #
973
+ # @param [Integer] texture_id
974
+ #
975
+ # @return [Boolean] +true+ if texture was released. +false+ otherwise.
976
+ #
977
+ # @see #load_texture
978
+ def release_texture(texture_id)
979
+ end
980
+
981
+ # The remove_observer method is used to remove an observer from the current
982
+ # object.
983
+ #
984
+ # @example
985
+ # view = Sketchup.active_model.active_view
986
+ # status = view.remove_observer observer
987
+ #
988
+ # @param [Object] observer
989
+ # An observer.
990
+ #
991
+ # @return [Boolean] true if successful, false if unsuccessful.
992
+ #
993
+ # @version SketchUp 6.0
994
+ def remove_observer(observer)
995
+ end
996
+
997
+ # The screen_coords method is used to retrieve the screen coordinates of the
998
+ # given point on the screen.
999
+ #
1000
+ # The x and y values returned correspond to the x and y screen coordinates.
1001
+ # Ignore the z values. If the referenced point is not in the current
1002
+ # viewport, the x and/or y value may be negative.
1003
+ #
1004
+ # @example
1005
+ # point = view.screen_coords(ORIGIN)
1006
+ #
1007
+ # @param [Geom::Point3d] point3d
1008
+ # A Point3d object.
1009
+ #
1010
+ # @return [Geom::Point3d] A Point3d containing the screen position
1011
+ #
1012
+ # @version SketchUp 6.0
1013
+ def screen_coords(point3d)
1014
+ end
1015
+
1016
+ # Set the drawing color for the view based on the direction of a line that you
1017
+ # want to draw. These colors will match the axes colors in the SketchUp model
1018
+ # (typically blue for straight up and down, etc.)
1019
+ #
1020
+ # This method is usually invoked within the draw method of a tool.
1021
+ #
1022
+ # @example
1023
+ # view = view.set_color_from_line point1, point2
1024
+ #
1025
+ # @param [Geom::Point3d] point1
1026
+ # Point3d object representing first point in the line.
1027
+ #
1028
+ # @param [Geom::Point3d] point2
1029
+ # Point3d object representing the second point in the line.
1030
+ #
1031
+ # @return [Sketchup::View] a View object
1032
+ #
1033
+ # @version SketchUp 6.0
1034
+ def set_color_from_line(point1, point2)
1035
+ end
1036
+
1037
+ # The show_frame method is used to show a frame of an Animation object in the
1038
+ # current view.
1039
+ #
1040
+ # You can supply an optional delay in seconds to wait before showing the next
1041
+ # frame. This can be useful to control the speed at which the animation runs.
1042
+ #
1043
+ # @example
1044
+ # status = view.show_frame delay
1045
+ #
1046
+ # @param [Numeric] delay
1047
+ # An optional delay in seconds.
1048
+ #
1049
+ # @return [Sketchup::View]
1050
+ #
1051
+ # @version SketchUp 6.0
1052
+ def show_frame(delay)
1053
+ end
1054
+
1055
+ # This method is used to compute the bounds of the text when
1056
+ # using {#draw_text}. The bounds are not a tight fit around the top and bottom
1057
+ # as they include varying amount of line spacing depending on the font used.
1058
+ #
1059
+ # The {TextVerticalAlignCenter} option will align the text to the center of the
1060
+ # height of the first line, not the whole boundingbox of the text.
1061
+ #
1062
+ # <b>Example of different vertical alignment and text bounds:</b>
1063
+ #
1064
+ # rdoc-image:../images/view-draw-text-with-bounds.png
1065
+ #
1066
+ # @example
1067
+ # class ExampleTool
1068
+ # TEXT_OPTIONS = {
1069
+ # :font => "Arial",
1070
+ # :size => 20,
1071
+ # :bold => true,
1072
+ # :align => TextAlignRight,
1073
+ # :align => TextVerticalAlignBaseline
1074
+ # }
1075
+ #
1076
+ # # Since `draw` is called frequently it can be useful to pre-compute and
1077
+ # # cache values used by `draw`.
1078
+ # def activate
1079
+ # @text = "Hello SketchUp"
1080
+ # @position = Geom::Point3d.new(200, 200, 0)
1081
+ #
1082
+ # # Compute text bounds
1083
+ # view = Sketchup.active_model.active_view
1084
+ # bounds = view.text_bounds(@position, @text, TEXT_OPTIONS)
1085
+ #
1086
+ # # Compute polygon for the text bounds
1087
+ # x1, y1 = bounds.upper_left.to_a
1088
+ # x2, y2 = bounds.lower_right.to_a
1089
+ # @points = [
1090
+ # Geom::Point3d.new(x1, y1),
1091
+ # Geom::Point3d.new(x1, y2),
1092
+ # Geom::Point3d.new(x2, y2),
1093
+ # Geom::Point3d.new(x2, y1),
1094
+ # ]
1095
+ # end
1096
+ #
1097
+ # def draw(view)
1098
+ # # Draw text bounds
1099
+ # view.drawing_color = Sketchup::Color.new(255, 0, 0, 64)
1100
+ # view.draw2d(GL_QUADS, @points)
1101
+ #
1102
+ # # Draw text
1103
+ # view.draw_text(@position, @text, TEXT_OPTIONS)
1104
+ # end
1105
+ # end
1106
+ #
1107
+ # @note Under Windows the font name must be less than 32 characters - due to
1108
+ # system limitations.
1109
+ #
1110
+ # @option options [String] :font The name of the font to use. If it does not
1111
+ # exist on the system, a default font will be used instead.
1112
+ #
1113
+ # @option options [Integer] :size The size of the font in points
1114
+ #
1115
+ # @option options [Boolean] :bold Controls the Bold property of the font.
1116
+ #
1117
+ # @option options [Boolean] :italic Controls the Italic property of the font.
1118
+ #
1119
+ # @option options [Integer] :align The text alignment, one of the following
1120
+ # constants: {TextAlignLeft}, {TextAlignCenter} or {TextAlignRight}.
1121
+ #
1122
+ # @option options [Integer] :vertical_align The vertical text alignment
1123
+ # one of the following constants:
1124
+ # {TextVerticalAlignBoundsTop}, {TextVerticalAlignBaseline},
1125
+ # {TextVerticalAlignCapHeight} or {TextVerticalAlignCenter}.
1126
+ #
1127
+ # @param [Geom::Point3d] point
1128
+ # A Point3d object representing a 2D coordinate
1129
+ # in view space.
1130
+ #
1131
+ # @param [String] text
1132
+ # The text string to draw.
1133
+ #
1134
+ # @param [Hash] options
1135
+ # The text can be customized by providing a hash or
1136
+ # named arguments of options.
1137
+ #
1138
+ # @return [Geom::Bounds2d]
1139
+ #
1140
+ # @see #draw_text
1141
+ #
1142
+ # @version SketchUp 2020.0
1143
+ def text_bounds(point, text, options = {})
1144
+ end
1145
+
1146
+ # Set a tooltip to display in the view. This is useful for displaying tooltips
1147
+ # in a tool that you write in Ruby.
1148
+ #
1149
+ # @example
1150
+ # tooltip = view.tooltip = string
1151
+ #
1152
+ # @param [String] string
1153
+ # The string tooltip.
1154
+ #
1155
+ # @return [String] the new tooltip string
1156
+ #
1157
+ # @version SketchUp 6.0
1158
+ def tooltip=(string)
1159
+ end
1160
+
1161
+ # The vpheight method is used to retrieve the height of the viewport for the
1162
+ # view.
1163
+ #
1164
+ # @example
1165
+ # model = Sketchup.active_model
1166
+ # view = model.active_view
1167
+ # height = view.vpheight
1168
+ #
1169
+ # @return [Integer] the height of the viewport in pixels.
1170
+ #
1171
+ # @version SketchUp 6.0
1172
+ def vpheight
1173
+ end
1174
+
1175
+ # The vpwidth method is used to retrieve the width of the viewport for the
1176
+ # view.
1177
+ #
1178
+ # @example
1179
+ # width = view.vpwidth
1180
+ #
1181
+ # @return [Integer] the width of the viewport in pixels.
1182
+ #
1183
+ # @version SketchUp 6.0
1184
+ def vpwidth
1185
+ end
1186
+
1187
+ # The {#write_image} method is used to write the current view to an image file.
1188
+ #
1189
+ # @overload write_image(filename, width = view.vpwidth, height = view.vpheight, antialias = false, compression = 1.0)
1190
+ #
1191
+ # @note Prefer the overload with option hash instead of this variant. This
1192
+ # overload is not updated with new options.
1193
+ #
1194
+ # @example
1195
+ # filename => "c:/tmp/write_image.png"
1196
+ # antialias => false
1197
+ # compression => 0.9
1198
+ # model = Sketchup.active_model
1199
+ # view = model.active_view
1200
+ # view.write_image(filename, 640, 480, antialias, compression)
1201
+ #
1202
+ # @param [String] filename
1203
+ # The filename for the saved image
1204
+ # @param [Integer] width
1205
+ # Width in pixels, defaults to the current viewport width {#vpwidth}.
1206
+ # @param [Integer] height
1207
+ # Height in pixels, defaults to the current viewport height {#vpheight}.
1208
+ # @param [Boolean] antialias
1209
+ # @param [Float] compression
1210
+ # Compression factor for JPEG images, between +0.0+ and +1.0+.
1211
+ #
1212
+ # @overload write_image(options)
1213
+ #
1214
+ # @example
1215
+ # options = {
1216
+ # :filename => "c:/tmp/write_image.png",
1217
+ # :width => 640,
1218
+ # :height => 480,
1219
+ # :antialias => false,
1220
+ # :compression => 0.9,
1221
+ # :transparent => true
1222
+ # }
1223
+ # model = Sketchup.active_model
1224
+ # view = model.active_view
1225
+ # view.write_image(options)
1226
+ #
1227
+ # @version SketchUp 7
1228
+ # @param [Hash] options
1229
+ # @option options [String] filename The filename for the saved image.
1230
+ # @option options [Integer] width (#vpwidth) Width in pixels (max +1600+).
1231
+ # @option options [Integer] height (#vpheight) Height in pixels (max +16000+).
1232
+ # @option options [Float] scale_factor (1.0) Scaling factor for
1233
+ # elements that are viewport dependent, such as text heights, arrow heads,
1234
+ # line widths, stipple patterns, etc. (Added in SketchUp 2019.2)
1235
+ # @option options [Boolean] antialias (false)
1236
+ # @option options [Float] compression (1.0) Compression factor for JPEG,
1237
+ # images between +0.0+ and +1.0+.
1238
+ # @option options [Boolean] transparent (false) Added in SketchUp 8.
1239
+ #
1240
+ # @overload write_image(options)
1241
+ #
1242
+ # It is possible to dump the framebuffer to file by setting +:source+ to
1243
+ # +:framebuffer+. When saving the framebuffer only the following options are
1244
+ # valid.
1245
+ #
1246
+ # @example
1247
+ # options = {
1248
+ # :filename => "c:/tmp/write_image.png",
1249
+ # :source => :framebuffer,
1250
+ # :compression => 0.9,
1251
+ # }
1252
+ # model = Sketchup.active_model
1253
+ # view = model.active_view
1254
+ # view.write_image(options)
1255
+ #
1256
+ # @version SketchUp 7
1257
+ # @param [Hash] options
1258
+ # @option options [String] filename The filename for the saved image.
1259
+ # @option options [Boolean] source (:image) Set to +:framebuffer+ to dump the
1260
+ # current framebuffer.
1261
+ # @option options [Float] compression (1.0) Compression factor for JPEG,
1262
+ # images between +0.0+ and +1.0+.
1263
+ #
1264
+ # @return [Boolean]
1265
+ #
1266
+ # @version SketchUp 6.0
1267
+ def write_image(*args)
1268
+ end
1269
+
1270
+ # The zoom method is used to zoom in or out by some zoom factor.
1271
+ #
1272
+ # @example
1273
+ # view = view.zoom factor
1274
+ # view = view.zoom selection
1275
+ # view = view.zoom entity
1276
+ # view = view.zoom array_of_entities
1277
+ #
1278
+ # @param [Numeric, Sketchup::Selection, Sketchup::Entity, Array<Sketchup::Entity>] zoom_or_ents
1279
+ # A Float zoom factor from 1.0 or larger or an Array or
1280
+ # collection of entities to "zoom extents" around.
1281
+ #
1282
+ # @return [Sketchup::View] the zoomed View object
1283
+ #
1284
+ # @version SketchUp 6.0
1285
+ def zoom(zoom_or_ents)
1286
+ end
1287
+
1288
+ # The zoom_extents method is used to zoom to the extents about the entire
1289
+ # model, as if the user has selected the zoom extents command from the menu.
1290
+ #
1291
+ # @example
1292
+ # view = Sketchup.active_model.active_view
1293
+ # new_view = view.zoom_extents
1294
+ #
1295
+ # @return [Sketchup::View] the zoomed View object
1296
+ #
1297
+ # @version SketchUp 6.0
1298
+ def zoom_extents
1299
+ end
1300
+
1301
+ end