Sideview modeling
-
Hi all
Like a first, thanks for this forum. I`m a newbie there and I have no experiences of ruby coding (I was coding in TurboBasic and Pascal long ago )
So...my question is...is there a plugin that can make a 3D model from sideviews?
For example I have front view, left view (and top view if need) and from this 2D elements ruby create 3D model...
I think, something like this have Rhino.
In my opinion it can by so simply code, so Im thinking I create this, but... I don't know anything about coding in ruby, and I don't know if I find so much time to learn something new -
Hi gashtan,
It is possible to do this using Ruby. You can use the normals of the faces to get the vectors, and then look for intersections of each vertex. At the least, it should be easy enough to create a construction point grid of the object.
This sounds like fun to me, so I might try it this weekend if I get a chance.
-
Hi Jim and Gashtan
Jim, would it be possible when writing this "plugin" to add a lot of comments
in order to understand how the script is done ?( in fact: a kind of tutorial )Thanks for all your so useful plugins
MALAISE
-
@jim said:
Hi gashtan,
It is possible to do this using Ruby. You can use the normals of the faces to get the vectors, and then look for intersections of each vertex. At the least, it should be easy enough to create a construction point grid of the object.
This sounds like fun to me, so I might try it this weekend if I get a chance.
It would be greatfull if you find some free time and write this script...and then I try to understand the script
thanks for your answer. -
Malaise, gashtan,
I have some ideas on how to do it, but I'd like to hear your ideas for a strategy on how to accomplish the task.
-
Jim
my idea is very close to your:
"You can use the normals of the faces to get the vectors, and then look for intersections of each vertex. At the least, it should be easy enough to create a construction point grid of the object."
But your last sentence inspire me. It is possible to make only construction point and then joint to the shape (vertex) and finaly to the group?
Because I think it can be a problem make it in ruby like in modelling, especially in a more complex shapes. -
Hi Jim and Gashtan
@ Jim, your tutorial on SU ruby helps me really.
About projections, I would select the biggest external face, define the normal
vector and create a box using the 2 vectors of this face and the normal
one . About dimension, I would take the biggest one on each vector-direction.Then I would project the object on faces this "outer box" and rotate axes
according space references ( Red, Green, Blue )....( sorry for that kind of frenglish )
MALAISE
-
Your request is a good one.
It is actually the way I build up my architectural models from plan.
I import the elevations, facades and sections in SU as .dxf, place them into position so you get a 3D model wireframe and start 'filling in' and building up the model. -
Here's the result of my first attempt. Circles and curves are not supported and I doubt a hole will show up either. But the result is not bad for a rough-in.
-
fuu...so I thing the code can be so simply, but now I recognise my BIG mistake
I don't understand the half of the code, so thank you one more time to start writing the script for that... -
wow, this is interesting, keep up the work guys!
pav
-
It's not hard, but I don't know how to explain it all. If you have a specific question, I will try to answer.
Here's a overview of my thought process.
Draw lines at all of the Vertices. The direction of the lines is the normal of Face that contains the Vertex. When a line intersects with at least 2 others, then you have a Point that defines a vertex of the 3D shape.
In order to find all the intersections, I have to test each line for an intersection with every other line. To do that, I need as list of all lines.
SketchUp's Geom module has a method that will tell you if 2 lines intersect, so I decided to use it instead of write my own. The method is:
Geom;;intersect_line_line(line1, line2)
But what is a line? There is no official Line class in SketchUp - a line is agreed to be a 2-element Array of either a Point and a Vector, or 2 Points. (See Geom module documentation.)
line = [Geom;;Point3d.new(0,0,0), Geom;;Vector3d.new(0,0,1)] line = [Geom;;Point3d.new(0,0,0), Geom;;Point3d.new(0,0,100)]
The first 2/3 of the script is all about building a list of lines in the form shown above (an Array of Arrays.)
Once the lines list is built, then we can iterate through each line and compare it to every other line for an intersection point.
l = lines.length for i in 0..l-2 for j in (i+1)..l-1 pt = Geom;;intersect_line_line(lines[i], lines[j]) next if pt.nil? draw_cline(lines[i][0], pt) draw_cline(lines[j][0], pt) pt = pt.to_a.map{|e| round_to(e)} line_hash[pt] += 1 end end
I use a Ruby Hash object to keep a count of the intersection points. I am not sure this is a robust way to track the intersections, but it seems to work. (The hash key is an Array of Floats. )
And once you have a list of intersection points, then you can do whatever you like with them; such as draw Contructionpoints at their positions.
-
Hi Jim
Very interesting topic. Your explanations give us the key for
understanding Drawing process. We have now a little idea of 3D coding
using Ruby in SU.
You're welcomeMALAISE
Advertisement