I've used similar to set the size of a webdialog specifying the client area: https://github.com/thomthom/SKUI/blob/master/src/SKUI/window.rb#L98
Posts
-
RE: Calculate the needed width of a WebDialog
-
RE: Calculate the needed width of a WebDialog
Use a callback to make a call from JS to Ruby:
http://www.sketchup.com/intl/en/developer/docs/ourdoc/webdialog.php#add_action_callback
Can't remember if I've already shared this link with you, but here's some notes about WebDialogs: https://github.com/thomthom/sketchup-webdialogs-the-lost-manual/wiki -
RE: Calculate the needed width of a WebDialog
Then there is also the matter of monitor DPI and font scaling.
And the windows borders isn't the same between platforms - and they can vary from theme to theme. Some people use applications like WindowBlinds which can greatly change with width of the border.Calculations is going to be very fragile.
What are you trying to achieve?
-
RE: [Plugin] Component Dropper
The latest is available on Extension Warehouse at the moment. I'm currently too overloaded to update my plugins on SCF. Probably won't happen until February.
-
RE: Best way to iterate all nested entities
Yes it does. Do does Geom::Point3d, Geom::Vector3d and Length - which is why it's recommended you use those types when doing calculations, instead of using arrays and floats.
Also note that Length + Length == Float (annoyingly). So you need to ensure you have a Length before outputting that to a string.
-
RE: [Plugin] Component Dropper
Ackh! Then it's one of the about 20 I need to update on SCF...

-
RE: [Plugin] Component Dropper
You tried to replace the trees with what? With component?
(Btw - your SKP file that you shared wsa 40MB - but when I purged it (Model Info > Statistics > Purge Unused it became only 18MB.)
Also, what version do you have? I'm not sure if I've published the latest on SketchUcation yet. The latest version is 1.1.0.
-
RE: Best way to iterate all nested entities
To use the same tolerance as SketchUp does, use the methods built into the Ruby API:
vector = edge.line[1] vector.samedirection?(Z_AXIS)http://www.sketchup.com/intl/en/developer/docs/ourdoc/vector3d.php#samedirection?
The components of a vector are floating point values so they should never be compared without a tolerance. For more information about floating point precision: http://floating-point-gui.de/
-
RE: Method -- Best Naming Techniques
#2 is what the GitHub style guide describes: https://github.com/styleguide/ruby
The GitHub style guide is a shorter version of the community driven styleguide: https://github.com/bbatsov/ruby-style-guideI'd go for what the community uses for the most part. Makes the code more interchangeable.
-
RE: [Plugin] Raytracer
No idea without test screenshots or preferable a test model.
-
RE: [Plugin] Solid Inspector
There is no way I can keep the SI tool active while editing. The API doesn't have any feature to do so.
Best thing I can do is selecting the edges.
-
RE: [Plugin] Architect Tools
@isbelcia said:
My question is how to install the necessary TT_lib2.rbz on sketchup version lower than 7?
Installing Plugins for SketchUp
Update: June 2014 This article was written right before Google sold SketchUp to Trimble. Since then the instructions has changed slightly. In May 2013 SketchUp 2013 was released which included the …
Procrastinators Revolt! (www.thomthom.net)
-
RE: SketchUp 2014 Wishlist
@play404 said:
Ability to delete multiple scenes at once rather than 1 at a time
You can do that in the Scenes tool-window.
-
RE: Best way to iterate all nested entities
Saying that - bulk methods is much faster than individual actions. Use entities.erase_entities when you erase multiple entities - it also avoids the pitfall of erasing the collection you are erasing from.
-
RE: Best way to iterate all nested entities
.grepis an iterator itself - so no need for.each:entities.grep(Sketchup::Edge) {|edge| edge.erase! if is_vertical?(edge) } -
RE: [Plugin] Export 2d with Alpha
@billiam said:
I'm having a problem with this plugin, recently when try to export nothing actually happens. No file is ever created. It was working perfectly then all of a sudden stopped. I have already tried deleting the plugins from sketchup plugin folder and re-installing. Still no image is ever created
If you open the Ruby Console before using the plugin, does any error messages appear in the console?
-
RE: [Plugin] TT_Lib²
After that message there should be an Explorer window opening, which is contains the Virtual Store files. Note the full file path in the address bar. Those files should be in the real Plugins folder.
-
RE: [Plugin] Solid Inspector
@jgb said:
1: One icon should be a Direct to Edit mode. Once SI shows you the problem circles, the icon should go directly into edit mode, with the red circled item highlighted or selected.
Right now you have to exit SI mode, reselect the comp/group, edit it and go find the problem, which may very well be a twig in the forest.
You should be able to activate SI while inside the group/component you want to inspect.
Making it select the edges SI highlights is a good idea though.@jgb said:
2: 2nd icon is a toggle between normal view and a partial transparent view in SI mode. That would make it easier to see what the problems are.
Right now SU's transparent view is too transparent.
hmm... There is no Ruby API controls to adjust the X-Ray transparency. There isn't even an UI control to do so.