sketchup-api-stubs 0.7.2 → 0.7.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. checksums.yaml +4 -4
  2. data/lib/sketchup-api-stubs/sketchup.rb +3 -1
  3. data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +15 -11
  4. data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +5 -5
  5. data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +5 -5
  6. data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +1 -1
  7. data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +5 -6
  8. data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +18 -18
  9. data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +27 -10
  10. data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +1 -1
  11. data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +1 -1
  12. data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +1 -1
  13. data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +2 -3
  14. data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +4 -4
  15. data/lib/sketchup-api-stubs/stubs/Layout.rb +1 -1
  16. data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +5 -1
  17. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +1 -1
  18. data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +7 -14
  19. data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +1 -1
  20. data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +61 -5
  21. data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +1 -1
  22. data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +7 -14
  23. data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +1 -1
  24. data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +1 -1
  25. data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +189 -1
  26. data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +1 -1
  27. data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +9 -4
  28. data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +2 -3
  29. data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +1 -1
  30. data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +1 -1
  31. data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +7 -14
  32. data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +6 -2
  33. data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +1 -1
  34. data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +1 -1
  35. data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +1 -1
  36. data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +1 -1
  37. data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +7 -14
  38. data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +1 -1
  39. data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +1 -1
  40. data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +148 -5
  41. data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1 -1
  42. data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +1 -1
  43. data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +1 -1
  44. data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +1 -1
  45. data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +1 -1
  46. data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +5 -1
  47. data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +4 -4
  48. data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +1 -1
  49. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +3 -3
  50. data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +6 -1
  51. data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +1 -1
  52. data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +32 -58
  53. data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +110 -209
  54. data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +1 -1
  55. data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +1 -1
  56. data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +24 -11
  57. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +24 -9
  58. data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +58 -57
  59. data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +1 -1
  60. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +1 -1
  61. data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +1 -1
  62. data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +16 -9
  63. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +135 -39
  64. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +6 -4
  65. data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +6 -4
  66. data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +1 -1
  67. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +3 -9
  68. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +5 -1
  69. data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +1 -1
  70. data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +10 -4
  71. data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +8 -14
  72. data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +1 -1
  73. data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +55 -26
  74. data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +6 -4
  75. data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +20 -15
  76. data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +6 -5
  77. data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +9 -8
  78. data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +232 -65
  79. data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +1 -1
  80. data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +98 -45
  81. data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +1 -1
  82. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +48 -41
  83. data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +7 -7
  84. data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +60 -1
  85. data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +47 -7
  86. data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +11 -12
  87. data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +33 -21
  88. data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +6 -4
  89. data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +5 -2
  90. data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +115 -68
  91. data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -0
  92. data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +225 -29
  93. data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +118 -5
  94. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +2 -2
  95. data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
  96. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +1 -1
  97. data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +2 -13
  98. data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +1 -1
  99. data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +8 -10
  100. data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +16 -9
  101. data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +6 -5
  102. data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +9 -11
  103. data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +126 -73
  104. data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +5 -4
  105. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +2 -3
  106. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +7 -7
  107. data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +4 -4
  108. data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +143 -40
  109. data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +22 -12
  110. data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +6 -5
  111. data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +37 -15
  112. data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +1 -1
  113. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +1 -1
  114. data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +5 -4
  115. data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +1 -1
  116. data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +10 -5
  117. data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +20 -20
  118. data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +1 -1
  119. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +5 -5
  120. data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +6 -4
  121. data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -0
  122. data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +1 -1
  123. data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +9 -3
  124. data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +1 -1
  125. data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +14 -22
  126. data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +1 -1
  127. data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +31 -25
  128. data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +2 -2
  129. data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +6 -4
  130. data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +32 -22
  131. data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +1 -1
  132. data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +73 -67
  133. data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +6 -4
  134. data/lib/sketchup-api-stubs/stubs/UI/Command.rb +13 -6
  135. data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +132 -10
  136. data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +94 -54
  137. data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +1 -1
  138. data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +3 -3
  139. data/lib/sketchup-api-stubs/stubs/_top_level.rb +3 -1
  140. data/lib/sketchup-api-stubs/stubs/array.rb +1 -1
  141. data/lib/sketchup-api-stubs/stubs/geom.rb +4 -1
  142. data/lib/sketchup-api-stubs/stubs/languagehandler.rb +1 -1
  143. data/lib/sketchup-api-stubs/stubs/length.rb +1 -1
  144. data/lib/sketchup-api-stubs/stubs/numeric.rb +1 -1
  145. data/lib/sketchup-api-stubs/stubs/sketchup.rb +66 -23
  146. data/lib/sketchup-api-stubs/stubs/sketchupextension.rb +1 -1
  147. data/lib/sketchup-api-stubs/stubs/string.rb +1 -1
  148. data/lib/sketchup-api-stubs/stubs/ui.rb +17 -12
  149. metadata +5 -3
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2020 Trimble Inc.
1
+ # Copyright:: Copyright 2021 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The TextureWriter class is used primarily for writing the textures used in a
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2020 Trimble Inc.
1
+ # Copyright:: Copyright 2021 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # Tool is the interface that you implement to create a SketchUp tool.
@@ -32,12 +32,15 @@
32
32
  # - +ALT_MODIFIER_KEY+ = Command on Mac, Alt on PC
33
33
  # - +ALT_MODIFIER_MASK+ = Command on Mac, Alt on PC
34
34
  #
35
+ # @abstract Implement the methods described in this class to create a tool.
36
+ # You can not sub-class this class because it is not defined by the API.
37
+ #
35
38
  # @version SketchUp 6.0
36
39
  class Sketchup::Tool
37
40
 
38
41
  # Instance Methods
39
42
 
40
- # The #{activate} method is called by SketchUp when the tool is selected.
43
+ # The {#activate} method is called by SketchUp when the tool is selected.
41
44
  # It is a good place to put most of your initialization, such as instance
42
45
  # variables to track the state of the tool.
43
46
  #
@@ -50,7 +53,7 @@ class Sketchup::Tool
50
53
  def activate
51
54
  end
52
55
 
53
- # The #{deactivate} method is called when the tool is deactivated because a
56
+ # The {#deactivate} method is called when the tool is deactivated because a
54
57
  # different tool was selected.
55
58
  #
56
59
  # @example
@@ -102,7 +105,7 @@ class Sketchup::Tool
102
105
  def draw(view)
103
106
  end
104
107
 
105
- # The #{enableVCB?} method is used to tell SketchUp whether to allow the user
108
+ # The {#enableVCB?} method is used to tell SketchUp whether to allow the user
106
109
  # to enter text into the VCB (value control box, aka the "measurements" panel).
107
110
  # If you do not implement this method, then the vcb is disabled by default.
108
111
  #
@@ -141,7 +144,7 @@ class Sketchup::Tool
141
144
  def getExtents
142
145
  end
143
146
 
144
- # The #{getInstructorContentDirectory} method is used to tell SketchUp the
147
+ # The {#getInstructorContentDirectory} method is used to tell SketchUp the
145
148
  # directory containing your Tool's instructor content. To use this, create
146
149
  # a custom instructor directory, put an index.html file inside of it, and then
147
150
  # return that path via this method. If the SketchUp user has the Instructor
@@ -165,7 +168,7 @@ class Sketchup::Tool
165
168
  def getInstructorContentDirectory
166
169
  end
167
170
 
168
- # The #{getMenu} method is called by SketchUp to let the tool provide its own
171
+ # The {#getMenu} method is called by SketchUp to let the tool provide its own
169
172
  # context menu. Most tools will not want to implement this method and,
170
173
  # instead, use the normal context menu found on all entities.
171
174
  #
@@ -250,6 +253,9 @@ class Sketchup::Tool
250
253
  # actually executed. If you need to do something with the model after an undo
251
254
  # use {Sketchup::ModelObserver#onTransactionUndo}.
252
255
  #
256
+ # @note When {#onKeyDown} is implemented and returns +true+, pressing Esc
257
+ # doesn't trigger {#onCancel}.
258
+ #
253
259
  # @param [Integer] reason
254
260
  # A reason value (see comments).
255
261
  #
@@ -259,7 +265,7 @@ class Sketchup::Tool
259
265
  def onCancel(reason, view)
260
266
  end
261
267
 
262
- # The #{onKeyDown} method is called by SketchUp when the user presses a key on
268
+ # The {#onKeyDown} method is called by SketchUp when the user presses a key on
263
269
  # the keyboard. If you want to get input from the VCB, you should implement
264
270
  # onUserText rather than this method.
265
271
  #
@@ -320,7 +326,7 @@ class Sketchup::Tool
320
326
  def onKeyDown(key, repeat, flags, view)
321
327
  end
322
328
 
323
- # The #{onKeyUp} method is called by SketchUp when the user releases a key on
329
+ # The {#onKeyUp} method is called by SketchUp when the user releases a key on
324
330
  # the keyboard.
325
331
  #
326
332
  # @example
@@ -352,7 +358,7 @@ class Sketchup::Tool
352
358
  def onKeyUp(key, repeat, flags, view)
353
359
  end
354
360
 
355
- # The #{onLButtonDoubleClick} is called by SketchUp when the user double clicks
361
+ # The {#onLButtonDoubleClick} is called by SketchUp when the user double clicks
356
362
  # with the left mouse button.
357
363
  #
358
364
  # @example
@@ -379,7 +385,7 @@ class Sketchup::Tool
379
385
  def onLButtonDoubleClick(flags, x, y, view)
380
386
  end
381
387
 
382
- # The #{onLButtonDown} method is called by SketchUp when the left mouse button
388
+ # The {#onLButtonDown} method is called by SketchUp when the left mouse button
383
389
  # is pressed. Most tools will implement this method.
384
390
  #
385
391
  # @example
@@ -406,7 +412,7 @@ class Sketchup::Tool
406
412
  def onLButtonDown(flags, x, y, view)
407
413
  end
408
414
 
409
- # The #{onLButtonUp} method is called by SketchUp when the left mouse button is
415
+ # The {#onLButtonUp} method is called by SketchUp when the left mouse button is
410
416
  # released.
411
417
  #
412
418
  # @example
@@ -433,7 +439,7 @@ class Sketchup::Tool
433
439
  def onLButtonUp(flags, x, y, view)
434
440
  end
435
441
 
436
- # The #{onMButtonDoubleClick} method is called by SketchUp when the middle
442
+ # The {#onMButtonDoubleClick} method is called by SketchUp when the middle
437
443
  # mouse button (on a three button mouse) is double-clicked.
438
444
  #
439
445
  # Only implement this method if you want SketchUp to react to a middle mouse
@@ -468,7 +474,7 @@ class Sketchup::Tool
468
474
  def onMButtonDoubleClick(flags, x, y, view)
469
475
  end
470
476
 
471
- # The #{onMButtonDown} method is called by SketchUp when the middle mouse
477
+ # The {#onMButtonDown} method is called by SketchUp when the middle mouse
472
478
  # button (on a three button mouse) is down.
473
479
  #
474
480
  # The Orbit tool is activated by default when the middle mouse button is down.
@@ -499,7 +505,7 @@ class Sketchup::Tool
499
505
  def onMButtonDown(flags, x, y, view)
500
506
  end
501
507
 
502
- # The #{onMButtonUp} method is called by SketchUp when the middle mouse button
508
+ # The {#onMButtonUp} method is called by SketchUp when the middle mouse button
503
509
  # (on a three button mouse) is released.
504
510
  #
505
511
  # SketchUp returns to the previous tool from the Orbit tool when the middle
@@ -531,7 +537,7 @@ class Sketchup::Tool
531
537
  def onMButtonUp(flags, x, y, view)
532
538
  end
533
539
 
534
- # The #{onMouseEnter} method is called by SketchUp when the mouse enters the
540
+ # The {#onMouseEnter} method is called by SketchUp when the mouse enters the
535
541
  # viewport.
536
542
  #
537
543
  # @example
@@ -545,7 +551,7 @@ class Sketchup::Tool
545
551
  def onMouseEnter(view)
546
552
  end
547
553
 
548
- # The #{onMouseLeave} method is called by SketchUp when the mouse leaves the
554
+ # The {#onMouseLeave} method is called by SketchUp when the mouse leaves the
549
555
  # viewport.
550
556
  #
551
557
  # @example
@@ -559,7 +565,7 @@ class Sketchup::Tool
559
565
  def onMouseLeave(view)
560
566
  end
561
567
 
562
- # The #{onMouseMove} method is called by SketchUp whenever the mouse is moved.
568
+ # The {#onMouseMove} method is called by SketchUp whenever the mouse is moved.
563
569
  # You will often want to implement this method.
564
570
  #
565
571
  # Try to make this method as efficient as possible because this method is
@@ -589,7 +595,7 @@ class Sketchup::Tool
589
595
  def onMouseMove(flags, x, y, view)
590
596
  end
591
597
 
592
- # The #{onMouseWheel} method is called by SketchUp when the mouse scroll wheel
598
+ # The {#onMouseWheel} method is called by SketchUp when the mouse scroll wheel
593
599
  # is used.
594
600
  #
595
601
  # @example
@@ -660,7 +666,7 @@ class Sketchup::Tool
660
666
  def onMouseWheel(flags, delta, x, y, view)
661
667
  end
662
668
 
663
- # The #{onRButtonDoubleClick} is called by SketchUp when the user double clicks
669
+ # The {#onRButtonDoubleClick} is called by SketchUp when the user double clicks
664
670
  # with the right mouse button.
665
671
  #
666
672
  # @example
@@ -687,7 +693,7 @@ class Sketchup::Tool
687
693
  def onRButtonDoubleClick(flags, x, y, view)
688
694
  end
689
695
 
690
- # The #{onRButtonDown} method is called by SketchUp when the user presses
696
+ # The {#onRButtonDown} method is called by SketchUp when the user presses
691
697
  # the right mouse button. Implement this method, along with the tool.getMenu
692
698
  # method, when you want your tool to do something other than display the
693
699
  # default context menu when the right mouse button is clicked.
@@ -716,7 +722,7 @@ class Sketchup::Tool
716
722
  def onRButtonDown(flags, x, y, view)
717
723
  end
718
724
 
719
- # The #{onRButtonUp} method is called by SketchUp when the user releases the
725
+ # The {#onRButtonUp} method is called by SketchUp when the user releases the
720
726
  # right mouse button.
721
727
  #
722
728
  # @example
@@ -760,7 +766,7 @@ class Sketchup::Tool
760
766
  def onReturn(view)
761
767
  end
762
768
 
763
- # The #{onSetCursor} method is called by SketchUp when the tool wants to set
769
+ # The {#onSetCursor} method is called by SketchUp when the tool wants to set
764
770
  # the cursor.
765
771
  #
766
772
  # @example
@@ -783,7 +789,7 @@ class Sketchup::Tool
783
789
  # def onUserText(text, view)
784
790
  # @distance = text.to_l
785
791
  # rescue ArgumentError
786
- # view.tooltop = 'Invalid length'
792
+ # view.tooltip = 'Invalid length'
787
793
  # end
788
794
  #
789
795
  # @param [String] text
@@ -796,7 +802,7 @@ class Sketchup::Tool
796
802
  def onUserText(text, view)
797
803
  end
798
804
 
799
- # The #{resume} method is called by SketchUp when the tool becomes active again
805
+ # The {#resume} method is called by SketchUp when the tool becomes active again
800
806
  # after being suspended.
801
807
  #
802
808
  # @example
@@ -810,7 +816,7 @@ class Sketchup::Tool
810
816
  def resume(view)
811
817
  end
812
818
 
813
- # The #{suspend} method is called by SketchUp when the tool temporarily becomes
819
+ # The {#suspend} method is called by SketchUp when the tool temporarily becomes
814
820
  # inactive because another tool has been activated. This typically happens
815
821
  # when a viewing tool is activated, such as when orbit is active due to the
816
822
  # middle mouse button.
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2020 Trimble Inc.
1
+ # Copyright:: Copyright 2021 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The Tools class contains methods to manipulate a collection of SketchUp
@@ -16,7 +16,7 @@ class Sketchup::Tools
16
16
  #
17
17
  # @example
18
18
  # tools = Sketchup.active_model.tools
19
- # tool = tools.current
19
+ # tool = tools.active_tool
20
20
  #
21
21
  # @return [Object, nil] Returns the active Ruby tool, or `nil` otherwise.
22
22
  #
@@ -1,9 +1,7 @@
1
- # Copyright:: Copyright 2020 Trimble Inc.
1
+ # Copyright:: Copyright 2021 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
- # This observer interface is implemented to react to tool events. To implement
5
- # this observer, create a Ruby class of this type, override the desired
6
- # methods, and add an instance of the observer to the {Sketchup::Tools} object.
4
+ # This observer interface is implemented to react to tool events.
7
5
  #
8
6
  # Some of the code below mentions +tool_names+ and +tool_ids+. Here is a list
9
7
  # of the common tool IDs and names:
@@ -42,6 +40,10 @@
42
40
  # - +21020+ = SketchTool
43
41
  # - +21405+ = TextTool
44
42
  #
43
+ # @abstract To implement this observer, create a Ruby class of this type,
44
+ # override the desired methods, and add an instance of the observer to the
45
+ # {Sketchup::Tools} object.
46
+ #
45
47
  # @example
46
48
  # # This is an example of an observer that watches tool interactions.
47
49
  # class MyToolsObserver < Sketchup::ToolsObserver
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2020 Trimble Inc.
1
+ # Copyright:: Copyright 2021 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # The UV Helper class contains methods allowing you to determine the location
@@ -14,45 +14,55 @@ class Sketchup::UVHelper
14
14
 
15
15
  # Instance Methods
16
16
 
17
- # The get_back_UVQ method is used to get the UV coordinates for the back of a
18
- # face.
17
+ # The {#get_back_UVQ} method is used to get the UV texture coordinates on the
18
+ # back of a face.
19
19
  #
20
20
  # @example
21
- # uv_helper = face.get_UVHelper true, true, my_texture_writer
21
+ # uv_helper = face.get_UVHelper(true, true, my_texture_writer)
22
22
  # face.outer_loop.vertices.each do |vert|
