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,213 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The EdgeUse class defines how an Edge is used in the definition of a Face.
|
5
|
+
#
|
6
|
+
# @version SketchUp 6.0
|
7
|
+
class Sketchup::EdgeUse < Sketchup::Entity
|
8
|
+
|
9
|
+
# Instance Methods
|
10
|
+
|
11
|
+
# The edge method is used to retrieve the edge for the edge use.
|
12
|
+
#
|
13
|
+
# @example
|
14
|
+
# entities = Sketchup.active_model.active_entities
|
15
|
+
# points = []
|
16
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
17
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
18
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
19
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
20
|
+
# face = entities.add_face(points)
|
21
|
+
# loop = face.outer_loop
|
22
|
+
# edgeuses = loop.edgeuses
|
23
|
+
# edgeuse = edgeuses[0]
|
24
|
+
# edge = edgeuse.edge
|
25
|
+
#
|
26
|
+
# @return edge - an Edge object used by this edge use
|
27
|
+
#
|
28
|
+
# @version SketchUp 6.0
|
29
|
+
def edge
|
30
|
+
end
|
31
|
+
|
32
|
+
# The end_vertex_normal method is used to retrieve the vertex normal for the
|
33
|
+
# end point of this edgeuse.
|
34
|
+
#
|
35
|
+
# @example
|
36
|
+
# entities = Sketchup.active_model.active_entities
|
37
|
+
# points = []
|
38
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
39
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
40
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
41
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
42
|
+
# face = entities.add_face(points)
|
43
|
+
# loop = face.outer_loop
|
44
|
+
# edgeuses = loop.edgeuses
|
45
|
+
# edgeuse = edgeuses[0]
|
46
|
+
# vector3d = edgeuse.end_vertex_normal
|
47
|
+
#
|
48
|
+
# @return vector3d - a vector3d object if successful.
|
49
|
+
#
|
50
|
+
# @version SketchUp 6.0
|
51
|
+
def end_vertex_normal
|
52
|
+
end
|
53
|
+
|
54
|
+
# The face method is used to retrieve the face used by this edge use.
|
55
|
+
#
|
56
|
+
# @example
|
57
|
+
# entities = Sketchup.active_model.active_entities
|
58
|
+
# points = []
|
59
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
60
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
61
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
62
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
63
|
+
# face = entities.add_face(points)
|
64
|
+
# loop = face.outer_loop
|
65
|
+
# edgeuses = loop.edgeuses
|
66
|
+
# edgeuse = edgeuses[0]
|
67
|
+
# face = edgeuse.face
|
68
|
+
#
|
69
|
+
# @return face - a Face object used by this edge use
|
70
|
+
#
|
71
|
+
# @version SketchUp 6.0
|
72
|
+
def face
|
73
|
+
end
|
74
|
+
|
75
|
+
# The loop method is used to retrieve the loop for this edge use.
|
76
|
+
#
|
77
|
+
# @example
|
78
|
+
# entities = Sketchup.active_model.active_entities
|
79
|
+
# points = []
|
80
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
81
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
82
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
83
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
84
|
+
# face = entities.add_face(points)
|
85
|
+
# loop = face.outer_loop
|
86
|
+
# edgeuses = loop.edgeuses
|
87
|
+
# edgeuse = edgeuses[0]
|
88
|
+
# loop = edgeuse.loop
|
89
|
+
#
|
90
|
+
# @return loop - a Loop object that contains this edge use.
|
91
|
+
#
|
92
|
+
# @version SketchUp 6.0
|
93
|
+
def loop
|
94
|
+
end
|
95
|
+
|
96
|
+
# The next method is used to retrieve the next edge use in a loop.
|
97
|
+
#
|
98
|
+
# @example
|
99
|
+
# entities = Sketchup.active_model.active_entities
|
100
|
+
# points = []
|
101
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
102
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
103
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
104
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
105
|
+
# face = entities.add_face(points)
|
106
|
+
# loop = face.outer_loop
|
107
|
+
# edgeuses = loop.edgeuses
|
108
|
+
# edgeuse = edgeuses[0]
|
109
|
+
# next_edgeuse = edgeuse.next
|
110
|
+
#
|
111
|
+
# @return edgeuse - the next EdgeUse object in a loop
|
112
|
+
#
|
113
|
+
# @version SketchUp 6.0
|
114
|
+
def next
|
115
|
+
end
|
116
|
+
|
117
|
+
# The partners method is used to retrieve all of the partner edge uses that
|
118
|
+
# uses the same edge.
|
119
|
+
#
|
120
|
+
# @example
|
121
|
+
# entities = Sketchup.active_model.active_entities
|
122
|
+
# points1 = []
|
123
|
+
# points1 << Geom::Point3d.new(0, 0, 0)
|
124
|
+
# points1 << Geom::Point3d.new(100, 0, 0)
|
125
|
+
# points1 << Geom::Point3d.new(100, 200, 0)
|
126
|
+
# points1 << Geom::Point3d.new(0, 200, 0)
|
127
|
+
# face1 = entities.add_face(points1)
|
128
|
+
# points2 = []
|
129
|
+
# points2 << Geom::Point3d.new(100, 0, 0)
|
130
|
+
# points2 << Geom::Point3d.new(200, 0, 0)
|
131
|
+
# points2 << Geom::Point3d.new(200, 200, 0)
|
132
|
+
# points2 << Geom::Point3d.new(100, 200, 0)
|
133
|
+
# face2 = entities.add_face(points2)
|
134
|
+
# loop = face1.outer_loop
|
135
|
+
# edgeuses = loop.edgeuses
|
136
|
+
# edgeuse = edgeuses[1]
|
137
|
+
# partners = edgeuse.partners
|
138
|
+
#
|
139
|
+
# @return array - an array of partner Edge Use objects.
|
140
|
+
#
|
141
|
+
# @version SketchUp 6.0
|
142
|
+
def partners
|
143
|
+
end
|
144
|
+
|
145
|
+
# The previous method is used to retrieve the previous edge use in a loop.
|
146
|
+
#
|
147
|
+
# @example
|
148
|
+
# entities = Sketchup.active_model.active_entities
|
149
|
+
# points = []
|
150
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
151
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
152
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
153
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
154
|
+
# face = entities.add_face(points)
|
155
|
+
# loop = face.outer_loop
|
156
|
+
# edgeuses = loop.edgeuses
|
157
|
+
# edgeuse = edgeuses[0]
|
158
|
+
# previous_edgeuse = edgeuse.previous
|
159
|
+
#
|
160
|
+
# @return edgeuse - the previous Edge Use object in the loop
|
161
|
+
#
|
162
|
+
# @version SketchUp 6.0
|
163
|
+
def previous
|
164
|
+
end
|
165
|
+
|
166
|
+
# The reversed? method is used to determine if the edge direction is opposite
|
167
|
+
# of the edge use direction. The edge use direction is the same as the loop
|
168
|
+
# it belongs to.
|
169
|
+
#
|
170
|
+
# @example
|
171
|
+
# entities = Sketchup.active_model.active_entities
|
172
|
+
# points = []
|
173
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
174
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
175
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
176
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
177
|
+
# face = entities.add_face(points)
|
178
|
+
# loop = face.outer_loop
|
179
|
+
# edgeuses = loop.edgeuses
|
180
|
+
# edgeuse = edgeuses[0]
|
181
|
+
# reversed = edgeuse.reversed?
|
182
|
+
#
|
183
|
+
# @return boolean - true if reversed, false if not reversed.
|
184
|
+
#
|
185
|
+
# @return [Boolean]
|
186
|
+
#
|
187
|
+
# @version SketchUp 6.0
|
188
|
+
def reversed?
|
189
|
+
end
|
190
|
+
|
191
|
+
# The start_vertex_normal method is used to retrieve the vertex normal for
|
192
|
+
# the start point of this edgeuse.
|
193
|
+
#
|
194
|
+
# @example
|
195
|
+
# entities = Sketchup.active_model.active_entities
|
196
|
+
# points = []
|
197
|
+
# points << Geom::Point3d.new(0, 0, 0)
|
198
|
+
# points << Geom::Point3d.new(100, 0, 0)
|
199
|
+
# points << Geom::Point3d.new(100, 200, 0)
|
200
|
+
# points << Geom::Point3d.new(0, 200, 0)
|
201
|
+
# face = entities.add_face(points)
|
202
|
+
# loop = face.outer_loop
|
203
|
+
# edgeuses = loop.edgeuses
|
204
|
+
# edgeuse = edgeuses[0]
|
205
|
+
# vector3d = edgeuse.start_vertex_normal
|
206
|
+
#
|
207
|
+
# @return vector3d - a vector3d object if successful.
|
208
|
+
#
|
209
|
+
# @version SketchUp 6.0
|
210
|
+
def start_vertex_normal
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
@@ -0,0 +1,1011 @@
|
|
1
|
+
# Copyright:: Copyright 2017 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The Entities class is a container class for all entities in a model (it is a
|
5
|
+
# collection of Entity objects).
|
6
|
+
#
|
7
|
+
# @version SketchUp 6.0
|
8
|
+
class Sketchup::Entities
|
9
|
+
|
10
|
+
# Includes
|
11
|
+
|
12
|
+
include Enumerable
|
13
|
+
|
14
|
+
# Instance Methods
|
15
|
+
|
16
|
+
# The {#[]} method is used to retrieve an entity by its index in an array of
|
17
|
+
# entities. The index is a number between +0+ and entities.length - 1. In
|
18
|
+
# general, it is preferable to use the {#each} method to iterate though all
|
19
|
+
# of the entities in the collection as it will be much more efficient.
|
20
|
+
#
|
21
|
+
# The {#at} method is an alias of {#[]}
|
22
|
+
#
|
23
|
+
# @example
|
24
|
+
# entities = Sketchup.active_model.entities
|
25
|
+
# entity0 = entities[0]
|
26
|
+
# if (entity0)
|
27
|
+
# UI.messagebox entity0
|
28
|
+
# else
|
29
|
+
# UI.messagebox "Failure"
|
30
|
+
# end
|
31
|
+
#
|
32
|
+
# @param [Integer] entity_index
|
33
|
+
# The index for a specific entity.
|
34
|
+
#
|
35
|
+
# @return [Sketchup::Entity, nil] an {Sketchup::Entity} object if successful,
|
36
|
+
# +nil+ if not found
|
37
|
+
#
|
38
|
+
# @version SketchUp 6.0
|
39
|
+
def [](entity_index)
|
40
|
+
end
|
41
|
+
|
42
|
+
# The active_section_plane method is used to access the currently active
|
43
|
+
# section plane in the Entities object.
|
44
|
+
#
|
45
|
+
# @example
|
46
|
+
# sp = Sketchup.active_model.entities.active_section_plane
|
47
|
+
# puts "Active section plane is #{sp}" if !sp.nil?
|
48
|
+
#
|
49
|
+
# @return the active SectionPlane or nil if none is active.
|
50
|
+
#
|
51
|
+
# @version SketchUp 2014
|
52
|
+
def active_section_plane
|
53
|
+
end
|
54
|
+
|
55
|
+
# The active_section_plane= method is used to set the active section plane in
|
56
|
+
# the Entities object.
|
57
|
+
#
|
58
|
+
# @example
|
59
|
+
# entities = Sketchup.active_model.entities
|
60
|
+
# sp = entities.add_section_plane([50, 50, 0], [1.0, 1.0, 0])
|
61
|
+
# entities.active_section_plane = sp
|
62
|
+
#
|
63
|
+
# @param sec_plane
|
64
|
+
# the SectionPlane object to be set active. Pass nil to
|
65
|
+
# deactivate any active section plane.
|
66
|
+
#
|
67
|
+
# @return the SectionPlane object that was set active.
|
68
|
+
#
|
69
|
+
# @version SketchUp 2014
|
70
|
+
def active_section_plane=(sec_plane)
|
71
|
+
end
|
72
|
+
|
73
|
+
# The add_3d_text is used to create 3D text. It will be added as edges and
|
74
|
+
# faces drawn at the origin.
|
75
|
+
#
|
76
|
+
# @example
|
77
|
+
# # Draw the word "test" at the origin of the model, aligned left, in
|
78
|
+
# # Arial Bold, not italics, 1" in size, best tolerance quality, filled,
|
79
|
+
# # with an extrusion size of 5".
|
80
|
+
# entities = Sketchup.active_model.entities
|
81
|
+
# success = entities.add_3d_text('test', TextAlignLeft, "Arial",
|
82
|
+
# true, false, 1.0, 0.0, 0.5, true, 5.0)
|
83
|
+
#
|
84
|
+
# @param [optional] is_bold
|
85
|
+
# Boolean, true for bold.
|
86
|
+
#
|
87
|
+
# @param string
|
88
|
+
# The text to create.
|
89
|
+
#
|
90
|
+
# @param alignment
|
91
|
+
# Number that defines the alignment. There are constants
|
92
|
+
# called TextAlignLeft, TextAlignRight, and
|
93
|
+
# TextAlignCenter that can be passed.
|
94
|
+
#
|
95
|
+
# @param font
|
96
|
+
# String font name.
|
97
|
+
#
|
98
|
+
# @param [optional] is_italic
|
99
|
+
# Boolean, true for italic.
|
100
|
+
#
|
101
|
+
# @param [optional] extrusion
|
102
|
+
# Extrusion depth in inches. Defaults to 0.0.
|
103
|
+
#
|
104
|
+
# @param [optional] letter_height
|
105
|
+
# Height of the text in inches.
|
106
|
+
#
|
107
|
+
# @param [optional] tolerance
|
108
|
+
# Tolerance of the curve creation. Defaults to
|
109
|
+
# 0.0, which creates the highest possible curve quality.
|
110
|
+
#
|
111
|
+
# @param [optional] z
|
112
|
+
# z position in inches.
|
113
|
+
#
|
114
|
+
# @param [optional] is_filled
|
115
|
+
# Boolean, true for filled, which will put a
|
116
|
+
# face between the edges of the letters.
|
117
|
+
#
|
118
|
+
# @return true if successful
|
119
|
+
#
|
120
|
+
# @version SketchUp 6.0
|
121
|
+
def add_3d_text(string, alignment, font, is_bold, is_italic, letter_height, tolerance, z, is_filled, extrusion)
|
122
|
+
end
|
123
|
+
|
124
|
+
# The add_arc method is used to create an arc curve segment.
|
125
|
+
#
|
126
|
+
# @example
|
127
|
+
# centerpoint = Geom::Point3d.new
|
128
|
+
# # Create a circle perpendicular to the normal or Z axis
|
129
|
+
# vector = Geom::Vector3d.new 0,0,1
|
130
|
+
# vector2 = Geom::Vector3d.new 1,0,0
|
131
|
+
# vector3 = vector.normalize!
|
132
|
+
# model = Sketchup.active_model
|
133
|
+
# entities = model.active_entities
|
134
|
+
# edges = entities.add_arc centerpoint, vector2, vector3, 10, 15.degrees, 135.degrees
|
135
|
+
# arccurve = edges.first.curve
|
136
|
+
#
|
137
|
+
# @overload add_arc(center, xaxis, normal, radius, start_angle, end_angle)
|
138
|
+
#
|
139
|
+
# @param center A Point3d object representing the center .
|
140
|
+
# @param xaxis A Vector3d object representing xaxis for the arc.
|
141
|
+
# @param normal A Vector3d object representing normal for the arc.
|
142
|
+
# @param radius The radius of the arc.
|
143
|
+
# @param start_angle Start angle for the arc, in radians.
|
144
|
+
# @param end_angle End angle for the arc, in radians.
|
145
|
+
# @return edges - an array of Edge objects that define the arc.
|
146
|
+
#
|
147
|
+
# @overload add_arc(center, xaxis, normal, radius, start_angle, end_angle, num_segments)
|
148
|
+
#
|
149
|
+
# @param center A Point3d object representing the center .
|
150
|
+
# @param xaxis A Vector3d object representing xaxis for the arc.
|
151
|
+
# @param normal A Vector3d object representing normal for the arc.
|
152
|
+
# @param radius The radius of the arc.
|
153
|
+
# @param start_angle Start angle for the arc, in radians.
|
154
|
+
# @param end_angle End angle for the arc, in radians.
|
155
|
+
# @param num_segments How many segments to draw.
|
156
|
+
# @return edges - an array of Edge objects that define the arc.
|
157
|
+
#
|
158
|
+
# @version SketchUp 6.0
|
159
|
+
def add_arc(*args)
|
160
|
+
end
|
161
|
+
|
162
|
+
# The add_circle method is used to create a circle.
|
163
|
+
#
|
164
|
+
# @example
|
165
|
+
# centerpoint = Geom::Point3d.new
|
166
|
+
# # Create a circle perpendicular to the normal or Z axis
|
167
|
+
# vector = Geom::Vector3d.new 0,0,1
|
168
|
+
# vector2 = vector.normalize!
|
169
|
+
# model = Sketchup.active_model
|
170
|
+
# entities = model.active_entities
|
171
|
+
# edges = entities.add_circle centerpoint, vector2, 10
|
172
|
+
#
|
173
|
+
# @param center
|
174
|
+
# A Point3d object representing the center .
|
175
|
+
#
|
176
|
+
# @param normal
|
177
|
+
# A Vector3d object representing normal for the arc.
|
178
|
+
#
|
179
|
+
# @param numsegs
|
180
|
+
# The number of segments.
|
181
|
+
#
|
182
|
+
# @param radius
|
183
|
+
# The radius of the arc.
|
184
|
+
#
|
185
|
+
# @return circle - an Array object containing edges if successful
|
186
|
+
#
|
187
|
+
# @version SketchUp 6.0
|
188
|
+
def add_circle(center, normal, radius, numsegs = 24)
|
189
|
+
end
|
190
|
+
|
191
|
+
# The add_cline method is used to create a construction line.
|
192
|
+
#
|
193
|
+
# @example
|
194
|
+
# model = Sketchup.active_model
|
195
|
+
# entities = model.active_entities
|
196
|
+
# point1 = Geom::Point3d.new(0, 0, 0)
|
197
|
+
# point2 = Geom::Point3d.new(20, 20, 20)
|
198
|
+
# cline = entities.add_cline(point1, point2)
|
199
|
+
#
|
200
|
+
# @param start_point
|
201
|
+
# A Point3d object where the line will start.
|
202
|
+
#
|
203
|
+
# @param end_point
|
204
|
+
# If a Vector3d, then an infinite line passing through
|
205
|
+
# the start_point will be created in that direction. If a
|
206
|
+
# Point3d, then a finite line will be created between the
|
207
|
+
# two points.
|
208
|
+
#
|
209
|
+
# @param [optional] stipple
|
210
|
+
# Stipple pattern. See ConstructionLine.stipple
|
211
|
+
# for acceptable patterns.
|
212
|
+
#
|
213
|
+
# @return construction_line - a ConstructionLine object if
|
214
|
+
# successful
|
215
|
+
#
|
216
|
+
# @version SketchUp 6.0
|
217
|
+
def add_cline(start_point, end_point, stipple)
|
218
|
+
end
|
219
|
+
|
220
|
+
# The add_cpoint method is used to create a construction point.
|
221
|
+
#
|
222
|
+
# @example
|
223
|
+
# model = Sketchup.active_model
|
224
|
+
# entities = model.active_entities
|
225
|
+
# point1 = Geom::Point3d.new(100,200,300)
|
226
|
+
# constpoint = entities.add_cpoint point1
|
227
|
+
# if (constpoint)
|
228
|
+
# UI.messagebox constpoint
|
229
|
+
# else
|
230
|
+
# UI.messagebox "Failure"
|
231
|
+
# end
|
232
|
+
#
|
233
|
+
# @param point
|
234
|
+
# A Point3d object.
|
235
|
+
#
|
236
|
+
# @return construction_point - a ConstructionPoint object if
|
237
|
+
# successful
|
238
|
+
#
|
239
|
+
# @version SketchUp 6.0
|
240
|
+
def add_cpoint(point)
|
241
|
+
end
|
242
|
+
|
243
|
+
# The add_curve method is used to create a curve from a collection of edges.
|
244
|
+
#
|
245
|
+
# The arguments are either Points or an Array of Points. At least 2 points are
|
246
|
+
# required.
|
247
|
+
#
|
248
|
+
# @example
|
249
|
+
# entities = Sketchup.active_model.entities
|
250
|
+
# curve = entities.add_curve [0,0,0], [0,10,0], [1,20,0]
|
251
|
+
#
|
252
|
+
# @param pts_or_array
|
253
|
+
# You can pass either a series of Point3d objects or a
|
254
|
+
# single array containing Point3d objects.
|
255
|
+
#
|
256
|
+
# @return curve - an array of Edges that make up the curve if
|
257
|
+
# successful
|
258
|
+
#
|
259
|
+
# @version SketchUp 6.0
|
260
|
+
def add_curve(pts_or_array)
|
261
|
+
end
|
262
|
+
|
263
|
+
# The add_dimension_linear method adds a linear dimension to the entities.
|
264
|
+
#
|
265
|
+
# @example
|
266
|
+
# entities = Sketchup.active_model.entities
|
267
|
+
# # From point to point
|
268
|
+
# dim = entities.add_dimension_linear [50, 10, 0], [100, 10, 0], [0, 20, 0]
|
269
|
+
# # Between edge vertices
|
270
|
+
# edge = entities.add_edges([50,50,0], [40,10,0])[0]
|
271
|
+
# v0 = edge.start
|
272
|
+
# v1 = edge.end
|
273
|
+
# dim = entities.add_dimension_linear v0, v1, [0, 0, 20]
|
274
|
+
# # From an edge's midpoint to a construction point
|
275
|
+
# p0 = edge.start.position
|
276
|
+
# p1 = edge.end.position
|
277
|
+
# mp = Geom::Point3d.new((p0.x+p1.x)/2.0, (p0.y+p1.y)/2.0, (p0.z+p1.z)/2.0)
|
278
|
+
# cp = entities.add_cpoint [50, 10, 0]
|
279
|
+
# dim = entities.add_dimension_linear [edge, mp], cp, [20, 0, 0]
|
280
|
+
# # alternatively, the start params could be passed in separately
|
281
|
+
# dim = entities.add_dimension_linear edge, mp, cp, [20, 0, 0]
|
282
|
+
#
|
283
|
+
# @param start_pt_or_entity
|
284
|
+
# the reference point and/or entity at the start of
|
285
|
+
# the dimension. This parameter can take several
|
286
|
+
# forms:
|
287
|
+
#
|
288
|
+
# @param end_pt_or_entity
|
289
|
+
# the reference point and/or entity at the end
|
290
|
+
# of the dimension. This parameter takes the exact
|
291
|
+
# same forms as 'start_pt_or_entity'.
|
292
|
+
#
|
293
|
+
# @param offset_vector
|
294
|
+
# the parallel offset vector from the reference line
|
295
|
+
# to the dimension line measured from the 'start'
|
296
|
+
# reference point.
|
297
|
+
#
|
298
|
+
# @return Entity - the created dimension
|
299
|
+
#
|
300
|
+
# @version SketchUp 2014
|
301
|
+
def add_dimension_linear(start_pt_or_entity, end_pt_or_entity, offset_vector)
|
302
|
+
end
|
303
|
+
|
304
|
+
# The add_dimension_radial method adds a radial dimension (i.e arc/circle
|
305
|
+
# radius/diameter dimension) to the entities.
|
306
|
+
#
|
307
|
+
# @example
|
308
|
+
# entities = Sketchup.active_model.entities
|
309
|
+
# # Create a circle
|
310
|
+
# centerpoint = Geom::Point3d.new(10, 10, 0)
|
311
|
+
# vector = Geom::Vector3d.new(0, 0, 1)
|
312
|
+
# edges = entities.add_circle centerpoint, vector, 10
|
313
|
+
# circle = edges[0].curve
|
314
|
+
# dim = entities.add_dimension_radial circle, [30, 30, 0]
|
315
|
+
#
|
316
|
+
# @param arc_curve
|
317
|
+
# an ArcCurve object to which the dimension is to be
|
318
|
+
# attached.
|
319
|
+
#
|
320
|
+
# @param leader_break_pt
|
321
|
+
# a Point3d for the break point on the leader where the
|
322
|
+
# dimension text is attached.
|
323
|
+
#
|
324
|
+
# @return the created dimension
|
325
|
+
#
|
326
|
+
# @version SketchUp 2014
|
327
|
+
def add_dimension_radial(arc_curve, leader_break_pt)
|
328
|
+
end
|
329
|
+
|
330
|
+
# The add_edges method is used to add a set of connected edges to the entities
|
331
|
+
# array.
|
332
|
+
#
|
333
|
+
# @example
|
334
|
+
# model = Sketchup.active_model
|
335
|
+
# entities = model.active_entities
|
336
|
+
# point1 = Geom::Point3d.new(0,0,0)
|
337
|
+
# point2 = Geom::Point3d.new(20,20,20)
|
338
|
+
# edges = entities.add_edges point1, point2
|
339
|
+
#
|
340
|
+
# @param pts_or_array
|
341
|
+
# You can pass either a series of Point3d objects or a
|
342
|
+
# single array containing Point3d objects.
|
343
|
+
#
|
344
|
+
# @return edges - an array of Edge objects if successful
|
345
|
+
#
|
346
|
+
# @version SketchUp 6.0
|
347
|
+
def add_edges(pts_or_array)
|
348
|
+
end
|
349
|
+
|
350
|
+
# The add_face method is used to create a face. You can call this method a
|
351
|
+
# number of ways:
|
352
|
+
#
|
353
|
+
# - entities.add_face(edge1, edge2, edge3, ...)
|
354
|
+
# - entities.add_face(edgearray)
|
355
|
+
# - entities.add_face(pt1, pt2, pt3, ...)
|
356
|
+
# - entities.add_face([pt1, pt2, pt3,...])
|
357
|
+
# - entities.add_face(curve)
|
358
|
+
#
|
359
|
+
# For the last form that takes a Curve, the curve must be closed - like a
|
360
|
+
# circle.
|
361
|
+
#
|
362
|
+
# Note that a special case exists for any face created on the ground plane, in
|
363
|
+
# which case the vertex order is ignored and the face is always facing down.
|
364
|
+
#
|
365
|
+
# @example
|
366
|
+
# depth = 100
|
367
|
+
# width = 100
|
368
|
+
# model = Sketchup.active_model
|
369
|
+
# entities = model.active_entities
|
370
|
+
# pts = []
|
371
|
+
# pts[0] = [0, 0, 0]
|
372
|
+
# pts[1] = [width, 0, 0]
|
373
|
+
# pts[2] = [width, depth, 0]
|
374
|
+
# pts[3] = [0, depth, 0]
|
375
|
+
# # Add the face to the entities in the model
|
376
|
+
# face = entities.add_face pts
|
377
|
+
# if (face)
|
378
|
+
# UI.messagebox face
|
379
|
+
# else
|
380
|
+
# UI.messagebox "Failure"
|
381
|
+
# end
|
382
|
+
#
|
383
|
+
# @param some_entities
|
384
|
+
# Either a series of Edge or Point3d objects, an array of
|
385
|
+
# Point3d objects, or a closed Curve.
|
386
|
+
#
|
387
|
+
# @return face - a Face object if successful
|
388
|
+
#
|
389
|
+
# @version SketchUp 6.0
|
390
|
+
def add_face(some_entities)
|
391
|
+
end
|
392
|
+
|
393
|
+
# The {#add_faces_from_mesh} method is used to add Face objects to the
|
394
|
+
# collection of entities from a PolygonMesh.
|
395
|
+
#
|
396
|
+
# The +smooth_flags+ parameter can contain any of the following values if
|
397
|
+
# passed. The constants were added in SketchUp 2014. For previous versions,
|
398
|
+
# numeric values have to be specified instead of the Ruby constants.
|
399
|
+
#
|
400
|
+
# - 0: {Geom::PolygonMesh::NO_SMOOTH_OR_HIDE}
|
401
|
+
# - 1: {Geom::PolygonMesh::HIDE_BASED_ON_INDEX} (Negative point index will hide the edge.)
|
402
|
+
# - 2: {Geom::PolygonMesh::SOFTEN_BASED_ON_INDEX} (Negative point index will soften the edge.)
|
403
|
+
# - 4: {Geom::PolygonMesh::AUTO_SOFTEN} (Interior edges are softened.)
|
404
|
+
# - 8: {Geom::PolygonMesh::SMOOTH_SOFT_EDGES} (All soft edges will also be smooth.)
|
405
|
+
#
|
406
|
+
# The 3rd and 4th parameters will accept a {sketchup::Material} object or a
|
407
|
+
# string name of a material currently in the model.
|
408
|
+
#
|
409
|
+
# @example
|
410
|
+
# pm = Geom::PolygonMesh.new
|
411
|
+
# pm.add_point([ 0, 0, 0]) # 1
|
412
|
+
# pm.add_point([10, 0, 0]) # 2
|
413
|
+
# pm.add_point([10,10, 0]) # 3
|
414
|
+
# pm.add_point([ 0,10, 0]) # 4
|
415
|
+
# pm.add_point([20, 0, 5]) # 5
|
416
|
+
# pm.add_point([20,10, 5]) # 6
|
417
|
+
# pm.add_polygon(1, -2, 3, 4)
|
418
|
+
# pm.add_polygon(2, 5,6, -3)
|
419
|
+
#
|
420
|
+
# # Create a new group that we will populate with the mesh.
|
421
|
+
# group = Sketchup.active_model.entities.add_group
|
422
|
+
# material = Sketchup.active_model.materials.add('green')
|
423
|
+
# smooth_flags = Geom::PolygonMesh::NO_SMOOTH_OR_HIDE
|
424
|
+
# group.entities.add_faces_from_mesh(pm, smooth_flags, material)
|
425
|
+
#
|
426
|
+
# @param [Geom::PolygonMesh] polygon_mesh
|
427
|
+
#
|
428
|
+
# @param [Integer] smooth_flags
|
429
|
+
# flags for softening and smoothing of edges.
|
430
|
+
#
|
431
|
+
# @param [Sketchup::Material, String] b_material
|
432
|
+
# material to paint back faces with.
|
433
|
+
#
|
434
|
+
# @param [Sketchup::Material, String] f_material
|
435
|
+
# material to paint front faces with.
|
436
|
+
#
|
437
|
+
# @return [Integer] Number of faces created
|
438
|
+
#
|
439
|
+
# @version SketchUp 6.0
|
440
|
+
def add_faces_from_mesh(polygon_mesh, smooth_flags = Geom::PolygonMesh::AUTO_SOFTEN|Geom::PolygonMesh::SMOOTH_SOFT_EDGES, f_material = nil, b_material = nil)
|
441
|
+
end
|
442
|
+
|
443
|
+
# The add_group method is used to create an empty group or a group with
|
444
|
+
# entities.
|
445
|
+
#
|
446
|
+
# NOTE: calling add_group with entities in its parameters has been known to
|
447
|
+
# crash SketchUp before version 8.0. It is preferable to create an empty
|
448
|
+
# group and then add things to its Entities collection.
|
449
|
+
#
|
450
|
+
# @example
|
451
|
+
# model = Sketchup.active_model
|
452
|
+
# entities = model.active_entities
|
453
|
+
# group = entities.add_group
|
454
|
+
# if (group)
|
455
|
+
# UI.messagebox group
|
456
|
+
# else
|
457
|
+
# UI.messagebox "Failure"
|
458
|
+
# end
|
459
|
+
#
|
460
|
+
# @param [optional] entities
|
461
|
+
# an entities collection to add to the group.
|
462
|
+
#
|
463
|
+
# @return group - the new group
|
464
|
+
#
|
465
|
+
# @version SketchUp 6.0
|
466
|
+
def add_group(entities)
|
467
|
+
end
|
468
|
+
|
469
|
+
# The add_image method is used to add an image to the collection of entities.
|
470
|
+
#
|
471
|
+
# The width and height are measured in model units (i.e. inches). If the
|
472
|
+
# height is not given, then it is computed from the width to preserve the
|
473
|
+
# aspect ratio of the image.
|
474
|
+
#
|
475
|
+
# @example
|
476
|
+
# model = Sketchup.active_model
|
477
|
+
# entities = model.active_entities
|
478
|
+
# point = Geom::Point3d.new 10,20,30
|
479
|
+
# image = entities.add_image "Shapes.jpg", point, 300
|
480
|
+
# if (image)
|
481
|
+
# UI.messagebox image
|
482
|
+
# else
|
483
|
+
# UI.messagebox "Failure"
|
484
|
+
# end
|
485
|
+
#
|
486
|
+
# @param filename
|
487
|
+
# A filename for the image file.
|
488
|
+
#
|
489
|
+
# @param point
|
490
|
+
# A Point3d object representing the insertion point of
|
491
|
+
# the image.
|
492
|
+
#
|
493
|
+
# @param [optional] height
|
494
|
+
# height for the image if you want to control
|
495
|
+
# width and height independently.
|
496
|
+
#
|
497
|
+
# @param width
|
498
|
+
# Width for the image.
|
499
|
+
#
|
500
|
+
# @return image - an Image object if successful.
|
501
|
+
#
|
502
|
+
# @version SketchUp 6.0
|
503
|
+
def add_image(filename, point, width, height)
|
504
|
+
end
|
505
|
+
|
506
|
+
# The add_instance method adds a component instance to the collection of
|
507
|
+
# entities.
|
508
|
+
#
|
509
|
+
# @example
|
510
|
+
# point = Geom::Point3d.new 10,20,30
|
511
|
+
# transform = Geom::Transformation.new point
|
512
|
+
# model = Sketchup.active_model
|
513
|
+
# entities = model.active_entities
|
514
|
+
# path = Sketchup.find_support_file "Bed.skp",
|
515
|
+
# "Components/Components Sampler/"
|
516
|
+
# definitions = model.definitions
|
517
|
+
# componentdefinition = definitions.load path
|
518
|
+
# instance = entities.add_instance componentdefinition, transform
|
519
|
+
# if (instance)
|
520
|
+
# UI.messagebox instance
|
521
|
+
# else
|
522
|
+
# UI.messagebox "Failure"
|
523
|
+
# end
|
524
|
+
#
|
525
|
+
# @param definition
|
526
|
+
# A ComponentDefinition object.
|
527
|
+
#
|
528
|
+
# @param transform
|
529
|
+
# A Transformation object.
|
530
|
+
#
|
531
|
+
# @return componentinstance - a ComponentInstance object if
|
532
|
+
# successful
|
533
|
+
#
|
534
|
+
# @version SketchUp 6.0
|
535
|
+
def add_instance(definition, transform)
|
536
|
+
end
|
537
|
+
|
538
|
+
# The add_line method is used to add an edge to the collection of entities.
|
539
|
+
# This is not to be confused with the concept of a "line" from a geometric
|
540
|
+
# sense, which is an invisible object represented by an Array of a point
|
541
|
+
# and a vector. (See the Array class for more information on geometric lines in
|
542
|
+
# SketchUp.)
|
543
|
+
#
|
544
|
+
# This method is the same as add_edges method, but returns a single edge.
|
545
|
+
#
|
546
|
+
# @example
|
547
|
+
# model = Sketchup.active_model
|
548
|
+
# entities = model.active_entities
|
549
|
+
# point1 = Geom::Point3d.new(0,0,0)
|
550
|
+
# point2 = Geom::Point3d.new(20,20,20)
|
551
|
+
# line = entities.add_line point1,point2
|
552
|
+
# if (line)
|
553
|
+
# UI.messagebox line
|
554
|
+
# else
|
555
|
+
# UI.messagebox "Failure"
|
556
|
+
# end
|
557
|
+
#
|
558
|
+
# @param point1
|
559
|
+
# Point3d object representing the edge's starting point.
|
560
|
+
#
|
561
|
+
# @param point2
|
562
|
+
# Point3d object representing the edge's ending point.
|
563
|
+
#
|
564
|
+
# @return edge - a Edge object if successful
|
565
|
+
#
|
566
|
+
# @version SketchUp 6.0
|
567
|
+
def add_line(point1, point2)
|
568
|
+
end
|
569
|
+
|
570
|
+
# The add_ngon method is used to create a multi-sided polygon.
|
571
|
+
#
|
572
|
+
# @example
|
573
|
+
# entities = Sketchup.active_model.entities
|
574
|
+
# center = Geom::Point3d.new
|
575
|
+
# normal = Geom::Vector3d.new(0,0,1)
|
576
|
+
# radius = 100
|
577
|
+
# numsides = 6
|
578
|
+
# edges = entities.add_ngon center, normal, radius, numsides
|
579
|
+
#
|
580
|
+
# @param center
|
581
|
+
# A Point3d object representing the center of the polygon.
|
582
|
+
#
|
583
|
+
# @param normal
|
584
|
+
# A Vector3d object.
|
585
|
+
#
|
586
|
+
# @param numsides
|
587
|
+
# The number of sides for the polygon.
|
588
|
+
#
|
589
|
+
# @param radius
|
590
|
+
# A radius.
|
591
|
+
#
|
592
|
+
# @return edges - an array of Edges that make up the polygon if
|
593
|
+
# successful
|
594
|
+
#
|
595
|
+
# @version SketchUp 6.0
|
596
|
+
def add_ngon(center, normal, radius, numsides = 24)
|
597
|
+
end
|
598
|
+
|
599
|
+
# The add_observer method is used to add an observer to the current object.
|
600
|
+
#
|
601
|
+
# @example
|
602
|
+
# entities = Sketchup.active_model.entities
|
603
|
+
# status = entities.add_observer observer
|
604
|
+
#
|
605
|
+
# @param observer
|
606
|
+
# An observer.
|
607
|
+
#
|
608
|
+
# @return true if successful, false if unsuccessful.
|
609
|
+
#
|
610
|
+
# @version SketchUp 6.0
|
611
|
+
def add_observer(observer)
|
612
|
+
end
|
613
|
+
|
614
|
+
# The add_section_plane method adds a section plane object to the entities.
|
615
|
+
#
|
616
|
+
# @example
|
617
|
+
# # Create a section plane
|
618
|
+
# model = Sketchup.active_model
|
619
|
+
# sp = model.entities.add_section_plane([50, 50, 0], [1.0, 1.0, 0])
|
620
|
+
# # Activate it
|
621
|
+
# sp.activate
|
622
|
+
# # Make sure section planes are visible
|
623
|
+
# model.rendering_options['DisplaySectionPlanes'] = true
|
624
|
+
#
|
625
|
+
# @param plane
|
626
|
+
# the geometric plane where the SectionPlane object is to
|
627
|
+
# be created. Refer to the Geom module for information on
|
628
|
+
# how planes are represented.
|
629
|
+
#
|
630
|
+
# @return the created SectionPlane object if successful, nil on
|
631
|
+
# failure.
|
632
|
+
#
|
633
|
+
# @version SketchUp 2014
|
634
|
+
def add_section_plane(plane)
|
635
|
+
end
|
636
|
+
|
637
|
+
# The add_text method adds a note or label text entity to the entities
|
638
|
+
#
|
639
|
+
# @example
|
640
|
+
# coordinates = [10, 10, 10]
|
641
|
+
# model = Sketchup.active_model
|
642
|
+
# entities = model.entities
|
643
|
+
# point = Geom::Point3d.new coordinates
|
644
|
+
# text = entities.add_text "This is a Test", point
|
645
|
+
#
|
646
|
+
# @param text
|
647
|
+
# The text string to add.
|
648
|
+
#
|
649
|
+
# @param point
|
650
|
+
# A Point3d object representing the insertion point.
|
651
|
+
#
|
652
|
+
# @param [optional] vector
|
653
|
+
# vector representing an arrow leader.
|
654
|
+
#
|
655
|
+
# @return text - a Text object if successful
|
656
|
+
#
|
657
|
+
# @version SketchUp 6.0
|
658
|
+
def add_text(text, point, vector)
|
659
|
+
end
|
660
|
+
|
661
|
+
# The {#[]} method is used to retrieve an entity by its index in an array of
|
662
|
+
# entities. The index is a number between +0+ and entities.length - 1. In
|
663
|
+
# general, it is preferable to use the {#each} method to iterate though all
|
664
|
+
# of the entities in the collection as it will be much more efficient.
|
665
|
+
#
|
666
|
+
# The {#at} method is an alias of {#[]}
|
667
|
+
#
|
668
|
+
# @example
|
669
|
+
# entities = Sketchup.active_model.entities
|
670
|
+
# entity0 = entities[0]
|
671
|
+
# if (entity0)
|
672
|
+
# UI.messagebox entity0
|
673
|
+
# else
|
674
|
+
# UI.messagebox "Failure"
|
675
|
+
# end
|
676
|
+
#
|
677
|
+
# @param [Integer] entity_index
|
678
|
+
# The index for a specific entity.
|
679
|
+
#
|
680
|
+
# @return [Sketchup::Entity, nil] an {Sketchup::Entity} object if successful,
|
681
|
+
# +nil+ if not found
|
682
|
+
#
|
683
|
+
# @version SketchUp 6.0
|
684
|
+
def at(entity_index)
|
685
|
+
end
|
686
|
+
|
687
|
+
# The clear! method is used to remove all entities from the collection of
|
688
|
+
# entities.
|
689
|
+
#
|
690
|
+
# @example
|
691
|
+
# coordinates = [10, 10, 10]
|
692
|
+
# model = Sketchup.active_model
|
693
|
+
# entities = model.entities
|
694
|
+
# point = Geom::Point3d.new coordinates
|
695
|
+
# text = entities.add_text "This is a Test", point
|
696
|
+
# UI.messagebox "Clearing All"
|
697
|
+
# status = entities.clear!
|
698
|
+
#
|
699
|
+
# @return status - true if successful, false if unsuccessful
|
700
|
+
#
|
701
|
+
# @version SketchUp 6.0
|
702
|
+
def clear!
|
703
|
+
end
|
704
|
+
|
705
|
+
#
|
706
|
+
# @example
|
707
|
+
# model = Sketchup.active_model
|
708
|
+
# entities = model.entities
|
709
|
+
# entities.add_cpoint([10, 10, 10])
|
710
|
+
# number = entities.count
|
711
|
+
#
|
712
|
+
# @note Since SketchUp 2014 the count method is inherited from Ruby's
|
713
|
+
# +Enumable+ mix-in module. Prior to that the {#count} method is an alias
|
714
|
+
# for {#length}.
|
715
|
+
#
|
716
|
+
# @return [Integer]
|
717
|
+
#
|
718
|
+
# @see #length
|
719
|
+
#
|
720
|
+
# @version SketchUp 6.0
|
721
|
+
def count
|
722
|
+
end
|
723
|
+
|
724
|
+
# The each method is used to iterate through the entities in the collection of
|
725
|
+
# entities.
|
726
|
+
#
|
727
|
+
# @example
|
728
|
+
# coordinates = [10, 10, 10]
|
729
|
+
# model = Sketchup.active_model
|
730
|
+
# entities = model.entities
|
731
|
+
# point = Geom::Point3d.new coordinates
|
732
|
+
# text = entities.add_text "This is a Test", point
|
733
|
+
# entities.each { | entity| UI.messagebox entity }
|
734
|
+
#
|
735
|
+
# @return nil
|
736
|
+
#
|
737
|
+
# @version SketchUp 6.0
|
738
|
+
#
|
739
|
+
# @yield [entity] A variable that will hold each Entity object as they are
|
740
|
+
# found if successful.
|
741
|
+
def each
|
742
|
+
end
|
743
|
+
|
744
|
+
# The erase_entities method is used to erase one or more entities from the
|
745
|
+
# model.
|
746
|
+
#
|
747
|
+
# @example
|
748
|
+
# depth = 100
|
749
|
+
# width = 100
|
750
|
+
# model = Sketchup.active_model
|
751
|
+
# entities = model.active_entities
|
752
|
+
# pts = []
|
753
|
+
# pts[0] = [0, 0, 0]
|
754
|
+
# pts[1] = [width, 0, 0]
|
755
|
+
# pts[2] = [width, depth, 0]
|
756
|
+
# pts[3] = [0, depth, 0]
|
757
|
+
#
|
758
|
+
# # Add the face to the entities in the model
|
759
|
+
# face = entities.add_face pts
|
760
|
+
#
|
761
|
+
# # I just happen to know that the second entity in the
|
762
|
+
# # entities objects is an edge, so erase it.
|
763
|
+
# UI.messagebox entities
|
764
|
+
# entities.erase_entities entities[1]
|
765
|
+
# UI.messagebox entities
|
766
|
+
#
|
767
|
+
# @param entities
|
768
|
+
# An entity or array of entities.
|
769
|
+
#
|
770
|
+
# @return nil
|
771
|
+
#
|
772
|
+
# @version SketchUp 6.0
|
773
|
+
def erase_entities(entities)
|
774
|
+
end
|
775
|
+
|
776
|
+
# The {#fill_from_mesh} method is used to add faces and edges to the collection
|
777
|
+
# of entities from a {Geom::PolygonMesh}. It requires that the entities
|
778
|
+
# collection to be filled is empty. It has higher performance than
|
779
|
+
# {#add_faces_from_mesh}, but does less error checking as it builds the
|
780
|
+
# geometry.
|
781
|
+
#
|
782
|
+
# The +smooth_flags+ parameter can contain any of the following values if
|
783
|
+
# passed. The constants were added in SketchUp 2014. For previous versions,
|
784
|
+
# numeric values have to be specified instead of the Ruby constants:
|
785
|
+
#
|
786
|
+
# - 0: {Geom::PolygonMesh::NO_SMOOTH_OR_HIDE}
|
787
|
+
# - 1: {Geom::PolygonMesh::HIDE_BASED_ON_INDEX} (Negative point index will hide the edge.)
|
788
|
+
# - 2: {Geom::PolygonMesh::SOFTEN_BASED_ON_INDEX} (Negative point index will soften the edge.)
|
789
|
+
# - 4: {Geom::PolygonMesh::AUTO_SOFTEN} (Interior edges are softened.)
|
790
|
+
# - 8: {Geom::PolygonMesh::SMOOTH_SOFT_EDGES} (All soft edges will also be smooth.)
|
791
|
+
#
|
792
|
+
# The 4rd and 5th parameters will accept a {Sketchup::Material} object or a
|
793
|
+
# string name of a material currently in the model.
|
794
|
+
#
|
795
|
+
# @example
|
796
|
+
# pm = Geom::PolygonMesh.new
|
797
|
+
# pm.add_point([ 0, 0, 0]) # 1
|
798
|
+
# pm.add_point([10, 0, 0]) # 2
|
799
|
+
# pm.add_point([10,10, 0]) # 3
|
800
|
+
# pm.add_point([ 0,10, 0]) # 4
|
801
|
+
# pm.add_point([20, 0, 5]) # 5
|
802
|
+
# pm.add_point([20,10, 5]) # 6
|
803
|
+
# pm.add_polygon(1, -2, 3, 4)
|
804
|
+
# pm.add_polygon(2, 5, 6, -3)
|
805
|
+
#
|
806
|
+
# # Create a new group that we will populate with the mesh.
|
807
|
+
# group = Sketchup.active_model.entities.add_group
|
808
|
+
# material = Sketchup.active_model.materials.add('red')
|
809
|
+
# smooth_flags = Geom::PolygonMesh::HIDE_BASED_ON_INDEX
|
810
|
+
# group.entities.fill_from_mesh(pm, true, smooth_flags, material)
|
811
|
+
#
|
812
|
+
# @param [Boolean] weld_vertices
|
813
|
+
# This argument has no effect and is kept for
|
814
|
+
# compatibility reasons. Points are always
|
815
|
+
# merged.
|
816
|
+
#
|
817
|
+
# @param [Geom::PolygonMesh] polygon_mesh
|
818
|
+
#
|
819
|
+
# @param [Integer] smooth_flags
|
820
|
+
# flags for softening and smoothing of edges.
|
821
|
+
#
|
822
|
+
# @param [Sketchup::Material, String] b_material
|
823
|
+
# material to paint back faces with.
|
824
|
+
#
|
825
|
+
# @param [Sketchup::Material, String] f_material
|
826
|
+
# material to paint front faces with.
|
827
|
+
#
|
828
|
+
# @return [Boolean]
|
829
|
+
#
|
830
|
+
# @version SketchUp 6.0
|
831
|
+
def fill_from_mesh(polygon_mesh, weld_vertices = true, smooth_flags = Geom::PolygonMesh::AUTO_SOFTEN|Geom::PolygonMesh::SMOOTH_SOFT_EDGES, f_material = nil, b_material = nil)
|
832
|
+
end
|
833
|
+
|
834
|
+
# The intersect_with method is used to intersect an entities, component
|
835
|
+
# instance, or group object with a entities object.
|
836
|
+
#
|
837
|
+
# @example
|
838
|
+
# entities.intersect_with recurse, transformation1, entities1,
|
839
|
+
# transformation2, hidden, entities2
|
840
|
+
#
|
841
|
+
# @param transform1
|
842
|
+
# The transformation for this entities object.
|
843
|
+
#
|
844
|
+
# @param recurse
|
845
|
+
# true if you want this entities object to be recursed
|
846
|
+
# (intersection lines will be put inside of groups and
|
847
|
+
# components within this entities object).
|
848
|
+
#
|
849
|
+
# @param entities1
|
850
|
+
# The entities object where you want the intersection
|
851
|
+
# lines to appear.
|
852
|
+
#
|
853
|
+
# @param entities2
|
854
|
+
# A single entity, or an array of entities.
|
855
|
+
#
|
856
|
+
# @param transform2
|
857
|
+
# The transformation for entities1.
|
858
|
+
#
|
859
|
+
# @param hidden
|
860
|
+
# true if you want hidden geometry in this entities
|
861
|
+
# object to be used in the intersection.
|
862
|
+
#
|
863
|
+
# @return nil
|
864
|
+
#
|
865
|
+
# @version SketchUp 6.0
|
866
|
+
def intersect_with(recurse, transform1, entities1, transform2, hidden, entities2)
|
867
|
+
end
|
868
|
+
|
869
|
+
# The {#length} method is used to retrieve the number of entities in the
|
870
|
+
# collection of entities.
|
871
|
+
#
|
872
|
+
# The {#size} method is an alias for {#length} added in SketchUp 2014.
|
873
|
+
#
|
874
|
+
# @example
|
875
|
+
# model = Sketchup.active_model
|
876
|
+
# entities = model.entities
|
877
|
+
# entities.add_cpoint([10, 10, 10])
|
878
|
+
# number = entities.length
|
879
|
+
#
|
880
|
+
# @return [Integer] the number of entities in the collection of
|
881
|
+
# entities if successful
|
882
|
+
#
|
883
|
+
# @version SketchUp 6.0
|
884
|
+
def length
|
885
|
+
end
|
886
|
+
|
887
|
+
# The model method is used to retrieve the model that contains the collection
|
888
|
+
# of entities.
|
889
|
+
#
|
890
|
+
# @example
|
891
|
+
# coordinates = [10, 10, 10]
|
892
|
+
# model = Sketchup.active_model
|
893
|
+
# entities = model.entities
|
894
|
+
# point = Geom::Point3d.new coordinates
|
895
|
+
# text = entities.add_text "This is a Test", point
|
896
|
+
# model = entities.model
|
897
|
+
#
|
898
|
+
# @return model - the model that contains the collection of
|
899
|
+
# entities if successful.
|
900
|
+
#
|
901
|
+
# @version SketchUp 6.0
|
902
|
+
def model
|
903
|
+
end
|
904
|
+
|
905
|
+
# The parent method is used to retrieve the parent or object that contains the
|
906
|
+
# collection of entities. A parent can be either a Model or
|
907
|
+
# ComponentDefinition object.
|
908
|
+
#
|
909
|
+
# @example
|
910
|
+
# coordinates = [10, 10, 10]
|
911
|
+
# model = Sketchup.active_model
|
912
|
+
# entities = model.entities
|
913
|
+
# point = Geom::Point3d.new coordinates
|
914
|
+
# text = entities.add_text "This is a Test", point
|
915
|
+
# parent = entities.parent
|
916
|
+
#
|
917
|
+
# @return parent - the object that contains the collection of
|
918
|
+
# entities if successful
|
919
|
+
#
|
920
|
+
# @version SketchUp 6.0
|
921
|
+
def parent
|
922
|
+
end
|
923
|
+
|
924
|
+
# The remove_observer method is used to remove an observer from the current
|
925
|
+
# object.
|
926
|
+
#
|
927
|
+
# @example
|
928
|
+
# entities = Sketchup.active_model.entities
|
929
|
+
# status = entities.remove_observer observer
|
930
|
+
#
|
931
|
+
# @param observer
|
932
|
+
# An observer.
|
933
|
+
#
|
934
|
+
# @return true if successful, false if unsuccessful.
|
935
|
+
#
|
936
|
+
# @version SketchUp 6.0
|
937
|
+
def remove_observer(observer)
|
938
|
+
end
|
939
|
+
|
940
|
+
# The {#length} method is used to retrieve the number of entities in the
|
941
|
+
# collection of entities.
|
942
|
+
#
|
943
|
+
# The {#size} method is an alias for {#length} added in SketchUp 2014.
|
944
|
+
#
|
945
|
+
# @example
|
946
|
+
# model = Sketchup.active_model
|
947
|
+
# entities = model.entities
|
948
|
+
# entities.add_cpoint([10, 10, 10])
|
949
|
+
# number = entities.length
|
950
|
+
#
|
951
|
+
# @return [Integer] the number of entities in the collection of
|
952
|
+
# entities if successful
|
953
|
+
#
|
954
|
+
# @version SketchUp 6.0
|
955
|
+
def size
|
956
|
+
end
|
957
|
+
|
958
|
+
# The transform_by_vectors method is used to apply several vectors to several
|
959
|
+
# sub-entities all at once.
|
960
|
+
#
|
961
|
+
# @example
|
962
|
+
# # Need better Ruby example.
|
963
|
+
# entities = entities.transform_by_vectors sub_entities, vector_array
|
964
|
+
#
|
965
|
+
# @param sub_entities
|
966
|
+
# An array of entities to transform.
|
967
|
+
#
|
968
|
+
# @param vectors
|
969
|
+
# An array of vectors to apply.
|
970
|
+
#
|
971
|
+
# @return nil
|
972
|
+
#
|
973
|
+
# @version SketchUp 6.0
|
974
|
+
def transform_by_vectors(sub_entities, vectors)
|
975
|
+
end
|
976
|
+
|
977
|
+
# The transform_entities method is used to apply a transform to several
|
978
|
+
# sub-entities all at once.
|
979
|
+
#
|
980
|
+
# Important note: If you apply a transformation to entities that are
|
981
|
+
# not in the current edit context (i.e. faces that are inside a group),
|
982
|
+
# SketchUp will apply the transformation incorrectly, since the geometry
|
983
|
+
# has one origin and the current edit context has another. You can correct
|
984
|
+
# for this by watching the Model.edit_transform and Model.active_path. See
|
985
|
+
# ModelObserver.onActivePathChanged for more information.
|
986
|
+
#
|
987
|
+
# @example
|
988
|
+
# entities = Sketchup.active_model.entities
|
989
|
+
# entities.add_line([0,0,0],[100,100,100])
|
990
|
+
# entities.add_line([0,0,0],[200,-10,-10])
|
991
|
+
#
|
992
|
+
# entities_to_transform = []
|
993
|
+
# entities_to_transform.push(entities[0])
|
994
|
+
# entities_to_transform.push(entities[1])
|
995
|
+
#
|
996
|
+
# transform = Geom::Transformation.new([100,0,0])
|
997
|
+
# entities.transform_entities(transform, ent1, ent2, ent3)
|
998
|
+
#
|
999
|
+
# @param transform
|
1000
|
+
# The Transformation to apply.
|
1001
|
+
#
|
1002
|
+
# @param entities
|
1003
|
+
# An array or series of entities to transform.
|
1004
|
+
#
|
1005
|
+
# @return status - results of the transform.
|
1006
|
+
#
|
1007
|
+
# @version SketchUp 6.0
|
1008
|
+
def transform_entities(transform, entities)
|
1009
|
+
end
|
1010
|
+
|
1011
|
+
end
|