Created
October 5, 2018 19:55
-
-
Save alexschreyer/645291e47b14f9b667d0fc1effcc65b1 to your computer and use it in GitHub Desktop.
Apply transformations to a brick wall (headers only) in SketchUp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Apply transformations to a brick wall (headers only) | |
mod = Sketchup.active_model # Open model | |
ent = mod.entities # All entities in model | |
sel = mod.selection # Current selection | |
# Max pullout of headers in inches | |
max_ext = 2 | |
ent.each { |e| | |
if (e.is_a? Sketchup::ComponentInstance) and (e.definition.name == "Brick2") | |
# Uniform | |
t1 = Geom::Transformation.translation [0 , -max_ext , 0] | |
# Random | |
t2 = Geom::Transformation.translation [0 , -rand * max_ext , 0] | |
# Wave | |
pos = e.bounds.center | |
ext = 2 + ( Math::sin( pos.x * 10 ) + Math::sin( pos.z * 20 ) ) * max_ext | |
ext > 0 ? ext : ext = 0 | |
t3 = Geom::Transformation.translation [0 , -ext , 0] | |
# Now pull out the header | |
e.transform! t3 | |
end | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment