sketchup-api-stubs 0.7.7 → 0.7.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/sketchup-api-stubs/sketchup.rb +2 -1
- data/lib/sketchup-api-stubs/stubs/{array.rb → Array.rb} +1 -1
- 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 +18 -4
- 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 +16 -14
- data/lib/sketchup-api-stubs/stubs/{geom.rb → Geom.rb} +1 -1
- data/lib/sketchup-api-stubs/stubs/{languagehandler.rb → LanguageHandler.rb} +5 -4
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +76 -54
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +311 -24
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +8 -4
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +2 -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 +1 -1
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +16 -11
- 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 +2 -2
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +1 -1
- 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 +2 -2
- 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 +9 -11
- 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/Layout.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/{length.rb → Length.rb} +1 -1
- data/lib/sketchup-api-stubs/stubs/{numeric.rb → Numeric.rb} +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +13 -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 +50 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +7 -8
- 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 +7 -6
- 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 +120 -41
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +272 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +27 -7
- 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/Request.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.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 +4 -2
- 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 +7 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +8 -8
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +3 -3
- 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 +2 -2
- 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 +68 -71
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +7 -7
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +2 -2
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +4 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +1 -1
- 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 +2 -2
- 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 +7 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +2 -2
- 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 +5 -3
- 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 +9 -5
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +14 -4
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +1 -1
- data/lib/sketchup-api-stubs/stubs/{sketchup.rb → Sketchup.rb} +10 -3
- data/lib/sketchup-api-stubs/stubs/{sketchupextension.rb → SketchupExtension.rb} +1 -1
- data/lib/sketchup-api-stubs/stubs/{string.rb → String.rb} +1 -1
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +79 -7
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +26 -8
- 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 +18 -16
- data/lib/sketchup-api-stubs/stubs/{ui.rb → UI.rb} +25 -14
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +1 -1
- metadata +12 -11
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2022 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# The {Sketchup::Entities} class is a collection of Entity objects, either in a
|
@@ -69,51 +69,53 @@ class Sketchup::Entities
|
|
69
69
|
# The add_3d_text is used to create 3D text. It will be added as edges and
|
70
70
|
# faces drawn at the origin.
|
71
71
|
#
|
72
|
-
#
|
73
|
-
# # Draw the word "test" at the origin of the model, aligned left, in
|
74
|
-
# # Arial Bold, not italics, 1" in size, best tolerance quality, filled,
|
75
|
-
# # with an extrusion size of 5".
|
76
|
-
# entities = Sketchup.active_model.entities
|
77
|
-
# success = entities.add_3d_text('test', TextAlignLeft, "Arial",
|
78
|
-
# true, false, 1.0, 0.0, 0.5, true, 5.0)
|
72
|
+
# = 1.0, tolerance = 0.0, z = 0.0, is_filled = true, extrusion = 0.0)
|
79
73
|
#
|
80
|
-
#
|
81
|
-
#
|
74
|
+
# @param [String] string
|
75
|
+
# The text to create.
|
82
76
|
#
|
83
|
-
#
|
84
|
-
#
|
85
|
-
#
|
86
|
-
#
|
77
|
+
# @param [Integer] alignment
|
78
|
+
# Number that defines the alignment. There are constants
|
79
|
+
# called TextAlignLeft, TextAlignRight, and
|
80
|
+
# TextAlignCenter that can be passed.
|
87
81
|
#
|
88
|
-
#
|
89
|
-
#
|
82
|
+
# @param [String] font
|
83
|
+
# font name.
|
90
84
|
#
|
91
|
-
#
|
92
|
-
#
|
85
|
+
# @param [Boolean] is_bold
|
86
|
+
# true for bold.
|
93
87
|
#
|
94
|
-
#
|
95
|
-
#
|
88
|
+
# @param [Boolean] is_italic
|
89
|
+
# true for italic.
|
96
90
|
#
|
97
|
-
#
|
98
|
-
#
|
91
|
+
# @param [Numeric] letter_height
|
92
|
+
# Height of the text in inches.
|
99
93
|
#
|
100
|
-
#
|
101
|
-
#
|
102
|
-
#
|
94
|
+
# @param [Numeric] tolerance
|
95
|
+
# Tolerance of the curve creation. Defaults to
|
96
|
+
# 0.0, which creates the highest possible curve quality.
|
103
97
|
#
|
104
|
-
#
|
105
|
-
#
|
98
|
+
# @param [Numeric] z
|
99
|
+
# z position in inches.
|
106
100
|
#
|
107
|
-
#
|
108
|
-
#
|
101
|
+
# @param [Boolean] is_filled
|
102
|
+
# true for filled, which will put a face between the edges of the letters.
|
109
103
|
#
|
110
|
-
#
|
111
|
-
#
|
104
|
+
# @param [Numeric] extrusion
|
105
|
+
# Extrusion depth in inches.
|
106
|
+
#
|
107
|
+
# @example
|
108
|
+
# # Draw the word "test" at the origin of the model, aligned left, in
|
109
|
+
# # Arial Bold, not italics, 1" in size, best tolerance quality, filled,
|
110
|
+
# # with an extrusion size of 5".
|
111
|
+
# entities = Sketchup.active_model.entities
|
112
|
+
# success = entities.add_3d_text('test', TextAlignLeft, "Arial",
|
113
|
+
# true, false, 1.0, 0.0, 0.5, true, 5.0)
|
112
114
|
#
|
113
115
|
# @return [Boolean] true if successful
|
114
116
|
#
|
115
117
|
# @version SketchUp 6.0
|
116
|
-
def add_3d_text(string, alignment, font, is_bold = false, is_italic = false, letter_height
|
118
|
+
def add_3d_text(string, alignment, font, is_bold = false, is_italic = false, letter_height)
|
117
119
|
end
|
118
120
|
|
119
121
|
# The add_arc method is used to create an arc curve segment.
|
@@ -263,6 +265,10 @@ class Sketchup::Entities
|
|
263
265
|
|
264
266
|
# The {#add_dimension_linear} method adds a linear dimension to the entities.
|
265
267
|
#
|
268
|
+
# [instance_path, end_point], vector)
|
269
|
+
#
|
270
|
+
# vector)
|
271
|
+
#
|
266
272
|
# @example
|
267
273
|
# entities = Sketchup.active_model.entities
|
268
274
|
# # From point to point
|
@@ -288,7 +294,7 @@ class Sketchup::Entities
|
|
288
294
|
# start_point = edge.start.position
|
289
295
|
# end_point = edge.end.position
|
290
296
|
# vector = Geom::Vector3d.new(30, 30, 0)
|
291
|
-
# Sketchup.active_model.entities.add_dimension_linear([instance_path, start_point],
|
297
|
+
# Sketchup.active_model.entities.add_dimension_linear([instance_path, start_point],
|
292
298
|
#
|
293
299
|
# @example Instance path as an array
|
294
300
|
# instance = Sketchup.active_model.active_entities.grep(Sketchup::ComponentInstance).first
|
@@ -297,7 +303,7 @@ class Sketchup::Entities
|
|
297
303
|
# start_point = edge.start.position
|
298
304
|
# end_point = edge.end.position
|
299
305
|
# vector = Geom::Vector3d.new(30, 30, 0)
|
300
|
-
# Sketchup.active_model.entities.add_dimension_linear([path, start_point], [path, end_point],
|
306
|
+
# Sketchup.active_model.entities.add_dimension_linear([path, start_point], [path, end_point],
|
301
307
|
#
|
302
308
|
# @overload add_dimension_linear(start_pt_or_entity, end_pt_or_entity, offset_vector)
|
303
309
|
#
|
@@ -400,6 +406,10 @@ class Sketchup::Entities
|
|
400
406
|
#
|
401
407
|
# @return [Array<Sketchup::Edge>] an array of Edge objects if successful
|
402
408
|
#
|
409
|
+
# @see Sketchup::EntitiesBuilder#add_edges
|
410
|
+
# EntitiesBuilder#add_edges, alternative
|
411
|
+
# for generating bulk geometry with performance in mind.
|
412
|
+
#
|
403
413
|
# @version SketchUp 6.0
|
404
414
|
def add_edges(*args)
|
405
415
|
end
|
@@ -416,9 +426,6 @@ class Sketchup::Entities
|
|
416
426
|
# For the last form that takes a Curve, the curve must be closed - like a
|
417
427
|
# circle.
|
418
428
|
#
|
419
|
-
# Note that a special case exists for any face created on the ground plane, in
|
420
|
-
# which case the vertex order is ignored and the face is always facing down.
|
421
|
-
#
|
422
429
|
# @example
|
423
430
|
# depth = 100
|
424
431
|
# width = 100
|
@@ -432,6 +439,9 @@ class Sketchup::Entities
|
|
432
439
|
# # Add the face to the entities in the model
|
433
440
|
# face = entities.add_face(pts)
|
434
441
|
#
|
442
|
+
# @note A special case exists for any face created on the ground plane, in
|
443
|
+
# which case the vertex order is ignored and the face is always facing down.
|
444
|
+
#
|
435
445
|
# @overload add_face(entities)
|
436
446
|
#
|
437
447
|
# @param [Array<Sketchup::Edge>, Array<Geom::Point3d>, Sketchup::Curve] entities
|
@@ -442,12 +452,19 @@ class Sketchup::Entities
|
|
442
452
|
#
|
443
453
|
# @return [Sketchup::Face, nil]
|
444
454
|
#
|
455
|
+
# @see Sketchup::EntitiesBuilder#add_face
|
456
|
+
# EntitiesBuilder#add_face, alternative
|
457
|
+
# for generating bulk geometry with performance in mind.
|
458
|
+
#
|
459
|
+
# @see file:pages/generating_geometry.md
|
460
|
+
# Guide on Generating Geometry
|
461
|
+
#
|
445
462
|
# @version SketchUp 6.0
|
446
463
|
def add_face(*args)
|
447
464
|
end
|
448
465
|
|
449
|
-
# The {#add_faces_from_mesh} method is used to add Face
|
450
|
-
# collection of entities from a PolygonMesh.
|
466
|
+
# The {#add_faces_from_mesh} method is used to add {Sketchup::Face} entities to the
|
467
|
+
# collection of entities from a {Geom::PolygonMesh}.
|
451
468
|
#
|
452
469
|
# The +smooth_flags+ parameter can contain any of the following values if
|
453
470
|
# passed. The constants were added in SketchUp 2014. For previous versions,
|
@@ -459,7 +476,7 @@ class Sketchup::Entities
|
|
459
476
|
# - 4: {Geom::PolygonMesh::AUTO_SOFTEN} (Interior edges are softened.)
|
460
477
|
# - 8: {Geom::PolygonMesh::SMOOTH_SOFT_EDGES} (All soft edges will also be smooth.)
|
461
478
|
#
|
462
|
-
# The 3rd and 4th parameters will accept a {
|
479
|
+
# The 3rd and 4th parameters will accept a {Sketchup::Material} object or a
|
463
480
|
# string name of a material currently in the model.
|
464
481
|
#
|
465
482
|
# @example
|
@@ -492,6 +509,13 @@ class Sketchup::Entities
|
|
492
509
|
#
|
493
510
|
# @return [Integer] Number of faces created
|
494
511
|
#
|
512
|
+
# @see Sketchup::EntitiesBuilder
|
513
|
+
# EntitiesBuilder, alternative interface
|
514
|
+
# for generating bulk geometry with performance in mind.
|
515
|
+
#
|
516
|
+
# @see file:pages/generating_geometry.md
|
517
|
+
# Guide on Generating Geometry
|
518
|
+
#
|
495
519
|
# @version SketchUp 6.0
|
496
520
|
def add_faces_from_mesh(polygon_mesh, smooth_flags = Geom::PolygonMesh::AUTO_SOFTEN|Geom::PolygonMesh::SMOOTH_SOFT_EDGES, f_material = nil, b_material = nil)
|
497
521
|
end
|
@@ -621,6 +645,13 @@ class Sketchup::Entities
|
|
621
645
|
#
|
622
646
|
# @return [Sketchup::Edge] a Edge object if successful
|
623
647
|
#
|
648
|
+
# @see Sketchup::EntitiesBuilder#add_edge
|
649
|
+
# EntitiesBuilder#add_edge, alternative
|
650
|
+
# for generating bulk geometry with performance in mind.
|
651
|
+
#
|
652
|
+
# @see file:pages/generating_geometry.md
|
653
|
+
# Guide on Generating Geometry
|
654
|
+
#
|
624
655
|
# @version SketchUp 6.0
|
625
656
|
def add_line(point1, point2)
|
626
657
|
end
|
@@ -770,6 +801,47 @@ class Sketchup::Entities
|
|
770
801
|
def at(entity_index)
|
771
802
|
end
|
772
803
|
|
804
|
+
# Creates an {Sketchup::EntitiesBuilder} that can be used to generate bulk
|
805
|
+
# geometry with performance in mind. This is particularly useful for importers
|
806
|
+
# where the geometry is already well defined and one wants to recreate it
|
807
|
+
# without further processing.
|
808
|
+
#
|
809
|
+
# The call to {#build} starts an implicit operation, even if no other model
|
810
|
+
# changes are made within the block. This is not the same as
|
811
|
+
# {Sketchup::Model#start_operation}, so it's still recommended to wrap all
|
812
|
+
# model changes, including {#build} with {Sketchup::Model#start_operation} and
|
813
|
+
# {Sketchup::Model#commit_operation}.
|
814
|
+
#
|
815
|
+
# Refer to the documentation of {Sketchup::EntitiesBuilder} for more details.
|
816
|
+
#
|
817
|
+
# @api EntitiesBuilder
|
818
|
+
#
|
819
|
+
# @example
|
820
|
+
# model = Sketchup.active_model
|
821
|
+
# model.entities.build { |builder|
|
822
|
+
# edge = builder.add_edge([0, 0, 0], [9, 0, 0])
|
823
|
+
# edge.material = 'red'
|
824
|
+
# face = builder.add_face([[0, 0, 0], [9, 0, 0], [9, 9, 0], [0, 9, 0]])
|
825
|
+
# face.material = 'maroon'
|
826
|
+
# }
|
827
|
+
#
|
828
|
+
# @note While using {Sketchup::Entities#build} it is important to not
|
829
|
+
# add or remove vertices by other means of the builder. Also don't modify the
|
830
|
+
# position of the vertices in the {Sketchup::Entities} container geometry is
|
831
|
+
# added to. Doing so can break the vertex-cache that de-duplicates the vertices.
|
832
|
+
#
|
833
|
+
# @return [nil]
|
834
|
+
#
|
835
|
+
# @see Sketchup::EntitiesBuilder
|
836
|
+
#
|
837
|
+
# @version SketchUp 2022.0
|
838
|
+
#
|
839
|
+
# @yield [builder]
|
840
|
+
#
|
841
|
+
# @yieldparam [Sketchup::EntitiesBuilder] builder
|
842
|
+
def build
|
843
|
+
end
|
844
|
+
|
773
845
|
# The clear! method is used to remove all entities from the collection of
|
774
846
|
# entities.
|
775
847
|
#
|
@@ -796,7 +868,7 @@ class Sketchup::Entities
|
|
796
868
|
# number = entities.count
|
797
869
|
#
|
798
870
|
# @note Since SketchUp 2014 the count method is inherited from Ruby's
|
799
|
-
# +
|
871
|
+
# +Enumerable+ mix-in module. Prior to that the {#count} method is an alias
|
800
872
|
# for {#length}.
|
801
873
|
#
|
802
874
|
# @return [Integer]
|
@@ -922,6 +994,13 @@ class Sketchup::Entities
|
|
922
994
|
#
|
923
995
|
# @return [Boolean]
|
924
996
|
#
|
997
|
+
# @see Sketchup::EntitiesBuilder
|
998
|
+
# EntitiesBuilder, alternative interface
|
999
|
+
# for generating bulk geometry with performance in mind.
|
1000
|
+
#
|
1001
|
+
# @see file:pages/generating_geometry.md
|
1002
|
+
# Guide on Generating Geometry
|
1003
|
+
#
|
925
1004
|
# @version SketchUp 6.0
|
926
1005
|
def fill_from_mesh(polygon_mesh, weld_vertices = true, smooth_flags = Geom::PolygonMesh::AUTO_SOFTEN|Geom::PolygonMesh::SMOOTH_SOFT_EDGES, f_material = nil, b_material = nil)
|
927
1006
|
end
|
@@ -0,0 +1,272 @@
|
|
1
|
+
# Copyright:: Copyright 2022 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The {Sketchup::EntitiesBuilder} is an interface to generate bulk geometry
|
5
|
+
# with performance in mind.
|
6
|
+
#
|
7
|
+
# This is particularly useful for importers where the geometry is already well
|
8
|
+
# defined and one wants to recreate it without further processing.
|
9
|
+
#
|
10
|
+
# Before the Entities Builder was introduced there were two ways of adding
|
11
|
+
# geometry; the +add_*+ methods of {Sketchup::Entities} and {Geom::PolygonMesh}.
|
12
|
+
#
|
13
|
+
# The former is slow as the methods perform intersection, splitting and merging
|
14
|
+
# of overlapping geometry. This is useful when creating tools similar to the
|
15
|
+
# Line and Rectangle tool.
|
16
|
+
#
|
17
|
+
# {Geom::PolygonMesh} is fast, but it doesn't provide granular control per
|
18
|
+
# face or edge added.
|
19
|
+
#
|
20
|
+
# Entities Builder is similar to {Geom::PolygonMesh} in speed, but with the
|
21
|
+
# flexibility of {Sketchup::Entities}'s +add_*+ methods.
|
22
|
+
#
|
23
|
+
# <i>(See "Creating a triangulated grid" example)</i>
|
24
|
+
#
|
25
|
+
# rdoc-image:../images/entities-builder-grid-example.png
|
26
|
+
#
|
27
|
+
# @api EntitiesBuilder
|
28
|
+
#
|
29
|
+
# @example Creating a triangulated grid
|
30
|
+
# model = Sketchup.active_model
|
31
|
+
# model.start_operation('Create Grid', true)
|
32
|
+
# model.entities.build { |builder|
|
33
|
+
# # Creates a grid similar to Sandbox Tools, with each square
|
34
|
+
# # triangulated with a soft+smooth edge.
|
35
|
+
# 10.times { |x|
|
36
|
+
# 10.times { |y|
|
37
|
+
# # 4 +--+ 3
|
38
|
+
# # |\ |
|
39
|
+
# # | \|
|
40
|
+
# # 1 +--+ 2
|
41
|
+
# pt1 = Geom::Point3d.new(x, y, 0)
|
42
|
+
# pt2 = Geom::Point3d.new(x + 1, y, 0)
|
43
|
+
# pt3 = Geom::Point3d.new(x + 1, y + 1, 0)
|
44
|
+
# pt4 = Geom::Point3d.new(x, y + 1, 0)
|
45
|
+
# face1 = builder.add_face([pt1, pt2, pt4])
|
46
|
+
# face2 = builder.add_face([pt2, pt3, pt4])
|
47
|
+
# material = (x + y).odd? ? 'red' : 'maroon'
|
48
|
+
# face1.material = material
|
49
|
+
# face2.material = material
|
50
|
+
# edge = builder.add_edge(pt2, pt4)
|
51
|
+
# edge.soft = true
|
52
|
+
# edge.smooth = true
|
53
|
+
# }
|
54
|
+
# }
|
55
|
+
# }
|
56
|
+
# model.commit_operation
|
57
|
+
#
|
58
|
+
# @note Like {Geom::PolygonMesh} there is minimal validation checks made on
|
59
|
+
# the input to the creation of the geometry. Vertices are de-duplicated and
|
60
|
+
# edges sharing the same vertices will be de-duplicated. But no intersection
|
61
|
+
# of overlapping entities is made. It leaves a higher responsibility on the
|
62
|
+
# API user to produce valid geometry.
|
63
|
+
#
|
64
|
+
# @note While using {Sketchup::Entities#build} it is important to not
|
65
|
+
# add or remove vertices by other means of the builder. Also don't modify the
|
66
|
+
# position of the vertices in the {Sketchup::Entities} container geometry is
|
67
|
+
# added to. Doing so can break the vertex-cache that de-duplicates the vertices.
|
68
|
+
#
|
69
|
+
# @see file:pages/generating_geometry.md
|
70
|
+
# Guide on Generating Geometry
|
71
|
+
#
|
72
|
+
# @see Sketchup::Entities#build
|
73
|
+
#
|
74
|
+
# @see Sketchup::Entities
|
75
|
+
#
|
76
|
+
# @see Geom::PolygonMesh
|
77
|
+
#
|
78
|
+
# @version SketchUp 2022.0
|
79
|
+
class Sketchup::EntitiesBuilder
|
80
|
+
|
81
|
+
# Instance Methods
|
82
|
+
|
83
|
+
# Adds a {Sketchup::Edge} to the {#entities} collection.
|
84
|
+
#
|
85
|
+
# @api EntitiesBuilder
|
86
|
+
#
|
87
|
+
# @example
|
88
|
+
# model = Sketchup.active_model
|
89
|
+
# model.entities.build { |builder|
|
90
|
+
# edge = builder.add_edge([0, 0, 0], [9, 0, 0])
|
91
|
+
# edge.material = 'red'
|
92
|
+
# }
|
93
|
+
#
|
94
|
+
# @note Does not split intersecting faces or edges.
|
95
|
+
#
|
96
|
+
# @overload add_edge(point1, point2)
|
97
|
+
#
|
98
|
+
# @param [Geom::Point3d] point1
|
99
|
+
# @param [Geom::Point3d] point2
|
100
|
+
#
|
101
|
+
# @overload add_edge(points)
|
102
|
+
#
|
103
|
+
# @param [Array(Geom::Point3d, Geom::Point3d)] points
|
104
|
+
#
|
105
|
+
# @raise [ArgumentError] If the points are considered equal.
|
106
|
+
#
|
107
|
+
# @raise [RuntimeError] If the builder is not valid.
|
108
|
+
#
|
109
|
+
# @return [Sketchup::Edge]
|
110
|
+
#
|
111
|
+
# @see Sketchup::Entities#add_line
|
112
|
+
#
|
113
|
+
# @version SketchUp 2022.0
|
114
|
+
def add_edge(*args)
|
115
|
+
end
|
116
|
+
alias_method :add_line, :add_edge
|
117
|
+
|
118
|
+
# Adds a continuous set of {Sketchup::Edge}'s to the {#entities} collection.
|
119
|
+
#
|
120
|
+
# @api EntitiesBuilder
|
121
|
+
#
|
122
|
+
# @example
|
123
|
+
# model = Sketchup.active_model
|
124
|
+
# model.entities.build { |builder|
|
125
|
+
# edges = builder.add_edges([0, 0, 0], [6, 0, 0], [9, 0, 8]) # => 2 edges
|
126
|
+
# edges.each { |edge|
|
127
|
+
# edge.material = 'red'
|
128
|
+
# }
|
129
|
+
# }
|
130
|
+
#
|
131
|
+
# @note Does not split intersecting faces or edges.
|
132
|
+
#
|
133
|
+
# @overload add_edges(points)
|
134
|
+
#
|
135
|
+
# @param [Array<Geom::Point3d>] points
|
136
|
+
#
|
137
|
+
# @overload add_edges(*points)
|
138
|
+
#
|
139
|
+
# @param [Array<Geom::Point3d>] points
|
140
|
+
#
|
141
|
+
# @raise [RuntimeError] If the builder is not valid.
|
142
|
+
#
|
143
|
+
# @return [Array<Sketchup::Edge, nil>] In the array, for each pair in +points+ an edge is returned.
|
144
|
+
# If two point are so close they are considered identical then +nil+ is returned.
|
145
|
+
#
|
146
|
+
# @see Sketchup::Entities#add_edges
|
147
|
+
#
|
148
|
+
# @version SketchUp 2022.0
|
149
|
+
def add_edges(*args)
|
150
|
+
end
|
151
|
+
|
152
|
+
# Adds a {Sketchup::Face} to the {#entities} collection.
|
153
|
+
#
|
154
|
+
# @api EntitiesBuilder
|
155
|
+
#
|
156
|
+
# @example Adding a simple face
|
157
|
+
# model = Sketchup.active_model
|
158
|
+
# model.entities.build { |builder|
|
159
|
+
# face = builder.add_face([[0, 0, 0], [6, 0, 0], [6, 8, 0], [0, 8, 0]])
|
160
|
+
# face.material = 'red'
|
161
|
+
# }
|
162
|
+
#
|
163
|
+
# @example Adding an edge with two holes
|
164
|
+
# model = Sketchup.active_model
|
165
|
+
# model.entities.build { |builder|
|
166
|
+
# outer_loop = [[0, 0, 0], [8, 0, 0], [8, 9, 0], [0, 9, 0]]
|
167
|
+
# hole1 = [[1, 1, 0], [3, 1, 0], [3, 8, 0], [1, 8, 0]]
|
168
|
+
# hole2 = [[4, 1, 0], [7, 1, 0], [7, 8, 0], [4, 8, 0]]
|
169
|
+
# face = builder.add_face(outer_loop, holes: [hole1, hole2])
|
170
|
+
# }
|
171
|
+
#
|
172
|
+
# @note Does not split intersecting faces or edges.
|
173
|
+
#
|
174
|
+
# @overload add_face(outer_loop)
|
175
|
+
#
|
176
|
+
# @param [Array<Geom::Point3d>] outer_loop
|
177
|
+
#
|
178
|
+
# @overload add_face(*outer_loop)
|
179
|
+
#
|
180
|
+
# @param [Array<Geom::Point3d>] outer_loop
|
181
|
+
#
|
182
|
+
# @overload add_face(outer_loop, holes: inner_loops)
|
183
|
+
#
|
184
|
+
# Adds a face with holes.
|
185
|
+
# @note The inner loops are not validated to be within the bounds of the outer loop.
|
186
|
+
# @param [Array<Geom::Point3d>] outer_loop
|
187
|
+
# @param [Array<Array<Geom::Point3d>>] inner_loops
|
188
|
+
#
|
189
|
+
# @overload add_face(*outer_loop, holes: inner_loops)
|
190
|
+
#
|
191
|
+
# Adds a face with holes.
|
192
|
+
# @note The inner loops are not validated to be within the bounds of the outer loop.
|
193
|
+
# @param [Array<Geom::Point3d>] outer_loop
|
194
|
+
# @param [Array<Array<Geom::Point3d>>] inner_loops
|
195
|
+
#
|
196
|
+
# @raise [ArgumentError] If points are not planar.
|
197
|
+
#
|
198
|
+
# @raise [ArgumentError] If any of the loops doesn't have at least 3 points.
|
199
|
+
#
|
200
|
+
# @raise [RuntimeError] If the builder is not valid.
|
201
|
+
#
|
202
|
+
# @return [Sketchup::Face]
|
203
|
+
#
|
204
|
+
# @see Sketchup::Entities#add_face
|
205
|
+
#
|
206
|
+
# @version SketchUp 2022.0
|
207
|
+
def add_face(*args)
|
208
|
+
end
|
209
|
+
|
210
|
+
# The {Sketchup::Entities} collection the {Sketchup::EntitiesBuilder} will add
|
211
|
+
# the geometry to.
|
212
|
+
#
|
213
|
+
# @api EntitiesBuilder
|
214
|
+
#
|
215
|
+
# @example
|
216
|
+
# model = Sketchup.active_model
|
217
|
+
# model.entities.build { |builder|
|
218
|
+
# p builder.entities == model.entities # => true
|
219
|
+
# }
|
220
|
+
#
|
221
|
+
# @raise [RuntimeError] If the builder is not valid.
|
222
|
+
#
|
223
|
+
# @return [Sketchup::Entities]
|
224
|
+
#
|
225
|
+
# @version SketchUp 2022.0
|
226
|
+
def entities
|
227
|
+
end
|
228
|
+
|
229
|
+
# Indicates whether the builder object is valid and can be used.
|
230
|
+
#
|
231
|
+
# A builder object is only valid within the scope of the block given to
|
232
|
+
# {Sketchup::Entities#build}.
|
233
|
+
#
|
234
|
+
# When this return +false+, calling any other method on the builder will raise
|
235
|
+
# an error.
|
236
|
+
#
|
237
|
+
# @api EntitiesBuilder
|
238
|
+
#
|
239
|
+
# @example
|
240
|
+
# model = Sketchup.active_model
|
241
|
+
# cached_builder = nil
|
242
|
+
# model.entities.build { |builder|
|
243
|
+
# p builder.valid? # => true
|
244
|
+
# cached_builder = builder # Don't hold on to builder objects.
|
245
|
+
# }
|
246
|
+
# p cached_builder.valid? # => false
|
247
|
+
#
|
248
|
+
# @return [Boolean]
|
249
|
+
#
|
250
|
+
# @version SketchUp 2022.0
|
251
|
+
def valid?
|
252
|
+
end
|
253
|
+
|
254
|
+
# Finds an existing {Sketchup::Vertex} for the given position, otherwise returns +nil+.
|
255
|
+
#
|
256
|
+
# @api EntitiesBuilder
|
257
|
+
#
|
258
|
+
# @example
|
259
|
+
# model = Sketchup.active_model
|
260
|
+
# model.entities.build { |builder|
|
261
|
+
# edge = builder.add_edge([1, 0, 0], [9, 0, 0])
|
262
|
+
# builder.vertex_at([0, 0, 0]) => nil
|
263
|
+
# builder.vertex_at([9, 0, 0]) => #<Sketchup::Vertex>
|
264
|
+
# }
|
265
|
+
#
|
266
|
+
# @return [Sketchup::Vertex, nil]
|
267
|
+
#
|
268
|
+
# @version SketchUp 2022.0
|
269
|
+
def vertex_at(position)
|
270
|
+
end
|
271
|
+
|
272
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2022 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# The ExtensionsManager class provides a way of accessing the
|
@@ -51,7 +51,7 @@ class Sketchup::ExtensionsManager
|
|
51
51
|
# number = manager.count
|
52
52
|
#
|
53
53
|
# @note Since SketchUp 2014 the count method is inherited from Ruby's
|
54
|
-
# +
|
54
|
+
# +Enumerable+ mix-in module. Prior to that the {#count} method is an alias
|
55
55
|
# for {#length}.
|
56
56
|
#
|
57
57
|
# @return [Integer]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright:: Copyright
|
1
|
+
# Copyright:: Copyright 2022 Trimble Inc.
|
2
2
|
# License:: The MIT License (MIT)
|
3
3
|
|
4
4
|
# Faces in SketchUp are flat, 2-sided polygons with 3 or more sides.
|
@@ -200,6 +200,18 @@ class Sketchup::Face < Sketchup::Drawingelement
|
|
200
200
|
def classify_point(point)
|
201
201
|
end
|
202
202
|
|
203
|
+
# The {#clear_texture_position} method is used to remove any explicit
|
204
|
+
# texture positioning for a face and have SketchUp display it with the
|
205
|
+
# default texture positioning.
|
206
|
+
#
|
207
|
+
# @param [Boolean] front
|
208
|
+
# +true+ Clears on the front side of the face, +false+
|
209
|
+
# the back side.
|
210
|
+
#
|
211
|
+
# @version SketchUp 2022.0
|
212
|
+
def clear_texture_position(front)
|
213
|
+
end
|
214
|
+
|
203
215
|
# The {#clear_texture_projection} method is used to clear the texture
|
204
216
|
# projection. This is similar to toggling off Projection from the Position
|
205
217
|
# Texture tool in the UI.
|
@@ -325,6 +337,8 @@ class Sketchup::Face < Sketchup::Drawingelement
|
|
325
337
|
# The get_glued_instances method returns an Array any ComponentInstances
|
326
338
|
# that are glued to the face.
|
327
339
|
#
|
340
|
+
# ComponentInstance objects that are currently glued to the face.
|
341
|
+
#
|
328
342
|
# @example
|
329
343
|
# # Create a series of points that define a new face.
|
330
344
|
# model = Sketchup.active_model
|
@@ -339,8 +353,7 @@ class Sketchup::Face < Sketchup::Drawingelement
|
|
339
353
|
# face = entities.add_face(pts)
|
340
354
|
# glued_array = face.get_glued_instances
|
341
355
|
#
|
342
|
-
# @return [Array<Sketchup::ComponentInstance, Sketchup::Group, Sketchup::Image>] An array of
|
343
|
-
# are currently glued to the face.
|
356
|
+
# @return [Array<Sketchup::ComponentInstance, Sketchup::Group, Sketchup::Image>] An array of
|
344
357
|
#
|
345
358
|
# @version SketchUp 7.0 M1
|
346
359
|
def get_glued_instances
|
@@ -645,6 +658,8 @@ class Sketchup::Face < Sketchup::Drawingelement
|
|
645
658
|
#
|
646
659
|
# @overload position_material(material, points, on_front, projection)
|
647
660
|
#
|
661
|
+
# @version SketchUp 2021.1
|
662
|
+
#
|
648
663
|
# This variant positions a material on the face's plane with projection.
|
649
664
|
#
|
650
665
|
# @param [Sketchup::Material] material
|
@@ -742,7 +757,7 @@ class Sketchup::Face < Sketchup::Drawingelement
|
|
742
757
|
#
|
743
758
|
# @deprecated This function never worked correctly. It's not capable of
|
744
759
|
# controlling the position and orientation of the texture. In some cases it
|
745
|
-
# produced an invalid model.
|
760
|
+
# produced an invalid model. As of SketchUp 2021.1 the method simply raises
|
746
761
|
# +NotImplementedError+.
|
747
762
|
#
|
748
763
|
# @param [Geom::Vector3d] vector
|
@@ -784,7 +799,7 @@ class Sketchup::Face < Sketchup::Drawingelement
|
|
784
799
|
# }
|
785
800
|
#
|
786
801
|
# @param [Boolean] front
|
787
|
-
# +true+ Checks the front side of the face, +
|
802
|
+
# +true+ Checks the front side of the face, +false+
|
788
803
|
# the back side.
|
789
804
|
#
|
790
805
|
# @return [Boolean]
|
@@ -809,7 +824,7 @@ class Sketchup::Face < Sketchup::Drawingelement
|
|
809
824
|
# {#position_material}.
|
810
825
|
#
|
811
826
|
# @param [Boolean] front
|
812
|
-
# +true+ Checks the front side of the face, +
|
827
|
+
# +true+ Checks the front side of the face, +false+
|
813
828
|
# the back side.
|
814
829
|
#
|
815
830
|
# @return [Boolean]
|
@@ -842,6 +857,11 @@ class Sketchup::Face < Sketchup::Drawingelement
|
|
842
857
|
#
|
843
858
|
# rdoc-image:../images/face-uv-tile-at.png
|
844
859
|
#
|
860
|
+
# @bug Fixed in SketchUp 2022.0: If the +position+ argument should line up exact
|
861
|
+
# U or V axes of the UV coordinate system the returned set of points won't
|
862
|
+
# be correct. A workaround for older SketchUp versions would be to slightly
|
863
|
+
# offset the +position+ argument.
|
864
|
+
#
|
845
865
|
# @example Copy material from front to back
|
846
866
|
# model = Sketchup.active_model
|
847
867
|
# model.active_entities.grep(Sketchup::Face) { |face|
|
@@ -876,7 +896,7 @@ class Sketchup::Face < Sketchup::Drawingelement
|
|
876
896
|
# bounded by the UV tile.
|
877
897
|
#
|
878
898
|
# @param [Boolean] front
|
879
|
-
# +true+ Checks the front side of the face, +
|
899
|
+
# +true+ Checks the front side of the face, +false+
|
880
900
|
# the back side.
|
881
901
|
#
|
882
902
|
# @return [Array<Geom::Point3d>, nil] A set of 8 points. Each stride of two is
|