Class: Layout::Document
- Inherits:
-
Object
- Object
- Layout::Document
Overview
This is the interface to a LayOut document. A Document is the 2D drawing that the user is working with, and it serves as the “entry point” for most Ruby API interactions. The Document.open method gives you a handle to a Document, and from there you can use the document-level methods to start getting information and making changes.
Constant Summary # collapse
- Layout::Document::VERSION_1
- Layout::Document::VERSION_2
- Layout::Document::VERSION_3
- Layout::Document::VERSION_2013
- Layout::Document::VERSION_2014
- Layout::Document::VERSION_2015
- Layout::Document::VERSION_2016
- Layout::Document::VERSION_2017
- Layout::Document::VERSION_2018
- Layout::Document::VERSION_2019
- Layout::Document::VERSION_2020
- Layout::Document::VERSION_2021
- Layout::Document::VERSION_2022
- Layout::Document::VERSION_2023
- Layout::Document::VERSION_CURRENT
- Layout::Document::FRACTIONAL_INCHES
- Layout::Document::DECIMAL_INCHES
- Layout::Document::DECIMAL_FEET
- Layout::Document::DECIMAL_MILLIMETERS
- Layout::Document::DECIMAL_CENTIMETERS
- Layout::Document::DECIMAL_METERS
- Layout::Document::DECIMAL_POINTS
Class Method Summary # collapse
-
.open(path) ⇒ Layout::Document
The Document.open method creates a new Document by loading an existing .layout file.
Instance Method Summary # collapse
- #==(other) ⇒ Boolean
-
#add_entity(*args) ⇒ Layout::Entity
The #add_entity method adds an Entity to the Document and places it on the given Layer and Page.
-
#attribute_dictionary(name) ⇒ Layout::Dictionary?
The #attribute_dictionary method returns a copy of the document's attribute dictionary with the given name.
-
#auto_text_definitions ⇒ Layout::AutoTextDefinitions
The #auto_text_definitions method returns an array of AutoTextDefinition's in the Document.
-
#delete_attribute(*args) ⇒ Object
The #delete_attribute method is used to delete an attribute from a document.
- #export(file_path, options = nil) ⇒ Object
-
#get_attribute(name, key, default_value = nil) ⇒ String, ...
The #get_attribute method is used to retrieve the value of an attribute in the document's attribute dictionary.
- #grid ⇒ Layout::Grid
-
#grid_snap_enabled=(enabled) ⇒ Object
The #grid_snap_enabled= method sets whether or not grid snap is enabled in the Document.
-
#grid_snap_enabled? ⇒ Boolean
The #grid_snap_enabled? method returns whether or not grid snap is enabled in the Document.
-
#initialize(*args) ⇒ Object
constructor
The #initialize method creates a new Document.
- #layers ⇒ Layout::Layers
-
#object_snap_enabled=(enabled) ⇒ Object
The #object_snap_enabled= method enables or disables inference in the Document.
-
#object_snap_enabled? ⇒ Boolean
The #object_snap_enabled? method returns whether or not inference is enabled in the Document.
-
#page_info ⇒ Layout::PageInfo
The #page_info method returns a reference to the PageInfo settings of the Document.
- #pages ⇒ Layout::Pages
- #path ⇒ String
-
#precision ⇒ Float
The #precision method returns the precision for the Document.
-
#precision=(precision) ⇒ Object
The #precision= method sets the precision for the Document.
-
#remove_entity(entity) ⇒ Object
The #remove_entity method removes an Entity from the Document.
-
#render_mode_override ⇒ Integer
The #render_mode_override method returns the override setting for output render modes of SketchUpModels in the Document.
-
#render_mode_override=(render_mode) ⇒ Object
The #render_mode_override= method sets the override setting for output render modes of SketchUpModels in the Document.
- #save(*args) ⇒ Object
-
#set_attribute(name, key, value) ⇒ Object
The #set_attribute method adds an attribute to the document's attribute dictionary.
-
#shared_entities ⇒ Layout::Entities
The #shared_entities method returns the Entities that exist on shared Layers in the Document.
-
#time_created ⇒ Time
The #time_created method returns the time when the Document was created.
-
#time_modified ⇒ Time
The #time_modified method returns the last time the Document was modified.
-
#time_published ⇒ Time
The #time_published method returns the time when the Document was published.
- #units ⇒ Integer
- #units=(units_format) ⇒ Object
Constructor Details
↑ #initialize ⇒ Layout::Document #initialize(template_path) ⇒ Layout::Document
The #initialize method creates a new Layout::Document. Passing a path to an existing Layout::Document will use that file as a template. The new Layout::Document won't have a path until it is saved for the first time.
Class Method Details
↑ .open(path) ⇒ Layout::Document
The open method creates a new Layout::Document by loading an existing .layout file.
Instance Method Details
↑ #==(other) ⇒ Boolean
The #== method checks to see if the two Layout::Documents are equal. This checks whether the Ruby Objects are pointing to the same internal object.
↑ #add_entity(entity, layer, page) ⇒ Layout::Entity #add_entity(entity, layer) ⇒ Layout::Entity
The #add_entity method adds an Entity to the Layout::Document and places it on the given Layer and Page. If layer is a shared Layer then page may be ommitted. The Entity must not already belong to a Layout::Document. If the Entity is a Group, then the Group along with all of its children will be added to the Layout::Document.
↑ #attribute_dictionary(name) ⇒ Layout::Dictionary?
The #attribute_dictionary method returns a copy of the document's attribute dictionary with the given name.
is no attribute dictionary
↑ #auto_text_definitions ⇒ Layout::AutoTextDefinitions
The #auto_text_definitions method returns an array of AutoTextDefinition's in the Layout::Document.
↑ #delete_attribute(dictionary_name) ⇒ Boolean #delete_attribute(dictionary_name, key) ⇒ Boolean
The #delete_attribute method is used to delete an attribute from a document.
↑ #export(file_path, options = nil) ⇒ Object
The #export method exports the Layout::Document to 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.pdf” will export a PDF file, whereas “thing.png” will export a set of PNG images.
For LayOut version 2020.1, valid extensions include .pdf, .jpg, and .png.
↑ #get_attribute(name, key, default_value = nil) ⇒ String, ...
The #get_attribute method is used to retrieve the value of an attribute in the document's attribute dictionary.
If the third parameter, default_value, is not passed and there is no attribute that matches the given name, it returns nil.
If default_value is provided and there is no matching attribute it returns the given value. It does not create an attribute with that name though.
↑ #grid ⇒ Layout::Grid
The #grid method returns the Grid for a Layout::Document.
↑ #grid_snap_enabled=(enabled) ⇒ Object
The #grid_snap_enabled= method sets whether or not grid snap is enabled in the Layout::Document.
↑ #grid_snap_enabled? ⇒ Boolean
The #grid_snap_enabled? method returns whether or not grid snap is enabled in the Layout::Document.
↑ #layers ⇒ Layout::Layers
The #layers method returns the Layers of the Layout::Document.
↑ #object_snap_enabled=(enabled) ⇒ Object
The #object_snap_enabled= method enables or disables inference in the Layout::Document.
↑ #object_snap_enabled? ⇒ Boolean
The #object_snap_enabled? method returns whether or not inference is enabled in the Layout::Document.
↑ #page_info ⇒ Layout::PageInfo
The #page_info method returns a reference to the PageInfo settings of the Layout::Document.
↑ #pages ⇒ Layout::Pages
↑ #path ⇒ String
The #path method returns the full path of the Layout::Document file. An empty string is returned for a new Layout::Document (one which has not been saved and opened).
↑ #precision ⇒ Float
The #precision method returns the precision for the Layout::Document.
↑ #precision=(precision) ⇒ Object
LayOut only allows for a finite set of precision values for each units setting, so it will set the precision to the closest valid setting for the specified units. See the “Units” section of LayOut's “Document Setup” dialog for a reference of the available precisions for each units setting.
The #precision= method sets the precision for the Layout::Document.
↑ #remove_entity(entity) ⇒ Object
The #remove_entity method removes an Entity from the Layout::Document. If entity is a Group, then the Group and all of its children will be removed from the Layout::Document.
↑ #render_mode_override ⇒ Integer
The #render_mode_override method returns the override setting for output render modes of SketchUpModels in the Layout::Document.
↑ #render_mode_override=(render_mode) ⇒ Object
The #render_mode_override= method sets the override setting for output render modes of SketchUpModels in the Layout::Document. Setting this to NO_OVERRIDE will prevent overriding the individual SketchUpModel render mode setting during export. This override will only affect raster rendered SketchUpModels, if a viewport is set to vector or hybrid, it will retain that render mode as its output render mode.
↑ #save ⇒ Object #save(path, version = Layout::Document::VERSION_CURRENT) ⇒ Object
The #save method saves the Layout::Document to a file at the given path. Passing an empty path string will save the Layout::Document at its current path.
↑ #set_attribute(name, key, value) ⇒ Object
The #set_attribute method adds an attribute to the document's attribute dictionary.
↑ #shared_entities ⇒ Layout::Entities
The #shared_entities method returns the Entities that exist on shared Layers in the Layout::Document.
↑ #time_created ⇒ Time
The #time_created method returns the time when the Layout::Document was created.
↑ #time_modified ⇒ Time
The #time_modified method returns the last time the Layout::Document was modified.
↑ #time_published ⇒ Time
The #time_published method returns the time when the Layout::Document was published.
↑ #units ⇒ Integer
The #units method returns the units for the Layout::Document.
↑ #units=(units_format) ⇒ Object
The #units= method sets the units for the Layout::Document.