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 'net/http' | |
require 'uri' | |
require 'json' | |
require 'base64' | |
# Ask something about what you see in SketchUp | |
prompt = "Is there anything wrong with this building?" | |
# Set the endpoint and API key for the OpenAI API | |
endpoint = "https://api.openai.com/v1/chat/completions" |
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 'net/http' | |
require 'uri' | |
require 'json' | |
# Set the endpoint and API key for the OpenAI API | |
endpoint = "https://api.openai.com/v1/chat/completions" | |
api_key = "<YOUR API KEY>" | |
# Set up the system message for the code completion | |
sys_message = "Generate only valid SketchUp Ruby code." |
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 | |
Available version constants: | |
Layout::Document::VERSION_1 | |
Layout::Document::VERSION_2 | |
Layout::Document::VERSION_3 | |
Layout::Document::VERSION_2013 | |
Layout::Document::VERSION_2014 | |
Layout::Document::VERSION_2015 |
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 | |
Available version constants: | |
Sketchup::Model::VERSION_3 | |
Sketchup::Model::VERSION_4 | |
Sketchup::Model::VERSION_5 | |
Sketchup::Model::VERSION_6 | |
Sketchup::Model::VERSION_7 | |
Sketchup::Model::VERSION_8 |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"> | |
<xs:element name="Furniture"> | |
<xs:complexType> | |
<xs:sequence> | |
<xs:element name="Manufacturer" type="xs:string" /> | |
<xs:element name="Cost" type="xs:string" /> | |
<xs:element name="Type" minOccurs="0"> |
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
# Randomly position textures on faces | |
# To begin, select ungrouped faces and/or grouped objects, not components | |
mod = Sketchup.active_model # Open model | |
ent = mod.entities # All entities in model | |
sel = mod.selection # Current selection | |
# Get all ungrouped faces and those that are inside groups (from selection) | |
all_faces = [] |
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
# Randomize object placement on faces | |
# Select one component and at least one ungrouped face to start | |
mod = Sketchup.active_model # Open model | |
ent = mod.entities # All entities in model | |
sel = mod.selection # Current selection | |
num = 20 # Number of items to place on each face | |
max_rot = 360 # Rotation max. degrees | |
scale_var = 0.5 # Size variation |
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
// Create an in-text ad for long texts by MOVING with jQuery | |
jQuery('.ad').first().insertAfter('.entry-content > p:nth-of-type(4)'); | |
// Create an in-text ad for long texts by COPYING with jQuery | |
jQuery('.ad').first().clone().insertAfter('.entry-content > p:nth-of-type(4)'); |
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
# Sets up four scenes in SketchUp for a turntable-style animation. | |
mod = Sketchup.active_model # Open model | |
view = mod.active_view # View | |
dur = 3 # Scene transition duration | |
eyehgt = 9 * 12 # Eye height, set at 1/2 height of model | |
my_camera = Sketchup::Camera.new [0,-500,eyehgt], [0,0,eyehgt], [0,0,1] | |
view.camera = my_camera |
NewerOlder