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: Question plugin rectangular subdivision

      You might have a look at thomthom's Plan Tools: http://forums.sketchucation.com/viewtopic.php?t=30512
      I once wrote a test plugin to crop, using a face. I later saw, thomthom had made the exact same tool. There is a youtube video showing it, in the thread.

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

      @razer said:

      Hello I was wondering how could I put this in my right click menu? that way its easier to get to Thanks! I was also wondering if you could add more saved options that way I can have 2 measurements instead of going back and forth having to change it all the time

      Not too hard to learn a few thing, so you can customize plugins for your own needs. I just posted a few links for another beginner starting out: http://forums.sketchucation.com/viewtopic.php?f=323&t=28086&p=332294#p332294
      There is a link there to a pdf book, Automatic Sketchup, specifically Chapter "10.2 Menus", page 220. It's only a few pages, which will answer your 1st question about context menus. If it's still confusing, just look at another plugin that uses a context menu. It's generally the very last lines.

      -Kwok

      posted in Plugins
      K
      kyyu
    • RE: [Plugin] Key Rotate

      @unknownuser said:

      So... as is, does your script transform the active entities (group, component) around their arbitrary geometric central axis?
      I'm trying to see which part of the script works that particular bit out.

      Yes, it rotates about the center point of the group/component:
      pt = e.bounds.center

      This is real basic, which means you need to learn the basics 1st. I will give you a link to some videos and to a book, later below.

      Like I said it's just two lines. You define a tranformation, in this case rotation:
      tr = Geom::Transformation.rotation(pt,v,angle.degrees)
      You only need to supply a point of rotation, a vector(ie an axis), and the angle.
      Then you apply the transformation to something, in this case the group/component reference by the variable "e":
      Sketchup.active_model.active_entities.transform_entities(tr,e)

      @unknownuser said:

      I would imagine my next step is to find out how to point your script to something that would describe the active entity's "COMPONENT AXIS" in each case.

      In my ultimate desired use, all of the component axis's would also fall on the same real-world axis for each piece. If you could imagine each component looks a bit like a floating piece of a "cracked-apart spherical "shell" each rotating about a common "core" but each on slightly different layers so that they can "sheer" over each other.

      As you might visualize, ultimately, it would be like pushing and rotating continents around on the surface of a little globe of the earth in any direction, each continent always properly oriented to the Core, and appearing to "float" with respect to the surface and each other.

      With your script, I've managed now to at least get each component to rotate by 2 degree increments for each keystroke, but of course they just rotate where they are, intersecting each other.

      Lots of working out ahead.

      Thanks again Kwok,

      Cheers,

      Woz

      You say you want to use the "COMPONENT AXIS", but I don't see why. You can simply rotate about the center of your sphere.

      You can test out snippets of code, without writing a full plugin. Look at Chris Fullmers video tutoirals, 1st 6: http://www.youtube.com/user/ChrisFullmer#g/u
      And then try out this snippet of code. Select something and execute the snippet of code and that something will rotate/orbit around the origin, 30 deg each time. I am assuming this is what you had in mind.

      model = Sketchup.active_model
      ent = model.entities
      sel = model.selection
      pt = [0,0,0]
      v = Geom;;Vector3d.new(0,0,1)
      tr = Geom;;Transformation.rotation(pt,v,30.degrees)
      Sketchup.active_model.active_entities.transform_entities(tr,sel[0])
      

      And read this book. The full pdf version is free: http://www.autosketchup.com/

      Sketchup Ruby API: http://code.google.com/apis/sketchup/docs/index.html

      Oh, and you should start a new thread for more help with your new plugin, so as not to tie up this one. Go ahead and post a link here to the new thread.

      -Kwok

      posted in Plugins
      K
      kyyu
    • RE: [Plugin] Key Rotate

      The variable "v" specifies the vector, representing the rotation axis. For example, for the Z axis: "v = Geom::Vector3d.new(0,0,1)"

      Oh, I guess you need the rotation point, also.

      It's these two lines of code that does the rotation:
      tr = Geom::Transformation.rotation(pt,v,angle.degrees)
      Sketchup.active_model.active_entities.transform_entities(tr,e)

      Study the Sketchup Ruby API. For example, for the 1st line: http://code.google.com/apis/sketchup/docs/ourdoc/transformation.html#rotation

      -Kwok

      posted in Plugins
      K
      kyyu
    • RE: Unfolding plugin idea

      Also, You can output text to the status bar vs alot of message boxes: http://code.google.com/apis/sketchup/docs/ourdoc/sketchup.html#status_text=
      Message boxes are especially good for alerting the user of errors and debugging your code.

      And there is a book that may help you out, concerning sketchup ruby. You can download the full pdf for free: http://www.autosketchup.com/

      posted in Plugins
      K
      kyyu
    • RE: Unfolding plugin idea

      @mattc said:

      So I chewed TIG's reply over , and I got to work.
      Result is this: <snip>

      I can call it from Ruby editor, but how to wrap it up to a plugin state ??
      Where can I find any tutorial or help ?

      MattC, look at this video: http://www.youtube.com/watch?v=YEJLw3WJsnU

      posted in Plugins
      K
      kyyu
    • RE: New developer wants to simple plugin

      Stevo,

      You should make a simple plugin, 1st. For example, try having an message box pop up with the text "Hello". That's like 1 line of core code, but the rest will be a wrapper that creates the actual plugin. Check out these videos: http://www.youtube.com/user/ChrisFullmer#g/u Then you can try writing your plugin. Brake it up into pieces and get each piece working, before moving on to the next. For example, 1st piece might be to simply to rotate the selected group/comp 90 deg. For user input, you can probably just use an input box: http://code.google.com/apis/sketchup/docs/ourdoc/ui.html#inputbox

      You see that I went to the Sketchup Ruby API documentation, when I wanted to research how to do something: http://code.google.com/apis/sketchup/docs/index.html

      -Kwok

      posted in Newbie Forum
      K
      kyyu
    • RE: Can I have more than one SU?

      Which ever SU version you open last, becomes the default.

      posted in SketchUp Discussions
      K
      kyyu
    • RE: (Request) Perspective 360 rotate

      I saw this plugin recently on the forum. Actually, someone was having a problem and discussing it. It seems like what you want, rotating and exporting the image:

      SketchUp Web Exporter Beta
      http://www.youtube.com/watch?v=j0Tmlko5YTU

      You can download it here:
      http://sketchup.google.com/download/plugins.html

      posted in Plugins
      K
      kyyu
    • RE: Contents Menu to other menu locations

      @unknownuser said:

      TIG

      I my studies of Ruby for Sketchup, I have no problem with finding the context menu, it just seems to me there is always an "if then" statement, proceeding the menu add statement, and I don't see on this the other menus. There are some plugins that appear in more than one menu, and I usually turn off the context menu, and move the plugin to an other memu selection where I wish to have the plugin appear. However, I have not been able to master the coding to get rid of just a context menu with the "if selection is.....".

      Anyway, I will keep trying.

      Thank

      Ken

      You could write a intermediate method to do the check. If ok, it runs the plugin. If not valid, then it pop up an error message:

      def xLine_check_valid
      	if xLine_validate_selection
      		xLine
      	else
      		UI.messagebox "Invalid selection"
      	end
      end
      
      if( not file_loaded?("xLine.rb") )
      	UI.menu("Plugins").add_item("Convert lines to guide lines"){xLine_check_valid}
      end
      
      file_loaded("xLine.rb")
      
      posted in Plugins
      K
      kyyu
    • RE: [Plugin] Recurve

      @unknownuser said:

      probably my oldest plugin request has finally happened πŸ˜„
      weld with no dialog boxes.

      I never liked the 2 dialog boxes, either. Always answered "no". So I commented they out, in my modified version. 😎

      posted in Plugins
      K
      kyyu
    • RE: [Plugin] Recurve

      @Diggsey, thanks for the plugin.

      @Wyatt, there is a plugin by Fredo6 (called RevertCurve) that will reverse a curve's direction: http://forums.sketchucation.com/viewtopic.php?t=25710

      posted in Plugins
      K
      kyyu
    • RE: How to get rid of direction information?

      @jim said:

      Right, it's an option named "ShowViewName" in the Ruby API, but apparently not available through any dialog. The following code, pasted in the Ruby Console window, will turn the text off.

      Sketchup.active_model.options["ShowViewName"] = false

      Thanks, that's very interesting. I couldn't get it to work, but googled it and found it was mis spelled. Should be:
      Sketchup.active_model.rendering_options["ShowViewName" = false]

      posted in Newbie Forum
      K
      kyyu
    • RE: Good way to test a script

      I use Jim Foltz's Ruby Toolbar plugin. It will load and reload a plugin file: http://forums.sketchucation.com/viewtopic.php?t=1542

      That plugin in the 1st post looks interesting, but looks like it checks a folder every second, as long as sketchup is running. Do you really want that?

      -Kwok

      posted in Developers' Forum
      K
      kyyu
    • RE: Help me, I don't remember ruby

      Try "repair broken lines": http://rhin.crai.archi.fr/rld/plugin_details.php?id=334

      posted in Newbie Forum
      K
      kyyu
    • RE: [solved] taking points at intervals from a line

      Ah, thanks for all the tips, guys! The line[1] vector will be useful, as long you are after the forward edge direction. I tried to use it yesterday, but couldn't because the polyline direction did matter in my case. And the second argument in .offset(). I didn't realize there was a second argument and was scaling my vector, instead. Actually, I only recently realized you could scale a vector by vector.length= and had been doing it a harder way, before.

      -Kwok

      posted in Developers' Forum
      K
      kyyu
    • RE: [solved] taking points at intervals from a line

      @kdasilva said:

      <snip>
      i removed the /num and it always prints as 2, no matter how long the line is i make)
      <snip>

      You don't want to use a line. A line would have infinite length. Anyways, it's just seen as an array ( type "edge.line.class"). So the length of that array is always 2 elements in that array, which defines a line.

      You want to use the vector from the edge:

      pt1 = edge.start.position
      pt2 = edge.end.position
      vec = Geom;;Vector3d.new [(pt2.x-pt1.x), (pt2.y-pt1.y), (pt2.z-pt1.z)]
      edge_length = vec.length
      

      @kdasilva said:

      <snip>
      also... where does the method each_with_index come from? I can't find it in the sketchup api, and I could only find each_index in the ruby-doc http://www.ruby-doc.org/core/classes/Array.html#M000232

      thanks for the help

      korbin

      The sketchup api just documents, extra ruby Modules/Classes/methods for sketchup. It doesn't document the entire ruby language.

      -Kwok

      posted in Developers' Forum
      K
      kyyu
    • RE: Edges, angles on rectangle triangle

      Angles for a right triangle is:
      sin(angle) = opposite/hypothenuse
      cos(angle) = adjacent/hypothenuse

      But can't you just use your start and end point positions to find the rectangle corners?

      Corner Points.png

      -Kwok

      posted in Developers' Forum
      K
      kyyu
    • RE: How to set length units in code

      4.5.m
      Just type this in the ruby console, and see what it returns.

      posted in Developers' Forum
      K
      kyyu
    • RE: Plugins for learning purposes

      Come to think of it, I have a very simple plugin with 4 versions posted. So you can see the progression. It's called: "Group PushPull 2DFaces"
      http://forums.sketchucation.com/viewtopic.php?t=31279

      posted in Plugins
      K
      kyyu
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 5 / 8