The quickest way to export your work from the Mac app is to choose Share > Export… from the menu, or press ⌘ ⇧ E, to bring up the Export dialog. AI and PSD files (limited support, only as a flattened layer).PDF documents (each page will be imported as its own artboard).SVG code (copy the code and paste it in to create a layer).The easiest way to import files into the Mac app is to drag and drop them onto the dock icon or directly onto the Canvas. Still if a “.” is a current working directory and not a home… “./images/image.png” looks strange to File.join( _dir_, '/images/iso_small.Exporting in the Mac app Watch lesson Importing That was just to see what ruby think the “.” is when ‘inside’ of the file loading it and if it is different from being typed in ruby console… File.expand_path(“”) shows a different results… Non of above relative paths would not sure what you would use this for…įile_loaded(‘oo–’ + File.expand_path(‘./images/iso_small.png’)) They all work well… and from my not big experience I can say usually methods are not so flexible about giving some extra or less slashes and dots…įor instance UI.play_sound … It needs exact full path. I still think there is something extra about #small_icon method… cmd1.small_icon = "./images/iso_small.png"Ĭmd1.small_icon = "/images/iso_small.png" # Define commands, menu items, and toolbars here We also usually suggest that you use internal module variables to hold the loaded state of your module’s resources, rather than slow file_loaded?() method and the global shared $loaded_files array (where name clashes can occur.) IE … # Within your extension submodule: It will not help to mangle the use of file_loaded() with icon files. The loader file (as specified in the 2nd argument to the SketchupExtension class constructor call, would be the best place to list all require calls for dependencies. However a set of files for an extension only needs to do it once. In SketchUp Ruby, it will be acceptable to require "sketchup.rb" if your code is going to use any of the 3 non-deprecated methods that "sketchup.rb" has added to the Top Level Objectspace. Normally, in Ruby, a file only requires another file if it uses or calls something that the other file defines. Since then SketchUp has preloaded all 3 files in it’s "Tools" folder before loading any extensions. In truth, no one needs to do this (require “sketchup.rb”) anymore since SketchUp 2014 was released with Ruby 2.0.0. No people do this because they do not really understand Ruby’s dependency issues or how SketchUp loads things. Is that the reason why people # require ‘sketchup.rb’ several times in samemodule but different files ? If your "images" subdirectory is beneath the current file’s directory location, then use the global _dir_ method, thus: File.join( _dir_, '/images/iso_small.png') Any extension could change it at any time. In Ruby the home path will be … ENVīut your code can never rely upon the set working directory staying the same. What your test shows is that the current working directory as set by SketchUp is beneath the user’s HOME directory. Instead it just stupidly prepends the current working directory, ie, the result of Dir::pwd, to the given relative path. It does not “divine” correct paths given “half a path”. Please be aware that the File::expand_path method is stupid. Still there is a question why the ‘.’ in “./resources/images/image.png” doesn’t mean this File.expand_path(“.”) which is home directory… Still there is a question why the ‘.’ in “./resources/images/image.png” doesn’t mean this File.expand_path(”.") which is home directory…Īnd it shows something in ‘My Documents’ home directory where definitely I don’t have those icons… Is that the reason why people # require ‘sketchup.rb’ several times in samemodule but different files ? maybe not since it doesn’t load the directory of the file from which it is called to load… Which accidently helped me guess (maybe correctly) that -probably- cmd.small_icon = … is searching for given file name in all? directories suplied by ‘require’ statements in $LOADED_FEATURS (or $“)… ? Though these are not exactly directories… rather paths… but consist directories… UI.messagebox(File.expand_path('./images/iso_small.png'))Īnd it shows something in ‘My Documents’ home directory where deffiniatelly I don’t have those icons…ĭigging in more I had a look into S4U Select and there he even only wrote files names… cmd.small_icon = "edgelength_small.png" png files to command for toolbar icons… cmd1.small_icon = "./images/iso_small.png"Īnd it works… but I don’t really know whyīut being curious I checked this: file_loaded('oo-' + File.expand_path('./images/iso_small.png')) Fallowning example from Chris Fullmer Extended Views I added.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |