Those are great and detailed construction details Craig. Thanks for sharing.
There's a lot of detail in there that would tax me if I were to make revisions. What plugins do you use to speed up your workflow?
Those are great and detailed construction details Craig. Thanks for sharing.
There's a lot of detail in there that would tax me if I were to make revisions. What plugins do you use to speed up your workflow?
@kiwi15 said:
Hi TommyK,
This new way is indeed a much better way to tweak component properties. Apparently you are not the only one who have found the native Component Browser cumbersome: https://extensions.sketchup.com/en/content/component-properties
Thanks for a cool and promising plugin:)
Thanks, kiwi. Yes ThomThom's plugin is indeed worth mentioning in this thread.
I must admit I have other distractions at the moment, so development on this is slow. Glue properties are high on my list for this plugin.
Plugin has been updated. This is still an alpha release, but there are big improvements.
Release Notes
v 0.2.0
Developer Contributions Welcome
There is a dizzying array of potential properties that can be edited in SketchUp, which will take a lot of coding to complete. I have developed a way to organise each property in this plugin, so developers (myself included) will be able to write just 4 methods (propertyName, get, set, validate) for each property that they wish to add to the mix.
If you are interested, have a look at the propertyType.rb file in the plugin, and see if you can't write the code needed to get your favourite property into the plugin. I will be happy to review and integrate contributions.
###############
### EXAMPLE ###
###############
# Each new property type needs to define 4 methods as in the example below.
# Note that all methods are class methods, so it can be called without creating
# an instance of the class.
# The first method simply defines the name of the property type, and the name of
# the 'get', 'set' and 'validate' methods it uses.
def self.example
# getNameFunc is an optional variable, which builds the name from parameters
#passed to the method. This is required for property types such as atributes,
# which need to include the attribute dictionaries and attribute label in the name
values = {'name' => 'example', \
'label' => 'Example', \
'getNameFunc' => 'exampleName', \
'getValueFunc' => 'getExample', \
'setValueFunc' => 'setExample', \
'validateFunc' => 'validateExample'}
return values
end
def self.exampleName(options)
name = 'example;' + options.to_s
return name
end
# The get method takes a Sketchup;;Selection object, and any parameters required.
# Parameters are required when getting deeper structured information about attributes
# or Classifications, for example.
#
# Params;
# +selection+;; Sketchup;;Selection object from which to get the values from.
# +params+;; Additional parameters required to get the value (optional).
def self.getExample(selection, params)
result = {}
result['label'] = 'example' # the label shown to the user (optional - defaults to existing label)
result['hidden'] = false # if true, the input box on the editor window will be hidden (optional - defaults to false)
result['message'] = "This is a message, not that you need it" # this shows the help text that can be displayed on the editor window (optional)
result['warning'] = "Watch out" # a warning to be displayed prominently to the user next to the label text (optional)
result['value'] = selection[0].definition.description # the output value. Can be a string, or an array of result objects with the same values as above (required)
result['form-type'] = 'text' # the form type, can be 'text', 'textarea', 'checkbox', 'select'
return result
end
# The set method sets the property of the selection.
#
# Params;
# +selection+;; Sketchup;;Selection object to which we can apply the properties.
# +params+;; The values to set the property with.
def self.setExample(selection, params)
if selection.length > 0
# Make your edits here
stuff = params['value'] # values normally reside in this hash
params['success'] = true # mark your values as successfully set
return params # return the params
else
params['success'] = false # report that something went wrong
params['warning'] = "something went wrong" # optional message to be displayed to the user
return params # return the params
end
end
# The validate method validates the input parameters, and amends them if necessary.
#
# Params;
# +selection+;; Sketchup;;Selection object to which the properties are to be applied.
# +params+;; A hash object containing values.
def self.validateExample(selection, params)
if params['value'] == "oh no" # check for problems with values
params['error'] = true # report an error - this will stop the setting of the property
params['warning'] = "Value given is not a string" # optional message to be displayed to the user
end
return params # return the parameters for the next step; set the property.
end
The plugin imports DXF text as SketchUp Text Label entities.
Adapted from TIG's importDXFText (which can be found here: http://sketchucation.com/forums/viewtopic.php?t=23002). SketchUp Text Labels are more lightweight than the 3D Text that TIG's plugin makes.
Download from the Plugin Store:
http://sketchucation.com/pluginstore?pln=importDXFtextLabel
Run by:
Menu > File > Import DXF Text Label...
Select the DXF file [text-type] from the first dialog.
Select the DXF's Units in next dialog.
Progress is reported in the Ruby Console.
I've been getting an error that breaks your plugin for some files, TIG.
gsub': invalid byte sequence in UTF-8 (ArgumentError)`
It appears that my file had text that was not encoded in UTF-8. I added a line to your code to get it working.
txt.strip! if txt txt.chomp! if txt txt = txt.encode("UTF-16be", :invalid=>:replace, :replace=>"?").encode('UTF-8') # added this line
I do like the auto label tool. I've been getting more in the habit of using it, by putting in information into the model, which I pull out within LayOut. It's a well designed system. However, more and more, I find myself going back to Sketchup to add/amend details (to a component description, more often than not), save model, refresh viewport in LayOut, before carrying on. This is a waste of time.
What has become clear for me in the pursuit of going more and more BIM, is that information about a model is more naturally manipulated within a paper layout (ie within LayOut). So users should have the ability to change the information in a SketchUp model from within LayOut.
I think the best way to do this is by expanding the features of the label tool. For example, if <ComponentDescription> is in the label text, the user should be able to, say, right click on the auto-text and select "edit property". Then the user edits the text of that property as if it was carrying on with a normal annotation, but the property gets updated on the model itself.
This changes the paradigm from "SketchUp to LayOut", to "SketchUp to/from LayOut", but I don't think this is a bad thing.
@brettsichellodesign said:
- With all of this BIM information being added in Sketchup, Layout needs to be able to pull that information into a window or door schedule without a huge amount of time required to set up the table and double check it over and over.
I think this would be possible with the new Layout C API, if only someone can build an extension that does it...
Also, with all this BIM, I think we need a way for information added in LayOut to be synced to the Sketchup model. We annotate in LayOut, so it only makes sense for LayOut to be the place from which information is added to the model... With a Ruby API in LayOut (hopefully for 2017), this should be possible with a LayOut extension.
@driven said:
Tommy, just set it as a global preference and it works for SU and Safari...
defaults write NSGlobalDomain WebKitDeveloperExtras -bool true
paste into Terminal or wrap in %x() from Ruby Console...
john
YES! IT WORKS! SO SIMPLE! THANK YOU!
I am sure I am doing something stupid, but this isn't working for me.
I have found ~/Library/Preferences/com.sketchup.SketchUp.2016.plist . Opened it with Xcode, made the additional property to the root, saved it. Then nothing. I try to go back to open the .plist file again, and it doesn't let me.... Strange? Any ideas?
So I got as far as this, using back ticks:
sql = %x(sqlite3 ~/Desktop/sp500data.sqlite "SELECT * FROM companies;")
I am getting an output.
I have two concerns:
FYI I am using a database from here: http://ruby.bastardsbook.com/files/projects/sp500/sp-500-historical-stock-prices.zip
Thanks for your engagement - it is getting me somewhere, at least.