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: Get rotation(transformation)

      @jolran said:

      I'm getting it to work almost.

      @unknownuser said:

      vector.length=20.0

      The copied distance will always be desired length on the vectors line, but depending on the angle of diagonal the edges will not be same distance apart. So I guess I will have to do another compensation? Or is there some Quick fix like the last one(thank you TIG)

      I'm guessing will have to do a comparison between Diagonal, user(desired angle, here 45 deg) and somehow
      compensate the copy distance for that. Boy this is hard..

      Here is a example of finding the normal vector of a grouped line, using a cross product. The cross product of two vectors prduces a third vector, at right angles to the original ones.

      model = Sketchup.active_model
      ent = model.entities
      sel = model.selection
      line = ent.add_line [3,3,0], [5,5,0]
      group = ent.add_group line
      v1 = line.vertices[0].position.transform(group.transformation)
      v2 = line.vertices[1].position.transform(group.transformation)
      v = v1.vector_to v2
      # I used z vector as 2nd vector, but can try "face.normal" for general case
      normal_vec = v.cross([0,0,1])  #cross product to get normal vector
      pt = [0,0,0]
      demo = ent.add_line  pt, pt.offset(normal_vec)  #drew demo line representing normal vector
      demo.material = 'red'
      n = normal_vec
      n.length = 1
      g1 = group.copy
      g1.transform! n  # moved copied group using normal vector
      
      posted in Developers' Forum
      K
      kyyu
    • [Plugin] toggle_units_3icons (July 6, 2011)

      I needed a real simple units toggle. Maybe it will be useful to others. It only has 3 choices, with preset precision for each:

      @unknownuser said:

      Description: There are 3 choices:

      1. Fractional - percision 1/64"
      2. decimal Inch - percision 0.0001
      3. decimal mm - percision 0.001

      @unknownuser said:

      #Credits: Based on "Toggle_units Inch to mm" by 3DMON which was based on "toggle_units_5icons" by Matt666.
      #This version by kyyu, March 2011. 3DMON's version compacted the orginal to just 2 options (inch/mm).
      #I added a 3rd option: fractional. This version works with SU8.

      - update misc stuff for upload to skechucation - July 6, 2011 - changed name to "toggle_units_3icons"

      toggle_units_3icons.gif
      toggle_units_3icons.zip

      posted in Plugins
      K
      kyyu
    • RE: Get rotation(transformation)

      Do you want the translation vector to have a length of: "user_length = 20" ?

      # code below does not work. Wanto translate in vector * 20(user_length)
      vector.length = user_length 
      tgp.transform!(Geom;;Transformation.translation(vector))
      
      posted in Developers' Forum
      K
      kyyu
    • RE: [Plugin] Solids Penetration Check

      @voljanko said:

      Sketchup assign the volume to -1 when the item is not a solid.If you mean something related to my plugin,please explain more.

      No, I just mention it just in case you didn't know about it. Components are hard for me to follow, so I just briefly looked through your code to learn more. At 1st, I was thinking this was causing your bug. But then figured out the error message.

      @voljanko said:

      You wrote:"That's why the error message saids undefined method."

      How do you get this message?Hod do you debug? Im only using message boxes to debug.

      Error messages are printed out in the Ruby Console. See picture of one way I debug, by running small snippets of code with Jim Foltz's "Web Console" plugin. Jim also has a "Ruby Toolbar" plugin, that lets you reload your plugin. But I think you need to add a check for if the plugin has been installed previously, or you will get multiple menu items.

      require 'sketchup.rb'
      
      if( not file_loaded?('solids_penetration_check.rb') )
      	plugins_menu = UI.menu("Tools")
      	plugins_menu.add_item("Solids Penetration Check") { penetrationcheck }
      end
      file_loaded 'solids_penetration_check.rb'
      

      Where to find SU error messages.png

      posted in Plugins
      K
      kyyu
    • RE: [Plugin] Solids Penetration Check

      @voljanko said:

      Please help me find the solution for this bug:
      -when one solid is a subcomponent and a subgroup in a component, the plugin can't find the penetration.
      I know the problem is in line 132 def1=solid1.entities.parent ,but don't know what to do about it.
      Thanks

      You probably have more experience playing with components, than me. πŸ˜› But what I can see is, there is no need to blame sub(groups or components), yet. Your plugin doesn't even work for two simple intersecting components. "def1=solid1.entities.parent" finds the definition of groups, not components. Component instances don't have the method for "entities". It's the component definition that has that method. That's why the error message saids undefine method. It should be something like "def1 = componentInstance.definition" for components.

      Also, another strange thing(bug?) I see is when you have (group or component) inside a (group or component), I get a volume of "-1.0"

      posted in Plugins
      K
      kyyu
    • RE: Hi and possibly a big newbie question!

      Looks like everything is loose(no groups or components). I just hid everything in the back, so I could select just the fan unit. I grouped the fan unit, so it can also be easily moved later; but you don't have to.


      PC case_temp1.skp

      posted in Newbie Forum
      K
      kyyu
    • RE: [Plugin] Solids Penetration Check

      @thomthom said:

      @voljanko said:

      I would also like to change the colour of the result to make it more visible,but I don't know how.
      Any suggestions?

      Create a material and apply it to the entities.
      http://code.google.com/apis/sketchup/docs/ourdoc/material.html

      ` my_material = model.materials.add( 'IntersectionMaterial' )
      my_material.color = 'orange'

      face.material = my_material
      group.material = my_material`

      voljanko, I see this is how you did it in your plugin. But the way you have it set up, you add a new identical material every single time your plugin is run. You can open up "Window > Model Info > Statistics" to check the number of materials.

      You don't need to define a new material. Instead use the following, which will only ever add one pre-defined material to your drawing, no matter how many times you use it:
      group.material = 'red'

      posted in Plugins
      K
      kyyu
    • RE: [Plugin] Slicer v4.3 20110619

      You could use "guide point/lines" placed by the "Tape Measure Tool". Or there are plugins that make center points (aka construction points) and you can copy/paste them after they are replaced. Or plugins that may place the construction point directly. The picture below, illustrates the two methods.

      Guide Point.png
      Or making construction lines, outside of the group, may turn out to be a better solution. That's how I normally do alot of my alignment.

      posted in Plugins
      K
      kyyu
    • RE: [Plugin] Slicer v4.3 20110619

      @gschwartz9 said:

      ...
      I've tried: Subtract, Split, Trim, Zorro & Zorro2. All either don't do the job, or require significant "repair" work on the cut pieces.

      This snippet of code can take care of the repair work, after using the solid tools (Trim?). Right click the group and select "Divide Group after Trim". Just be sure no loose geometry is touching it(groups & components are ok), otherwise they may be incorporated into the new groups.
      divide group after trim.rb

      posted in Plugins
      K
      kyyu
    • RE: [Plugin] Slicer v4.3 20110619

      Gschwartz9, you say you have SU8 Pro. Have you tried the "Solid Tools", specifically the "Split" feature?

      posted in Plugins
      K
      kyyu
    • RE: CNC milling machine

      Usually cnc machines run a gcode file. So you need a CAM program to mark up and convert your model to the proper tool paths. If you are doing 2D/2.5D stuff, there is a sketchup plugin called "Phlatscript" (they just changed it to "SketchUCam")that can generate the gcode directly from sketchup. You can download it at phlatforum.com (need to register to get on the forum). I have a video on youtube showing how it is used: http://www.youtube.com/watch?v=Z9f-bC3hpHQ

      posted in SketchUp Discussions
      K
      kyyu
    • RE: Attributes and dictionaries

      I see the difference. The 2nd plugin applies and reads attibutes to the component definition. Where as the 1st plugin, uses the component instance. It works fine for edges, faces, groups. But for components, they can't see the attibutes set by the other. Also, I don't know if it matters. But if you are changing the definition of a component, then the change is not unique.

      posted in Plugins
      K
      kyyu
    • RE: Attributes and dictionaries

      What's the plugin that allow attibutes to be save with the component?

      'Get attributes' does allow changes. I've used it alot in the past.

      posted in Plugins
      K
      kyyu
    • RE: Attributes and dictionaries

      I use this plugin from smustard's site: http://www.smustard.com/script/Attributes

      You can use the right click > Attributes > "Get Attributes" feature and just type in a new value. There is a more fancy one, that uses dialog box. But this one, I've found much simpler to use and has just the single rb file.

      I'm not sure about saving the attribute with the component? I did a quick test and I couldn't get an imported component to retain it's attribute.

      posted in Plugins
      K
      kyyu
    • RE: Quantities from model

      @sdmitch, WoW, that's a great plugin you whipped up for this one off problem. I will have to study it, a little, for my education. πŸ‘

      @jemagnussen, I always like to try things out. I used sketchup's "Outer Shell" feature to combine your 3 layers into 1 (2 at a time). Then used sdmitch's volume plugin, which looks to work great. One thing, that I had to figure out was, don't select the front face edges. Only the front face and the lines extending back. I double checked the volume by grouping the 1st and last slice, and checking the volume in "entitiy info box" and it was very close to the output file.

      Quantities_1b.skp
      volume_1b.txt

      -Kwok

      posted in Newbie Forum
      K
      kyyu
    • RE: Rotating Spherical components around a common axis

      @wozabee said:

      It works just absolutely spot-on now!!

      ...now to re-learn some Keyframe animation & such, and see if I can put this chap through his paces.

      Thanks so much again Kwok!

      Woz, you're welcome. Would love to see the animation, when you are done. β˜€

      posted in SketchUp Discussions
      K
      kyyu
    • RE: Export For CAM software

      @paulhankin said:

      @dedmin said:

      Fully agree with You!! I wonder why nobody did this already - there are so many fellow woodworkers ready to pay for this!! But when You export a 5mm circle from SketchUP as .dxf it is not a circle anymore - that is why I asked above if this is a problem with CAM?

      What it could is when exported convert all circles to a high segment polygon,via a input box

      Ie a circle that has 10 edges could be converted to a circle with 100 edges giving the appearance of a more precise circle
      depending on the tolerance of a hole. and insert a cross hair in the centre to denote the centre of the circle of a standardised size say 5x5mm or an input box could include this feature to choose.

      This then could have an option to convert all holes in model , voila problem sorted

      obviously this would only work on flattened geometry for export to 2d cad cutting , say laser cutting

      What do you think?

      Thanks

      Paul

      You can always increase the circle segment size to get better circles. But gcode also does circular interprolation (G02 and G03). One is for clockwise and the other couter clockwise. You just need to supply the end points of the segment and the radius or center. The phlatscript sketchup plugin makes some use of this. For example a 3 segment circle and the simulated gcode, pictured below. I don't know if my eye is playing tricks or not, but it looks just a fraction off. Possibly round off error. But this is an extreme case. With a few more segments it looks perfect. Certainly, a 8 segment circle looks perfect.

      3 segment circle and simulated gcode

      posted in Extensions & Applications Discussions
      K
      kyyu
    • [Plugin] rotating components spherically (June 12, 2011)

      This plugin came from this thread:
      "Rotating Spherical components around a common axis"
      http://forums.sketchucation.com/viewtopic.php?f=15&t=37881

      Basically, the question was how to animate a cartoonly, sun model. The model and pics are posted in the above thread. The person had found my key rotate plugin, which rotated groups and components 90 degees in the 3 major axes. It used the arrow keys and the home/end keys:
      http://forums.sketchucation.com/viewtopic.php?t=28086

      I wasn't hard to modify the plugin, so the arrow keys moved components placed on the surface of a sphere, x and y on the surface. It was kinda like they were glued, but not really. The sphere was centered at the origin and the x/y rotations was about the origin. So the components just orbited, on the sphere surface. In z direction (local normal direction), the components rotated about their local center. But uses the radius vector of the sphere. So they also appeared to stick to the sphere surface.

      It's a rather specific plugin, but maybe people will find it useful. It's easy enough to modify. I showed the code I modified in the original thread.

      Best to get the sun model, to test how this plugins works.
      Oh, this and the orginal "ky_Key Rotate" plugin are essential identical, so they they can't both be installed, at the same time. Otherwise they will conflict.

      -Kwok

      posted in Plugins
      K
      kyyu
    • RE: Rotating Spherical components around a common axis

      Woz,

      @unknownuser said:

      I'm still wading through trying your mods to see what you changed to do the magic. Do the pieces rotate on the origin now or the component centers?

      The x and y now rotate about the origin point. The z still rotates about the component's center point. Remember, the are two key parameters. The point of rotation and the axis of rotation.

      Other than changing the 90 degrees to 1 degrees, I only changed 4 other lines. They are the ones commented out:

      def rotate_X(angle)
      	@sel.each do |e|  
      		 # pt = e.bounds.center
      		 pt = [0,0,0]
      					v = Geom;;Vector3d.new(1,0,0)
      		 tr = Geom;;Transformation.rotation(pt,v,angle.degrees)
      		 Sketchup.active_model.active_entities.transform_entities(tr,e)
      	end
      end
      
      def rotate_Y(angle)
      	@sel.each do |e|  
      		 # pt = e.bounds.center
      		 pt = [0,0,0]
      					# v = Geom;;Vector3d.new(0,1,0)
      					v = Geom;;Vector3d.new(0,0,1)
      		 tr = Geom;;Transformation.rotation(pt,v,angle.degrees)
      		 Sketchup.active_model.active_entities.transform_entities(tr,e)
      	end
      end
      
      def rotate_Z(angle)
      	@sel.each do |e|  
      		 pt = e.bounds.center
      					# v = Geom;;Vector3d.new(0,0,1)
      					v = Geom;;Vector3d.new(0,-1,0)
      		 tr = Geom;;Transformation.rotation(pt,v,angle.degrees)
      		 Sketchup.active_model.active_entities.transform_entities(tr,e)
      	end
      end
      

      @unknownuser said:

      The only thing now is the way using the home/end keys appear to rotate the parts in the z true axis. If you'll notice they "dig in" to the surface as you rotate them.

      Easy enough to fix. I changed the local Z rotation vector from the y axis to a vector pointing to the center of the component. This vector is basically the same as the rotation point (component's center), since the start point is on the origin [0,0,0]. Basically, it's now rotating about the radius of the sphere. I just changed 1 line:

      def rotate_Z(angle)
      	@sel.each do |e|  
      		 pt = e.bounds.center
      					# v = Geom;;Vector3d.new(0,0,1)
      					# v = Geom;;Vector3d.new(0,-1,0)
      					v = Geom;;Vector3d.new(pt.x, pt.y, pt.z)
      		 tr = Geom;;Transformation.rotation(pt,v,angle.degrees)
      		 Sketchup.active_model.active_entities.transform_entities(tr,e)
      	end
      end
      

      Here is the new version:
      ky_Key Rotate_modified for sun animation_02.rb

      -Kwok

      posted in SketchUp Discussions
      K
      kyyu
    • RE: Rotating Spherical components around a common axis

      Nice model! I want to learn more on the modeling front myself. I made a few changes to the "key rotate" plugin and I think it now does what you want. I didn't change much, if you look at the code. I commented out the few lines I changed, so you can see what I changed.

      You need to remove the current "key rotate" plugin or they will conflict. Changing the file extention to .txt will do, if you don't want to delete it.

      ky_Key Rotate_modified for sun animation.rb

      -Kwok

      posted in SketchUp Discussions
      K
      kyyu
    • 1 / 1