sketchucation logo sketchucation
    • Login
    1. Home
    2. TNTDAVID
    3. Posts
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    đŸ›Łïž Road Profile Builder | Generate roads, curbs and pavements easily Download
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 99
    • Posts 736
    • Groups 2

    Posts

    Recent Best Controversial
    • RE: Enable SketchUp tools

      Thank you for these solutions. ☀

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • Enable SketchUp tools

      Hello everyone. ☀

      Which code can be used to activate the SketchUp selection tool?

      Is there a list that gives all the codes to activate any tools in SketchUp?

      Thank you

      David

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Pour les pressĂ©s car la vie est trop courte!

      C'est merveilleux! 😍

      posted in Français
      TNTDAVIDT
      TNTDAVID
    • RE: Composant dynamique - curseur ou texte ?

      En effet j'avais pas compris ta question. 💚

      Tout ce qui est de nature Ă  modifier une fenĂȘtre d'option SketchUp ou une barre d'outil demande des compĂ©tences en Ruby.

      Avec les composants dynamiques, il est uniquement possible de modifier les modùles 3D. 😉

      Voici un petit exemple:

      Exemple Composants Dynamique Grue.skp

      Dans les options de ta grue, choisi la charge que tu veux déplacer puis clic sur la grue.(Tu dois utiliser l'outil interagir avec les composants dynamiques pour que ça fonctionne.)

      Tu remarquera que la charge viendra ce placer sur le crochet de la grue. 😛

      Cela est un petit exemple simple, mais il est possible de faire beaucoup plus avec les composants dynamiques.

      A plus

      David


      Exemple Composants Dynamique Grue.skp

      posted in Français
      TNTDAVIDT
      TNTDAVID
    • RE: Composant dynamique - curseur ou texte ?

      Bonjour Patrick ☀

      Je ne suis pas sur de bien comprendre ta demande.

      Il est possible de positionner un composant par rapport Ă  un autre par simple clic.

      Avec la fonction "SET" dans l'attribut "Onclick", tu peux envoyer la position et la rotation d'un composant Ă  un autre composant.

      Par exemple tu clic sur ta grue, la charge vient ce placer juste en dessous.

      Est-ce cela que tu veux faire ?

      posted in Français
      TNTDAVIDT
      TNTDAVID
    • Remove and purge hidden components.

      **Hello, ☀

      I'm currently finalizing Click-Cuisine 2.

      In order to offer a complete tool, it is essential for me to offer Click-Cuisine 2 specific functions.

      **Thanks to the many subjects opened in this formum and your help, Click-Cuisine allows to:
      **

      • Remove the included dynamic thumbnails of each furniture through their definitions and purge their materials.

      • Purge materials not used by Click-Cuisine furniture 2.

      To finish the functions of cleaning, I have to write 2 methods:

      • Purge the hidden dynamic components in all components with the "IKEA" definition.

      • Remove all dynamic attributes of components with the "IKEA" definition.

      I want to target the components with the IKEA definition, so as not to involuntarily affect other dynamic components.

      Any help from you will be greatly appreciated.

      Cordially

      David Barros**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: ConnaĂźtre la position d'un composant dynamique

      Bonjour, Boris VAISMAN

      Comme un exemple vos beaucoup mieux que de nombreuses explications, voici un exemple au format SKP:

      Position Cube.skp

      DĂ©place lu cube, puis clique dessus avec l'outil "Interagir avec les composants dynamiques", pour connaitre ça position dans les 3 Axes. 😉

      A plus

      David

      posted in Français
      TNTDAVIDT
      TNTDAVID
    • RE: Utilisation de DIBAC

      Bonjour anglaret,

      Si vous souhaitez des composants dynamiques Gratuits, vous pouvez tĂ©lĂ©charger Click-Change qui propose des Portes, FenĂȘtres, inĂ©trupteurs, vases de fleures ect...

      Dans les Plugins Payants:

      Si vous souhaitez un outil de FenĂȘtres 3D plus complet pour les Pro, il existe Click-Window 3D et Click-Cuisine pour les cuisines.

      A plus.

      David

      posted in Français
      TNTDAVIDT
      TNTDAVID
    • RE: TwinMotion 2018 va frapper fort! (VF)

      C'est un bonne exemple de simplification sur un produit complexe! 👍

      SimplicitĂ© + efficacitĂ© sur un produit d'avenir, tous est rĂ©unis pour faire un carton. ☀

      posted in Français
      TNTDAVIDT
      TNTDAVID
    • RE: Delete a list of components by their definitions.

      **I can not understand why the texture applied to "TOTO" is purged.

      If I go through "purge_unused" the texture "TOTO" is not deleted.

      So I'll get around the problem with another method.

      To delete a list of materials, I can write this:

      mat_names = ['TOTO','LOLA','CUBE']
      materials = Sketchup.active_model.materials
      mat_names.each{|mnj| materials.remove(mnj)}
      

      Can we do the same with "purge_unused", so that the unused materials of the list are deleted?

      Thank you for your help.**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Delete a list of components by their definitions.

      **Yes I read your code driven and am surprised that it does not work for me.

      You are right in my last SKP example, your method works.

      Make a test with this example:

      CubeLolaToto2.skp

      You will see that the texture of "TOTO" will be deleted.**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Delete a list of components by their definitions.

      **Thank you driven, your solution works well but encounters the same problem as that of TIG enhanced by Dan.

      The materials applied to the "subcomponents" are not seen by the 2 methods.

      To be more precise, here is an example in image:

      http://i.imgur.com/JSGr1lZ.gif

      The goal is that the texture "CUBE" is not deleted because it is used by "Nested component".

      Perhaps the solution would be to ask both methods to explore all the subcomponents in SketchUp and collect the materials so as not to delete them?

      How to write this in ruby?

      I could find a solution by modifying the components of Click-Cuisine 2, but the ideal would be to solve the problem with the code.

      If you want to try, here is the SKP file of the example:

      CUBE.skp

      Thank you**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Delete a list of components by their definitions.

      **Hello,

      You are right Dan, for the moment I still have not found a solution.

      I'm stubborn and I'd end up finding it!

      Thanks for your example Dirven ☀

      I have tested your code and the components are all removed from the SketchUp scene but nothing is purged.

      Is this normal?

      Edite:

      The Ruby console returns this message when I trigger your method.

      Error; #<NameError; undefined local variable or method `i' for Teste;Module>
      C;/Users/David/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/TNT_Teste/logic.rb;60;in `block in purge_comps_n_mats'
      C;/Users/David/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/TNT_Teste/logic.rb;56;in `each'
      C;/Users/David/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/TNT_Teste/logic.rb;56;in `purge_comps_n_mats'
      C;/Users/David/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/TNT_Teste/logic.rb;75;in `purge_comps'
      C;/Users/David/AppData/Roaming/SketchUp/SketchUp 2017/SketchUp/Plugins/TNT_Teste/logic.rb;85;in `block in singleton class'
      SketchUp;1;in `call'
      

      Thank you**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Delete a list of components by their definitions.

      **Thanks for your reactivity Dan.

      Your solution works in the most by cases, but not all the time.

      The texture applied to TOTO should not be removed because it is used by the 4 Rectangle to Left:

      http://i.imgur.com/ywPqHyg.gif

      This mistake this product on my Click-Cuisine 2 furniture, and therefore makes the method unusable.

      Here's the SKP file:

      CubeLolaToto2.skp

      If you test your code on other examples the problem will not exist! 😼

      For this reason the problem is strange and requires an investigation.

      Thank you in advance for your help.

      David**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Delete a list of components by their definitions.

      **Sorry Dan, I had not paid attention to your instructions in the code:

      @dan rathbun said:

      To test:

      purge_comps('CUBE','TOTO','LOLA')

      ... or:

      del = ['CUBE','TOTO','LOLA']

      purge_comps(del)

      Your method works very well and offers new benefits. 👍

      I noticed a small problem:

      How to avoid deleting the texture of 'CUBE', if it is used elsewhere in SketchUp?

      Thanks in advance for your help.**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Delete a list of components by their definitions.

      **Sorry Dan, but I can not seem to make your method work.

      In your method, how to integrate "CUBE", "TOTO" and "LOLA"?

      Thank you in advance for your help.

      David**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Delete a list of components by their definitions.

      @sdmitch said:

      You just need to wrap TIG's code with
      CODE: SELECT ALL
      ["cube","toto","lola"].each{|name|
        match = /#{name}/i
      .
      .
      .
      }

      Great thanks sdmitch,

      You allowed me to understand what Dan Rathbun was explaining to me.

      @dan rathbun said:

      https://forums.sketchup.com/t/ruby-lear ... ists/22861
      Get the old "Pick Axe" book and read it.

      Thanks for the Dan link, I will follow your advice.

      Here is the TIG method, which works for several definitions:

      http://i.imgur.com/UwLix09.gif

      
        ["cube","toto","lola"].each{|name|
        match = /#{name}/i
        model=Sketchup.active_model 
        defstogo=model.definitions.find_all{|d| d.name =~ match } 
        matstogo=[]
        defstogo.each{|d|  
        d.instances.each{|i|
        matstogo << i.material unless matstogo.include?(i.material)
        }
        d.entities.each{|e|
        matstogo << e.material unless matstogo.include?(e.material)
      ( matstogo << e.back_material unless matstogo.include?(e.material) ) if e.is_a?(Sketchup;;Face)
      }
      }
        matstogo.compact!
        matstogo.uniq!
      
        defsnottogo=model.definitions.find_all{|d| ! d.name =~ /#{match}/ }
        matsnottogo=[]
        defsnottogo.each{|d|
        d.instances.each{|i|
        matsnottogo << i.material unless matsnottogo.include?(i.material)
        }
        d.entities.each{|e|
        matsnottogo << e.material unless matsnottogo.include?(e.material)
      ( matsnottogo << e.back_material unless matsnottogo.include?(e.material) ) if e.is_a?(Sketchup;;Face)
      }
      }
        matsnottogo.compact!
        matsnottogo.uniq!
        matstogo.clone.each{|e|
        matstogo.delete(e) if matsnottogo.include?(e)
      }
        model.start_operation('Purger', true)
        defstogo.each{|d| d.entities.clear! }
        matstogo.each{|m| model.materials.remove(m) }
        model.commit_operation
      }
      
      

      With your help I reach my goals and I discover more and more the Ruby. 😉

      Thank you all for your help.

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Delete a list of components by their definitions.

      **Hello Dan Rathbun and thank you for your help.

      @dan rathbun said:

      Then either you wrap what TIG showed you into a method, and call it 3 times from a loop:

      How to write the loop?

      I have done several tests and I still get this error message:

      Error; # <SyntaxError; <main>; syntax error, unexpected '|'
      For cname in ['CUBE', 'TOTO', 'LOLA'] do | cname |
      
                                               ^>
      

      Then I tried your method by adding:

      Cnames = ['CUBE', 'TOTO', 'LOLA']

      The ruby console returns:

      purge_comps
      

      But nothing changes in SketchUp. đŸ˜Č

      I have to move on from something obvious that I can not understand.

      Thank you in advance for your help.**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Delete a list of components by their definitions.

      @tntdavid said:

      What made you think you need to diverge from my guidance ?

      **I used a array to "match" because there will be several different definitions to delete.

      As in your code you use:

      defstogo.each {| d |

      It seemed to me that "each" was used to browse a array.

      Your code works perfectly for a single definition, what if we have "CUBE", "TOTO" and "LOLA" to delete?

      For matstogo I did not know that it was possible to collect materials of a definition without naming them. I'm still surprised by the Ruby.

      Thank you for your help.

      David**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Delete a list of components by their definitions.

      **Hello TIG,

      Thank you for your very complete and precise example.

      I made a simple test on a component with the definition "BOX" which has a texture called "RED".

      The ruby dialog box returns "True", but does not delete the cube or the texture.

      http://i.imgur.com/ukvVTXi.gif

      Here is the code I copied and pasted into the dialog box:

        match = ['BOX']
        model=Sketchup.active_model 
        defstogo=model.definitions.find_all{|d| d.name =~ match } 
        matstogo=['RED']
        defstogo.each{|d|  
        d.instances.each{|i|
        matstogo << i.material unless matstogo.include?(i.material)
        }
        d.entities.each{|e|
        matstogo << e.material unless matstogo.include?(e.material)
      ( matstogo << e.back_material unless matstogo.include?(e.material) ) if e.is_a?(Sketchup;;Face)
        }
      }
        matstogo.compact!
        matstogo.uniq!
      
        defsnottogo=model.definitions.find_all{|d| ! d.name =~ /#{match}/ }
        matsnottogo=['RED']
        defsnottogo.each{|d|
        d.instances.each{|i|
        matsnottogo << i.material unless matsnottogo.include?(i.material)
        }
        d.entities.each{|e|
        matsnottogo << e.material unless matsnottogo.include?(e.material)
      ( matsnottogo << e.back_material unless matsnottogo.include?(e.material) ) if e.is_a?(Sketchup;;Face)
      }
      }
        matsnottogo.compact!
        matsnottogo.uniq!
        matstogo.clone.each{|e|
        matstogo.delete(e) if matsnottogo.include?(e)
      }
        model.start_operation('Purger', true)
        defstogo.each{|d| d.entities.clear! }
        matstogo.each{|m| model.materials.remove(m) }
        model.commit_operation
      

      Or is my mistake?

      Thank you in advance for your help.

      David**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • 1 / 1