SketchUcation Premium Membership

 

 

lengthening a series of lines in equal increments

Welcome! Ask and get answered - or just introduce yourself.

Re: lengthening a series of lines in equal increments

Postby sdmitch » Thu May 31, 2012 8:43 pm

davecon wrote:Thanks for the help so far everyone :)

I have got the hang of doing this on a straight line, now the complex bit is trying to do it on a spiral. Currently I am trying to turn the model on the left (spiral with even length lines) in the model on the right (spiral with lines increasing by XX per length)
spiral lines.jpg


Ideally what I would like to be able to do is select the first line (red) and then the last line (green) and be able to input something like "starting the with the first line make all the others increase in XXmm increments"

Here is the file itself so far.
spiral lines.skp


Instead of going to the trouble of creating the equal length lines then extending them incrementally, I would make the "baseline", be it a flat spiral or a straight line divided into the desired number of segments, into a curve using weld and then you can create the lines originating from the curve's vertices.

The code to do this is as simple as this
Code: Select all
mod = Sketchup.active_model
ent = mod.entities
sel = mod.selection
if !sel.empty? && sel.first.curve
 vers=sel.first.curve.vertices
# d is initial length, i is the increment, and a is the direction vector
 d=875.0.mm;i=87.5.mm;a=[0,0,-1]
 for v in vers
  p=v.position;pp=p.offset(a,d)
  ent.add_line(p,pp)
  d += i
 end
else
 UI.messagebox "select a curve"
end

It would be a monumental task to try to figure out the order of the equal length lines. When you select a group of anything, there is no guaranty that Sketchup will add them to the selection in the proper order. At least that has been my experience.
Nothing is worthless, it can always be used as a bad example.

http://sdmitch.blogspot.com/
User avatar
sdmitch
 
Posts: 617
Joined: Wed Mar 02, 2011 9:21 pm
Name: Sam
Operating system: Windows
SketchUp version: 8
License type: Free/Make
SketchUp use: hobby
Level of SketchUp: Beginner

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago

Not a Premium Member yet? Check out the great time-limited deal we are offering.

Ad Machine
Robot
 
Posts: 2012

Previous

Return to Newbie Forum

Who is online

Users browsing this forum: No registered users and 5 guests