Plugins Locations
-
Users should have read the following article, whose link is given in the End User's Release Notes under SketchUp 2014, within the "Ruby API" section:
Plugin migration article for SketchUp 2014
~
-
@al hart said:
What about automatic execution when SketchUp StartUp.
We put the same file in all three folders and started SketchUp to see which one(s) it ran.
It only ran one, (probably because it uses require(), so only loads one version of a file with given name.
With all three there, it ran the one in AppData.
When we deleted the one in AppData, leaving the other two in ProgramData and Program Files, it ran the one in ProgramData.
This IS expected... a user can copy a shared plugin to THEIR OWN plugin folder, and tweak it for their own use. THEIR edition then loads for THEM only, without affecting the edition that is shared by other users.
-
@al hart said:
We put a file 'al1.rb', in Users\XXX*AppData*\Roaming\SketchUp\SketchUp 2014\SketchUp\Plugins.
We put a second file, al2.rb, in C:*Program Files* (x86)\SketchUp\SketchUp 2014\Plugins
We put a third file, al3.rb in C:*ProgramData*\SketchUp\SketchUp 2014\SketchUp\Plugins
As Dan points out, the user folder is where plugins should be installed - it's where we install it to.
There should be no plugins folder in Program File - that's locked down by the system and enforced by a bunch of security measures which have caused nothing but pain. Unfortunately we had to keep it in there for such a long time uptil SU2014 due to Ruby 1.8's inability to load from unicode paths.
-
Thanks for the responses.
We are looking for a work-around for users with Unicode Characters in their user names - which causes \Users\XXX\AppData to fail with: "Error: #<Encoding::CompatibilityError: incompatible character encodings: Windows-1252 and UTF-8>"
And one of our users has a Unicode Character in what I presume is the local translation for AppData - "Data aplikací"
I looked in my old thrads and haven't found a Windows-1252/UTF-8 solution yet. We didn;t try the GetShortPathName() idea, because we were worried that it might solve some early problems, but leave other problems which would show up after we shipped the App to other countries.
So we are now thinking about installing our App in Program Files instead of the SketchUp Plugins folder, and only using a couple of .rb files in the plugins folder to find the rest of the app.
-
@al hart said:
I looked in my old threads and haven't found a Windows-1252/UTF-8 solution yet.
The US locale code page is CP1252 (ie, Windows-1252.)
We do not have a problem transcoding between the two, IF Ruby loads correctly.This seems like the user may have installed SketchUp on a drive (or location,) other than %ProgramFiles% on %SystemDrive%. When they do, the paths Ruby library paths are incorrect in
$LOAD_PATH
, and theEncoding
class is not loaded properly at startup. (The "team" has fixed this in MR1, but we are still waiting for them to release it!)I whacked out a workaround script, and TIG revised it and posted it here at SCF.
- But it does not work for many foreign codepages (asian codepages,) as there is no way to determine the locale copepage, because in order to make system calls, we need to load
Win32API
from the Ruby library, and the paths are incorrect in$LOAD_PATH
. (Vicious circle.)
But a C extension could make the system calls to determine the locale codepage, in order to load the correct encoding file from the Ruby library. (Or a user could manually edit that patch script to laod their loacale encoding.)
** Also be aware that Ruby itself, does not yet support Vietnamese codepage (Windows-1258, I think.)
- But it does not work for many foreign codepages (asian codepages,) as there is no way to determine the locale copepage, because in order to make system calls, we need to load
-
@al hart said:
So we are now thinking about installing our App in Program Files instead of the SketchUp Plugins folder, and only using a couple of .rb files in the plugins folder to find the rest of the app.
If it is not "data" used by an application, or it is an executable, it should be in the %ProgramFiles% path. Or if it supports multiple versions of SketchUp.
Your app, say RenderPlus, can have it's own AppData folder, with SketchUp verison subfolders, for the users data.
-
@al hart said:
What are your thoughts and/or what have you learned already?
I learned to ALWAYS read the Release Notes.
Your a developer, so reference:
http://www.sketchup.com/intl/en/developer/docs/releases.php
.. and take note of the section for SketchUp 2014, viz:(razzin' ya')
BUT... you have found a booboo.
find_support_files
should really not return pathnames from a "Plugins" directory, in the binary ("Program Files",) path under SketchUp 2014+.IMO, it should return a warning or exception instead, if the user creates a "Plugins" folder there.
-
@al hart said:
We are looking for a work-around for users with Unicode Characters in their user names - which causes \Users\XXX\AppData to fail with: "Error: #<Encoding::CompatibilityError: incompatible character encodings: Windows-1252 and UTF-8>"
Can you give some more background for this error? Are you creating a string from ENV or FILE for the filename you want to load?
-
@tt_su said:
Can you give some more background for this error? Are you creating a string from ENV or FILE for the filename you want to load?
To duplicate a problem we are having with a client, I created a user on my machine with an extended ASCII character in the name (using a word from a path in the users AppData location).
The user name is: aplikacíX (but there is a hex 0xa1 in front of the X. (Here is a hex dump)
C:\AA>echo aplikacíX| od -hc
0000000 7061 696c 616b a163 0d58 000a
a p l i k a c 241 X \r \nI then used find_support_file() to get the complete path of a file name in Plugins:
sdll = Sketchup.find_support_file('Plugins/RPS_win32_IRender_nXt.so')
sdll was set to: C:/Users/aplikacíX/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/RPS_win32_IRender_nXt.so
I then passed the name on to require
require sdll
and I get this error:
Error: #<Encoding::CompatibilityError: incompatible character encodings: Windows-1252 and UTF-8>
C:/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:109:inend_with?' C:/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:109:in
rescue in require'
C:/Program Files (x86)/SketchUp/SketchUp 2014/Tools/RubyStdLib/rubygems/core_ext/kernel_require.rb:35:in `require'It is possible that the error is with a call in the .so file. I'll try to find a way to check that out.
-
Ah! yes, the loading binary libraries issue. We have a fix for that coming up.
-
@dan rathbun said:
This IS expected... a user can copy a shared plugin to THEIR OWN plugin folder, and tweak it for their own use. THEIR edition then loads for THEM only, without affecting the edition that is shared by other users.
That was pretty clever! - Letting the User have his own version and it works well for APPDATA and ProgramData.
But if the same rubies happen to be in a SketchUp 2014 Plugins folder in Program Files, then find_support_file() finds them instead. (I understand that no one is supposed to place anything in the SketchUp Plugins folder in Program Files - but you can imagine why users using SketchUp 2014 for the first time might copy their old Plugins folder into SketchUp 2014 in Program files)
I placed identical ruby files - one in Plugins and one in a sub-folder of Plugins - in APPDATA and in ProgramData - and the AppData ones got run properly. (Using find_support_file() to get the full path of the second file worked properly)
However, when I placed the same files in Program Files as well (the same rubies in all 3 locations), and used get_support_file() to try to find the second ruby file, then it messed up and found the one in Program Files. When SketchUp started up, it ran the first ruby file from APPDATA, but find_support_file found the one in Program Files instead of the one in APPDATA.
I created two ruby files, rps_level1.rb uses find_support_file() to locate rps_level2.rb and then runs it.
rps_level1.rb - placed in Plugins:
` SKETCHUP_CONSOLE.show
printf("\n-----------------------\n")
printf("IN: %s\n", FILE)printf("\nIN: 'RPS/rps_level2.rb'\n")
$sfull_path = Sketchup.find_support_file('Plugins/RPS/rps_level2.rb').to_s
printf("\nLOADING FULL PATH: %s\n", $sfull_path)
load ($sfull_path)`
rps_level2.rb placed in the Plugins/RPS sub folder:
printf("IN rps_level2.rb: %s\n", __FILE__)
When duplicate files were placed in APPDATA and ProgramData only the ones in APPDATA were executed:
` -----------------------
IN: C:/Users/Al/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/rps_level1.rbLOADING FULL PATH: C:/Users/Al/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/RPS/rps_level2.rb
IN rps_level2.rb: C:/Users/Al/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/RPS/rps_level2.rb`But when I placed a third copy in Program Files Plugins, find_support_file found the one in Program Files and ran it instead.
(Sketchup.find_support_file() called from APPDATA returned the path in Program Files.)
` -----------------------
IN: C:/Users/Al/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/rps_level1.rbLOADING FULL PATH: C:/Program Files (x86)/SketchUp/SketchUp 2014/Plugins/RPS/rps_level2.rb
IN rps_level2.rb: C:/Program Files (x86)/SketchUp/SketchUp 2014/Plugins/RPS/rps_level2.rb` -
Hi,
I am a newbee in sketchup plugin development and I am facing an issue with sketchup 2014.
My plugin dll is not geeting loaded in su2014,which used to get loaded without any errors till su2013.I am getting the following error messages
Error Loading File sketchupConnector
Could not find included file 'sketchupConnector'
Error Loading File C:/Users/damayantib/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/eDrawings/edpublisher.rb
Error: #<NoMethodError: undefined methodcheck_license' for Sketchup::EDrawingsTools:Module> C:/Users/damayantib/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/eDrawings/edpublisher.rb:583:in
module:EDrawingsTools'
C:/Users/damayantib/AppData/Roaming/SketchUp/SketchUp 2014/SketchUp/Plugins/eDrawings/edpublisher.rb:5:in<top (required)>' C:/Program Files (x86)/SketchUp/SketchUp 2014/Tools/extensions.rb:197:in
require'
C:/Program Files (x86)/SketchUp/SketchUp 2014/Tools/extensions.rb:197:in `load'Can anyone help me with this issue!!!
Thanks in advance.
-
SketchUp changed from Ruby 1.8 to Ruby 2.0 in version 2014. So you need to make sure all binaries are compatible with the updated Ruby interpreter.
-
I have tried that too.I have changed the thirdparty from ruby1.8 to ruby2.0 and built my project in vs2010, but the error persists.
-
Hmm... the error actually complains about a file not found...
Could not find included file 'sketchupConnector'
And an undefined method...
Hard to tell without knowing anything about the extension. But I'd trace down the missing method and file.
Have you tried the Ruby Debugger - letting you step through Ruby code?
https://github.com/SketchUp/sketchup-ruby-debugger -
Hi,
I have created a sample extension .This is my Samplemenus.rb file.
I am not getting the message box when I click on 'publish'.Am I missing something here.
I guess the syntax is wrong somewhere. plz help.require 'sketchup.rb'
module Sketchup::Sampletoolif defined?(Sketchup::Set)
Set = Sketchup::Set
endPLUGIN = self
def pop_message
UI.messagebox('Hit')
end
#------------------------------------------------------------------------------Add things to the Utilities menu
if( not $edrawings_menu_loaded )
sample_menu = UI.menu("Plugins").add_submenu("sample")
sample_menu.add_item("Publish") {pop_message }
$edrawings_menu_loaded = true
end -
Try using:
**self.**pop_message
instead...BUT please don't mess with the 'Sketchup' module - make your own module e.g. 'SWAPB'
Also don't use unnecessary global-variables like$edrawings_menu_loaded
, they can be replaced in this instance with something like...unless file_loaded?(__FILE__) ... file_loaded(__FILE__) end
Why do you need to redefine
Set
?Also this is NOT an 'Extension', it some simple Ruby plugin code to add a menu item and make a messagebox etc...
Also learn to put your post's code inside [code] or [
ruby
] blocks... like my snippets above... -
.. and the nested module definition has no
end
closure.
Advertisement