Class: Sketchup::Model
- Inherits:
-
Object
- Object
- Sketchup::Model
- Defined in:
- lib/sketchup-api-stubs/stubs/Sketchup/Model.rb
Overview
This is the interface to a SketchUp model. The model is the 3D drawing that the user is working with, and it serves as the “entry point” for most Ruby API interactions. The Sketchup.active_model method gives you a handle to the current model, and from there you can use the model-level methods to start getting information and making changes.
Constants: Product Family
-
Model::ProTrial
-
Model::ProLicensed
-
Model::MakeTrial
-
Model::MakeTrialExpired
Constant Summary collapse
- LOAD_STATUS_SUCCESS =
Constants
nil
- LOAD_STATUS_SUCCESS_MORE_RECENT =
Stub value.
nil
- Make =
Stub value.
nil
- MakeTrial =
Stub value.
nil
- ProLicensed =
Stub value.
nil
- ProTrial =
Stub value.
nil
- VERSION_2013 =
Stub value.
nil
- VERSION_2014 =
Stub value.
nil
- VERSION_2015 =
Stub value.
nil
- VERSION_2016 =
Stub value.
nil
- VERSION_2017 =
Stub value.
nil
- VERSION_2018 =
Stub value.
nil
- VERSION_2019 =
Stub value.
nil
- VERSION_2020 =
Stub value.
nil
- VERSION_2021 =
Stub value.
nil
- VERSION_3 =
Stub value.
nil
- VERSION_4 =
Stub value.
nil
- VERSION_5 =
Stub value.
nil
- VERSION_6 =
Stub value.
nil
- VERSION_7 =
Stub value.
nil
- VERSION_8 =
Stub value.
nil
Instance Method Summary collapse
-
#abort_operation ⇒ Boolean
The #abort_operation method aborts the current operation started with the start_operation method.
-
#active_entities ⇒ Sketchup::Entities
Returns an Entities object which contains the entities in the open group or component instance.
-
#active_layer ⇒ Sketchup::Layer
The #active_layer method retrieves the active Layer.
-
#active_layer=(layer) ⇒ Sketchup::Layer
The #active_layer= method sets the active Layer object.
-
#active_path ⇒ Array<Sketchup::Drawingelement>?
Returns an array containing the sequence of entities the user has double-clicked on for editing.
-
#active_path=(instance_path) ⇒ Sketchup::Model
The #active_path= method is used to open a given instance path for editing.
-
#active_view ⇒ Sketchup::View
The #active_view method returns the active View object for this model.
-
#add_note(note, x, y) ⇒ Sketchup::Text
Add a text note to the Model.
-
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the current object.
-
#attribute_dictionaries ⇒ Sketchup::AttributeDictionaries
The #attribute_dictionaries method retrieves the AttributeDictionaries object that is associated with the Model.
-
#attribute_dictionary(name, create = false) ⇒ Sketchup::AttributeDictionary
Returns the Sketchup::AttributeDictionary object that is specified by name.
-
#axes ⇒ Sketchup::Axes
The #axes method returns the drawing axes for the model.
-
#behavior ⇒ Sketchup::Behavior
The behavior method retrieves the behavior of the model.
-
#bounds ⇒ Geom::BoundingBox
The #bounds method is used to retrieve the Geom::BoundingBox bounding the contents of a Model.
-
#classifications ⇒ Sketchup::Classifications
The #classifications method is used to retrieve the Classifications object for this model.
-
#close(ignore_changes = false) ⇒ nil
The close method is used to close this model.
-
#close_active ⇒ Boolean
The #close_active method is used to close the currently active (open) group or component.
-
#commit_operation ⇒ Boolean
The commit_operation method commits an operation for undo.
-
#definitions ⇒ Sketchup::DefinitionList
The #definitions method retrieves a definition list containing all of the component definitions in the model.
-
#description ⇒ String
The description method retrieves a description of the model as found in the Model Info > Files panel.
-
#description=(description) ⇒ String
The #description= method sets the description of the model.
-
#drawing_element_visible?(instance_path) ⇒ Boolean
The #drawing_element_visible? method reports whether the given drawing element in an instance path is visible given the current model options.
-
#edit_transform ⇒ Geom::Transformation
Returns the transformation of the current component edit session.
- #entities ⇒ Sketchup::Entities
-
#export(*args) ⇒ Object
The export method is used to export a given file format.
-
#find_entity_by_id(ids_or_array) ⇒ Array<Sketchup::Entity, nil>
Finds and returns entities by their entityID or GUID.
-
#find_entity_by_persistent_id(*args) ⇒ Object
Finds and returns entities by their persistent id.
-
#georeferenced? ⇒ Boolean
This methods determines if the model is georeferenced.
-
#get_attribute(dictname, key, defaultvalue = nil) ⇒ Object?
The get_attribute method gets the value of an attribute that in the AttributeDictionary with the given name.
-
#get_datum ⇒ String
the get_datum method retrieves the datum, in the form of a string, used in UTM conversions.
-
#get_product_family ⇒ Integer
Returns a value which indicates the product family of the installed SketchUp application.
-
#guid ⇒ String
The guid method retrieves the globally unique identifier, in the form of a string, for the Model.
-
#import(*args) ⇒ Object
The import method is used to load a file by recognizing the file extension and calling appropriate importer.
-
#instance_path_from_pid_path(pid_path) ⇒ Sketchup::InstancePath
The #instance_path_from_pid_path method returns a instance path given a string with persistent ids representing the path to the entity.
-
#latlong_to_point(lnglat_array) ⇒ Geom::Point3d
The latlong_to_point method converts a latitude and longitude to a Point3d object in the model.
-
#layers ⇒ Sketchup::Layers
The {#layers method retrieves a collection of all Layers objects in the model..
-
#line_styles ⇒ Sketchup::LineStyles
The #line_styles method returns the line styles manager.
-
#list_datums ⇒ Array<String>
This method retrieves an Array of all of the datums recognized by SketchUp.
-
#materials ⇒ Sketchup::Materials
The #materials method returns a collection of all of the materials in the model.
-
#mipmapping=(mipmap) ⇒ Boolean
This method can be used to turn mipmapping on or off.
-
#mipmapping? ⇒ Boolean
This method can be used to find out if mipmapping is on or off.
-
#modified? ⇒ Boolean
The modified? method determines if the Model has been modified since the last save.
-
#name ⇒ String
The name method retrieves the string name of the model.
-
#name=(name) ⇒ String
The name= method sets the string name of the model.
-
#number_faces ⇒ Integer
Returns the number faces in a model.
-
#options ⇒ Sketchup::OptionsManager
The #options method retrieves the options manager that defines the options settings for the model.
- #pages ⇒ Sketchup::Pages
-
#path ⇒ String
The path method retrieves the path of the file from which the model was opened.
-
#place_component(componentdef, repeat = false) ⇒ Sketchup::Model?
The place_component method places a new component in the Model using the component placement tool.
-
#point_to_latlong(point) ⇒ Geom::Point3d, Geom::LatLong
The point_to_latlong method converts a point in the model to a LatLong so that you can get its latitude and longitude.
-
#point_to_utm(point) ⇒ Geom::UTM
This method converts a Point3d object in the Model to UTM coordinates.
-
#raytest(ray, wysiwyg_flag = true) ⇒ Array(Geom::Point3d, Array<Sketchup::Drawingelement>)?
The raytest method is used to cast a ray (line) through the model and return the first thing that the ray hits.
-
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the current object.
-
#rendering_options ⇒ Sketchup::RenderingOptions
The #rendering_options method retrieves the RenderingOptions object for this model.
-
#save(*args) ⇒ Boolean
This method is used to save the model to a file.
-
#save_copy(path, version) ⇒ Boolean
This method is used to save the copy of the current model to a file.
-
#save_thumbnail(filename) ⇒ Boolean
The save_thumbnail method is used to save a thumbnail image to a file.
-
#select_tool(tool) ⇒ Sketchup::Model
This method is used to select a SketchUp Tool object s the active tool.
-
#selection ⇒ Sketchup::Selection
This method retrieves a Selection object for the model, containing the currently selected entities.
-
#set_attribute(attrdictname, key, value) ⇒ Object
This method is used to set the value of an attribute in an attribute dictionary with the given name.
-
#set_datum(datum) ⇒ nil
This method sets the datum used in conversions between the internal coordinate system and UTM.
-
#shadow_info ⇒ Sketchup::ShadowInfo
This method is used to retrieve the shadow information for the Model.
-
#start_operation(op_name, disable_ui = false, next_transparent = false, transparent = false) ⇒ Boolean
The #start_operation method is used to notify SketchUp that a new operation (which can be undone) is starting.
-
#styles ⇒ Sketchup::Styles
The #styles method retrieves the styles associated with the model.
-
#tags ⇒ String
The tags method retrieves the string tags of the model.
-
#tags=(tags) ⇒ String
The tags= method sets the string tags of the model.
-
#title ⇒ String
The tile method retrieves the name of the model.
- #tools ⇒ Sketchup::Tools
-
#utm_to_point(utm) ⇒ Geom::Point3d
The utm_to_point method converts a position given in UTM coordinates to a Point3d in the Model.
-
#valid? ⇒ Boolean
Determine if a model is a valid Sketchup::Model object.
Instance Method Details
#abort_operation ⇒ Boolean
Never abort a transparent operation. Doing so would abort the operation it chains to. Instead, try to clean up and simply commit in order to make sure the operation is closed.
The #abort_operation method aborts the current operation started with the start_operation method.
The #abort_operation method is normally called from inside of a rescue clause to cancel an operation if something goes wrong.
89 90 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 89 def abort_operation end |
#active_entities ⇒ Sketchup::Entities
Returns an Entities object which contains the entities in the open group or component instance. If no group or component is open for editing then this will be the same as #entities.
To perform actions upon the current set of entities the user is working with then this is the method to use. Entities selected by the user will be a subset of the active entities.
110 111 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 110 def active_entities end |
#active_layer ⇒ Sketchup::Layer
The #active_layer method retrieves the active Layer.
The default layer in SketchUp is layer 0.
124 125 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 124 def active_layer end |
#active_layer=(layer) ⇒ Sketchup::Layer
The #active_layer= method sets the active Layer object.
141 142 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 141 def active_layer=(layer) end |
#active_path ⇒ Array<Sketchup::Drawingelement>?
Returns an array containing the sequence of entities the user has double-clicked on for editing. This allows one to determine whether they are in component edit mode and where in the model they are.
For example, if a user has double-clicked into a component to edit its geometry, and then double clicked into a sub-group to edit that, the active_path might contain:
[<Sketchup::ComponentInstance>, <Sketchup::Group>]
161 162 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 161 def active_path end |
#active_path=(instance_path) ⇒ Sketchup::Model
An instance path can only be opened if the instances are not locked. This also include instances of the same component definition that are not on the given path. A definition cannot be edited if any of its instances are locked.
Since changing the active entities in SketchUp also changes what coordinate system is used, entities can’t be modified in the same operation as the active entities changes. The API handles this automatically by starting and committing transparent operations as needed.
If the API user tries to do this:
model.start_operation('...', true)
model.entities.add_face(...)
model.active_path = instance_path
model.entities.add_face(...)
model.commit_operation
Then SketchUp will automatically break it up to something like to this:
model.start_operation('...', true)
model.entities.add_face(...)
model.commit_operation
model.start_operation('...', true, false, true)
model.active_path = instance_path
model.commit_operation
model.start_operation('...', true, false, true)
model.entities.add_face(...)
model.commit_operation
For the end user this will be experienced as a single operation.
For the API user the side-effect is multiple transaction notifications to Sketchup::ModelObservers.
The #active_path= method is used to open a given instance path for editing.
228 229 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 228 def active_path=(instance_path) end |
#active_view ⇒ Sketchup::View
The #active_view method returns the active View object for this model.
240 241 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 240 def active_view end |
#add_note(note, x, y) ⇒ Sketchup::Text
Add a text note to the Model. The position of the note is given as relative window positions between 0 and 1. For example, the following command would create a note that start 1/10 of the ways down the screen from the upper left corner of the window.
267 268 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 267 def add_note(note, x, y) end |
#add_observer(observer) ⇒ Boolean
The add_observer method is used to add an observer to the current object.
283 284 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 283 def add_observer(observer) end |
#attribute_dictionaries ⇒ Sketchup::AttributeDictionaries
The #attribute_dictionaries method retrieves the AttributeDictionaries object that is associated with the Model.
307 308 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 307 def attribute_dictionaries end |
#attribute_dictionary(name, create = false) ⇒ Sketchup::AttributeDictionary
Returns the Sketchup::AttributeDictionary object that is specified by name. If the model does not have an attribute dictionary that corresponds to name, returns either nil, or a creates an attribute dictionary. If the optional second argument is true, and there is no attribute dictionary that corresponds to name, a new attribute dictionary is created.
334 335 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 334 def attribute_dictionary(name, create = false) end |
#axes ⇒ Sketchup::Axes
The #axes method returns the drawing axes for the model.
356 357 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 356 def axes end |
#behavior ⇒ Sketchup::Behavior
The behavior method retrieves the behavior of the model.
368 369 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 368 def behavior end |
#bounds ⇒ Geom::BoundingBox
The #bounds method is used to retrieve the Geom::BoundingBox bounding the contents of a Sketchup::Model.
381 382 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 381 def bounds end |
#classifications ⇒ Sketchup::Classifications
The #classifications method is used to retrieve the Classifications object for this model.
394 395 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 394 def classifications end |
#close(ignore_changes = false) ⇒ nil
The close method is used to close this model. On Mac OS, only the active model can be closed. On Windows, since there can be only one document open, this method will perform a File/New operation.
415 416 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 415 def close(ignore_changes = false) end |
#close_active ⇒ Boolean
Before SketchUp 2014 this method had a bug where it didn’t create an undo operation and that could lead to corrupted geometry when undo/redo was used after invoking this method.
The #close_active method is used to close the currently active (open) group or component.
432 433 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 432 def close_active end |
#commit_operation ⇒ Boolean
The commit_operation method commits an operation for undo.
The commit_operation method is normally called at the end of a method to commit the operation that the method performs.
446 447 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 446 def commit_operation end |
#definitions ⇒ Sketchup::DefinitionList
The #definitions method retrieves a definition list containing all of the component definitions in the model.
459 460 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 459 def definitions end |
#description ⇒ String
The description method retrieves a description of the model as found in the Model Info > Files panel.
The returned description can be empty. The default description for all models is empty.
475 476 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 475 def description end |
#description=(description) ⇒ String
The #description= method sets the description of the model.
491 492 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 491 def description=(description) end |
#drawing_element_visible?(instance_path) ⇒ Boolean
The #drawing_element_visible? method reports whether the given drawing element in an instance path is visible given the current model options.
539 540 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 539 def drawing_element_visible?(instance_path) end |
#edit_transform ⇒ Geom::Transformation
Returns the transformation of the current component edit session. If a user has double-clicked to edit a component’s geometry, this will return the transformation of that component, relative to its parent’s origin. This allows one to correctly calculate “local” transformations of a given entity regardless of whether the user is in edit mode.
554 555 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 554 def edit_transform end |
#entities ⇒ Sketchup::Entities
571 572 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 571 def entities end |
#export(path, show_summary = false) ⇒ Boolean #export(path, options) ⇒ Boolean
The export method is used to export a given file format. It knows which format to export based on the file extension you place on the file name. For example, a filename of “thing.obj” will export an OBJ file, whereas “thing.dae” will export a COLLADA file.
For SketchUp Pro 7.1+, valid extensions include dae, kmz, 3ds, dwg, dxf, fbx, obj, wrl, and xsi. SketchUp Free only supports dae and kmz.
Format Support Changes:
-
SketchUp 7.1 added COLLADA (.dae) export capability.
-
SketchUp Pro 2015+ added IFC export capability.
-
SketchUp Pro 2016+ added PDF export capability.
-
SketchUp Pro 2018+ added options for all 3D exporters.
See the Exporter Options file for information on creating a valid hash for the various exporters.
641 642 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 641 def export(*args) end |
#find_entity_by_id(ids_or_array) ⇒ Array<Sketchup::Entity, nil>
Finds and returns entities by their entityID or GUID.
GUIDs looked up are only relevant to Group and ComponentInstance as these GUIDs are persistent. ComponentDefinition and Model GUIDs are not persistent and are not looked up.
When given an array of IDs, an array is returned with a 1:1 mapping to the input arguments. This array may contain nil values if some ids were not found. You cannot look up a mix of entityIDs and GUIDs in the same call.
681 682 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 681 def find_entity_by_id(ids_or_array) end |
#find_entity_by_persistent_id(ids_or_array) ⇒ Array<Sketchup::Entity, nil> #find_entity_by_persistent_id(ids_or_array, **scope) ⇒ Array<Sketchup::Entity, nil>
Finds and returns entities by their persistent id.
When given an array of IDs, an array is returned with a 1:1 mapping to the input arguments. This array may contain ‘nil` values if some ids were not found.
748 749 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 748 def find_entity_by_persistent_id(*args) end |
#georeferenced? ⇒ Boolean
This methods determines if the model is georeferenced.
763 764 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 763 def georeferenced? end |
#get_attribute(dictname, key, defaultvalue = nil) ⇒ Object?
The get_attribute method gets the value of an attribute that in the AttributeDictionary with the given name. If no value is associated with key, or if the model does not have an attribute dictionary specified by name, the optional third parameter will be returned.
793 794 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 793 def get_attribute(dictname, key, defaultvalue = nil) end |
#get_datum ⇒ String
the get_datum method retrieves the datum, in the form of a string, used in UTM conversions.
806 807 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 806 def get_datum end |
#get_product_family ⇒ Integer
Returns a value which indicates the product family of the installed SketchUp application. As of SketchUp 2013, the return values are:
-
0
= Unknown -
1
= Pro Trial -
2
= Pro -
3
= Pro Expired -
4
= Make Trial -
5
= Make Expired -
6
= Make -
7
= Pro License Unavailable
The Model class defines some of these values as constants as of SketchUp 2016.
834 835 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 834 def get_product_family end |
#guid ⇒ String
The guid method retrieves the globally unique identifier, in the form of a string, for the Model. The guid will change after the model is modified and saved. The Model guid is stored with the SketchUp file; it will not change if the file is moved to another computer.
850 851 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 850 def guid end |
#import(path, options) ⇒ Boolean #import(path, show_summary = false) ⇒ Boolean
The import method is used to load a file by recognizing the file extension and calling appropriate importer.
See DefinitionList#import for importing a 3d model file as a component definition, without activating the UI for placing an instance.
See the Importer Options file for information on creating a valid hash for the various importers.
888 889 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 888 def import(*args) end |
#instance_path_from_pid_path(pid_path) ⇒ Sketchup::InstancePath
The #instance_path_from_pid_path method returns a instance path given a string with persistent ids representing the path to the entity.
920 921 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 920 def instance_path_from_pid_path(pid_path) end |
#latlong_to_point(lnglat_array) ⇒ Geom::Point3d
The latlong_to_point method converts a latitude and longitude to a Point3d object in the model. It does not actually work with a LatLong object, but operates on a 2-element array. The returned point will always be on the ground (z=0).
943 944 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 943 def latlong_to_point(lnglat_array) end |
#layers ⇒ Sketchup::Layers
The {#layers method retrieves a collection of all Layers objects in the model.
956 957 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 956 def layers end |
#line_styles ⇒ Sketchup::LineStyles
The #line_styles method returns the line styles manager.
967 968 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 967 def line_styles end |
#list_datums ⇒ Array<String>
This method retrieves an Array of all of the datums recognized by SketchUp.
980 981 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 980 def list_datums end |
#materials ⇒ Sketchup::Materials
The #materials method returns a collection of all of the materials in the model.
993 994 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 993 def materials end |
#mipmapping=(mipmap) ⇒ Boolean
This method can be used to turn mipmapping on or off.
1007 1008 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1007 def mipmapping=(mipmap) end |
#mipmapping? ⇒ Boolean
This method can be used to find out if mipmapping is on or off.
1018 1019 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1018 def mipmapping? end |
#modified? ⇒ Boolean
The modified? method determines if the Model has been modified since the last save.
1034 1035 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1034 def modified? end |
#name ⇒ String
The name method retrieves the string name of the model.
1046 1047 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1046 def name end |
#name=(name) ⇒ String
The name= method sets the string name of the model.
1060 1061 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1060 def name=(name) end |
#number_faces ⇒ Integer
Returns the number faces in a model.
1073 1074 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1073 def number_faces end |
#options ⇒ Sketchup::OptionsManager
The #options method retrieves the options manager that defines the options settings for the model.
Use the string keys instead of numerical indicies when accessing the options as the indicies are not consistent between SketchUp versions.
1095 1096 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1095 def end |
#pages ⇒ Sketchup::Pages
1108 1109 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1108 def pages end |
#path ⇒ String
The path method retrieves the path of the file from which the model was opened.
An empty string is returned for a new model (one which has not been saved and opened.)
1125 1126 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1125 def path end |
#place_component(componentdef, repeat = false) ⇒ Sketchup::Model?
The place_component method places a new component in the Model using the component placement tool.
1145 1146 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1145 def place_component(componentdef, repeat = false) end |
#point_to_latlong(point) ⇒ Geom::Point3d, Geom::LatLong
The point_to_latlong method converts a point in the model to a LatLong so that you can get its latitude and longitude.
This method uses the location information set in ShadowInfo.
NOTE: SketchUp 6.0 and higher has a change where this method returns a Point3d instead of a LatLong, where the x and y values contain the LatLong coordinates.
1169 1170 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1169 def point_to_latlong(point) end |
#point_to_utm(point) ⇒ Geom::UTM
This method converts a Point3d object in the Model to UTM coordinates.
This method uses the location information set in ShadowInfo. See also UTM.
1187 1188 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1187 def point_to_utm(point) end |
#raytest(ray, wysiwyg_flag = true) ⇒ Array(Geom::Point3d, Array<Sketchup::Drawingelement>)?
The parameter wysiwyg_flag was added in SU8 M1.
The raytest method is used to cast a ray (line) through the model and return the first thing that the ray hits.
A ray is a two element array containing a point and a vector [Geom::Point3d(), Geom::Vector3d()]. The point defines the start point of the ray and the vector defines the direction. If direction can not be normalized (e.g. direction = [0, 0, 0]), direction is taken as a point the ray intersects.
1229 1230 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1229 def raytest(ray, wysiwyg_flag = true) end |
#remove_observer(observer) ⇒ Boolean
The remove_observer method is used to remove an observer from the current object.
1247 1248 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1247 def remove_observer(observer) end |
#rendering_options ⇒ Sketchup::RenderingOptions
The #rendering_options method retrieves the RenderingOptions object for this model.
1260 1261 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1260 def end |
#save ⇒ Boolean #save(path) ⇒ Boolean #save(path, version) ⇒ Boolean
A bug in SketchUp 2016 and older caused the .skb
backup file written during save to be empty. The .skp
file was however valid.
This method is used to save the model to a file.
1327 1328 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1327 def save(*args) end |
#save_copy(path, version) ⇒ Boolean
This method is used to save the copy of the current model to a file.
1365 1366 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1365 def save_copy(path, version) end |
#save_thumbnail(filename) ⇒ Boolean
The save_thumbnail method is used to save a thumbnail image to a file. The image format is specified by the file extension of filename. Supported formats are bmp, jpg, png, tif, pct, and gif.
1383 1384 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1383 def save_thumbnail(filename) end |
#select_tool(tool) ⇒ Sketchup::Model
This method is used to select a SketchUp Tool object s the active tool. You must implement the SketchUp Tool interface to create a tool prior to calling this method.
The select tool is activated if you pass nil to the select_tool method. You must implement the SketchUp Tool interface to create a tool, prior to calling this method, and then instance the tool implementation and pass the object to this method. If you attempt to set the select_tool to nil in the initialize method of a tool you have written, it will be ignored.
1406 1407 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1406 def select_tool(tool) end |
#selection ⇒ Sketchup::Selection
This method retrieves a Selection object for the model, containing the currently selected entities. The entries in the selection list are not necessarily in the same order in which the user selected them.
1421 1422 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1421 def selection end |
#set_attribute(attrdictname, key, value) ⇒ Object
This method is used to set the value of an attribute in an attribute dictionary with the given name.
This method can be used create a new AttributeDictionary object, if needed.
1446 1447 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1446 def set_attribute(attrdictname, key, value) end |
#set_datum(datum) ⇒ nil
This method sets the datum used in conversions between the internal coordinate system and UTM.
The default datum is WGS84. You can use the method list_datums to get a list of all of the datums supported in SketchUp. If you pass an invalid datum to set_datum, set_datum returns the default datum.
1465 1466 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1465 def set_datum(datum) end |
#shadow_info ⇒ Sketchup::ShadowInfo
This method is used to retrieve the shadow information for the Model.
1477 1478 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1477 def shadow_info end |
#start_operation(op_name, disable_ui = false, next_transparent = false, transparent = false) ⇒ Boolean
Operations in SketchUp are sequential and cannot be nested. If you start a new Ruby operation while another is still open, you will implicitly close the first one.
The #start_operation method is used to notify SketchUp that a new operation (which can be undone) is starting.
The op_name
argument is a description for the operation that is displayed adjacent to the Edit > Undo menu item. Make sure to provide a user friendly name for your operation.
Starting with SketchUp 7.0, there are three additional booleans that one can pass in when starting an operation. It is recommended to always set disable_ui
to true
. It’s left to false
for default for compatibility reasons.
1546 1547 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1546 def start_operation(op_name, disable_ui = false, next_transparent = false, transparent = false) end |
#styles ⇒ Sketchup::Styles
The #styles method retrieves the styles associated with the model.
1558 1559 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1558 def styles end |
#tags ⇒ String
The tags method retrieves the string tags of the model.
1570 1571 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1570 def end |
#tags=(tags) ⇒ String
The tags= method sets the string tags of the model.
1584 1585 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1584 def () end |
#title ⇒ String
The tile method retrieves the name of the model. If the model is saved on disk, returns the file name without extension. Otherwise returns an empty string.
1599 1600 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1599 def title end |
#tools ⇒ Sketchup::Tools
1611 1612 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1611 def tools end |
#utm_to_point(utm) ⇒ Geom::Point3d
The utm_to_point method converts a position given in UTM coordinates to a Point3d in the Model.
1628 1629 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1628 def utm_to_point(utm) end |
#valid? ⇒ Boolean
Determine if a model is a valid Sketchup::Model object. Returns false if the model has been closed.
This is useful on the mac where one can have multiple models open at the same time. In such a case, this method can tell you if the user has closed the model before you perform operations on it.
1651 1652 |
# File 'lib/sketchup-api-stubs/stubs/Sketchup/Model.rb', line 1651 def valid? end |