Module: MSPhysics
- Defined in:
- RubyExtension/MSPhysics.rb,
RubyExtension/MSPhysics/hit.rb,
RubyExtension/MSPhysics/body.rb,
RubyExtension/MSPhysics/gear.rb,
RubyExtension/MSPhysics/main.rb,
RubyExtension/MSPhysics/joint.rb,
RubyExtension/MSPhysics/world.rb,
RubyExtension/MSPhysics/dialog.rb,
RubyExtension/MSPhysics/entity.rb,
RubyExtension/MSPhysics/replay.rb,
RubyExtension/MSPhysics/contact.rb,
RubyExtension/MSPhysics/material.rb,
RubyExtension/MSPhysics/settings.rb,
RubyExtension/MSPhysics/collision.rb,
RubyExtension/MSPhysics/materials.rb,
RubyExtension/MSPhysics/joint_tool.rb,
RubyExtension/MSPhysics/scene_data.rb,
RubyExtension/MSPhysics/simulation.rb,
RubyExtension/MSPhysics/joint_fixed.rb,
RubyExtension/MSPhysics/joint_hinge.rb,
RubyExtension/MSPhysics/joint_motor.rb,
RubyExtension/MSPhysics/joint_plane.rb,
RubyExtension/MSPhysics/joint_servo.rb,
RubyExtension/MSPhysics/body_context.rb,
RubyExtension/MSPhysics/joint_piston.rb,
RubyExtension/MSPhysics/joint_slider.rb,
RubyExtension/MSPhysics/joint_spring.rb,
RubyExtension/MSPhysics/control_panel.rb,
RubyExtension/MSPhysics/common_context.rb,
RubyExtension/MSPhysics/joint_corkscrew.rb,
RubyExtension/MSPhysics/joint_universal.rb,
RubyExtension/MSPhysics/joint_up_vector.rb,
RubyExtension/MSPhysics/script_exception.rb,
RubyExtension/MSPhysics/controller_context.rb,
RubyExtension/MSPhysics/joint_curvy_piston.rb,
RubyExtension/MSPhysics/joint_curvy_slider.rb,
RubyExtension/MSPhysics/gear_connection_tool.rb,
RubyExtension/MSPhysics/joint_point_to_point.rb,
RubyExtension/MSPhysics/joint_ball_and_socket.rb,
RubyExtension/MSPhysics/joint_connection_tool.rb
Overview
Defined Under Namespace
Modules: Collision, ControlPanel, Dialog, Materials, Replay, Settings Classes: BallAndSocket, Body, BodyContext, CommonContext, Contact, ControllerContext, Corkscrew, CurvyPiston, CurvySlider, Entity, Fixed, Gear, GearConnectionTool, Hinge, Hit, Joint, JointConnectionTool, JointTool, Material, Motor, Piston, Plane, PointToPoint, SceneData, ScriptException, Servo, Simulation, Slider, Spring, Universal, UpVector, World
Constant Summary
- NAME =
'MSPhysics'.freeze
- VERSION =
'1.0.2'.freeze
- RELEASE_DATE =
'July 19, 2017'.freeze
- EPSILON =
1.0e-6- SHAPES =
{ 0 => 'Null', 1 => 'Box', 2 => 'Sphere', 3 => 'Cone', 4 => 'Cylinder', 5 => 'Chamfer Cylinder', 6 => 'Capsule', 7 => 'Convex Hull', 8 => 'Compound', 9 => 'Static Mesh' }.freeze
- SHAPE_DIRS =
{ 0 => 'X-axis', 1 => 'Y-axis', 2 => 'Z-axis' }.freeze
- JOINT_ID_TO_NAME =
{ 0 => 'None', 1 => 'Hinge', 2 => 'Motor', 3 => 'Servo', 4 => 'Slider', 5 => 'Piston', 6 => 'UpVector', 7 => 'Spring', 8 => 'Corkscrew', 9 => 'BallAndSocket', 10 => 'Universal', 11 => 'Fixed', 12 => 'CurvySlider', 13 => 'CurvyPiston', 14 => 'Plane', 15 => 'PointToPoint' }.freeze
- JOINT_ID_TO_FILE_NAME =
{ 0 => 'none', 1 => 'hinge', 2 => 'motor', 3 => 'servo', 4 => 'slider', 5 => 'piston', 6 => 'up_vector', 7 => 'spring', 8 => 'corkscrew', 9 => 'ball_and_socket', 10 => 'universal', 11 => 'fixed', 12 => 'curvy_slider', 13 => 'curvy_piston', 14 => 'plane', 15 => 'point_to_point' }.freeze
- JOINT_NAMES =
JOINT_ID_TO_NAME.values.freeze
- JOINT_FILE_NAMES =
JOINT_ID_TO_FILE_NAME.values.freeze
- MASS_CONTROLS =
{ 1 => 'by Density', 2 => 'by Mass' }.freeze
- MAGNET_MODES =
{ 1 => 'Mode 1', 2 => 'Mode 2' }.freeze
- BODY_TYPES =
{ 0 => 'Dynamic', 1 => 'Kinematic' }.freeze
- BODY_STATES =
[ 'Ignore', 'Static', 'Frozen', 'Magnetic', 'Collidable', 'Auto Sleep', 'Continuous Collision', 'Enable Friction', 'Enable Script', 'Enable Gravity', 'Enable Thruster', 'Enable Emitter', 'Thruster Lock Axes', 'Emitter Lock Axes', 'Emitter Recoil' ].freeze
- BODY_CON_STATES =
[ 'Clear Ignore Flag', 'Movable', 'Non-Frozen', 'Non-Magnetic', 'Non-Collidable', 'No Auto Sleep', 'No Continuous Collision', 'Disable Friction', 'Disable Script', 'Disable Gravity', 'Disable Thruster', 'Disable Emitter', 'No Thruster Lock Axes', 'No Emitter Lock Axes', "No Emitter Recoil" ].freeze
- MATERIALS =
Coefficients are defined from material to material contacts. Material to another material coefficients are automatically calculated by averaging out the coefficients of both. Many coefficient values are estimated, averaged up, made up, and not accurate. name => [ density (kg/m^3), static friction, kinetic friction, elasticity, softness ]
{ 'Aluminium' => [2700, 0.42, 0.34, 0.30, 0.01], 'Brass' => [8730, 0.35, 0.24, 0.40, 0.01], 'Brick' => [1920, 0.60, 0.55, 0.20, 0.01], 'Bronze' => [8200, 0.36, 0.27, 0.60, 0.01], 'Cadnium' => [8640, 0.79, 0.46, 0.60, 0.01], 'Cast Iron' => [7300, 0.51, 0.40, 0.60, 0.01], 'Chromium' => [7190, 0.46, 0.30, 0.60, 0.01], 'Cobalt' => [8746, 0.56, 0.40, 0.60, 0.01], 'Concrete' => [2400, 0.62, 0.56, 0.20, 0.01], 'Glass' => [2800, 0.90, 0.72, 0.4, 0.01], 'Copper' => [8940, 0.55, 0.40, 0.60, 0.01], 'Gold' => [19320, 0.49, 0.39, 0.60, 0.01], 'Graphite' => [2230, 0.18, 0.14, 0.10, 0.01], 'Ice' => [916, 0.01, 0.01, 0.10, 0.01], 'Nickel' => [8900, 0.53, 0.44, 0.60, 0.01], 'Plastic' => [1000, 0.35, 0.30, 0.69, 0.01], 'Rubber' => [1100, 1.16, 1.16, 0.01, 0.01], 'Silver' => [10500, 0.50, 0.40, 0.60, 0.01], 'Steel' => [8050, 0.31, 0.23, 0.60, 0.01], 'Teflon' => [2170, 0.04, 0.03, 0.10, 0.01], 'Titanium' => [4500, 0.36, 0.30, 0.40, 0.01], 'Tungsten Carbide' => [19600, 0.22, 0.15, 0.40, 0.01], 'Wood' => [700, 0.50, 0.25, 0.40, 0.01], 'Zinc' => [7000, 0.60, 0.50, 0.60, 0.01] }.freeze
- DEFAULT_SIMULATION_SETTINGS =
{ :solver_model => 16, # 1 - 64 :joint_algorithm => 2, # 0 - accurate; 1 - don't use; 2 - fast. :update_rate => 2, # 1 - 100 :update_timestep => 1/60.0, # 1/30 - 1/1200, in seconds :gravity => -9.801, # in m/s/s along Z-axis :material_thickness => 0.002, # thickness b/w 0.0 and 1/32 meters :contact_merge_tolerance => 0.005, # 0.001+ :world_scale => 9, # 1 - 100 :continuous_collision_check => false, # boolean :full_screen_mode => false, # boolean :ignore_hidden_instances => false, # boolean :game_mode => false, # boolean :hide_joint_layer => false, # boolean :undo_on_end => false, # boolean :key_nav_state => 0, # 0 - off; 1 - normal; 2 - upright. :key_nav_velocity => 40.0, # in m/s :key_nav_omega => 1.0, # in rad/s :key_nav_atime => 0.15, # in seconds :animate_scenes_state => 0, # 0 - off; 1 - one way; 2 - repeat forth and back; 3 - loop around. :animate_scenes_delay => 0.0, # in seconds :animate_scenes_reversed => false # boolean }.freeze
- DEFAULT_BODY_SETTINGS =
{ :type => 0, :shape_id => 8, :shape_dir => 0, :material_name => 'Default', :mass_control => 1, :density => 700, :mass => 1.0, :static_friction => 0.90, :kinetic_friction => 0.50, :enable_friction => true, :elasticity => 0.40, :softness => 0.10, :linear_damping => 0.001, :angular_damping => 0.001, :magnet_mode => 1, :magnet_force => 0.00, :magnet_range => 0.00, :magnet_strength => 0.00, :magnetic => false, :enable_script => true, :static => false, :frozen => false, :collidable => true, :auto_sleep => true, :continuous_collision => false, :thruster_lock_axes => true, :enable_thruster => true, :emitter_lock_axes => true, :emitter_recoil => false, :emitter_rate => 0.1, :emitter_lifetime => 1.0, :emitter_delay => 0.0, :enable_emitter => true, :enable_gravity => true }.freeze
- DEFAULT_BUOYANCY_PLANE_SETTINGS =
{ :material_name => 'MSPhysics Buoyancy', :density => 997.04, :viscosity => 0.015, :current_x => 0, :current_y => 0, :current_z => 0, :plane_size => 10000, :color => Sketchup::Color.new(40,60,220), :alpha => 0.7 }.freeze
- CURSORS =
{ :select => 0, :select_plus => 0, :select_minus => 0, :select_plus_minus => 0, :hand => 0, :grab => 0, :click => 0, :target => 0 }
- CURSOR_ORIGINS =
{ :select => [2,5], :select_plus => [2,5], :select_minus => [2,5], :select_plus_minus => [2,5], :hand => [2,2], :grab => [2,2], :click => [2,2], :target => [15,15] }.freeze
- EMBEDDED_MUSIC_FORMATS =
%w(wav aiff riff ogg voc flac mod it xm s3m m4a 669 med mp3 mp2 mid pat).freeze
- EMBEDDED_SOUND_FORMATS =
%w(wav aiff riff ogg voc mp3 mp2).freeze
- JOYSTICK1_AXES =
%w(leftx lefty leftz rightx righty rightz).freeze
- JOYSTICK2_AXES =
%w(leftx lefty rightx righty).freeze
- JOYSTICK1_BUTTONS =
%w(a b x y lb rb back start leftb rightb).freeze
- JOYSTICK2_BUTTONS =
%w(x a b y lb rb lt rt back start leftb rightb).freeze
- DEFAULT_JOINT_SCALE =
1.0- WATERMARK_COLOR =
Sketchup::Color.new(126, 42, 168)
- DEFAULT_ANGLE_UNITS =
'deg'.freeze
- DEFAULT_POSITION_UNITS =
'cm'.freeze
- SCRIPT_NAME =
'MSPhysicsScript'.freeze
- CONTROLLER_NAME =
'MSPhysicsController'.freeze
- VIEW_UPDATE_TIMESTEP =
1.0 / 60.0
- VIEW_UPDATE_TIMESTEP_INV =
1.0 / VIEW_UPDATE_TIMESTEP
- POSITION_CONVERSION =
{ 'mm' => 0.001, 'cm' => 0.01, 'dm' => 0.1, 'm' => 1.0, 'in' => 0.0254, 'ft' => 0.3048, 'yd' => 0.9144 }
- ANGLE_CONVERSION =
{ 'deg' => 1.degrees.to_f, 'rad' => 1.0 }
Class Attribute Summary collapse
-
.extension ⇒ SketchupExtension
readonly
Get MSPhysics extension.
Class Method Summary collapse
-
.add_watermark_text(x, y, text, name = 'Watermark', component = 'version_text.skp') ⇒ Sketchup::Text?
Create a watermark text.
-
.add_watermark_text2(x, y, text, name = 'Watermark', component = 'version_text.skp') ⇒ Sketchup::Text?
Create a watermark text without material or layer.
-
.all_watermark_texts ⇒ Array<Sketchup::Text>
Get all watermark texts.
-
.delete_all_attributes ⇒ void
Delete MSPhysics attributes from all entities.
-
.delete_attribute(ents, handle, name = nil) ⇒ void
Delete attribute value from a collection of entities.
-
.delete_attributes(ents) ⇒ void
Delete MSPhysics attributes from a collection of entities.
-
.duplicate_camera(camera) ⇒ Sketchup::Camera
Create copy of a camera object.
-
.find_watermark_text_by_name(name) ⇒ Sketchup::Text?
Get watermark text by name.
-
.get_attribute(ents, handle, name, default_value = nil) ⇒ Object
Get common attribute value from a collection of entities.
-
.get_joint_scale ⇒ Numeric
Get physical joint scale.
-
.make_compatible(wrap_op = true) ⇒ void
Make model of previous MSPhysics version compatible with this version.
-
.newton_float_size ⇒ Fixnum
Get float size of the Newton Dynamics physics SDK.
-
.newton_memory_used ⇒ Fixnum
Get memory used by the Newton Dynamics physics SDK at the current time.
-
.newton_version ⇒ String
Get version of the Newton Dynamics physics SDK.
-
.set_attribute(ents, handle, name, value) ⇒ void
Assign attribute value to a collection of entities.
-
.set_joint_scale(scale, wrap_op = true) ⇒ Numeric
Set physical joint scale.
-
.verify_version(wrap_op = true) ⇒ Boolean
Displays MSPhysics version text.
Class Attribute Details
.extension ⇒ SketchupExtension (readonly)
Get MSPhysics extension.
Class Method Details
.add_watermark_text(x, y, text, name = 'Watermark', component = 'version_text.skp') ⇒ Sketchup::Text?
Manually wrap the operation.
Create a watermark text.
.add_watermark_text2(x, y, text, name = 'Watermark', component = 'version_text.skp') ⇒ Sketchup::Text?
Manually wrap the operation.
Create a watermark text without material or layer.
.all_watermark_texts ⇒ Array<Sketchup::Text>
Get all watermark texts.
.delete_all_attributes ⇒ void
Manually wrap the operation.
This method returns an undefined value.
Delete MSPhysics attributes from all entities.
.delete_attribute(ents, handle, name = nil) ⇒ void
Manually wrap the operation.
This method returns an undefined value.
Delete attribute value from a collection of entities.
.delete_attributes(ents) ⇒ void
Manually wrap the operation.
This method returns an undefined value.
Delete MSPhysics attributes from a collection of entities.
.duplicate_camera(camera) ⇒ Sketchup::Camera
Create copy of a camera object.
.find_watermark_text_by_name(name) ⇒ Sketchup::Text?
Get watermark text by name.
.get_attribute(ents, handle, name, default_value = nil) ⇒ Object
Get common attribute value from a collection of entities.
.get_joint_scale ⇒ Numeric
Get physical joint scale.
.make_compatible(wrap_op = true) ⇒ void
This method returns an undefined value.
Make model of previous MSPhysics version compatible with this version.
.newton_float_size ⇒ Fixnum
Get float size of the Newton Dynamics physics SDK.
.newton_memory_used ⇒ Fixnum
Get memory used by the Newton Dynamics physics SDK at the current time.
.newton_version ⇒ String
Get version of the Newton Dynamics physics SDK.
.set_attribute(ents, handle, name, value) ⇒ void
Manually wrap the operation.
This method returns an undefined value.
Assign attribute value to a collection of entities.
.set_joint_scale(scale, wrap_op = true) ⇒ Numeric
Set physical joint scale.
.verify_version(wrap_op = true) ⇒ Boolean
Displays MSPhysics version text.