123456789_123456789_123456789_123456789_123456789_

Class: Sketchup::HatchPatterns

Relationships
Super Chains via Extension / Inclusion / Inheritance
Class Chain:
self, Entity
Instance Chain:
self, Enumerable, Entity
Inherits: Sketchup::Entity

Overview

An HatchPatterns object is a collection of HatchPattern objects. It is used to manage the hatch patterns in a model.

An HatchPattern object represents an hatch pattern in the model.

Version:

  • SketchUp 2027.0

Instance Attribute Summary

Entity - Inherited

#deleted?

The deleted? method is used to determine if your entity is still valid (not deleted by another script, for example.).

#valid?

The #valid? method is used to determine if your entity is still valid (not deleted by another script, for example).

Instance Method Summary

Entity - Inherited

#add_observer

The add_observer method is used to add an observer to the current object.

#attribute_dictionaries

The attribute_dictionaries method is used to retrieve the AttributeDictionaries collection attached to the entity.

#attribute_dictionary

The attribute_dictionary method is used to retrieve an attribute dictionary with a given name that is attached to an Entity.

#delete_attribute

The #delete_attribute method is used to delete an attribute from an entity.

#entityID

The entityID method is used to retrieve a unique ID assigned to an entity.

#get_attribute

The #get_attribute method is used to retrieve the value of an attribute in the entity's attribute dictionary.

#inspect

The #inspect method is used to retrieve the string representation of the entity.

#model

The model method is used to retrieve the model for the entity.

#parent

The parent method is used to retrieve the parent of the entity.

#persistent_id

The #persistent_id method is used to retrieve a unique persistent id assigned to an entity.

#remove_observer

The remove_observer method is used to remove an observer from the current object.

#set_attribute

The set attribute is used to set the value of an attribute in an attribute dictionary with the given name.

#to_s

The #to_s method is used to retrieve the string representation of the entity.

#typename

The typename method retrieves the type of the entity, which will be a string such as "Face", "Edge", or "Group".

Instance Attribute Details

#selected_hatch_pattern ⇒ Sketchup::HatchPattern? (rw)

The #selected_hatch_pattern method retrieves the currently selected HatchPattern, mirroring the selection in the desktop ::UI, or nil if none is selected.

Examples:

hatch_patterns = Sketchup.active_model.hatch_patterns
pattern = hatch_patterns.selected_hatch_pattern

Returns:

Version:

  • SketchUp 2027.0

#selected_hatch_pattern=(pattern) (rw)

The #selected_hatch_pattern= method sets the currently selected HatchPattern, mirroring the selection in the desktop ::UI. Pass nil to clear the selection.

Examples:

hatch_patterns = Sketchup.active_model.hatch_patterns
hatch_patterns.selected_hatch_pattern = hatch_patterns['Pattern']

Parameters:

Raises:

  • (ArgumentError) —

    if the pattern does not belong to this collection.

Version:

  • SketchUp 2027.0

Instance Method Details

#[](index) ⇒ Sketchup::HatchPattern? #[](name) ⇒ Sketchup::HatchPattern?

The #[] method is used to retrieve an HatchPattern by index or name.

Overloads:

Version:

  • SketchUp 2027.0

#add(name, path) ⇒ Sketchup::HatchPattern

The #add method adds an HatchPattern to the HatchPatterns, loading it from a file. The name must be non-empty and unique within the model.

Examples:

hatch_patterns = Sketchup.active_model.hatch_patterns
path = 'path/to/pattern.skh'
hatch_pattern = hatch_patterns.add('Pattern', path)

Parameters:

  • name (String)
  • path (String) —

    the file to load the pattern from

Returns:

Raises:

  • (ArgumentError) —

    if the name is empty, already used by another hatch pattern, or the pattern could not be loaded from the file.

Version:

  • SketchUp 2027.0

#each {|hatch_pattern| ... } ⇒ HatchPatterns

The #each method is used to iterate over all the patterns in the HatchPatterns.

Examples:

hatch_patterns = Sketchup.active_model.hatch_patterns
hatch_patterns.each { |hatch_pattern| puts hatch_pattern.name }

Yields:

  • (hatch_pattern)

Yield Parameters:

Version:

  • SketchUp 2027.0

#length

Alias for #size.

#purge_unused ⇒ HatchPatterns

The #purge_unused method is used to remove unused hatch patterns.

Examples:

hatch_patterns = Sketchup.active_model.hatch_patterns
hatch_patterns.purge_unused

Version:

  • SketchUp 2027.0

#remove(pattern) ⇒ Boolean

The #remove method removes an HatchPattern from the HatchPatterns.

Examples:

hatch_patterns = Sketchup.active_model.hatch_patterns
path = 'path/to/pattern.skh'
hatch_pattern = hatch_patterns.add('Pattern', path)
hatch_patterns.remove(hatch_pattern)

Parameters:

Returns:

  • (Boolean) —

    true if the pattern was removed, false if it was not found

Version:

  • SketchUp 2027.0

#size ⇒ Integer Also known as: #length

The #size method retrieves the number of hatch patterns in the HatchPatterns.

Examples:

hatch_patterns = Sketchup.active_model.hatch_patterns
number = hatch_patterns.size

Returns:

  • (Integer) —

    the number of hatch patterns

Version:

  • SketchUp 2027.0