[Plugin] Facewarp

[Plugin] Facewarp

Postby Builder Boy » Fri May 13, 2011 9:44 pm

My original post was here. I still got tired of dividing edges(by the way, does anyone know how to do this with ruby?), then welding them back together, then filling out a lot of dialog boxes. So, I made my own plugin to do this. I give you:

Facewarp.rb
0

Builder Boy 
 

Re: [Plugin] Facewarp

Postby Rich O Brien » Fri May 13, 2011 9:57 pm

Lots of vanishing lines when drawing? And not all faces created?

FaceWarp_Error.png
0
There's a frontroom and a backroom....reverse faces
User avatar
Rich O Brien 
Administrator
 

Re: [Plugin] Facewarp

Postby TIG » Fri May 13, 2011 10:10 pm

0
TIG
User avatar
TIG 
Global Moderator
 

Re: [Plugin] Facewarp

Postby Builder Boy » Fri May 13, 2011 10:25 pm

Rich O'Brien wrote:Lots of vanishing lines when drawing? And not all faces created?


This plugin does not always work when 2 points have the same location. Also, may give unexpected results when 3 points are collinear.

TIG wrote:http://code.google.com/apis/sketchup/docs/ourdoc/edge.html#split ???


This will only split a line into 2 segments with controllable proportions, I am looking for something more like this:
edge.divide(5) # for 5 equal-length segments
0

Builder Boy 
 

Re: [Plugin] Facewarp

Postby Didier Bur » Sat May 14, 2011 10:50 am

I am looking for something more like this:
edge.divide(5) # for 5 equal-length segments

You can do that with edge.split, just create a loop 0.upto(4) for instance to divide in 5 segments...
0
Didier Bur (Bytes Farmer)
Ecole Nationale Supérieure d'Architecture de Nancy (F)
http://rld.crai.archi.fr/rubylibrarydepot/
User avatar
Didier Bur 
 

Re: [Plugin] Facewarp

Postby TIG » Sat May 14, 2011 12:57 pm

Builder Boy wrote:
TIG wrote:http://code.google.com/apis/sketchup/docs/ourdoc/edge.html#split ???

This will only split a line into 2 segments with controllable proportions, I am looking for something more like this:
edge.divide(5) # for 5 equal-length segments

It'd be easily enough to make a custom 'divide' method that works as you want - you know the edge's starting length and therefore the length of one divided part. So simply iterate through the edge the number of divisions-1 nibbling off the appropriate proportion as another edge until you are done. I don't recommend extending the Edge class but more like this...
self.divide(edge,5)
calling this
Code: Select all
def divide(edge=nil, num=nil)
  return nil if not edge or edge.class!=Sketchup::Edge
  return nil if not num or not num.class==Fixnum or num<=1
  len=edge.length
  bit=len/num.to_f
  num.times{
    begin
      nedge=edge.split(bit/len)
      if nedge
        edge=nedge
        len=edge.length
      end#if
    rescue
      puts 'Divide Error'
    end
  }
end
Which splits the specified edge into the specified parts...
0
TIG
User avatar
TIG 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Plugins

Who is online

Users browsing this forum: linkph, roltsi89 and 12 guests

Visit our sponsors: