Class: MSPhysics::GearConnectionTool
- Defined in:
- RubyExtension/MSPhysics/gear_connection_tool.rb
Overview
Class Method Summary collapse
-
.activate ⇒ Boolean
Activate joint connection tool.
-
.active? ⇒ Boolean
Determine whether joint connection tool is active.
-
.deactivate ⇒ Boolean
Deactivate joint connection tool.
Instance Method Summary collapse
-
#initialize ⇒ GearConnectionTool
constructor
Gears can be formed between Hinge, Motor, Servo, Slider, Piston, Spring, CurvySlider, and CurvyPiston joints.
Methods inherited from Entity
Constructor Details
#initialize ⇒ GearConnectionTool
Gears can be formed between Hinge, Motor, Servo, Slider, Piston, Spring, CurvySlider, and CurvyPiston joints. To connect gears
1. Select instance A.
2. Hold CTRL/SHIFT or both and select instance B.
To disconnect gears
1. Select a geared instance.
2. Hold SHIFT or CTRl+SHIFT and select the other instance.
To change reference joint.
1. Select a geared instance.
2. And click on one of the connected joints.
Changing name and gear ratio
1. Select a geared instance
2. Open MSPhysics UI
3. Navigate to gears section and edit properties.
Rules
1. Both instances must not be ignored and must be top-level entities.
2. Both instances must be connected to at least one joint.
3. Both instances can be connected to the same joint if the joint is
either a Hinge, a Slider, a Spring, or a CurvySlider.
4. Both instances can be connected to multiple joints. By default,
the first, connected joints are used for gears.
Copyable gears
* Copyable gears work in the same concept as copyable joints.
Specs
* Gear information is stored in one of the instances.
* When two instances are connected, both are assigned unique
identifiers.
* Whenever simulation starts, all invalid gear attributes are removed.
62 63 |
# File 'RubyExtension/MSPhysics/gear_connection_tool.rb', line 62 def initialize end |
Class Method Details
.activate ⇒ Boolean
Activate joint connection tool.
11 12 13 14 15 |
# File 'RubyExtension/MSPhysics/gear_connection_tool.rb', line 11 def activate return false if @@instance Sketchup.active_model.select_tool(self.new) true end |
.active? ⇒ Boolean
Determine whether joint connection tool is active.
27 28 29 |
# File 'RubyExtension/MSPhysics/gear_connection_tool.rb', line 27 def active? @@instance ? true : false end |
.deactivate ⇒ Boolean
Deactivate joint connection tool.
19 20 21 22 23 |
# File 'RubyExtension/MSPhysics/gear_connection_tool.rb', line 19 def deactivate return false unless @@instance Sketchup.active_model.select_tool(nil) true end |