Dave, thanks for the links but those are for meshing gears. I'm looking for something for chain cogs, which have a different profile. I found a link to a geometric construction technique
http://www.gizmology.net/sprockets.htm
but I was just wondering if anyone had created a plugin that does the same thing.
Latest posts made by nickinwv
-
RE: Bicycle cog plugin?
-
Bicycle cog plugin?
Does anyone have a plugin or other resources to make it easier to make bike cogs and chainrings? I'm working on an invention and I don't want to have to make the cogs from scratch. In fact if there are cassette cogs and a freehub spline somewhere I would prefer to just use those. Couldn't find any in the 3D warehouse, just a 6sp freewheel.
-
RE: Interaction with objects for simulation
Dan,
Thanks for the quick, instructive and helpful reply. I have no formal training in any computer language and thus have been struggling with Ruby. Just when I'm thinking I've learned enough to get by I come across something that I need to know and that may take some time to understand. Given that this is strictly a hobby project right now that time is limited. I've got some questions - would it be better to correspond with you privately?Main question is "Do I need SU Pro to use dynamic components?" I don't currently have it, or money to buy it.
I'm trying the FrameChangeObserver to see if that works any better.
btw The code i posted ran without errors, it just didn't do what I wanted it to. It moved the box 1 step and not 100.
-
RE: Interaction with objects for simulation
Good evening,
Thank you for your replies, sorry I'm so late in responding - I've been preoccupied with other things for a month.-
Dan, I wasn't able to comprehend the frameobserver that you referred to. Would it be possible to post a simple example?
-
Here's a simple example of what I've tried with the "animation" command that doesn't work. It uses Martin Rhinehart's TransformableCI. My example is just the last few lines....
/r/anim1.rb - sample Animation
require 'sketchup'
transformable_ci.rb - a ComponentInstance with easy, transform!-based transformations
from Edges to Rubies - The Complete SketchUp Tutorial
Copyright 2010, Martin Rinehart
require 'sketchup'
$radians_per_degree = Math::PI/180.0
class TransformableCI
=begin
A TransformableCI can do move, rotate and scale transformations. The
developer creates a TransformableCI from a ComponentInstance and then
applies move(), rotate() and/or scale() methods directly, without needing
Transformation objects or methods.Internally, the transformations are performed with the
ComponentInstance.transform!() method, recording changes on the undo stack
and redrawing immediately. (Use a MovableCI if you do not want to record
undo changes and view changes immediately .)This is documented in the tutorial's Chapter 16.
=endattr_reader :inst, :trans def initialize( inst ) @inst = inst @trans = inst.transformation.to_a() end # of initialize def move( *args ) # Point3d or Vector3d or [r,g,b] arg = args[0] if args.length == 3 vec = Geom::Vector3d.new( args[0], args[1], args[2] ) xform = Geom::Transformation.new( vec ) @inst.transform!( xform ) elsif arg.is_a?( Array ) vec = Geom::Vector3d.new( args[0] ) xform = Geom::Transformation.new( vec ) @inst.transform!( xform ) elsif arg.is_a?( Geom::Vector3d ) xform = Geom::Transformation.new( args[0] ) @inst.transform!( xform ) elsif arg.is_a?( Geom::Point3d ) xform = inst.transformation().to_a() xform[12] = arg[0]; xform[13] = arg[1]; xform[14] = arg[2] @inst.transformation= xform else raise "move cannot handle " + args[0].to_s() end end # of move() def rotate( point, plane_or_axis, degrees ) axis = make_axis(plane_or_axis) degrees *= $radians_per_degree xform = Geom::Transformation.rotation( point, axis, degrees ) @inst.transform!( xform ) end # of rotate() def scale( *args ) case args.length when 1 then xform = Geom::Transformation.scaling( args[0] ) when 2 then xform = Geom::Transformation.scaling( args[0], args[1] ) when 3 then xform = Geom::Transformation.scaling( args[0], args[1], args[2] ) when 4 then xform = Geom::Transformation.scaling( args[0], args[1], args[2], args[3] ) end @inst.transform!( xform ) end # of scale()
support functions
def make_axis( plane_or_axis ) if plane_or_axis.is_a?( String ) case plane_or_axis when 'rg' then axis = [0,0,1] when 'rb' then axis = [0,1,0] when 'gb' then axis = [1,0,0] else raise "Plane must be 'rg', 'rb', 'gb' or an axis." end else axis = plane_or_axis end return axis end # of make_axis() def inspect() return '#<Transformable' + @inst.to_s() + '>' end # of inspect()
end # of class MovableCI
#================= Beginning of test code ===================
$mvbl = TransformableCI.new( Sketchup.active_model().selection()[0] )for $i in [1..10] do
$mvbl.move( Geom::Vector3d.new(1, 0, 0) )
Sketchup.active_model().active_view().invalidate()
end
#================= endf test code =========================== -
-
RE: Interaction with objects for simulation
@thomthom said:
Haven't done anything like that, but have you looked at the
Animation
class? http://code.google.com/apis/sketchup/docs/ourdoc/animation.htmlAnd
Group.move!
&ComponentInstance.move!
- moves a group/component instnace without adding the event to the undo stack.Thanks for the response thomthom, that's actually where I started with guidance from Martin Rhinehart's excellent tutorial series. However, as he explains, you can't use that for interactive animation because Sketchup computes the numerical stuff and graphic stuff in separate threads. Don't want to get too deep in the explanation here, but the end result is that the image skips from the start of the animation to the end without showing any of the scenes in between. Martin doesn't know any way around that, I'm trying to find one. Chris Phillips must have found a way because Sketchy Physics does it, not sure if anyone else has.
Thanks again,
Nick -
RE: Interaction with objects for simulation
@chris fullmer said:
SketchUp has NO understanding of physics built into its core. You will have to program that yourself, or use an existing physics library and then tie it into SketchUp - which is what Sketchyphysics does. It uses an existing C or C# (or something) physics library.
So you have to write the physics yourself, or borrow them. Not for the faint of heart in my opinion.
Chris,
Thanks for the reply. The physics part is easy for me, I've been doing that professionally for 30-some years and I'm making a simplified model of the physics. What I don't get is how to animate Sketchup interactively (like SketchyPhysics does). I've only seen examples of scripted or key-frame animations, what I want to do is have the animation respond to changes that occur in each frame. Looked at the ruby source for Sketchy Physics and couldn't see how they do it there. Was wondering if anyone else has done this and can explain it or point me to a good example.
Thanks.
Nick -
RE: Interaction with objects for simulation
Anybody? I'm kind of anxious to find a solution.
Thanks.
Nick -
Interaction with objects for simulation
Good evening,
I'm new to plugin programming, though I've been using Sketchup for several years on an occasional basis and have programming experience in other languages - as an engineer, not a dedicated programmer. I am trying to write a simulation for bicycling, but can't see how to make it respond to controls like Sketchy Physics does. Can anyone give me ideas on how to go about it. I've tried the animation command in the API, and just drawing/redrawing the model after calculating each frame and neither does what I want. The model will have to respond to changes in hill slope, rider power, winds and braking. The reason I prefer not to use SP is that I want it to run fast enough to have smooth movement (I'm on an XP machine). Any help would be appreciated.
Thank you and Happy Holidays,
Nick