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: Redraw a dynamic component

      **I found with some tests that it is not possible to add dynamic attributes to neutral components.

      The component must have at least an existing attribute for it to be possible to add attributes in ruby.

      If not, we have this error message:

      @unknownuser said:

      Error: #<NoMethodError: undefined method []' for nil:NilClass> <main>:1:in block in <main>'
      <main>:in each' <main>:in grep'
      <main>:in <main>' -e:1:in eval'
      nil

      The goal is certainly to protect the creation of dynamic components, which is only available in Pro version of SketchUp?**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Redraw a dynamic component

      Thank you TIG! 😄
      This solution will give me even more possibilities in the future with the dynamic components. 👍

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Remove and purge hidden components.

      **


      Wonderful! Your example works TIG, for instances with IKEA definitions:**

      m=Sketchup.active_model;m.start_operation("unDC");m.definitions.each{|d|next unless d.name=~/IKEA/; d.attribute_dictionaries.delete("dynamic_attributes") if d.attribute_dictionaries and d.attribute_dictionaries["dynamic_attributes"];d.instances.each{|i|i.attribute_dictionaries.delete("dynamic_attributes") if i.attribute_dictionaries and i.attribute_dictionaries["dynamic_attributes"]}};m.commit_operation
      

      Is it possible to purge dynamic attributes of nested components in instances with IKEA definitions?

      Thank you

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Redraw a dynamic component

      I get the following error message with your TIG example:

      @unknownuser said:

      Error: #<ArgumentError: wrong number of arguments (1 for 0)>
      <main>:2:in attribute_dictionaries' <main>:2:in block in <main>'
      <main>:1:in each' <main>:1:in grep'
      <main>:1:in <main>' -e:1:in eval'
      nil

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • Redraw a dynamic component

      **Hello, 😄

      The code below redraws the instance 0 named with the definition "BOX".

      model = Sketchup.active_model  
      model_definition = model.definitions
      model_def = model_definition['BOX']
      $dc_observers.get_latest_class.redraw_with_undo(model_def.instances[0])
      

      How to redraw all the instances being selected without taking their definitions into account?

      Thank you

      David**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Select instances in the selection

      Thank you Dan.
      I will analyze all your information in detail. 😉

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Remove and purge hidden components.

      **Sorry Dan, I mixed brushes between definitions and instances ...

      It's wonderful TIG, your code meets 100% to my needs. 👍

      I want to be very careful with the selections or deletes, for this reason your example is perfect.

      The code below removes all attributes of all dynamic components present in a SketchUp file.

      m=Sketchup.active_model;m.start_operation("unDC");m.definitions.each{|d|d.attribute_dictionaries.delete("dynamic_attributes") if d.attribute_dictionaries and d.attribute_dictionaries["dynamic_attributes"];d.instances.each{|i|i.attribute_dictionaries.delete("dynamic_attributes") if i.attribute_dictionaries and i.attribute_dictionaries["dynamic_attributes"]}};m.commit_operation
      

      How to adapt this code so that it only deletes the dynamic attributes of all nested entities in the named definitions / IKEA / ?

      Thank you**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Remove and purge hidden components.

      **I'm not sure I understand all of your logical reasoning Dan. 😕

      I want to delete hidden definitions and not instances.

      For example:

      Dynamic Cabinet consists of a Drawer and a Door.

      The Drawer is hidden by its "Hidden" attribute.

      The Gate is visible by its "Hidden" attribute.

      Both have instances "Handles" in "sub-component".

      The method must delete the "Drawer" definition because it is hidden.

      Thus, only the "Handles" instance of the drawer will be deleted without affecting the same instances of the door.

      Cordially

      David**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Select instances in the selection

      **Thank you for all these Dan examples.

      = ~ / # {"name"} /

      It's perfect because it works for all instances.

      Now, I only want to select the instances present in a selection of components.

      The problem is that the code below, selects all the instances in the SketchUp file.

      m=Sketchup.active_model;s=m.selection;m.definitions.each{|d|s.add d.instances if d.name=~/#{"Handle"}/}
      

      Thank you**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Remove and purge hidden components.

      **Is it possible to purge hidden components inside components with the IKEA definition only?

      This will avoid affecting all the file to target only the 3D models proposed by Click-Kitchen 2.

      For example:

      Method A selects all components with the IKEA definition.

      # Method A
      m=Sketchup.active_model;s=m.selection;m.definitions.each{|d|s.add d.instances if d.name=~/#{"IKEA"}/}
      

      Method B searches for hidden components inside the selection and deletes them.

      To write Method B, I need your help.

      Thank you

      David**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • Select instances in the selection

      **Hello everybody, ☀

      With the code below, it is possible to select an instance in SketchUp by ca definition.

      m=Sketchup.active_model;s=m.selection;m.definitions.each{|d|s.add d.instances if d.name=~/#{"Handle"}/}
      

      Is it possible to select the instances "Handle # 1", "Handle # 2", "Handle # 3" etc. which are only in the furniture being selected?

      If so how do I do it?

      Thank you in advance for your help.

      David**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Remove and purge hidden components.

      Thank you TIG and slbaumgartner ☀

      The TIG example works perfectly. 👍

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Where is the SketchUp API site?

      It's wonderful Pixero. 👍

      Well tried Pilou, but these are the methods and ruby class for SketchUp that interests me.

      I am happy to find this good old API. 😍

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Where is the SketchUp API site?

      Thank you renderiza, this book looks very interesting!
      Unfortunately it can not replace the old API or all the methods and classes were perfectly presented.

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Remove and purge hidden components.

      **Hello, ☀

      After some research, I found this sample code:

      Sketchup.active_model.definitions.each {| d | d.entities.to_a.each {| e | e.erase! if e.hidden?}}
      

      The problem with this example is that hidden lines are deleted.

      I only want to remove he hidden components.

      thank you in advance for your help

      David**

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Partie d'un composant sur un autre calque

      Bonjour rom13,

      Je n'arrive pas à comprendre vos besoins, est-il possible de reformuler ou joindre une image plus explicite ?

      Les composants dynamiques comme les composant normaux peuvent être constitués de plusieurs calques afin d'afficher ou masquer un élément d'un simple clic.

      Il existe aussi l'attribut "Hidden" spécifique aux composants dynamiques qui permet de masquer ou afficher les "composants" et les "sous composant".

      Valeur à 0 <= Composants dynamique visible.
      Valeur > 0 = Composants dynamique masqué.

      Voici un petit tuto à ce sujet:

      Pour plus de tuto sur les composants dynamiques, rendez-vous sur cette page:

      http://www.composant-dynamique.com/formation-video

      A plus 😉

      David

      posted in Français
      TNTDAVIDT
      TNTDAVID
    • RE: Where is the SketchUp API site?

      Hello Pixero,

      I want to try but I do not know the address of the old site.

      Does anyone know it ?

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Where is the SketchUp API site?

      Thank you TIG but I already know this site.

      I prefer by far the old site for that documentation, are organization of methods and classes, and its tutorial.

      It was much easier to understand for novices in ruby scripts.

      It is a pity that it no longer exists! 😒

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Where is the SketchUp API site?

      @jim said:

      David, basically the new site is under construction. The API documentation needs to be corrected first, and then the examples will grow.

      I restart the subject to find out if the original API site is or will soon be available?

      Thank you

      David

      posted in Developers' Forum
      TNTDAVIDT
      TNTDAVID
    • RE: Question concernant l'import de composants (résolu)

      Salut Silic! ☀

      Je sais pas si cette méthode va t'aider:

      • Enregistre ton composant dans un dossier sur ton PC.

      • Ouvre ton composant comme une scène SketchUp traditionnelle.

      • Importe tous les sous composants que tu souhaite puis enregistre.

      • Pour finir, ouvre une nouvelle scène SketchUp et importe ton composant.

      A plus

      David

      posted in Français
      TNTDAVIDT
      TNTDAVID
    • 1
    • 2
    • 6
    • 7
    • 8
    • 9
    • 10
    • 36
    • 37
    • 8 / 37