sketchucation logo sketchucation
    • Login
    1. Home
    2. Eric_Erb
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    E
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 8
    • Posts 33
    • Groups 1

    Eric_Erb

    @Eric_Erb

    10
    Reputation
    1
    Profile views
    33
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    Eric_Erb Unfollow Follow
    registered-users

    Latest posts made by Eric_Erb

    • RE: Attempting to make a button for a toolbar

      Alright it's actually pretty simple. If anybody else needs the same thing here you go...

      ` toolbar = UI::Toolbar.new "TOOLBAR.NAME"

       cmd = UI::Command.new("TOOLBAR.ITEM.NAME") {
        
          ###copy everything from the def you want to use here...
         
          ###call it...
          DEF.NAME.call()
       }
       cmd.small_icon = "PATH.TO.ICON"
       cmd.large_icon = "PATH.TO.ICON"
       cmd.tooltip = "POPUP.TEXT"
       cmd.status_bar_text = "TEXT"
       cmd.menu_text = "TEXT"
       toolbar = toolbar.add_item cmd
       toolbar.show`
      
      posted in Developers' Forum
      E
      Eric_Erb
    • RE: Automaticaly try to import files that aren't .sku

      Yeah... I'm going to stay out of this conversation and just try to follow along as best I can. How do you guys think in script? I think my brain was completely maxed out after I added about 50% of AS3 to it, so HTML CSS PHP and AS3. I just don't seem to be retaining ruby like I did the others. Maybe I'm just getting old.

      posted in Developers' Forum
      E
      Eric_Erb
    • Attempting to make a button for a toolbar

      πŸ˜• ❓ πŸ˜• ❓ πŸ˜• ❓ πŸ˜•
      I'm trying to make a toolbar button. I used the webexporter files as my guides. I was able to create the toolbar with the button but the button didn't execute the def it did nothing. I was messing around with it and now I'm getting "Error Loading File addfg2walls.rb
      undefined local variable or method `fg2walls' for main:Object"

      my addfg2walls.rb file (the one that creates the button)looks like this...

      require "Rapidset/fg2walls.rb" def createPlugin() fg2walls.init() end createPlugin()

      and my fg2walls.rb file (the one that defines the button and the def I want the button to run) looks like this...

      ` require 'sketchup'
      def fg2walls::init()
      cmd = UI::Command.new(fg2walls.handleToolbarPress) {handleToolbarButtonPress()}
      cmd.small_icon = "FG.png"
      cmd.large_icon = "FG.png"
      cmd.status_bar_text = cmd.tooltip = "Fox Gray"
      cmd.menu_text = "Wall Colors"
      wallsToolbar = UI::Toolbar.new("Wall Colors")
      wallsToolbar.add_item(cmd)
      wallsToolbar.show

      UI.menu("Plugins").add_item("FG Walls") { fg2walls.init }
      end

      def fg2walls::handleToolbarButtonPress()
      mod = Sketchup.active_model
      su_materials = mod.materials
      my_materials = Hash.new
      my_materials["Wall_surfaces"] = su_materials["FG"]

      begin
      mod.start_operation("Change Walls", true)
      rescue ArgumentError
      mod.start_operation("Change Walls")
      end

      mod.entities.each do |entity|
      if entity.is_a? Sketchup::Drawingelement
      entity.material = my_materials[entity.layer.name] if my_materials[entity.layer.name]
      end
      end

      mod.commit_operation
      end`

      As I said I was just using the WebExporter files as a guide so I don't even know if these need to be two separate files. You know it's funny as soon as I start to feel confident enough to start putting my own things together, Ruby has a way of reminding me that I know nothing. Below you can download either of the files to edit them.
      addfg2Wallsfg2walls

      posted in Developers' Forum
      E
      Eric_Erb
    • RE: Script returns no errors but has no effect in sketchup

      Perfect!!! Thank you Chris

      posted in Developers' Forum
      E
      Eric_Erb
    • RE: Script returns no errors but has no effect in sketchup

      I think the problem with my code is that I'm still looking at all the layer names and applying materials to the components within those layers according to the layers name. Therefore when It finds a layer that doesn't have a material associated with it it applies white. So what I need to do is either write a script that specifically looks for a layer named Roof_surface and apply materials to its components or add a few lines to my script that says "if there is no material associated with this layer name do nothing" Anybody know how to do that?

      posted in Developers' Forum
      E
      Eric_Erb
    • RE: Script returns no errors but has no effect in sketchup

      Well it shows up just as it should in my pluggins menu. I have my material called BS loaded in the template so it's in the active model materials. I'm sure there is a big hint in your reply to my post but I just don't know enough to discern what you're telling me. For crying out loud I wrote a script with a method that I never called on and wondered why it didn't do anything.

      I'm getting closer. The new code changes the roof to the BS material, but is still turning the other stuff white.

      ` require 'sketchup'
      def bs2roof
      mod = Sketchup.active_model
      su_materials = mod.materials
      my_materials = Hash.new
      my_materials["Roof_surface"] = su_materials["BS"]

      begin
      mod.start_operation("Change Roof", true)
      rescue ArgumentError
      mod.start_operation("Change Roof")
      end

      mod.entities.each do |entity|
          if entity.is_a? Sketchup::Drawingelement
      	entity.material = my_materials[entity.layer.name]
          end
      end
      

      mod.commit_operation
      end

      UI.menu("Plugins").add_item("BS Roof") { bs2roof }`
      
      posted in Developers' Forum
      E
      Eric_Erb
    • RE: Script returns no errors but has no effect in sketchup

      You know when someone points something like that out you can't help but think "I'm....Dumb" I actually cut it out to get rid of the add to plugin menu thing. The new problem is it turns the outside of my model white even thought the material is Burnished Slate (BS) in color. (The inside of my model retains it's materials"

      ` require 'sketchup'
      def bs2roof
      mod = Sketchup.active_model
      su_materials = mod.materials
      my_materials = Hash.new
      my_materials["Roof_Surface"] = su_materials["BS"]

      begin
      mod.start_operation("Change Roof", true)
      rescue ArgumentError
      mod.start_operation("Change Roof")
      end

      mod.entities.each do |entity|
      entity.material = my_materials[entity.layer.name]
      end

      mod.commit_operation
      end

      if( !$bs2roofLoaded )
      UI.menu("Plugins").add_item("BS Roof") { bs2roof }
      bs2roofLoaded = true
      end`

      posted in Developers' Forum
      E
      Eric_Erb
    • Script returns no errors but has no effect in sketchup

      My boss pointed out that there is an exception to the "materials are always the same" rule that you guys helped write a code for. I thought I'd just make a button to make the material change if it is needed. So I wrote the code below but when I run it in sketch up it says complete and returns no errors but has no effect on my model. Where did I screw it up?

      ` require 'sketchup'
      def BS2Roof
      mod = Sketchup.active_model
      su_materials = mod.materials
      my_materials = Hash.new
      my_materials["Roof_Surface"] = su_materials["BS"]

      begin
      mod.start_operation("Change Roof", true)
      rescue ArgumentError
      mod.start_operation("Change Roof")
      end

      mod.entities.each do |entity|
      entity.material = my_materials[entity.layer.name]
      end

      mod.commit_operation
      end`

      posted in Developers' Forum
      E
      Eric_Erb
    • RE: Legal Questions / Maybe Liscensing Question

      SOAP does look interesting but what I'm going for is having an interactive color choice system for all of our models and it seams like with SOAP it would have to be set up specific to each model and we just don't have the time to invest in setting up SOAP every time. furthermore, I need to supply the user with a list of eight color choices, not allow them an infinite number of choices. Thanks for the suggestion though

      posted in SketchUp Discussions
      E
      Eric_Erb
    • RE: Automaticaly try to import files that aren't .sku

      Thanks again Gruff... it worked without a hitch. It's a bit of a work around but it works and that's the important thing. I might try to figure out how to launch it during startup and just have it appear down in the notification area of the windows toolbar so I can drag and drop files to it there instead of just keeping a your small window on screen all the time.

      posted in Developers' Forum
      E
      Eric_Erb