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

    Posts

    Recent Best Controversial
    • RE: Creating a nested component

      Thanks TIG! I thought clone might have to be the approach, glad I got confirmation before heading down that path. I got it working in my code. However, did get one annoying side effect. My code creates several nested components, and for just one of the nested components all the faces end up inside out after cloning. I fixed it for now by using face.reverse!, but wanted to check if anybody knew why SketchUp was reversing the face normals for just one nested subcomponents created by cloning. I'm guessing the reversal could be avoided if I'm cloning entities in a specific order.

      posted in Developers' Forum
      S
      Shoff
    • Creating a nested component

      Hi Everybody,

      So, I'm trying to create a sub component and add entities from the parent component that satisfy a set of conditions. Been banging my head on the problem for a while and could use some explanation of how to make this work. Hoping that somebody that understands the nuances of add_group can break it down for me.

      Overview:

      Here's a sample model: https://dl.dropbox.com/u/4116128/example.skp

      Here's what i want the output to look like: https://dl.dropbox.com/u/4116128/example-after.skp

      When you look at each example model, make sure to turn on hidden geometry. If you look in outliner, you'll see that I selected the top left geometry of the component (manually), selected "make component", and chose to "Replace selection with component".

      Below is part of the code I wrote to try to achieve the same outcome, it assumes you have selected the component in the model. Warning, this code causes a BUG SPLAT when you quit SketchUp.

      
      
      am = Sketchup.active_model
      ci = am.selection[0]
      cd = ci.definition
      ents = cd.entities
      
      off = 8
      max = [8.0, 82.25]
      tl_a = []
      
      cd.entities.each do |ent| 
        b_max = ent.bounds.max
        b_min = ent.bounds.max
        
        if b_max.x <= off && b_min.z.to_i >= (max[1] - off)   
          tl_a<<ent
        end
        
      end
      
      tl_grp = ents.add_group tl_a
      
      
      
      posted in Developers' Forum
      S
      Shoff
    • SketchUp API Documentation for redraw and redraw_with_undo

      Hi All,
      Figured out how to do redraw based on a discussion on the Sketchucation forums, but wondering why I can't seem to find any mention of redraw and redraw_with_undo methods in the SketchUp API documentation. Are they there and I'm just not looking hard enough?

      posted in Developers' Forum
      S
      Shoff
    • RE: Question about load_handler parameter from load_from_url

      Yeah, I posted a bug report. One more thing worth mentioning for anybody that finds this thread later. When I said that it worked on a PC, I got it to work using Sketchup.status_text=, but it wouldn't work using WebDialog.execute_script. I wrote a little script to slowly count from 1 to 100 and call my javascript each time, so that I could make sure that it wasn't some silly mistake on my end, and that worked fine. So, my assumption is that execute_script is taking forever to get called inside of onPercentChange even for the PC.

      posted in Developers' Forum
      S
      Shoff
    • RE: Question about load_handler parameter from load_from_url

      I think I figured out the problem. onPercentChange doesn't work on a mac. Just tried my code on a PC, and it worked. Guess that means bug report...kind of wish I tested that sooner, would have saved me a lot of time.

      posted in Developers' Forum
      S
      Shoff
    • RE: Question about load_handler parameter from load_from_url

      hmmm. Yeah, i did something very similar to your onPercentChange definition, and it doesn't look like SketchUp is calling it. I know my javascript works because if I call load_handler.onPercentChange(foo) where foo is a number, then my progress bar updates. When you run load_from_url with the optional load_handler parameter, is SketchUp calling onPercentChange for you?

      posted in Developers' Forum
      S
      Shoff
    • RE: Question about load_handler parameter from load_from_url

      How frequently does SketchUp call it? Can I control the interval? Or is it just that I specify the interval at which it does something inside of the onPercentchange method?

      posted in Developers' Forum
      S
      Shoff
    • RE: Question about load_handler parameter from load_from_url

      That's what I was hoping, but what is the argument that you are passing doing? In the prototype on the api page, it shows that you have to pass an argument, and then it's basically just printing that p argument. What is p supposed to be conceptually?

      class LoadHandler
      
         def onPercentChange(p)
           Sketchup;;set_status_text("LOADING;    " + p.to_i.to_s + "%")
         end
      
         def cancelled?
           # You could, for example, show a messagebox after X seconds asking if the
           # user wants to cancel the download. If this method returns true, then
           # the download cancels.
           return false
         end
      
         def onSuccess
           Sketchup;;set_status_text('')
         end
      
         def onFailure(error_message)
           # A real implementation would probably not use a global variable,
           # but this demonstrates storing any error we receive.
           $last_error = error_message
           Sketchup;;set_status_text('')
         end
      
       end
      
      
      posted in Developers' Forum
      S
      Shoff
    • Question about load_handler parameter from load_from_url

      I'm using the load_handler option parameter for load_from_url, and I'm a little confused about how the onPercentchange method is supposed to work which is a piece of the bigger problem with load handling that I'm trying to resolve.

      Progress Bar:
      A little background, I'm trying to use a jquery ui progress bar to show the progress of the sketchup file being downloaded, and, my plan is to, at regular interval, fire off a request that takes the pulse of the download and returns the completion status. I need some way of taking the pulse of the download process. Anybody got an idea how to do that?

      posted in Developers' Forum
      S
      Shoff
    • RE: [Code] Sketchup.send_action() : Arguments to

      Realized I need to clarify. Those arguments return true, but nothing happens. Dialogs don't show up, etc. Do they work on a PC?

      posted in Developers' Forum
      S
      Shoff
    • RE: [Code] Sketchup.send_action() : Arguments to

      @unknownuser said:

      # Cross-Platform String arguments;
      > 'addBuilding;'     "Add New Building..."
      > 'getPhotoTexture;' "Photo Textures"
      > 'getModels;'       "Get Models..."
      > 'shareModel;'      "Share Model..." **
      > 'uploadComponent;' "Share Component..." **
      > **(brings up login dialog if not logged in.)
      

      The Cross-Platform String arguments don't work for me on a Mac with SketchUp 8.

      posted in Developers' Forum
      S
      Shoff
    • RE: Where is favorite Collections info being stored?

      I agree it's pretty easy, but just trying to make it even easier. I have a growing collection of models that works with my plugin on the warehouse, and it would be great if there was a shortcut to those models in the user's favorites.

      posted in Developers' Forum
      S
      Shoff
    • RE: What is the url for the google account sign in dialog?

      Dan,

      thanks for your help. I was hoping it wasn't a native dialog. I've been poking around in SketchUp.dat hoping that would give me a clue, and came across this:

      
      
      [SUBSTITUTIONS]
      // Explict Substitutions - currently only these three are supported
      {WAREHOUSE_SERVER}=http://sketchup.google.com
      {GWS_SERVER}=http://sketchup.google.com
      {VERSION}=gsu8
      
      [URLS google.com]
      HELP_GAIA_ACCOUNT_ACCESS=http://www.google.com/support/accounts/bin/answer.py?answer=48598&hl={GWS_CULTURE}
      HELP_GAIA_CREATE_ACCOUNT=https://www.google.com/accounts/NewAccount?continue=http://sketchup.google.com/3dwarehouse/&hl={GWS_CULTURE}&service=warehouse
      
      
      [GAIA]
      GAIA_ACCOUNTS=https://www.google.com/accounts/
      GAIA_WAREHOUSE_SERVICE_NAME=warehouse
      GAIA_APP_SIGNATURE=Google-SketchUp-
      

      Looks like native dialogs are calling urls. Don't think anything can be done with this, but thought you might find that interesting.

      posted in Developers' Forum
      S
      Shoff
    • Where is favorite Collections info being stored?

      I know i18n.dat contains Default Favorite Collections info, but can't figure out where favorite collections info get's stored when a user updates it. I'm trying to give user an easy way to add a collection to favorites through my plugin.

      Here's the excerpt i18n.dat:

      [DEFAULT FAVORITE COLLECTIONS]
      
      NUMBER_DEFAULT_COLLECTIONS=6;
      COLLECTION_0_NAME=Architecture;
      COLLECTION_0_URL=http://sketchup.google.com/3dwarehouse/data/entities?clid=578dd83d965235a69943445eb5ff139e&q=is;downloadable&hl={CULTURE};
      COLLECTION_1_NAME=Landscape;
      COLLECTION_1_URL=http://sketchup.google.com/3dwarehouse/data/entities?clid=74f1f4bc15880d539d72d32da159e115&q=is;downloadable&hl={CULTURE};
      COLLECTION_2_NAME=Construction;
      COLLECTION_2_URL=http://sketchup.google.com/3dwarehouse/data/entities?clid=7c6adff4dfc2274cbdec1b0b6b8425ca&q=is;downloadable&hl={CULTURE};
      COLLECTION_3_NAME=People;
      COLLECTION_3_URL=http://sketchup.google.com/3dwarehouse/data/entities?clid=4f8bf1d61dccd5b68095ba2080357053&q=is;downloadable&hl={CULTURE};
      COLLECTION_4_NAME=Playground;
      COLLECTION_4_URL=http://sketchup.google.com/3dwarehouse/data/entities?clid=198ab77991db28b58095ba2080357053&q=is;downloadable&hl={CULTURE};
      COLLECTION_5_NAME=Transportation;
      COLLECTION_5_URL=http://sketchup.google.com/3dwarehouse/data/entities?clid=a854971e9dfb05cea5ab2a72c8b8cb68&q=is;downloadable&hl={CULTURE};
      
      

      I've spent a few days on this, and I've run out of ideas. Any help is much appreciated.

      posted in Developers' Forum
      S
      Shoff
    • RE: What is the url for the google account sign in dialog?

      I think my question wasn't clear. I'm not a SketchUp newbie, I'm working on a plugin, and I I want to load that dialog window using the api, and I don't know what the url is for that dialog box.

      posted in Developers' Forum
      S
      Shoff
    • What is the url for the google account sign in dialog?

      Trying to figure out what the url is for the google account sign in dialog. Anybody happen to know or have a suggestion as to how to figure out?

      https://lh4.googleusercontent.com/pNXZjWqnRk3On8wKnVB-wud9ArXr_-Ir6Gg6TUBcNGlGlCqA-_bJU8lwjiAF09SfEy2ivRfF6NkHJDnMN1mM959gumFhdw9IrZ4=w1024

      posted in Developers' Forum
      S
      Shoff
    • 1 / 1