Module: EnfEditor::UserPropertyUtils

Included in:
EEBrepEdge, EEBrepFace, EEBrepVertex, EEBrepVolume, EEComponent
Defined in:
lib/enfeditor/core_ext/property_utils.rb

Overview

Mixin module to handle user property

Instance Method Summary collapse

Instance Method Details

#create_user_property(key, value, type, subtype = "") ⇒ Object

Create user attribute for brep element

Examples:

# Create user property
element.create_user_property('USER_KEY', '1',    :bool)          # 0 or 1
element.create_user_property('USER_KEY', 'a',    :boolchar)      # one character string
element.create_user_property('USER_KEY', '123',  :integer)       # integer string
element.create_user_property('USER_KEY', '4.56', :real)          # double string
element.create_user_property('USER_KEY', 'hoge', :text)          # text string
element.create_user_property('USER_KEY', 'hoge', :text, 'hoge2') # text string

Parameters:

  • key (String)

    User attribute key

  • value (String)

    User attribute value

  • type (Symbol)

    Specify user attribute type from :bool, :boolchar, :integer, :real or :text.

  • subtype (String) (defaults to: "")

    User Attribute subType (optional)

Since:

  • 0.1.0.0



222
223
224
# File 'lib/enfeditor/core_ext/property_utils.rb', line 222

def create_user_property(key, value, type, subtype = "")
  _create_user_property(key, value, type, subtype)
end

#user_propertiesArray<EEUserProperty>

Returns user properties of element

Examples:

# Modify user property key, value and type
element.user_properties.each do |user_prop|
  key   = user_prop.key      # => USER_KEY
  value = user_prop.value    # => 100
  type  = user_prop.type     # => :integer
end

Returns:

Since:

  • 0.1.0.0



# File 'lib/enfeditor/core_ext/property_utils.rb', line 195