sketchucation logo sketchucation
    • Login
    1. Home
    2. TIG
    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!
    ⚠️ Important | Libfredo 15.8b introduces important bugfixes for Fredo's Extensions Update
    Offline
    • Profile
    • Following 0
    • Followers 12
    • Topics 264
    • Posts 19,746
    • Groups 6

    Posts

    Recent Best Controversial
    • RE: Help with Observers

      Here's some example code:

      ###
      class FaceWatch < Sketchup;;EntityObserver
       def onChangeEntity(entity)
         UI.messagebox(entity.to_s+"; Face Changed!")
       end#def
       def onEraseEntity(entity)
         UI.messagebox(entity.to_s+"; Face Erased!")
       end#def
      end#class
      pts=[[0,0,0],[100,0,0],[0,100,0]]
      face=Sketchup.active_model.entities.add_face(pts)
      face.add_observer(FaceWatch.new)
      ###
      

      Clearly the messages are only to show what it's doing - you can add other actions instead, such as affecting some other related objects ("attributed" together)... E.G. A window has an observer, you move the window and its associated reveal faces move too: the reveal faces each have an observer and if you move one the others move with it (like it's a group that's not a group !) AND their associated window moves too...

      posted in Developers' Forum
      TIGT
      TIG
    • RE: Volume Calculator v2...

      Here's v2.1

      301 Moved Permanently

      favicon

      (www.sketchucation.com)

      ...

      Nested Groups/Components within Groups now 'mined' and each calculated.
      Dialogs combined into one and only one dialog per selection set.
      Reversed faces in some volume-groups now properly colored.
      [Note that 'Red' faces show a problem too]
      Warning at end if any ambiguous forms.

      ...

      posted in Developers' Forum
      TIGT
      TIG
    • RE: [Plugin] Volume Calculator2...

      Here's v2.2

      Nested Groups/Components within Groups now 'mined' and each calculated.
      Dialogs combined into one and only one dialog per selection set.
      Reversed faces in some volume-groups now properly colored.
      [Note that 'Red' faces show a problem too]
      Warning at end if any ambiguous forms.
      Get its RBZ from here http://sketchucation.com/resources/pluginstore?pln=VolumeCalculator2

      posted in Plugins
      TIGT
      TIG
    • RE: Disability issues

      I don't know exactly how this might function - I've never tried it... I suspect that it's only one of many applications that could provide an overlay 'screen' that otherwise doesn't interfere with the main app' [much] as you use it, so that colours could be [re]set so they are perceptible to users with such problems...

      If it doesn't exist it should be invented - I don't think it's a necessity for SketchUp or Windows BUT 3rd party developers could make something that fills that gap ?

      posted in Developers' Forum
      TIGT
      TIG
    • RE: Disability issues

      This has little to do with Ruby BUT it might help you...
      http://colorhelper.com/tutorial.php
      It seems quite comprehensive and inexpensive...

      posted in Developers' Forum
      TIGT
      TIG
    • RE: Workaround for disappearing &quot;explode&quot;-shortcut?

      @samtsham said:

      Hi everybody.
      I don't know about you, but even after the latest service release, on my Mac I cannont define a shortcut for "explode", which is as integral to my workflow as hardly another function. Well, more accurately, I can DEFINE one (Edit/Context Menu Flyout/Explode), but it doesn't do anything. I read way back when that I wasn't the only one with that problem, but protests have been few.

      Since Google still doesn't address this bug, and I have to use the bloody flyout menu 80 times a day, would any of you ruby wizards have an idea for a temporary quickfix/custumizable shortcut/workaround of any kind, to speed things up until that thing gets repaired?
      I realize that it can't be a problem on PCs, or you'd all have raised merry hell by now, but any long suffering MAC users with a few minutes to spare?

      I'd be eternally grateful.
      SAM from Vienna.

      You probably tried this anyway, but...
      Select an object that could be exploded - e.g. a Group - Open the Menu > Windows > Preferences [dialog] > Shortcuts [tab] and Filter for 'Explode', pick the 'explode' off the 'edit' menu and assign a Key - e.g. Shift+X - Now when you have something Explode'able selected using Shift+X should Explode it ... Avoid using just 'X' as this conflicts with Copy+Ctrl for Array xNNN...

      posted in Developers' Forum
      TIGT
      TIG
    • RE: Script User Options

      @unknownuser said:

      Is there a easy way to make options in a ruby script? I want to have a few user options that wont reset every time the script loads. The only way that I can think of is making a text file and somehow reading and editing it within the script.

      Making the tool as a 'Class' and then setting a user's choices as @xxx named class-specific variables remembers those for that tool during that session. Similarly, using $xxx variable names is set as global per session, BUT this is not recommended usually as these might clash with other global variables set by other scripts or extensions etc...
      Here's an example of @xxx use:

      ### PathMemory.rb
      require 'sketchup.rb'
      class PathMemory
      def PathMemory;;memorize
         model=Sketchup.active_model; @memory=[]; model.selection.each{|e|@memory.push(e)if e.typename=="Edge"}
         ### remembers just the edges in a selection in a persistent @xxx variable array called @memory.
      end
      def PathMemory;;recall
         model=Sketchup.active_model; model.selection.clear; model.selection.add(@memory)
      end
      end#class
      # add context menu items
      if( not file_loaded?("PathMemory.rb") )
        UI.add_context_menu_handler do |menu|
          menu.add_separator ### this adds a seperator line
          submenu=menu.add_submenu("Path Memory...")
          submenu.add_item("Memorize"){PathMemory.memorize}
          submenu.add_item("Recall"){PathMemory.recall}
        end#do menu
      end#if
      ###
      file_loaded("PathMemory.rb")
      

      If you want to remember a user's last-chosen general settings across different sessions then use variables that are written / saved as 'default settings' (which is in essence like writing/reading a text file of the settings BUT uses 'the registry') [ http://download.sketchup.com/sketchuphelp/gsu6_ruby/Docs/Ruby-Sketchup.html#read_default and http://download.sketchup.com/sketchuphelp/gsu6_ruby/Docs/Ruby-Sketchup.html#write_defaults ].

      If the variables relate to a specific instance of something that you are making/editing then writing/reading Attributes which are attached to that entity will persist across sessions too [ http://download.sketchup.com/sketchuphelp/gsu6_ruby/Docs/Ruby-Entity.html#get_attribute and http://download.sketchup.com/sketchuphelp/gsu6_ruby/Docs/Ruby-Entity.html#set_attribute ] - an entity can be anything, from the whole model, to a group or component, right down to just one face or edge.

      posted in Developers' Forum
      TIGT
      TIG
    • RE: Volume Calculator v2...

      @unknownuser said:

      TIG,
      Just an idea ...
      With regard to the Volume faces that are reversed, what about applying the users chosen colour / material to BOTH the front AND back faces ???
      It's a bit of a workaround, but it might be the simplest solution ???
      ...
      Howard L'

      Had that and removed it BUT it is a solution...

      posted in Developers' Forum
      TIGT
      TIG
    • RE: Volume Calculator v2...

      @unknownuser said:

      TIG,
      See attached.
      I've tried out your new VolumeCalculator Script.
      Really good, very quick.
      ...
      A few Observations / Requests:

      1. Would it be possible to have the script mine down into Groups / Components similar to your Component Reporter - ie the Volume Script would work out the Volumes for the Deepest nested Groups / Components ??? Currently models have to be Exploded down before the script can be run. (This would be my Number 1 request).
      2. Currently when you make a selection and run the script, you are prompted with 2 dialog boxes:
        a. Volume parameters dialog - where you define Layer etc
        b. A dialog which asks "Do you want to leave the original selection hidden for now ?".
        These prompts come up for EACH Group / Component selected.
        It would be much better to have these 2 dialog boxes come up just ONCE for each Selection Set - much slicker. Currently you can get around this by keeping your finger on the Return Key on the keyboard - but I'm sure there is a better way !!!
      3. I've noticed that some Volume faces are reversed - it could be just the file that I'm using to test the script - but it appears OK.
        All Volume geometry does actually have the users chosen colour - it's just that some faces are reversed.
        ...
        If I find anything else I'll post the info here in this thread.
        Other than the items noted above, the script is great, you've done a really good job with it.
        ...
        Regards
        Howard L'

      Thanks for the feedback.

      1. Group/Compo Mining would be quite possible...
      2. A combined dialog for all options once for each selection is quite possible.
      3. The problem with AdamB's great/swift volume-calculator method is that it can give wrong answers if some of the faces aren't consistently oriented. That's why I invented orient_faces.rb at the weekend. I currently make the group and orient faces consistently and make a copy with all faces reversed take the larger volume by comparing them - one's outside-in and the other is outside-out - sometimes a negative volume is reported and this is trapped. Unfortunately, depending on the form of the tested objects tested, it can report the same volume for BOTH options and it then sometimes guesses the wrong one and gives you a reversed-face final volume-group. I have some ideas on how to trap for this so we always get the volume-group's faces the right way round...

      Watch this space...

      posted in Developers' Forum
      TIGT
      TIG
    • RE: Explode Into Groups?

      @daniel s said:

      Thank you TIG!!
      It works great!... this will save me a lot of time.
      And a question... because this i can´t done with sketchup.. i put an example on the attachment... is it possible with ruby?
      Thank you again!
      Daniel S

      Groups always have their bounding box square to the axes. Components do not. Try using components ?

      posted in Developers' Forum
      TIGT
      TIG
    • RE: Explode Into Groups?

      See this thread for the answer to your dreams...

      http://www.sketchucation.com/forums/scf/viewtopic.php?p=15423#p15423

      ...

      posted in Developers' Forum
      TIGT
      TIG
    • Explode2Groups

      New script: http://www.sketchucation.com/forums/scf/viewtopic.php?p=15421#p15421

      It adds a context-menu if the 1st in a selection is a group - 'Explode to Groups'. All connected geometry within that group is grouped into separate sub-groups and the original group exploded...

      posted in Plugins
      TIGT
      TIG
    • [Plugin] Explode2Groups

      This script adds a context-menu if the 1st in a selection is a group - 'Explode to Groups'. All connected geometry within that group is grouped into separate sub-groups and the original group exploded...
      Get the latest version from the here...
      https://sketchucation.com/pluginstore?pln=Explode2Groups

      posted in Plugins
      TIGT
      TIG
    • RE: Import or Paste all Layers AND Pages?

      See new thread [Layer List Export and Import]: http://www.sketchucation.com/forums/scf/viewtopic.php?p=15373#p15373

      ...

      posted in Developers' Forum
      TIGT
      TIG
    • Layer List Export and Import

      LayerExIm.rb v1.0
      See: http://www.sketchucation.com/forums/scf/viewtopic.php?p=15372#p15372
      This lets you quickly export lists of a model's layer names and import them into another model, you can also write a list manually and import that. For more sophisticated options use Didier's LayerManager Tool...

      posted in Developers' Forum
      TIGT
      TIG
    • [Plugin] LayerExIm.rb

      PayPalButton This lets you quickly export lists of a model's layer names and import them into another model, you can also write a list manually and import that. For more sophisticated options use Didier's LayerManager Tool...http://sketchucation.com/resources/pluginstore?pln=LayerExIm

      posted in Plugins
      TIGT
      TIG
    • RE: Import or Paste all Layers AND Pages?

      As Edson says, RickW's "PageExim" script [see Smustard]] deals with exporting a model's pages[scenes] and then importing them into another model.

      To import layers import the host-model into your model. It should come in as a component. Immediately in the component browser pick over it and delete it. All of its used layers have been brought over and will remain...

      I'll knock together a script to make a list of a models layers, export it and then import it a la PageExim...

      posted in Developers' Forum
      TIGT
      TIG
    • RE: Wall &quot;cutter&quot; for windows

      Didier

      If it helps here's my thought process that's not too off yours ??? ...

      You'd place the Cutting Compo as usual into the outer face.
      The context-menu spots a cutting-component already in a face (via typename, glued_to gives face and other available properties etc). It should also check if there's an inner face to cut - pointless to give the option otherwise - your projection tools come in here ?...
      The context-menu item is say 'Cut "[compo'name]" into inner Face'
      We can get the intersection edges between the Component and its glued face.
      Assuming we have the 'cut' lines' loop we copy them onto the inner face by projecting backwards.
      We erase the outer face loop so the window cuts into the face properly once again.
      We erase the inner face within its loop.
      We make reveals from this out to the outer face (copy inner face materials).
      To get the hole/reveals to move with the component we could link those entities with attributes and observers etc so if one of them moves then so does the other one...

      posted in Developers' Forum
      TIGT
      TIG
    • Volume Calculator v2...

      See: http://www.sketchucation.com/forums/scf/viewtopic.php?p=15295#p15295

      VolumeCalculator2.rb

      Rewritten with a much quicker volume calc method thanks to AdamB.

      Please try and feedback. It has most of the functions/options of v1.8 and also puts the text-tag on a separate layer...

      Note its new name - remove any earlier versions before running or you'll get two Volume items in the context-menu...

      posted in Developers' Forum
      TIGT
      TIG
    • [Plugin] Volume Calculator2...

      VolumeCalculator2.rb

      Rewritten with a much quicker volume calc method thanks to AdamB.

      Please try and feedback. It has most of the functions/options of v1.8 and also puts the text-tag on a separate layer...

      Note its new name - remove any earlier versions before running or you'll get two Volume items in the context-menu...PayPalButton
      This is v2.0 - the NEXT post contains v2.1

      posted in Plugins
      TIGT
      TIG
    • 1 / 1