How to automate orient and scale a component

Hi,

I have a question about modeling a dendriform columns. I modeled an element and I want to orient this element to different line of columns. Is there any way to orient and scale a component to any lines?

Best.
Ewss

you would need to use a ruby script,
http://sdmitch.blogspot.com.au/
has an orient and scale “Scale/Align Component - Places Component by direction and x_scale”

I figure something along the lines of this maybe what you are after…Revit-like Adaptive Component • sketchUcation • 1

1 Like

Use this snippit in the Ruby Console to “automate” the process

mod = Sketchup.active_model
ent = mod.active_entities
sel = mod.selection
sel.empty? ? ents=ent.to_a : ents=sel.to_a
#assumes that edge vector matches components z axis
cdn = mod.definitions.reject{|cd|(cd.group?||cd.image?)}.map{|cd|cd.name}
inp = UI.inputbox(["Component:"],[cdn[0]],"Edge to Component")
if inp
 cd=mod.definitions[inp[0]];cl=cd.bounds.max.z
 ents.grep(Sketchup::Edge).each{|e|
  tr1=Geom::Transformation.scaling(1,1,e.length/cl)
  p,v=e.line;tr2=Geom::Transformation.new(p,v)
  ent.add_instance(cd,tr2*tr1)
 }
end
1 Like

Wow That’s awesome, so much thanks.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.