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,593 +1,593 @@
|
|
1
|
-
# Copyright:: Copyright
|
2
|
-
# License:: The MIT License (MIT)
|
3
|
-
|
4
|
-
# The {Sketchup::ComponentInstance} class is used to represent component
|
5
|
-
# instances of a component definition or components that have been dragged from
|
6
|
-
# the Component Browser and placed (thus, instanced) within the Model.
|
7
|
-
# Therefore, the ComponentInstance class contains a reference to a
|
8
|
-
# corresponding ComponentDefinition object and a Transformation object (which
|
9
|
-
# contains the location of the component in the Drawing Window).
|
10
|
-
#
|
11
|
-
# Starting from SketchUp 2018+, the {Sketchup::ComponentInstance} class
|
12
|
-
# contains default attributes when created or imported. The attributes
|
13
|
-
# are: "Owner", "Status". See the
|
14
|
-
# {https://help.sketchup.com/en/article/3000124 Help article} for more
|
15
|
-
# information. The dictionary cannot be deleted via ruby and an @raise ArgumentError
|
16
|
-
# will be raised. The key/value pairs in the dictionary can be deleted safely.
|
17
|
-
#
|
18
|
-
# @version SketchUp 6.0
|
19
|
-
class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
20
|
-
|
21
|
-
# Instance Methods
|
22
|
-
|
23
|
-
# The add_observer method is used to add an observer to the current object.
|
24
|
-
#
|
25
|
-
# @example
|
26
|
-
# entities = Sketchup.active_model.entities
|
27
|
-
# definition = Sketchup.active_model.definitions[0]
|
28
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
29
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
30
|
-
# status = componentinstance.add_observer observer
|
31
|
-
#
|
32
|
-
# @param [Object] observer
|
33
|
-
# An observer.
|
34
|
-
#
|
35
|
-
# @return [Boolean] true if successful, false if unsuccessful.
|
36
|
-
#
|
37
|
-
# @version SketchUp 6.0
|
38
|
-
def add_observer(observer)
|
39
|
-
end
|
40
|
-
|
41
|
-
# The definition method is used to retrieve the component definition for this
|
42
|
-
# component instance.
|
43
|
-
#
|
44
|
-
# @example
|
45
|
-
# # First create an instance for us to look at.
|
46
|
-
# entities = Sketchup.active_model.entities
|
47
|
-
# definition = Sketchup.active_model.definitions[0]
|
48
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
49
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
50
|
-
#
|
51
|
-
# # You can get an instance's definition with this method.
|
52
|
-
# definition = componentinstance.definition
|
53
|
-
#
|
54
|
-
# @return [Sketchup::ComponentDefinition] a ComponentDefinition object if
|
55
|
-
# successful
|
56
|
-
#
|
57
|
-
# @version SketchUp 6.0
|
58
|
-
def definition
|
59
|
-
end
|
60
|
-
|
61
|
-
# The definition= method is used to set the component definition for this
|
62
|
-
# component.
|
63
|
-
#
|
64
|
-
# This method causes the instance to use a different definition, but it will
|
65
|
-
# use the same transformation to position it in the Model.
|
66
|
-
#
|
67
|
-
# @example
|
68
|
-
# # Assumes that the active model contains two different components.
|
69
|
-
# instance1 = Sketchup.active_model.entities[0]
|
70
|
-
# instance2 = Sketchup.active_model.entities[1]
|
71
|
-
#
|
72
|
-
# # Grab handles to our two definitions.
|
73
|
-
# definition1 = instance1.definition
|
74
|
-
# definition2 = instance2.definition
|
75
|
-
#
|
76
|
-
# # Replace 2nd instance with the 1st definition.
|
77
|
-
# instance2.definition = definition1
|
78
|
-
#
|
79
|
-
# @param [Sketchup::ComponentDefinition] definition
|
80
|
-
# A ComponentDefinition object to set.
|
81
|
-
#
|
82
|
-
# @return [Sketchup::ComponentDefinition] the ComponentDefinition object
|
83
|
-
# that was set if successful, false if unsuccessful
|
84
|
-
#
|
85
|
-
# @version SketchUp 6.0
|
86
|
-
def definition=(definition)
|
87
|
-
end
|
88
|
-
|
89
|
-
# The equals? method is used to determine if a component instance is
|
90
|
-
# geometrically equivalent to another instance.
|
91
|
-
#
|
92
|
-
# @example
|
93
|
-
# entities = Sketchup.active_model.entities
|
94
|
-
# instance1 = entities[0]
|
95
|
-
# instance2 = entities[1]
|
96
|
-
# status = instance1.equals?(instance2)
|
97
|
-
#
|
98
|
-
# @param [Sketchup::ComponentInstance] instance
|
99
|
-
# The instance to compare this instance with.
|
100
|
-
#
|
101
|
-
# @return [Boolean]
|
102
|
-
#
|
103
|
-
# @version SketchUp 8.0
|
104
|
-
def equals?(instance)
|
105
|
-
end
|
106
|
-
|
107
|
-
# The explode method is used to explode the component instance into separate
|
108
|
-
# entities.
|
109
|
-
#
|
110
|
-
# @example
|
111
|
-
# # Assuming 'instance' is a ComponentInstance object
|
112
|
-
# array = instance.explode
|
113
|
-
# if array
|
114
|
-
# UI.messagebox "Exploded the component instance"
|
115
|
-
# else
|
116
|
-
# UI.messagebox "Failure"
|
117
|
-
# end
|
118
|
-
#
|
119
|
-
# @return [Array<Sketchup:Entity>] An array of entity objects if successful, false if
|
120
|
-
# unsuccessful
|
121
|
-
#
|
122
|
-
# @version SketchUp 6.0
|
123
|
-
def explode
|
124
|
-
end
|
125
|
-
|
126
|
-
# The glued_to method is used to retrieve the entity that this instance is
|
127
|
-
# glued to.
|
128
|
-
#
|
129
|
-
# Returns nil if it is not glued to anything.
|
130
|
-
#
|
131
|
-
# @example
|
132
|
-
# point = Geom::Point3d.new 10,20,30
|
133
|
-
# transform = Geom::Transformation.new point
|
134
|
-
# model = Sketchup.active_model
|
135
|
-
# entities = model.active_entities
|
136
|
-
# path = Sketchup.find_support_file "Bed.skp",
|
137
|
-
# "Components/Components Sampler/"
|
138
|
-
# definitions = model.definitions
|
139
|
-
# componentdefinition = definitions.load path
|
140
|
-
# instance = entities.add_instance componentdefinition, transform
|
141
|
-
# status = instance.glued_to
|
142
|
-
#
|
143
|
-
# @return [Sketchup::Face, nil] the Entity object that the instance is glued
|
144
|
-
# to (if successful)
|
145
|
-
#
|
146
|
-
# @version SketchUp 6.0
|
147
|
-
def glued_to
|
148
|
-
end
|
149
|
-
|
150
|
-
# The glued_to= method glues this instance to a face.
|
151
|
-
#
|
152
|
-
# This method will raise an exception if the instance cannot be glued to the
|
153
|
-
# given face. Instances cannot be glued if the definition of the instance
|
154
|
-
# doesn't support gluing or if the alignment is wrong.
|
155
|
-
#
|
156
|
-
# @example
|
157
|
-
# depth = 100
|
158
|
-
# width = 100
|
159
|
-
# path=Sketchup.find_support_file "Bed.skp",
|
160
|
-
# "Components/Components Sampler/"
|
161
|
-
# model = Sketchup.active_model
|
162
|
-
# entities = model.active_entities
|
163
|
-
# pts = []
|
164
|
-
# pts[0] = [0, 0, 0]
|
165
|
-
# pts[1] = [width, 0, 0]
|
166
|
-
# pts[2] = [width, depth, 0]
|
167
|
-
# pts[3] = [0, depth, 0]
|
168
|
-
# # Add the face to the entities in the model
|
169
|
-
# face = entities.add_face pts
|
170
|
-
# point = Geom::Point3d.new 10,10,0
|
171
|
-
# transform = Geom::Transformation.new point
|
172
|
-
# definitions = model.definitions
|
173
|
-
# componentdefinition = definitions.load path
|
174
|
-
# instance = entities.add_instance componentdefinition, transform
|
175
|
-
# begin
|
176
|
-
# status = instance.glued_to = face
|
177
|
-
# rescue
|
178
|
-
# UI.messagebox $!.message
|
179
|
-
# end
|
180
|
-
# if (status)
|
181
|
-
# UI.messagebox status.to_s
|
182
|
-
# else
|
183
|
-
# UI.messagebox "Failure"
|
184
|
-
# end
|
185
|
-
#
|
186
|
-
# @param [Sketchup::Face, nil] face
|
187
|
-
#
|
188
|
-
# @return [Sketchup::Face, nil] - the Face object where the component is glued if
|
189
|
-
# successful
|
190
|
-
#
|
191
|
-
# @version SketchUp 6.0
|
192
|
-
def glued_to=(face)
|
193
|
-
end
|
194
|
-
|
195
|
-
# The guid method is used to get the base 64 encoded unique id
|
196
|
-
# for this SketchUp object.
|
197
|
-
#
|
198
|
-
# @example
|
199
|
-
# entities = Sketchup.active_model.entities
|
200
|
-
# definition = Sketchup.active_model.definitions[0]
|
201
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
202
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
203
|
-
# guid = componentinstance.guid
|
204
|
-
#
|
205
|
-
# @return [String] a unique 22 character string
|
206
|
-
#
|
207
|
-
# @version SketchUp 2014
|
208
|
-
def guid
|
209
|
-
end
|
210
|
-
|
211
|
-
# The intersect method is used to compute the boolean intersection of two
|
212
|
-
# instances representing manifold solid volumes (this - arg). If the specified
|
213
|
-
# objects (this and arg) do not represent manifold volumes, this method fails.
|
214
|
-
#
|
215
|
-
# @example
|
216
|
-
# entities = Sketchup.active_model.entities
|
217
|
-
# instance1 = entities[0]
|
218
|
-
# instance2 = entities[1]
|
219
|
-
# result = instance1.intersect(instance2)
|
220
|
-
#
|
221
|
-
# @param [Sketchup::ComponentInstance] instance
|
222
|
-
# The instance to intersect this instance with.
|
223
|
-
#
|
224
|
-
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
225
|
-
# (this and arg) represent manifold solids and the
|
226
|
-
# operation succeeds otherwise nil is returned.
|
227
|
-
#
|
228
|
-
# @version SketchUp 8.0
|
229
|
-
def intersect(instance)
|
230
|
-
end
|
231
|
-
|
232
|
-
# The locked= method is used to lock a component instance.
|
233
|
-
#
|
234
|
-
# @example
|
235
|
-
# entities = Sketchup.active_model.entities
|
236
|
-
# definition = Sketchup.active_model.definitions[0]
|
237
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
238
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
239
|
-
# status = componentinstance.locked = true
|
240
|
-
#
|
241
|
-
# @param [Boolean] lock
|
242
|
-
#
|
243
|
-
# @return [Boolean] true if the component instance is locked.
|
244
|
-
# False if the instance is not locked.
|
245
|
-
#
|
246
|
-
# @version SketchUp 6.0
|
247
|
-
def locked=(lock)
|
248
|
-
end
|
249
|
-
|
250
|
-
# The locked? method is used to determine if a component instance is locked.
|
251
|
-
#
|
252
|
-
# @example
|
253
|
-
# entities = Sketchup.active_model.entities
|
254
|
-
# definition = Sketchup.active_model.definitions[0]
|
255
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
256
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
257
|
-
# status = componentinstance.locked?
|
258
|
-
#
|
259
|
-
# @return [Boolean]
|
260
|
-
#
|
261
|
-
# @version SketchUp 6.0
|
262
|
-
def locked?
|
263
|
-
end
|
264
|
-
|
265
|
-
# The {#make_unique} method is used to create a component definition for this
|
266
|
-
# instance that is not used by any other instances.
|
267
|
-
#
|
268
|
-
# @example
|
269
|
-
# point = Geom::Point3d.new(10,20,30)
|
270
|
-
# transform = Geom::Transformation.new(point)
|
271
|
-
# model = Sketchup.active_model
|
272
|
-
# entities = model.active_entities
|
273
|
-
#
|
274
|
-
# path = Sketchup.find_support_file("Bed.skp",
|
275
|
-
# "Components/Components Sampler/")
|
276
|
-
# definitions = model.definitions
|
277
|
-
# componentdefinition = definitions.load(path)
|
278
|
-
# instance = entities.add_instance(componentdefinition, transform)
|
279
|
-
# # Returns unique component instance
|
280
|
-
# instance.make_unique
|
281
|
-
#
|
282
|
-
# @return [Sketchup::ComponentInstance] returns itself
|
283
|
-
#
|
284
|
-
# @version SketchUp 6.0
|
285
|
-
def make_unique
|
286
|
-
end
|
287
|
-
|
288
|
-
# The manifold? method is used to determine if an instance is manifold.
|
289
|
-
#
|
290
|
-
# @example
|
291
|
-
# entities = Sketchup.active_model.entities
|
292
|
-
# definition = Sketchup.active_model.definitions[0]
|
293
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
294
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
295
|
-
# status = componentinstance.manifold?
|
296
|
-
#
|
297
|
-
# @return [Boolean]
|
298
|
-
#
|
299
|
-
# @version SketchUp 8.0
|
300
|
-
def manifold?
|
301
|
-
end
|
302
|
-
|
303
|
-
# The move! method is the same as the transform! method, except that it does
|
304
|
-
# not record the move as an undo operation.
|
305
|
-
#
|
306
|
-
# This method is useful for moving entities inside of an animation or page
|
307
|
-
# transition.
|
308
|
-
#
|
309
|
-
# @example
|
310
|
-
# entities = Sketchup.active_model.entities
|
311
|
-
# definition = Sketchup.active_model.definitions[0]
|
312
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
313
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
314
|
-
# new_transformation = Geom::Transformation.new([100,0,0])
|
315
|
-
# componentinstance.move! new_transformation
|
316
|
-
#
|
317
|
-
# @param [Geom::Transformation] transform
|
318
|
-
# The transform object to apply to the component instance.
|
319
|
-
#
|
320
|
-
# @return [Boolean] true if successful, false if unsuccessful
|
321
|
-
#
|
322
|
-
# @version SketchUp 6.0
|
323
|
-
def move!(transform)
|
324
|
-
end
|
325
|
-
|
326
|
-
# The name method is used to get the name of this instance.
|
327
|
-
#
|
328
|
-
# @example
|
329
|
-
# entities = Sketchup.active_model.entities
|
330
|
-
# definition = Sketchup.active_model.definitions[0]
|
331
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
332
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
333
|
-
# name = componentinstance.name
|
334
|
-
#
|
335
|
-
# @return [String] the string name of the ComponentInstance
|
336
|
-
#
|
337
|
-
# @version SketchUp 6.0
|
338
|
-
def name
|
339
|
-
end
|
340
|
-
|
341
|
-
# The name method is used to set the name of this instance.
|
342
|
-
#
|
343
|
-
# @example
|
344
|
-
# entities = Sketchup.active_model.entities
|
345
|
-
# definition = Sketchup.active_model.definitions[0]
|
346
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
347
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
348
|
-
# componentinstance.name = "Sang"
|
349
|
-
#
|
350
|
-
# @param [String] name
|
351
|
-
# the string name to set
|
352
|
-
#
|
353
|
-
# @return [Sketchup::ComponentInstance] the newly named ComponentInstance
|
354
|
-
#
|
355
|
-
# @version SketchUp 6.0
|
356
|
-
def name=(name)
|
357
|
-
end
|
358
|
-
|
359
|
-
# The outer_shell method is used to compute the outer shell of the two
|
360
|
-
# instances representing manifold solid volumes (this || arg). If the specified
|
361
|
-
# objects (this and arg) do not represent manifold volumes, this method fails.
|
362
|
-
#
|
363
|
-
# @example
|
364
|
-
# entities = Sketchup.active_model.entities
|
365
|
-
# instance1 = entities[0]
|
366
|
-
# instance2 = entities[1]
|
367
|
-
# result = instance1.outer_shell(instance2)
|
368
|
-
#
|
369
|
-
# @param [Sketchup::ComponentInstance] instance
|
370
|
-
# The instance to outer shell this instance with.
|
371
|
-
#
|
372
|
-
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
373
|
-
# (this and arg) represent manifold solids and the
|
374
|
-
# operation succeeds otherwise nil is returned.
|
375
|
-
#
|
376
|
-
# @version SketchUp 8.0
|
377
|
-
def outer_shell(instance)
|
378
|
-
end
|
379
|
-
|
380
|
-
# The remove_observer method is used to remove an observer from the current
|
381
|
-
# object.
|
382
|
-
#
|
383
|
-
# @example
|
384
|
-
# entities = Sketchup.active_model.entities
|
385
|
-
# definition = Sketchup.active_model.definitions[0]
|
386
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
387
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
388
|
-
# status = componentinstance.remove_observer observer
|
389
|
-
#
|
390
|
-
# @param [Object] observer
|
391
|
-
# An observer.
|
392
|
-
#
|
393
|
-
# @return [Boolean] true if successful, false if unsuccessful.
|
394
|
-
#
|
395
|
-
# @version SketchUp 6.0
|
396
|
-
def remove_observer(observer)
|
397
|
-
end
|
398
|
-
|
399
|
-
# The show_differences method is used to determine if a component instance is
|
400
|
-
# geometrically equivalent to another instance and in addition move the non-
|
401
|
-
# matching and matching geometry to new layers.
|
402
|
-
#
|
403
|
-
# This method will move both instances to Layer0. Geometry that is the same
|
404
|
-
# in both components will be moved to a new layer named def_name + "_same".
|
405
|
-
# Geometry that is not the same will be moved to a layer named def_name +
|
406
|
-
# "_diff".
|
407
|
-
#
|
408
|
-
# If verbose is true, a list of all the geometry that is different
|
409
|
-
# from one component to the other is displayed texturally in the Ruby Console.
|
410
|
-
#
|
411
|
-
# @example
|
412
|
-
# entities = Sketchup.active_model.entities
|
413
|
-
# instance1 = entities[0]
|
414
|
-
# instance2 = entities[1]
|
415
|
-
# status = instance1.show_differences(instance2, true)
|
416
|
-
#
|
417
|
-
# @param [Sketchup::ComponentInstance] instance
|
418
|
-
# The instance to be compared with.
|
419
|
-
#
|
420
|
-
# @param [Boolean] verbose
|
421
|
-
# A boolean flag indicating whether to display a textural
|
422
|
-
# report of the found differences to the Ruby console.
|
423
|
-
#
|
424
|
-
# @return [Boolean] true if the instances are geometrically
|
425
|
-
# equivalent, otherwise false.
|
426
|
-
#
|
427
|
-
# @version SketchUp 8.0
|
428
|
-
def show_differences(instance, verbose)
|
429
|
-
end
|
430
|
-
|
431
|
-
# The split method is used to compute the boolean split (map overlay)of the two
|
432
|
-
# instances representing manifold solid volumes (this - arg). If the specified
|
433
|
-
# objects (this and arg) do not represent manifold volumes, this method fails.
|
434
|
-
#
|
435
|
-
# @example
|
436
|
-
# entities = Sketchup.active_model.entities
|
437
|
-
# instance1 = entities[0]
|
438
|
-
# instance2 = entities[1]
|
439
|
-
# result = instance1.split(instance2)
|
440
|
-
#
|
441
|
-
# @param [Sketchup::ComponentInstance, nil] instance
|
442
|
-
# The instance to split this instance with.
|
443
|
-
#
|
444
|
-
# @return [Array(Sketchup::Group, Sketchup::Group, Sketchup::Group)] A vector (array) of the three resultant groups
|
445
|
-
# if the two objects (this and arg) represent manifold
|
446
|
-
# solids and the operation succeeds otherwise nil is
|
447
|
-
# returned. The 3 groups are as follows: The intersection
|
448
|
-
# of volume 1 & volume 2, the difference of
|
449
|
-
# volume 1 minus volume 2, and the reverse difference of
|
450
|
-
# volume 2 minus volume 1.
|
451
|
-
#
|
452
|
-
# @version SketchUp 8.0
|
453
|
-
def split(instance)
|
454
|
-
end
|
455
|
-
|
456
|
-
# The subtract method is used to compute the boolean difference of the two
|
457
|
-
# instances representing manifold solid volumes (this - arg). If the specified
|
458
|
-
# objects (this and arg) do not represent manifold volumes, this method fails.
|
459
|
-
#
|
460
|
-
# @example
|
461
|
-
# entities = Sketchup.active_model.entities
|
462
|
-
# instance1 = entities[0]
|
463
|
-
# instance2 = entities[1]
|
464
|
-
# result = instance1.subtract(instance2)
|
465
|
-
#
|
466
|
-
# @param [Sketchup::ComponentInstance] instance
|
467
|
-
# The instance to subtract this instance from.
|
468
|
-
#
|
469
|
-
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
470
|
-
# (this and arg) represent manifold solids and the
|
471
|
-
# operation succeeds otherwise nil is returned.
|
472
|
-
#
|
473
|
-
# @version SketchUp 8.0
|
474
|
-
def subtract(instance)
|
475
|
-
end
|
476
|
-
|
477
|
-
# Apply a {Geom::Transformation} to a component instance.
|
478
|
-
#
|
479
|
-
# @example
|
480
|
-
# entities = Sketchup.active_model.entities
|
481
|
-
# definition = Sketchup.active_model.definitions[0]
|
482
|
-
# transformation = Geom::Transformation.new([0, 0, 0])
|
483
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
484
|
-
# new_transformation = Geom::Transformation.new([100, 0, 0])
|
485
|
-
# componentinstance.transform! new_transformation
|
486
|
-
#
|
487
|
-
# @param [Geom::Transformation] transform
|
488
|
-
# The transformation object to apply to the component instance.
|
489
|
-
#
|
490
|
-
# @return [Boolean]
|
491
|
-
#
|
492
|
-
# @version SketchUp 6.0
|
493
|
-
def transform!(transform)
|
494
|
-
end
|
495
|
-
|
496
|
-
# The transformation method is used to retrieve the transformation of this
|
497
|
-
# instance.
|
498
|
-
#
|
499
|
-
# @example
|
500
|
-
# entities = Sketchup.active_model.entities
|
501
|
-
# definition = Sketchup.active_model.definitions[0]
|
502
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
503
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
504
|
-
# t = componentinstance.transformation
|
505
|
-
#
|
506
|
-
# @return [Geom::Transformation] the Transformation object if successful
|
507
|
-
#
|
508
|
-
# @version SketchUp 6.0
|
509
|
-
def transformation
|
510
|
-
end
|
511
|
-
|
512
|
-
# The transformation= method is used to set the transformation on this
|
513
|
-
# instance.
|
514
|
-
#
|
515
|
-
# @example
|
516
|
-
# entities = Sketchup.active_model.entities
|
517
|
-
# definition = Sketchup.active_model.definitions[0]
|
518
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
519
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
520
|
-
# new_transformation = Geom::Transformation.new([100,0,0])
|
521
|
-
# componentinstance.transformation = new_transformation
|
522
|
-
#
|
523
|
-
# @param [Geom::Transformation] transformation
|
524
|
-
# A Transformation object to apply.
|
525
|
-
#
|
526
|
-
# @return [Sketchup::ComponentInstance] the transformed ComponentInstance
|
527
|
-
#
|
528
|
-
# @version SketchUp 6.0
|
529
|
-
def transformation=(transformation)
|
530
|
-
end
|
531
|
-
|
532
|
-
# The trim method is used to compute the (non-destructive) boolean difference
|
533
|
-
# of the two instances representing manifold solid volumes (this - arg). If
|
534
|
-
# the specified objects (this and arg) do not represent manifold volumes, this
|
535
|
-
# method fails.
|
536
|
-
#
|
537
|
-
# @example
|
538
|
-
# entities = Sketchup.active_model.entities
|
539
|
-
# instance1 = entities[0]
|
540
|
-
# instance2 = entities[1]
|
541
|
-
# result = instance1.trim(instance2)
|
542
|
-
#
|
543
|
-
# @param [Sketchup::ComponentInstance] instance
|
544
|
-
# The instance to trim this instance against.
|
545
|
-
#
|
546
|
-
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
547
|
-
# (this and arg) represent manifold solids and the
|
548
|
-
# operation succeeds otherwise nil is returned.
|
549
|
-
#
|
550
|
-
# @version SketchUp 8.0
|
551
|
-
def trim(instance)
|
552
|
-
end
|
553
|
-
|
554
|
-
# The union method is used to compute the boolean union of the two instances
|
555
|
-
# representing manifold solid volumes (this | arg). If the specified
|
556
|
-
# objects (this and arg) do not represent manifold volumes, this method fails.
|
557
|
-
#
|
558
|
-
# @example
|
559
|
-
# entities = Sketchup.active_model.entities
|
560
|
-
# instance1 = entities[0]
|
561
|
-
# instance2 = entities[1]
|
562
|
-
# result = instance1.union(instance2)
|
563
|
-
#
|
564
|
-
# @param [Sketchup::ComponentInstance] instance
|
565
|
-
# The instance to union this instance with.
|
566
|
-
#
|
567
|
-
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
568
|
-
# (this and arg) represent manifold solids and the
|
569
|
-
# operation succeeds otherwise nil is returned.
|
570
|
-
#
|
571
|
-
# @version SketchUp 8.0
|
572
|
-
def union(instance)
|
573
|
-
end
|
574
|
-
|
575
|
-
# The volume method is used to compute the volume of this instance if and only
|
576
|
-
# if this instance is manifold.
|
577
|
-
#
|
578
|
-
# @example
|
579
|
-
# entities = Sketchup.active_model.entities
|
580
|
-
# definition = Sketchup.active_model.definitions[0]
|
581
|
-
# transformation = Geom::Transformation.new([0,0,0])
|
582
|
-
# componentinstance = entities.add_instance(definition, transformation)
|
583
|
-
# volume = componentinstance.volume
|
584
|
-
#
|
585
|
-
# @return [Float] If the instance represents a manifold volume,
|
586
|
-
# volume will be a positive value. If volume is negative,
|
587
|
-
# the instance is not manifold.
|
588
|
-
#
|
589
|
-
# @version SketchUp 8.0
|
590
|
-
def volume
|
591
|
-
end
|
592
|
-
|
593
|
-
end
|
1
|
+
# Copyright:: Copyright 2020 Trimble Inc.
|
2
|
+
# License:: The MIT License (MIT)
|
3
|
+
|
4
|
+
# The {Sketchup::ComponentInstance} class is used to represent component
|
5
|
+
# instances of a component definition or components that have been dragged from
|
6
|
+
# the Component Browser and placed (thus, instanced) within the Model.
|
7
|
+
# Therefore, the ComponentInstance class contains a reference to a
|
8
|
+
# corresponding ComponentDefinition object and a Transformation object (which
|
9
|
+
# contains the location of the component in the Drawing Window).
|
10
|
+
#
|
11
|
+
# Starting from SketchUp 2018+, the {Sketchup::ComponentInstance} class
|
12
|
+
# contains default attributes when created or imported. The attributes
|
13
|
+
# are: "Owner", "Status". See the
|
14
|
+
# {https://help.sketchup.com/en/article/3000124 Help article} for more
|
15
|
+
# information. The dictionary cannot be deleted via ruby and an @raise ArgumentError
|
16
|
+
# will be raised. The key/value pairs in the dictionary can be deleted safely.
|
17
|
+
#
|
18
|
+
# @version SketchUp 6.0
|
19
|
+
class Sketchup::ComponentInstance < Sketchup::Drawingelement
|
20
|
+
|
21
|
+
# Instance Methods
|
22
|
+
|
23
|
+
# The add_observer method is used to add an observer to the current object.
|
24
|
+
#
|
25
|
+
# @example
|
26
|
+
# entities = Sketchup.active_model.entities
|
27
|
+
# definition = Sketchup.active_model.definitions[0]
|
28
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
29
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
30
|
+
# status = componentinstance.add_observer observer
|
31
|
+
#
|
32
|
+
# @param [Object] observer
|
33
|
+
# An observer.
|
34
|
+
#
|
35
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
36
|
+
#
|
37
|
+
# @version SketchUp 6.0
|
38
|
+
def add_observer(observer)
|
39
|
+
end
|
40
|
+
|
41
|
+
# The definition method is used to retrieve the component definition for this
|
42
|
+
# component instance.
|
43
|
+
#
|
44
|
+
# @example
|
45
|
+
# # First create an instance for us to look at.
|
46
|
+
# entities = Sketchup.active_model.entities
|
47
|
+
# definition = Sketchup.active_model.definitions[0]
|
48
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
49
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
50
|
+
#
|
51
|
+
# # You can get an instance's definition with this method.
|
52
|
+
# definition = componentinstance.definition
|
53
|
+
#
|
54
|
+
# @return [Sketchup::ComponentDefinition] a ComponentDefinition object if
|
55
|
+
# successful
|
56
|
+
#
|
57
|
+
# @version SketchUp 6.0
|
58
|
+
def definition
|
59
|
+
end
|
60
|
+
|
61
|
+
# The definition= method is used to set the component definition for this
|
62
|
+
# component.
|
63
|
+
#
|
64
|
+
# This method causes the instance to use a different definition, but it will
|
65
|
+
# use the same transformation to position it in the Model.
|
66
|
+
#
|
67
|
+
# @example
|
68
|
+
# # Assumes that the active model contains two different components.
|
69
|
+
# instance1 = Sketchup.active_model.entities[0]
|
70
|
+
# instance2 = Sketchup.active_model.entities[1]
|
71
|
+
#
|
72
|
+
# # Grab handles to our two definitions.
|
73
|
+
# definition1 = instance1.definition
|
74
|
+
# definition2 = instance2.definition
|
75
|
+
#
|
76
|
+
# # Replace 2nd instance with the 1st definition.
|
77
|
+
# instance2.definition = definition1
|
78
|
+
#
|
79
|
+
# @param [Sketchup::ComponentDefinition] definition
|
80
|
+
# A ComponentDefinition object to set.
|
81
|
+
#
|
82
|
+
# @return [Sketchup::ComponentDefinition] the ComponentDefinition object
|
83
|
+
# that was set if successful, false if unsuccessful
|
84
|
+
#
|
85
|
+
# @version SketchUp 6.0
|
86
|
+
def definition=(definition)
|
87
|
+
end
|
88
|
+
|
89
|
+
# The equals? method is used to determine if a component instance is
|
90
|
+
# geometrically equivalent to another instance.
|
91
|
+
#
|
92
|
+
# @example
|
93
|
+
# entities = Sketchup.active_model.entities
|
94
|
+
# instance1 = entities[0]
|
95
|
+
# instance2 = entities[1]
|
96
|
+
# status = instance1.equals?(instance2)
|
97
|
+
#
|
98
|
+
# @param [Sketchup::ComponentInstance] instance
|
99
|
+
# The instance to compare this instance with.
|
100
|
+
#
|
101
|
+
# @return [Boolean]
|
102
|
+
#
|
103
|
+
# @version SketchUp 8.0
|
104
|
+
def equals?(instance)
|
105
|
+
end
|
106
|
+
|
107
|
+
# The explode method is used to explode the component instance into separate
|
108
|
+
# entities.
|
109
|
+
#
|
110
|
+
# @example
|
111
|
+
# # Assuming 'instance' is a ComponentInstance object
|
112
|
+
# array = instance.explode
|
113
|
+
# if array
|
114
|
+
# UI.messagebox "Exploded the component instance"
|
115
|
+
# else
|
116
|
+
# UI.messagebox "Failure"
|
117
|
+
# end
|
118
|
+
#
|
119
|
+
# @return [Array<Sketchup:Entity>] An array of entity objects if successful, false if
|
120
|
+
# unsuccessful
|
121
|
+
#
|
122
|
+
# @version SketchUp 6.0
|
123
|
+
def explode
|
124
|
+
end
|
125
|
+
|
126
|
+
# The glued_to method is used to retrieve the entity that this instance is
|
127
|
+
# glued to.
|
128
|
+
#
|
129
|
+
# Returns nil if it is not glued to anything.
|
130
|
+
#
|
131
|
+
# @example
|
132
|
+
# point = Geom::Point3d.new 10,20,30
|
133
|
+
# transform = Geom::Transformation.new point
|
134
|
+
# model = Sketchup.active_model
|
135
|
+
# entities = model.active_entities
|
136
|
+
# path = Sketchup.find_support_file "Bed.skp",
|
137
|
+
# "Components/Components Sampler/"
|
138
|
+
# definitions = model.definitions
|
139
|
+
# componentdefinition = definitions.load path
|
140
|
+
# instance = entities.add_instance componentdefinition, transform
|
141
|
+
# status = instance.glued_to
|
142
|
+
#
|
143
|
+
# @return [Sketchup::Face, nil] the Entity object that the instance is glued
|
144
|
+
# to (if successful)
|
145
|
+
#
|
146
|
+
# @version SketchUp 6.0
|
147
|
+
def glued_to
|
148
|
+
end
|
149
|
+
|
150
|
+
# The glued_to= method glues this instance to a face.
|
151
|
+
#
|
152
|
+
# This method will raise an exception if the instance cannot be glued to the
|
153
|
+
# given face. Instances cannot be glued if the definition of the instance
|
154
|
+
# doesn't support gluing or if the alignment is wrong.
|
155
|
+
#
|
156
|
+
# @example
|
157
|
+
# depth = 100
|
158
|
+
# width = 100
|
159
|
+
# path=Sketchup.find_support_file "Bed.skp",
|
160
|
+
# "Components/Components Sampler/"
|
161
|
+
# model = Sketchup.active_model
|
162
|
+
# entities = model.active_entities
|
163
|
+
# pts = []
|
164
|
+
# pts[0] = [0, 0, 0]
|
165
|
+
# pts[1] = [width, 0, 0]
|
166
|
+
# pts[2] = [width, depth, 0]
|
167
|
+
# pts[3] = [0, depth, 0]
|
168
|
+
# # Add the face to the entities in the model
|
169
|
+
# face = entities.add_face pts
|
170
|
+
# point = Geom::Point3d.new 10,10,0
|
171
|
+
# transform = Geom::Transformation.new point
|
172
|
+
# definitions = model.definitions
|
173
|
+
# componentdefinition = definitions.load path
|
174
|
+
# instance = entities.add_instance componentdefinition, transform
|
175
|
+
# begin
|
176
|
+
# status = instance.glued_to = face
|
177
|
+
# rescue
|
178
|
+
# UI.messagebox $!.message
|
179
|
+
# end
|
180
|
+
# if (status)
|
181
|
+
# UI.messagebox status.to_s
|
182
|
+
# else
|
183
|
+
# UI.messagebox "Failure"
|
184
|
+
# end
|
185
|
+
#
|
186
|
+
# @param [Sketchup::Face, nil] face
|
187
|
+
#
|
188
|
+
# @return [Sketchup::Face, nil] - the Face object where the component is glued if
|
189
|
+
# successful
|
190
|
+
#
|
191
|
+
# @version SketchUp 6.0
|
192
|
+
def glued_to=(face)
|
193
|
+
end
|
194
|
+
|
195
|
+
# The guid method is used to get the base 64 encoded unique id
|
196
|
+
# for this SketchUp object.
|
197
|
+
#
|
198
|
+
# @example
|
199
|
+
# entities = Sketchup.active_model.entities
|
200
|
+
# definition = Sketchup.active_model.definitions[0]
|
201
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
202
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
203
|
+
# guid = componentinstance.guid
|
204
|
+
#
|
205
|
+
# @return [String] a unique 22 character string
|
206
|
+
#
|
207
|
+
# @version SketchUp 2014
|
208
|
+
def guid
|
209
|
+
end
|
210
|
+
|
211
|
+
# The intersect method is used to compute the boolean intersection of two
|
212
|
+
# instances representing manifold solid volumes (this - arg). If the specified
|
213
|
+
# objects (this and arg) do not represent manifold volumes, this method fails.
|
214
|
+
#
|
215
|
+
# @example
|
216
|
+
# entities = Sketchup.active_model.entities
|
217
|
+
# instance1 = entities[0]
|
218
|
+
# instance2 = entities[1]
|
219
|
+
# result = instance1.intersect(instance2)
|
220
|
+
#
|
221
|
+
# @param [Sketchup::ComponentInstance] instance
|
222
|
+
# The instance to intersect this instance with.
|
223
|
+
#
|
224
|
+
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
225
|
+
# (this and arg) represent manifold solids and the
|
226
|
+
# operation succeeds otherwise nil is returned.
|
227
|
+
#
|
228
|
+
# @version SketchUp 8.0
|
229
|
+
def intersect(instance)
|
230
|
+
end
|
231
|
+
|
232
|
+
# The locked= method is used to lock a component instance.
|
233
|
+
#
|
234
|
+
# @example
|
235
|
+
# entities = Sketchup.active_model.entities
|
236
|
+
# definition = Sketchup.active_model.definitions[0]
|
237
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
238
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
239
|
+
# status = componentinstance.locked = true
|
240
|
+
#
|
241
|
+
# @param [Boolean] lock
|
242
|
+
#
|
243
|
+
# @return [Boolean] true if the component instance is locked.
|
244
|
+
# False if the instance is not locked.
|
245
|
+
#
|
246
|
+
# @version SketchUp 6.0
|
247
|
+
def locked=(lock)
|
248
|
+
end
|
249
|
+
|
250
|
+
# The locked? method is used to determine if a component instance is locked.
|
251
|
+
#
|
252
|
+
# @example
|
253
|
+
# entities = Sketchup.active_model.entities
|
254
|
+
# definition = Sketchup.active_model.definitions[0]
|
255
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
256
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
257
|
+
# status = componentinstance.locked?
|
258
|
+
#
|
259
|
+
# @return [Boolean]
|
260
|
+
#
|
261
|
+
# @version SketchUp 6.0
|
262
|
+
def locked?
|
263
|
+
end
|
264
|
+
|
265
|
+
# The {#make_unique} method is used to create a component definition for this
|
266
|
+
# instance that is not used by any other instances.
|
267
|
+
#
|
268
|
+
# @example
|
269
|
+
# point = Geom::Point3d.new(10,20,30)
|
270
|
+
# transform = Geom::Transformation.new(point)
|
271
|
+
# model = Sketchup.active_model
|
272
|
+
# entities = model.active_entities
|
273
|
+
#
|
274
|
+
# path = Sketchup.find_support_file("Bed.skp",
|
275
|
+
# "Components/Components Sampler/")
|
276
|
+
# definitions = model.definitions
|
277
|
+
# componentdefinition = definitions.load(path)
|
278
|
+
# instance = entities.add_instance(componentdefinition, transform)
|
279
|
+
# # Returns unique component instance
|
280
|
+
# instance.make_unique
|
281
|
+
#
|
282
|
+
# @return [Sketchup::ComponentInstance] returns itself
|
283
|
+
#
|
284
|
+
# @version SketchUp 6.0
|
285
|
+
def make_unique
|
286
|
+
end
|
287
|
+
|
288
|
+
# The manifold? method is used to determine if an instance is manifold.
|
289
|
+
#
|
290
|
+
# @example
|
291
|
+
# entities = Sketchup.active_model.entities
|
292
|
+
# definition = Sketchup.active_model.definitions[0]
|
293
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
294
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
295
|
+
# status = componentinstance.manifold?
|
296
|
+
#
|
297
|
+
# @return [Boolean]
|
298
|
+
#
|
299
|
+
# @version SketchUp 8.0
|
300
|
+
def manifold?
|
301
|
+
end
|
302
|
+
|
303
|
+
# The move! method is the same as the transform! method, except that it does
|
304
|
+
# not record the move as an undo operation.
|
305
|
+
#
|
306
|
+
# This method is useful for moving entities inside of an animation or page
|
307
|
+
# transition.
|
308
|
+
#
|
309
|
+
# @example
|
310
|
+
# entities = Sketchup.active_model.entities
|
311
|
+
# definition = Sketchup.active_model.definitions[0]
|
312
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
313
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
314
|
+
# new_transformation = Geom::Transformation.new([100,0,0])
|
315
|
+
# componentinstance.move! new_transformation
|
316
|
+
#
|
317
|
+
# @param [Geom::Transformation] transform
|
318
|
+
# The transform object to apply to the component instance.
|
319
|
+
#
|
320
|
+
# @return [Boolean] true if successful, false if unsuccessful
|
321
|
+
#
|
322
|
+
# @version SketchUp 6.0
|
323
|
+
def move!(transform)
|
324
|
+
end
|
325
|
+
|
326
|
+
# The name method is used to get the name of this instance.
|
327
|
+
#
|
328
|
+
# @example
|
329
|
+
# entities = Sketchup.active_model.entities
|
330
|
+
# definition = Sketchup.active_model.definitions[0]
|
331
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
332
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
333
|
+
# name = componentinstance.name
|
334
|
+
#
|
335
|
+
# @return [String] the string name of the ComponentInstance
|
336
|
+
#
|
337
|
+
# @version SketchUp 6.0
|
338
|
+
def name
|
339
|
+
end
|
340
|
+
|
341
|
+
# The name method is used to set the name of this instance.
|
342
|
+
#
|
343
|
+
# @example
|
344
|
+
# entities = Sketchup.active_model.entities
|
345
|
+
# definition = Sketchup.active_model.definitions[0]
|
346
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
347
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
348
|
+
# componentinstance.name = "Sang"
|
349
|
+
#
|
350
|
+
# @param [String] name
|
351
|
+
# the string name to set
|
352
|
+
#
|
353
|
+
# @return [Sketchup::ComponentInstance] the newly named ComponentInstance
|
354
|
+
#
|
355
|
+
# @version SketchUp 6.0
|
356
|
+
def name=(name)
|
357
|
+
end
|
358
|
+
|
359
|
+
# The outer_shell method is used to compute the outer shell of the two
|
360
|
+
# instances representing manifold solid volumes (this || arg). If the specified
|
361
|
+
# objects (this and arg) do not represent manifold volumes, this method fails.
|
362
|
+
#
|
363
|
+
# @example
|
364
|
+
# entities = Sketchup.active_model.entities
|
365
|
+
# instance1 = entities[0]
|
366
|
+
# instance2 = entities[1]
|
367
|
+
# result = instance1.outer_shell(instance2)
|
368
|
+
#
|
369
|
+
# @param [Sketchup::ComponentInstance] instance
|
370
|
+
# The instance to outer shell this instance with.
|
371
|
+
#
|
372
|
+
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
373
|
+
# (this and arg) represent manifold solids and the
|
374
|
+
# operation succeeds otherwise nil is returned.
|
375
|
+
#
|
376
|
+
# @version SketchUp 8.0
|
377
|
+
def outer_shell(instance)
|
378
|
+
end
|
379
|
+
|
380
|
+
# The remove_observer method is used to remove an observer from the current
|
381
|
+
# object.
|
382
|
+
#
|
383
|
+
# @example
|
384
|
+
# entities = Sketchup.active_model.entities
|
385
|
+
# definition = Sketchup.active_model.definitions[0]
|
386
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
387
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
388
|
+
# status = componentinstance.remove_observer observer
|
389
|
+
#
|
390
|
+
# @param [Object] observer
|
391
|
+
# An observer.
|
392
|
+
#
|
393
|
+
# @return [Boolean] true if successful, false if unsuccessful.
|
394
|
+
#
|
395
|
+
# @version SketchUp 6.0
|
396
|
+
def remove_observer(observer)
|
397
|
+
end
|
398
|
+
|
399
|
+
# The show_differences method is used to determine if a component instance is
|
400
|
+
# geometrically equivalent to another instance and in addition move the non-
|
401
|
+
# matching and matching geometry to new layers.
|
402
|
+
#
|
403
|
+
# This method will move both instances to Layer0. Geometry that is the same
|
404
|
+
# in both components will be moved to a new layer named def_name + "_same".
|
405
|
+
# Geometry that is not the same will be moved to a layer named def_name +
|
406
|
+
# "_diff".
|
407
|
+
#
|
408
|
+
# If verbose is true, a list of all the geometry that is different
|
409
|
+
# from one component to the other is displayed texturally in the Ruby Console.
|
410
|
+
#
|
411
|
+
# @example
|
412
|
+
# entities = Sketchup.active_model.entities
|
413
|
+
# instance1 = entities[0]
|
414
|
+
# instance2 = entities[1]
|
415
|
+
# status = instance1.show_differences(instance2, true)
|
416
|
+
#
|
417
|
+
# @param [Sketchup::ComponentInstance] instance
|
418
|
+
# The instance to be compared with.
|
419
|
+
#
|
420
|
+
# @param [Boolean] verbose
|
421
|
+
# A boolean flag indicating whether to display a textural
|
422
|
+
# report of the found differences to the Ruby console.
|
423
|
+
#
|
424
|
+
# @return [Boolean] true if the instances are geometrically
|
425
|
+
# equivalent, otherwise false.
|
426
|
+
#
|
427
|
+
# @version SketchUp 8.0
|
428
|
+
def show_differences(instance, verbose)
|
429
|
+
end
|
430
|
+
|
431
|
+
# The split method is used to compute the boolean split (map overlay)of the two
|
432
|
+
# instances representing manifold solid volumes (this - arg). If the specified
|
433
|
+
# objects (this and arg) do not represent manifold volumes, this method fails.
|
434
|
+
#
|
435
|
+
# @example
|
436
|
+
# entities = Sketchup.active_model.entities
|
437
|
+
# instance1 = entities[0]
|
438
|
+
# instance2 = entities[1]
|
439
|
+
# result = instance1.split(instance2)
|
440
|
+
#
|
441
|
+
# @param [Sketchup::ComponentInstance, nil] instance
|
442
|
+
# The instance to split this instance with.
|
443
|
+
#
|
444
|
+
# @return [Array(Sketchup::Group, Sketchup::Group, Sketchup::Group)] A vector (array) of the three resultant groups
|
445
|
+
# if the two objects (this and arg) represent manifold
|
446
|
+
# solids and the operation succeeds otherwise nil is
|
447
|
+
# returned. The 3 groups are as follows: The intersection
|
448
|
+
# of volume 1 & volume 2, the difference of
|
449
|
+
# volume 1 minus volume 2, and the reverse difference of
|
450
|
+
# volume 2 minus volume 1.
|
451
|
+
#
|
452
|
+
# @version SketchUp 8.0
|
453
|
+
def split(instance)
|
454
|
+
end
|
455
|
+
|
456
|
+
# The subtract method is used to compute the boolean difference of the two
|
457
|
+
# instances representing manifold solid volumes (this - arg). If the specified
|
458
|
+
# objects (this and arg) do not represent manifold volumes, this method fails.
|
459
|
+
#
|
460
|
+
# @example
|
461
|
+
# entities = Sketchup.active_model.entities
|
462
|
+
# instance1 = entities[0]
|
463
|
+
# instance2 = entities[1]
|
464
|
+
# result = instance1.subtract(instance2)
|
465
|
+
#
|
466
|
+
# @param [Sketchup::ComponentInstance] instance
|
467
|
+
# The instance to subtract this instance from.
|
468
|
+
#
|
469
|
+
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
470
|
+
# (this and arg) represent manifold solids and the
|
471
|
+
# operation succeeds otherwise nil is returned.
|
472
|
+
#
|
473
|
+
# @version SketchUp 8.0
|
474
|
+
def subtract(instance)
|
475
|
+
end
|
476
|
+
|
477
|
+
# Apply a {Geom::Transformation} to a component instance.
|
478
|
+
#
|
479
|
+
# @example
|
480
|
+
# entities = Sketchup.active_model.entities
|
481
|
+
# definition = Sketchup.active_model.definitions[0]
|
482
|
+
# transformation = Geom::Transformation.new([0, 0, 0])
|
483
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
484
|
+
# new_transformation = Geom::Transformation.new([100, 0, 0])
|
485
|
+
# componentinstance.transform! new_transformation
|
486
|
+
#
|
487
|
+
# @param [Geom::Transformation] transform
|
488
|
+
# The transformation object to apply to the component instance.
|
489
|
+
#
|
490
|
+
# @return [Boolean]
|
491
|
+
#
|
492
|
+
# @version SketchUp 6.0
|
493
|
+
def transform!(transform)
|
494
|
+
end
|
495
|
+
|
496
|
+
# The transformation method is used to retrieve the transformation of this
|
497
|
+
# instance.
|
498
|
+
#
|
499
|
+
# @example
|
500
|
+
# entities = Sketchup.active_model.entities
|
501
|
+
# definition = Sketchup.active_model.definitions[0]
|
502
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
503
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
504
|
+
# t = componentinstance.transformation
|
505
|
+
#
|
506
|
+
# @return [Geom::Transformation] the Transformation object if successful
|
507
|
+
#
|
508
|
+
# @version SketchUp 6.0
|
509
|
+
def transformation
|
510
|
+
end
|
511
|
+
|
512
|
+
# The transformation= method is used to set the transformation on this
|
513
|
+
# instance.
|
514
|
+
#
|
515
|
+
# @example
|
516
|
+
# entities = Sketchup.active_model.entities
|
517
|
+
# definition = Sketchup.active_model.definitions[0]
|
518
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
519
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
520
|
+
# new_transformation = Geom::Transformation.new([100,0,0])
|
521
|
+
# componentinstance.transformation = new_transformation
|
522
|
+
#
|
523
|
+
# @param [Geom::Transformation] transformation
|
524
|
+
# A Transformation object to apply.
|
525
|
+
#
|
526
|
+
# @return [Sketchup::ComponentInstance] the transformed ComponentInstance
|
527
|
+
#
|
528
|
+
# @version SketchUp 6.0
|
529
|
+
def transformation=(transformation)
|
530
|
+
end
|
531
|
+
|
532
|
+
# The trim method is used to compute the (non-destructive) boolean difference
|
533
|
+
# of the two instances representing manifold solid volumes (this - arg). If
|
534
|
+
# the specified objects (this and arg) do not represent manifold volumes, this
|
535
|
+
# method fails.
|
536
|
+
#
|
537
|
+
# @example
|
538
|
+
# entities = Sketchup.active_model.entities
|
539
|
+
# instance1 = entities[0]
|
540
|
+
# instance2 = entities[1]
|
541
|
+
# result = instance1.trim(instance2)
|
542
|
+
#
|
543
|
+
# @param [Sketchup::ComponentInstance] instance
|
544
|
+
# The instance to trim this instance against.
|
545
|
+
#
|
546
|
+
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
547
|
+
# (this and arg) represent manifold solids and the
|
548
|
+
# operation succeeds otherwise nil is returned.
|
549
|
+
#
|
550
|
+
# @version SketchUp 8.0
|
551
|
+
def trim(instance)
|
552
|
+
end
|
553
|
+
|
554
|
+
# The union method is used to compute the boolean union of the two instances
|
555
|
+
# representing manifold solid volumes (this | arg). If the specified
|
556
|
+
# objects (this and arg) do not represent manifold volumes, this method fails.
|
557
|
+
#
|
558
|
+
# @example
|
559
|
+
# entities = Sketchup.active_model.entities
|
560
|
+
# instance1 = entities[0]
|
561
|
+
# instance2 = entities[1]
|
562
|
+
# result = instance1.union(instance2)
|
563
|
+
#
|
564
|
+
# @param [Sketchup::ComponentInstance] instance
|
565
|
+
# The instance to union this instance with.
|
566
|
+
#
|
567
|
+
# @return [Sketchup::Group, nil] The resultant group if the two objects
|
568
|
+
# (this and arg) represent manifold solids and the
|
569
|
+
# operation succeeds otherwise nil is returned.
|
570
|
+
#
|
571
|
+
# @version SketchUp 8.0
|
572
|
+
def union(instance)
|
573
|
+
end
|
574
|
+
|
575
|
+
# The volume method is used to compute the volume of this instance if and only
|
576
|
+
# if this instance is manifold.
|
577
|
+
#
|
578
|
+
# @example
|
579
|
+
# entities = Sketchup.active_model.entities
|
580
|
+
# definition = Sketchup.active_model.definitions[0]
|
581
|
+
# transformation = Geom::Transformation.new([0,0,0])
|
582
|
+
# componentinstance = entities.add_instance(definition, transformation)
|
583
|
+
# volume = componentinstance.volume
|
584
|
+
#
|
585
|
+
# @return [Float] If the instance represents a manifold volume,
|
586
|
+
# volume will be a positive value. If volume is negative,
|
587
|
+
# the instance is not manifold.
|
588
|
+
#
|
589
|
+
# @version SketchUp 8.0
|
590
|
+
def volume
|
591
|
+
end
|
592
|
+
|
593
|
+
end
|