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