sketchucation logo sketchucation
    • Login
    1. Home
    2. ssunderland
    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 2
    • Posts 4
    • Groups 1

    Posts

    Recent Best Controversial
    • Selection order

      Hi, I've been trying to apply an Attribute Dictionary to some entities in the outliner window but haven't been having my luck. It seems like Sketchup is picking a random entity as the place to start, rather than the first one I clicked on or selected like you would assume.

      IE. My first entity gets assigned the dictionary 12 instead of 0, my second gets assigned the dictionary 13 instead of 1, etc.

      I've double checked the code with others just to make sure it was correct, but I'm wondering if anyone else has experienced this randomized order of your selection.

      posted in SketchUp Discussions sketchup
      S
      ssunderland
    • RE: Variable values in attribute dictionaries

      That would work if I was drawing the entities in the model. I didn't mention it earlier but they are entities that are imported in a DWG.

      n=0
      i=0

      Sketchup.active_model.selection[n].set_attribute("Bubble","id",i); n+=1; i+=1

      Would something like that work to select them one at a time in order? So the edges aren't mixed up in the selection?

      posted in Developers' Forum
      S
      ssunderland
    • RE: Variable values in attribute dictionaries

      Thanks for the fast reply. That is interesting..is there a better way to accomplish what I'm trying to do? Possibly in place of using the entities in the selection? Definition maybe, or group them first?

      posted in Developers' Forum
      S
      ssunderland
    • Variable values in attribute dictionaries

      I'm fairly new with Ruby so I was wondering if someone could possibly point out what I'm doing wrong in this snippet of code.

      I'm trying to assign an incrementing variable as the value in my attribute dictionary for all the entities in my array. I'd like for the value to be different for each entity, but they will share the same attribute dictionary and key.

      selection = Sketchup.active_model.selection
      i = 0
      selection.each { |entity| entity.set_attribute('Bubble','ID',i)
      i += 1
      }

      This is what I've come up with so far, but the output is all wonky. IE the first entity in the outliner window is assigned the value 2 when it should be 0. Second entity three and so on. I've tried some while/until loops as well but I haven't been able to get them to work with this. Any help is appreciated!

      posted in Developers' Forum
      S
      ssunderland
    • 1 / 1