23
- # uvq = uv_help.get_back_UVQ(vert.position)
24
- # puts "u=" + uvq.x.to_s + " v=" + uvq.y.to_s
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}""
25
28
  # end
26
29
  #
27
- # @param point
28
- # A Point3d object containing one of the 3D vertexes of
29
- # the face.
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
30
34
  #
31
- # @return point - a Point3d containing the UV coordinates where
32
- # the X value is the U value, the Y value is the V value
33
- # and the Z value is a Q value (which is not used).
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.
34
39
  #
35
40
  # @version SketchUp 6.0
36
41
  def get_back_UVQ(point)
37
42
  end
38
43
 
39
- # The get_front_UVQ method is used to get the UV coordinates for a front of a
40
- # face.
44
+ # The {#get_front_UVQ} method is used to get the UV texture coordinates on the
45
+ # front of a face.
41
46
  #
42
47
  # @example
43
- # uv_helper = face.get_UVHelper true, true, my_texture_writer
48
+ # uv_helper = face.get_UVHelper(true, true, my_texture_writer)
44
49
  # face.outer_loop.vertices.each do |vert|
45
50
  # uvq = uv_helper.get_front_UVQ(vert.position)
46
- # puts "u=" + uvq.x.to_s + " v=" + uvq.y.to_s
51
+ # # "Normalize" UVQ to UV.
52
+ # u = uvq.u / unq.q
53
+ # v = uvq.v / unq.q
54
+ # puts "u=#{u} v=#{v}""
47
55
  # end
48
56
  #
49
- # @param point
50
- # A Point3d object containing one of the 3D vertexes of
51
- # the face.
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.
52
64
  #
53
- # @return point - a Point3d containing the UV coordinates where
54
- # the X value is the U value, the Y value is the V value
55
- # and the Z value is a Q value (which is not used).
65
+ # @return [Geom::Point3d] Point where X represents U, Y represents V and Z represents Q.
56
66
  #
57
67
  # @version SketchUp 6.0
58
68
  def get_front_UVQ(point)
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2020 Trimble Inc.
1
+ # Copyright:: Copyright 2021 Trimble Inc.
2
2
  # License:: The MIT License (MIT)
3
3
 
4
4
  # A Vertex. A Vertex represents the end of an Edge or a point inside a Face.
@@ -1,4 +1,4 @@
1
- # Copyright:: Copyright 2020 Trimble Inc.
1
+ # Copyright:: Copyright 2021 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
@@ -91,15 +91,13 @@ class Sketchup::View
91
91
  #
92
92
  # @overload camera=(camera)
93
93
  #
94
- # @param camera [Sketchup::Camera] The new Camera object.
95
- # @return [Sketchup::Camera]
94
+ # @param [Sketchup::Camera] camera The new camera object.
96
95
  #
97
96
  # @overload camera=(camera_and_transition)
98
97
  #
99
- # @param camera_and_transition [Array(Sketchup::Camera, Float)]
98
+ # @param [Array(Sketchup::Camera, Float)] camera_and_transition
100
99
  # The second item in the array represents the transition time from the
101
- # existing camera to the new one
102
- # @return [Array(Sketchup::Camera, Float)]
100
+ # existing camera to the new one.
103
101
  #
104
102
  # @version SketchUp 6.0
105
103
  def camera=(arg)
@@ -246,11 +244,11 @@ class Sketchup::View
246
244
  # light will affect it. By providing an array of vertex normals lighting
247
245
  # is turned on and will use the model's current light. Note that the number
248
246
  # of normals must match the number of points provided.
249
- # @option options [Integer] :texture_id
247
+ # @option options [Integer] :texture
250
248
  # A texture id provided by {#load_texture}.
251
249
  # @option options [Array<Geom::Vector3d>] :uvs
252
250
  # Set of UV (Not UVQ) coordinates matching the number of points provided.
253
- # This must be used along with the +:texture_id+ option.
251
+ # This must be used along with the +:texture+ option.
254
252
  #
255
253
  # @overload draw(openglenum, *points, **options)
256
254
  #
@@ -265,11 +263,11 @@ class Sketchup::View
265
263
  # light will affect it. By providing an array of vertex normals lighting
266
264
  # is turned on and will use the model's current light. Note that the number
267
265
  # of normals must match the number of points provided.
268
- # @option options [Integer] :texture_id
266
+ # @option options [Integer] :texture
269
267
  # A texture id provided by {#load_texture}.
270
268
  # @option options [Array<Geom::Vector3d>] :uvs
271
269
  # Set of UV (Not UVQ) coordinates matching the number of points provided.
272
- # This must be used along with the +:texture_id+ option.
270
+ # This must be used along with the +:texture+ option.
273
271
  #
