Urasik Extensions | Lots of new extensions to check out Learn More

Alkategóriák

  • No decscription available

    20 Témakörök
    462 Hozzászólások
    HornOxxH
    @pilou said: More appetizing in chocolate! Eggs are good as well - but only very fragile when falling down in SketchyPhysics
  • Send action for DC Components options window?

    2
    0 Szavazatok
    2 Hozzászólások
    6k Megtekintések
    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 Szavazatok
    8 Hozzászólások
    7k Megtekintések
    PixeroP
    Thank you. That works as I wanted.
  • Inputbox issues

    9
    0 Szavazatok
    9 Hozzászólások
    7k Megtekintések
    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 Szavazatok
    14 Hozzászólások
    9k Megtekintések
    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 Szavazatok
    10 Hozzászólások
    7k Megtekintések
    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 Szavazatok
    4 Hozzászólások
    7k Megtekintések
    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.
  • Issues with set_attributes Method and Components

    4
    0 Szavazatok
    4 Hozzászólások
    6k Megtekintések
    TIGT
    How do you 'know' for sure that setting the definition's attribute fails ? You give insufficient detail. If you use get_attribute() on the exact same definition [or instance.definition] you used set_attribute() on, then it should work. Make sure the attribute-dictionary-name and the key are exactly the same in both cases, and that you have a default value set up too - like result = t_def.get_attribute(lib, 'trussfamily', 'WTF!'). If result == @Trussfamily it's working, but if result == 'WTF!' it's not ! Make sure you have presets for the 'value' set/get @Trussfamily, and of course the ' lib' - which should be the string-name of the dictionary, e.g. lib = 'medeek_truss_eng'. It a dictionary of that exact name doesn't exist it's made, if it exists then it's reused... Personally I'd use dictionary name starting with an uppercase letter, and all keys in lowercase. There's less confusion that way... To check what's dictionaries and keys/values are attached to a definition use something like this. if t_def.attribute_dictionaries t_def.attribute_dictionaries.each{|d| puts "DICTIONARY == #{d.name}" d.each_pair{|k, v| puts "#{k} = #{v}" } } else puts "NO DICTS !" end
  • Selecting all edges in selection cycling through groups

    3
    0 Szavazatok
    3 Hozzászólások
    6k Megtekintések
    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 Szavazatok
    4 Hozzászólások
    6k Megtekintések
    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 Szavazatok
    2 Hozzászólások
    6k Megtekintések
    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 Szavazatok
    3 Hozzászólások
    9k Megtekintések
    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 Szavazatok
    2 Hozzászólások
    6k Megtekintések
    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 Szavazatok
    2 Hozzászólások
    6k Megtekintések
    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 Szavazatok
    13 Hozzászólások
    8k Megtekintések
    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 Szavazatok
    6 Hozzászólások
    11k Megtekintések
    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 Szavazatok
    7 Hozzászólások
    9k Megtekintések
    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 Szavazatok
    21 Hozzászólások
    11k Megtekintések
    Didier BurD
    @Dan: Layer feature done See here: https://sketchucation.com/forums/viewtopic.php?f=323&t=70361
  • Select Style for drawing

    8
    0 Szavazatok
    8 Hozzászólások
    7k Megtekintések
    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 Szavazatok
    2 Hozzászólások
    6k Megtekintések
    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 Szavazatok
    3 Hozzászólások
    6k Megtekintések
    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

Advertisement