This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://stackoverflow.com/a/17982272/816093 | |
module TransformationHelper | |
def flipped_x? | |
dot_x, dot_y, dot_z = axes_dot_products() | |
dot_x < 0 && flipped?(dot_x, dot_y, dot_z) | |
end | |
def flipped_y? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#UI.menu.add_item("Export AMF") { | |
#JF::AMF.export | |
#} | |
require 'rexml/document' | |
module JF | |
module AMF | |
module Exporter |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://sketchucation.com/forums/viewtopic.php?p=124392#p124392 | |
#----------------------------------------------------------------------------# | |
## Copyright 2005-2008, Google, Inc. | |
# This software is provided as an example of using the Ruby interface | |
# to SketchUp. | |
# Permission to use, copy, modify, and distribute this software for | |
# any purpose and without fee is hereby granted, provided that the above |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
=begin | |
This is how you to delete a Layer prior to SketchUp 2015. | |
SketchUp >= 2015 has a Layer.delete method. | |
(c) TIG 2009 | |
layer-delete.rb adds a new Method the Sketchup's Layer Class- | |
"layer.delete()" - it deletes that layer from the model and | |
entities that used it get the default layer instead... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if not defined?(JF::ZoomCrosshairs) | |
UI.menu("Camera").add_item("Zoom Crosshairs") { | |
Sketchup.active_model.select_tool(JF::ZoomCrosshairs.new) | |
} | |
end | |
module JF | |
class ZoomCrosshairs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
require 'nokogiri' | |
require 'nori' | |
require 'pp' | |
SETTINGS = "C:/ProgramData/SketchUp/RubyDebugger.settings" | |
def main | |
@parser = Nori.new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# jf_attach_camera_to_sun.rb (C) [email protected] | |
# | |
# Name: Sun Tool | |
# | |
module JF | |
module AttachCameraToSun | |
VERSION = '1.0.0'.freeze |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Cannon | |
def initialize(bearing, elev, velocity) | |
@item = Sketchup.active_model.entities[0] | |
@t = 0 | |
@v = velocity.to_f | |
@angle = elev.to_f | |
@bearing = bearing.to_f | |
@vy = @v * Math::cos(@angle.degrees) | |
@vz = @v * Math::sin(@angle.degrees) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# with a lot of help from Adam on comp.lang.ruby | |
def extract_chunk(input, output) | |
lenword = input.read(4) | |
length = lenword.unpack('N')[0] | |
type = input.read(4) | |
data = length>0 ? input.read(length) : "" | |
crc = input.read(4) | |
return nil if length<0 || !(('A'..'z')===type[0,1]) | |
#return nil if validate_crc(type+data, crc) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
v_tot = 1 | |
vqty = 0 | |
file = ARGV.shift | |
f = File.new(file, "rb") | |
while ! f.eof? | |
cid = f.read(2).unpack('s')[0] | |
len = f.read(4).unpack('i')[0] |
NewerOlder