274
272
  # @return [Sketchup::View]
275
273
  #
@@ -320,11 +318,11 @@ class Sketchup::View
320
318
  # from the comments, such as +GL_LINES+.
321
319
  # @param [Array<Geom::Point3d>] points
322
320
  # @param [Hash] options
323
- # @option options [Integer] :texture_id
321
+ # @option options [Integer] :texture
324
322
  # A texture id provided by {#load_texture}.
325
323
  # @option options [Array<Geom::Vector3d>] :uvs
326
324
  # Set of UV (Not UVQ) coordinates matching the number of points provided.
327
- # This must be used along with the +:texture_id+ option.
325
+ # This must be used along with the +:texture+ option.
328
326
  #
329
327
  # @overload draw2d(openglenum, *points, **options)
330
328
  #
@@ -334,11 +332,11 @@ class Sketchup::View
334
332
  # from the comments, such as +GL_LINES+.
335
333
  # @param [Array<Geom::Point3d>] points
336
334
  # @param [Hash] options
337
- # @option options [Integer] :texture_id
335
+ # @option options [Integer] :texture
338
336
  # A texture id provided by {#load_texture}.
339
337
  # @option options [Array<Geom::Vector3d>] :uvs
340
338
  # Set of UV (Not UVQ) coordinates matching the number of points provided.
341
- # This must be used along with the +:texture_id+ option.
339
+ # This must be used along with the +:texture+ option.
342
340
  #
343
341
  # @return [Sketchup::View]
344
342
  #
@@ -362,15 +360,16 @@ class Sketchup::View
362
360
  # status = view.drawing_color="red"
363
361
  # status = view.draw_lines point4, point5
364
362
  #
365
- # @overload draw_lines(point_list, ...)
363
+ # @overload draw_lines(points, ...)
366
364
  #
367
- # @param point_list [Array<Geom::Point3d>] An even number of Point3d objects.
368
- # @return [Sketchup::View] returns the View object
365
+ # @param [Array<Geom::Point3d>] points
366
+ # An even number of Point3d objects.
367
+ # @return [Sketchup::View]
369
368
  #
370
- # @overload draw_lines(pts)
369
+ # @overload draw_lines(points)
371
370
  #
372
- # @param pts [Array<Geom::Point3d>] An array of Point3d objects.
373
- # @return [Sketchup::View] returns the View object
371
+ # @param [Array<Geom::Point3d>] points An array of Point3d objects.
372
+ # @return [Sketchup::View]
374
373
  #
375
374
  # @version SketchUp 6.0
376
375
  def draw_line(*args)
@@ -388,15 +387,16 @@ class Sketchup::View
388
387
  # status = view.drawing_color="red"
389
388
  # status = view.draw_lines point4, point5
390
389
  #
391
- # @overload draw_lines(point_list, ...)
390
+ # @overload draw_lines(points, ...)
392
391
  #
393
- # @param point_list [Array<Geom::Point3d>] An even number of Point3d objects.
394
- # @return [Sketchup::View] returns the View object
392
+ # @param [Array<Geom::Point3d>] points
393
+ # An even number of Point3d objects.
394
+ # @return [Sketchup::View]
395
395
  #
396
- # @overload draw_lines(pts)
396
+ # @overload draw_lines(points)
397
397
  #
398
- # @param pts [Array<Geom::Point3d>] An array of Point3d objects.
399
- # @return [Sketchup::View] returns the View object
398
+ # @param [Array<Geom::Point3d>] points An array of Point3d objects.
399
+ # @return [Sketchup::View]
400
400
  #
401
401
  # @version SketchUp 6.0
402
402
  def draw_lines(*args)
@@ -409,26 +409,23 @@ class Sketchup::View
409
409
  # @example
410
410
  # point3 = Geom::Point3d.new 0,0,0
411
411
  # # returns a view
412
- # status = view.draw_points point3, 10, 1, "red"
412
+ # status = view.draw_points(point3, 10, 1, "red")
413
413
  #
414
- # @param [Array<Geom::Point3d>] pts
415
- # An array of Point3d objects.
414
+ # @param [Array<Geom::Point3d>] points
416
415
  #
417
- # @param [Integer] pointsize
416
+ # @param [Integer] size
418
417
  # Size of the point in pixels.
419
418
  #
420
- # @param [Sketchup::Color] pointcolor
421
- # Color of the point.
422
- #
423
- # @param [Integer] pointstyle
424
- # Style of the point. 1 = open square,
425
- # 2 = filled square, 3 = "+", 4 = "X", 5 = "*",
419
+ # @param [Integer] style
420
+ # 1 = open square, 2 = filled square, 3 = "+", 4 = "X", 5 = "*",
426
421
  # 6 = open triangle, 7 = filled triangle.
