Sketchucation Tools 5.0.7 | Licensing improvements and bug fixes Learn More

Subcategories

  • No decscription available

    20 Topics
    462 Posts
    HornOxxH
    @pilou said: More appetizing in chocolate! Eggs are good as well - but only very fragile when falling down in SketchyPhysics
  • Reverse operation of view.screen_coords

    30
    0 Votes
    30 Posts
    2k Views
    Dan RathbunD
    Do the same thing but do not change the target ?
  • How to read .skp files in ruby?

    6
    0 Votes
    6 Posts
    964 Views
    P
    When you import a model, the entities (edges, faces, groups,... ) don't go directly in model.entities. They are encapsulated in a new component....
  • Secure http request from SketchUp ruby

    4
    0 Votes
    4 Posts
    1k Views
    Dan RathbunD
    Now hold on. IF this certificate will be used across all versions of SketchUp, then yes you CAN have your own application folder in the user %AppData% path. "C:/Users/Joe/AppData/Roaming/YourCompany/ThisPlugin" (Windows) If it is for any user on a workstation, then it could go in the %ProgramData% path. That complicates thing though. If it does not matter if there are multiple copies of the file, then it is easiest to include it within the RBZ archive.
  • Rename texture image file inside *.skp

    7
    0 Votes
    7 Posts
    2k Views
    N
    So there is a ruby plugin I've done (based on TIG's post). It renames all texture files in model with a template. module VNV def VNV.rename_textures UI.messagebox("All texture file names will be changed with a template - mat000") model = Sketchup.active_model model.start_operation('Rename texture files', true) tw = Sketchup.create_texture_writer temp_path = File.expand_path( ENV['TMPDIR'] || ENV['TMP'] || ENV['TEMP'] ) temp_folder = File.join( temp_path, 'Sketchup_tmp_mtl' ) unless File.exist?( temp_folder ) Dir.mkdir( temp_folder ) end group = model.active_entities.add_group() Sketchup.active_model.materials.each_with_index{ |m,i| if m.texture then group.material = m tw.load(group) path_to_png = File.join(temp_folder, "mat#{'%03d' % i}"+".png") tw.write(group, path_to_png) w = m.texture.width h = m.texture.height m.texture = path_to_png m.texture.size = [w, h] File.delete(path_to_png) end } group.erase! model.commit_operation end # def end # module if (!file_loaded?(__FILE__)) menu = UI.menu("Plugins") menu.add_item("Rename texture files") { VNV;;rename_textures } # Let Ruby know we have loaded this file file_loaded(__FILE__) end RenameTextures.rb
  • [Code] Layers Panel API

    9
    0 Votes
    9 Posts
    2k Views
    Dan RathbunD
    @jiminy-billy-bob said: A module. Why? Just checking. Keepin' ya honest. (Only Ruby, and in rare instances the API or library gems, should define classes at the toplevel.)
  • Hide at a distance from the camera - works but slooooowwww

    4
    0 Votes
    4 Posts
    379 Views
    tt_suT
    Fog generally tends to slow down the framerate.
  • Reading and drawing textures

    22
    0 Votes
    22 Posts
    2k Views
    Dan RathbunD
    @dan rathbun said: The HTML5 Canvas element will not work well on PC yet because SketchUp uses the MSIE WebBrowser control for WebDialogs. Microsoft is lagging behind in their IE support of the specification. You can test by loading the HTML5 Bejeweled game into a WebDialog. It most likely will not run under XP. But runs fine under Win7 with MSIE v11 installed. Bejeweled.rb
  • GitHub as a Content Library Manager?

    6
    0 Votes
    6 Posts
    516 Views
    M
    @adamb said: It sounds what you need is an Asset Management System... I'll have to do some more investigation. I knew GitHub probably wouldn't have been quite right, and I appreciate the feedback. On to do more research. I might just use a private collection (or several) on 3DWH like was suggested earlier until I figure something out.
  • Group moves to origin when I doubleclick to select component

    20
    0 Votes
    20 Posts
    2k Views
    Dan RathbunD
    @tt_su said: But you cannot return a single world position for a vertex unless you have some extra info. RIGHT.. I gotcha' We would need to let Ruby know the parent instance's transform. (Not automatic unless in user edit mode.) I guess we can do this now. We just create a copy of the instance's transformation, call it **t**: world_pt = edge.start.position.transform(t) I guess I was pondering how to automatically call #transform(t) upon all newly created Geom::Point3d instances, within a code block scope. So, yes I suppose an optional "tranform" class argument for Vertex#position would be handy. (It could be a Geom::Transformation instance, a Geom::Vector3d in world context, OR either an Array or Geom::Point3d offset from ORIGIN.) So it could look like: world_pt = edge.start.position(t) (2) So lets say you have collected a series of vertices (in an array verts.) And you want their world co-ordinates: world_pts = verts.map {|v| v.postion(t) } We have to use map, because the API's Array#tranform() and Array#tranform!() methods, refuse to apply a transform to an array with anything other than than 3 numerics. Even though each individual element has a transform method. Example, you have an array of Geom::Point3d objects, and you want to transform ALL elements the same. The Array class transform methods should do this IF the the elements are not numeric, and they respond_to?(:transform). (Add: Any element that does not "respond_to" is returned unchanged.))
  • View.draw2d(GL_POINTS, pts) on ATI with AA

    3
    0 Votes
    3 Posts
    418 Views
    thomthomT
    Yea, think so.
  • Rounding a value for export with a ":" separator

    7
    0 Votes
    7 Posts
    582 Views
    IltisI
    OK, this works well : begin # Open a file for writing File.open(filepath, "w"){ |file| selection = Sketchup.active_model.selection # Get an array of faces that are in the selection. faces = selection.grep(Sketchup;;Face) faces.each_with_index{ |face, index| # Write a label for the face. file.puts("Face#{index+1}") # Get a transformation object that translates from model space to 2d space of the face. t = Geom;;Transformation.axes(face.vertices.first.position, *face.normal.axes).inverse # Write all vertices to the file. blnFirstPoint = true first_point_u=0 first_point_v=0 face.outer_loop.vertices.each{ |vertex| # Get the point of the vertex and apply the transformation. point = vertex.position.transform(t) # Convert the coordinates u, v = point.to_a.map{ |c| c.to_f } if blnFirstPoint==true first_point_u = u first_point_v = v blnFirstPoint = false end #if # Write the coordinates to the file. file.puts("#{(u*10000*25.4).to_i.to_f/10000};#{(v*10000*25.4).to_i.to_f/10000}") } file.puts("#{(first_point_u*10000*25.4).to_i.to_f/10000};#{(first_point_v*10000*25.4).to_i.to_f/10000}") } } Thanks a lot! Renaud
  • Mac read_defaults?

    20
    0 Votes
    20 Posts
    1k Views
    Dan RathbunD
    Well on the PC, we have been in the same boat. The API can read only string registry values. Many things are DWORD binary values. Often holding only 1 or 0 for true/false, on/off, etc. Such a simple thing that can not be read. A long time ago, I thought I filed a Feature Request for an application level options hash interface.
  • Get component definition name

    3
    0 Votes
    3 Posts
    462 Views
    alexandre skA
    ohhhhhh this one is for me: [image: dumbass.jpg] Thank you very much. I was expecting something very simple but not that simple. Starting to like ruby. I only know php and javascript, but this ruby is good. Thank you Jim
  • Find vertex resulting from a pushpull or transformation

    8
    0 Votes
    8 Posts
    669 Views
    Dan RathbunD
    The wrapper method in "sketchup.rb" is in need of an overhaul. Post your suggestions in thread: [Code] better inputbox() wrapper
  • Reading registry values withouts quotes

    2
    0 Votes
    2 Posts
    310 Views
    Dan RathbunD
    What Windows version and SketchUp version ? EDIT. Nevermind, just go to this post from last Thursday, 1st of May: Re: get registry string from ruby 2.0 (Also works with older versions, if user has the old "win32ole.so" file downloaded from the Plugins forum [link shown.])
  • Nicedit for SketchUp (javascript issue)

    9
    0 Votes
    9 Posts
    2k Views
    inteloideI
    Hello, thank you for your answer. Actually the main reason why it didn't work, is beceause jQuery was required. Once added, it work fine. Inteloide
  • Tool: rak - like grep only optimized for source code repos

    2
    0 Votes
    2 Posts
    423 Views
    tt_suT
    Nice! Thanks for the link!
  • Web dialogs stealing focus within my tool.

    28
    0 Votes
    28 Posts
    3k Views
    Dan RathbunD
    Dang it! That is news to me. Did ya'll hire someone to to be a TechWriter for the API? (Ya' need to badly.)
  • Push_tool

    5
    0 Votes
    5 Posts
    399 Views
    A
    Thanks guys. Yes, I was doing a pickhelper or ray intersection and figuring out the object being clicked on and added it to the global selection. That worked fine, but only allowed selecting one entity at a time. I wanted to switch to select tool so I can use the group selection features that are available in it. Like thomthom suggested, I managed to get that working by backing up the current tool before doing Sketchup.send_action("selectSelectionTool:") and then restoring the older tool on release. This probably won't retain the tool state since I'm actually exiting the tool and re-entering, but it seems to work for my purpose. Thanks again!
  • OnKeyDown: getting the charcater value from key

    32
    0 Votes
    32 Posts
    3k Views
    Dan RathbunD
    Yea did you look at the C code by clicking the method in the CHM ? It has a kind of convoluted switch statement.

Advertisement