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