PointTool for Mac
-
-
Just downloaded PointTool_1.2, using SU 2016 on iMac El Capitan, with autoinstall from the SketchUcation plugin store.
Works fine as installed automatically, but puts Draw Points on the Extensions menu (formerly Plugins). I wanted to put it on the Draw menu, so changed one line in this part (sorry, don't have line numbers in my Text Editor)
` unless file_loaded?(FILE)
file_loaded(FILE)
$submenu ? (organizer = $submenu) : (organizer = UI.menu("Plugins"))
organizer.add_item("Draw points"){ pointtool }p=Sketchup.find_support_file("Plugins") cmd = UI::Command.new("Draw points"){ pointtool } cmd.large_icon = cmd.small_icon = File.join(p, "PointTool", "PointTool.png") cmd.tooltip = cmd.status_bar_text = "Draw some points" UI::Toolbar.new("Point Tool").add_item cmd
end`
I changed just part of this line from:
$submenu ? (organizer = $submenu) : (organizer = UI.menu("Plugins"))
to
$submenu ? (organizer = $submenu) : (organizer = UI.menu("Draw"))
but now the plugin errors on loading. And still errors if I change the line back to have "Plugins" as in the original.
Any thoughts on why this is happening, and how I could get it to load in the Draw menu?
Of course I can (and shortly will) add a shortcut (probably Shift P) but I don't understand why this simple change stops the plugin working. I was using the built in Mac TextEdit.app which I assumed did what it says on the tin, like Notepad on Windows - or is it more like WordPad, and adding non-text characters to the file when saved?
John McC
-
Ah. It seems that the problem lay in the TextEdit app - when I found and installed Brackets instead, and made the same edit, it does what I expected.
Ah well, it takes a while for a decades-long Windows user to get used to a new iMac...!
John McC
-
It looks like a problem of file encoding due to your editor. This is why it does not work even when restoring the menu to its original value.
The file should encoded UTF8 without BOM.
You could use notepad++ (free and quite powerful editor), whenever you manipulate Ruby.
Fredo
-
unless you use the old SmartMustard plugin organizer [which I doubt]...
get rid of the $organiser bit....
menu = UI.menu('Draw') menu.add_item('Draw points') { pointtool }
I can see other errors in a very old copy I checked, that may have been fixed by TIG...
if the next line starts withp =
, then it's not fixed...BTW... the free TextWrangler.app is much better for editing all kinds of files...
EDIT: the rest of the file is needing work there are a number of places it use a 'reserved' word...
this was why i asked about thep
, before re-reading your code block...plgs = Sketchup.find_support_file('Plugins') cmd = UI;;Command.new('Draw points') { pointtool } cmd.large_icon = cmd.small_icon = File.join(plgs, 'PointTool', 'PointTool.png')
def create_geometry(pt, view) view.model.active_entities.add_cpoint pt view.invalidate end
def no_points_here?(pt) Sketchup.active_model.entities.select { |e| e.class == Sketchup;;ConstructionPoint }.each do |e| return false if e.position.to_a == pt.to_a end
john
Advertisement