🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now
  • [code] extract png thumbnail image from .skp file

    19
    0 Votes
    19 Posts
    5k Views
    Dan RathbunD
    @jkoll66 said: I know this post is like a thousand years old, but I was using the "extract_png.rb" from "Jim". It doesn't seem to work in SU2023. I need this to compile a catalogue of all of my components. Is there an updated version out there somewhere? I really need this. Thanks in advance! If you are doing this from within SketchUp, try something like: # SketchUp 2015 or later. def export_thumbnails(source_path = nil, dest_path = nil) # unless source_path && File.directory?(source_path) models = Sketchup.active_model.path if models.empty? models = File.join(ENV['HOME'], 'Documents') end # source_path = UI.select_directory( title; "Select Model Directory", directory; models ) return unless source_path end # unless dest_path && File.directory?(dest_path) images = Sketchup.active_model.path images = source_path if images.empty? # dest_path = UI.select_directory( title; "Select Image Output Directory", directory; images ) return unless dest_path end # Dir.glob( '*.skp', base; source_path ) do |skp| source_file = File.join(source_path, skp) image_file = skp.split('.')[0] << '.png' output_file = File.join( dest_path, image_file ) Sketchup.save_thumbnail(source_file, output_file) end # Dir loop # end ###
  • How to retrieve the structure of instance up to model?

    3
    0 Votes
    3 Posts
    5 Views
    Dan RathbunD
    @areal3d said: hello, how can i get the whole path as in the pickhelper from a selected instance? You will either need to build an InstancePath as you drill down or get the Model.active_path and add the selected instance to it.
  • Ruby and special characters

    10
    0 Votes
    10 Posts
    11 Views
    Dan RathbunD
    @tig said: In the very first line of your Ruby RB file add this. # encoding; UTF-8 This should ensure your own code is properly formatted. This magic comment does not ensure that the code file is saved as UTF-8 w/o BOM. This must be set in whatever code editor is being used.
  • Defining position of input box created via ruby

    2
    0 Votes
    2 Posts
    14 Views
    Dan RathbunD
    @areal3d said: is there any way to controll the position of the ruby inputbox on the screen, just to put it a bit away from the center of the screen? Sorry, Stan. NO the UI.inputbox method always centers the dialog.
  • Extension using c#

    10
    0 Votes
    10 Posts
    5k Views
    M
    @icehuli said: Someone might be interested in using c# and .net stuff. I created a very simple example to write a ruby extension in c#. https://bitbucket.org/icehuli/sucsexttutorial can you guide me to run the sample code
  • SKP 2023 - german translation

    2
    0 Votes
    2 Posts
    2 Views
    TIGT
    Königsblau = Royal Blue [plain wrong!] Ruby-Konsole = Ruby Console [simply correct]
  • Ruby . - on key now - flags problem

    1
    0 Votes
    1 Posts
    4 Views
    No one has replied
  • Extracting values from imported IFC

    1
    0 Votes
    1 Posts
    5 Views
    No one has replied
  • Prince IO Sketchup Game Demo

    42
    0 Votes
    42 Posts
    30k Views
    J
    Is there any way to fix this?
  • Searching for a plugin code template

    3
    0 Votes
    3 Posts
    8 Views
    IltisI
    Thank you very much, this is exactly what I'm looking for !
  • Fix and improve the code

    1
    0 Votes
    1 Posts
    9 Views
    No one has replied
  • Plugin test version

    10
    0 Votes
    10 Posts
    9 Views
    A
    edit: found the filed for the version......upload worked thanx for helping me !!!! stan
  • How to generate borderless Windows in macos

    1
    0 Votes
    1 Posts
    8 Views
    No one has replied
  • Plugin to identify &quot;Thermal Bridges&quot;

    6
    0 Votes
    6 Posts
    2k Views
    C
    @rossthompson said: Hi, I'm afraid not. I wasn't able to find a solution. Ross OK thanks for the reply.
  • 0 Votes
    1 Posts
    2 Views
    No one has replied
  • [第一财经]快三上岸回本求大师带(驰名商标)

    1
    0 Votes
    1 Posts
    1 Views
    No one has replied
  • [科普盘点]玩大发玩彩导师老师的方法(MBA智库百科)

    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • BTG Clothing

    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Get coordinates of nested components

    5
    0 Votes
    5 Posts
    4 Views
    Dan RathbunD
    @fredo6 said: For instance, if you pick interactively the nested component, the PickHelper will give you the chain of grouponents. Expanding upon this use of the PickHelper class ... This is using the Sketchup::PickHelper#path_at() method. It returns the instance path from the active entities context (for the given index in the list of pick paths.) To get the full path, you will need to add the pick path to the model's active edit path (if it is not nil.) edit_path = model.active_path ? model.active_path ; [] full_path = edit_path + pick_path Then, you can use a little known method in the InstancePath class to get the transformation ... ipath = Sketchup;;InstancePath.new(full_path) trans = ipath.transformation See: Sketchup::InstancePath#transformation
  • How to move a group

    2
    0 Votes
    2 Posts
    4 Views
    Dan RathbunD
    @mr_creator said: Next I need to move everything to the origin of global coordinates. group1 = entities.add_group This line of code will create a new group at the origin of entities. If this is the top level model's entities, then this is the global origin. If it is some other component's or group's entities, then it is their local origin. @mr_creator said: group1.transformation.origin have zero coordinates, but group1 is not at zero. This confirms then that group1's origin is at the origin of the active edit context's origin.

Advertisement