Just a quick little plugin to draw a sine curve in SketchUp.
Draws a sine curve at the Origin and in a Group. User is asked for amplitude, length, and number of segments.
sine_wave.rb
Subscribe to:
Post Comments (Atom)
Popular Posts (Last 30 Days)
-
Sketchup materials library of 12x12 vinyl floor tiles. Download download
-
This SketchUp script assists the user in flattening, or unfolding, 3d objects onto a 2d plane. Installation Download unfoldtool.zip . M...
-
This importer lets you import both ASCII and binary STL files into SketchUp. It automatically detects the type of .stl file and imports acc...
-
The Construction Line Tool allows you to draw constructions lines in a similar way as the Pencil Tool. Toolbar: View > Toolbars >...
-
This Windows-only plugin creates a Toolbar for controlling the Ruby Console It can open and close the Ruby console, clear the console, loa...
-
This is the first step in a greeble plugin. And by first step I mean there are possible bugs. Protrude performs 4 basic operations: div...
-
Apr 2014 * Renamed to MoveIt , and available in t SketchUcation Plugin Store Aug 16, 2009 * Released update fixing possible bugsplat...
-
2010-09 * Updated for small bug in placement in SketchUp 8. toolbars-2010-09.zip This is an update to Custom Toolbars plugin with t...
-
Dec 18, 2010 - TIG just released a new .obj exporter. TIG's plugins are usually solid, so I recommend trying TIG's. ( TIG's OBJe...
-
As you probably know, SketchUp 8 Free does not include the ability import/export DXF/DWG files. Although there are some free and commercia...
1 comment:
Here's an enhancement that adds cosine and tangent, and changes the amplitude and frequency to be floats instead of ints.
# Copyright (C) 2010 Jim Foltz
# Draw a Sine wave
require "sketchup"
module JF
def self.clamp(y, max)
if y > max
y = max
end
if y < -max
y = -max
end
return y
end
def self.draw_sine_wave
prompts = %w( Length Amplitude Segments Function )
defaults = [10.0, 5.0, 24, "Sine"]
list = ['','','',"Sine|Cosine|Tan"]
title = "Parameters"
ret = UI.inputbox(prompts, defaults, list, title)
return unless ret
#a = 10.0.feet
#b = 250.0.feet
b = ret[0].to_l
a = ret[1].to_l
segments = ret[2].to_l
f = ret[3]
#b, a, segments, f = ret.map{|e| e.to_l}
pts = []
0.step(b, b/segments) do |x|
y = 0.0
case f
when 'Sine'
y = a * Math::sin( (x / b) * 2 * Math::PI)
when 'Cosine'
y = a * Math::cos( (x / b) * 2 * Math::PI)
when 'Tan'
y = Math::tan( (x / b) * 2 * Math::PI)
y = clamp(y, a)
end
pts << [x, y]
end
Sketchup.active_model.start_operation("Trig Function")
grp = Sketchup.active_model.active_entities.add_group
entities = grp.entities
entities.add_edges pts
Sketchup.active_model.commit_operation
end
end
unless file_loaded? "jf_trig.rb"
UI.menu("Plugins").add_item("Trig functions") { JF.draw_sine_wave }
file_loaded "jf_trig.rb"
end
Post a Comment