sketchup-api-stubs 0.6.1 → 0.7.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.yardopts +2 -0
- data/lib/sketchup-api-stubs.rb +1 -1
- data/lib/sketchup-api-stubs/sketchup.rb +145 -145
- data/lib/sketchup-api-stubs/stubs/Geom/BoundingBox.rb +318 -318
- data/lib/sketchup-api-stubs/stubs/Geom/Bounds2d.rb +172 -172
- data/lib/sketchup-api-stubs/stubs/Geom/LatLong.rb +126 -126
- data/lib/sketchup-api-stubs/stubs/Geom/OrientedBounds2d.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Geom/Point2d.rb +400 -401
- data/lib/sketchup-api-stubs/stubs/Geom/Point3d.rb +661 -661
- data/lib/sketchup-api-stubs/stubs/Geom/PolygonMesh.rb +492 -492
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation.rb +478 -478
- data/lib/sketchup-api-stubs/stubs/Geom/Transformation2d.rb +263 -263
- data/lib/sketchup-api-stubs/stubs/Geom/UTM.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Geom/Vector2d.rb +522 -523
- data/lib/sketchup-api-stubs/stubs/Geom/Vector3d.rb +691 -691
- data/lib/sketchup-api-stubs/stubs/Layout.rb +25 -25
- data/lib/sketchup-api-stubs/stubs/Layout/AngularDimension.rb +573 -569
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinition.rb +411 -411
- data/lib/sketchup-api-stubs/stubs/Layout/AutoTextDefinitions.rb +174 -186
- data/lib/sketchup-api-stubs/stubs/Layout/ConnectionPoint.rb +70 -70
- data/lib/sketchup-api-stubs/stubs/Layout/Document.rb +514 -455
- data/lib/sketchup-api-stubs/stubs/Layout/Ellipse.rb +29 -29
- data/lib/sketchup-api-stubs/stubs/Layout/Entities.rb +143 -155
- data/lib/sketchup-api-stubs/stubs/Layout/Entity.rb +353 -359
- data/lib/sketchup-api-stubs/stubs/Layout/FormattedText.rb +349 -349
- data/lib/sketchup-api-stubs/stubs/Layout/Grid.rb +311 -123
- data/lib/sketchup-api-stubs/stubs/Layout/Group.rb +261 -261
- data/lib/sketchup-api-stubs/stubs/Layout/Image.rb +91 -86
- data/lib/sketchup-api-stubs/stubs/Layout/Label.rb +371 -371
- data/lib/sketchup-api-stubs/stubs/Layout/Layer.rb +218 -218
- data/lib/sketchup-api-stubs/stubs/Layout/LayerInstance.rb +128 -128
- data/lib/sketchup-api-stubs/stubs/Layout/Layers.rb +220 -232
- data/lib/sketchup-api-stubs/stubs/Layout/LinearDimension.rb +567 -563
- 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 +204 -216
- data/lib/sketchup-api-stubs/stubs/Layout/Path.rb +344 -344
- data/lib/sketchup-api-stubs/stubs/Layout/Rectangle.rb +174 -174
- data/lib/sketchup-api-stubs/stubs/Layout/SketchUpModel.rb +694 -547
- data/lib/sketchup-api-stubs/stubs/Layout/Style.rb +1519 -1519
- data/lib/sketchup-api-stubs/stubs/Layout/Table.rb +290 -290
- data/lib/sketchup-api-stubs/stubs/Layout/TableCell.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Layout/TableColumn.rb +139 -139
- data/lib/sketchup-api-stubs/stubs/Layout/TableRow.rb +135 -135
- data/lib/sketchup-api-stubs/stubs/Sketchup/Animation.rb +140 -140
- data/lib/sketchup-api-stubs/stubs/Sketchup/AppObserver.rb +157 -157
- data/lib/sketchup-api-stubs/stubs/Sketchup/ArcCurve.rb +209 -209
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionaries.rb +152 -152
- data/lib/sketchup-api-stubs/stubs/Sketchup/AttributeDictionary.rb +281 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/Axes.rb +149 -149
- data/lib/sketchup-api-stubs/stubs/Sketchup/Behavior.rb +328 -328
- data/lib/sketchup-api-stubs/stubs/Sketchup/Camera.rb +577 -577
- data/lib/sketchup-api-stubs/stubs/Sketchup/ClassificationSchema.rb +63 -63
- data/lib/sketchup-api-stubs/stubs/Sketchup/Classifications.rb +122 -122
- data/lib/sketchup-api-stubs/stubs/Sketchup/Color.rb +281 -281
- data/lib/sketchup-api-stubs/stubs/Sketchup/ComponentDefinition.rb +562 -554
- 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 +194 -194
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionList.rb +329 -329
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionObserver.rb +72 -72
- data/lib/sketchup-api-stubs/stubs/Sketchup/DefinitionsObserver.rb +102 -102
- data/lib/sketchup-api-stubs/stubs/Sketchup/Dimension.rb +165 -165
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionLinear.rb +312 -312
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionObserver.rb +38 -38
- data/lib/sketchup-api-stubs/stubs/Sketchup/DimensionRadial.rb +87 -87
- data/lib/sketchup-api-stubs/stubs/Sketchup/Drawingelement.rb +390 -390
- data/lib/sketchup-api-stubs/stubs/Sketchup/Edge.rb +508 -508
- data/lib/sketchup-api-stubs/stubs/Sketchup/EdgeUse.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entities.rb +1119 -1097
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntitiesObserver.rb +125 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Entity.rb +544 -537
- data/lib/sketchup-api-stubs/stubs/Sketchup/EntityObserver.rb +59 -59
- data/lib/sketchup-api-stubs/stubs/Sketchup/ExtensionsManager.rb +125 -125
- data/lib/sketchup-api-stubs/stubs/Sketchup/Face.rb +750 -750
- data/lib/sketchup-api-stubs/stubs/Sketchup/FrameChangeObserver.rb +104 -104
- data/lib/sketchup-api-stubs/stubs/Sketchup/Group.rb +697 -697
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http.rb +27 -27
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Request.rb +285 -285
- data/lib/sketchup-api-stubs/stubs/Sketchup/Http/Response.rb +62 -62
- data/lib/sketchup-api-stubs/stubs/Sketchup/Image.rb +409 -409
- data/lib/sketchup-api-stubs/stubs/Sketchup/ImageRep.rb +226 -226
- data/lib/sketchup-api-stubs/stubs/Sketchup/Importer.rb +190 -190
- data/lib/sketchup-api-stubs/stubs/Sketchup/InputPoint.rb +393 -393
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstanceObserver.rb +82 -82
- data/lib/sketchup-api-stubs/stubs/Sketchup/InstancePath.rb +303 -303
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layer.rb +285 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Layers.rb +244 -231
- data/lib/sketchup-api-stubs/stubs/Sketchup/LayersObserver.rb +136 -136
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing.rb +48 -48
- data/lib/sketchup-api-stubs/stubs/Sketchup/Licensing/ExtensionLicense.rb +86 -86
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyle.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/Sketchup/LineStyles.rb +112 -123
- data/lib/sketchup-api-stubs/stubs/Sketchup/Loop.rb +137 -137
- data/lib/sketchup-api-stubs/stubs/Sketchup/Material.rb +416 -416
- data/lib/sketchup-api-stubs/stubs/Sketchup/Materials.rb +311 -311
- data/lib/sketchup-api-stubs/stubs/Sketchup/MaterialsObserver.rb +141 -141
- data/lib/sketchup-api-stubs/stubs/Sketchup/Menu.rb +95 -95
- data/lib/sketchup-api-stubs/stubs/Sketchup/Model.rb +1638 -1483
- data/lib/sketchup-api-stubs/stubs/Sketchup/ModelObserver.rb +356 -356
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsManager.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProvider.rb +284 -282
- data/lib/sketchup-api-stubs/stubs/Sketchup/OptionsProviderObserver.rb +58 -58
- data/lib/sketchup-api-stubs/stubs/Sketchup/Page.rb +770 -650
- data/lib/sketchup-api-stubs/stubs/Sketchup/Pages.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/Sketchup/PagesObserver.rb +76 -76
- data/lib/sketchup-api-stubs/stubs/Sketchup/PickHelper.rb +456 -456
- data/lib/sketchup-api-stubs/stubs/Sketchup/RegionalSettings.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptions.rb +364 -356
- data/lib/sketchup-api-stubs/stubs/Sketchup/RenderingOptionsObserver.rb +44 -44
- data/lib/sketchup-api-stubs/stubs/Sketchup/SectionPlane.rb +150 -150
- data/lib/sketchup-api-stubs/stubs/Sketchup/Selection.rb +454 -454
- data/lib/sketchup-api-stubs/stubs/Sketchup/SelectionObserver.rb +115 -115
- data/lib/sketchup-api-stubs/stubs/Sketchup/Set.rb +212 -212
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfo.rb +257 -257
- data/lib/sketchup-api-stubs/stubs/Sketchup/ShadowInfoObserver.rb +57 -57
- data/lib/sketchup-api-stubs/stubs/Sketchup/Style.rb +69 -69
- data/lib/sketchup-api-stubs/stubs/Sketchup/Styles.rb +211 -211
- data/lib/sketchup-api-stubs/stubs/Sketchup/Text.rb +262 -262
- data/lib/sketchup-api-stubs/stubs/Sketchup/Texture.rb +225 -225
- data/lib/sketchup-api-stubs/stubs/Sketchup/TextureWriter.rb +237 -237
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tool.rb +829 -829
- data/lib/sketchup-api-stubs/stubs/Sketchup/Tools.rb +132 -132
- data/lib/sketchup-api-stubs/stubs/Sketchup/ToolsObserver.rb +154 -154
- data/lib/sketchup-api-stubs/stubs/Sketchup/UVHelper.rb +61 -61
- data/lib/sketchup-api-stubs/stubs/Sketchup/Vertex.rb +142 -142
- data/lib/sketchup-api-stubs/stubs/Sketchup/View.rb +1301 -995
- data/lib/sketchup-api-stubs/stubs/Sketchup/ViewObserver.rb +43 -43
- data/lib/sketchup-api-stubs/stubs/UI/Command.rb +310 -310
- data/lib/sketchup-api-stubs/stubs/UI/HtmlDialog.rb +356 -356
- data/lib/sketchup-api-stubs/stubs/UI/Notification.rb +229 -229
- data/lib/sketchup-api-stubs/stubs/UI/Toolbar.rb +240 -240
- data/lib/sketchup-api-stubs/stubs/UI/WebDialog.rb +633 -633
- data/lib/sketchup-api-stubs/stubs/_top_level.rb +311 -303
- data/lib/sketchup-api-stubs/stubs/array.rb +741 -741
- data/lib/sketchup-api-stubs/stubs/geom.rb +348 -233
- data/lib/sketchup-api-stubs/stubs/languagehandler.rb +92 -92
- data/lib/sketchup-api-stubs/stubs/length.rb +278 -262
- data/lib/sketchup-api-stubs/stubs/numeric.rb +249 -249
- data/lib/sketchup-api-stubs/stubs/sketchup.rb +1310 -1310
- data/lib/sketchup-api-stubs/stubs/sketchupextension.rb +353 -353
- data/lib/sketchup-api-stubs/stubs/string.rb +24 -24
- data/lib/sketchup-api-stubs/stubs/ui.rb +667 -660
- metadata +2 -16
@@ -1,59 +1,59 @@
|
|
1
|
-
# Copyright:: Copyright
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# This observer interface is implemented to react to entity events. To
|
5
|
-
# implement this observer, create a Ruby class of this type, override the
|
6
|
-
# desired methods, and add an instance of the observer to the entity of
|
7
|
-
# interests.
|
8
|
-
#
|
9
|
-
# @example
|
10
|
-
# class MyEntityObserver < Sketchup::EntityObserver
|
11
|
-
# def onEraseEntity(entity)
|
12
|
-
# puts "onEraseEntity: #{entity}"
|
13
|
-
# end
|
14
|
-
# end
|
15
|
-
#
|
16
|
-
# # Attach the observer. (Assumes there is an entity in the model.)
|
17
|
-
# Sketchup.active_model.entities[0].add_observer(MyEntityObserver.new)
|
18
|
-
#
|
19
|
-
# @note The methods of this observer fire in such a way that making changes
|
20
|
-
# to the model while inside of them is dangerous. If you experience sudden
|
21
|
-
# crashes, it could be because of this observer. A potential workaround is to
|
22
|
-
# use a {Sketchup::ToolsObserver} to watch what the user is doing instead.
|
23
|
-
#
|
24
|
-
# @version SketchUp 6.0
|
25
|
-
class Sketchup::EntityObserver
|
26
|
-
|
27
|
-
# Instance Methods
|
28
|
-
|
29
|
-
# The {#onChangeEntity} method is invoked when your entity is modified.
|
30
|
-
#
|
31
|
-
# @example
|
32
|
-
# def onChangeEntity(entity)
|
33
|
-
# puts "onChangeEntity: #{entity}"
|
34
|
-
# end
|
35
|
-
#
|
36
|
-
# @param [Sketchup::Entity] entity
|
37
|
-
#
|
38
|
-
# @return [nil]
|
39
|
-
#
|
40
|
-
# @version SketchUp 6.0
|
41
|
-
def onChangeEntity(entity)
|
42
|
-
end
|
43
|
-
|
44
|
-
# The {#onEraseEntity} method is invoked when your entity is erased.
|
45
|
-
#
|
46
|
-
# @example
|
47
|
-
# def onEraseEntity(entity)
|
48
|
-
# puts "onEraseEntity: #{entity}"
|
49
|
-
# end
|
50
|
-
#
|
51
|
-
# @param [Sketchup::Entity] entity
|
52
|
-
#
|
53
|
-
# @return [nil]
|
54
|
-
#
|
55
|
-
# @version SketchUp 6.0
|
56
|
-
def onEraseEntity(entity)
|
57
|
-
end
|
58
|
-
|
59
|
-
end
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# This observer interface is implemented to react to entity events. To
|
5
|
+
# implement this observer, create a Ruby class of this type, override the
|
6
|
+
# desired methods, and add an instance of the observer to the entity of
|
7
|
+
# interests.
|
8
|
+
#
|
9
|
+
# @example
|
10
|
+
# class MyEntityObserver < Sketchup::EntityObserver
|
11
|
+
# def onEraseEntity(entity)
|
12
|
+
# puts "onEraseEntity: #{entity}"
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
#
|
16
|
+
# # Attach the observer. (Assumes there is an entity in the model.)
|
17
|
+
# Sketchup.active_model.entities[0].add_observer(MyEntityObserver.new)
|
18
|
+
#
|
19
|
+
# @note The methods of this observer fire in such a way that making changes
|
20
|
+
# to the model while inside of them is dangerous. If you experience sudden
|
21
|
+
# crashes, it could be because of this observer. A potential workaround is to
|
22
|
+
# use a {Sketchup::ToolsObserver} to watch what the user is doing instead.
|
23
|
+
#
|
24
|
+
# @version SketchUp 6.0
|
25
|
+
class Sketchup::EntityObserver
|
26
|
+
|
27
|
+
# Instance Methods
|
28
|
+
|
29
|
+
# The {#onChangeEntity} method is invoked when your entity is modified.
|
30
|
+
#
|
31
|
+
# @example
|
32
|
+
# def onChangeEntity(entity)
|
33
|
+
# puts "onChangeEntity: #{entity}"
|
34
|
+
# end
|
35
|
+
#
|
36
|
+
# @param [Sketchup::Entity] entity
|
37
|
+
#
|
38
|
+
# @return [nil]
|
39
|
+
#
|
40
|
+
# @version SketchUp 6.0
|
41
|
+
def onChangeEntity(entity)
|
42
|
+
end
|
43
|
+
|
44
|
+
# The {#onEraseEntity} method is invoked when your entity is erased.
|
45
|
+
#
|
46
|
+
# @example
|
47
|
+
# def onEraseEntity(entity)
|
48
|
+
# puts "onEraseEntity: #{entity}"
|
49
|
+
# end
|
50
|
+
#
|
51
|
+
# @param [Sketchup::Entity] entity
|
52
|
+
#
|
53
|
+
# @return [nil]
|
54
|
+
#
|
55
|
+
# @version SketchUp 6.0
|
56
|
+
def onEraseEntity(entity)
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
@@ -1,125 +1,125 @@
|
|
1
|
-
# Copyright:: Copyright
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# The ExtensionsManager class provides a way of accessing the
|
5
|
-
# SketchupExtensions that have been registered via the
|
6
|
-
# Sketchup.register_extension method.
|
7
|
-
#
|
8
|
-
# There is only one ExtensionsManager available. You access it via the
|
9
|
-
# Sketchup.extensions method.
|
10
|
-
#
|
11
|
-
# @version SketchUp 8.0 M2
|
12
|
-
class Sketchup::ExtensionsManager
|
13
|
-
|
14
|
-
# Includes
|
15
|
-
|
16
|
-
include Enumerable
|
17
|
-
|
18
|
-
# Instance Methods
|
19
|
-
|
20
|
-
# The [] method is used to get an extension by name, index or ID.
|
21
|
-
#
|
22
|
-
# @example
|
23
|
-
# manager = Sketchup.extensions
|
24
|
-
# extension = manager[0]
|
25
|
-
# if (extension)
|
26
|
-
# UI.messagebox extension.name
|
27
|
-
# else
|
28
|
-
# UI.messagebox "Failure"
|
29
|
-
# end
|
30
|
-
#
|
31
|
-
# # You can also get extensions by name.
|
32
|
-
# solarnorth = manager['Solar North Toolbar']
|
33
|
-
#
|
34
|
-
# # You can also get extensions by ID.
|
35
|
-
# my_extension = manager['2475A758-6503-46D5-AC5E-16AEA0A3162A']
|
36
|
-
#
|
37
|
-
# @param index_or_name
|
38
|
-
# The index, name or ID of the SketchupExtension object.
|
39
|
-
#
|
40
|
-
# @return extension - an SketchupExtension object if
|
41
|
-
# successful, otherwise nil.
|
42
|
-
#
|
43
|
-
# @version SketchUp 8.0 M2
|
44
|
-
def [](index_or_name)
|
45
|
-
end
|
46
|
-
|
47
|
-
#
|
48
|
-
# @example
|
49
|
-
# manager = Sketchup.extensions
|
50
|
-
# number = manager.count
|
51
|
-
#
|
52
|
-
# @note Since SketchUp 2014 the count method is inherited from Ruby's
|
53
|
-
# +Enumable+ mix-in module. Prior to that the {#count} method is an alias
|
54
|
-
# for {#length}.
|
55
|
-
#
|
56
|
-
# @return [Integer]
|
57
|
-
#
|
58
|
-
# @see #length
|
59
|
-
#
|
60
|
-
# @version SketchUp 8.0 M2
|
61
|
-
def count
|
62
|
-
end
|
63
|
-
|
64
|
-
# The each method is used to iterate through extensions.
|
65
|
-
#
|
66
|
-
# @example
|
67
|
-
# manager = Sketchup.extensions
|
68
|
-
# # Retrieves each extension
|
69
|
-
# manager.each { |extension| UI.messagebox extension.name }
|
70
|
-
#
|
71
|
-
# @return nil
|
72
|
-
#
|
73
|
-
# @version SketchUp 8.0 M2
|
74
|
-
#
|
75
|
-
# @yield [extension] A variable that will hold each SketchupExtension object
|
76
|
-
# as they are found.
|
77
|
-
def each
|
78
|
-
end
|
79
|
-
|
80
|
-
# The keys method is used to get a list of keys in the ExtensionsManager,
|
81
|
-
# which are the same as the names of the extensions.
|
82
|
-
#
|
83
|
-
# @example
|
84
|
-
# manager = Sketchup.extensions
|
85
|
-
# keys = manager.keys
|
86
|
-
# for key in keys
|
87
|
-
# UI.messagebox('The next extension is named: ' + key)
|
88
|
-
# end
|
89
|
-
#
|
90
|
-
# @return keys - Array of string keys
|
91
|
-
#
|
92
|
-
# @version SketchUp 8.0 M2
|
93
|
-
def keys
|
94
|
-
end
|
95
|
-
|
96
|
-
# The {#length} method returns the number of {SketchupExtension} objects inside
|
97
|
-
# this ExtensionsManager.
|
98
|
-
#
|
99
|
-
# @example
|
100
|
-
# manager = Sketchup.extensions
|
101
|
-
# number = manager.length
|
102
|
-
#
|
103
|
-
# @return [Integer]
|
104
|
-
#
|
105
|
-
# @see #size
|
106
|
-
#
|
107
|
-
# @version SketchUp 8.0 M2
|
108
|
-
def length
|
109
|
-
end
|
110
|
-
|
111
|
-
# The {#size} method is an alias of {#length}.
|
112
|
-
#
|
113
|
-
# @example
|
114
|
-
# manager = Sketchup.extensions
|
115
|
-
# number = manager.size
|
116
|
-
#
|
117
|
-
# @return [Integer]
|
118
|
-
#
|
119
|
-
# @see #length
|
120
|
-
#
|
121
|
-
# @version SketchUp 8.0 M2
|
122
|
-
def size
|
123
|
-
end
|
124
|
-
|
125
|
-
end
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The ExtensionsManager class provides a way of accessing the
|
5
|
+
# SketchupExtensions that have been registered via the
|
6
|
+
# Sketchup.register_extension method.
|
7
|
+
#
|
8
|
+
# There is only one ExtensionsManager available. You access it via the
|
9
|
+
# Sketchup.extensions method.
|
10
|
+
#
|
11
|
+
# @version SketchUp 8.0 M2
|
12
|
+
class Sketchup::ExtensionsManager
|
13
|
+
|
14
|
+
# Includes
|
15
|
+
|
16
|
+
include Enumerable
|
17
|
+
|
18
|
+
# Instance Methods
|
19
|
+
|
20
|
+
# The [] method is used to get an extension by name, index or ID.
|
21
|
+
#
|
22
|
+
# @example
|
23
|
+
# manager = Sketchup.extensions
|
24
|
+
# extension = manager[0]
|
25
|
+
# if (extension)
|
26
|
+
# UI.messagebox extension.name
|
27
|
+
# else
|
28
|
+
# UI.messagebox "Failure"
|
29
|
+
# end
|
30
|
+
#
|
31
|
+
# # You can also get extensions by name.
|
32
|
+
# solarnorth = manager['Solar North Toolbar']
|
33
|
+
#
|
34
|
+
# # You can also get extensions by ID.
|
35
|
+
# my_extension = manager['2475A758-6503-46D5-AC5E-16AEA0A3162A']
|
36
|
+
#
|
37
|
+
# @param index_or_name
|
38
|
+
# The index, name or ID of the SketchupExtension object.
|
39
|
+
#
|
40
|
+
# @return extension - an SketchupExtension object if
|
41
|
+
# successful, otherwise nil.
|
42
|
+
#
|
43
|
+
# @version SketchUp 8.0 M2
|
44
|
+
def [](index_or_name)
|
45
|
+
end
|
46
|
+
|
47
|
+
#
|
48
|
+
# @example
|
49
|
+
# manager = Sketchup.extensions
|
50
|
+
# number = manager.count
|
51
|
+
#
|
52
|
+
# @note Since SketchUp 2014 the count method is inherited from Ruby's
|
53
|
+
# +Enumable+ mix-in module. Prior to that the {#count} method is an alias
|
54
|
+
# for {#length}.
|
55
|
+
#
|
56
|
+
# @return [Integer]
|
57
|
+
#
|
58
|
+
# @see #length
|
59
|
+
#
|
60
|
+
# @version SketchUp 8.0 M2
|
61
|
+
def count
|
62
|
+
end
|
63
|
+
|
64
|
+
# The each method is used to iterate through extensions.
|
65
|
+
#
|
66
|
+
# @example
|
67
|
+
# manager = Sketchup.extensions
|
68
|
+
# # Retrieves each extension
|
69
|
+
# manager.each { |extension| UI.messagebox extension.name }
|
70
|
+
#
|
71
|
+
# @return nil
|
72
|
+
#
|
73
|
+
# @version SketchUp 8.0 M2
|
74
|
+
#
|
75
|
+
# @yield [extension] A variable that will hold each SketchupExtension object
|
76
|
+
# as they are found.
|
77
|
+
def each
|
78
|
+
end
|
79
|
+
|
80
|
+
# The keys method is used to get a list of keys in the ExtensionsManager,
|
81
|
+
# which are the same as the names of the extensions.
|
82
|
+
#
|
83
|
+
# @example
|
84
|
+
# manager = Sketchup.extensions
|
85
|
+
# keys = manager.keys
|
86
|
+
# for key in keys
|
87
|
+
# UI.messagebox('The next extension is named: ' + key)
|
88
|
+
# end
|
89
|
+
#
|
90
|
+
# @return keys - Array of string keys
|
91
|
+
#
|
92
|
+
# @version SketchUp 8.0 M2
|
93
|
+
def keys
|
94
|
+
end
|
95
|
+
|
96
|
+
# The {#length} method returns the number of {SketchupExtension} objects inside
|
97
|
+
# this ExtensionsManager.
|
98
|
+
#
|
99
|
+
# @example
|
100
|
+
# manager = Sketchup.extensions
|
101
|
+
# number = manager.length
|
102
|
+
#
|
103
|
+
# @return [Integer]
|
104
|
+
#
|
105
|
+
# @see #size
|
106
|
+
#
|
107
|
+
# @version SketchUp 8.0 M2
|
108
|
+
def length
|
109
|
+
end
|
110
|
+
|
111
|
+
# The {#size} method is an alias of {#length}.
|
112
|
+
#
|
113
|
+
# @example
|
114
|
+
# manager = Sketchup.extensions
|
115
|
+
# number = manager.size
|
116
|
+
#
|
117
|
+
# @return [Integer]
|
118
|
+
#
|
119
|
+
# @see #length
|
120
|
+
#
|
121
|
+
# @version SketchUp 8.0 M2
|
122
|
+
def size
|
123
|
+
end
|
124
|
+
|
125
|
+
end
|
@@ -1,750 +1,750 @@
|
|
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 in current units.
|
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 current units (if successful)
|
70
|
-
#
|
71
|
-
# @overload area(transform)
|
72
|
-
#
|
73
|
-
# @param transform [Geom::Transformation] A Transformation object or array
|
74
|
-
# that can be interpreted as a Transformation object.
|
75
|
-
# @return [Float] the area of the face in current units (if successful)
|
76
|
-
#
|
77
|
-
# @version SketchUp 6.0
|
78
|
-
def area(*args)
|
79
|
-
end
|
80
|
-
|
81
|
-
# The back_material method is used to retrieve the material assigned to the
|
82
|
-
# back side of the face.
|
83
|
-
#
|
84
|
-
# @example
|
85
|
-
# depth = 100
|
86
|
-
# width = 100
|
87
|
-
# model = Sketchup.active_model
|
88
|
-
# entities = model.active_entities
|
89
|
-
# pts = []
|
90
|
-
# pts[0] = [0, 0, 0]
|
91
|
-
# pts[1] = [width, 0, 0]
|
92
|
-
# pts[2] = [width, depth, 0]
|
93
|
-
# pts[3] = [0, depth, 0]
|
94
|
-
#
|
95
|
-
# # Add the face to the entities in the model
|
96
|
-
# face = entities.add_face(pts)
|
97
|
-
#
|
98
|
-
# # Add a material to the back face, then check to see that it was added
|
99
|
-
# face.back_material = "red"
|
100
|
-
# material = face.back_material
|
101
|
-
#
|
102
|
-
# @return [Sketchup::Material, nil] a Material object representing the material
|
103
|
-
# on the back of the face (if successful)
|
104
|
-
#
|
105
|
-
# @version SketchUp 6.0
|
106
|
-
def back_material
|
107
|
-
end
|
108
|
-
|
109
|
-
# The back_material= method is used to set the material assigned to the back
|
110
|
-
# side of the face.
|
111
|
-
#
|
112
|
-
# @example
|
113
|
-
# depth = 100
|
114
|
-
# width = 100
|
115
|
-
# model = Sketchup.active_model
|
116
|
-
# entities = model.active_entities
|
117
|
-
# pts = []
|
118
|
-
# pts[0] = [0, 0, 0]
|
119
|
-
# pts[1] = [width, 0, 0]
|
120
|
-
# pts[2] = [width, depth, 0]
|
121
|
-
# pts[3] = [0, depth, 0]
|
122
|
-
# # Add the face to the entities in the model
|
123
|
-
# face = entities.add_face(pts)
|
124
|
-
# status = face.back_material = "red"
|
125
|
-
#
|
126
|
-
# @param [Sketchup::Material] material
|
127
|
-
# A Material object or the name of a valid material.
|
128
|
-
#
|
129
|
-
# @return [Sketchup::Material] the name of the valid material or the new
|
130
|
-
# Material object (if successful)
|
131
|
-
#
|
132
|
-
# @version SketchUp 6.0
|
133
|
-
def back_material=(material)
|
134
|
-
end
|
135
|
-
|
136
|
-
# The classify_point method is used to determine if a given Point3d is on the
|
137
|
-
# referenced Face.
|
138
|
-
#
|
139
|
-
# It is important that return value comparisons be made against the
|
140
|
-
# symbolic constants (i.e. {Sketchup::Face::PointUnknown},
|
141
|
-
# {Sketchup::Face::PointInside}, {Sketchup::Face::PointOnVertex}, etc.) rather
|
142
|
-
# than the absolute integer values as these values may change from one
|
143
|
-
# release to the next.
|
144
|
-
#
|
145
|
-
# @example
|
146
|
-
# model = Sketchup.active_model
|
147
|
-
# entities = model.active_entities
|
148
|
-
# pts = []
|
149
|
-
# pts[0] = [0, 0, 0]
|
150
|
-
# pts[1] = [9, 0, 0]
|
151
|
-
# pts[2] = [9, 9, 0]
|
152
|
-
# pts[3] = [0, 9, 0]
|
153
|
-
#
|
154
|
-
# # Add the face to the entities in the model
|
155
|
-
# face = entities.add_face(pts)
|
156
|
-
#
|
157
|
-
# # Check a point that should be outside the face.
|
158
|
-
# pt = Geom::Point3d.new(50, 50, 0)
|
159
|
-
# result = face.classify_point(pt)
|
160
|
-
# if result == Sketchup::Face::PointOutside
|
161
|
-
# puts "#{pt.to_s} is outside the face"
|
162
|
-
# end
|
163
|
-
#
|
164
|
-
# # Check a point that should be outside inside the face.
|
165
|
-
# pt = Geom::Point3d.new(1, 1, 0)
|
166
|
-
# result = face.classify_point(pt)
|
167
|
-
# if result == Sketchup::Face::PointInside
|
168
|
-
# puts "#{pt.to_s} is inside the face"
|
169
|
-
# end
|
170
|
-
#
|
171
|
-
# # Check a point that should be on the vertex of the face.
|
172
|
-
# pt = Geom::Point3d.new(0, 0, 0)
|
173
|
-
# result = face.classify_point(pt)
|
174
|
-
# if result == Sketchup::Face::PointOnVertex
|
175
|
-
# puts "#{pt.to_s} is on a vertex"
|
176
|
-
# end
|
177
|
-
#
|
178
|
-
# # Check a point that should be on the edge of the face.
|
179
|
-
# pt = Geom::Point3d.new(0, 1, 0)
|
180
|
-
# result = face.classify_point(pt)
|
181
|
-
# if result == Sketchup::Face::PointOnEdge
|
182
|
-
# puts "#{pt.to_s} is on an edge of the face"
|
183
|
-
# end
|
184
|
-
#
|
185
|
-
# # Check a point that should be off the plane of the face.
|
186
|
-
# pt = Geom::Point3d.new(1, 1, 10)
|
187
|
-
# result = face.classify_point(pt)
|
188
|
-
# if result == Sketchup::Face::PointNotOnPlane
|
189
|
-
# puts "#{pt.to_s} is not on the same plane as the face"
|
190
|
-
# end
|
191
|
-
#
|
192
|
-
# @param [Geom::Point3d] point
|
193
|
-
# A Point3d.
|
194
|
-
#
|
195
|
-
# @return [Integer] an integer describing where a Point3d is in
|
196
|
-
# relation to the referenced Face.
|
197
|
-
#
|
198
|
-
# @version SketchUp 6.0
|
199
|
-
def classify_point(point)
|
200
|
-
end
|
201
|
-
|
202
|
-
# The edges method is used to get an array of edges that bound the face.
|
203
|
-
#
|
204
|
-
# @example
|
205
|
-
# depth = 100
|
206
|
-
# width = 100
|
207
|
-
# model = Sketchup.active_model
|
208
|
-
# entities = model.active_entities
|
209
|
-
# pts = []
|
210
|
-
# pts[0] = [0, 0, 0]
|
211
|
-
# pts[1] = [width, 0, 0]
|
212
|
-
# pts[2] = [width, depth, 0]
|
213
|
-
# pts[3] = [0, depth, 0]
|
214
|
-
# # Add the face to the entities in the model
|
215
|
-
# face = entities.add_face(pts)
|
216
|
-
# edges = face.edges
|
217
|
-
#
|
218
|
-
# @return [Array<Sketchup::Edge>] an array of Edge objects (if successful)
|
219
|
-
#
|
220
|
-
# @version SketchUp 6.0
|
221
|
-
def edges
|
222
|
-
end
|
223
|
-
|
224
|
-
# The {#followme} method is used to create a shape by making the face follow
|
225
|
-
# along an array of edges.
|
226
|
-
#
|
227
|
-
# @example
|
228
|
-
# model = Sketchup.active_model
|
229
|
-
# entities = model.active_entities
|
230
|
-
#
|
231
|
-
# depth = 100
|
232
|
-
# width = 100
|
233
|
-
#
|
234
|
-
# # Add the face to the entities in the model
|
235
|
-
# points = [
|
236
|
-
# Geom::Point3d.new(0, 0, 0),
|
237
|
-
# Geom::Point3d.new(width, 0, 0),
|
238
|
-
# Geom::Point3d.new(width, depth, 0),
|
239
|
-
# Geom::Point3d.new(0, depth, 0)
|
240
|
-
# ]
|
241
|
-
# face = entities.add_face(points)
|
242
|
-
#
|
243
|
-
# # Add the line which we will "follow" to the entities in the model
|
244
|
-
# point1 = Geom::Point3d.new(0, 0, 0)
|
245
|
-
# point2 = Geom::Point3d.new(0, 0, 100)
|
246
|
-
# edge = entities.add_line(point1, point2)
|
247
|
-
# face.followme(edge)
|
248
|
-
#
|
249
|
-
# @overload followme(edges)
|
250
|
-
#
|
251
|
-
# @param [Array<Sketchup::Edge>] edges An array of edge objects to follow.
|
252
|
-
# @return [Boolean]
|
253
|
-
#
|
254
|
-
# @overload followme(edge)
|
255
|
-
#
|
256
|
-
# @param [Sketchup::Edge] edge An edge to follow.
|
257
|
-
# @return [Boolean]
|
258
|
-
#
|
259
|
-
# @version SketchUp 6.0
|
260
|
-
def followme(*args)
|
261
|
-
end
|
262
|
-
|
263
|
-
# The get_UVHelper object is used to retrieve a UVHelper object for use in
|
264
|
-
# texture manipulation on a face.
|
265
|
-
#
|
266
|
-
# @example
|
267
|
-
# model = Sketchup.active_model
|
268
|
-
# entities = model.active_entities
|
269
|
-
# pts = []
|
270
|
-
# pts[0] = [0, 0, 0]
|
271
|
-
# pts[1] = [9, 0, 0]
|
272
|
-
# pts[2] = [9, 9, 0]
|
273
|
-
# pts[3] = [0, 9, 0]
|
274
|
-
#
|
275
|
-
# # Add the face to the entities in the model
|
276
|
-
# face = entities.add_face(pts)
|
277
|
-
# tw = Sketchup.create_texture_writer
|
278
|
-
# uvHelp = face.get_UVHelper(true, true, tw)
|
279
|
-
#
|
280
|
-
# @overload get_UVHelper(front = true, back = true)
|
281
|
-
#
|
282
|
-
# @param [Boolean] front
|
283
|
-
# True if you want the texture coordinates for the front
|
284
|
-
# face, false if not.
|
285
|
-
#
|
286
|
-
# @param [Boolean] back
|
287
|
-
# True if you want the texture coordinates for the back
|
288
|
-
# face, false if not.
|
289
|
-
#
|
290
|
-
# @overload get_UVHelper(front = true, back = true, texturewriter)
|
291
|
-
#
|
292
|
-
# @param [Boolean] front
|
293
|
-
# True if you want the texture coordinates for the front
|
294
|
-
# face, false if not.
|
295
|
-
#
|
296
|
-
# @param [Boolean] back
|
297
|
-
# True if you want the texture coordinates for the back
|
298
|
-
# face, false if not.
|
299
|
-
#
|
300
|
-
# @param [Sketchup::TextureWriter] texturewriter
|
301
|
-
# An optional TextureWriter object.
|
302
|
-
#
|
303
|
-
# @return [Sketchup::UVHelper]
|
304
|
-
#
|
305
|
-
# @version SketchUp 6.0
|
306
|
-
def get_UVHelper(*args)
|
307
|
-
end
|
308
|
-
|
309
|
-
# The get_glued_instances method returns an Array any ComponentInstances
|
310
|
-
# that are glued to the face.
|
311
|
-
#
|
312
|
-
# @example
|
313
|
-
# # Create a series of points that define a new face.
|
314
|
-
# model = Sketchup.active_model
|
315
|
-
# entities = model.active_entities
|
316
|
-
# pts = []
|
317
|
-
# pts[0] = [0, 0, 0]
|
318
|
-
# pts[1] = [9, 0, 0]
|
319
|
-
# pts[2] = [9, 9, 0]
|
320
|
-
# pts[3] = [0, 9, 0]
|
321
|
-
#
|
322
|
-
# # Add the face to the entities in the model
|
323
|
-
# face = entities.add_face(pts)
|
324
|
-
# glued_array = face.get_glued_instances
|
325
|
-
#
|
326
|
-
# @return [Array<Sketchup::ComponentInstance, Sketchup::Group, Sketchup::Image>] An array of ComponentInstance objects that
|
327
|
-
# are currently glued to the face.
|
328
|
-
#
|
329
|
-
# @version SketchUp 7.0 M1
|
330
|
-
def get_glued_instances
|
331
|
-
end
|
332
|
-
|
333
|
-
# The get_texture_projection method will return a vector representing the
|
334
|
-
# projection for either the front or back side of the face.
|
335
|
-
#
|
336
|
-
# @example
|
337
|
-
# model = Sketchup.active_model
|
338
|
-
# entities = model.active_entities
|
339
|
-
# materials = model.materials
|
340
|
-
#
|
341
|
-
# # Create a face and add it to the model entities
|
342
|
-
# pts = []
|
343
|
-
# pts[0] = [0, 0, 1]
|
344
|
-
# pts[1] = [10, 0, 1]
|
345
|
-
# pts[2] = [10, 10, 1]
|
346
|
-
# face = entities.add_face(pts)
|
347
|
-
#
|
348
|
-
# # Export an image to use as a texture
|
349
|
-
# path = Sketchup.temp_dir
|
350
|
-
# full_name = File.join(path, "temp_image.jpg")
|
351
|
-
# model.active_view.write_image(full_name, 500, 500, false, 0.0)
|
352
|
-
#
|
353
|
-
# # Create a material and assign the texture to it
|
354
|
-
# material = materials.add("Test Material")
|
355
|
-
# material.texture = full_name
|
356
|
-
#
|
357
|
-
# # Assign the new material to our face we created
|
358
|
-
# face.material = material
|
359
|
-
#
|
360
|
-
# # Set the projection of the applied material
|
361
|
-
# face.set_texture_projection(face.normal, true)
|
362
|
-
#
|
363
|
-
# # Get the projection of the applied material
|
364
|
-
# vector = face.get_texture_projection(true)
|
365
|
-
#
|
366
|
-
# @param [Boolean] frontside
|
367
|
-
# true for front side, false for back side.
|
368
|
-
#
|
369
|
-
# @return [Geom::Vector3d] a vector on success, nil on failure.
|
370
|
-
#
|
371
|
-
# @version SketchUp 2014
|
372
|
-
def get_texture_projection(frontside)
|
373
|
-
end
|
374
|
-
|
375
|
-
# The loops method is used to get an array of all of the loops that bound the
|
376
|
-
# face.
|
377
|
-
#
|
378
|
-
# @example
|
379
|
-
# depth = 100
|
380
|
-
# width = 100
|
381
|
-
# model = Sketchup.active_model
|
382
|
-
# entities = model.active_entities
|
383
|
-
# pts = []
|
384
|
-
# pts[0] = [0, 0, 0]
|
385
|
-
# pts[1] = [width, 0, 0]
|
386
|
-
# pts[2] = [width, depth, 0]
|
387
|
-
# pts[3] = [0, depth, 0]
|
388
|
-
#
|
389
|
-
# # Add the face to the entities in the model
|
390
|
-
# face = entities.add_face(pts)
|
391
|
-
# loops = face.loops
|
392
|
-
#
|
393
|
-
# @return [Array<Sketchup::Loop>] an array of Loop objects if successful
|
394
|
-
#
|
395
|
-
# @version SketchUp 6.0
|
396
|
-
def loops
|
397
|
-
end
|
398
|
-
|
399
|
-
# The material method is used to retrieve the material assigned to the
|
400
|
-
# front of the face. (This method is inherited from the Drawingelement
|
401
|
-
# parent class.)
|
402
|
-
#
|
403
|
-
# @example
|
404
|
-
# depth = 100
|
405
|
-
# width = 100
|
406
|
-
# model = Sketchup.active_model
|
407
|
-
# entities = model.active_entities
|
408
|
-
# pts = []
|
409
|
-
# pts[0] = [0, 0, 0]
|
410
|
-
# pts[1] = [width, 0, 0]
|
411
|
-
# pts[2] = [width, depth, 0]
|
412
|
-
# pts[3] = [0, depth, 0]
|
413
|
-
#
|
414
|
-
# # Add the face to the entities in the model
|
415
|
-
# face = entities.add_face(pts)
|
416
|
-
#
|
417
|
-
# # Add a material to the face, then check to see that it was added
|
418
|
-
# face.material = "red"
|
419
|
-
# material = face.material
|
420
|
-
#
|
421
|
-
# @return [Sketchup::Material, nil] a Material object representing the material
|
422
|
-
# on the front of the face (if successful)
|
423
|
-
#
|
424
|
-
# @version SketchUp 6.0
|
425
|
-
def material
|
426
|
-
end
|
427
|
-
|
428
|
-
# The material= method is used to set the material assigned to the front
|
429
|
-
# side of the face. (This method is inherited from the Drawingelement
|
430
|
-
# parent class.)
|
431
|
-
#
|
432
|
-
# @example
|
433
|
-
# depth = 100
|
434
|
-
# width = 100
|
435
|
-
# model = Sketchup.active_model
|
436
|
-
# entities = model.active_entities
|
437
|
-
# pts = []
|
438
|
-
# pts[0] = [0, 0, 0]
|
439
|
-
# pts[1] = [width, 0, 0]
|
440
|
-
# pts[2] = [width, depth, 0]
|
441
|
-
# pts[3] = [0, depth, 0]
|
442
|
-
# # Add the face to the entities in the model
|
443
|
-
# face = entities.add_face(pts)
|
444
|
-
# status = face.material = "red"
|
445
|
-
#
|
446
|
-
# @param [Sketchup::Material] material
|
447
|
-
# A Material object or the name of a valid material.
|
448
|
-
#
|
449
|
-
# @return [Sketchup::Material] the name of the valid material or the new
|
450
|
-
# Material object (if successful)
|
451
|
-
#
|
452
|
-
# @version SketchUp 6.0
|
453
|
-
def material=(material)
|
454
|
-
end
|
455
|
-
|
456
|
-
# The mesh method creates a polygon mesh that represents the face. See the
|
457
|
-
# {Geom::PolygonMesh} class for more information.
|
458
|
-
#
|
459
|
-
# Valid flags are:
|
460
|
-
#
|
461
|
-
# - +0+: Include PolygonMeshPoints,
|
462
|
-
# - +1+: Include PolygonMeshUVQFront,
|
463
|
-
# - +2+: Include PolygonMeshUVQBack,
|
464
|
-
# - +4+: Include PolygonMeshNormals.
|
465
|
-
#
|
466
|
-
# Use bitwise OR to combine flags. A value of +7+ will include all
|
467
|
-
# flags, for example.
|
468
|
-
#
|
469
|
-
# @example
|
470
|
-
# depth = 100
|
471
|
-
# width = 100
|
472
|
-
# model = Sketchup.active_model
|
473
|
-
# entities = model.active_entities
|
474
|
-
# pts = []
|
475
|
-
# pts[0] = [0, 0, 0]
|
476
|
-
# pts[1] = [width, 0, 0]
|
477
|
-
# pts[2] = [width, depth, 0]
|
478
|
-
# pts[3] = [0, depth, 0]
|
479
|
-
#
|
480
|
-
# # Add the face to the entities in the model
|
481
|
-
# face = entities.add_face(pts)
|
482
|
-
#
|
483
|
-
# kPoints = 0
|
484
|
-
# kUVQFront = 1
|
485
|
-
# kUVQBack = 2
|
486
|
-
# kNormals = 4
|
487
|
-
# flags = kPoints | kUVQFront | kUVQBack | kNormals # equals to 7
|
488
|
-
# mesh = face.mesh(flags)
|
489
|
-
#
|
490
|
-
# @param [Integer] flags
|
491
|
-
# One or more flags used to generate a mesh.
|
492
|
-
#
|
493
|
-
# @return [Geom::PolygonMesh]
|
494
|
-
#
|
495
|
-
# @version SketchUp 6.0
|
496
|
-
def mesh(flags = 0)
|
497
|
-
end
|
498
|
-
|
499
|
-
# The normal method is used to retrieve the 3D vector normal to the face in
|
500
|
-
# the front direction.
|
501
|
-
#
|
502
|
-
# @example
|
503
|
-
# depth = 100
|
504
|
-
# width = 100
|
505
|
-
# model = Sketchup.active_model
|
506
|
-
# entities = model.active_entities
|
507
|
-
# pts = []
|
508
|
-
# pts[0] = [0, 0, 0]
|
509
|
-
# pts[1] = [width, 0, 0]
|
510
|
-
# pts[2] = [width, depth, 0]
|
511
|
-
# pts[3] = [0, depth, 0]
|
512
|
-
#
|
513
|
-
# # Add the face to the entities in the model
|
514
|
-
# face = entities.add_face(pts)
|
515
|
-
# normal = face.normal
|
516
|
-
#
|
517
|
-
# @return [Geom::Vector3d] a Vector3d object if successful
|
518
|
-
#
|
519
|
-
# @version SketchUp 6.0
|
520
|
-
def normal
|
521
|
-
end
|
522
|
-
|
523
|
-
# This method is used to retrieve the outer loop that bounds the face.
|
524
|
-
#
|
525
|
-
# @example
|
526
|
-
# # Create a series of points that define a new face.
|
527
|
-
# model = Sketchup.active_model
|
528
|
-
# entities = model.active_entities
|
529
|
-
# pts = []
|
530
|
-
# pts[0] = [0, 0, 0]
|
531
|
-
# pts[1] = [9, 0, 0]
|
532
|
-
# pts[2] = [9, 9, 0]
|
533
|
-
# pts[3] = [0, 9, 0]
|
534
|
-
#
|
535
|
-
# # Add the face to the entities in the model
|
536
|
-
# face = entities.add_face(pts)
|
537
|
-
# loop = face.outer_loop
|
538
|
-
#
|
539
|
-
# @return [Sketchup::Loop] a Loop object representing the outer loop (if
|
540
|
-
# successful)
|
541
|
-
#
|
542
|
-
# @version SketchUp 6.0
|
543
|
-
def outer_loop
|
544
|
-
end
|
545
|
-
|
546
|
-
# The plane method is used to retrieve the plane of the face. See the Array
|
547
|
-
# class for information on how planes are stored.
|
548
|
-
#
|
549
|
-
# @example
|
550
|
-
# depth = 100
|
551
|
-
# width = 100
|
552
|
-
# model = Sketchup.active_model
|
553
|
-
# entities = model.active_entities
|
554
|
-
# pts = []
|
555
|
-
# pts[0] = [0, 0, 0]
|
556
|
-
# pts[1] = [width, 0, 0]
|
557
|
-
# pts[2] = [width, depth, 0]
|
558
|
-
# pts[3] = [0, depth, 0]
|
559
|
-
#
|
560
|
-
# # Add the face to the entities in the model
|
561
|
-
# face = entities.add_face(pts)
|
562
|
-
# plane = face.plane
|
563
|
-
#
|
564
|
-
# @return [Array(Float, Float, Float, Float)] a plane that contains the face (if successful)
|
565
|
-
#
|
566
|
-
# @version SketchUp 6.0
|
567
|
-
def plane
|
568
|
-
end
|
569
|
-
|
570
|
-
# The position_material method is used to position a material on a face.
|
571
|
-
#
|
572
|
-
# The pt_array must contain 2, 4, 6 or 8 points. The points are used in pairs
|
573
|
-
# to tell where a point in the texture image is positioned on the Face. The
|
574
|
-
# first point in each pair is a 3D point in the model. It should be a point on
|
575
|
-
# the Face. The second point in each pair of points is a 2D point that gives
|
576
|
-
# the (u,v) coordinates of a point in the image to match up with the 3D point.
|
577
|
-
#
|
578
|
-
# @example
|
579
|
-
# model = Sketchup.active_model
|
580
|
-
# entities = model.active_entities
|
581
|
-
#
|
582
|
-
# # Create a face and add it to the model entities
|
583
|
-
# pts = []
|
584
|
-
# pts[0] = [0, 0, 1]
|
585
|
-
# pts[1] = [9, 0, 1]
|
586
|
-
# pts[2] = [9, 9, 1]
|
587
|
-
# pts[3] = [0, 9, 1]
|
588
|
-
# face = entities.add_face(pts)
|
589
|
-
#
|
590
|
-
# # Export an image to use as a texture
|
591
|
-
# path = Sketchup.temp_dir
|
592
|
-
# full_name = File.join(path, "temp_image.jpg")
|
593
|
-
# model.active_view.write_image(full_name, 500, 500, false, 0.0)
|
594
|
-
#
|
595
|
-
# # Create a material and assign the texture to it
|
596
|
-
# material = model.materials.add("Test Material")
|
597
|
-
# material.texture = full_name
|
598
|
-
#
|
599
|
-
# # Assign the new material to our face we created
|
600
|
-
# face.material = material
|
601
|
-
#
|
602
|
-
# pt_array = []
|
603
|
-
# pt_array[0] = Geom::Point3d.new(3,0,0)
|
604
|
-
# pt_array[1] = Geom::Point3d.new(0,0,0)
|
605
|
-
# on_front = true
|
606
|
-
# face.position_material(material, pt_array, on_front)
|
607
|
-
#
|
608
|
-
# @param [Sketchup::Material] material
|
609
|
-
# a Material object.
|
610
|
-
#
|
611
|
-
# @param [Array<Geom::Point3d>] pt_array
|
612
|
-
# An array of Point3d objects used to position the material.
|
613
|
-
#
|
614
|
-
# @param [Boolean] o_front
|
615
|
-
# true to position the texture on the front of the Face or
|
616
|
-
# false to position it on the back of the Face.
|
617
|
-
#
|
618
|
-
# @return [Sketchup::Face, false] the face upon success, false upon failure.
|
619
|
-
#
|
620
|
-
# @version SketchUp 6.0
|
621
|
-
def position_material(material, pt_array, o_front)
|
622
|
-
end
|
623
|
-
|
624
|
-
# The pushpull method is used to perform a push/pull on a face.
|
625
|
-
#
|
626
|
-
# The distance is measured in the direction that the face normal is pointing.
|
627
|
-
#
|
628
|
-
# @example
|
629
|
-
# depth = 100
|
630
|
-
# width = 100
|
631
|
-
# model = Sketchup.active_model
|
632
|
-
# entities = model.active_entities
|
633
|
-
# pts = []
|
634
|
-
# pts[0] = [0, 0, 0]
|
635
|
-
# pts[1] = [width, 0, 0]
|
636
|
-
# pts[2] = [width, depth, 0]
|
637
|
-
# pts[3] = [0, depth, 0]
|
638
|
-
# # Add the face to the entities in the model
|
639
|
-
# face = entities.add_face(pts)
|
640
|
-
# status = face.pushpull(100, true)
|
641
|
-
#
|
642
|
-
# @param [Numeric] distance
|
643
|
-
# The distance, in current units, to push/pull the face.
|
644
|
-
#
|
645
|
-
# @param [Boolean] copy
|
646
|
-
# Create a new push/pull starting face if true (equivalent
|
647
|
-
# of pressing CTRL while in SketchUp), do not create a
|
648
|
-
# push/pull starting face if false.
|
649
|
-
#
|
650
|
-
# @return [nil]
|
651
|
-
#
|
652
|
-
# @version SketchUp 6.0
|
653
|
-
def pushpull(distance, copy = false)
|
654
|
-
end
|
655
|
-
|
656
|
-
# The reverse! method is used to reverse the face's orientation, meaning the
|
657
|
-
# front becomes the back.
|
658
|
-
#
|
659
|
-
# @example
|
660
|
-
# depth = 100
|
661
|
-
# width = 100
|
662
|
-
# model = Sketchup.active_model
|
663
|
-
# entities = model.active_entities
|
664
|
-
# pts = []
|
665
|
-
# pts[0] = [0, 0, 0]
|
666
|
-
# pts[1] = [width, 0, 0]
|
667
|
-
# pts[2] = [width, depth, 0]
|
668
|
-
# pts[3] = [0, depth, 0]
|
669
|
-
# # Add the face to the entities in the model
|
670
|
-
# face = entities.add_face(pts)
|
671
|
-
# status = face.reverse!
|
672
|
-
#
|
673
|
-
# @return [Sketchup::Face, false] the reversed Face object if successful, false if
|
674
|
-
# unsuccessful
|
675
|
-
#
|
676
|
-
# @version SketchUp 6.0
|
677
|
-
def reverse!
|
678
|
-
end
|
679
|
-
|
680
|
-
# The set_texture_projection method is used to set the texture projection
|
681
|
-
# direction.
|
682
|
-
#
|
683
|
-
# @deprecated This function never worked right. It's not possible to control
|
684
|
-
# the position and orientation of the texture.
|
685
|
-
#
|
686
|
-
# @example
|
687
|
-
# model = Sketchup.active_model
|
688
|
-
# entities = model.active_entities
|
689
|
-
# materials = model.materials
|
690
|
-
#
|
691
|
-
# # Create a face and add it to the model entities
|
692
|
-
# pts = []
|
693
|
-
# pts[0] = [0, 0, 1]
|
694
|
-
# pts[1] = [10, 0, 1]
|
695
|
-
# pts[2] = [10, 10, 1]
|
696
|
-
# face = entities.add_face(pts)
|
697
|
-
#
|
698
|
-
# # Export an image to use as a texture
|
699
|
-
# path = Sketchup.temp_dir
|
700
|
-
# full_name = File.join(path, "temp_image.jpg")
|
701
|
-
# model.active_view.write_image(full_name, 500, 500, false, 0.0)
|
702
|
-
#
|
703
|
-
# # Create a material and assign the testure to it.
|
704
|
-
# material = materials.add("Test Material")
|
705
|
-
# material.texture = full_name
|
706
|
-
#
|
707
|
-
# # Assign the new material to our face we created
|
708
|
-
# face.material = material
|
709
|
-
#
|
710
|
-
# # Returns nil if not successful, path if successful
|
711
|
-
# result = face.set_texture_projection(face.normal, true)
|
712
|
-
#
|
713
|
-
# @param [Geom::Vector3d] vector
|
714
|
-
# representing the direction of the projection. Use nil
|
715
|
-
# to remove the projection.
|
716
|
-
#
|
717
|
-
# @param [Boolean] frontside
|
718
|
-
# true for front side, false for back side.
|
719
|
-
#
|
720
|
-
# @return [Boolean] true on success
|
721
|
-
#
|
722
|
-
# @version SketchUp 2014
|
723
|
-
def set_texture_projection(vector, frontside)
|
724
|
-
end
|
725
|
-
|
726
|
-
# The vertices method is used to get an array of all of the vertices that
|
727
|
-
# bound the face.
|
728
|
-
#
|
729
|
-
# @example
|
730
|
-
# depth = 100
|
731
|
-
# width = 100
|
732
|
-
# model = Sketchup.active_model
|
733
|
-
# entities = model.active_entities
|
734
|
-
# pts = []
|
735
|
-
# pts[0] = [0, 0, 0]
|
736
|
-
# pts[1] = [width, 0, 0]
|
737
|
-
# pts[2] = [width, depth, 0]
|
738
|
-
# pts[3] = [0, depth, 0]
|
739
|
-
#
|
740
|
-
# # Add the face to the entities in the model
|
741
|
-
# face = entities.add_face(pts)
|
742
|
-
# vertices = face.vertices
|
743
|
-
#
|
744
|
-
# @return [Array<Sketchup::Vertex>] an array of Vertex objects if successful
|
745
|
-
#
|
746
|
-
# @version SketchUp 6.0
|
747
|
-
def vertices
|
748
|
-
end
|
749
|
-
|
750
|
-
end
|
1
|
+
# Copyright:: Copyright 2020 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 in current units.
|
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 current units (if successful)
|
70
|
+
#
|
71
|
+
# @overload area(transform)
|
72
|
+
#
|
73
|
+
# @param transform [Geom::Transformation] A Transformation object or array
|
74
|
+
# that can be interpreted as a Transformation object.
|
75
|
+
# @return [Float] the area of the face in current units (if successful)
|
76
|
+
#
|
77
|
+
# @version SketchUp 6.0
|
78
|
+
def area(*args)
|
79
|
+
end
|
80
|
+
|
81
|
+
# The back_material method is used to retrieve the material assigned to the
|
82
|
+
# back side of the face.
|
83
|
+
#
|
84
|
+
# @example
|
85
|
+
# depth = 100
|
86
|
+
# width = 100
|
87
|
+
# model = Sketchup.active_model
|
88
|
+
# entities = model.active_entities
|
89
|
+
# pts = []
|
90
|
+
# pts[0] = [0, 0, 0]
|
91
|
+
# pts[1] = [width, 0, 0]
|
92
|
+
# pts[2] = [width, depth, 0]
|
93
|
+
# pts[3] = [0, depth, 0]
|
94
|
+
#
|
95
|
+
# # Add the face to the entities in the model
|
96
|
+
# face = entities.add_face(pts)
|
97
|
+
#
|
98
|
+
# # Add a material to the back face, then check to see that it was added
|
99
|
+
# face.back_material = "red"
|
100
|
+
# material = face.back_material
|
101
|
+
#
|
102
|
+
# @return [Sketchup::Material, nil] a Material object representing the material
|
103
|
+
# on the back of the face (if successful)
|
104
|
+
#
|
105
|
+
# @version SketchUp 6.0
|
106
|
+
def back_material
|
107
|
+
end
|
108
|
+
|
109
|
+
# The back_material= method is used to set the material assigned to the back
|
110
|
+
# side of the face.
|
111
|
+
#
|
112
|
+
# @example
|
113
|
+
# depth = 100
|
114
|
+
# width = 100
|
115
|
+
# model = Sketchup.active_model
|
116
|
+
# entities = model.active_entities
|
117
|
+
# pts = []
|
118
|
+
# pts[0] = [0, 0, 0]
|
119
|
+
# pts[1] = [width, 0, 0]
|
120
|
+
# pts[2] = [width, depth, 0]
|
121
|
+
# pts[3] = [0, depth, 0]
|
122
|
+
# # Add the face to the entities in the model
|
123
|
+
# face = entities.add_face(pts)
|
124
|
+
# status = face.back_material = "red"
|
125
|
+
#
|
126
|
+
# @param [Sketchup::Material] material
|
127
|
+
# A Material object or the name of a valid material.
|
128
|
+
#
|
129
|
+
# @return [Sketchup::Material] the name of the valid material or the new
|
130
|
+
# Material object (if successful)
|
131
|
+
#
|
132
|
+
# @version SketchUp 6.0
|
133
|
+
def back_material=(material)
|
134
|
+
end
|
135
|
+
|
136
|
+
# The classify_point method is used to determine if a given Point3d is on the
|
137
|
+
# referenced Face.
|
138
|
+
#
|
139
|
+
# It is important that return value comparisons be made against the
|
140
|
+
# symbolic constants (i.e. {Sketchup::Face::PointUnknown},
|
141
|
+
# {Sketchup::Face::PointInside}, {Sketchup::Face::PointOnVertex}, etc.) rather
|
142
|
+
# than the absolute integer values as these values may change from one
|
143
|
+
# release to the next.
|
144
|
+
#
|
145
|
+
# @example
|
146
|
+
# model = Sketchup.active_model
|
147
|
+
# entities = model.active_entities
|
148
|
+
# pts = []
|
149
|
+
# pts[0] = [0, 0, 0]
|
150
|
+
# pts[1] = [9, 0, 0]
|
151
|
+
# pts[2] = [9, 9, 0]
|
152
|
+
# pts[3] = [0, 9, 0]
|
153
|
+
#
|
154
|
+
# # Add the face to the entities in the model
|
155
|
+
# face = entities.add_face(pts)
|
156
|
+
#
|
157
|
+
# # Check a point that should be outside the face.
|
158
|
+
# pt = Geom::Point3d.new(50, 50, 0)
|
159
|
+
# result = face.classify_point(pt)
|
160
|
+
# if result == Sketchup::Face::PointOutside
|
161
|
+
# puts "#{pt.to_s} is outside the face"
|
162
|
+
# end
|
163
|
+
#
|
164
|
+
# # Check a point that should be outside inside the face.
|
165
|
+
# pt = Geom::Point3d.new(1, 1, 0)
|
166
|
+
# result = face.classify_point(pt)
|
167
|
+
# if result == Sketchup::Face::PointInside
|
168
|
+
# puts "#{pt.to_s} is inside the face"
|
169
|
+
# end
|
170
|
+
#
|
171
|
+
# # Check a point that should be on the vertex of the face.
|
172
|
+
# pt = Geom::Point3d.new(0, 0, 0)
|
173
|
+
# result = face.classify_point(pt)
|
174
|
+
# if result == Sketchup::Face::PointOnVertex
|
175
|
+
# puts "#{pt.to_s} is on a vertex"
|
176
|
+
# end
|
177
|
+
#
|
178
|
+
# # Check a point that should be on the edge of the face.
|
179
|
+
# pt = Geom::Point3d.new(0, 1, 0)
|
180
|
+
# result = face.classify_point(pt)
|
181
|
+
# if result == Sketchup::Face::PointOnEdge
|
182
|
+
# puts "#{pt.to_s} is on an edge of the face"
|
183
|
+
# end
|
184
|
+
#
|
185
|
+
# # Check a point that should be off the plane of the face.
|
186
|
+
# pt = Geom::Point3d.new(1, 1, 10)
|
187
|
+
# result = face.classify_point(pt)
|
188
|
+
# if result == Sketchup::Face::PointNotOnPlane
|
189
|
+
# puts "#{pt.to_s} is not on the same plane as the face"
|
190
|
+
# end
|
191
|
+
#
|
192
|
+
# @param [Geom::Point3d] point
|
193
|
+
# A Point3d.
|
194
|
+
#
|
195
|
+
# @return [Integer] an integer describing where a Point3d is in
|
196
|
+
# relation to the referenced Face.
|
197
|
+
#
|
198
|
+
# @version SketchUp 6.0
|
199
|
+
def classify_point(point)
|
200
|
+
end
|
201
|
+
|
202
|
+
# The edges method is used to get an array of edges that bound the face.
|
203
|
+
#
|
204
|
+
# @example
|
205
|
+
# depth = 100
|
206
|
+
# width = 100
|
207
|
+
# model = Sketchup.active_model
|
208
|
+
# entities = model.active_entities
|
209
|
+
# pts = []
|
210
|
+
# pts[0] = [0, 0, 0]
|
211
|
+
# pts[1] = [width, 0, 0]
|
212
|
+
# pts[2] = [width, depth, 0]
|
213
|
+
# pts[3] = [0, depth, 0]
|
214
|
+
# # Add the face to the entities in the model
|
215
|
+
# face = entities.add_face(pts)
|
216
|
+
# edges = face.edges
|
217
|
+
#
|
218
|
+
# @return [Array<Sketchup::Edge>] an array of Edge objects (if successful)
|
219
|
+
#
|
220
|
+
# @version SketchUp 6.0
|
221
|
+
def edges
|
222
|
+
end
|
223
|
+
|
224
|
+
# The {#followme} method is used to create a shape by making the face follow
|
225
|
+
# along an array of edges.
|
226
|
+
#
|
227
|
+
# @example
|
228
|
+
# model = Sketchup.active_model
|
229
|
+
# entities = model.active_entities
|
230
|
+
#
|
231
|
+
# depth = 100
|
232
|
+
# width = 100
|
233
|
+
#
|
234
|
+
# # Add the face to the entities in the model
|
235
|
+
# points = [
|
236
|
+
# Geom::Point3d.new(0, 0, 0),
|
237
|
+
# Geom::Point3d.new(width, 0, 0),
|
238
|
+
# Geom::Point3d.new(width, depth, 0),
|
239
|
+
# Geom::Point3d.new(0, depth, 0)
|
240
|
+
# ]
|
241
|
+
# face = entities.add_face(points)
|
242
|
+
#
|
243
|
+
# # Add the line which we will "follow" to the entities in the model
|
244
|
+
# point1 = Geom::Point3d.new(0, 0, 0)
|
245
|
+
# point2 = Geom::Point3d.new(0, 0, 100)
|
246
|
+
# edge = entities.add_line(point1, point2)
|
247
|
+
# face.followme(edge)
|
248
|
+
#
|
249
|
+
# @overload followme(edges)
|
250
|
+
#
|
251
|
+
# @param [Array<Sketchup::Edge>] edges An array of edge objects to follow.
|
252
|
+
# @return [Boolean]
|
253
|
+
#
|
254
|
+
# @overload followme(edge)
|
255
|
+
#
|
256
|
+
# @param [Sketchup::Edge] edge An edge to follow.
|
257
|
+
# @return [Boolean]
|
258
|
+
#
|
259
|
+
# @version SketchUp 6.0
|
260
|
+
def followme(*args)
|
261
|
+
end
|
262
|
+
|
263
|
+
# The get_UVHelper object is used to retrieve a UVHelper object for use in
|
264
|
+
# texture manipulation on a face.
|
265
|
+
#
|
266
|
+
# @example
|
267
|
+
# model = Sketchup.active_model
|
268
|
+
# entities = model.active_entities
|
269
|
+
# pts = []
|
270
|
+
# pts[0] = [0, 0, 0]
|
271
|
+
# pts[1] = [9, 0, 0]
|
272
|
+
# pts[2] = [9, 9, 0]
|
273
|
+
# pts[3] = [0, 9, 0]
|
274
|
+
#
|
275
|
+
# # Add the face to the entities in the model
|
276
|
+
# face = entities.add_face(pts)
|
277
|
+
# tw = Sketchup.create_texture_writer
|
278
|
+
# uvHelp = face.get_UVHelper(true, true, tw)
|
279
|
+
#
|
280
|
+
# @overload get_UVHelper(front = true, back = true)
|
281
|
+
#
|
282
|
+
# @param [Boolean] front
|
283
|
+
# True if you want the texture coordinates for the front
|
284
|
+
# face, false if not.
|
285
|
+
#
|
286
|
+
# @param [Boolean] back
|
287
|
+
# True if you want the texture coordinates for the back
|
288
|
+
# face, false if not.
|
289
|
+
#
|
290
|
+
# @overload get_UVHelper(front = true, back = true, texturewriter)
|
291
|
+
#
|
292
|
+
# @param [Boolean] front
|
293
|
+
# True if you want the texture coordinates for the front
|
294
|
+
# face, false if not.
|
295
|
+
#
|
296
|
+
# @param [Boolean] back
|
297
|
+
# True if you want the texture coordinates for the back
|
298
|
+
# face, false if not.
|
299
|
+
#
|
300
|
+
# @param [Sketchup::TextureWriter] texturewriter
|
301
|
+
# An optional TextureWriter object.
|
302
|
+
#
|
303
|
+
# @return [Sketchup::UVHelper]
|
304
|
+
#
|
305
|
+
# @version SketchUp 6.0
|
306
|
+
def get_UVHelper(*args)
|
307
|
+
end
|
308
|
+
|
309
|
+
# The get_glued_instances method returns an Array any ComponentInstances
|
310
|
+
# that are glued to the face.
|
311
|
+
#
|
312
|
+
# @example
|
313
|
+
# # Create a series of points that define a new face.
|
314
|
+
# model = Sketchup.active_model
|
315
|
+
# entities = model.active_entities
|
316
|
+
# pts = []
|
317
|
+
# pts[0] = [0, 0, 0]
|
318
|
+
# pts[1] = [9, 0, 0]
|
319
|
+
# pts[2] = [9, 9, 0]
|
320
|
+
# pts[3] = [0, 9, 0]
|
321
|
+
#
|
322
|
+
# # Add the face to the entities in the model
|
323
|
+
# face = entities.add_face(pts)
|
324
|
+
# glued_array = face.get_glued_instances
|
325
|
+
#
|
326
|
+
# @return [Array<Sketchup::ComponentInstance, Sketchup::Group, Sketchup::Image>] An array of ComponentInstance objects that
|
327
|
+
# are currently glued to the face.
|
328
|
+
#
|
329
|
+
# @version SketchUp 7.0 M1
|
330
|
+
def get_glued_instances
|
331
|
+
end
|
332
|
+
|
333
|
+
# The get_texture_projection method will return a vector representing the
|
334
|
+
# projection for either the front or back side of the face.
|
335
|
+
#
|
336
|
+
# @example
|
337
|
+
# model = Sketchup.active_model
|
338
|
+
# entities = model.active_entities
|
339
|
+
# materials = model.materials
|
340
|
+
#
|
341
|
+
# # Create a face and add it to the model entities
|
342
|
+
# pts = []
|
343
|
+
# pts[0] = [0, 0, 1]
|
344
|
+
# pts[1] = [10, 0, 1]
|
345
|
+
# pts[2] = [10, 10, 1]
|
346
|
+
# face = entities.add_face(pts)
|
347
|
+
#
|
348
|
+
# # Export an image to use as a texture
|
349
|
+
# path = Sketchup.temp_dir
|
350
|
+
# full_name = File.join(path, "temp_image.jpg")
|
351
|
+
# model.active_view.write_image(full_name, 500, 500, false, 0.0)
|
352
|
+
#
|
353
|
+
# # Create a material and assign the texture to it
|
354
|
+
# material = materials.add("Test Material")
|
355
|
+
# material.texture = full_name
|
356
|
+
#
|
357
|
+
# # Assign the new material to our face we created
|
358
|
+
# face.material = material
|
359
|
+
#
|
360
|
+
# # Set the projection of the applied material
|
361
|
+
# face.set_texture_projection(face.normal, true)
|
362
|
+
#
|
363
|
+
# # Get the projection of the applied material
|
364
|
+
# vector = face.get_texture_projection(true)
|
365
|
+
#
|
366
|
+
# @param [Boolean] frontside
|
367
|
+
# true for front side, false for back side.
|
368
|
+
#
|
369
|
+
# @return [Geom::Vector3d] a vector on success, nil on failure.
|
370
|
+
#
|
371
|
+
# @version SketchUp 2014
|
372
|
+
def get_texture_projection(frontside)
|
373
|
+
end
|
374
|
+
|
375
|
+
# The loops method is used to get an array of all of the loops that bound the
|
376
|
+
# face.
|
377
|
+
#
|
378
|
+
# @example
|
379
|
+
# depth = 100
|
380
|
+
# width = 100
|
381
|
+
# model = Sketchup.active_model
|
382
|
+
# entities = model.active_entities
|
383
|
+
# pts = []
|
384
|
+
# pts[0] = [0, 0, 0]
|
385
|
+
# pts[1] = [width, 0, 0]
|
386
|
+
# pts[2] = [width, depth, 0]
|
387
|
+
# pts[3] = [0, depth, 0]
|
388
|
+
#
|
389
|
+
# # Add the face to the entities in the model
|
390
|
+
# face = entities.add_face(pts)
|
391
|
+
# loops = face.loops
|
392
|
+
#
|
393
|
+
# @return [Array<Sketchup::Loop>] an array of Loop objects if successful
|
394
|
+
#
|
395
|
+
# @version SketchUp 6.0
|
396
|
+
def loops
|
397
|
+
end
|
398
|
+
|
399
|
+
# The material method is used to retrieve the material assigned to the
|
400
|
+
# front of the face. (This method is inherited from the Drawingelement
|
401
|
+
# parent class.)
|
402
|
+
#
|
403
|
+
# @example
|
404
|
+
# depth = 100
|
405
|
+
# width = 100
|
406
|
+
# model = Sketchup.active_model
|
407
|
+
# entities = model.active_entities
|
408
|
+
# pts = []
|
409
|
+
# pts[0] = [0, 0, 0]
|
410
|
+
# pts[1] = [width, 0, 0]
|
411
|
+
# pts[2] = [width, depth, 0]
|
412
|
+
# pts[3] = [0, depth, 0]
|
413
|
+
#
|
414
|
+
# # Add the face to the entities in the model
|
415
|
+
# face = entities.add_face(pts)
|
416
|
+
#
|
417
|
+
# # Add a material to the face, then check to see that it was added
|
418
|
+
# face.material = "red"
|
419
|
+
# material = face.material
|
420
|
+
#
|
421
|
+
# @return [Sketchup::Material, nil] a Material object representing the material
|
422
|
+
# on the front of the face (if successful)
|
423
|
+
#
|
424
|
+
# @version SketchUp 6.0
|
425
|
+
def material
|
426
|
+
end
|
427
|
+
|
428
|
+
# The material= method is used to set the material assigned to the front
|
429
|
+
# side of the face. (This method is inherited from the Drawingelement
|
430
|
+
# parent class.)
|
431
|
+
#
|
432
|
+
# @example
|
433
|
+
# depth = 100
|
434
|
+
# width = 100
|
435
|
+
# model = Sketchup.active_model
|
436
|
+
# entities = model.active_entities
|
437
|
+
# pts = []
|
438
|
+
# pts[0] = [0, 0, 0]
|
439
|
+
# pts[1] = [width, 0, 0]
|
440
|
+
# pts[2] = [width, depth, 0]
|
441
|
+
# pts[3] = [0, depth, 0]
|
442
|
+
# # Add the face to the entities in the model
|
443
|
+
# face = entities.add_face(pts)
|
444
|
+
# status = face.material = "red"
|
445
|
+
#
|
446
|
+
# @param [Sketchup::Material] material
|
447
|
+
# A Material object or the name of a valid material.
|
448
|
+
#
|
449
|
+
# @return [Sketchup::Material] the name of the valid material or the new
|
450
|
+
# Material object (if successful)
|
451
|
+
#
|
452
|
+
# @version SketchUp 6.0
|
453
|
+
def material=(material)
|
454
|
+
end
|
455
|
+
|
456
|
+
# The mesh method creates a polygon mesh that represents the face. See the
|
457
|
+
# {Geom::PolygonMesh} class for more information.
|
458
|
+
#
|
459
|
+
# Valid flags are:
|
460
|
+
#
|
461
|
+
# - +0+: Include PolygonMeshPoints,
|
462
|
+
# - +1+: Include PolygonMeshUVQFront,
|
463
|
+
# - +2+: Include PolygonMeshUVQBack,
|
464
|
+
# - +4+: Include PolygonMeshNormals.
|
465
|
+
#
|
466
|
+
# Use bitwise OR to combine flags. A value of +7+ will include all
|
467
|
+
# flags, for example.
|
468
|
+
#
|
469
|
+
# @example
|
470
|
+
# depth = 100
|
471
|
+
# width = 100
|
472
|
+
# model = Sketchup.active_model
|
473
|
+
# entities = model.active_entities
|
474
|
+
# pts = []
|
475
|
+
# pts[0] = [0, 0, 0]
|
476
|
+
# pts[1] = [width, 0, 0]
|
477
|
+
# pts[2] = [width, depth, 0]
|
478
|
+
# pts[3] = [0, depth, 0]
|
479
|
+
#
|
480
|
+
# # Add the face to the entities in the model
|
481
|
+
# face = entities.add_face(pts)
|
482
|
+
#
|
483
|
+
# kPoints = 0
|
484
|
+
# kUVQFront = 1
|
485
|
+
# kUVQBack = 2
|
486
|
+
# kNormals = 4
|
487
|
+
# flags = kPoints | kUVQFront | kUVQBack | kNormals # equals to 7
|
488
|
+
# mesh = face.mesh(flags)
|
489
|
+
#
|
490
|
+
# @param [Integer] flags
|
491
|
+
# One or more flags used to generate a mesh.
|
492
|
+
#
|
493
|
+
# @return [Geom::PolygonMesh]
|
494
|
+
#
|
495
|
+
# @version SketchUp 6.0
|
496
|
+
def mesh(flags = 0)
|
497
|
+
end
|
498
|
+
|
499
|
+
# The normal method is used to retrieve the 3D vector normal to the face in
|
500
|
+
# the front direction.
|
501
|
+
#
|
502
|
+
# @example
|
503
|
+
# depth = 100
|
504
|
+
# width = 100
|
505
|
+
# model = Sketchup.active_model
|
506
|
+
# entities = model.active_entities
|
507
|
+
# pts = []
|
508
|
+
# pts[0] = [0, 0, 0]
|
509
|
+
# pts[1] = [width, 0, 0]
|
510
|
+
# pts[2] = [width, depth, 0]
|
511
|
+
# pts[3] = [0, depth, 0]
|
512
|
+
#
|
513
|
+
# # Add the face to the entities in the model
|
514
|
+
# face = entities.add_face(pts)
|
515
|
+
# normal = face.normal
|
516
|
+
#
|
517
|
+
# @return [Geom::Vector3d] a Vector3d object if successful
|
518
|
+
#
|
519
|
+
# @version SketchUp 6.0
|
520
|
+
def normal
|
521
|
+
end
|
522
|
+
|
523
|
+
# This method is used to retrieve the outer loop that bounds the face.
|
524
|
+
#
|
525
|
+
# @example
|
526
|
+
# # Create a series of points that define a new face.
|
527
|
+
# model = Sketchup.active_model
|
528
|
+
# entities = model.active_entities
|
529
|
+
# pts = []
|
530
|
+
# pts[0] = [0, 0, 0]
|
531
|
+
# pts[1] = [9, 0, 0]
|
532
|
+
# pts[2] = [9, 9, 0]
|
533
|
+
# pts[3] = [0, 9, 0]
|
534
|
+
#
|
535
|
+
# # Add the face to the entities in the model
|
536
|
+
# face = entities.add_face(pts)
|
537
|
+
# loop = face.outer_loop
|
538
|
+
#
|
539
|
+
# @return [Sketchup::Loop] a Loop object representing the outer loop (if
|
540
|
+
# successful)
|
541
|
+
#
|
542
|
+
# @version SketchUp 6.0
|
543
|
+
def outer_loop
|
544
|
+
end
|
545
|
+
|
546
|
+
# The plane method is used to retrieve the plane of the face. See the Array
|
547
|
+
# class for information on how planes are stored.
|
548
|
+
#
|
549
|
+
# @example
|
550
|
+
# depth = 100
|
551
|
+
# width = 100
|
552
|
+
# model = Sketchup.active_model
|
553
|
+
# entities = model.active_entities
|
554
|
+
# pts = []
|
555
|
+
# pts[0] = [0, 0, 0]
|
556
|
+
# pts[1] = [width, 0, 0]
|
557
|
+
# pts[2] = [width, depth, 0]
|
558
|
+
# pts[3] = [0, depth, 0]
|
559
|
+
#
|
560
|
+
# # Add the face to the entities in the model
|
561
|
+
# face = entities.add_face(pts)
|
562
|
+
# plane = face.plane
|
563
|
+
#
|
564
|
+
# @return [Array(Float, Float, Float, Float)] a plane that contains the face (if successful)
|
565
|
+
#
|
566
|
+
# @version SketchUp 6.0
|
567
|
+
def plane
|
568
|
+
end
|
569
|
+
|
570
|
+
# The position_material method is used to position a material on a face.
|
571
|
+
#
|
572
|
+
# The pt_array must contain 2, 4, 6 or 8 points. The points are used in pairs
|
573
|
+
# to tell where a point in the texture image is positioned on the Face. The
|
574
|
+
# first point in each pair is a 3D point in the model. It should be a point on
|
575
|
+
# the Face. The second point in each pair of points is a 2D point that gives
|
576
|
+
# the (u,v) coordinates of a point in the image to match up with the 3D point.
|
577
|
+
#
|
578
|
+
# @example
|
579
|
+
# model = Sketchup.active_model
|
580
|
+
# entities = model.active_entities
|
581
|
+
#
|
582
|
+
# # Create a face and add it to the model entities
|
583
|
+
# pts = []
|
584
|
+
# pts[0] = [0, 0, 1]
|
585
|
+
# pts[1] = [9, 0, 1]
|
586
|
+
# pts[2] = [9, 9, 1]
|
587
|
+
# pts[3] = [0, 9, 1]
|
588
|
+
# face = entities.add_face(pts)
|
589
|
+
#
|
590
|
+
# # Export an image to use as a texture
|
591
|
+
# path = Sketchup.temp_dir
|
592
|
+
# full_name = File.join(path, "temp_image.jpg")
|
593
|
+
# model.active_view.write_image(full_name, 500, 500, false, 0.0)
|
594
|
+
#
|
595
|
+
# # Create a material and assign the texture to it
|
596
|
+
# material = model.materials.add("Test Material")
|
597
|
+
# material.texture = full_name
|
598
|
+
#
|
599
|
+
# # Assign the new material to our face we created
|
600
|
+
# face.material = material
|
601
|
+
#
|
602
|
+
# pt_array = []
|
603
|
+
# pt_array[0] = Geom::Point3d.new(3,0,0)
|
604
|
+
# pt_array[1] = Geom::Point3d.new(0,0,0)
|
605
|
+
# on_front = true
|
606
|
+
# face.position_material(material, pt_array, on_front)
|
607
|
+
#
|
608
|
+
# @param [Sketchup::Material] material
|
609
|
+
# a Material object.
|
610
|
+
#
|
611
|
+
# @param [Array<Geom::Point3d>] pt_array
|
612
|
+
# An array of Point3d objects used to position the material.
|
613
|
+
#
|
614
|
+
# @param [Boolean] o_front
|
615
|
+
# true to position the texture on the front of the Face or
|
616
|
+
# false to position it on the back of the Face.
|
617
|
+
#
|
618
|
+
# @return [Sketchup::Face, false] the face upon success, false upon failure.
|
619
|
+
#
|
620
|
+
# @version SketchUp 6.0
|
621
|
+
def position_material(material, pt_array, o_front)
|
622
|
+
end
|
623
|
+
|
624
|
+
# The pushpull method is used to perform a push/pull on a face.
|
625
|
+
#
|
626
|
+
# The distance is measured in the direction that the face normal is pointing.
|
627
|
+
#
|
628
|
+
# @example
|
629
|
+
# depth = 100
|
630
|
+
# width = 100
|
631
|
+
# model = Sketchup.active_model
|
632
|
+
# entities = model.active_entities
|
633
|
+
# pts = []
|
634
|
+
# pts[0] = [0, 0, 0]
|
635
|
+
# pts[1] = [width, 0, 0]
|
636
|
+
# pts[2] = [width, depth, 0]
|
637
|
+
# pts[3] = [0, depth, 0]
|
638
|
+
# # Add the face to the entities in the model
|
639
|
+
# face = entities.add_face(pts)
|
640
|
+
# status = face.pushpull(100, true)
|
641
|
+
#
|
642
|
+
# @param [Numeric] distance
|
643
|
+
# The distance, in current units, to push/pull the face.
|
644
|
+
#
|
645
|
+
# @param [Boolean] copy
|
646
|
+
# Create a new push/pull starting face if true (equivalent
|
647
|
+
# of pressing CTRL while in SketchUp), do not create a
|
648
|
+
# push/pull starting face if false.
|
649
|
+
#
|
650
|
+
# @return [nil]
|
651
|
+
#
|
652
|
+
# @version SketchUp 6.0
|
653
|
+
def pushpull(distance, copy = false)
|
654
|
+
end
|
655
|
+
|
656
|
+
# The reverse! method is used to reverse the face's orientation, meaning the
|
657
|
+
# front becomes the back.
|
658
|
+
#
|
659
|
+
# @example
|
660
|
+
# depth = 100
|
661
|
+
# width = 100
|
662
|
+
# model = Sketchup.active_model
|
663
|
+
# entities = model.active_entities
|
664
|
+
# pts = []
|
665
|
+
# pts[0] = [0, 0, 0]
|
666
|
+
# pts[1] = [width, 0, 0]
|
667
|
+
# pts[2] = [width, depth, 0]
|
668
|
+
# pts[3] = [0, depth, 0]
|
669
|
+
# # Add the face to the entities in the model
|
670
|
+
# face = entities.add_face(pts)
|
671
|
+
# status = face.reverse!
|
672
|
+
#
|
673
|
+
# @return [Sketchup::Face, false] the reversed Face object if successful, false if
|
674
|
+
# unsuccessful
|
675
|
+
#
|
676
|
+
# @version SketchUp 6.0
|
677
|
+
def reverse!
|
678
|
+
end
|
679
|
+
|
680
|
+
# The set_texture_projection method is used to set the texture projection
|
681
|
+
# direction.
|
682
|
+
#
|
683
|
+
# @deprecated This function never worked right. It's not possible to control
|
684
|
+
# the position and orientation of the texture.
|
685
|
+
#
|
686
|
+
# @example
|
687
|
+
# model = Sketchup.active_model
|
688
|
+
# entities = model.active_entities
|
689
|
+
# materials = model.materials
|
690
|
+
#
|
691
|
+
# # Create a face and add it to the model entities
|
692
|
+
# pts = []
|
693
|
+
# pts[0] = [0, 0, 1]
|
694
|
+
# pts[1] = [10, 0, 1]
|
695
|
+
# pts[2] = [10, 10, 1]
|
696
|
+
# face = entities.add_face(pts)
|
697
|
+
#
|
698
|
+
# # Export an image to use as a texture
|
699
|
+
# path = Sketchup.temp_dir
|
700
|
+
# full_name = File.join(path, "temp_image.jpg")
|
701
|
+
# model.active_view.write_image(full_name, 500, 500, false, 0.0)
|
702
|
+
#
|
703
|
+
# # Create a material and assign the testure to it.
|
704
|
+
# material = materials.add("Test Material")
|
705
|
+
# material.texture = full_name
|
706
|
+
#
|
707
|
+
# # Assign the new material to our face we created
|
708
|
+
# face.material = material
|
709
|
+
#
|
710
|
+
# # Returns nil if not successful, path if successful
|
711
|
+
# result = face.set_texture_projection(face.normal, true)
|
712
|
+
#
|
713
|
+
# @param [Geom::Vector3d] vector
|
714
|
+
# representing the direction of the projection. Use nil
|
715
|
+
# to remove the projection.
|
716
|
+
#
|
717
|
+
# @param [Boolean] frontside
|
718
|
+
# true for front side, false for back side.
|
719
|
+
#
|
720
|
+
# @return [Boolean] true on success
|
721
|
+
#
|
722
|
+
# @version SketchUp 2014
|
723
|
+
def set_texture_projection(vector, frontside)
|
724
|
+
end
|
725
|
+
|
726
|
+
# The vertices method is used to get an array of all of the vertices that
|
727
|
+
# bound the face.
|
728
|
+
#
|
729
|
+
# @example
|
730
|
+
# depth = 100
|
731
|
+
# width = 100
|
732
|
+
# model = Sketchup.active_model
|
733
|
+
# entities = model.active_entities
|
734
|
+
# pts = []
|
735
|
+
# pts[0] = [0, 0, 0]
|
736
|
+
# pts[1] = [width, 0, 0]
|
737
|
+
# pts[2] = [width, depth, 0]
|
738
|
+
# pts[3] = [0, depth, 0]
|
739
|
+
#
|
740
|
+
# # Add the face to the entities in the model
|
741
|
+
# face = entities.add_face(pts)
|
742
|
+
# vertices = face.vertices
|
743
|
+
#
|
744
|
+
# @return [Array<Sketchup::Vertex>] an array of Vertex objects if successful
|
745
|
+
#
|
746
|
+
# @version SketchUp 6.0
|
747
|
+
def vertices
|
748
|
+
end
|
749
|
+
|
750
|
+
end
|