Class: MSPhysics::JointConnectionTool

Inherits:
Entity
  • Object
show all
Defined in:
RubyExtension/MSPhysics/joint_connection_tool.rb

Overview

Since:

  • 1.0.0

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Entity

#inspect, #to_s

Constructor Details

#initializeJointConnectionTool

class << self

Since:

  • 1.0.0

Class Method Details

.activateBoolean

Activate joint connection tool.

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0

.active?Boolean

Determine whether joint connection tool is active.

Returns:

  • (Boolean)

Since:

  • 1.0.0

.connect_joint_id(body, id) ⇒ Array<Fixnum>

Connect joint id to a group/component.

Parameters:

  • body (Sketchup::Group, Sketchup::ComponentInstance)
  • id (Fixnum)

Returns:

  • (Array<Fixnum>)

    The new joint ids of a group/component.

Since:

  • 1.0.0

.deactivateBoolean

Deactivate joint connection tool.

Returns:

  • (Boolean)

    success

Since:

  • 1.0.0

.disconnect_joint_id(body, id) ⇒ Array<Fixnum>

Note:

Manually wrap the operation.

Connect joint id from a group/component.

Parameters:

  • body (Sketchup::Group, Sketchup::ComponentInstance)
  • id (Fixnum)

Returns:

  • (Array<Fixnum>)

    The new joint ids of a group/component.

Since:

  • 1.0.0

.get_all_connections(consider_world) ⇒ Array<Array>

Get all joint connections.

Parameters:

  • consider_world (Boolean)

    Whether to return MSPhysics::Body instances or Sketchup::Group/ Sketchup::ComponentInstance instances in place of bodies.

Returns:

  • (Array<Array>)

    [ [joint_ent, joint_tra, child_body, parent_body, joint_id], ... ]

Since:

  • 1.0.0

.get_conections_from_data(fbdata, fjdata) ⇒ Object

Get all joint connections from connection data.

Parameters:

  • fbdata (Hash)

    A hash of body data: { body => [centre, connected_ids], ... }

  • fjdata (Hash)

    A hash of joint data: { joint_id => [[joint_ent, joint_tra, parent_body], ...], ... }

Since:

  • 1.0.0

.get_connected_bodies(joint, joint_parent) ⇒ Array

Get all bodies connected to a joint.

Parameters:

  • joint (Sketchup::Group, Sketchup::ComponentInstance)
  • joint_parent (Sketchup::Group, Sketchup::ComponentInstance, nil)

Returns:

  • (Array)

    [ connected_inst, ... ]

Since:

  • 1.0.0

.get_connected_joint_ids(body) ⇒ Array<Fixnum>

Get all joint ids connected to a group/component.

Parameters:

  • body (Sketchup::Group, Sketchup::ComponentInstance)

Returns:

  • (Array<Fixnum>)

Since:

  • 1.0.0

.get_connected_joints(body) ⇒ Array<Array>

Get all joints connected to a body.

Parameters:

  • body (Sketchup::Group, Sketchup::ComponentInstance)

Returns:

  • (Array<Array>)

    [ [joint_ent, joint_tra, joint_parent], ... ]

Since:

  • 1.0.0

.get_connection_data(consider_world) ⇒ Array<(Hash, Hash)>

Get all connection data.

Parameters:

  • consider_world (Boolean)

    Whether to return MSPhysics::Body instances or Sketchup::Group/ Sketchup::ComponentInstance instances in place of bodies.

Returns:

  • (Array<(Hash, Hash)>)

    An array of two values.

    • The first element is a Hash of body data: { body => [centre, connected_ids], ... }

    • The second element is a Hash of joint data: { joint_id => [[joint_ent, joint_tra, parent_body], ...], ... }

Since:

  • 1.0.0

.get_curve_length(joint, joint_parent, loop = false) ⇒ Numeric

Get curve length of a CurvySlider or a CurvyPiston joint.

Parameters:

  • joint (Sketchup::Group, Sketchup::ComponentInstance)
  • joint_parent (Sketchup::Group, Sketchup::ComponentInstance, nil)
  • loop (Boolean) (defaults to: false)

Returns:

  • (Numeric)

    Curve length in inches.

Since:

  • 1.0.0

.get_joints_by_id(joint_id) ⇒ Array

Get joint by its id.

Parameters:

  • joint_id (Fixnum)

Returns:

  • (Array)

    An array of joint data. Each joint data represents an array of two elements. The first element of joint data is joint entity. The second element of joint data is joint parent entity.

Since:

  • 1.0.0

.get_points_on_curve(joint, joint_parent) ⇒ Array<Geom::Point3d>

Get all points on a CurvySlider or a CurvyPiston joint.

Parameters:

  • joint (Sketchup::Group, Sketchup::ComponentInstance)
  • joint_parent (Sketchup::Group, Sketchup::ComponentInstance, nil)

Returns:

  • (Array<Geom::Point3d>)

    An array of points in global space.

Since:

  • 1.0.0

.set_connected_joint_ids(body, ids) ⇒ Object

Set connected joint ids of a group/component.

Parameters:

  • body (Sketchup::Group, Sketchup::ComponentInstance)
  • ids (Array<Fixnum>)

Since:

  • 1.0.0

.toggle_connect_joint_id(body, id) ⇒ Array<Fixnum>

Note:

Manually wrap the operation.

Toggle connect joint id to a group/component.

Parameters:

  • body (Sketchup::Group, Sketchup::ComponentInstance)
  • id (Fixnum)

Returns:

  • (Array<Fixnum>)

    The new joint ids of a group/component.

Since:

  • 1.0.0