ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
  • [Talk] Ruby Debugger for SketchUp 14+

    45
    0 Votes
    45 Posts
    6k Views
    T
    @avariant said: When displaying data about a variable, does it volunteer variable names or does it just respond with a value? I would be very disappointed to find out it did The debugger is exposing nothing new here, the same thing could be done anyway through any of the SU consoles by any savvy Rubyist - using nothing but standard Kernel method calls. Setting trace functions and using the returned bindings to read local and instance variables, get the current method and its call signature, read the call stack etc... can all be done from even the most basic install of Ruby. You can't actually read the code lines unless they are in a 'plain text' source file (the scrambler presumably 'evals' the unscrambled code, which precludes seeing the source) - but there's not much that can be done to secure the other information without losing the consoles - which would make life very difficult for the amateur developers that we all rely on for our toys!
  • Scene (Page) animation of Section Cuts

    10
    0 Votes
    10 Posts
    566 Views
    TIGT
    You can 'get' & 'set' [with = ] page.name BUT you can only 'get' the page.label By default the page.name==page.label and so it's in the animated set... Sorry, but the API is lacking page.label= or similar... Of course, the Animation class can be used filtering out () labels, BUT you can't change a page.label in code
  • Translations for plugins?

    14
    0 Votes
    14 Posts
    458 Views
    Dan RathbunD
    @aerilius said: Each plugin would be translated individually, with based on .strings files as you already have, but hosted online (like you can host code in git/mercurial/bazar). I'm out. I do not use .strings files, nor LanguageHandler specifically because it's fixes are not backported. (And they never will be, because backporting is against the SketchUp Dev Team's religion.)
  • Git for SketchUcation?

    23
    0 Votes
    23 Posts
    602 Views
    Rich O BrienR
    The bug reporting is being worked on. We just need to figure out some of the details before testing. It will be a process through which you (the dev) will see the bug submissions on the dashboard and the members can flag posts as bugs on the forums. Unflagging will also be possible. Users can also flag a bug through the plugin and submit some text. We need some method where the dev doesn't need to read 3 pages of posts just to find that one post that has a bug. @andreas the ratings system was an experiment on our side. we needed to see how proactive users were with microtransactions. there's a very good chance we will retire it to the site only for v3.0 of the pluginstore. @all we are definitely listening to all the suggestions here. if there's things you want to happen let us know as we entering into knuckle down time soon. if you want to play an active roll in v3.0 let us know.
  • Versioning

    7
    0 Votes
    7 Posts
    355 Views
    tt_suT
    It's still unclear what release they are scheduled for. Sometimes these things end up in new releases only - some times they backport the fixes.
  • Examples of unit tests in ruby for sketchup plugins

    3
    0 Votes
    3 Posts
    531 Views
    tt_suT
    @nits4 said: Hello, Are there any examples of unit tests in ruby for sketchup plugins? Thanks. There is TestUp with a framework. But it doesn't work with Ruby 2.0 in SU2014. It used some old and custom frameworks that aren't supported any more. https://github.com/SketchUp/sketchup-developer-tools Internally we've begun on a new framework, but it's not something that's even remotely ready for distribution.
  • Sync sketchup with vtk tool

    3
    0 Votes
    3 Posts
    320 Views
    C
    Hi, thanks for the Tip. I looked their and synced the position with the position, the target with the focal point and view up with view up. That seems to work pretty good in the first attempt, but I am not allowed to zoom in or out, since then both view are not the same anymore (basically the vtk window does not "rescale". vtk has the zoom or setdistance function, but I expected them to be given indirectly be the distance between position and focal point. what information have i missed?
  • Followme with distance

    8
    0 Votes
    8 Posts
    313 Views
    N
    Thanks to all who tried to help me. I'm just new to ruby and Sketchup API, but digging some deeper into it I solved this problem by myself now.
  • Reverse operation of view.screen_coords

    30
    0 Votes
    30 Posts
    758 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
    703 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
    873 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
    219 Views
    tt_suT
    Fog generally tends to slow down the framerate.
  • Reading and drawing textures

    22
    0 Votes
    22 Posts
    1k 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
    307 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
    873 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
    309 Views
    thomthomT
    Yea, think so.
  • Rounding a value for export with a ":" separator

    7
    0 Votes
    7 Posts
    376 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
    623 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.

Advertisement