⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Import script to import 300 dae into 1 project

    27
    0 Votes
    27 Posts
    21k Views
    S
    Hi mate, maybe operator error the first couple of times I tried. Confirmed working in SU2019 Pro both with Collada DAE meshes created in Meshlab and from batch triangulated Collada export from Blender.
  • The component information inside the group extract

    6
    0 Votes
    6 Posts
    8k Views
    T
    Thank you for your help. It works perfectly. Thank you again.
  • Collecting groups and components with certain material

    6
    0 Votes
    6 Posts
    7k Views
    TIGT
    'Containers' are groups or component-definitions, which 'contain' entities - they are usually referred to as 'entities-collections' - but 'containers' is synonymous...
  • Help with dialog

    6
    0 Votes
    6 Posts
    7k Views
    PixeroP
    Thanks. That worked.
  • "Cannot convert argument to Geom::Vector3d" error

    2
    0 Votes
    2 Posts
    7k Views
    TIGT
    Before the line starting angle... Add in these to see what the arguments you pass are out the possible obj_axis permutations and retest... ` p e p tr p a_vector p obj_axis p a_vector.to_a p obj_axis.to_a` If one or both of them are NOT vectors, then we've got somewhere...
  • Selected entity question

    8
    0 Votes
    8 Posts
    7k Views
    PixeroP
    They are just for two small snippets that I will need some advise from Thomasz (Thea settings) to make them properly. I'm just preparing for when he will have some time to look into it...
  • HTMLDialog - Change source on the fly? Possible?

    2
    0 Votes
    2 Posts
    6k Views
    placidfuryP
    Did more searching, and found one spot that said the source couldn't be changed (at least not in the way I was meaning). I guess to do what I really want to do, I'd have to dive deep into this, and I just don't have the time since my development work is a "side" project at work. I DO however have time to use TT's SKUI, so that's what I'm going with, since I have already used it for a couple dialogs already in this project.
  • Ruby Component Insertion and Attributes - Not Updating

    7
    0 Votes
    7 Posts
    9k Views
    placidfuryP
    Just now saw this - I have been unable to get a batch redraw of DC's to not take significant time. It seems the more DC's you redraw in the same operation, the longer each successive one takes to redraw. Eventually, I found a way around this by simply scrapping my usage of DC's and switching to groups. Operations on groups are essentially instantaneous. I'd use DC's if it's one or few objects at a time, or something I want the user to be able to interact with via the DC interface, but most of my plugin's objects are not that - I'm manipulating them with my code. Since I'm doing Engineered Wood Products layouts on very large multifamily buildings, I end up with thousands of objects to manipulate, and DC's simply didn't work well enough, as they were too slow. And the fact that even changing one property - even one that doesn't affect geometry - forces you to have to redraw them each, that time involved was a deal-breaker.
  • Modify highest face

    2
    0 Votes
    2 Posts
    7k Views
    V
    Ok I find the way, it works with local_bounds model = Sketchup.active_model sel = model.selection bbox = Geom::BoundingBox.new sel.each {|grp| bbox=grp.local_bounds get_entities(grp).find_all{|e| is_kind(e,"Face") }.each{|fc2| pl2 = fc2.plane if fc2.normal.parallel?( vec3d(0,0,1) ) and ( bbox.max.on_plane?(pl2)) fc2.layer = "K-Masque" edges = fc2.edges edges.each {|edg| edg.layer = "K-Masque"} end } }
  • Two different colors to the same shape

    2
    0 Votes
    2 Posts
    13k Views
    TIGT
    Please use 'code' blocks to format long Ruby extracts. I've fixed your post for you this time... You need to find all 'vertical' faces in the group named 'Top'. After the last part of the code add this... vfaces = entities.grep(Sketchup;;Face).find_all{|f| f.normal.z == 0 } vfaces.each{|f| f.material = clr }
  • Messagebox within a callback fails

    5
    0 Votes
    5 Posts
    7k Views
    Didier BurD
    @TIG Thanks for the hint, unfortunately it doesn't help, I'm getting the correct values for face and dist outputs. BUT, I tried to call message box in others callbacks, it worked in every case. So what was wrong with this particular callback ? Guess what, one CANNOT call a UI.messagebox after a webdialog (or html dialog) closes, modal or non-modal. There's some kind of logic here... This doesn't work: # callback cancel @web_dialog.add_action_callback("dlg_cancel_settings") { |d, p| @web_dialog.close() r=UI.messagebox("Are you sure ?",MB_YESNO) } This works: # callback cancel @web_dialog.add_action_callback("dlg_cancel_settings") { |d, p| r=UI.messagebox("Are you sure ?",MB_YESNO) @web_dialog.close() }
  • [Plugin] Slender - Baking textures in Sketchup with Blender

    29
    0 Votes
    29 Posts
    14k Views
    N
    I should have also included I am using win 10, blender 2.79c, sketchup 17
  • Reading numbers from external text file

    18
    0 Votes
    18 Posts
    8k Views
    PixeroP
    I use Notepad++ as well but use the ruby code editor when testing out snippets without having to restart SketchUp. Now I’ll continue with the main work.
  • Ruby scripted Dynamic Attributes reporting Issues

    2
    0 Votes
    2 Posts
    6k Views
    Dan RathbunD
    @jh said: ... I dont get it why I cannot get the lenx, leny and leny to report in any Ruby- driven Report-Script I tried, until some User-Interaction with the Component-Options has been made, ... The default values are stored in the DC definition's "dynamic_attributes" dictionary and the DC instance just uses the defaults until the user changes them. When they are different than the default, the DC code will create instance specific attributes in the instance's "dynamic_attributes" dictionary. So the "rule of thumb" for Ruby coding DCs is to always first check the instance's "dynamic_attributes" dictionary, then check the definition's "dynamic_attributes" dictionary for dynamic attribute values.
  • Send action for DC Components options window?

    2
    0 Votes
    2 Posts
    6k Views
    Dan RathbunD
    @pixero said: Is there a way of activating the Dynamic Component Options window through ruby? Yes and sample code is given here ... https://forums.sketchup.com/t/close-component-option-component-attribute-windows-using-ruby-script/83784/6
  • Iterate through nested groups/components to get edges

    8
    0 Votes
    8 Posts
    6k Views
    PixeroP
    Thank you. That works as I wanted.
  • Inputbox issues

    9
    0 Votes
    9 Posts
    7k Views
    PixeroP
    Solved it this way so I never have to pass the @@depth value to the DC. @@depth_inch = @@depth*0.0393700787
  • [SOLVED]Reloading Component via DefinitionsList.load Problem

    14
    0 Votes
    14 Posts
    8k Views
    M
    Thanks for the quick reply! I think I've done everything right, but I only get a new definition (loaded) when I use the write-to-dev-null trick (but it's painfully slow!). When I use the add_cpoint() or add_group() trick my SKP file is ignored and I get the same GUID back. Here's my full script, if you don't mind taking a look: require "sketchup.rb" module RefreshComponent def self.force_reload_component_definition!(model, definition) definition_path = definition.path definition_name = definition.name definition.name = definition.name + rand.to_s ## definition.entities.add_cpoint(ORIGIN) ## <== this causes GUIDs to match (fail) definition.save_as("/dev/null") ## <== this causes new definition load (success) reloaded_definition = model.definitions.load(definition_path) puts "Old GUID; " + definition.guid puts "New GUID; " + reloaded_definition.guid reloaded_definition end def self.reconnect_component_instances!(model, old_definition, new_definition) model.start_operation("Remap instances") old_definition.instances.each { |instance| instance.definition = new_definition } model.commit_operation end def self.delete_component_definition!(model, definition) model.start_operation("Delete Definition") definition.entities.erase_entities(definition.entities.to_a) model.commit_operation end def self.refresh_component(model, definition) model.start_operation("Reload current component definition", true) reloaded_definition = force_reload_component_definition!(model, definition) reconnect_component_instances!(model, definition, reloaded_definition) delete_component_definition!(model, definition) model.commit_operation end def self.start model = Sketchup.active_model model.start_operation("Reload component definitions from file", true) model .selection .select { |entity| entity.is_a?(Sketchup;;ComponentInstance) } .map { |instance| instance.definition } .uniq .each { |definition| refresh_component(model, definition) } model.commit_operation end end unless file_loaded?("refresh_component.rb") UI.add_context_menu_handler do |context_menu| context_menu.add_item("Reload Current Component Definition") { RefreshComponent.start } end file_loaded("refresh_component.rb") end
  • Trouble with commit operation

    10
    0 Votes
    10 Posts
    7k Views
    V
    En fait le guide point sert à modifier l'ancien composant a cause d'un bug sur model.definitions.load(path) qui refuse de lire un composant dans le même répertoire qu'un composant enregistrer si celui ci n'est pas modifier. Je suis donc obliger de mettre la partie guide point avant model.définitions.load(path). cf : https://sketchucation.com/forums/viewtopic.php?f=180&t=60568
  • Straight Skeleton Algorithm

    4
    0 Votes
    4 Posts
    7k Views
    H
    I have been looking for this algorithm too! it's so useful in design. Is there any follow up on this thread? The problem with ruby is that for all the available ruby geometry libraries I could find online are simple algorithms, I can write them myself. but for the hardcore ones such as straight skeleton... it does take some expertise to translate from other languages. looking forward to any ruby implementations for this.

Advertisement