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

    Posts

    Recent Best Controversial
    • RE: [Plugin] Select by Material, and Hide All Unselected

      Thanks for all the positive feedback.

      Bob - the tool should work to select materials within groups. However, if you are currently in component or group edit mode, it will only look at entities within the current workspace. Try exiting all components and running the plugin again. If this doesn't work, try it on a simple model... and let me know how it goes.

      CadFather - I can add something like this... Just give me a few days. Weekends are for construction.

      --
      Karen

      posted in Plugins
      K
      kwalkerman
    • RE: [Plugin] Hole Punching Tool

      Awesome Plugin!!! I thought about doing something with a similar approach, but you beat me to it!

      Two comments:

      1. The plugin works session to session (which is awesome) IF you open your file by double clicking on it and opening it directly. It doesn't seem to work if you open SU first, then do "file, open." Minor issue.

      2. After punching, if you select any of the reveal faces, all of the other reveal faces are selected, but the window component remains unselected. Again, minor, but worthy of a fix.

      3. If you create a new file by selecting "file, new", the windows are punched, but the hole doesn't move when the window is moved (same issue as #1, I think)

      Anyway, overall AWESOME plugin. Definitely saves much time & effort.

      --
      Karen

      posted in Plugins
      K
      kwalkerman
    • [Plugin] Select by Material, and Hide All Unselected

      This is my first plugin, so go easy on me.

      It has 3 basic functions:

      1. It will select all entities within the active workspace that are painted with the current material. If the current material is the default, it will select all basic entities (but not groups or component instances). For now, the plugin doesn't look at UV, just material. Unlike the built-in SU tool, it also looks in sub-groups.

      2. Hides all unselected items. This is handy if you only want to look at the items that are painted with a specific material.

      Let me know how it works for you!

      --
      Karen


      material_selection.rb

      posted in Plugins
      K
      kwalkerman
    • RE: [Plugin] Zorro2 (beta)

      Awesome plugin. Works great with the section plane and with the straight zorro tool.

      I was getting bugsplats when I used the section plane (on very simple models). De-activated another plugin (openstudio), and now it works fine.

      --
      Karen

      posted in Plugins
      K
      kwalkerman
    • RE: [Info] Allowable Classes for "set_attribute"

      Dan,

      Very nice. I will definitely use this. Too bad it's not embedded in SU though.

      Jim - I have found that any sub-components of arrays also need to be one of the allowable classes.

      Thom - trueclass and falseclass also work. I'm updating the first post accordingly.

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • [Info] Allowable Classes for "set_attribute"

      Under the Ruby API for "set_attribute" we get:

      Arguments:
      dict_name: The name of an attribute dictionary.
      key: An attribute key.
      value: The value for the attribute.

      Returns:
      value: the newly set value if successful

      but, it doesn't tell you what type of values are allowable. Here is my short list:

      allowed:

      String
      Fixnum
      Float
      Array -- For arrays, every element in the array needs to be one of the allowed types on this list.
      TrueClass
      FalseClass
      Length
      Geom::Point3d (tested under SU8 M1)
      Geom::Vector3d (tested under SU8 M1)

      not allowed:

      Entity
      Hash -- this can be stored following Dan's guidelines below.

      Be careful with hash, because if you have an array, and one of the array values is a hash, it will return the array, but instead of returning the hash, it will return nil.

      Additions? Corrections? Comments?

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: SketchUp RUBY API Wishlist [way of coding wishes, please]

      Cool. Thanks again.

      posted in Developers' Forum
      K
      kwalkerman
    • RE: SketchUp RUBY API Wishlist [way of coding wishes, please]

      Seconded on the Layers usability, also, it would be great to be able to do:

      Layers.active_layer
      Layers[layer] = active

      A consistent entityID would be awesome. The entity should maintain the ID if it is deleted, and then undeleted as well.

      Pages:

      In addition to retaining information on which layers are on and off, should also be able to retain the active layer for each page.

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: [code] loading from the Standard Ruby Libs

      Dan,

      Very helpful, as always.

      So... For future... this is where you can download the library files if you need to: http://www.ruby-lang.org/en/downloads/

      Thanks again!

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Ruby Singleton Class

      Ok, found a copy here: http://sketchuptips.blogspot.com/2008/03/plugin-auto-centerpoint.html

      if anyone needs it in the future.

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • Ruby Singleton Class

      Hi,

      I'm trying to reference the ruby Singleton Class... but when I require singleton, I get the error: "No such file to load -- singelton"

      I thought this was one of the Ruby native classes? Any idea why SU can't find it? Is there any way to restore the file and/or the source code so that I can reference it?

      Thanks,

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Observers WhishList

      I definitely add my vote for an onBeforeSave for the Model Observer. Right now, I am doing some stuff and then re-saving...

      A few things I came across:

      1. re-saving triggers the onSave method in your application, and in any other plugins that have a Model Observer. This can lead to an annoying infinite loop. I fixed this problem by requiring that the times between saves be greater than a certain set time.

      2. Once you re-save your model, the model observer immediately calls the onSave method. This means that any code below Sketchup.active_model.save "my model.skp" will not be executed until after the onSave is called and executed again... so any infinite loop prevention should be above the save command.

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Optimization Tips

      Dan, this is absolutely what I need. It is the updating of the UI that is slowing the calculation down. Having the outliner window open compounds the problem.

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Optimization Tips

      One thing I have noticed is that some code runs much slower with the outliner window open. Is there a way to close the window at the start of certain code execution, and then re-open it at the end?

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Strange warning from Face.vertices

      cool. thanks Dan.

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Strange warning from Face.vertices

      Dan,

      Wow! Lots of useful information here. I'll definitely make the changes you suggested. I was using "is_a?" instead of "class" because I read somewhere that is_a? is faster to execute, is it not?.

      TIG - also good advice. I'm trying not to debug this with "puts entity.vertices" because the error only occurred in the scope of much larger code. Printing to the console seems to slow things down considerably. I could print if v.class!=Sketchup::Vertex

      Thanks!!

      --
      karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Strange warning from Face.vertices

      true. I was stuck for a few hours the other day because I wrote:

      if(i = 0)
      do this
      else
      do that
      end

      but this one... I have no idea.

      Thanks for all the input. I'll restart the program.

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Strange warning from Face.vertices

      yeah, really puzzling. The thing is, we are starting with a face, because

      if(ent.is_a?(Sketchup::Face))

      returned true.

      And no, I can't reliably produce it. It only happened once, which makes it difficult to diagnose. I'm thinking about just double checking to make sure that v is a vertex before asking for the position. But that shouldn't be necessary!

      I can't imagine that a plugin is messing with things, but I haven't really discovered how they mess with each other yet.

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • RE: Strange warning from Face.vertices

      in addition, I just figured out which group caused the error, and was able to run the code directly on the group, with no errors... I'm truly stumped

      --
      karen

      posted in Developers' Forum
      K
      kwalkerman
    • Strange warning from Face.vertices

      I have the following code:

      
      lowest_face = nil
      lowest_z = nil
      entities = group.entities
      entities.each do |entity|
      	if(entity.is_a?(Sketchup;;Face))
      		z_avg = 0
      		n = 0
      		entity.vertices.each do |v|
      			z_avg += v.position.z
      			n+=1
      		end
      		z_avg = z_avg/n
      		if(lowest_z == nil || lowest_z > z_avg)
      			lowest_z = z_avg
      			lowest_face = entity
      		end
      	end
      end
      
      
      

      I have run this code many times with no problems, but in the scope of a larger program (after this code had been run probably 50 times), I got the following error:

      undefined method `position' for #Sketchup::Edge:0xdc52548>
      C:/PROGRA~1/Google/GOOGLE~2/Plugins/work/entity_functions.rb:518

      line 518 is the "z_avg += v.position.z

      any ideas??? Face.vertices should never return an edge - right?

      --
      Karen

      posted in Developers' Forum
      K
      kwalkerman
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 6 / 8