sketchup-api-stubs 0.7.8 → 0.7.9
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 +151 -148
- data/lib/sketchup-api-stubs/stubs/Array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +322 -322
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -400
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +509 -523
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +476 -478
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -522
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +693 -693
- data/lib/sketchup-api-stubs/stubs/Geom.rb +351 -351
- data/lib/sketchup-api-stubs/stubs/LanguageHandler.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +595 -595
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +747 -698
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +517 -516
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +148 -148
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +354 -354
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -91
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +370 -370
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +225 -225
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -567
- data/lib/sketchup-api-stubs/stubs/Layout/LockedEntityError.rb +10 -10
- data/lib/sketchup-api-stubs/stubs/Layout/LockedLayerError.rb +11 -11
- data/lib/sketchup-api-stubs/stubs/Layout/Page.rb +183 -183
- data/lib/sketchup-api-stubs/stubs/Layout/PageInfo.rb +387 -387
- data/lib/sketchup-api-stubs/stubs/Layout/Pages.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
- data/lib/sketchup-api-stubs/stubs/Layout/ReferenceEntity.rb +82 -0
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +692 -692
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Length.rb +278 -278
- data/lib/sketchup-api-stubs/stubs/Numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +144 -144
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +169 -169
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +150 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -286
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +302 -302
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +478 -478
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +121 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +294 -294
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +659 -619
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentInstance.rb +593 -593
- data/lib/sketchup-api-stubs/stubs/Sketchup/Console.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionLine.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ConstructionPoint.rb +32 -32
- data/lib/sketchup-api-stubs/stubs/Sketchup/Curve.rb +201 -201
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +449 -426
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +74 -74
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +42 -42
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +406 -396
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +397 -502
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1239 -1205
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesBuilder.rb +261 -272
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +127 -127
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +545 -545
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +60 -60
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -126
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +937 -937
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +102 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +750 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +282 -292
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +468 -468
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +266 -266
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +189 -189
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +406 -407
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +84 -84
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +306 -306
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +326 -326
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayerFolder.rb +422 -422
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +427 -427
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +114 -112
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +414 -414
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +317 -318
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +93 -93
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1652 -1651
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +357 -357
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +130 -131
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +271 -284
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Overlay.rb +490 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/OverlaysManager.rb +116 -0
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +797 -797
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +361 -363
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +77 -77
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +478 -477
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +361 -364
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +458 -459
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +255 -260
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/Skp.rb +40 -40
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +217 -217
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +834 -837
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +156 -156
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +75 -75
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1311 -1317
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +45 -45
- data/lib/sketchup-api-stubs/stubs/Sketchup.rb +1377 -1360
- data/lib/sketchup-api-stubs/stubs/SketchupExtension.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/String.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +389 -389
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +494 -496
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +269 -269
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +241 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +635 -635
- data/lib/sketchup-api-stubs/stubs/UI.rb +683 -683
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +303 -311
- data/lib/sketchup-api-stubs.rb +1 -1
- metadata +10 -7
@@ -1,937 +1,937 @@
|
|
1
|
-
# Copyright:: Copyright
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# Faces in SketchUp are flat, 2-sided polygons with 3 or more sides.
|
5
|
-
#
|
6
|
-
# @version SketchUp 6.0
|
7
|
-
class Sketchup::Face < Sketchup::Drawingelement
|
8
|
-
|
9
|
-
# Constants
|
10
|
-
|
11
|
-
PointInside = nil # Stub value.
|
12
|
-
PointNotOnPlane = nil # Stub value.
|
13
|
-
PointOnEdge = nil # Stub value.
|
14
|
-
PointOnFace = nil # Stub value.
|
15
|
-
PointOnVertex = nil # Stub value.
|
16
|
-
PointOutside = nil # Stub value.
|
17
|
-
PointUnknown = nil # Stub value.
|
18
|
-
|
19
|
-
# Instance Methods
|
20
|
-
|
21
|
-
# The all_connected method retrieves all of the entities connected to a face.
|
22
|
-
#
|
23
|
-
# @example
|
24
|
-
# depth = 100
|
25
|
-
# width = 100
|
26
|
-
# model = Sketchup.active_model
|
27
|
-
# entities = model.active_entities
|
28
|
-
# pts = []
|
29
|
-
# pts[0] = [0, 0, 0]
|
30
|
-
# pts[1] = [width, 0, 0]
|
31
|
-
# pts[2] = [width, depth, 0]
|
32
|
-
# pts[3] = [0, depth, 0]
|
33
|
-
#
|
34
|
-
# # Add the face to the entities in the model
|
35
|
-
# face = entities.add_face(pts)
|
36
|
-
# connected = face.all_connected
|
37
|
-
#
|
38
|
-
# @return [Array<Sketchup::Entity>] the entities connected to the face
|
39
|
-
#
|
40
|
-
# @version SketchUp 6.0
|
41
|
-
def all_connected
|
42
|
-
end
|
43
|
-
|
44
|
-
# The area method is used to retrieve the area of a face.
|
45
|
-
#
|
46
|
-
# You can pass in an optional Transformation (or an array that can represent a
|
47
|
-
# transformation), to correct for a parent group's transformation. For example,
|
48
|
-
# if a face is inside of a group that is scaled to 200%, the area method will
|
49
|
-
# return the unscaled area of the face. So by passing a 200% transformation
|
50
|
-
# object to this method, you can account for that to get the "visual" area
|
51
|
-
# of the face.
|
52
|
-
#
|
53
|
-
# @example
|
54
|
-
# depth = 100
|
55
|
-
# width = 100
|
56
|
-
# model = Sketchup.active_model
|
57
|
-
# entities = model.active_entities
|
58
|
-
# pts = []
|
59
|
-
# pts[0] = [0, 0, 0]
|
60
|
-
# pts[1] = [width, 0, 0]
|
61
|
-
# pts[2] = [width, depth, 0]
|
62
|
-
# pts[3] = [0, depth, 0]
|
63
|
-
# # Add the face to the entities in the model
|
64
|
-
# face = entities.add_face(pts)
|
65
|
-
# area = face.area
|
66
|
-
#
|
67
|
-
# @overload area
|
68
|
-
#
|
69
|
-
# @return [Float] the area of the face in square inches.
|
70
|
-
#
|
71
|
-
# @overload area(transform)
|
72
|
-
#
|
73
|
-
# @param [Geom::Transformation] transform
|
74
|
-
# A Transformation object or array that can be interpreted as a
|
75
|
-
# Transformation object.
|
76
|
-
# @return [Float] the area of the face in square inches.
|
77
|
-
#
|
78
|
-
# @version SketchUp 6.0
|
79
|
-
def area(*args)
|
80
|
-
end
|
81
|
-
|
82
|
-
# The back_material method is used to retrieve the material assigned to the
|
83
|
-
# back side of the face.
|
84
|
-
#
|
85
|
-
# @example
|
86
|
-
# depth = 100
|
87
|
-
# width = 100
|
88
|
-
# model = Sketchup.active_model
|
89
|
-
# entities = model.active_entities
|
90
|
-
# pts = []
|
91
|
-
# pts[0] = [0, 0, 0]
|
92
|
-
# pts[1] = [width, 0, 0]
|
93
|
-
# pts[2] = [width, depth, 0]
|
94
|
-
# pts[3] = [0, depth, 0]
|
95
|
-
#
|
96
|
-
# # Add the face to the entities in the model
|
97
|
-
# face = entities.add_face(pts)
|
98
|
-
#
|
99
|
-
# # Add a material to the back face, then check to see that it was added
|
100
|
-
# face.back_material = "red"
|
101
|
-
# material = face.back_material
|
102
|
-
#
|
103
|
-
# @return [Sketchup::Material, nil] a Material object representing the material
|
104
|
-
# on the back of the face (if successful)
|
105
|
-
#
|
106
|
-
# @version SketchUp 6.0
|
107
|
-
def back_material
|
108
|
-
end
|
109
|
-
|
110
|
-
# The back_material= method is used to set the material assigned to the back
|
111
|
-
# side of the face.
|
112
|
-
#
|
113
|
-
# @example
|
114
|
-
# depth = 100
|
115
|
-
# width = 100
|
116
|
-
# model = Sketchup.active_model
|
117
|
-
# entities = model.active_entities
|
118
|
-
# pts = []
|
119
|
-
# pts[0] = [0, 0, 0]
|
120
|
-
# pts[1] = [width, 0, 0]
|
121
|
-
# pts[2] = [width, depth, 0]
|
122
|
-
# pts[3] = [0, depth, 0]
|
123
|
-
# # Add the face to the entities in the model
|
124
|
-
# face = entities.add_face(pts)
|
125
|
-
# status = face.back_material = "red"
|
126
|
-
#
|
127
|
-
# @param [Sketchup::Material] material
|
128
|
-
# A Material object or the name of a valid material.
|
129
|
-
#
|
130
|
-
# @return [Sketchup::Material] the name of the valid material or the new
|
131
|
-
# Material object (if successful)
|
132
|
-
#
|
133
|
-
# @version SketchUp 6.0
|
134
|
-
def back_material=(material)
|
135
|
-
end
|
136
|
-
|
137
|
-
# The classify_point method is used to determine if a given Point3d is on the
|
138
|
-
# referenced Face.
|
139
|
-
#
|
140
|
-
# It is important that return value comparisons be made against the
|
141
|
-
# symbolic constants (i.e. {Sketchup::Face::PointUnknown},
|
142
|
-
# {Sketchup::Face::PointInside}, {Sketchup::Face::PointOnVertex}, etc.) rather
|
143
|
-
# than the absolute integer values as these values may change from one
|
144
|
-
# release to the next.
|
145
|
-
#
|
146
|
-
# @example
|
147
|
-
# model = Sketchup.active_model
|
148
|
-
# entities = model.active_entities
|
149
|
-
# pts = []
|
150
|
-
# pts[0] = [0, 0, 0]
|
151
|
-
# pts[1] = [9, 0, 0]
|
152
|
-
# pts[2] = [9, 9, 0]
|
153
|
-
# pts[3] = [0, 9, 0]
|
154
|
-
#
|
155
|
-
# # Add the face to the entities in the model
|
156
|
-
# face = entities.add_face(pts)
|
157
|
-
#
|
158
|
-
# # Check a point that should be outside the face.
|
159
|
-
# pt = Geom::Point3d.new(50, 50, 0)
|
160
|
-
# result = face.classify_point(pt)
|
161
|
-
# if result == Sketchup::Face::PointOutside
|
162
|
-
# puts "#{pt.to_s} is outside the face"
|
163
|
-
# end
|
164
|
-
#
|
165
|
-
# # Check a point that should be outside inside the face.
|
166
|
-
# pt = Geom::Point3d.new(1, 1, 0)
|
167
|
-
# result = face.classify_point(pt)
|
168
|
-
# if result == Sketchup::Face::PointInside
|
169
|
-
# puts "#{pt.to_s} is inside the face"
|
170
|
-
# end
|
171
|
-
#
|
172
|
-
# # Check a point that should be on the vertex of the face.
|
173
|
-
# pt = Geom::Point3d.new(0, 0, 0)
|
174
|
-
# result = face.classify_point(pt)
|
175
|
-
# if result == Sketchup::Face::PointOnVertex
|
176
|
-
# puts "#{pt.to_s} is on a vertex"
|
177
|
-
# end
|
178
|
-
#
|
179
|
-
# # Check a point that should be on the edge of the face.
|
180
|
-
# pt = Geom::Point3d.new(0, 1, 0)
|
181
|
-
# result = face.classify_point(pt)
|
182
|
-
# if result == Sketchup::Face::PointOnEdge
|
183
|
-
# puts "#{pt.to_s} is on an edge of the face"
|
184
|
-
# end
|
185
|
-
#
|
186
|
-
# # Check a point that should be off the plane of the face.
|
187
|
-
# pt = Geom::Point3d.new(1, 1, 10)
|
188
|
-
# result = face.classify_point(pt)
|
189
|
-
# if result == Sketchup::Face::PointNotOnPlane
|
190
|
-
# puts "#{pt.to_s} is not on the same plane as the face"
|
191
|
-
# end
|
192
|
-
#
|
193
|
-
# @param [Geom::Point3d] point
|
194
|
-
# A Point3d.
|
195
|
-
#
|
196
|
-
# @return [Integer] an integer describing where a Point3d is in
|
197
|
-
# relation to the referenced Face.
|
198
|
-
#
|
199
|
-
# @version SketchUp 6.0
|
200
|
-
def classify_point(point)
|
201
|
-
end
|
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
|
-
|
215
|
-
# The {#clear_texture_projection} method is used to clear the texture
|
216
|
-
# projection. This is similar to toggling off Projection from the Position
|
217
|
-
# Texture tool in the UI.
|
218
|
-
#
|
219
|
-
# @param [Boolean] frontside
|
220
|
-
# +true+ for front side, +false+ for back side.
|
221
|
-
#
|
222
|
-
# @see #position_material
|
223
|
-
#
|
224
|
-
# @see #get_texture_projection
|
225
|
-
#
|
226
|
-
# @version SketchUp 2021.1
|
227
|
-
def clear_texture_projection(frontside)
|
228
|
-
end
|
229
|
-
|
230
|
-
# The edges method is used to get an array of edges that bound the face.
|
231
|
-
#
|
232
|
-
# @example
|
233
|
-
# depth = 100
|
234
|
-
# width = 100
|
235
|
-
# model = Sketchup.active_model
|
236
|
-
# entities = model.active_entities
|
237
|
-
# pts = []
|
238
|
-
# pts[0] = [0, 0, 0]
|
239
|
-
# pts[1] = [width, 0, 0]
|
240
|
-
# pts[2] = [width, depth, 0]
|
241
|
-
# pts[3] = [0, depth, 0]
|
242
|
-
# # Add the face to the entities in the model
|
243
|
-
# face = entities.add_face(pts)
|
244
|
-
# edges = face.edges
|
245
|
-
#
|
246
|
-
# @return [Array<Sketchup::Edge>] an array of Edge objects (if successful)
|
247
|
-
#
|
248
|
-
# @version SketchUp 6.0
|
249
|
-
def edges
|
250
|
-
end
|
251
|
-
|
252
|
-
# The {#followme} method is used to create a shape by making the face follow
|
253
|
-
# along an array of edges.
|
254
|
-
#
|
255
|
-
# @example
|
256
|
-
# model = Sketchup.active_model
|
257
|
-
# entities = model.active_entities
|
258
|
-
#
|
259
|
-
# depth = 100
|
260
|
-
# width = 100
|
261
|
-
#
|
262
|
-
# # Add the face to the entities in the model
|
263
|
-
# points = [
|
264
|
-
# Geom::Point3d.new(0, 0, 0),
|
265
|
-
# Geom::Point3d.new(width, 0, 0),
|
266
|
-
# Geom::Point3d.new(width, depth, 0),
|
267
|
-
# Geom::Point3d.new(0, depth, 0)
|
268
|
-
# ]
|
269
|
-
# face = entities.add_face(points)
|
270
|
-
#
|
271
|
-
# # Add the line which we will "follow" to the entities in the model
|
272
|
-
# point1 = Geom::Point3d.new(0, 0, 0)
|
273
|
-
# point2 = Geom::Point3d.new(0, 0, 100)
|
274
|
-
# edge = entities.add_line(point1, point2)
|
275
|
-
# face.followme(edge)
|
276
|
-
#
|
277
|
-
# @overload followme(edges)
|
278
|
-
#
|
279
|
-
# @param [Array<Sketchup::Edge>] edges An array of edge objects to follow.
|
280
|
-
# @return [Boolean]
|
281
|
-
#
|
282
|
-
# @overload followme(edge)
|
283
|
-
#
|
284
|
-
# @param [Sketchup::Edge] edge An edge to follow.
|
285
|
-
# @return [Boolean]
|
286
|
-
#
|
287
|
-
# @version SketchUp 6.0
|
288
|
-
def followme(*args)
|
289
|
-
end
|
290
|
-
|
291
|
-
# The get_UVHelper object is used to retrieve a UVHelper object for use in
|
292
|
-
# texture manipulation on a face.
|
293
|
-
#
|
294
|
-
# @example
|
295
|
-
# model = Sketchup.active_model
|
296
|
-
# entities = model.active_entities
|
297
|
-
# pts = []
|
298
|
-
# pts[0] = [0, 0, 0]
|
299
|
-
# pts[1] = [9, 0, 0]
|
300
|
-
# pts[2] = [9, 9, 0]
|
301
|
-
# pts[3] = [0, 9, 0]
|
302
|
-
#
|
303
|
-
# # Add the face to the entities in the model
|
304
|
-
# face = entities.add_face(pts)
|
305
|
-
# tw = Sketchup.create_texture_writer
|
306
|
-
# uvHelp = face.get_UVHelper(true, true, tw)
|
307
|
-
#
|
308
|
-
# @overload get_UVHelper(front = true, back = true)
|
309
|
-
#
|
310
|
-
# @param [Boolean] front
|
311
|
-
# True if you want the texture coordinates for the front
|
312
|
-
# face, false if not.
|
313
|
-
#
|
314
|
-
# @param [Boolean] back
|
315
|
-
# True if you want the texture coordinates for the back
|
316
|
-
# face, false if not.
|
317
|
-
#
|
318
|
-
# @overload get_UVHelper(front = true, back = true, texturewriter)
|
319
|
-
#
|
320
|
-
# @param [Boolean] front
|
321
|
-
# True if you want the texture coordinates for the front
|
322
|
-
# face, false if not.
|
323
|
-
#
|
324
|
-
# @param [Boolean] back
|
325
|
-
# True if you want the texture coordinates for the back
|
326
|
-
# face, false if not.
|
327
|
-
#
|
328
|
-
# @param [Sketchup::TextureWriter] texturewriter
|
329
|
-
# An optional TextureWriter object.
|
330
|
-
#
|
331
|
-
# @return [Sketchup::UVHelper]
|
332
|
-
#
|
333
|
-
# @version SketchUp 6.0
|
334
|
-
def get_UVHelper(*args)
|
335
|
-
end
|
336
|
-
|
337
|
-
# The get_glued_instances method returns an Array any ComponentInstances
|
338
|
-
# that are glued to the face.
|
339
|
-
#
|
340
|
-
# ComponentInstance objects that are currently glued to the face.
|
341
|
-
#
|
342
|
-
# @example
|
343
|
-
# # Create a series of points that define a new face.
|
344
|
-
# model = Sketchup.active_model
|
345
|
-
# entities = model.active_entities
|
346
|
-
# pts = []
|
347
|
-
# pts[0] = [0, 0, 0]
|
348
|
-
# pts[1] = [9, 0, 0]
|
349
|
-
# pts[2] = [9, 9, 0]
|
350
|
-
# pts[3] = [0, 9, 0]
|
351
|
-
#
|
352
|
-
# # Add the face to the entities in the model
|
353
|
-
# face = entities.add_face(pts)
|
354
|
-
# glued_array = face.get_glued_instances
|
355
|
-
#
|
356
|
-
# @return [Array<Sketchup::ComponentInstance, Sketchup::Group, Sketchup::Image>] An array of
|
357
|
-
#
|
358
|
-
# @version SketchUp 7.0 M1
|
359
|
-
def get_glued_instances
|
360
|
-
end
|
361
|
-
|
362
|
-
# The {#get_texture_projection} method will return a vector representing the
|
363
|
-
# projection for either the front or back side of the face.
|
364
|
-
#
|
365
|
-
# @example
|
366
|
-
# model = Sketchup.active_model
|
367
|
-
# entities = model.active_entities
|
368
|
-
# materials = model.materials
|
369
|
-
#
|
370
|
-
# # Create a face and add it to the model entities
|
371
|
-
# pts = []
|
372
|
-
# pts[0] = [0, 0, 1]
|
373
|
-
# pts[1] = [10, 0, 1]
|
374
|
-
# pts[2] = [10, 10, 1]
|
375
|
-
# face = entities.add_face(pts)
|
376
|
-
#
|
377
|
-
# # Export an image to use as a texture
|
378
|
-
# path = Sketchup.temp_dir
|
379
|
-
# full_name = File.join(path, "temp_image.jpg")
|
380
|
-
# model.active_view.write_image(full_name, 500, 500, false, 0.0)
|
381
|
-
#
|
382
|
-
# # Create a material and assign the texture to it
|
383
|
-
# material = materials.add("Test Material")
|
384
|
-
# material.texture = full_name
|
385
|
-
#
|
386
|
-
# # Assign the new material to our face we created
|
387
|
-
# face.material = material
|
388
|
-
#
|
389
|
-
# # Set the projection of the applied material
|
390
|
-
# face.set_texture_projection(face.normal, true)
|
391
|
-
#
|
392
|
-
# # Get the projection of the applied material
|
393
|
-
# vector = face.get_texture_projection(true)
|
394
|
-
#
|
395
|
-
# @param [Boolean] frontside
|
396
|
-
# +true+ for front side, +false+ for back side.
|
397
|
-
#
|
398
|
-
# @return [Geom::Vector3d, nil] a vector on success, +nil+ if face is not
|
399
|
-
# textured with a projected texture mapping.
|
400
|
-
#
|
401
|
-
# @see #position_material
|
402
|
-
#
|
403
|
-
# @see #texture_projected?
|
404
|
-
#
|
405
|
-
# @version SketchUp 2014
|
406
|
-
def get_texture_projection(frontside)
|
407
|
-
end
|
408
|
-
|
409
|
-
# The loops method is used to get an array of all of the loops that bound the
|
410
|
-
# face.
|
411
|
-
#
|
412
|
-
# @example
|
413
|
-
# depth = 100
|
414
|
-
# width = 100
|
415
|
-
# model = Sketchup.active_model
|
416
|
-
# entities = model.active_entities
|
417
|
-
# pts = []
|
418
|
-
# pts[0] = [0, 0, 0]
|
419
|
-
# pts[1] = [width, 0, 0]
|
420
|
-
# pts[2] = [width, depth, 0]
|
421
|
-
# pts[3] = [0, depth, 0]
|
422
|
-
#
|
423
|
-
# # Add the face to the entities in the model
|
424
|
-
# face = entities.add_face(pts)
|
425
|
-
# loops = face.loops
|
426
|
-
#
|
427
|
-
# @return [Array<Sketchup::Loop>] an array of Loop objects if successful
|
428
|
-
#
|
429
|
-
# @version SketchUp 6.0
|
430
|
-
def loops
|
431
|
-
end
|
432
|
-
|
433
|
-
# The material method is used to retrieve the material assigned to the
|
434
|
-
# front of the face. (This method is inherited from the Drawingelement
|
435
|
-
# parent class.)
|
436
|
-
#
|
437
|
-
# @example
|
438
|
-
# depth = 100
|
439
|
-
# width = 100
|
440
|
-
# model = Sketchup.active_model
|
441
|
-
# entities = model.active_entities
|
442
|
-
# pts = []
|
443
|
-
# pts[0] = [0, 0, 0]
|
444
|
-
# pts[1] = [width, 0, 0]
|
445
|
-
# pts[2] = [width, depth, 0]
|
446
|
-
# pts[3] = [0, depth, 0]
|
447
|
-
#
|
448
|
-
# # Add the face to the entities in the model
|
449
|
-
# face = entities.add_face(pts)
|
450
|
-
#
|
451
|
-
# # Add a material to the face, then check to see that it was added
|
452
|
-
# face.material = "red"
|
453
|
-
# material = face.material
|
454
|
-
#
|
455
|
-
# @return [Sketchup::Material, nil] a Material object representing the material
|
456
|
-
# on the front of the face (if successful)
|
457
|
-
#
|
458
|
-
# @version SketchUp 6.0
|
459
|
-
def material
|
460
|
-
end
|
461
|
-
|
462
|
-
# The material= method is used to set the material assigned to the front
|
463
|
-
# side of the face. (This method is inherited from the Drawingelement
|
464
|
-
# parent class.)
|
465
|
-
#
|
466
|
-
# @example
|
467
|
-
# depth = 100
|
468
|
-
# width = 100
|
469
|
-
# model = Sketchup.active_model
|
470
|
-
# entities = model.active_entities
|
471
|
-
# pts = []
|
472
|
-
# pts[0] = [0, 0, 0]
|
473
|
-
# pts[1] = [width, 0, 0]
|
474
|
-
# pts[2] = [width, depth, 0]
|
475
|
-
# pts[3] = [0, depth, 0]
|
476
|
-
# # Add the face to the entities in the model
|
477
|
-
# face = entities.add_face(pts)
|
478
|
-
# status = face.material = "red"
|
479
|
-
#
|
480
|
-
# @param [Sketchup::Material] material
|
481
|
-
# A Material object or the name of a valid material.
|
482
|
-
#
|
483
|
-
# @return [Sketchup::Material] the name of the valid material or the new
|
484
|
-
# Material object (if successful)
|
485
|
-
#
|
486
|
-
# @version SketchUp 6.0
|
487
|
-
def material=(material)
|
488
|
-
end
|
489
|
-
|
490
|
-
# The mesh method creates a polygon mesh that represents the face. See the
|
491
|
-
# {Geom::PolygonMesh} class for more information.
|
492
|
-
#
|
493
|
-
# Valid flags are:
|
494
|
-
#
|
495
|
-
# - +0+: Include PolygonMeshPoints,
|
496
|
-
# - +1+: Include PolygonMeshUVQFront,
|
497
|
-
# - +2+: Include PolygonMeshUVQBack,
|
498
|
-
# - +4+: Include PolygonMeshNormals.
|
499
|
-
#
|
500
|
-
# Use bitwise OR to combine flags. A value of +7+ will include all
|
501
|
-
# flags, for example.
|
502
|
-
#
|
503
|
-
# @example
|
504
|
-
# depth = 100
|
505
|
-
# width = 100
|
506
|
-
# model = Sketchup.active_model
|
507
|
-
# entities = model.active_entities
|
508
|
-
# pts = []
|
509
|
-
# pts[0] = [0, 0, 0]
|
510
|
-
# pts[1] = [width, 0, 0]
|
511
|
-
# pts[2] = [width, depth, 0]
|
512
|
-
# pts[3] = [0, depth, 0]
|
513
|
-
#
|
514
|
-
# # Add the face to the entities in the model
|
515
|
-
# face = entities.add_face(pts)
|
516
|
-
#
|
517
|
-
# kPoints = 0
|
518
|
-
# kUVQFront = 1
|
519
|
-
# kUVQBack = 2
|
520
|
-
# kNormals = 4
|
521
|
-
# flags = kPoints | kUVQFront | kUVQBack | kNormals # equals to 7
|
522
|
-
# mesh = face.mesh(flags)
|
523
|
-
#
|
524
|
-
# @param [Integer] flags
|
525
|
-
# One or more flags used to generate a mesh.
|
526
|
-
#
|
527
|
-
# @return [Geom::PolygonMesh]
|
528
|
-
#
|
529
|
-
# @version SketchUp 6.0
|
530
|
-
def mesh(flags = 0)
|
531
|
-
end
|
532
|
-
|
533
|
-
# The normal method is used to retrieve the 3D vector normal to the face in
|
534
|
-
# the front direction.
|
535
|
-
#
|
536
|
-
# @example
|
537
|
-
# depth = 100
|
538
|
-
# width = 100
|
539
|
-
# model = Sketchup.active_model
|
540
|
-
# entities = model.active_entities
|
541
|
-
# pts = []
|
542
|
-
# pts[0] = [0, 0, 0]
|
543
|
-
# pts[1] = [width, 0, 0]
|
544
|
-
# pts[2] = [width, depth, 0]
|
545
|
-
# pts[3] = [0, depth, 0]
|
546
|
-
#
|
547
|
-
# # Add the face to the entities in the model
|
548
|
-
# face = entities.add_face(pts)
|
549
|
-
# normal = face.normal
|
550
|
-
#
|
551
|
-
# @return [Geom::Vector3d] a Vector3d object if successful
|
552
|
-
#
|
553
|
-
# @version SketchUp 6.0
|
554
|
-
def normal
|
555
|
-
end
|
556
|
-
|
557
|
-
# This method is used to retrieve the outer loop that bounds the face.
|
558
|
-
#
|
559
|
-
# @example
|
560
|
-
# # Create a series of points that define a new face.
|
561
|
-
# model = Sketchup.active_model
|
562
|
-
# entities = model.active_entities
|
563
|
-
# pts = []
|
564
|
-
# pts[0] = [0, 0, 0]
|
565
|
-
# pts[1] = [9, 0, 0]
|
566
|
-
# pts[2] = [9, 9, 0]
|
567
|
-
# pts[3] = [0, 9, 0]
|
568
|
-
#
|
569
|
-
# # Add the face to the entities in the model
|
570
|
-
# face = entities.add_face(pts)
|
571
|
-
# loop = face.outer_loop
|
572
|
-
#
|
573
|
-
# @return [Sketchup::Loop] a Loop object representing the outer loop (if
|
574
|
-
# successful)
|
575
|
-
#
|
576
|
-
# @version SketchUp 6.0
|
577
|
-
def outer_loop
|
578
|
-
end
|
579
|
-
|
580
|
-
# The plane method is used to retrieve the plane of the face. See the Array
|
581
|
-
# class for information on how planes are stored.
|
582
|
-
#
|
583
|
-
# @example
|
584
|
-
# depth = 100
|
585
|
-
# width = 100
|
586
|
-
# model = Sketchup.active_model
|
587
|
-
# entities = model.active_entities
|
588
|
-
# pts = []
|
589
|
-
# pts[0] = [0, 0, 0]
|
590
|
-
# pts[1] = [width, 0, 0]
|
591
|
-
# pts[2] = [width, depth, 0]
|
592
|
-
# pts[3] = [0, depth, 0]
|
593
|
-
#
|
594
|
-
# # Add the face to the entities in the model
|
595
|
-
# face = entities.add_face(pts)
|
596
|
-
# plane = face.plane
|
597
|
-
#
|
598
|
-
# @return [Array(Float, Float, Float, Float)] a plane that contains the face (if successful)
|
599
|
-
#
|
600
|
-
# @version SketchUp 6.0
|
601
|
-
def plane
|
602
|
-
end
|
603
|
-
|
604
|
-
# The {#position_material} method is used to position a material on a face.
|
605
|
-
#
|
606
|
-
# The +points+ argument must contain 2, 4, 6 or 8 points. The points are used
|
607
|
-
# in pairs to describe where a point in the texture image is positioned on the
|
608
|
-
# Face. The first point in each pair is a 3D point in the model. The second
|
609
|
-
# point in each pair of points is a 2D point that gives the (u,v) coordinates
|
610
|
-
# of a point in the image to match up with the 3D point.
|
611
|
-
#
|
612
|
-
# @example
|
613
|
-
# model = Sketchup.active_model
|
614
|
-
# entities = model.active_entities
|
615
|
-
#
|
616
|
-
# # Create a face and add it to the model entities
|
617
|
-
# points = [
|
618
|
-
# Geom::Point3d.new(0, 0, 1),
|
619
|
-
# Geom::Point3d.new(9, 0, 1),
|
620
|
-
# Geom::Point3d.new(9, 9, 1),
|
621
|
-
# Geom::Point3d.new(0, 9, 1),
|
622
|
-
# ]
|
623
|
-
# face = entities.add_face(points)
|
624
|
-
#
|
625
|
-
# # Export an image to use as a texture
|
626
|
-
# path = Sketchup.temp_dir
|
627
|
-
# full_name = File.join(path, "temp_image.jpg")
|
628
|
-
# model.active_view.write_image(full_name, 500, 500, false, 0.0)
|
629
|
-
#
|
630
|
-
# # Create a material and assign the texture to it
|
631
|
-
# material = model.materials.add("Test Material")
|
632
|
-
# material.texture = full_name
|
633
|
-
#
|
634
|
-
# # Assign the new material to our face we created
|
635
|
-
# face.material = material
|
636
|
-
#
|
637
|
-
# mapping = [
|
638
|
-
# Geom::Point3d.new(3,0,0), # Model coordinate
|
639
|
-
# Geom::Point3d.new(0,0,0), # UV coordinate
|
640
|
-
# ]
|
641
|
-
# on_front = true
|
642
|
-
# face.position_material(material, mapping, on_front)
|
643
|
-
#
|
644
|
-
# @overload position_material(material, points, on_front)
|
645
|
-
#
|
646
|
-
# This variant positions a material on the face's plane without projection.
|
647
|
-
#
|
648
|
-
# @param [Sketchup::Material] material
|
649
|
-
#
|
650
|
-
# @param [Array<Geom::Point3d>] points
|
651
|
-
# An array of Point3d objects used to position the material.
|
652
|
-
# The points should be on the plane of the face. If they are not they will
|
653
|
-
# be projected to the face's plane.
|
654
|
-
#
|
655
|
-
# @param [Boolean] on_front
|
656
|
-
# +true+ to position the texture on the front of the Face or
|
657
|
-
# +false+ to position it on the back of the Face.
|
658
|
-
#
|
659
|
-
# @overload position_material(material, points, on_front, projection)
|
660
|
-
#
|
661
|
-
# @version SketchUp 2021.1
|
662
|
-
#
|
663
|
-
# This variant positions a material on the face's plane with projection.
|
664
|
-
#
|
665
|
-
# @param [Sketchup::Material] material
|
666
|
-
#
|
667
|
-
# @param [Array<Geom::Point3d>] points
|
668
|
-
# An array of Point3d objects used to position the material.
|
669
|
-
# The points should be on the same plane. The plane should be parallel to
|
670
|
-
# the +projection+ vector. If they are not on a plane parallel to the
|
671
|
-
# projection vector they will be projected to such a plane.
|
672
|
-
#
|
673
|
-
# @param [Boolean] on_front
|
674
|
-
# +true+ to position the texture on the front of the Face or
|
675
|
-
# +false+ to position it on the back of the Face.
|
676
|
-
#
|
677
|
-
# @param [Geom::Vector3d] projection_vector
|
678
|
-
# The direction of the texture projection.
|
679
|
-
#
|
680
|
-
# @raise ArgumentError if the provided points are not in the size of 2, 4, 6 or 8.
|
681
|
-
#
|
682
|
-
# @raise ArgumentError if the provided points could not be computed to a valid UV mapping.
|
683
|
-
#
|
684
|
-
# @return [Sketchup::Face, false] the face upon success, +false+ if material or
|
685
|
-
# texture if not valid.
|
686
|
-
#
|
687
|
-
# @see #texture_positioned?
|
688
|
-
#
|
689
|
-
# @see #texture_projected?
|
690
|
-
#
|
691
|
-
# @see #get_texture_projection
|
692
|
-
#
|
693
|
-
# @see #clear_texture_projection
|
694
|
-
#
|
695
|
-
# @version SketchUp 6.0
|
696
|
-
def position_material(*args)
|
697
|
-
end
|
698
|
-
|
699
|
-
# The pushpull method is used to perform a push/pull on a face.
|
700
|
-
#
|
701
|
-
# The distance is measured in the direction that the face normal is pointing.
|
702
|
-
#
|
703
|
-
# @example
|
704
|
-
# depth = 100
|
705
|
-
# width = 100
|
706
|
-
# model = Sketchup.active_model
|
707
|
-
# entities = model.active_entities
|
708
|
-
# pts = []
|
709
|
-
# pts[0] = [0, 0, 0]
|
710
|
-
# pts[1] = [width, 0, 0]
|
711
|
-
# pts[2] = [width, depth, 0]
|
712
|
-
# pts[3] = [0, depth, 0]
|
713
|
-
# # Add the face to the entities in the model
|
714
|
-
# face = entities.add_face(pts)
|
715
|
-
# status = face.pushpull(100, true)
|
716
|
-
#
|
717
|
-
# @param [Length] distance
|
718
|
-
# The distance to push/pull the face.
|
719
|
-
#
|
720
|
-
# @param [Boolean] copy
|
721
|
-
# Create a new push/pull starting face if true (equivalent
|
722
|
-
# of pressing CTRL while in SketchUp), do not create a
|
723
|
-
# push/pull starting face if false.
|
724
|
-
#
|
725
|
-
# @return [nil]
|
726
|
-
#
|
727
|
-
# @version SketchUp 6.0
|
728
|
-
def pushpull(distance, copy = false)
|
729
|
-
end
|
730
|
-
|
731
|
-
# The reverse! method is used to reverse the face's orientation, meaning the
|
732
|
-
# front becomes the back.
|
733
|
-
#
|
734
|
-
# @example
|
735
|
-
# depth = 100
|
736
|
-
# width = 100
|
737
|
-
# model = Sketchup.active_model
|
738
|
-
# entities = model.active_entities
|
739
|
-
# pts = []
|
740
|
-
# pts[0] = [0, 0, 0]
|
741
|
-
# pts[1] = [width, 0, 0]
|
742
|
-
# pts[2] = [width, depth, 0]
|
743
|
-
# pts[3] = [0, depth, 0]
|
744
|
-
# # Add the face to the entities in the model
|
745
|
-
# face = entities.add_face(pts)
|
746
|
-
# status = face.reverse!
|
747
|
-
#
|
748
|
-
# @return [Sketchup::Face, false] the reversed Face object if successful, false if
|
749
|
-
# unsuccessful
|
750
|
-
#
|
751
|
-
# @version SketchUp 6.0
|
752
|
-
def reverse!
|
753
|
-
end
|
754
|
-
|
755
|
-
# The {#set_texture_projection} method is used to set the texture projection
|
756
|
-
# direction.
|
757
|
-
#
|
758
|
-
# @deprecated This function never worked correctly. It's not capable of
|
759
|
-
# controlling the position and orientation of the texture. In some cases it
|
760
|
-
# produced an invalid model. As of SketchUp 2021.1 the method simply raises
|
761
|
-
# +NotImplementedError+.
|
762
|
-
#
|
763
|
-
# @param [Geom::Vector3d] vector
|
764
|
-
# representing the direction of the projection. Use +nil+ to remove the
|
765
|
-
# projection.
|
766
|
-
#
|
767
|
-
# @param [Boolean] frontside
|
768
|
-
# +true+ for front side, +false+ for back side.
|
769
|
-
#
|
770
|
-
# @return [Boolean]
|
771
|
-
#
|
772
|
-
# @see #position_material
|
773
|
-
#
|
774
|
-
# @see #clear_texture_projection
|
775
|
-
#
|
776
|
-
# @version SketchUp 2014
|
777
|
-
def set_texture_projection(vector, frontside)
|
778
|
-
end
|
779
|
-
|
780
|
-
# The {#texture_positioned?} method is used to check if the face has a
|
781
|
-
# texture that is positioned.
|
782
|
-
#
|
783
|
-
# A texture is positioned when it's not using the default texture coordinates.
|
784
|
-
#
|
785
|
-
# When a user uses the Paint Bucket Tool to apply a material sampled from the
|
786
|
-
# Material Browser it will use default texture coordinates and not be
|
787
|
-
# positioned. It will be positioned if the user uses the Position Texture Tool.
|
788
|
-
#
|
789
|
-
# When an API user uses {Sketchup::Drawinglement#material=} the texture is not
|
790
|
-
# positioned. It will be positioned when the API user uses
|
791
|
-
# {Sketchup::Face#position_material}. It it also positioned of the face was
|
792
|
-
# crafted via {Geom::PolygonMesh}.
|
793
|
-
#
|
794
|
-
# @example
|
795
|
-
# model = Sketchup.active_model
|
796
|
-
# entities = model.active_entities
|
797
|
-
# faces = entities.grep(Sketchup::Face).select { |face|
|
798
|
-
# face.texture_positioned?(true) || face.texture_positioned?(false)
|
799
|
-
# }
|
800
|
-
#
|
801
|
-
# @param [Boolean] front
|
802
|
-
# +true+ Checks the front side of the face, +false+
|
803
|
-
# the back side.
|
804
|
-
#
|
805
|
-
# @return [Boolean]
|
806
|
-
#
|
807
|
-
# @see #position_material
|
808
|
-
#
|
809
|
-
# @see #material=
|
810
|
-
#
|
811
|
-
# @see #back_material=
|
812
|
-
#
|
813
|
-
# @version SketchUp 2021.1
|
814
|
-
def texture_positioned?(front)
|
815
|
-
end
|
816
|
-
|
817
|
-
# The {#texture_projected?} method is used to check if the face has a
|
818
|
-
# texture that is projected.
|
819
|
-
#
|
820
|
-
# A texture is projected when the user enables this property via the
|
821
|
-
# Position Texture Tool.
|
822
|
-
#
|
823
|
-
# It is also projected when the API user passes a projection vector to
|
824
|
-
# {#position_material}.
|
825
|
-
#
|
826
|
-
# @param [Boolean] front
|
827
|
-
# +true+ Checks the front side of the face, +false+
|
828
|
-
# the back side.
|
829
|
-
#
|
830
|
-
# @return [Boolean]
|
831
|
-
#
|
832
|
-
# @see #get_texture_projection
|
833
|
-
#
|
834
|
-
# @see #clear_texture_projection
|
835
|
-
#
|
836
|
-
# @see #position_material
|
837
|
-
#
|
838
|
-
# @version SketchUp 2021.1
|
839
|
-
def texture_projected?(front)
|
840
|
-
end
|
841
|
-
|
842
|
-
# The {#uv_tile_at} method is used to get the corner positions (model and UV)
|
843
|
-
# of a UV tile.
|
844
|
-
#
|
845
|
-
# The UV tile bounds the given reference point on the plane of the face. If the
|
846
|
-
# reference isn't on the plane of the face it will be projected onto it.
|
847
|
-
#
|
848
|
-
# The world coordinates are on the plane of the face unless the texture is
|
849
|
-
# projected. When the texture is projected the the world points are on an
|
850
|
-
# arbitrary plane that is perpendicular to the projection direction.
|
851
|
-
#
|
852
|
-
# The returned coordinates are arranged to be compatible with {#position_material}.
|
853
|
-
#
|
854
|
-
# <b>Getting the bounds of the UV tile under the cursor:</b>
|
855
|
-
#
|
856
|
-
# <i>The red quadrilateral represents the model points returned.</i>
|
857
|
-
#
|
858
|
-
# rdoc-image:../images/face-uv-tile-at.png
|
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
|
-
#
|
865
|
-
# @example Copy material from front to back
|
866
|
-
# model = Sketchup.active_model
|
867
|
-
# model.active_entities.grep(Sketchup::Face) { |face|
|
868
|
-
# material = face.material
|
869
|
-
#
|
870
|
-
# if material&.texture.nil?
|
871
|
-
# face.back_material = material
|
872
|
-
# end
|
873
|
-
#
|
874
|
-
# reference = face.vertices.first.position
|
875
|
-
# mapping = face.uv_tile_at(reference, true)
|
876
|
-
# if face.texture_projected?(true)
|
877
|
-
# projection = face.get_texture_projection(true)
|
878
|
-
# face.position_material(material, mapping, false, projection)
|
879
|
-
# else
|
880
|
-
# face.position_material(material, mapping, false)
|
881
|
-
# end
|
882
|
-
# }
|
883
|
-
#
|
884
|
-
# @example Iterate each set of world and UV coordinates
|
885
|
-
# model = Sketchup.active_model
|
886
|
-
# faces = model.active_entities.grep(Sketchup::Face)
|
887
|
-
# face = faces.find { |face| face.material&.texture }
|
888
|
-
# reference = face.vertices.first.position
|
889
|
-
# mapping = face.uv_tile_at(reference, true)
|
890
|
-
# mapping.each_slice(2) { |position, uv|
|
891
|
-
# puts "World: #{position.inspect} - UV: #{uv.inspect}"
|
892
|
-
# }
|
893
|
-
#
|
894
|
-
# @param [Geom::Point3d] position
|
895
|
-
# Model position on the face's plane that will be
|
896
|
-
# bounded by the UV tile.
|
897
|
-
#
|
898
|
-
# @param [Boolean] front
|
899
|
-
# +true+ Checks the front side of the face, +false+
|
900
|
-
# the back side.
|
901
|
-
#
|
902
|
-
# @return [Array<Geom::Point3d>, nil] A set of 8 points. Each stride of two is
|
903
|
-
# first a model space point, the second a UV
|
904
|
-
# coordinate. +nil+ if the face doesn't have
|
905
|
-
# a texture on the given side.
|
906
|
-
#
|
907
|
-
# @see #position_material
|
908
|
-
#
|
909
|
-
# @version SketchUp 2021.1
|
910
|
-
def uv_tile_at(position, front)
|
911
|
-
end
|
912
|
-
|
913
|
-
# The vertices method is used to get an array of all of the vertices that
|
914
|
-
# bound the face.
|
915
|
-
#
|
916
|
-
# @example
|
917
|
-
# depth = 100
|
918
|
-
# width = 100
|
919
|
-
# model = Sketchup.active_model
|
920
|
-
# entities = model.active_entities
|
921
|
-
# pts = []
|
922
|
-
# pts[0] = [0, 0, 0]
|
923
|
-
# pts[1] = [width, 0, 0]
|
924
|
-
# pts[2] = [width, depth, 0]
|
925
|
-
# pts[3] = [0, depth, 0]
|
926
|
-
#
|
927
|
-
# # Add the face to the entities in the model
|
928
|
-
# face = entities.add_face(pts)
|
929
|
-
# vertices = face.vertices
|
930
|
-
#
|
931
|
-
# @return [Array<Sketchup::Vertex>] an array of Vertex objects if successful
|
932
|
-
#
|
933
|
-
# @version SketchUp 6.0
|
934
|
-
def vertices
|
935
|
-
end
|
936
|
-
|
937
|
-
end
|
1
|
+
# Copyright:: Copyright 2023 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# Faces in SketchUp are flat, 2-sided polygons with 3 or more sides.
|
5
|
+
#
|
6
|
+
# @version SketchUp 6.0
|
7
|
+
class Sketchup::Face < Sketchup::Drawingelement
|
8
|
+
|
9
|
+
# Constants
|
10
|
+
|
11
|
+
PointInside = nil # Stub value.
|
12
|
+
PointNotOnPlane = nil # Stub value.
|
13
|
+
PointOnEdge = nil # Stub value.
|
14
|
+
PointOnFace = nil # Stub value.
|
15
|
+
PointOnVertex = nil # Stub value.
|
16
|
+
PointOutside = nil # Stub value.
|
17
|
+
PointUnknown = nil # Stub value.
|
18
|
+
|
19
|
+
# Instance Methods
|
20
|
+
|
21
|
+
# The all_connected method retrieves all of the entities connected to a face.
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# depth = 100
|
25
|
+
# width = 100
|
26
|
+
# model = Sketchup.active_model
|
27
|
+
# entities = model.active_entities
|
28
|
+
# pts = []
|
29
|
+
# pts[0] = [0, 0, 0]
|
30
|
+
# pts[1] = [width, 0, 0]
|
31
|
+
# pts[2] = [width, depth, 0]
|
32
|
+
# pts[3] = [0, depth, 0]
|
33
|
+
#
|
34
|
+
# # Add the face to the entities in the model
|
35
|
+
# face = entities.add_face(pts)
|
36
|
+
# connected = face.all_connected
|
37
|
+
#
|
38
|
+
# @return [Array<Sketchup::Entity>] the entities connected to the face
|
39
|
+
#
|
40
|
+
# @version SketchUp 6.0
|
41
|
+
def all_connected
|
42
|
+
end
|
43
|
+
|
44
|
+
# The area method is used to retrieve the area of a face.
|
45
|
+
#
|
46
|
+
# You can pass in an optional Transformation (or an array that can represent a
|
47
|
+
# transformation), to correct for a parent group's transformation. For example,
|
48
|
+
# if a face is inside of a group that is scaled to 200%, the area method will
|
49
|
+
# return the unscaled area of the face. So by passing a 200% transformation
|
50
|
+
# object to this method, you can account for that to get the "visual" area
|
51
|
+
# of the face.
|
52
|
+
#
|
53
|
+
# @example
|
54
|
+
# depth = 100
|
55
|
+
# width = 100
|
56
|
+
# model = Sketchup.active_model
|
57
|
+
# entities = model.active_entities
|
58
|
+
# pts = []
|
59
|
+
# pts[0] = [0, 0, 0]
|
60
|
+
# pts[1] = [width, 0, 0]
|
61
|
+
# pts[2] = [width, depth, 0]
|
62
|
+
# pts[3] = [0, depth, 0]
|
63
|
+
# # Add the face to the entities in the model
|
64
|
+
# face = entities.add_face(pts)
|
65
|
+
# area = face.area
|
66
|
+
#
|
67
|
+
# @overload area
|
68
|
+
#
|
69
|
+
# @return [Float] the area of the face in square inches.
|
70
|
+
#
|
71
|
+
# @overload area(transform)
|
72
|
+
#
|
73
|
+
# @param [Geom::Transformation] transform
|
74
|
+
# A Transformation object or array that can be interpreted as a
|
75
|
+
# Transformation object.
|
76
|
+
# @return [Float] the area of the face in square inches.
|
77
|
+
#
|
78
|
+
# @version SketchUp 6.0
|
79
|
+
def area(*args)
|
80
|
+
end
|
81
|
+
|
82
|
+
# The back_material method is used to retrieve the material assigned to the
|
83
|
+
# back side of the face.
|
84
|
+
#
|
85
|
+
# @example
|
86
|
+
# depth = 100
|
87
|
+
# width = 100
|
88
|
+
# model = Sketchup.active_model
|
89
|
+
# entities = model.active_entities
|
90
|
+
# pts = []
|
91
|
+
# pts[0] = [0, 0, 0]
|
92
|
+
# pts[1] = [width, 0, 0]
|
93
|
+
# pts[2] = [width, depth, 0]
|
94
|
+
# pts[3] = [0, depth, 0]
|
95
|
+
#
|
96
|
+
# # Add the face to the entities in the model
|
97
|
+
# face = entities.add_face(pts)
|
98
|
+
#
|
99
|
+
# # Add a material to the back face, then check to see that it was added
|
100
|
+
# face.back_material = "red"
|
101
|
+
# material = face.back_material
|
102
|
+
#
|
103
|
+
# @return [Sketchup::Material, nil] a Material object representing the material
|
104
|
+
# on the back of the face (if successful)
|
105
|
+
#
|
106
|
+
# @version SketchUp 6.0
|
107
|
+
def back_material
|
108
|
+
end
|
109
|
+
|
110
|
+
# The back_material= method is used to set the material assigned to the back
|
111
|
+
# side of the face.
|
112
|
+
#
|
113
|
+
# @example
|
114
|
+
# depth = 100
|
115
|
+
# width = 100
|
116
|
+
# model = Sketchup.active_model
|
117
|
+
# entities = model.active_entities
|
118
|
+
# pts = []
|
119
|
+
# pts[0] = [0, 0, 0]
|
120
|
+
# pts[1] = [width, 0, 0]
|
121
|
+
# pts[2] = [width, depth, 0]
|
122
|
+
# pts[3] = [0, depth, 0]
|
123
|
+
# # Add the face to the entities in the model
|
124
|
+
# face = entities.add_face(pts)
|
125
|
+
# status = face.back_material = "red"
|
126
|
+
#
|
127
|
+
# @param [Sketchup::Material] material
|
128
|
+
# A Material object or the name of a valid material.
|
129
|
+
#
|
130
|
+
# @return [Sketchup::Material] the name of the valid material or the new
|
131
|
+
# Material object (if successful)
|
132
|
+
#
|
133
|
+
# @version SketchUp 6.0
|
134
|
+
def back_material=(material)
|
135
|
+
end
|
136
|
+
|
137
|
+
# The classify_point method is used to determine if a given Point3d is on the
|
138
|
+
# referenced Face.
|
139
|
+
#
|
140
|
+
# It is important that return value comparisons be made against the
|
141
|
+
# symbolic constants (i.e. {Sketchup::Face::PointUnknown},
|
142
|
+
# {Sketchup::Face::PointInside}, {Sketchup::Face::PointOnVertex}, etc.) rather
|
143
|
+
# than the absolute integer values as these values may change from one
|
144
|
+
# release to the next.
|
145
|
+
#
|
146
|
+
# @example
|
147
|
+
# model = Sketchup.active_model
|
148
|
+
# entities = model.active_entities
|
149
|
+
# pts = []
|
150
|
+
# pts[0] = [0, 0, 0]
|
151
|
+
# pts[1] = [9, 0, 0]
|
152
|
+
# pts[2] = [9, 9, 0]
|
153
|
+
# pts[3] = [0, 9, 0]
|
154
|
+
#
|
155
|
+
# # Add the face to the entities in the model
|
156
|
+
# face = entities.add_face(pts)
|
157
|
+
#
|
158
|
+
# # Check a point that should be outside the face.
|
159
|
+
# pt = Geom::Point3d.new(50, 50, 0)
|
160
|
+
# result = face.classify_point(pt)
|
161
|
+
# if result == Sketchup::Face::PointOutside
|
162
|
+
# puts "#{pt.to_s} is outside the face"
|
163
|
+
# end
|
164
|
+
#
|
165
|
+
# # Check a point that should be outside inside the face.
|
166
|
+
# pt = Geom::Point3d.new(1, 1, 0)
|
167
|
+
# result = face.classify_point(pt)
|
168
|
+
# if result == Sketchup::Face::PointInside
|
169
|
+
# puts "#{pt.to_s} is inside the face"
|
170
|
+
# end
|
171
|
+
#
|
172
|
+
# # Check a point that should be on the vertex of the face.
|
173
|
+
# pt = Geom::Point3d.new(0, 0, 0)
|
174
|
+
# result = face.classify_point(pt)
|
175
|
+
# if result == Sketchup::Face::PointOnVertex
|
176
|
+
# puts "#{pt.to_s} is on a vertex"
|
177
|
+
# end
|
178
|
+
#
|
179
|
+
# # Check a point that should be on the edge of the face.
|
180
|
+
# pt = Geom::Point3d.new(0, 1, 0)
|
181
|
+
# result = face.classify_point(pt)
|
182
|
+
# if result == Sketchup::Face::PointOnEdge
|
183
|
+
# puts "#{pt.to_s} is on an edge of the face"
|
184
|
+
# end
|
185
|
+
#
|
186
|
+
# # Check a point that should be off the plane of the face.
|
187
|
+
# pt = Geom::Point3d.new(1, 1, 10)
|
188
|
+
# result = face.classify_point(pt)
|
189
|
+
# if result == Sketchup::Face::PointNotOnPlane
|
190
|
+
# puts "#{pt.to_s} is not on the same plane as the face"
|
191
|
+
# end
|
192
|
+
#
|
193
|
+
# @param [Geom::Point3d] point
|
194
|
+
# A Point3d.
|
195
|
+
#
|
196
|
+
# @return [Integer] an integer describing where a Point3d is in
|
197
|
+
# relation to the referenced Face.
|
198
|
+
#
|
199
|
+
# @version SketchUp 6.0
|
200
|
+
def classify_point(point)
|
201
|
+
end
|
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
|
+
|
215
|
+
# The {#clear_texture_projection} method is used to clear the texture
|
216
|
+
# projection. This is similar to toggling off Projection from the Position
|
217
|
+
# Texture tool in the UI.
|
218
|
+
#
|
219
|
+
# @param [Boolean] frontside
|
220
|
+
# +true+ for front side, +false+ for back side.
|
221
|
+
#
|
222
|
+
# @see #position_material
|
223
|
+
#
|
224
|
+
# @see #get_texture_projection
|
225
|
+
#
|
226
|
+
# @version SketchUp 2021.1
|
227
|
+
def clear_texture_projection(frontside)
|
228
|
+
end
|
229
|
+
|
230
|
+
# The edges method is used to get an array of edges that bound the face.
|
231
|
+
#
|
232
|
+
# @example
|
233
|
+
# depth = 100
|
234
|
+
# width = 100
|
235
|
+
# model = Sketchup.active_model
|
236
|
+
# entities = model.active_entities
|
237
|
+
# pts = []
|
238
|
+
# pts[0] = [0, 0, 0]
|
239
|
+
# pts[1] = [width, 0, 0]
|
240
|
+
# pts[2] = [width, depth, 0]
|
241
|
+
# pts[3] = [0, depth, 0]
|
242
|
+
# # Add the face to the entities in the model
|
243
|
+
# face = entities.add_face(pts)
|
244
|
+
# edges = face.edges
|
245
|
+
#
|
246
|
+
# @return [Array<Sketchup::Edge>] an array of Edge objects (if successful)
|
247
|
+
#
|
248
|
+
# @version SketchUp 6.0
|
249
|
+
def edges
|
250
|
+
end
|
251
|
+
|
252
|
+
# The {#followme} method is used to create a shape by making the face follow
|
253
|
+
# along an array of edges.
|
254
|
+
#
|
255
|
+
# @example
|
256
|
+
# model = Sketchup.active_model
|
257
|
+
# entities = model.active_entities
|
258
|
+
#
|
259
|
+
# depth = 100
|
260
|
+
# width = 100
|
261
|
+
#
|
262
|
+
# # Add the face to the entities in the model
|
263
|
+
# points = [
|
264
|
+
# Geom::Point3d.new(0, 0, 0),
|
265
|
+
# Geom::Point3d.new(width, 0, 0),
|
266
|
+
# Geom::Point3d.new(width, depth, 0),
|
267
|
+
# Geom::Point3d.new(0, depth, 0)
|
268
|
+
# ]
|
269
|
+
# face = entities.add_face(points)
|
270
|
+
#
|
271
|
+
# # Add the line which we will "follow" to the entities in the model
|
272
|
+
# point1 = Geom::Point3d.new(0, 0, 0)
|
273
|
+
# point2 = Geom::Point3d.new(0, 0, 100)
|
274
|
+
# edge = entities.add_line(point1, point2)
|
275
|
+
# face.followme(edge)
|
276
|
+
#
|
277
|
+
# @overload followme(edges)
|
278
|
+
#
|
279
|
+
# @param [Array<Sketchup::Edge>] edges An array of edge objects to follow.
|
280
|
+
# @return [Boolean]
|
281
|
+
#
|
282
|
+
# @overload followme(edge)
|
283
|
+
#
|
284
|
+
# @param [Sketchup::Edge] edge An edge to follow.
|
285
|
+
# @return [Boolean]
|
286
|
+
#
|
287
|
+
# @version SketchUp 6.0
|
288
|
+
def followme(*args)
|
289
|
+
end
|
290
|
+
|
291
|
+
# The get_UVHelper object is used to retrieve a UVHelper object for use in
|
292
|
+
# texture manipulation on a face.
|
293
|
+
#
|
294
|
+
# @example
|
295
|
+
# model = Sketchup.active_model
|
296
|
+
# entities = model.active_entities
|
297
|
+
# pts = []
|
298
|
+
# pts[0] = [0, 0, 0]
|
299
|
+
# pts[1] = [9, 0, 0]
|
300
|
+
# pts[2] = [9, 9, 0]
|
301
|
+
# pts[3] = [0, 9, 0]
|
302
|
+
#
|
303
|
+
# # Add the face to the entities in the model
|
304
|
+
# face = entities.add_face(pts)
|
305
|
+
# tw = Sketchup.create_texture_writer
|
306
|
+
# uvHelp = face.get_UVHelper(true, true, tw)
|
307
|
+
#
|
308
|
+
# @overload get_UVHelper(front = true, back = true)
|
309
|
+
#
|
310
|
+
# @param [Boolean] front
|
311
|
+
# True if you want the texture coordinates for the front
|
312
|
+
# face, false if not.
|
313
|
+
#
|
314
|
+
# @param [Boolean] back
|
315
|
+
# True if you want the texture coordinates for the back
|
316
|
+
# face, false if not.
|
317
|
+
#
|
318
|
+
# @overload get_UVHelper(front = true, back = true, texturewriter)
|
319
|
+
#
|
320
|
+
# @param [Boolean] front
|
321
|
+
# True if you want the texture coordinates for the front
|
322
|
+
# face, false if not.
|
323
|
+
#
|
324
|
+
# @param [Boolean] back
|
325
|
+
# True if you want the texture coordinates for the back
|
326
|
+
# face, false if not.
|
327
|
+
#
|
328
|
+
# @param [Sketchup::TextureWriter] texturewriter
|
329
|
+
# An optional TextureWriter object.
|
330
|
+
#
|
331
|
+
# @return [Sketchup::UVHelper]
|
332
|
+
#
|
333
|
+
# @version SketchUp 6.0
|
334
|
+
def get_UVHelper(*args)
|
335
|
+
end
|
336
|
+
|
337
|
+
# The get_glued_instances method returns an Array any ComponentInstances
|
338
|
+
# that are glued to the face.
|
339
|
+
#
|
340
|
+
# ComponentInstance objects that are currently glued to the face.
|
341
|
+
#
|
342
|
+
# @example
|
343
|
+
# # Create a series of points that define a new face.
|
344
|
+
# model = Sketchup.active_model
|
345
|
+
# entities = model.active_entities
|
346
|
+
# pts = []
|
347
|
+
# pts[0] = [0, 0, 0]
|
348
|
+
# pts[1] = [9, 0, 0]
|
349
|
+
# pts[2] = [9, 9, 0]
|
350
|
+
# pts[3] = [0, 9, 0]
|
351
|
+
#
|
352
|
+
# # Add the face to the entities in the model
|
353
|
+
# face = entities.add_face(pts)
|
354
|
+
# glued_array = face.get_glued_instances
|
355
|
+
#
|
356
|
+
# @return [Array<Sketchup::ComponentInstance, Sketchup::Group, Sketchup::Image>] An array of
|
357
|
+
#
|
358
|
+
# @version SketchUp 7.0 M1
|
359
|
+
def get_glued_instances
|
360
|
+
end
|
361
|
+
|
362
|
+
# The {#get_texture_projection} method will return a vector representing the
|
363
|
+
# projection for either the front or back side of the face.
|
364
|
+
#
|
365
|
+
# @example
|
366
|
+
# model = Sketchup.active_model
|
367
|
+
# entities = model.active_entities
|
368
|
+
# materials = model.materials
|
369
|
+
#
|
370
|
+
# # Create a face and add it to the model entities
|
371
|
+
# pts = []
|
372
|
+
# pts[0] = [0, 0, 1]
|
373
|
+
# pts[1] = [10, 0, 1]
|
374
|
+
# pts[2] = [10, 10, 1]
|
375
|
+
# face = entities.add_face(pts)
|
376
|
+
#
|
377
|
+
# # Export an image to use as a texture
|
378
|
+
# path = Sketchup.temp_dir
|
379
|
+
# full_name = File.join(path, "temp_image.jpg")
|
380
|
+
# model.active_view.write_image(full_name, 500, 500, false, 0.0)
|
381
|
+
#
|
382
|
+
# # Create a material and assign the texture to it
|
383
|
+
# material = materials.add("Test Material")
|
384
|
+
# material.texture = full_name
|
385
|
+
#
|
386
|
+
# # Assign the new material to our face we created
|
387
|
+
# face.material = material
|
388
|
+
#
|
389
|
+
# # Set the projection of the applied material
|
390
|
+
# face.set_texture_projection(face.normal, true)
|
391
|
+
#
|
392
|
+
# # Get the projection of the applied material
|
393
|
+
# vector = face.get_texture_projection(true)
|
394
|
+
#
|
395
|
+
# @param [Boolean] frontside
|
396
|
+
# +true+ for front side, +false+ for back side.
|
397
|
+
#
|
398
|
+
# @return [Geom::Vector3d, nil] a vector on success, +nil+ if face is not
|
399
|
+
# textured with a projected texture mapping.
|
400
|
+
#
|
401
|
+
# @see #position_material
|
402
|
+
#
|
403
|
+
# @see #texture_projected?
|
404
|
+
#
|
405
|
+
# @version SketchUp 2014
|
406
|
+
def get_texture_projection(frontside)
|
407
|
+
end
|
408
|
+
|
409
|
+
# The loops method is used to get an array of all of the loops that bound the
|
410
|
+
# face.
|
411
|
+
#
|
412
|
+
# @example
|
413
|
+
# depth = 100
|
414
|
+
# width = 100
|
415
|
+
# model = Sketchup.active_model
|
416
|
+
# entities = model.active_entities
|
417
|
+
# pts = []
|
418
|
+
# pts[0] = [0, 0, 0]
|
419
|
+
# pts[1] = [width, 0, 0]
|
420
|
+
# pts[2] = [width, depth, 0]
|
421
|
+
# pts[3] = [0, depth, 0]
|
422
|
+
#
|
423
|
+
# # Add the face to the entities in the model
|
424
|
+
# face = entities.add_face(pts)
|
425
|
+
# loops = face.loops
|
426
|
+
#
|
427
|
+
# @return [Array<Sketchup::Loop>] an array of Loop objects if successful
|
428
|
+
#
|
429
|
+
# @version SketchUp 6.0
|
430
|
+
def loops
|
431
|
+
end
|
432
|
+
|
433
|
+
# The material method is used to retrieve the material assigned to the
|
434
|
+
# front of the face. (This method is inherited from the Drawingelement
|
435
|
+
# parent class.)
|
436
|
+
#
|
437
|
+
# @example
|
438
|
+
# depth = 100
|
439
|
+
# width = 100
|
440
|
+
# model = Sketchup.active_model
|
441
|
+
# entities = model.active_entities
|
442
|
+
# pts = []
|
443
|
+
# pts[0] = [0, 0, 0]
|
444
|
+
# pts[1] = [width, 0, 0]
|
445
|
+
# pts[2] = [width, depth, 0]
|
446
|
+
# pts[3] = [0, depth, 0]
|
447
|
+
#
|
448
|
+
# # Add the face to the entities in the model
|
449
|
+
# face = entities.add_face(pts)
|
450
|
+
#
|
451
|
+
# # Add a material to the face, then check to see that it was added
|
452
|
+
# face.material = "red"
|
453
|
+
# material = face.material
|
454
|
+
#
|
455
|
+
# @return [Sketchup::Material, nil] a Material object representing the material
|
456
|
+
# on the front of the face (if successful)
|
457
|
+
#
|
458
|
+
# @version SketchUp 6.0
|
459
|
+
def material
|
460
|
+
end
|
461
|
+
|
462
|
+
# The material= method is used to set the material assigned to the front
|
463
|
+
# side of the face. (This method is inherited from the Drawingelement
|
464
|
+
# parent class.)
|
465
|
+
#
|
466
|
+
# @example
|
467
|
+
# depth = 100
|
468
|
+
# width = 100
|
469
|
+
# model = Sketchup.active_model
|
470
|
+
# entities = model.active_entities
|
471
|
+
# pts = []
|
472
|
+
# pts[0] = [0, 0, 0]
|
473
|
+
# pts[1] = [width, 0, 0]
|
474
|
+
# pts[2] = [width, depth, 0]
|
475
|
+
# pts[3] = [0, depth, 0]
|
476
|
+
# # Add the face to the entities in the model
|
477
|
+
# face = entities.add_face(pts)
|
478
|
+
# status = face.material = "red"
|
479
|
+
#
|
480
|
+
# @param [Sketchup::Material] material
|
481
|
+
# A Material object or the name of a valid material.
|
482
|
+
#
|
483
|
+
# @return [Sketchup::Material] the name of the valid material or the new
|
484
|
+
# Material object (if successful)
|
485
|
+
#
|
486
|
+
# @version SketchUp 6.0
|
487
|
+
def material=(material)
|
488
|
+
end
|
489
|
+
|
490
|
+
# The mesh method creates a polygon mesh that represents the face. See the
|
491
|
+
# {Geom::PolygonMesh} class for more information.
|
492
|
+
#
|
493
|
+
# Valid flags are:
|
494
|
+
#
|
495
|
+
# - +0+: Include PolygonMeshPoints,
|
496
|
+
# - +1+: Include PolygonMeshUVQFront,
|
497
|
+
# - +2+: Include PolygonMeshUVQBack,
|
498
|
+
# - +4+: Include PolygonMeshNormals.
|
499
|
+
#
|
500
|
+
# Use bitwise OR to combine flags. A value of +7+ will include all
|
501
|
+
# flags, for example.
|
502
|
+
#
|
503
|
+
# @example
|
504
|
+
# depth = 100
|
505
|
+
# width = 100
|
506
|
+
# model = Sketchup.active_model
|
507
|
+
# entities = model.active_entities
|
508
|
+
# pts = []
|
509
|
+
# pts[0] = [0, 0, 0]
|
510
|
+
# pts[1] = [width, 0, 0]
|
511
|
+
# pts[2] = [width, depth, 0]
|
512
|
+
# pts[3] = [0, depth, 0]
|
513
|
+
#
|
514
|
+
# # Add the face to the entities in the model
|
515
|
+
# face = entities.add_face(pts)
|
516
|
+
#
|
517
|
+
# kPoints = 0
|
518
|
+
# kUVQFront = 1
|
519
|
+
# kUVQBack = 2
|
520
|
+
# kNormals = 4
|
521
|
+
# flags = kPoints | kUVQFront | kUVQBack | kNormals # equals to 7
|
522
|
+
# mesh = face.mesh(flags)
|
523
|
+
#
|
524
|
+
# @param [Integer] flags
|
525
|
+
# One or more flags used to generate a mesh.
|
526
|
+
#
|
527
|
+
# @return [Geom::PolygonMesh]
|
528
|
+
#
|
529
|
+
# @version SketchUp 6.0
|
530
|
+
def mesh(flags = 0)
|
531
|
+
end
|
532
|
+
|
533
|
+
# The normal method is used to retrieve the 3D vector normal to the face in
|
534
|
+
# the front direction.
|
535
|
+
#
|
536
|
+
# @example
|
537
|
+
# depth = 100
|
538
|
+
# width = 100
|
539
|
+
# model = Sketchup.active_model
|
540
|
+
# entities = model.active_entities
|
541
|
+
# pts = []
|
542
|
+
# pts[0] = [0, 0, 0]
|
543
|
+
# pts[1] = [width, 0, 0]
|
544
|
+
# pts[2] = [width, depth, 0]
|
545
|
+
# pts[3] = [0, depth, 0]
|
546
|
+
#
|
547
|
+
# # Add the face to the entities in the model
|
548
|
+
# face = entities.add_face(pts)
|
549
|
+
# normal = face.normal
|
550
|
+
#
|
551
|
+
# @return [Geom::Vector3d] a Vector3d object if successful
|
552
|
+
#
|
553
|
+
# @version SketchUp 6.0
|
554
|
+
def normal
|
555
|
+
end
|
556
|
+
|
557
|
+
# This method is used to retrieve the outer loop that bounds the face.
|
558
|
+
#
|
559
|
+
# @example
|
560
|
+
# # Create a series of points that define a new face.
|
561
|
+
# model = Sketchup.active_model
|
562
|
+
# entities = model.active_entities
|
563
|
+
# pts = []
|
564
|
+
# pts[0] = [0, 0, 0]
|
565
|
+
# pts[1] = [9, 0, 0]
|
566
|
+
# pts[2] = [9, 9, 0]
|
567
|
+
# pts[3] = [0, 9, 0]
|
568
|
+
#
|
569
|
+
# # Add the face to the entities in the model
|
570
|
+
# face = entities.add_face(pts)
|
571
|
+
# loop = face.outer_loop
|
572
|
+
#
|
573
|
+
# @return [Sketchup::Loop] a Loop object representing the outer loop (if
|
574
|
+
# successful)
|
575
|
+
#
|
576
|
+
# @version SketchUp 6.0
|
577
|
+
def outer_loop
|
578
|
+
end
|
579
|
+
|
580
|
+
# The plane method is used to retrieve the plane of the face. See the Array
|
581
|
+
# class for information on how planes are stored.
|
582
|
+
#
|
583
|
+
# @example
|
584
|
+
# depth = 100
|
585
|
+
# width = 100
|
586
|
+
# model = Sketchup.active_model
|
587
|
+
# entities = model.active_entities
|
588
|
+
# pts = []
|
589
|
+
# pts[0] = [0, 0, 0]
|
590
|
+
# pts[1] = [width, 0, 0]
|
591
|
+
# pts[2] = [width, depth, 0]
|
592
|
+
# pts[3] = [0, depth, 0]
|
593
|
+
#
|
594
|
+
# # Add the face to the entities in the model
|
595
|
+
# face = entities.add_face(pts)
|
596
|
+
# plane = face.plane
|
597
|
+
#
|
598
|
+
# @return [Array(Float, Float, Float, Float)] a plane that contains the face (if successful)
|
599
|
+
#
|
600
|
+
# @version SketchUp 6.0
|
601
|
+
def plane
|
602
|
+
end
|
603
|
+
|
604
|
+
# The {#position_material} method is used to position a material on a face.
|
605
|
+
#
|
606
|
+
# The +points+ argument must contain 2, 4, 6 or 8 points. The points are used
|
607
|
+
# in pairs to describe where a point in the texture image is positioned on the
|
608
|
+
# Face. The first point in each pair is a 3D point in the model. The second
|
609
|
+
# point in each pair of points is a 2D point that gives the (u,v) coordinates
|
610
|
+
# of a point in the image to match up with the 3D point.
|
611
|
+
#
|
612
|
+
# @example
|
613
|
+
# model = Sketchup.active_model
|
614
|
+
# entities = model.active_entities
|
615
|
+
#
|
616
|
+
# # Create a face and add it to the model entities
|
617
|
+
# points = [
|
618
|
+
# Geom::Point3d.new(0, 0, 1),
|
619
|
+
# Geom::Point3d.new(9, 0, 1),
|
620
|
+
# Geom::Point3d.new(9, 9, 1),
|
621
|
+
# Geom::Point3d.new(0, 9, 1),
|
622
|
+
# ]
|
623
|
+
# face = entities.add_face(points)
|
624
|
+
#
|
625
|
+
# # Export an image to use as a texture
|
626
|
+
# path = Sketchup.temp_dir
|
627
|
+
# full_name = File.join(path, "temp_image.jpg")
|
628
|
+
# model.active_view.write_image(full_name, 500, 500, false, 0.0)
|
629
|
+
#
|
630
|
+
# # Create a material and assign the texture to it
|
631
|
+
# material = model.materials.add("Test Material")
|
632
|
+
# material.texture = full_name
|
633
|
+
#
|
634
|
+
# # Assign the new material to our face we created
|
635
|
+
# face.material = material
|
636
|
+
#
|
637
|
+
# mapping = [
|
638
|
+
# Geom::Point3d.new(3,0,0), # Model coordinate
|
639
|
+
# Geom::Point3d.new(0,0,0), # UV coordinate
|
640
|
+
# ]
|
641
|
+
# on_front = true
|
642
|
+
# face.position_material(material, mapping, on_front)
|
643
|
+
#
|
644
|
+
# @overload position_material(material, points, on_front)
|
645
|
+
#
|
646
|
+
# This variant positions a material on the face's plane without projection.
|
647
|
+
#
|
648
|
+
# @param [Sketchup::Material] material
|
649
|
+
#
|
650
|
+
# @param [Array<Geom::Point3d>] points
|
651
|
+
# An array of Point3d objects used to position the material.
|
652
|
+
# The points should be on the plane of the face. If they are not they will
|
653
|
+
# be projected to the face's plane.
|
654
|
+
#
|
655
|
+
# @param [Boolean] on_front
|
656
|
+
# +true+ to position the texture on the front of the Face or
|
657
|
+
# +false+ to position it on the back of the Face.
|
658
|
+
#
|
659
|
+
# @overload position_material(material, points, on_front, projection)
|
660
|
+
#
|
661
|
+
# @version SketchUp 2021.1
|
662
|
+
#
|
663
|
+
# This variant positions a material on the face's plane with projection.
|
664
|
+
#
|
665
|
+
# @param [Sketchup::Material] material
|
666
|
+
#
|
667
|
+
# @param [Array<Geom::Point3d>] points
|
668
|
+
# An array of Point3d objects used to position the material.
|
669
|
+
# The points should be on the same plane. The plane should be parallel to
|
670
|
+
# the +projection+ vector. If they are not on a plane parallel to the
|
671
|
+
# projection vector they will be projected to such a plane.
|
672
|
+
#
|
673
|
+
# @param [Boolean] on_front
|
674
|
+
# +true+ to position the texture on the front of the Face or
|
675
|
+
# +false+ to position it on the back of the Face.
|
676
|
+
#
|
677
|
+
# @param [Geom::Vector3d] projection_vector
|
678
|
+
# The direction of the texture projection.
|
679
|
+
#
|
680
|
+
# @raise ArgumentError if the provided points are not in the size of 2, 4, 6 or 8.
|
681
|
+
#
|
682
|
+
# @raise ArgumentError if the provided points could not be computed to a valid UV mapping.
|
683
|
+
#
|
684
|
+
# @return [Sketchup::Face, false] the face upon success, +false+ if material or
|
685
|
+
# texture if not valid.
|
686
|
+
#
|
687
|
+
# @see #texture_positioned?
|
688
|
+
#
|
689
|
+
# @see #texture_projected?
|
690
|
+
#
|
691
|
+
# @see #get_texture_projection
|
692
|
+
#
|
693
|
+
# @see #clear_texture_projection
|
694
|
+
#
|
695
|
+
# @version SketchUp 6.0
|
696
|
+
def position_material(*args)
|
697
|
+
end
|
698
|
+
|
699
|
+
# The pushpull method is used to perform a push/pull on a face.
|
700
|
+
#
|
701
|
+
# The distance is measured in the direction that the face normal is pointing.
|
702
|
+
#
|
703
|
+
# @example
|
704
|
+
# depth = 100
|
705
|
+
# width = 100
|
706
|
+
# model = Sketchup.active_model
|
707
|
+
# entities = model.active_entities
|
708
|
+
# pts = []
|
709
|
+
# pts[0] = [0, 0, 0]
|
710
|
+
# pts[1] = [width, 0, 0]
|
711
|
+
# pts[2] = [width, depth, 0]
|
712
|
+
# pts[3] = [0, depth, 0]
|
713
|
+
# # Add the face to the entities in the model
|
714
|
+
# face = entities.add_face(pts)
|
715
|
+
# status = face.pushpull(100, true)
|
716
|
+
#
|
717
|
+
# @param [Length] distance
|
718
|
+
# The distance to push/pull the face.
|
719
|
+
#
|
720
|
+
# @param [Boolean] copy
|
721
|
+
# Create a new push/pull starting face if true (equivalent
|
722
|
+
# of pressing CTRL while in SketchUp), do not create a
|
723
|
+
# push/pull starting face if false.
|
724
|
+
#
|
725
|
+
# @return [nil]
|
726
|
+
#
|
727
|
+
# @version SketchUp 6.0
|
728
|
+
def pushpull(distance, copy = false)
|
729
|
+
end
|
730
|
+
|
731
|
+
# The reverse! method is used to reverse the face's orientation, meaning the
|
732
|
+
# front becomes the back.
|
733
|
+
#
|
734
|
+
# @example
|
735
|
+
# depth = 100
|
736
|
+
# width = 100
|
737
|
+
# model = Sketchup.active_model
|
738
|
+
# entities = model.active_entities
|
739
|
+
# pts = []
|
740
|
+
# pts[0] = [0, 0, 0]
|
741
|
+
# pts[1] = [width, 0, 0]
|
742
|
+
# pts[2] = [width, depth, 0]
|
743
|
+
# pts[3] = [0, depth, 0]
|
744
|
+
# # Add the face to the entities in the model
|
745
|
+
# face = entities.add_face(pts)
|
746
|
+
# status = face.reverse!
|
747
|
+
#
|
748
|
+
# @return [Sketchup::Face, false] the reversed Face object if successful, false if
|
749
|
+
# unsuccessful
|
750
|
+
#
|
751
|
+
# @version SketchUp 6.0
|
752
|
+
def reverse!
|
753
|
+
end
|
754
|
+
|
755
|
+
# The {#set_texture_projection} method is used to set the texture projection
|
756
|
+
# direction.
|
757
|
+
#
|
758
|
+
# @deprecated This function never worked correctly. It's not capable of
|
759
|
+
# controlling the position and orientation of the texture. In some cases it
|
760
|
+
# produced an invalid model. As of SketchUp 2021.1 the method simply raises
|
761
|
+
# +NotImplementedError+.
|
762
|
+
#
|
763
|
+
# @param [Geom::Vector3d] vector
|
764
|
+
# representing the direction of the projection. Use +nil+ to remove the
|
765
|
+
# projection.
|
766
|
+
#
|
767
|
+
# @param [Boolean] frontside
|
768
|
+
# +true+ for front side, +false+ for back side.
|
769
|
+
#
|
770
|
+
# @return [Boolean]
|
771
|
+
#
|
772
|
+
# @see #position_material
|
773
|
+
#
|
774
|
+
# @see #clear_texture_projection
|
775
|
+
#
|
776
|
+
# @version SketchUp 2014
|
777
|
+
def set_texture_projection(vector, frontside)
|
778
|
+
end
|
779
|
+
|
780
|
+
# The {#texture_positioned?} method is used to check if the face has a
|
781
|
+
# texture that is positioned.
|
782
|
+
#
|
783
|
+
# A texture is positioned when it's not using the default texture coordinates.
|
784
|
+
#
|
785
|
+
# When a user uses the Paint Bucket Tool to apply a material sampled from the
|
786
|
+
# Material Browser it will use default texture coordinates and not be
|
787
|
+
# positioned. It will be positioned if the user uses the Position Texture Tool.
|
788
|
+
#
|
789
|
+
# When an API user uses {Sketchup::Drawinglement#material=} the texture is not
|
790
|
+
# positioned. It will be positioned when the API user uses
|
791
|
+
# {Sketchup::Face#position_material}. It it also positioned of the face was
|
792
|
+
# crafted via {Geom::PolygonMesh}.
|
793
|
+
#
|
794
|
+
# @example
|
795
|
+
# model = Sketchup.active_model
|
796
|
+
# entities = model.active_entities
|
797
|
+
# faces = entities.grep(Sketchup::Face).select { |face|
|
798
|
+
# face.texture_positioned?(true) || face.texture_positioned?(false)
|
799
|
+
# }
|
800
|
+
#
|
801
|
+
# @param [Boolean] front
|
802
|
+
# +true+ Checks the front side of the face, +false+
|
803
|
+
# the back side.
|
804
|
+
#
|
805
|
+
# @return [Boolean]
|
806
|
+
#
|
807
|
+
# @see #position_material
|
808
|
+
#
|
809
|
+
# @see #material=
|
810
|
+
#
|
811
|
+
# @see #back_material=
|
812
|
+
#
|
813
|
+
# @version SketchUp 2021.1
|
814
|
+
def texture_positioned?(front)
|
815
|
+
end
|
816
|
+
|
817
|
+
# The {#texture_projected?} method is used to check if the face has a
|
818
|
+
# texture that is projected.
|
819
|
+
#
|
820
|
+
# A texture is projected when the user enables this property via the
|
821
|
+
# Position Texture Tool.
|
822
|
+
#
|
823
|
+
# It is also projected when the API user passes a projection vector to
|
824
|
+
# {#position_material}.
|
825
|
+
#
|
826
|
+
# @param [Boolean] front
|
827
|
+
# +true+ Checks the front side of the face, +false+
|
828
|
+
# the back side.
|
829
|
+
#
|
830
|
+
# @return [Boolean]
|
831
|
+
#
|
832
|
+
# @see #get_texture_projection
|
833
|
+
#
|
834
|
+
# @see #clear_texture_projection
|
835
|
+
#
|
836
|
+
# @see #position_material
|
837
|
+
#
|
838
|
+
# @version SketchUp 2021.1
|
839
|
+
def texture_projected?(front)
|
840
|
+
end
|
841
|
+
|
842
|
+
# The {#uv_tile_at} method is used to get the corner positions (model and UV)
|
843
|
+
# of a UV tile.
|
844
|
+
#
|
845
|
+
# The UV tile bounds the given reference point on the plane of the face. If the
|
846
|
+
# reference isn't on the plane of the face it will be projected onto it.
|
847
|
+
#
|
848
|
+
# The world coordinates are on the plane of the face unless the texture is
|
849
|
+
# projected. When the texture is projected the the world points are on an
|
850
|
+
# arbitrary plane that is perpendicular to the projection direction.
|
851
|
+
#
|
852
|
+
# The returned coordinates are arranged to be compatible with {#position_material}.
|
853
|
+
#
|
854
|
+
# <b>Getting the bounds of the UV tile under the cursor:</b>
|
855
|
+
#
|
856
|
+
# <i>The red quadrilateral represents the model points returned.</i>
|
857
|
+
#
|
858
|
+
# rdoc-image:../images/face-uv-tile-at.png
|
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
|
+
#
|
865
|
+
# @example Copy material from front to back
|
866
|
+
# model = Sketchup.active_model
|
867
|
+
# model.active_entities.grep(Sketchup::Face) { |face|
|
868
|
+
# material = face.material
|
869
|
+
#
|
870
|
+
# if material&.texture.nil?
|
871
|
+
# face.back_material = material
|
872
|
+
# end
|
873
|
+
#
|
874
|
+
# reference = face.vertices.first.position
|
875
|
+
# mapping = face.uv_tile_at(reference, true)
|
876
|
+
# if face.texture_projected?(true)
|
877
|
+
# projection = face.get_texture_projection(true)
|
878
|
+
# face.position_material(material, mapping, false, projection)
|
879
|
+
# else
|
880
|
+
# face.position_material(material, mapping, false)
|
881
|
+
# end
|
882
|
+
# }
|
883
|
+
#
|
884
|
+
# @example Iterate each set of world and UV coordinates
|
885
|
+
# model = Sketchup.active_model
|
886
|
+
# faces = model.active_entities.grep(Sketchup::Face)
|
887
|
+
# face = faces.find { |face| face.material&.texture }
|
888
|
+
# reference = face.vertices.first.position
|
889
|
+
# mapping = face.uv_tile_at(reference, true)
|
890
|
+
# mapping.each_slice(2) { |position, uv|
|
891
|
+
# puts "World: #{position.inspect} - UV: #{uv.inspect}"
|
892
|
+
# }
|
893
|
+
#
|
894
|
+
# @param [Geom::Point3d] position
|
895
|
+
# Model position on the face's plane that will be
|
896
|
+
# bounded by the UV tile.
|
897
|
+
#
|
898
|
+
# @param [Boolean] front
|
899
|
+
# +true+ Checks the front side of the face, +false+
|
900
|
+
# the back side.
|
901
|
+
#
|
902
|
+
# @return [Array<Geom::Point3d>, nil] A set of 8 points. Each stride of two is
|
903
|
+
# first a model space point, the second a UV
|
904
|
+
# coordinate. +nil+ if the face doesn't have
|
905
|
+
# a texture on the given side.
|
906
|
+
#
|
907
|
+
# @see #position_material
|
908
|
+
#
|
909
|
+
# @version SketchUp 2021.1
|
910
|
+
def uv_tile_at(position, front)
|
911
|
+
end
|
912
|
+
|
913
|
+
# The vertices method is used to get an array of all of the vertices that
|
914
|
+
# bound the face.
|
915
|
+
#
|
916
|
+
# @example
|
917
|
+
# depth = 100
|
918
|
+
# width = 100
|
919
|
+
# model = Sketchup.active_model
|
920
|
+
# entities = model.active_entities
|
921
|
+
# pts = []
|
922
|
+
# pts[0] = [0, 0, 0]
|
923
|
+
# pts[1] = [width, 0, 0]
|
924
|
+
# pts[2] = [width, depth, 0]
|
925
|
+
# pts[3] = [0, depth, 0]
|
926
|
+
#
|
927
|
+
# # Add the face to the entities in the model
|
928
|
+
# face = entities.add_face(pts)
|
929
|
+
# vertices = face.vertices
|
930
|
+
#
|
931
|
+
# @return [Array<Sketchup::Vertex>] an array of Vertex objects if successful
|
932
|
+
#
|
933
|
+
# @version SketchUp 6.0
|
934
|
+
def vertices
|
935
|
+
end
|
936
|
+
|
937
|
+
end
|