Module: ModraUp
Overview
Application entry points for accessing the active model, reading version information, registering extensions, opening files, and formatting units. This namespace follows the SketchUp Ruby API naming conventions.
Defined Under Namespace
Classes: AppObserver, ArcCurve, AttributeDictionaries, AttributeDictionary, Axes, Behavior, Camera, Color, ComponentDefinition, ComponentInstance, Console, ConstructionLine, ConstructionPoint, Curve, DefinitionList, DefinitionObserver, DefinitionsObserver, Dimension, DimensionLinear, DimensionObserver, Drawingelement, Edge, EdgeUse, Entities, EntitiesObserver, Entity, EntityObserver, EnvironmentsObserver, ExtensionsManager, Face, FrameChangeObserver, Group, HatchPattern, HatchPatternData, HatchPatterns, Http, Image, ImageRep, Importer, InputPoint, InstanceObserver, InstancePath, Layer, LayerFolder, Layers, LayersObserver, Licensing, LineStyle, LineStyles, LoadHandler, LocalExtensionManager, Loop, Material, Materials, MaterialsObserver, Menu, Model, ModelObserver, OptionsManager, OptionsProvider, OptionsProviderObserver, Overlay, OverlaysManager, Page, Pages, PagesObserver, PickHelper, Procedure, RegionalSettings, RenderingOptions, RenderingOptionsObserver, SectionPlane, Selection, SelectionObserver, ShadowInfo, ShadowInfoObserver, Skp, Text, Texture, TextureWriter, Tool, Tools, ToolsObserver, UVHelper, Vertex, View, ViewObserver
Constants # collapse
- ModraUp::PROCEDURE_ID_FOLLOW_ME
The native process Follow Me's id (in the string form of ComponentDefinition#attach_procedure).
- ModraUp::PROCEDURE_ID_SOLID_TOOLS
The native procedure ID for solid tools (union, difference, intersection).
- ModraUp::PROCEDURE_ID_COPY_ALONG
The native process ID for "Copy Along" in Ruby SketchUp.
- ModraUp::SnapTo_Arbitrary
SnapTo_Arbitrary = 0
Snap to any face.
- ModraUp::SnapTo_Horizontal
SnapTo_Horizontal = 1
Snap to horizontal plane.
- ModraUp::SnapTo_Vertical
SnapTo_Vertical = 2
Snap to vertical plane.
- ModraUp::SnapTo_Sloped
SnapTo_Sloped = 3
Snap to the nearest point on a sloped surface.
- ModraUp::VERSION
The application version string.
Class Method Summary # collapse
-
.register_procedure(procedure) ⇒ Boolean
Register a procedure in the current session. Registering the same instance or the same ID again returns false. Only the procedure's ID and parameters are stored in the model. When the file is opened, the procedure must be registered; otherwise, get_procedure_parameters returns an empty value and run_procedures does not run, preserving any existing output geometry.
-
.active_model ⇒ ModraUp::Model
The currently open model (the host contains only this instance).
-
.version ⇒ String
Declared SketchUp compatible version string (currently fixed to "24.0.0").
-
.version_number ⇒ Integer
Version number (current +2400000000).
-
.app_name ⇒ String
Application Name, currently set to `ModraUp`.
-
.platform ⇒ Symbol
Current operating system. macOS is denoted as :platform_osx, and Windows as :platform_win.
-
.register_extension(extension, load_at_start) ⇒ SketchupExtension
Register the SketchupExtension. When load_at_start is true, its load path (specified by the second parameter @path of SketchupExtension.new) is immediately +require"d.
-
.require(path) ⇒ Boolean
Loads Ruby files, supporting both .rbe (RBS2.0) and old .rbs (RBS1.0) formats. Returns false if the file is not found or a LoadError occurs; the old error strategy of the host application is maintained.
-
.load(path) ⇒ Boolean
Load Ruby files. Currently, behaves the same as ModraUp.require: the file will not be executed more than once; and it returns false if the file is not found.
-
.is_pro? ⇒ Boolean
Is Pro functionality enabled. Currently always true; otherwise, the DC Manager/Report functions will be disabled.
-
.is_online ⇒ Boolean
Do you consider there to be an online connection? Currently, it is always set to false, with DC reports using local HTML.
-
.get_datfile_info(key, default = nil) ⇒ Object
Read keys from the SketchUp installation dat file. Return the default value if no dat file is found.
-
.get_i18n_datfile_info(key, default = nil) ⇒ Object
Read the interface language dat file. Like ModraUp.get_datfile_info, it returns default when no table is found.
-
.temp_dir ⇒ String
Temporary directory (system temporary path).
-
.get_locale ⇒ String
The current application language; uses the system language if no fixed language is set, following SketchUp style tags such as "zh-CN", "en-US".
-
.os_language ⇒ String
System preferred language, unaffected by the application language setting.
-
.is_64bit? ⇒ Boolean
Is the process 64-bit.
-
.mdi? ⇒ Boolean
Is the multi-document interface. This host is single-document and always returns false.
-
.debug_mode? ⇒ Boolean
Outputs API misuse warnings to the console. Currently, only the switch is saved; individual messages are not printed yet.
-
.debug_mode= ⇒ Boolean
Sets the value reported by ModraUp.debug_mode?.
-
.plugins_disabled? ⇒ Boolean
Does the plugin skip the Plugins directory's .rb files on startup? This setting is defined in the ModraUp.write_default preference file and will take effect on the next startup.
-
.plugins_disabled= ⇒ Boolean
Sets the flag returned by ModraUp.plugins_disabled?. Pass true to disable the plugins directory.
-
.is_valid_filename?(filename) ⇒ Boolean
Does the filename contain no path separators or Windows illegal characters.
-
.get_shortcuts ⇒ Array<String>
Returns all shortcuts configured by the host, including user rebindings, multiple bindings for the same command, and plugin commands.
-
.get_resource_path(filename) ⇒ String, nil
Find application resource files (LanguageHandler uses). In $LOAD_PATH, look for Resources/en-US/filename, then find the same-named file. If not found, return nil.
-
.format_length(length) ⇒ String
Format the length according to the current model units (internal inches). The second parameter covers decimal places; a negative value will remove trailing zeros.
-
.format_angle(radians) ⇒ String
Format the angle in radians into a degree format used by the current model. Currently, it outputs in degrees with a decimal point, e.g., ..
-
.format_degrees(degrees) ⇒ String
Format a number that is already in degrees into an angle text (currently "%.1f").
-
.format_area(square_inches) ⇒ String
Format the area according to the current model units. The parameter is in square inches.
-
.parse_length(text) ⇒ Float, nil
Parse the length text into inches. Return nil if parsing fails.
-
.format_volume(cubic_inches) ⇒ String
Format the volume using the current model's length unit. The parameter is in cubic inches.
-
.break_edges? ⇒ Boolean
Does the line snap to intersect coplanar edges at the intersection point when breaking them? Defaults to true. The line tool reads this switch from the core imprint_coplanar_line.
-
.break_edges= ⇒ Boolean
Set ModraUp.break_edges? to false to keep intersecting edges intact.
-
.create_texture_writer ⇒ ModraUp::TextureWriter
Create a texture writer.
-
.add_observer(observer) ⇒ Boolean
Register application-level observers. Adding the same object a second time returns false.
-
.remove_observer(observer) ⇒ Boolean
Remove application-level observers. Returns false if not registered.
-
.read_default(section, key, default = nil) ⇒ Object
Read the persisted preferences and return the type written at the time (see ModraUp.write_default); if not written, return default.
-
.write_default(section, key, value) ⇒ Boolean
Persist preferences: save values by type, readable during the current session and written to disk on exit.
-
.status_text= ⇒ Object
Displays a prompt in the status bar on the left. Equivalent to ModraUp.set_status_text(text, SB_PROMPT). Ignored if there is no host.
-
.vcb_label= ⇒ Object
VCB Label. Equivalent to ModraUp.set_status_text(label_text, SB_VCB_LABEL).
-
.vcb_value= ⇒ Object
VCB value. Equivalent to ModraUp.set_status_text(value, SB_VCB_VALUE).
-
.set_status_text ⇒ Object, nil
Set the status bar. Clear the left prompt, VCB label, and VCB value.
-
.undo ⇒ Boolean
Undo the previous operation on the current model.
-
.redo ⇒ nil
Redoes the current model by executing the next step in the undo stack.
-
.file_new ⇒ Module
Create a new document. When hosted, it follows the path of the "File / New" menu: if the document is dirty, ask to save first, then display the template dialog. If the user cancels saving or selects a template, the document remains unchanged. When not hosted, reset to the default millimeter template (1 m cube).
-
.open_file(path) ⇒ Boolean, Integer
Open a .osk3d or .skp file, or pass it to the importer registered by ModraUp.register_importer. Replace the current model. If the file does not exist, return false. For dirty documents, prompt the host to save; if the user cancels, return false. If with_status is true, return ModraUp::Model::LOAD_STATUS_SUCCESS (importers return their ModraUp::Importer::ImportSuccess status, etc.). Ignore show_version_warning_dialog.
-
.quit ⇒ nil
Exit the application. Follow the path of closing the window when there is a host (prompt to save dirty documents). Do nothing if there is no host.
-
.focus ⇒ Module
Brings the main window to the foreground. Does nothing if there is no host.
-
.resize_viewport(width, height) ⇒ Boolean
Resize the 3D viewport dimensions. After adjustment, ModraUp::View#vpwidth / ModraUp::View#vpheight aligns correctly.
-
.template ⇒ String
The current template file path. It is an empty string if there is no host and no template is set.
-
.template=(path) ⇒ String
Set the path for the template to be used next time a new model is created. Write the setting when there is a host.
-
.template_dir ⇒ String
Template directory. When hosted, it is located at Templates under the application data directory.
-
.fix_shadow_strings? ⇒ Boolean
Enhance face offsetting to reduce shadow stripe artifacts. Only affects polygon offsetting when there is no true shadow channel.
-
.fix_shadow_strings=(enabled) ⇒ Boolean
Toggle Shadow Stripes Correction.
-
.install_from_archive(path) ⇒ Boolean
Unzip the archive (either .rbz or .zip) to the Plugins directory and save the installation record. On restart, load the top-level entry. A default warning for third-party extensions will pop up; if the user cancels, throw Interrupt. If there is no host, return false.
-
.register_importer(importer) ⇒ Boolean
Register the ModraUp::Importer. Afterward, the "Open / Import" dialog will display its file filter, and ModraUp.open_file will call the load_file method when it corresponds to the extension.
-
.send_action(action) ⇒ Boolean
Trigger an action. The string can include or exclude a trailing colon. Recognized actions: showRubyPanel: (host console), standard views / zoom / perspective, built-in tools, editUndo: / editRedo:,
-
.display_name_from_action(action_name) ⇒ String
Replace the ModraUp.send_action string with a short name. Remove the trailing colon from unknown names and return them unchanged.
-
.find_support_file(name) ⇒ String, nil
Find support files. When querying "Plugins", omitting the directory or passing an empty string returns the user plugin directory. For other two-parameter calls, search for directory/name in the plugin directory (prefix can be removed) and $LOAD_PATH.
-
.find_support_files(extension, directory) ⇒ Array<String>
Lists files with matching extensions in the support directory. Omitting directory returns an empty array.
-
.extensions ⇒ ModraUp::ExtensionsManager
Entries in the extensions table registered with ModraUp.register_extension.
Class Method Details
ModraUp.register_procedure(procedure) ⇒ Boolean
Register a procedure in the current session. Registering the same instance or the same ID again returns false. Only the procedure's ID and parameters are stored in the model. When the file is opened, the procedure must be registered; otherwise, get_procedure_parameters returns an empty value and run_procedures does not run, preserving any existing output geometry.
ModraUp.active_model ⇒ ModraUp::Model
The currently open model (the host contains only this instance).
ModraUp.version ⇒ String
Declared SketchUp compatible version string (currently fixed to "24.0.0").
ModraUp.version_number ⇒ Integer
Version number (current +2400000000).
ModraUp.app_name ⇒ String
Application Name, currently set to `ModraUp`.
ModraUp.platform ⇒ Symbol
Current operating system. macOS is denoted as :platform_osx, and Windows as :platform_win.
ModraUp.register_extension(extension, load_at_start) ⇒ extension
Register the SketchupExtension. When load_at_start is true, its load path (specified by the second parameter @path of SketchupExtension.new) is immediately +require"d.
ModraUp.require(path) ⇒ Boolean
Loads Ruby files, supporting both .rbe (RBS2.0) and old .rbs (RBS1.0) formats. Returns false if the file is not found or a LoadError occurs; the old error strategy of the host application is maintained.
ModraUp.load(path) ⇒ Boolean
Load Ruby files. Currently, behaves the same as ModraUp.require: the file will not be executed more than once; and it returns false if the file is not found.
ModraUp.is_pro? ⇒ Boolean
Is Pro functionality enabled. Currently always true; otherwise, the DC Manager/Report functions will be disabled.
ModraUp.is_online ⇒ Boolean
Do you consider there to be an online connection? Currently, it is always set to false, with DC reports using local HTML.
ModraUp.get_datfile_info(key, default = nil) ⇒ Object
Read keys from the SketchUp installation dat file. Return the default value if no dat file is found.
ModraUp.get_i18n_datfile_info(key, default = nil) ⇒ Object
Read the interface language dat file. Like ModraUp.get_datfile_info, it returns default when no table is found.
ModraUp.temp_dir ⇒ String
Temporary directory (system temporary path).
ModraUp.get_locale ⇒ String
The current application language; uses the system language if no fixed language is set, following SketchUp style tags such as "zh-CN", "en-US". LanguageHandler extends the Resources subdirectory using this name.
ModraUp.os_language ⇒ String
System preferred language, unaffected by the application language setting.
ModraUp.is_64bit? ⇒ Boolean
Is the process 64-bit.
ModraUp.mdi? ⇒ Boolean
Is the multi-document interface. This host is single-document and always returns false.
ModraUp.debug_mode? ⇒ Boolean
Outputs API misuse warnings to the console. Currently, only the switch is saved; individual messages are not printed yet.
ModraUp.debug_mode = enabled ⇒ Boolean
Sets the value reported by ModraUp.debug_mode?.
ModraUp.plugins_disabled? ⇒ Boolean
Does the plugin skip the Plugins directory's .rb files on startup? This setting is defined in the ModraUp.write_default preference file and will take effect on the next startup.
ModraUp.plugins_disabled = enabled ⇒ Boolean
Sets the flag returned by ModraUp.plugins_disabled?. Pass true to disable the plugins directory.
ModraUp.is_valid_filename?(filename) ⇒ Boolean
Does the filename contain no path separators or Windows illegal characters.
ModraUp.get_shortcuts ⇒ Array<String>
Returns all shortcuts configured by the host, including user rebindings, multiple bindings for the same command, and plugin commands.
Each item is a key, tab, and command identifier (e.g., selectLineTool:); if no command identifier is present, the registered menu path is used.
Keys are represented in Qt PortableText format, preserving distinctions between modifiers like Ctrl and Meta, and do not force conversion to Windows key format.
HTML input temporarily suspends shortcut triggering without affecting the query; unbound commands are not output, and an empty array is returned if there is no host.
ModraUp.get_resource_path(filename) ⇒ String, nil
Find application resource files (LanguageHandler uses). In $LOAD_PATH, look for Resources/en-US/filename, then find the same-named file. If not found, return nil.
ModraUp.format_length(length) ⇒ StringModraUp.format_length(length, precision) ⇒ String
Format the length according to the current model units (internal inches). The second parameter covers decimal places; a negative value will remove trailing zeros.
ModraUp.format_angle(radians) ⇒ String
Format the angle in radians into a degree format used by the current model. Currently, it outputs in degrees with a decimal point, e.g., ..
ModraUp.format_degrees(degrees) ⇒ String
Format a number that is already in degrees into an angle text (currently "%.1f").
ModraUp.format_area(square_inches) ⇒ String
Format the area according to the current model units. The parameter is in square inches.
ModraUp.parse_length(text) ⇒ Float, nil
Parse the length text into inches. Return nil if parsing fails.
ModraUp.format_volume(cubic_inches) ⇒ String
Format the volume using the current model's length unit. The parameter is in cubic inches.
ModraUp.break_edges? ⇒ Boolean
Does the line snap to intersect coplanar edges at the intersection point when breaking them? Defaults to true. The line tool reads this switch from the core imprint_coplanar_line.
ModraUp.break_edges = enabled ⇒ enabled
Set ModraUp.break_edges? to false to keep intersecting edges intact.
ModraUp.create_texture_writer ⇒ ModraUp::TextureWriter
Create a texture writer.
ModraUp.add_observer(observer) ⇒ Boolean
Register application-level observers. Adding the same object a second time returns false.
When an observer implements expectsStartupModelNotifications and returns true, the plugin will receive the onNewModel notification after the plugin loads. New, open, and exit events are then dispatched by the host.
ModraUp.remove_observer(observer) ⇒ Boolean
Remove application-level observers. Returns false if not registered.
ModraUp.read_default(section, key, default = nil) ⇒ Object
Read the persisted preferences and return the type written at the time (see ModraUp.write_default); if not written, return default.
ModraUp.write_default(section, key, value) ⇒ Boolean
Persist preferences: save values by type, readable during the current session and written to disk on exit.
Like in SketchUp 2018 and later versions, they are stored in the user directory's PrivatePreferences.json (macOS: ~/Library/Application Support/ModraUp 2026/ModraUp; Windows: %LOCALAPPDATA%\ModraUp\ModraUp 2026\ModraUp).
Nil, true/false, Integer (64-bit or less), Float, String, and their composed Array, Hash are read back as-is; Lengths are stored as Float, Symbols as String, Hash keys as String, and other objects as their to_s result.
ModraUp.status_text = text ⇒ text
Displays a prompt in the status bar on the left. Equivalent to ModraUp.set_status_text(text, SB_PROMPT). Ignored if there is no host.
ModraUp.vcb_label = label_text ⇒ label_text
VCB Label. Equivalent to ModraUp.set_status_text(label_text, SB_VCB_LABEL).
ModraUp.vcb_value = value ⇒ value
VCB value. Equivalent to ModraUp.set_status_text(value, SB_VCB_VALUE).
ModraUp.set_status_text ⇒ nilModraUp.set_status_text(status_text = '', position = SB_PROMPT) ⇒ Object
Set the status bar. Clear the left prompt, VCB label, and VCB value. position can be SB_PROMPT (left prompt), SB_VCB_LABEL (VCB label), or SB_VCB_VALUE (VCB value).
ModraUp.undo ⇒ Boolean
Undo the previous operation on the current model.
ModraUp.redo ⇒ nil
Redoes the current model by executing the next step in the undo stack.
ModraUp.file_new ⇒ Sketchup
Create a new document. When hosted, it follows the path of the "File / New" menu: if the document is dirty, ask to save first, then display the template dialog. If the user cancels saving or selects a template, the document remains unchanged. When not hosted, reset to the default millimeter template (1 m cube).
ModraUp.open_file(path) ⇒ BooleanModraUp.open_file(path, with_status: true) ⇒ Integer, false
Open a .osk3d or .skp file, or pass it to the importer registered by ModraUp.register_importer. Replace the current model. If the file does not exist, return false. For dirty documents, prompt the host to save; if the user cancels, return false. If with_status is true, return ModraUp::Model::LOAD_STATUS_SUCCESS (importers return their ModraUp::Importer::ImportSuccess status, etc.). Ignore show_version_warning_dialog.
ModraUp.quit ⇒ nil
Exit the application. Follow the path of closing the window when there is a host (prompt to save dirty documents). Do nothing if there is no host.
ModraUp.focus ⇒ Sketchup
Brings the main window to the foreground. Does nothing if there is no host.
ModraUp.resize_viewport(width, height) ⇒ BooleanModraUp.resize_viewport(width, height, logical_pixels: true) ⇒ Boolean
Resize the 3D viewport dimensions. After adjustment, ModraUp::View#vpwidth / ModraUp::View#vpheight aligns correctly. logical_pixels: false when resizing by physical pixels; uses screen DPR when hosted, otherwise directly sets the model viewport.
ModraUp.template ⇒ String
The current template file path. It is an empty string if there is no host and no template is set.
ModraUp.template=(path) ⇒ path
Set the path for the template to be used next time a new model is created. Write the setting when there is a host.
ModraUp.template_dir ⇒ String
Template directory. When hosted, it is located at Templates under the application data directory.
ModraUp.fix_shadow_strings? ⇒ Boolean
Enhance face offsetting to reduce shadow stripe artifacts. Only affects polygon offsetting when there is no true shadow channel.
ModraUp.fix_shadow_strings=(enabled) ⇒ Boolean
Toggle Shadow Stripes Correction.
ModraUp.install_from_archive(path) ⇒ trueModraUp.install_from_archive(path, show_warning) ⇒ true
Unzip the archive (either .rbz or .zip) to the Plugins directory and save the installation record. On restart, load the top-level entry. A default warning for third-party extensions will pop up; if the user cancels, throw Interrupt. If there is no host, return false.
ModraUp.register_importer(importer) ⇒ true
Register the ModraUp::Importer. Afterward, the "Open / Import" dialog will display its file filter, and ModraUp.open_file will call the load_file method when it corresponds to the extension.
ModraUp.send_action(action) ⇒ Boolean
Trigger an action. The string can include or exclude a trailing colon. Recognized actions: showRubyPanel: (host console), standard views / zoom / perspective, built-in tools, editUndo: / editRedo:, pageAdd: / pageDelete: / pageUpdate: / pageNext: / pagePrevious:, renderWireframe: / renderHiddenLine: / renderMonochrome: / renderShaded: / renderTextures:, viewShowAxes: / viewShowHidden: / viewUndo:, fileNew: / fileOpen: / fileSave: (last two go through the host). Integers are Windows command numbers, e.g., 10501 for top view.
ModraUp.display_name_from_action(action_name) ⇒ String
Replace the ModraUp.send_action string with a short name. Remove the trailing colon from unknown names and return them unchanged.
ModraUp.find_support_file(name) ⇒ String, nilModraUp.find_support_file(name, directory) ⇒ String, nil
Find support files. When querying "Plugins", omitting the directory or passing an empty string returns the user plugin directory. For other two-parameter calls, search for directory/name in the plugin directory (prefix can be removed) and $LOAD_PATH.
ModraUp.find_support_files(extension, directory) ⇒ Array<String>
Lists files with matching extensions in the support directory. Omitting directory returns an empty array.
ModraUp.extensions ⇒ ModraUp::ExtensionsManager
Entries in the extensions table registered with ModraUp.register_extension.