sketchucation logo sketchucation
    • Login
    1. Home
    2. kyyu
    3. Posts
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
    K
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 9
    • Posts 150
    • Groups 1

    Posts

    Recent Best Controversial
    • RE: Plugins for learning purposes

      Try the Ruby Depot: http://rhin.crai.archi.fr/rld/plugins_list_az.php

      Just look for names and descriptions that imply a simple function.

      -Kwok

      posted in Plugins
      K
      kyyu
    • RE: Loop.convex? question

      You could get the vertices and get rid of the ones that form coliner edges. Make a new temporary face and go from there. Not pretty, but works. Maybe some has a better idea?

      Oh, anyone got a simple/elequent way of getting the new vertices set, instead of what I did?

      depth = 100
      width = 100
      model = Sketchup.active_model
      entities = model.active_entities
      
      ptsB = []
      ptsB[0] = [200+0, 0, 0]
      ptsB[1] = [200+width/2, 0, 0]
      ptsB[2] = [200+width, 0, 0]
      ptsB[3] = [200+width, depth, 0]
      ptsB[4] = [200+0, depth, 0]
      
      # Add the face to the entities in the model
      face = entities.add_face ptsB
      
      # Only keep non-colinear vertices
      v = []
      ver = face.outer_loop.vertices
      n = (ver.length - 2)
          v1 = ver[0].position    
          v2 = ver[1].position
          u1 = [(v2.x - v1.x), (v2.y - v1.y), (v2.z - v1.z)].normalize!
          u1_saved = u1
      for i in 1..n do
          v1 = ver[i].position    
          v2 = ver[i+1].position       
          u2 = [(v2.x - v1.x), (v2.y - v1.y), (v2.z - v1.z)].normalize!        
          if u1 != u2 then v.push ver[i] end
          u1 = u2      
      end
          v1 = ver[(ver.length - 1)].position    
          v2 = ver[0].position       
          u2 = [(v2.x - v1.x), (v2.y - v1.y), (v2.z - v1.z)].normalize!        
          if u1 != u2 then v.push ver[(ver.length - 1)] end
          u1 = u2 
      if u1 != u1_saved then v.push ver[0] end
      
      # make new face & loop
      group = entities.add_group
      face2 = group.entities.add_face v
      loop = face2.outer_loop
      status = loop.convex?
      if (status)
         UI.messagebox "Loop is Convex"
      else
         UI.messagebox "Loop is not Convex"
      end
      group.erase!
      
      posted in Developers' Forum
      K
      kyyu
    • RE: Group from Selected Entities

      It's done like this:

      model = Sketchup.active_model
      ent = model.entities
      sel = model.selection
      ent.add_group(sel)
      

      You don't want to write it out like this (long way). But this is what the above means(all one line):

      Sketchup.active_model.entities.add_group(Sketchup.active_model.selection)
      
      posted in Developers' Forum
      K
      kyyu
    • RE: Add_arc etc.

      Here is a quick diagram. 😄

      add_arc.png

      posted in Developers' Forum
      K
      kyyu
    • RE: Paste inside ruby

      Are your paver shapes 2D? You should post a example sketchup file.

      posted in Plugins
      K
      kyyu
    • RE: [Request] SU 6,7 & 8 : Version & Build & MR numbers

      There are a few version numbers listed here:
      http://www.filehippo.com/download_google_sketchup/

      posted in Plugins
      K
      kyyu
    • RE: [Help!] creat a face from edges on existing face

      @heven7_floor said:

      I just learning ruby code in SU, and found problem about draw a face onto existing face, I can identify any method in new face further , such as

      <span class="syntaxdefault"><br /></span><span class="syntaxkeyword">@</span><span class="syntaxdefault">cir_face </span><span class="syntaxkeyword">=</span><span class="syntaxdefault"> entities</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">add_face edges                     </span><span class="syntaxkeyword">----------></span><span class="syntaxdefault"> drawing it on existing face<br /><br />if not</span><span class="syntaxkeyword">(@</span><span class="syntaxdefault">cir_face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">normal</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">samedirection</span><span class="syntaxkeyword">?</span><span class="syntaxdefault"> </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">dir_vec</span><span class="syntaxkeyword">)</span><span class="syntaxdefault">        </span><span class="syntaxkeyword">---------></span><span class="syntaxdefault"> get error </span><span class="syntaxstring">"undefine method 'normal' on nil "</span><span class="syntaxdefault"> <br />  puts </span><span class="syntaxstring">"change to initial direction"<br /></span><span class="syntaxdefault">  </span><span class="syntaxkeyword">@</span><span class="syntaxdefault">cir_face</span><span class="syntaxkeyword">.</span><span class="syntaxdefault">reverse</span><span class="syntaxkeyword">!<br /></span><span class="syntaxdefault">end<br /></span>
      

      any one please help me to explain why cause of this error , I don't understand why I can't undentify this method

      thanks everyone in advance

      I've run into this problem before. Sketchup won't let you make a internal face with the add_face method. For example, if you simply draw a rectangle inside the interior of a face. Delete the rectangle's face. Select the 4 edges. The following code using Jim Foltz's Ruby Web Console won't remake the face:

      model = Sketchup.active_model
      ent = model.entities
      sel = model.selection
      edges = sel.to_a
      ent.add_face edges
      

      You need to use the "find_faces" method, but that only returns the number of faces made. So you have to go through the trouble of finding the face it made. So rewriting your code, it would work this way:

      	#@cir_face = entities.add_face edges
          edges[0].find_faces
          faces = edges[0].faces
          for i in (0..faces.length)
              result = faces[i].classify_point(@f_point)    
              if result == Sketchup;;Face;;PointInside
                @cir_face = faces[i]
                break
              end
          end
      

      I found this plugin very interesting. Here are some extra stuff, I cleared up at the beginning.

      The "normal=@inputpoints[0].normal" was giving an error, like everyone pointed out. Looks like to me, its the same vector as "@dir_vec". So I set it equal to that vector:

      #normal=@inputpoints[0].normal      
      @dir_vec = find_vec(@inputpoints[0],@inputpoints[1])
      normal = @dir_vec
      v_axes = @dir_vec.axes
      

      And I found that your pushpull direction only went positive and not negative. So added these extra lines before your pushpull:

      @pushpull_dir_vec = (@cpt_l-@f_point)
      if !(@pushpull_dir_vec.samedirection? @dir_vec)
          @cy_dist = -@cy_dist 
      end         
      status = @cir_face.pushpull @cy_dist,true
      

      Here is the modified file:
      circle_any_plan_&Pull(modified).rb

      posted in Developers' Forum
      K
      kyyu
    • RE: Zorro crashing

      SU8 isn't default. It seem to go by which version was opened last. If v7 was opened last, then double clicking will open the file in v7.

      posted in Plugins
      K
      kyyu
    • RE: Flattery plug in problem

      The file structure is messed up in the zip file. You want this folder:
      Flattery-1.0\Flattery\flattery and the flattery.rb file. And you can delete any .svn folder. There is a .svn folder in the final flattery folder. That's why you see those green and red circler revision icons.

      -Kwok

      posted in Plugins
      K
      kyyu
    • RE: Accurate rotation

      @hellnbak said:

      Is there a way, maybe a plugin, that will allow me to accurately rotate an object? What would be really good is a plugin similar to Nudge, that lets you use the arrow keys to move objects in small increments. I have searched extensively for something like this, have come up with zip, so any help will be much appreciated.

      The rotix plugin does what you want. Works with groups & components.
      http://rhin.crai.archi.fr/RubyLibraryDepot/plugin_details.php?id=348

      posted in SketchUp Discussions
      K
      kyyu
    • RE: Novice Ruby Questions - Regarding dropdown windows

      Did you figure it out? You just need to 1)put a blank filler in there to shift the original options down. And 2)rearrange your default values.

      1. array_of_dropdowns = ["", inputbox1, inputbox2, inputbox3]
      2. values = [@val4, @val1, @val2, @val3]

      -Kwok

      posted in Newbie Forum
      K
      kyyu
    • RE: [Plugin] Group PushPull 2DFaces (v0.4) Oct 20, 2010

      @diego-rodriguez said:

      thanks.
      you can add the option to remember the last setting used?

      Done, new version 0.4 posted. 😄

      posted in Plugins
      K
      kyyu
    • RE: [Plugin] Group PushPull 2DFaces (v0.4) Oct 20, 2010

      Your welcome, DIEGO-RODRIGUEZ.

      Everyone, I found a bug and have released a quick update. (from v0.3 to v0.3b ) Please, get the new version. The bug I fixed only has effect, if you chose the option not to use the input box.

      -Kwok

      posted in Plugins
      K
      kyyu
    • RE: [Plugin] Group PushPull 2DFaces (v0.4) Oct 20, 2010

      Updated to v0.3. You now have the option to make components.

      posted in Plugins
      K
      kyyu
    • RE: (Wanted) Plugin Auto Create Face

      @kazmej said:

      Kwok, implementing input box for push/pull value would be of great help 4 me.

      Here you go. Get the new version here: http://forums.sketchucation.com/viewtopic.php?f=323&t=31279&p=279346

      posted in Plugins
      K
      kyyu
    • RE: [Plugin] Group PushPull 2DFaces (v0.4) Oct 20, 2010

      Updated to v0.2. Input box added.

      posted in Plugins
      K
      kyyu
    • RE: (Wanted) Plugin Auto Create Face

      What if I gave you a input box? Would that be useful? When the plugin is run, a input box opens up. You would hit "ok" to use the default thickness value. Or you could enter a new value.

      -Kwok

      posted in Plugins
      K
      kyyu
    • RE: (Wanted) Plugin Auto Create Face

      @kazmej said:

      Great job kyyu.
      Is the a possibility to modify yours plugin that i'll be able to change the push/pull value in the Sketchup window?

      Hi kazme,

      I started a seperate thread for my plugin, if you want to check it out http://forums.sketchucation.com/viewtopic.php?t=31279. This question has been addressed there.
      Basically, I plan to integrate this feature into my Pushpull & Group plugin. That plugin already has the ability to enter the pushpush value.

      -Kwok

      posted in Plugins
      K
      kyyu
    • RE: [Plugin] Group PushPull 2DFaces (v0.4) Oct 20, 2010

      I don't normally use components, so don't even know how to code for it. If anyone wants to, feel free to modify this plugin for components. And I will post it above, as an alternative.

      This was just a quick writeup, that I never intended to improve on. But what I plan to do is incorporate this plugin into my PushPull & Group Plugin, which already has most of the features requested by DIEGO-RODRIGUEZ. I did try my PushPull & Group Plugin, originally, but it could not handle faces that touched (adjacent). You guys can check out this video, of the current incarnation of the PushPull & Group Plugin: http://www.youtube.com/watch?v=lQgeMuFdpKU

      -Kwok

      posted in Plugins
      K
      kyyu
    • [Plugin] Group PushPull 2DFaces (v0.4) Oct 20, 2010

      This was a request for a plugin to automatically divide up a solid into individual solids. The use would be importing out game levels. I guess the game engine can't deal with holes, like a wall with a window opening. What this plugin does is not divide up a solid, but works on 2D divided faces and pushpulls them into individual grouped solids. The thickness value needs to be manually changed in the beginning of the ruby. Default is 0.25
      Original request thread is here: http://forums.sketchucation.com/viewtopic.php?f=323&t=31112

      blocks.gif

      Applied to a box and exploded with Pilou's Eclate_Deplace plugin

      The example Pilou posted - exploded afterwards with Radial Move plugin
      [Original Version 0.1]

      Original v0.1

      [Version 0.2]
      I added an input box. Click ok to accept the default pushpull depth or enter new value. You can manual change two things in the code:
      -change the value "thickness_default", to set the default thickness
      -change to "use_input_box = false", if you don't want a input box

      ky_Group_PushPull_2DFaces v0.2 (input box).png

      Version 0.2 - added input box

      [version 0.3b]
      The plugin now has the option of making components instead of groups. A component option has been added to the input box. Like the other values, you can change the default in the code. Just read the comments at the beginning of the code, for instructions.

      ky_Group_PushPull_2DFaces v0.3.png

      Version 0.3b - added component option

      [New version 0.4]
      Now, saves changed input box values, for the entire sketchup session.

      Version 0.4 - remembers values for entire session

      posted in Plugins
      K
      kyyu
    • 1 / 1