Class: ModraUp::Behavior
- Inherits:
-
ModraUp::Entity
- Object
- ModraUp::Entity
- ModraUp::Behavior
Overview
Controls component behaviors such as gluing, scale handles, and facing the camera. Obtain it from ModraUp::ComponentDefinition#behavior.
Instance Method Summary # collapse
-
#always_face_camera? ⇒ Boolean
Always face the component towards the camera (-Y face towards the camera).
-
#always_face_camera= ⇒ Boolean
Sets the Face Me. This ensures that the face always faces the camera.
-
#cuts_opening? ⇒ Boolean
Whether to cut an opening when sticking to a face.
-
#cuts_opening= ⇒ Boolean
Set the opening. Typically, #is2d= should also be set.
-
#is2d? ⇒ Boolean
Can be glued to other faces (Glue to).
-
#is2d= ⇒ Boolean
Sets whether attachment is allowed.
-
#shadows_face_sun? ⇒ Boolean
Returns whether shadows are calculated with the face oriented toward the sun.
-
#shadows_face_sun= ⇒ ModraUp::Behavior
Sets the face to cast a shadow towards the sun.
- #snapto ⇒ Integer
-
#snapto= ⇒ Integer
Set the snap plane.
-
#no_scale_mask? ⇒ Integer
Thumb grip hidden bit mask. Note that the method name ends with a question mark and returns an integer.
-
#no_scale_mask= ⇒ ModraUp::Behavior
Sets the mask for hiding the scale handles of a single component: bit0=X, bit1=Y, bit2=Z, bit3=XZ, bit4=YZ, bit5=XY, bit6=uniform corner scaling. After setting, re-activate the scale tool. Note that this mask does not restrict direct transformation of the component via the API.
Inherited from ModraUp::Entity
-
#typename ⇒ String
Type name (e.g., Face / Edge / Group).
-
#entityID ⇒ Integer
Entity ID within the current session: A small integer starting from 1 that increments and remains constant for the lifetime of the entity, unchanged by undo/redo operations. This ID is not preserved when saving the file; it will be renumbered upon reopening the model. For cross-session identification, use #persistent_id. Copied entities will receive new IDs.
-
#add_observer(observer) ⇒ Boolean
Register a ModraUp::EntityObserver. Adding the same object a second time returns false. Locking, property, and material changes will dispatch an onChangeEntity event.
-
#remove_observer(observer) ⇒ Boolean
Remove the entity observer.
-
#persistent_id ⇒ Integer
Number assigned with the model: A unique, incrementing small integer starting from 1 that persists across model saves and reloads, independent of #entityID. Copied entities receive new numbers, and deleted entities do not reuse their numbers. Edges, faces, vertices, curves, groups, component instances/definitions, dimensions, leader lines/points, section planes, materials, layers, layer folders, and drawing sheets have assigned numbers; all others (rings, EdgeUses, attribute dictionaries, line types, sets, etc.) return 0.
-
#parent ⇒ ModraUp::Model, ModraUp::ComponentDefinition
Returns the owner of this drawing context. At the root this is the model. Inside a definition it is the definition itself.
-
#model ⇒ ModraUp::Model
The model it belongs to.
-
#to_s ⇒ String
String form. Returns "#<Deleted Entity>” when the entity has been deleted.
-
#inspect ⇒ String
Same as #to_s.
-
#attribute_dictionaries ⇒ ModraUp::AttributeDictionaries, nil
Collection of attribute dictionaries. Returns nil (evaluates to false) if there are no dictionaries.
-
#attribute_dictionary(name) ⇒ ModraUp::AttributeDictionary, nil
Retrieve an attribute dictionary by name. If none exists, return nil; if create is true, create an empty dictionary. ModraUp::Loop / ModraUp::EdgeUse / ModraUp::Curve always return nil.
-
#valid? ⇒ Boolean
Returns true if the entity is valid, meaning it has not been deleted from the model. Revoked entities are false; even if new geometry is drawn occupying its original position, this object remains an invalid entity (still false). Repeating the action to restore it makes it valid again.
-
#deleted? ⇒ Boolean
Opposite of #valid?.
-
#set_attribute(dict_name, key, value) ⇒ Object
Write attribute values. Materials, groups, component instances, faces, and edges are supported. When dict_name and key are Symbols, they are converted to strings. The type of data written is the same type that will be read back.
-
#get_attribute(dict_name, key, default = nil) ⇒ Object
Read the attribute. If dict_name and key are Symbols, convert them to strings (similar to SketchUp). If the dictionary or key does not exist, return default. The return value type is the same as what is written by #set_attribute.
-
#delete_attribute(dict_name) ⇒ Boolean
Delete a key, or delete the entire dictionary when the key is omitted.
Instance Method Details
behavior.always_face_camera? ⇒ Boolean
Always face the component towards the camera (-Y face towards the camera).
behavior.always_face_camera = setting ⇒ setting
Sets the Face Me. This ensures that the face always faces the camera.
behavior.cuts_opening? ⇒ Boolean
Whether to cut an opening when sticking to a face.
behavior.cuts_opening = setting ⇒ setting
Set the opening. Typically, #is2d= should also be set.
behavior.is2d? ⇒ Boolean
Can be glued to other faces (Glue to).
behavior.is2d = is2d ⇒ is2d
Sets whether attachment is allowed.
behavior.shadows_face_sun? ⇒ Boolean
Returns whether shadows are calculated with the face oriented toward the sun.
behavior.shadows_face_sun = status ⇒ self
Sets the face to cast a shadow towards the sun.
behavior.snapto ⇒ Integer
Snap Plane: SnapTo_Arbitrary / SnapTo_Horizontal / SnapTo_Vertical / SnapTo_Sloped.
behavior.snapto = snapto ⇒ snapto
Set the snap plane.
behavior.no_scale_mask? ⇒ Integer
Thumb grip hidden bit mask. Note that the method name ends with a question mark and returns an integer.
behavior.no_scale_mask = mask ⇒ self
Sets the mask for hiding the scale handles of a single component: bit0=X, bit1=Y, bit2=Z, bit3=XZ, bit4=YZ, bit5=XY, bit6=uniform corner scaling. After setting, re-activate the scale tool. Note that this mask does not restrict direct transformation of the component via the API.