⚠️ Important | Libfredo 15.6b introduces important bugfixes for Fredo's Extensions Update
  • Selecting all edges in selection cycling through groups

    3
    0 Votes
    3 Posts
    6k Views
    TNTDAVIDT
    Hellobaldaman, Here is an example code that will allow you to select all the edges: def select_all_edges(ents, edges) ents.grep(Sketchup;;ComponentInstance).each do |e| e.definition.entities.grep(Sketchup;;Edge).each do |e| edges << e end select_all_edges(e.definition.entities, edges) end end edges = [] mod = Sketchup.active_model sel = mod.selection select_all_edges(sel, edges) sel.clear sel.add(edges) Note that you do not have to select the edges to apply a ruby transformation on the edges. Cordially David
  • Find the position of a specific vertex on a face.

    4
    0 Votes
    4 Posts
    6k Views
    TNTDAVIDT
    Hello, Try this: mod = Sketchup.active_model sel = mod.selection sommet = [] sel.grep(Sketchup;;Face).each do |f| @pt = f.bounds.min f.edges.each do |e| e.vertices.each do |v| sommet << v.position end end end p "VERTICES POSITIONS = #{vertices_posy}" p "POINT POSITION = #{@pt}" Then follow the instructions of TIG.
  • Adding a new group issues

    2
    0 Votes
    2 Posts
    6k Views
    S
    Your snippet is missing some key contextual info from the surrounding code: where was edg created and what does it refer to? Lacking that, it is impossible to guess what face=edg.faces[0] returns, hence what pushpull is acting on.
  • Clearing the model.selection programmatically

    3
    0 Votes
    3 Posts
    9k Views
    S
    Actually, #close_active exits the current edit context, aka active_entities, (belonging to a group or component) and returns to its parent (an enclosing group, component, or the model). Since the selection can contain entities from only one context at a time, all of the currently selected entities have to be in the active context and have to be cleared when you close it.
  • Length snapping by code?

    2
    0 Votes
    2 Posts
    6k Views
    C
    # Default code, use or delete... SKETCHUP_CONSOLE.clear if defined? SKETCHUP_CONSOLE mod = Sketchup.active_model # Open model ent = mod.entities # All entities in model sel = mod.selection # Current selection opts = mod.options prov = opts["UnitsOptions"] #LengthFormat puts "Old setting ;" + prov["LengthFormat"].to_s prov["LengthFormat"] = 0 puts "New setting ;" + prov["LengthFormat"].to_s #LengthUnit puts "Old setting ;" + prov["LengthUnit"].to_s prov["LengthUnit"] = 3 puts "New setting ;" + prov["LengthUnit"].to_s #LengthPrecision puts "The original precision setting value ;" + prov["LengthPrecision"].to_s prov["LengthPrecision"] = 1 puts "The new precision setting value ;" + prov["LengthPrecision"].to_s #LengthSnapLength puts "The original SnapLength setting value ;" + prov["LengthSnapLength"].to_s prov["LengthSnapLength"] = 10.cm puts "The new SnapLength setting value ;" + prov["LengthSnapLength"].to_s
  • Load plugin on condition of textfile

    2
    0 Votes
    2 Posts
    6k Views
    U
    Okay, I found a solution, I should have had the if statement in the plugin I wanted to run.
  • Subtract the selection of edges

    13
    0 Votes
    13 Posts
    8k Views
    TIGT
    This isn't a method, but an outline of a process... You have a component-instance. From that instance you can get the component-definition. You can then add a new instance of that into the same entities-context as the original instance, using a copy of the original's transformation. Now you can process that new instance. For example, you can explode it get a reference to everything, then erase everything that's not an edge - e.g. faces, text, dims, and nested groups and instances. Now you have the edges. If you'd like a group containing just those edges... Once you have the component-definition, you first add a new empty group into the same entities-context. You can now make a reference to the group.entities context and then add the new instance into that new context, explode and trim the array of entities, to finally leave only the desired edges inside the group. Now you have the required edges inside your group. [Remember that you can rename that container group etc as desired]
  • Transformation tap method

    6
    0 Votes
    6 Posts
    10k Views
    TIGT
    You have the center, radius and normal before you add the circle. Then when you add the circle it returns an array of edges edges = entities.add_circle(...) From any one of those edges you can get the ArcCurve, and from that you can get its center, radius and normal. I still think this can be done more simply. But if you have something that works... then go with it...
  • About Checking Plugins for Update

    7
    0 Votes
    7 Posts
    8k Views
    C
    Is there a way to pre-configure "Check Fredo6 Plugins for Update" to "Never show this dialog again"? Basically, I never want this feature to pop up for users and check for updates. If I choose "Never show..." in that pop up where does that get stored? We run a managed environment across all our computers. We deploy SketchUp plugins to C:\ProgramData\SketchUp\SketchUp 2018\SketchUp\Plugins\ so that all the plugins are available to any user of a given computer. When a plugin has been updated by a developer we deploy it to all computers to keep everyone on the same version. I would like to preset the parameter to never check for Fredo6 plugin updates. Thanks!
  • Potential Project

    21
    0 Votes
    21 Posts
    11k Views
    Didier BurD
    @Dan: Layer feature done See here: https://sketchucation.com/forums/viewtopic.php?f=323&t=70361
  • Select Style for drawing

    8
    0 Votes
    8 Posts
    7k Views
    U
    I found it, it was a test .rb file, not a plugin but it did have def get_from_excel That is where the plugin was getting the code from. Thank you, The style does change now that I am in the correct code.
  • How download and apply material from html page?

    2
    0 Votes
    2 Posts
    6k Views
    B
    I guess you have to download the file to local disk,then apply it in your model, of course, you can use ruby to do it automaticly
  • Online 3D Room Visualiser

    3
    0 Votes
    3 Posts
    6k Views
    pbacotP
    @juju said: I know of RoomSketcher, but I don't think it imports SKP files. Actually looks pretty good. May be useful for some clients
  • Ruby Operation left Open

    4
    0 Votes
    4 Posts
    6k Views
    TIGT
    Also remember that your code as we can see it ALWAYS does a commit - even if there was never an operation started. But since we only see some of your code it's unclear if there's always an operation to be committed ! One way round that is initially to set **@**draw_status = false, then within the 'tests' use **@**draw_status = @model1.start_operation(@Model_operation, true) e.g. in if @Trusstype... Always remembering to set in each 'test': and then in your unshown code, for each commit you need to use: draw_status = @model1.commit_operation if **@**draw_status So you don't commit anything unless an operation is been started...
  • Python for Sketchup?

    2
    0 Votes
    2 Posts
    7k Views
    renderizaR
    Why would you want to use Python instead of Ruby? You can try using Python to talk to Javascript and then javascript talk to SketchUp is Ruby API. There is also a C API but I have never used it. Good luck!
  • How to detect if two faces are EXACTLY coplanar or not?

    9
    0 Votes
    9 Posts
    8k Views
    robintR
    Yeehaaa here's a dummy way with a tetrahedron fudge your model with a face on x,y plane and one edge on the x axis - you hope. this face must be filled draw a flat rectangle joining this edge at both end and extend along the flat plane y. It should fill by itself. the line in between can be removed and it should all fill - if not you screwed up placing your model I think this is fundamental to any modelling (would you start a 2d drg without an origin, scale and xy directions [image: iKQz_coplanarity.jpg]
  • Applying color to circles?

    4
    0 Votes
    4 Posts
    5k Views
    TIGT
    Your current 'circle' code only draws some edges [all be it that they are in the form of circles]. Use e.g. edges=ents.add_circle(@pt1, @vec3, @dia, 24) Then make a face for one of those edges... ents.find_faces(edges[0]) face=edges[0].faces[0] Then add a material to the 'face'... Of course this is very simplistic... e.g. if your circles might overlap etc not all edges might get a face, so then you probably need to make each circle/face inside its own group in turn, at least until you have finished making/painting it etc, after which exploding the temp-group can put the faces back into the desired entities-context...
  • Converting Su8 ruby 1.86 to Ruby 2

    3
    0 Votes
    3 Posts
    5k Views
    robintR
    Hi thanx for the heads up, I thoought I was probably being simplistic Its a pity that SUC does allow more realistic FB to developers. Some of the stuff is brill and I would give 5* But I am strictly on the geometric solids/eng side and SU is mainly for graphics and visualisers I guess
  • LD_LIBRARY_PATH ... call executables and dynamic libraries

    2
    0 Votes
    2 Posts
    4k Views
    Dan RathbunD
    ENV["LD_LIBRARY_PATH"] is for standalone Ruby. I'm surprised if it works at all in embedded Ruby. Same for Open3. I've heard of nothing but problems with it under SketchUp embedded Ruby. Suggest you try to wrap Emp using the Ruby Fiddle library ... http://ruby-doc.org/stdlib-2.2.4/libdoc/fiddle/rdoc/Fiddle/Importer.html P.S. - Your code is hard to read on GitHub because your indents are being replaced with 8 spaced TABs. Ruby looks best with 2 space indents. Most code editors can replace TAB with space characters as you type, and you will not get these giants indents when you post code.
  • Issues with a simple material copy raycast script

    25
    0 Votes
    25 Posts
    9k Views
    C
    Thanks again for the reply TIG. Unfortunately, I see the same issues. To verify it wasn't the small differences in faces from DropVertices, I made a copy of the bottom textured model and moved it directly above. I removed the top materials and then ran the script. UV issue is still there. Have you actually downloaded the file and run this script with the top mesh faces selected? Have you seen the UV issues or did it look okay for you? Honestly, I guess I will just give up at this point. I have figured out another sort of workaround where I make a sandbox mesh above the original, run this script we wrote (which does perfectly with the texture and UVs when the raycast is from a flat surface), then use UVToolkit to save the UVs, then drop the vertices and then restore the UVs. It works. A few extra steps but this script has been enough of a headache. Regardless, thanks for your help.

Advertisement