thank you very much.
Latest posts made by odowhacker
-
Ruby code editor
hallo all,
i am trying to get used to ruby again - working with the ruby code editor 4.3 and sketchup pro 2016.
working with one of the script examples 'using formulas for patterned panels' i'm running into a problem when i try to modify this script slightly.
the example is about drawing circles in a plane. i'm trying to add faces to these circles and extrude them to cylinders. i'm getting errors that seem impossible to me - so i need your help.after much browsing QA articles with helpful responses for instance by TIG i noticed that possibly the error might have to do with the editor.
script:
###############################################
Script sample from Alexander C. Schreyer's book
"Architectural Design with SketchUp"
###############################################
Creates a square panel with a sinusoidal hole pattern
mod = Sketchup.active_model # Open model
ent = mod.entities # All entities in model
sel = mod.selection # Current selectionwidth = 36 # Width of panel
n = 10 # Number of circles in each direction
s = width / (n+1).to_f # Spacing of circles
w = 50Add the square base for the panel
face = ent.add_face [0,0,0] , [width,0,0] , [width,width,0] , [0,width,0]
Iterate in the panel plane
(0..n-1).each { |i|
(0..n-1).each { |j|
# Create a group for each circle
group = ent.add_group()
ents = group.entities
# Add the circle
centerpoint = [s+is,s+js,0]
vector = [0,0,1]
radius = Math::sin( i / (n-1).to_f * Math::PI ) * s / 5.0 + Math::sin( j / (n-1).to_f * Math::PI ) * s / 5.0
edges = ents.add_circle centerpoint , vector , radius , 24#various trial and error to get a face inside
#edges[0].find_faces
#cface = edges[0].faces[0]
cface = group.entities.add_face edgescface.back_material = [ (255 / (n-1)*i).round , (255 / (n-1)*j).round ,(255 / (n-1)*j).round ] #face.pushpull -w group.explode
}
}
the add_face command is followed by error: not enough edges
if i omit the command i'll get error: undefined method 'back_materia=' for nil so a face isn't created no matter which approach i use.the ruby console tellsme:
"undefined method
back_material=' for nil:NilClass (Line 37)" Error: #<TypeError: no implicit conversion of NoMethodError into String> C:/Users/errfitt/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/as_rubyeditor/as_rubyeditor.rb:346:in
+'
C:/Users/errfitt/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/as_rubyeditor/as_rubyeditor.rb:346:inrescue in block in initialize' C:/Users/errfitt/AppData/Roaming/SketchUp/SketchUp 2016/SketchUp/Plugins/as_rubyeditor/as_rubyeditor.rb:368:in
block in initialize'
SketchUp:1:in `call'can someone tell me what's wrong and what i can do to solve this?
thanks a bunch
-
Drape equal length grid
is there something for SU comparable to "drape equal-length grid over shape"?
http://www.bath.ac.uk/ace/structural-optimisation -
RE: Snap-rotate around edge
after some more trying with groups vs. "exploded" geometry i noticed that it is almost impossible to align several grouped faces (triangles) in one corner vertex with common edges congruent.
if i draw the geometry connected all (6) edges will share the same vertex.
if i group faces their corner vertices will snap out of the common vertex.
this is weird. is it because SU doesn't like doubled geometry?fyi the free 1.3 version of DD allows 25 settings and works with SU7.
found one in a czech SU forum: http://sketchup.wu.cz/forum/viewtopic.php?f=17&t=108 -
RE: Snap-rotate around edge
woa - phantastic. thank you so much for taking the time to look into this.
DD seems to achieve what i want - i guess snap rotation isn't really an option here.
i hadn't known of this plugin - will try out right away. thanks again. p.
have tried now - this is absolutely brilliant. in fact i never used parametric editing before.
this allows for what i had in mind - a fully automated origami-base. foldable along certain fixed things.
excellent. thinking of what else can be done with it - suppose i'll have to buy it. -
RE: Snap-rotate around edge
nope, it don't work.
setting a construction point via a calculated angle is never precise enough.
with units set to millimeter and precision to .000 there will be measurable offsets of less than .01 mm with a 100m length. that's admittedly close but not what i want. an idea anyone?
-
RE: Snap-rotate around edge
thank you, TIG. i'm afraid though it is not quite this easy.
i do know how to use rotate along some edge or guide.
i.e. i can rotate red and green so that the red edge is coplanar to the blue edge - that doesn't mean that the edges meet there. by rotating this 2axial way i can approximate closer and closer but never snap to it. think of each triangle as a group that mustn't change in size or angle.assuming the blue edge is fixed in its position - it will take two rotations (green and red triangle)
to arrive at the only angle configuration that has red and blue edges meet perfectly.
this can't be done with rotating around the given edges - see circles.
it takes a constructive approach that i haven't yet discovered.
i am using guides - lots of em. well, all i could think of - half angle, right angles on vertices, parallel shifts and whatnot. alas..
in order for a line rotate 'tool' to do this job it would need to drag faces along with the moving edge - restrained by common edges and fixed vertices. not easy i imagine.
the known sides of the resulting tetrahedron would have to be taken into account for construction - i haven't the faintest how to do that. -
RE: Snap-rotate around edge
this is about what i want to achieve - actually i would like to be able to drop such a folded structure onto some other structure and see it fold accordingly - but that's probably asking a little too much.
i need advise on how to rotate the green and red bit so that the red edge/vertices meet with the blue edge/vertices. please.
-
RE: [Plugin] Zero Tilt Camera
maybe i shouldn't have posted this to plugins - it's rather simple and was meant ironic too.
a beginners try at coding ruby/SUapi...
the script is handy for me with walktrough animations where i would look around during setup (leave eye height and planar view) and also use different 'camera lens' settings.
the effect desired was that of a steady cam (with a weigth underneath and the camera set to 90Β° from that weight).
the two point perspective is kind of static and for me 'position camera' will often fail without a proper reference line or the axes.
i mainly use the shortcut for setting up scene views - sort of constructing a camera path. transitions look nicer this way (same eye heigth, 0tilt and you can do a rotational move along the way.)..the diversion in the chair overlay would occur if you choose 0tilt coming from a 2point perspective view. this won't work - i hadn't thought of the possiblity - i never use 2point.
try with a house. inside. use the walk or move tool (hand) to navigate around once you've chosen 0tilt. you'll see.attached a dennismethod output of some planar view of a few huts..
.