⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Action callback - Duh!

    4
    0 Szavazatok
    4 Hozzászólások
    229 Megtekintések
    jolranJ
    I see. Clever solution, anyway. Save's some code.
  • How to store slected file directory name on a variable?

    6
    0 Szavazatok
    6 Hozzászólások
    344 Megtekintések
    Dan RathbunD
    @Rafael: The API UI module does not have a folderpicker, YET. We have filed Feature Requests for one, and fontpicker, and colorpicker, and etc., etc. For now users must pick a file within the target folder. (We are out of luck if the folder is empty.) @thomthom said: @dan rathbun said: @sound = filepath.gsub("\\",'/') Since / as path separator isn't hard coded I tend to use: @sound = File.expand_path(filepath) One could also do: @sound = filepath.gsub("\\", File::SEPARATOR) But I prefer the first. Your second one is safer. Yes I got lazy, but my purpose here is going from the OS to Ruby. I imagine that after tha statement the path will be used by Ruby's Dir and File methods. Later on... to go back to the OS I'd use filepath.gsub("\/", File::SEPARATOR) if it is even necessary. Be careful with expand_path() because it is DUMB! Your example will work only because the UI.openpanel method returns an absolute path. When the path is a relative path,... the method simply concatenates the current working directory path and the argument path, regardless if the result is really a valid path.
  • Can Plugin Script Run while using other tools?

    5
    0 Szavazatok
    5 Hozzászólások
    189 Megtekintések
    renderizaR
    Thank you both for help I think I will not work on that plugin idea for the time being. Cheers!
  • Nested groups

    6
    0 Szavazatok
    6 Hozzászólások
    274 Megtekintések
    bomastudioB
    THANXXXXXXXXX!!!! it works!!!!!!
  • Ditto mac unix command

    2
    0 Szavazatok
    2 Hozzászólások
    600 Megtekintések
    D
    I'll start answering my own question... plugs = Sketchup.find_support_file("Plugins")ditto "#{plugs}" ~/Desktop/!plugs`` this duplicates the entire contents folder structure in a new folder on the desktop... not an unknown path insight sooo.... now to write that dropbox plugin john
  • [Talk] Qpik::SimpleRays Overhaul

    11
    0 Szavazatok
    11 Hozzászólások
    6k Megtekintések
    Dan RathbunD
    v1.0.1 download Moved to Plugins forum. Old v1.0.0 deleted. THIS thread retitled as "[Talk] Qpik::SimpleRays Overhaul"
  • I want to write a ruby script : rotate an object

    11
    0 Szavazatok
    11 Hozzászólások
    4k Megtekintések
    Dan RathbunD
    @unknownuser said: I want to learn if instead of having a text inputbox you can also have a dropdown menu list with existing layers on it so you can select from there aswell. Yes I have done that.. it is one one my files (somewhere) just guessing it's similar to this: def choose_layer(active=false) model = Sketchup.active_model layset = model.layers deflay =( active ? model.active_layer.name ; layset.first.name ) laylist = layset.map(){|l| l.name }.join('|') results = inputbox(["Layer ;...... "], [deflay], [laylist], " Choose Layer") results ? layset[results.first] ; nil end #
  • How to draw a cylinder by ruby?

    11
    0 Szavazatok
    11 Hozzászólások
    3k Megtekintések
    D
    hi have a look at linetool.rb and class CylTool < LineTool in the Example scripts folder in ../SketchUp/Plugins/examples/linetool.rb, or download it if it's not...... john
  • Notepad++ SU8 Ruby API Autocomplete

    62
    0 Szavazatok
    62 Hozzászólások
    15k Megtekintések
    B
    Thanks a lot!
  • Rotation transformation for a component instance

    10
    0 Szavazatok
    10 Hozzászólások
    2k Megtekintések
    Dan RathbunD
    @honkinberry said: I want to be able to place a component like a bench, and then immediately rotate it about the Z axis. So both the placement and the rotation should be linked very smoothly to accurate cursor position. OH.. well that is extremely EASY. Because that functionality is built-into the native component placement tool, which is accessible from the Ruby API. So.. for example the bench's name is "Bench Wood HighBack" def place_bench() mdl = Sketchup.active_model compdef = mdl.definitions["Bench Wood HighBack"] if compdef mdl.place_component(compdef,false) return true else return false end end The trick is the 2nd argument to Model#place_component() must be false, so that you can use the rotate handles (they appear as little red crosses,) just after you choose the insert point. Insert the bench.. then move the cursor to the top of the comp's boundingbox, and you should see 4 red crosses appear. Hover over one of the cross handles, and the cursor will change to a rotate cursor. Hold & Drag (or Click Move Click,) to rotate about the Z axis.
  • Why creating dictionary triggers onSelectionBulkChange?

    15
    0 Szavazatok
    15 Hozzászólások
    540 Megtekintések
    D
    @dan rathbun said: ... the engine triggers MISSPELLED dan, I truly thought you had misspelt that and had to Google it... best explanation I could find was this... @unknownuser said: British English shows a preference for retaining strong verb forms (burnt, learnt, spelt, dreamt, spoilt etc). American English shows a preference for ignora... I'm mean simplification (burned, learned etc). john
  • [Code] save Camera properties method

    4
    0 Szavazatok
    4 Hozzászólások
    334 Megtekintések
    Dan RathbunD
    @greenskp said: all this code is to work in MAC and PC? Yes it will work on both Mac and PC. BUT it is meant for you to copy it INSIDE your plugin sub-module.
  • How to load the system lib of ruby for SU

    5
    0 Szavazatok
    5 Hozzászólások
    304 Megtekintések
    Dan RathbunD
    SketchUp currently uses Ruby v1.8.6-p287 Ruby (v1.8.6-p287) Windows One-Click Installer Standard Ruby Library folders DO NOT belong in SketchUp's "Plugins" folder. They belong in the Standard Ruby Library folders. Once a user installs the full Ruby edition, SketchUp's Ruby can access it's library folders, by pushing library paths into SketchUp's **$LOAD_PATH** array. See: [ Code ] Ruby LOAD PATHs script (Win32)
  • Extract camera position

    11
    0 Szavazatok
    11 Hozzászólások
    422 Megtekintések
    renderizaR
    @greenskp said: One more thing. Whit this code i can get camera target position? Dan Rathbun posted a ref link that have things like target, direction, ect example ptarget = @@model.active_view.camera.target ; @greenskp said: It´s possible that to each Scene created i have different coordinates? Not sure what you mean by this. If you click remember camera position in scene manager then yes you will change camera placement with scene. Cheers! Note: Thanks thomthom for explaining why that happened!
  • [code] Is there a way to know if cursor on top of shadow?

    12
    0 Szavazatok
    12 Hozzászólások
    463 Megtekintések
    Dan RathbunD
    ... because in a boolean expression nil (and false,) eval falsely. Everything else including true, [] (an empty array), and 0 (the integer zero,) evaluate truthfully.
  • How to display Vertex and change color when selected?

    10
    0 Szavazatok
    10 Hozzászólások
    601 Megtekintések
    Dan RathbunD
    Don't put spaces between method names and their argument lists when you surround the list with** ( )** Ruby generates a warning for every line that has the unneeded space.
  • [code] Sketchup Safe Shutdown method

    10
    0 Szavazatok
    10 Hozzászólások
    6k Megtekintések
    D
    censored
  • TextureWriter filename - empty response

    5
    0 Szavazatok
    5 Hozzászólások
    591 Megtekintések
    B
    There appears to be a software defect in the SketchUp API. Loading the textures into TextureWriter and then attempting to access their filenames using TextureWriter.filename(index) returns only empty strings. However, if you call TextureWriter.write_all beforehand: # Display texture names def display_tex_names $tw = Sketchup.create_texture_writer load_textures(Sketchup.active_model.entities) $tw.write_all("D;", false) tex_index = 1 while (tex_index <= $tw.count) UI.messagebox($tw.filename(tex_index)) tex_index += 1 end Sketchup.active_model.commit_operation end then the filenames are returned properly. Confusing matters further, the TextureWriterindices are one-based rather than the expected zero-based array.
  • How to select last entity selected?

    6
    0 Szavazatok
    6 Hozzászólások
    272 Megtekintések
    renderizaR
    I have tried but seems I can't get it to work or understand correctly. Is there a sample code that can better illustrate this. Thanks!
  • Ruby method to calculate the area of an intersection?

    3
    0 Szavazatok
    3 Hozzászólások
    576 Megtekintések
    Dan RathbunD
    Assuming f is the reference to the intersecting face object: a = f.area() See the API Face class.

Advertisement