427
422
  #
423
+ # @param [Sketchup::Color] color
424
+ #
428
425
  # @return [Sketchup::View] a View object
429
426
  #
430
427
  # @version SketchUp 6.0
431
- def draw_points(pts, pointsize = 6, pointstyle = 3, pointcolor = 'black')
428
+ def draw_points(points, size = 6, style = 3, color = 'black')
432
429
  end
433
430
 
434
431
  # The draw_polyline method is used to draw a series of connected line segments
@@ -443,15 +440,15 @@ class Sketchup::View
443
440
  # point15 = Geom::Point3d.new 30,30,30
444
441
  # status = view.draw_polyline point12, point13, point14, point15
445
442
  #
446
- # @overload draw_polyline(point_list, ...)
443
+ # @overload draw_polyline(points, ...)
447
444
  #
448
- # @param point_list [Array<Geom::Point3d>] An even number of Point3d objects.
449
- # @return [Sketchup::View] a View object
445
+ # @param [Array<Geom::Point3d>] points An even number of Point3d objects.
446
+ # @return [Sketchup::View]
450
447
  #
451
- # @overload draw_polyline(pts)
448
+ # @overload draw_polyline(points)
452
449
  #
453
- # @param pts [Array<Geom::Point3d>] An array of Point3d objects.
454
- # @return [Sketchup::View] a View object
450
+ # @param [Array<Geom::Point3d>] points An array of Point3d objects.
451
+ # @return [Sketchup::View]
455
452
  #
456
453
  # @version SketchUp 6.0
457
454
  def draw_polyline(*args)
@@ -473,7 +470,7 @@ class Sketchup::View
473
470
  # class ExampleTool
474
471
  # def draw(view)
475
472
  # # This works in all SketchUp versions and draws the text using the
476
- # # default font, color and size.
473
+ # # default font, size and color (i.e. the model edge color).
477
474
  # point = Geom::Point3d.new(200, 100, 0)
478
475
  # view.draw_text(point, "This is a test")
479
476
  #
@@ -498,14 +495,14 @@ class Sketchup::View
498
495
  # IS_WIN = Sketchup.platform == :platform_win
499
496
  #
500
497
  # def draw(view)
501
- # draw_text(view, "Hello World", size: 20)
498
+ # draw_text(view, [100, 200, 0], "Hello World", size: 20)
502
499
  # end
503
500
  #
504
501
  # private
505
502
  #
506
503
  # # This will ensure text is drawn with consistent size across platforms,
507
504
  # # using pixels as size units.
508
- # def draw_text(view, text, **options)
505
+ # def draw_text(view, position, text, **options)
509
506
  # native_options = options.dup
510
507
  # if IS_WIN && options.key?(:size)
511
508
  # native_options[:size] = pixels_to_points(size)
@@ -763,7 +760,6 @@ class Sketchup::View
763
760
  # @example
764
761
  # module Example
765
762
  # class MyTool
766
- #
767
763
  # def activate
768
764
  # view = Sketchup.active_model.active_view
769
765
  # image_rep = view.model.materials.current.texture.image_rep
@@ -777,9 +773,8 @@ class Sketchup::View
777
773
  # def draw(view)
778
774
  # points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
779
775
  # uvs = [ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] ]
780
- # view.draw(points, texture_id: @texture_id, uvs: uvs)
776
+ # view.draw(GL_QUADS, points, texture: @texture_id, uvs: uvs)
781
777
  # end
782
- #
783
778
  # end
784
779
  # end
785
780
  # Sketchup.active_model.select_tool(Example::MyTool.new)
@@ -804,16 +799,20 @@ class Sketchup::View
804
799
  # @see #release_texture
805
800
  #
806
801
  # @see #draw
802
+ #
803
+ # @version SketchUp 2020.0
807
804
  def load_texture(image_rep)
808
805
  end
809
806
 
810
- # The lock_inference method is used to lock or unlock an inference.
807
+ # The {#lock_inference} method is used to lock or unlock an inference.
811
808
  #
812
809
  # This method will typically be called from inside a tool class when the user
813
- # presses the shift key.
810
+ # presses the shift key or arrow keys.
814
811
  #
815
- # With no arguments it unlocks all inferences. With one or two arguments, it
816
- # locks the inference based on the given InputPoint(s).
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.
817
816
  #
818
817
  # @example
819
818
  # view = view.lock_inference
@@ -826,14 +825,19 @@ class Sketchup::View
826
825
  # @overload lock_inference(inputpoint)
827
826
  #
828
827
  # @param [Sketchup::InputPoint] inputpoint
