sketchup-api-stubs 0.6.1 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +2 -0
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +5 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +4 -10
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +5 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +9 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +4 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +25 -3
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +129 -11
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +8 -6
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +45 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +12 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +364 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +7 -1
- data/lib/sketchup-api-stubs/stubs/array.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/geom.rb +116 -1
- data/lib/sketchup-api-stubs/stubs/languagehandler.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/length.rb +19 -3
- data/lib/sketchup-api-stubs/stubs/numeric.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/sketchup.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/sketchupextension.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/string.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/ui.rb +10 -3
- metadata +2 -2
@@ -1,14 +1,16 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
|
-
# An OptionsProvider class provides various kinds of options on a
|
5
|
-
# get an OptionsProvider from the
|
6
|
-
# name/value pairs.
|
4
|
+
# An +OptionsProvider+ class provides various kinds of options on a
|
5
|
+
# {Sketchup::Model}. You get an +OptionsProvider+ from the
|
6
|
+
# {Sketchup::OptionsManager}. The options are given as name/value pairs.
|
7
7
|
#
|
8
8
|
# List of keys added in different SketchUp versions:
|
9
9
|
#
|
10
|
-
# [+UnitsOptions+] * +AreaUnit+ (SketchUp 2019.
|
11
|
-
# * +VolumeUnit+ (SketchUp 2019.
|
10
|
+
# [+UnitsOptions+] * +AreaUnit+ (SketchUp 2019.2)
|
11
|
+
# * +VolumeUnit+ (SketchUp 2019.2)
|
12
|
+
# * +AreaPrecision+ (SketchUp 2020.0)
|
13
|
+
# * +VolumePrecision+ (SketchUp 2020.0)
|
12
14
|
#
|
13
15
|
# The +AreaUnit+ and +VolumeUnit+ options in +UnitsOptions+ only applies if
|
14
16
|
# the +UnitFormat+ is +Length::Decimal+.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# The Page class contains methods to extract information and modify the
|
@@ -114,6 +114,26 @@ class Sketchup::Page < Sketchup::Entity
|
|
114
114
|
def description=(description)
|
115
115
|
end
|
116
116
|
|
117
|
+
# The {#get_drawingelement_visibility} method is used to get the visibility
|
118
|
+
# of a drawing element on a particular page.
|
119
|
+
#
|
120
|
+
# @example
|
121
|
+
# model = Sketchup.active_model
|
122
|
+
# entities = model.active_entities
|
123
|
+
# point1 = Geom::Point3d.new(10,0,0)
|
124
|
+
# constpoint = entities.add_cpoint(point1)
|
125
|
+
# pages = model.pages
|
126
|
+
# page = pages.add("My Page")
|
127
|
+
# result = page.get_drawingelement_visibility(constpoint)
|
128
|
+
#
|
129
|
+
# @param [Sketchup::Drawingelement] element
|
130
|
+
#
|
131
|
+
# @return [Boolean] - true if visible, false if not.
|
132
|
+
#
|
133
|
+
# @version SketchUp 2020.0
|
134
|
+
def get_drawingelement_visibility(element)
|
135
|
+
end
|
136
|
+
|
117
137
|
# The hidden_entities method retrieves all hidden entities within a page.
|
118
138
|
#
|
119
139
|
# @example
|
@@ -235,6 +255,30 @@ class Sketchup::Page < Sketchup::Entity
|
|
235
255
|
def rendering_options
|
236
256
|
end
|
237
257
|
|
258
|
+
# The {#set_drawingelement_visibility} method is used to change the visibility
|
259
|
+
# of a drawing element on a particular page. Only drawing elements on the root
|
260
|
+
# of the model, as well as nested instances of components, groups, and images
|
261
|
+
# are controlled by Page visibility.
|
262
|
+
#
|
263
|
+
# @example
|
264
|
+
# model = Sketchup.active_model
|
265
|
+
# entities = model.active_entities
|
266
|
+
# point1 = Geom::Point3d.new(10, 0, 0)
|
267
|
+
# constpoint = entities.add_cpoint(point1)
|
268
|
+
# pages = model.pages
|
269
|
+
# page = pages.add("My Page")
|
270
|
+
# page.set_drawingelement_visibility(constpoint, false)
|
271
|
+
#
|
272
|
+
# @param [Sketchup::Drawingelement] element
|
273
|
+
#
|
274
|
+
# @param [Boolean] visibility
|
275
|
+
#
|
276
|
+
# @return [Boolean]
|
277
|
+
#
|
278
|
+
# @version SketchUp 2020.0
|
279
|
+
def set_drawingelement_visibility(element, visibility)
|
280
|
+
end
|
281
|
+
|
238
282
|
# The set_visibility method sets the visibility for a layer on a page.
|
239
283
|
#
|
240
284
|
# @example
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# The RenderingOptions class contains method to extract the rendering
|
@@ -57,9 +57,6 @@
|
|
57
57
|
# - +Texture+
|
58
58
|
# - +TransparencySort+ SketchUp 2017 treats Medium transparency as Faster.
|
59
59
|
#
|
60
|
-
# Removed in SketchUp 2019.1
|
61
|
-
# - +FaceColorMode+ This option was previously included but it was ineffective.
|
62
|
-
#
|
63
60
|
# Added in SketchUp 7:
|
64
61
|
# - +DisplayDims+
|
65
62
|
# - +DisplaySketchAxes+
|
@@ -81,6 +78,13 @@
|
|
81
78
|
# - +SectionCutFilled+
|
82
79
|
# - +SectionDefaultFillColor+
|
83
80
|
#
|
81
|
+
# Removed in SketchUp 2019.1
|
82
|
+
# - +FaceColorMode+ This option was previously included but it was ineffective.
|
83
|
+
#
|
84
|
+
# Added in SketchUp 2020.0:
|
85
|
+
# - +ROPDrawHiddenGeometry+
|
86
|
+
# - +ROPDrawHiddenObjects+
|
87
|
+
#
|
84
88
|
# @version SketchUp 6.0
|
85
89
|
class Sketchup::RenderingOptions < Sketchup::Entity
|
86
90
|
|
@@ -92,7 +96,10 @@ class Sketchup::RenderingOptions < Sketchup::Entity
|
|
92
96
|
|
93
97
|
ROPAssign = nil # Stub value.
|
94
98
|
ROPDrawHidden = nil # Stub value.
|
99
|
+
ROPDrawHiddenGeometry = nil # Stub value.
|
100
|
+
ROPDrawHiddenObjects = nil # Stub value.
|
95
101
|
ROPEditComponent = nil # Stub value.
|
102
|
+
ROPSectionDisplayTurnedOff = nil # Stub value.
|
96
103
|
ROPSetBackgroundColor = nil # Stub value.
|
97
104
|
ROPSetConstructionColor = nil # Stub value.
|
98
105
|
ROPSetDepthQueEdges = nil # Stub value.
|
@@ -128,6 +135,7 @@ class Sketchup::RenderingOptions < Sketchup::Entity
|
|
128
135
|
ROPSetLineEndEdges = nil # Stub value.
|
129
136
|
ROPSetLineEndWidth = nil # Stub value.
|
130
137
|
ROPSetLineExtension = nil # Stub value.
|
138
|
+
ROPSetLineStyleEdges = nil # Stub value.
|
131
139
|
ROPSetLockedColor = nil # Stub value.
|
132
140
|
ROPSetMaterialTransparency = nil # Stub value.
|
133
141
|
ROPSetModelTransparency = nil # Stub value.
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# This class contains methods to manipulate the current point of view of the
|
@@ -219,18 +219,64 @@ class Sketchup::View
|
|
219
219
|
# {Tool#getExtents} which returns a bounding box large enough to include the
|
220
220
|
# points you draw. Otherwise your drawing will be clipped.
|
221
221
|
#
|
222
|
-
# @
|
223
|
-
# The item you are going to draw, one of the constants
|
224
|
-
# from the comments, such as +GL_LINES+.
|
222
|
+
# @overload draw(openglenum, points)
|
225
223
|
#
|
226
|
-
#
|
224
|
+
# @param [Integer] openglenum
|
225
|
+
# The item you are going to draw, one of the constants
|
226
|
+
# from the comments, such as +GL_LINES+.
|
227
|
+
# @param [Array<Geom::Point3d>] points
|
228
|
+
#
|
229
|
+
# @overload draw(openglenum, *points)
|
230
|
+
#
|
231
|
+
# @param [Integer] openglenum
|
232
|
+
# The item you are going to draw, one of the constants
|
233
|
+
# from the comments, such as +GL_LINES+.
|
234
|
+
# @param [Array<Geom::Point3d>] points
|
235
|
+
#
|
236
|
+
# @overload draw(openglenum, points, **options)
|
237
|
+
#
|
238
|
+
# @version SketchUp 2020.0
|
239
|
+
# @param [Integer] openglenum
|
240
|
+
# The item you are going to draw, one of the constants
|
241
|
+
# from the comments, such as +GL_LINES+.
|
242
|
+
# @param [Array<Geom::Point3d>] points
|
243
|
+
# @param [Hash] options
|
244
|
+
# @option options [Array<Geom::Vector3d>] :normals
|
245
|
+
# Without normals the polygons will be rendered with flat shading. No
|
246
|
+
# light will affect it. By providing an array of vertex normals lighting
|
247
|
+
# is turned on and will use the model's current light. Note that the number
|
248
|
+
# of normals must match the number of points provided.
|
249
|
+
# @option options [Integer] :texture_id
|
250
|
+
# A texture id provided by {#load_texture}.
|
251
|
+
# @option options [Array<Geom::Vector3d>] :uvs
|
252
|
+
# Set of UV (Not UVQ) coordinates matching the number of points provided.
|
253
|
+
# This must be used along with the +:texture_id+ option.
|
254
|
+
#
|
255
|
+
# @overload draw(openglenum, *points, **options)
|
256
|
+
#
|
257
|
+
# @version SketchUp 2020.0
|
258
|
+
# @param [Integer] openglenum
|
259
|
+
# The item you are going to draw, one of the constants
|
260
|
+
# from the comments, such as +GL_LINES+.
|
261
|
+
# @param [Array<Geom::Point3d>] points
|
262
|
+
# @param [Hash] options
|
263
|
+
# @option options [Array<Geom::Vector3d>] :normals ([])
|
264
|
+
# Without normals the polygons will be rendered with flat shading. No
|
265
|
+
# light will affect it. By providing an array of vertex normals lighting
|
266
|
+
# is turned on and will use the model's current light. Note that the number
|
267
|
+
# of normals must match the number of points provided.
|
268
|
+
# @option options [Integer] :texture_id
|
269
|
+
# A texture id provided by {#load_texture}.
|
270
|
+
# @option options [Array<Geom::Vector3d>] :uvs
|
271
|
+
# Set of UV (Not UVQ) coordinates matching the number of points provided.
|
272
|
+
# This must be used along with the +:texture_id+ option.
|
227
273
|
#
|
228
274
|
# @return [Sketchup::View]
|
229
275
|
#
|
230
276
|
# @see Tool#getExtents
|
231
277
|
#
|
232
278
|
# @version SketchUp 6.0
|
233
|
-
def draw(
|
279
|
+
def draw(*args)
|
234
280
|
end
|
235
281
|
|
236
282
|
# The {#draw2d} method is used to draw in screen space (using 2D screen
|
@@ -252,20 +298,56 @@ class Sketchup::View
|
|
252
298
|
# ]
|
253
299
|
# view.draw2d(GL_LINE_STRIP, points)
|
254
300
|
#
|
255
|
-
# @
|
256
|
-
#
|
257
|
-
#
|
301
|
+
# @overload draw2d(openglenum, points)
|
302
|
+
#
|
303
|
+
# @param [Integer] openglenum
|
304
|
+
# The item you are going to draw, one of the constants
|
305
|
+
# from the comments, such as +GL_LINES+.
|
306
|
+
# @param [Array<Geom::Point3d>] points
|
258
307
|
#
|
259
|
-
# @
|
308
|
+
# @overload draw2d(openglenum, *points)
|
260
309
|
#
|
261
|
-
#
|
310
|
+
# @param [Integer] openglenum
|
311
|
+
# The item you are going to draw, one of the constants
|
312
|
+
# from the comments, such as +GL_LINES+.
|
313
|
+
# @param [Array<Geom::Point3d>] points
|
314
|
+
#
|
315
|
+
# @overload draw2d(openglenum, points, **options)
|
316
|
+
#
|
317
|
+
# @version SketchUp 2020.0
|
318
|
+
# @param [Integer] openglenum
|
319
|
+
# The item you are going to draw, one of the constants
|
320
|
+
# from the comments, such as +GL_LINES+.
|
321
|
+
# @param [Array<Geom::Point3d>] points
|
322
|
+
# @param [Hash] options
|
323
|
+
# @option options [Integer] :texture_id
|
324
|
+
# A texture id provided by {#load_texture}.
|
325
|
+
# @option options [Array<Geom::Vector3d>] :uvs
|
326
|
+
# Set of UV (Not UVQ) coordinates matching the number of points provided.
|
327
|
+
# This must be used along with the +:texture_id+ option.
|
328
|
+
#
|
329
|
+
# @overload draw2d(openglenum, *points, **options)
|
330
|
+
#
|
331
|
+
# @version SketchUp 2020.0
|
332
|
+
# @param [Integer] openglenum
|
333
|
+
# The item you are going to draw, one of the constants
|
334
|
+
# from the comments, such as +GL_LINES+.
|
335
|
+
# @param [Array<Geom::Point3d>] points
|
336
|
+
# @param [Hash] options
|
337
|
+
# @option options [Integer] :texture_id
|
338
|
+
# A texture id provided by {#load_texture}.
|
339
|
+
# @option options [Array<Geom::Vector3d>] :uvs
|
340
|
+
# Set of UV (Not UVQ) coordinates matching the number of points provided.
|
341
|
+
# This must be used along with the +:texture_id+ option.
|
342
|
+
#
|
343
|
+
# @return [Sketchup::View]
|
262
344
|
#
|
263
345
|
# @see #draw
|
264
346
|
#
|
265
347
|
# @see UI.scale_factor
|
266
348
|
#
|
267
349
|
# @version SketchUp 6.0
|
268
|
-
def draw2d(
|
350
|
+
def draw2d(*args)
|
269
351
|
end
|
270
352
|
|
271
353
|
# The draw_lines method is used to draw disconnected lines.
|
@@ -378,27 +460,63 @@ class Sketchup::View
|
|
378
460
|
# This method is used to draw text on the screen and is usually invoked within
|
379
461
|
# the draw method of a tool.
|
380
462
|
#
|
463
|
+
# The {TextVerticalAlignCenter} option will align the text to the center of the
|
464
|
+
# height of the first line, not the whole boundingbox of the text. To align
|
465
|
+
# around the full bounds of the text, use {#text_bounds} to compute the
|
466
|
+
# desired alignment.
|
467
|
+
#
|
468
|
+
# <b>Example of different vertical alignment and text bounds:</b>
|
469
|
+
#
|
470
|
+
# rdoc-image:../images/view-draw-text-with-bounds.png
|
471
|
+
#
|
381
472
|
# @example
|
382
|
-
#
|
473
|
+
# class ExampleTool
|
474
|
+
# def draw(view)
|
475
|
+
# # This works in all SketchUp versions and draws the text using the
|
476
|
+
# # default font, color and size.
|
477
|
+
# point = Geom::Point3d.new(200, 100, 0)
|
478
|
+
# view.draw_text(point, "This is a test")
|
479
|
+
#
|
480
|
+
# # This works in SketchUp 2016 and up.
|
481
|
+
# options = {
|
482
|
+
# :font => "Arial",
|
483
|
+
# :size => 20,
|
484
|
+
# :bold => true,
|
485
|
+
# :align => TextAlignRight
|
486
|
+
# }
|
487
|
+
# point = Geom::Point3d.new(200, 200, 0)
|
488
|
+
# view.draw_text(point, "This is another\ntest", options)
|
489
|
+
#
|
490
|
+
# # You can also use Ruby 2.0's named arguments:
|
491
|
+
# point = Geom::Point3d.new(200, 200, 0)
|
492
|
+
# view.draw_text(point, "Hello world!", color: "Red")
|
493
|
+
# end
|
494
|
+
# end
|
383
495
|
#
|
384
|
-
#
|
385
|
-
#
|
386
|
-
#
|
387
|
-
#
|
388
|
-
#
|
389
|
-
#
|
390
|
-
#
|
391
|
-
#
|
392
|
-
#
|
393
|
-
#
|
394
|
-
#
|
395
|
-
#
|
396
|
-
#
|
397
|
-
#
|
398
|
-
#
|
399
|
-
#
|
400
|
-
#
|
401
|
-
#
|
496
|
+
# @example Cross Platform Font Size
|
497
|
+
# class ExampleTool
|
498
|
+
# IS_WIN = Sketchup.platform == :platform_win
|
499
|
+
#
|
500
|
+
# def draw(view)
|
501
|
+
# draw_text(view, "Hello World", size: 20)
|
502
|
+
# end
|
503
|
+
#
|
504
|
+
# private
|
505
|
+
#
|
506
|
+
# # This will ensure text is drawn with consistent size across platforms,
|
507
|
+
# # using pixels as size units.
|
508
|
+
# def draw_text(view, text, **options)
|
509
|
+
# native_options = options.dup
|
510
|
+
# if IS_WIN && options.key?(:size)
|
511
|
+
# native_options[:size] = pixels_to_points(size)
|
512
|
+
# end
|
513
|
+
# view.draw_text(position, text, **native_options)
|
514
|
+
# end
|
515
|
+
#
|
516
|
+
# def pixels_to_points(pixels)
|
517
|
+
# ((pixels.to_f / 96.0) * 72.0).round
|
518
|
+
# end
|
519
|
+
# end
|
402
520
|
#
|
403
521
|
# @note Under Windows the font name must be less than 32 characters - due to
|
404
522
|
# system limitations.
|
@@ -406,35 +524,43 @@ class Sketchup::View
|
|
406
524
|
# @note As of SU2017 this will automatically scale the font-size by the same
|
407
525
|
# factor as {UI.scale_factor}.
|
408
526
|
#
|
409
|
-
# @
|
410
|
-
#
|
411
|
-
#
|
412
|
-
#
|
413
|
-
#
|
414
|
-
#
|
415
|
-
#
|
416
|
-
#
|
417
|
-
#
|
418
|
-
#
|
419
|
-
#
|
420
|
-
#
|
421
|
-
#
|
422
|
-
#
|
423
|
-
#
|
424
|
-
#
|
425
|
-
#
|
426
|
-
#
|
427
|
-
#
|
428
|
-
#
|
429
|
-
#
|
430
|
-
#
|
431
|
-
#
|
432
|
-
#
|
527
|
+
# @note The font size is platform dependent. On Windows the method expects
|
528
|
+
# points, where on Mac it's pixels. See "Cross Platform Font Size" example
|
529
|
+
# for details.
|
530
|
+
#
|
531
|
+
# @overload draw_text(point, text)
|
532
|
+
#
|
533
|
+
# @param [Geom::Point3d] point A Point3d object representing a 2D coordinate
|
534
|
+
# in view space.
|
535
|
+
# @param [String] text The text string to draw.
|
536
|
+
#
|
537
|
+
# @overload draw_text(point, text, options = {})
|
538
|
+
#
|
539
|
+
# @version SketchUp 2016
|
540
|
+
# @param [Geom::Point3d] point A Point3d object representing a 2D coordinate
|
541
|
+
# in view space.
|
542
|
+
# @param [String] text The text string to draw.
|
543
|
+
# @param [Hash] options The text can be customized by providing a hash or
|
544
|
+
# named arguments of options.
|
545
|
+
# @option options [String] :font The name of the font to use. If it does not
|
546
|
+
# exist on the system, a default font will be used instead.
|
547
|
+
# @option options [Integer] :size The size of the font in points
|
548
|
+
# @option options [Boolean] :bold Controls the Bold property of the font.
|
549
|
+
# @option options [Boolean] :italic Controls the Italic property of the font.
|
550
|
+
# @option options [Sketchup::Color] :color The color to draw the text with.
|
551
|
+
# @option options [Integer] :align The text alignment, one of the following
|
552
|
+
# constants: {TextAlignLeft}, {TextAlignCenter} or {TextAlignRight}.
|
553
|
+
# @option options [Integer] :vertical_align <b>Added SketchUp 2020.0.</b>
|
554
|
+
# The vertical text alignment, one of the following constants:
|
555
|
+
# {TextVerticalAlignBoundsTop}, {TextVerticalAlignBaseline},
|
556
|
+
# {TextVerticalAlignCapHeight} or {TextVerticalAlignCenter}. Note that
|
557
|
+
# some fonts on Mac might not align as expected due to the system
|
558
|
+
# reporting incorrect font metrics.
|
433
559
|
#
|
434
560
|
# @return [Sketchup::View]
|
435
561
|
#
|
436
562
|
# @version SketchUp 6.0
|
437
|
-
def draw_text(
|
563
|
+
def draw_text(*args)
|
438
564
|
end
|
439
565
|
|
440
566
|
# The drawing_color method is used to set the color that is used for drawing
|
@@ -462,11 +588,12 @@ class Sketchup::View
|
|
462
588
|
# See also camera.rb which is part of the film and stage ruby
|
463
589
|
# scripts.
|
464
590
|
#
|
591
|
+
# @deprecated This method is no longer doing anything.
|
592
|
+
#
|
465
593
|
# @example
|
466
594
|
# view.dynamic = true
|
467
595
|
#
|
468
596
|
# @param [Boolean] value
|
469
|
-
# true or false
|
470
597
|
#
|
471
598
|
# @return [Boolean]
|
472
599
|
#
|
@@ -631,6 +758,55 @@ class Sketchup::View
|
|
631
758
|
def line_width=(width)
|
632
759
|
end
|
633
760
|
|
761
|
+
# Loads a texture to be drawn with {#draw} or {#draw2d}.
|
762
|
+
#
|
763
|
+
# @example
|
764
|
+
# module Example
|
765
|
+
# class MyTool
|
766
|
+
#
|
767
|
+
# def activate
|
768
|
+
# view = Sketchup.active_model.active_view
|
769
|
+
# image_rep = view.model.materials.current.texture.image_rep
|
770
|
+
# @texture_id = view.load_texture(image_rep)
|
771
|
+
# end
|
772
|
+
#
|
773
|
+
# def deactivate(view)
|
774
|
+
# view.release_texture(@texture_id)
|
775
|
+
# end
|
776
|
+
#
|
777
|
+
# def draw(view)
|
778
|
+
# points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
|
779
|
+
# uvs = [ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] ]
|
780
|
+
# view.draw(points, texture_id: @texture_id, uvs: uvs)
|
781
|
+
# end
|
782
|
+
#
|
783
|
+
# end
|
784
|
+
# end
|
785
|
+
# Sketchup.active_model.select_tool(Example::MyTool.new)
|
786
|
+
#
|
787
|
+
# @note To conserve resources on the user's machine, textures can be loaded
|
788
|
+
# only when there is a Ruby tool on the tool stack. Make sure to release the
|
789
|
+
# texture when it's no longer needed. Any textures not already released
|
790
|
+
# when the last Ruby tool on the tool stack is removed will be automatically
|
791
|
+
# released by SketchUp.
|
792
|
+
#
|
793
|
+
# @note Avoid loading and releasing textures within the {Sketchup::Tool#draw}
|
794
|
+
# event as that is not efficient.
|
795
|
+
#
|
796
|
+
# @param [Sketchup::ImageRep] image_rep
|
797
|
+
#
|
798
|
+
# @raise [ArgumentError] if the provided {Sketchup::ImageRep} is not valid.
|
799
|
+
#
|
800
|
+
# @raise [RuntimeError] if a Ruby tool was not on the tool stack.
|
801
|
+
#
|
802
|
+
# @return [Integer] A resource ID referring to the image loaded.
|
803
|
+
#
|
804
|
+
# @see #release_texture
|
805
|
+
#
|
806
|
+
# @see #draw
|
807
|
+
def load_texture(image_rep)
|
808
|
+
end
|
809
|
+
|
634
810
|
# The lock_inference method is used to lock or unlock an inference.
|
635
811
|
#
|
636
812
|
# This method will typically be called from inside a tool class when the user
|
@@ -763,6 +939,45 @@ class Sketchup::View
|
|
763
939
|
def refresh
|
764
940
|
end
|
765
941
|
|
942
|
+
# Releases a texture loaded via {#load_texture}, freeing up it's memory.
|
943
|
+
# It's good practice to do so whenever there is no longer any need for the
|
944
|
+
# resource.
|
945
|
+
#
|
946
|
+
# For example, when your tool deactivates you probably want to release your
|
947
|
+
# resources as you don't know if your tool will be used again.
|
948
|
+
#
|
949
|
+
# @example
|
950
|
+
# module Example
|
951
|
+
# class MyTool
|
952
|
+
#
|
953
|
+
# def activate
|
954
|
+
# view = Sketchup.active_model.active_view
|
955
|
+
# image_rep = view.model.materials.current.texture.image_rep
|
956
|
+
# @texture_id = view.load_texture(image_rep)
|
957
|
+
# end
|
958
|
+
#
|
959
|
+
# def deactivate(view)
|
960
|
+
# view.release_texture(@texture_id)
|
961
|
+
# end
|
962
|
+
#
|
963
|
+
# def draw(view)
|
964
|
+
# points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
|
965
|
+
# uvs = [ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] ]
|
966
|
+
# view.draw(points, texture_id: @texture_id, uvs: uvs)
|
967
|
+
# end
|
968
|
+
#
|
969
|
+
# end
|
970
|
+
# end
|
971
|
+
# Sketchup.active_model.select_tool(Example::MyTool.new)
|
972
|
+
#
|
973
|
+
# @param [Integer] texture_id
|
974
|
+
#
|
975
|
+
# @return [Boolean] +true+ if texture was released. +false+ otherwise.
|
976
|
+
#
|
977
|
+
# @see #load_texture
|
978
|
+
def release_texture(texture_id)
|
979
|
+
end
|
980
|
+
|
766
981
|
# The remove_observer method is used to remove an observer from the current
|
767
982
|
# object.
|
768
983
|
#
|
@@ -837,6 +1052,97 @@ class Sketchup::View
|
|
837
1052
|
def show_frame(delay)
|
838
1053
|
end
|
839
1054
|
|
1055
|
+
# This method is used to compute the bounds of the text when
|
1056
|
+
# using {#draw_text}. The bounds are not a tight fit around the top and bottom
|
1057
|
+
# as they include varying amount of line spacing depending on the font used.
|
1058
|
+
#
|
1059
|
+
# The {TextVerticalAlignCenter} option will align the text to the center of the
|
1060
|
+
# height of the first line, not the whole boundingbox of the text.
|
1061
|
+
#
|
1062
|
+
# <b>Example of different vertical alignment and text bounds:</b>
|
1063
|
+
#
|
1064
|
+
# rdoc-image:../images/view-draw-text-with-bounds.png
|
1065
|
+
#
|
1066
|
+
# @example
|
1067
|
+
# class ExampleTool
|
1068
|
+
# TEXT_OPTIONS = {
|
1069
|
+
# :font => "Arial",
|
1070
|
+
# :size => 20,
|
1071
|
+
# :bold => true,
|
1072
|
+
# :align => TextAlignRight,
|
1073
|
+
# :align => TextVerticalAlignBaseline
|
1074
|
+
# }
|
1075
|
+
#
|
1076
|
+
# # Since `draw` is called frequently it can be useful to pre-compute and
|
1077
|
+
# # cache values used by `draw`.
|
1078
|
+
# def activate
|
1079
|
+
# @text = "Hello SketchUp"
|
1080
|
+
# @position = Geom::Point3d.new(200, 200, 0)
|
1081
|
+
#
|
1082
|
+
# # Compute text bounds
|
1083
|
+
# view = Sketchup.active_model.active_view
|
1084
|
+
# bounds = view.text_bounds(@position, @text, TEXT_OPTIONS)
|
1085
|
+
#
|
1086
|
+
# # Compute polygon for the text bounds
|
1087
|
+
# x1, y1 = bounds.upper_left.to_a
|
1088
|
+
# x2, y2 = bounds.lower_right.to_a
|
1089
|
+
# @points = [
|
1090
|
+
# Geom::Point3d.new(x1, y1),
|
1091
|
+
# Geom::Point3d.new(x1, y2),
|
1092
|
+
# Geom::Point3d.new(x2, y2),
|
1093
|
+
# Geom::Point3d.new(x2, y1),
|
1094
|
+
# ]
|
1095
|
+
# end
|
1096
|
+
#
|
1097
|
+
# def draw(view)
|
1098
|
+
# # Draw text bounds
|
1099
|
+
# view.drawing_color = Sketchup::Color.new(255, 0, 0, 64)
|
1100
|
+
# view.draw2d(GL_QUADS, @points)
|
1101
|
+
#
|
1102
|
+
# # Draw text
|
1103
|
+
# view.draw_text(@position, @text, TEXT_OPTIONS)
|
1104
|
+
# end
|
1105
|
+
# end
|
1106
|
+
#
|
1107
|
+
# @note Under Windows the font name must be less than 32 characters - due to
|
1108
|
+
# system limitations.
|
1109
|
+
#
|
1110
|
+
# @option options [String] :font The name of the font to use. If it does not
|
1111
|
+
# exist on the system, a default font will be used instead.
|
1112
|
+
#
|
1113
|
+
# @option options [Integer] :size The size of the font in points
|
1114
|
+
#
|
1115
|
+
# @option options [Boolean] :bold Controls the Bold property of the font.
|
1116
|
+
#
|
1117
|
+
# @option options [Boolean] :italic Controls the Italic property of the font.
|
1118
|
+
#
|
1119
|
+
# @option options [Integer] :align The text alignment, one of the following
|
1120
|
+
# constants: {TextAlignLeft}, {TextAlignCenter} or {TextAlignRight}.
|
1121
|
+
#
|
1122
|
+
# @option options [Integer] :vertical_align The vertical text alignment
|
1123
|
+
# one of the following constants:
|
1124
|
+
# {TextVerticalAlignBoundsTop}, {TextVerticalAlignBaseline},
|
1125
|
+
# {TextVerticalAlignCapHeight} or {TextVerticalAlignCenter}.
|
1126
|
+
#
|
1127
|
+
# @param [Geom::Point3d] point
|
1128
|
+
# A Point3d object representing a 2D coordinate
|
1129
|
+
# in view space.
|
1130
|
+
#
|
1131
|
+
# @param [String] text
|
1132
|
+
# The text string to draw.
|
1133
|
+
#
|
1134
|
+
# @param [Hash] options
|
1135
|
+
# The text can be customized by providing a hash or
|
1136
|
+
# named arguments of options.
|
1137
|
+
#
|
1138
|
+
# @return [Geom::Bounds2d]
|
1139
|
+
#
|
1140
|
+
# @see #draw_text
|
1141
|
+
#
|
1142
|
+
# @version SketchUp 2020.0
|
1143
|
+
def text_bounds(point, text, options = {})
|
1144
|
+
end
|
1145
|
+
|
840
1146
|
# Set a tooltip to display in the view. This is useful for displaying tooltips
|
841
1147
|
# in a tool that you write in Ruby.
|
842
1148
|
#
|
@@ -925,7 +1231,7 @@ class Sketchup::View
|
|
925
1231
|
# @option options [Integer] height (#vpheight) Height in pixels (max +16000+).
|
926
1232
|
# @option options [Float] scale_factor (1.0) Scaling factor for
|
927
1233
|
# elements that are viewport dependent, such as text heights, arrow heads,
|
928
|
-
# line widths, stipple patterns, etc. (Added in SketchUp 2019.
|
1234
|
+
# line widths, stipple patterns, etc. (Added in SketchUp 2019.2)
|
929
1235
|
# @option options [Boolean] antialias (false)
|
930
1236
|
# @option options [Float] compression (1.0) Compression factor for JPEG,
|
931
1237
|
# images between +0.0+ and +1.0+.
|