This repository was archived by the owner on Sep 17, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
Wikihouse Extension 0.2 Dev #4
Open
MrKriss
wants to merge
31
commits into
tav:master
Choose a base branch
from
MrKriss:Dev
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
74f4873
First Commit with minor Comments added
MrKriss 3a8b321
Restructured folders to hold all plugin code in a single folder, and a
MrKriss ecc56a6
Added .rbz file for extension install
MrKriss d6efc62
Minor changes to README
MrKriss 67f3b27
Changed folder name to wikihouse-extension
MrKriss 941a935
make or make build now generates wikihouse_extension.rbz
MrKriss 29689b1
Introduced an encapsulating Module 'WikihouseExtension' to allow for
MrKriss 30721ec
Fixed the error. Origin was extra white space in generated svg file.
MrKriss 1a2c764
Minor comment edits + experimenting with SVG writer code.
MrKriss 4808846
Updated Make file to also install files into default location on Mac
MrKriss 020f1a4
All Web dialogue will soon be moved here fore easier reference.
MrKriss 5faf0c8
New JSON module for parsing of Ruby Hashes and Arrays to and from json
MrKriss 0018ed9
File no longer needed. Constants moved into utils.rb or
MrKriss 5ee3cac
Added some more constants
MrKriss 8eeae13
Changed dimensions to a module vaiable. Added a Hash
MrKriss 049f861
Added settings Web Dialogue. Testing in progress.
MrKriss 29d1978
Finished Testing Settings Web Dialogue.
MrKriss 2e53890
Moved all Web Dialogue related code to one file.
MrKriss fcc3ede
Make wikihouse_settings a global variable and added sheet_depth
MrKriss 5a7ecd6
Added Changes log file
MrKriss 605bc79
Updated + added alternative manual install
MrKriss dd4d24a
Minor formating edits
MrKriss f8684a4
Minor markdown edits
MrKriss f2fb33f
minor edits to markdown
MrKriss afc6090
Fixed error in Web Dialogue save and error callbacks.
MrKriss 81556e8
Added install_mac_SU8 and install_mac_SU2013 options for make file.
MrKriss d41c070
Minor edits
MrKriss d6d11f4
Changed JSON to a class instead of module. Seems there is a validation
MrKriss 37bf202
Located the bug in downloading via web dialogues
MrKriss 6a97356
Minor comment additions to WikihouseLayoutEngine
MrKriss cb485d8
Lowered threshold on face area to include. Now able to detect C parts in
MrKriss File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| # Ruby Extension Files # | ||
| ######################## | ||
| *.rbz |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| # Make file for creating wikihouse_extention.rbz | ||
|
|
||
| assets=wikihouse-extension/wikihouse-assets/* | ||
| libs=wikihouse-extension/lib/* | ||
|
|
||
| plugin_dir_2013=${HOME}/Library/Application\ Support/SketchUp\ 2013/SketchUp/Plugins/ | ||
| plugin_dir_SU8=/Library/Application\ Support/Google\ SketchUp\ 8/SketchUp/plugins/ | ||
|
|
||
| # Store current git revision | ||
| git-rev=$(git rev-parse --short=8 HEAD) | ||
|
|
||
| # May need changing - not sure if full url is used for amazon buckets | ||
| wikihouse_bucket="https://wikihouse.s3.amazonaws.com/sketchup/" | ||
|
|
||
|
|
||
| build: wikihouse_extension_loader.rb $(assets) $(libs) | ||
| # Creating .rbz file | ||
| zip wikihouse_extension.rbz \ | ||
| wikihouse_extension_loader.rb \ | ||
| wikihouse-extension/wikihouse.rb \ | ||
| $(assets) \ | ||
| $(libs) | ||
|
|
||
| release: wikihouse_extension.rbz | ||
| # s3put BUCKET/[OBJECT] [FILE] - OBJECT is the name FILE is saved as in BUCKET | ||
| s3put ${wikihouse_bucket}wikihouse_extension-$git-rev.rbz wikihouse_extension.rbz | ||
| s3put ${wikihouse_bucket}wikihouse_extension.rbz wikihouse_extension.rbz | ||
|
|
||
| install_mac_SU8: wikihouse_extension_loader.rb wikihouse-extension/wikihouse.rb $(assets) $(libs) | ||
| # Copying files to their locations | ||
| cp -v wikihouse_extension_loader.rb $(plugin_dir_SU8) | ||
| cp -v wikihouse-extension/wikihouse.rb $(plugin_dir_SU8)wikihouse-extension/wikihouse.rb | ||
| cp -v $(assets) $(plugin_dir_SU8)wikihouse-extension/wikihouse-assets/ | ||
| cp -v $(libs) $(plugin_dir_SU8)wikihouse-extension/lib/ | ||
|
|
||
| install_mac_SU2013: wikihouse_extension_loader.rb wikihouse-extension/wikihouse.rb $(assets) $(libs) | ||
| # Copying files to their locations | ||
| cp -v wikihouse_extension_loader.rb $(plugin_dir_2013) | ||
| cp -v wikihouse-extension/wikihouse.rb $(plugin_dir_2013)wikihouse-extension/ | ||
| cp -v $(assets) $(plugin_dir_2013)/wikihouse-extension/wikihouse-assets/ | ||
| cp -v $(libs) $(plugin_dir_2013)/wikihouse-extension/lib/ |
This file contains hidden or 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
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| **Wikihouse Extension 0.2 Dev** | ||
|
|
||
| New Features: | ||
|
|
||
| * Wikihouse now loadable as a Sketchup Extension. | ||
| * Settings Menu added to custimise sheet dimentions. | ||
|
|
||
| List of Changes: | ||
|
|
||
| * Split the main Wikihouse.rb file into multiple files of related code located in the `wikihouse_extension/lib/` directory. | ||
| * Wrapped the whole code into a Ruby module called `WikihouseExtension`, thereby protecting against any namespace clashes in the future. | ||
| * `wikihouse_extension_loader.rb` script now contains all the configuration constants such as paths, platform, and run flags which are most likely to be changed between runs. | ||
| * All utility functions are now in the file `utils.rb` along with any other perminant constants. | ||
| * All output writer classes moved to a file called `writers.rb`. | ||
| * All WebDialoge moved to `WebDialog.rb`. | ||
| * Added a hash **$wikihouse_settings** as a global variale to store all variable configureation/settup data. | ||
| * Any code that is not currently functional is in `other.rb`. | ||
| * Added methods to convert Ruby Hash and Array classes to JSON strings and vice versa. This provides a more flexible bridge between Ruby and JavaScript in the Web Dialogues. | ||
| * Added this change log file. |
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| # JSON formatter for parsing Ruby hases and Arrays to JavaScript as | ||
| # json objects. | ||
| # | ||
| # Original Author: Aerilius | ||
| # Source: http://sketchucation.com/forums/viewtopic.php?f=180&t=35969 | ||
| # | ||
|
|
||
| module WikihouseExtension | ||
|
|
||
| class JSON | ||
|
|
||
| # Redefined JSON to a class instead of a module as this seems to through | ||
| # a load error otherwise (things run fine though). | ||
| # module_function() # Allows Methods to be callable from module | ||
|
|
||
| def self.from_json(json_string) | ||
| # split at every even number of unescaped quotes; if it's not a string then replace : and null | ||
| ruby_string = json_string.split(/(\"(?:.*?[^\\])*?\")/). | ||
| collect{|s| | ||
| (s[0..0] != '"')? s.gsub(/\:/, "=>").gsub(/null/, "nil") : s | ||
| }. | ||
| join() | ||
| result = eval(ruby_string) | ||
| return result | ||
| rescue Exception => e | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. One shouldn't normally catch |
||
| {} | ||
| end | ||
|
|
||
| def self.to_json(obj) | ||
| json_classes = [String, Symbol, Fixnum, Float, Length, Array, Hash, TrueClass, FalseClass, NilClass] | ||
| # remove non-JSON objects | ||
| check_value = nil | ||
| check_array = Proc.new{|o| o.reject!{|k| !check_value.call(k) } } | ||
| check_hash = Proc.new{|o| o.reject!{|k,v| !k.is_a?(String) && !k.is_a?(Symbol) || !check_value.call(v) } } | ||
| check_value = Proc.new{|v| | ||
| if v.is_a?(Array) | ||
| check_array.call(v) | ||
| elsif v.is_a?(Hash) | ||
| check_hash.call(v) | ||
| end | ||
| json_classes.include?(v.class) | ||
| } | ||
| return "null" unless check_value.call(obj) | ||
| # split at every even number of unescaped quotes; if it's not a string then turn Symbols into String and replace => and nil | ||
| json_string = obj.inspect.split(/(\"(?:.*?[^\\])*?\")/).collect{ |s| | ||
| (s[0..0] != '"')? # If we are not inside a string | ||
| s.gsub(/\:(\S+?(?=\=>|\s))/, "\"\\1\""). # Symbols to String | ||
| gsub(/=>/, ":"). # Arrow to colon | ||
| gsub(/\bnil\b/, "null") : # nil to null | ||
| s | ||
| }.join() | ||
| return json_string | ||
| end | ||
|
|
||
| end #JSON | ||
|
|
||
| end # Wikihouse Module | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's Trimble SketchUp now. ;)