829
- # 1st InputPoint to inference to.
830
828
  #
831
829
  # @overload lock_inference(inputpoint, inputpoint2)
832
830
  #
833
831
  # @param [Sketchup::InputPoint] inputpoint
834
- # 1st InputPoint to inference to.
835
832
  # @param [Sketchup::InputPoint] inputpoint2
836
- # 2nd InputPoint to inference to.
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
+ # )
837
841
  #
838
842
  # @return [Sketchup::View] a View object
839
843
  #
@@ -949,7 +953,6 @@ class Sketchup::View
949
953
  # @example
950
954
  # module Example
951
955
  # class MyTool
952
- #
953
956
  # def activate
954
957
  # view = Sketchup.active_model.active_view
955
958
  # image_rep = view.model.materials.current.texture.image_rep
@@ -963,9 +966,8 @@ class Sketchup::View
963
966
  # def draw(view)
964
967
  # points = [ [0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0] ]
965
968
  # uvs = [ [0, 0, 0], [1, 0, 0], [1, 1, 0], [0, 1, 0] ]
966
- # view.draw(points, texture_id: @texture_id, uvs: uvs)
969
+ # view.draw(GL_QUADS, points, texture: @texture_id, uvs: uvs)
967
970
  # end
968
- #
969
971
  # end
970
972
  # end
971
973
  # Sketchup.active_model.select_tool(Example::MyTool.new)
@@ -1166,7 +1168,7 @@ class Sketchup::View
1166
1168
  # view = model.active_view
1167
1169
  # height = view.vpheight
1168
1170
  #
1169
- # @return [Integer] the height of the viewport in pixels.
1171
+ # @return [Integer] the height of the viewport in physical pixels.
1170
1172
  #
1171
1173
  # @version SketchUp 6.0
1172
1174
  def vpheight
@@ -1178,7 +1180,7 @@ class Sketchup::View
1178
1180
  # @example
1179
1181
  # width = view.vpwidth
1180
1182
  #
1181
- # @return [Integer] the width of the viewport in pixels.
1183
+ # @return [Integer] the width of the viewport in physical pixels.
1182
1184
  #
1183
1185
  # @version SketchUp 6.0
1184
1186
  def vpwidth
@@ -1186,15 +1188,19 @@ class Sketchup::View
1186
1188
 
1187
1189
  # The {#write_image} method is used to write the current view to an image file.
1188
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
+ #
1189
1195
  # @overload write_image(filename, width = view.vpwidth, height = view.vpheight, antialias = false, compression = 1.0)
1190
1196
  #
1191
1197
  # @note Prefer the overload with option hash instead of this variant. This
1192
1198
  # overload is not updated with new options.
1193
1199
  #
1194
1200
  # @example
1195
- # filename => "c:/tmp/write_image.png"
1196
- # antialias => false
1197
- # compression => 0.9
1201
+ # filename = File.join(Sketchup.temp_dir, 'example.png')
1202
+ # antialias = false
1203
+ # compression = 0.9
1198
1204
  # model = Sketchup.active_model
1199
1205
  # view = model.active_view
1200
1206
  # view.write_image(filename, 640, 480, antialias, compression)
@@ -1213,7 +1219,7 @@ class Sketchup::View
1213
1219
  #
1214
1220
  # @example
1215
1221
  # options = {
1216
- # :filename => "c:/tmp/write_image.png",
1222
+ # :filename => File.join(Sketchup.temp_dir, 'example.png'),
1217
1223
  # :width => 640,
1218
1224
  # :height => 480,
1219
1225
  # :antialias => false,
@@ -1227,7 +1233,7 @@ class Sketchup::View
1227
1233
  # @version SketchUp 7
1228
1234
  # @param [Hash] options
1229
1235
  # @option options [String] filename The filename for the saved image.
1230
- # @option options [Integer] width (#vpwidth) Width in pixels (max +1600+).
1236
+ # @option options [Integer] width (#vpwidth) Width in pixels (max +16000+).
1231
1237
  # @option options [Integer] height (#vpheight) Height in pixels (max +16000+).
1232
1238
  # @option options [Float] scale_factor (1.0) Scaling factor for
1233
1239
  # elements that are viewport dependent, such as text heights, arrow heads,
@@ -1245,7 +1251,7 @@ class Sketchup::View
1245
1251
  #
1246
1252
  # @example
1247
1253
  # options = {
1248
- # :filename => "c:/tmp/write_image.png",
1254
+ # :filename => File.join(Sketchup.temp_dir, 'example.png'),
1249
1255
  # :source => :framebuffer,
1250
1256
  # :compression => 0.9,
1251
1257
  # }