Creating a 3D wall from 2Dpoints(line),Width and Height
-
Hi Everyone
Greetings from Bilgaria
Can you help me to make a ruby script, that will create a 3d wall from lines with specific Width and Height.
these are the points366.26651026393 333.719887067018 0 366.26651026393 285.616120618378 0 462.266627565982 189.639454957164 0 692.1357771261 189.639454957164 0 788.313607038123 285.793731097276 0 788.870674486803 627.869695716532 0 716.678005865103 627.869695716532 0
and here is the script that i use to draw lines
0.upto(pts.length-2) {|i| line=entities.add_line pts[i],pts[i+1]} end
lets say the Width of the wall is 8.inches
and height is a 120.feets -
I assume that you have successfully applied xyz values to these points needed to make these lines; and put then into an array called 'pts'. You could use...
lines=entities.add_edges(pts)
where 'lines' is an array of the lines made.
now to make the wall - I think the easiest in this case is to make a rectangular vertical face, the width [8"/20cm] and height [12'/3.6m] and then use 'followme' on that face with the lines as the path.
So make the face at the origin....
face_pts=[[0,0,0],[8,0,0],[8,0,144],[0,0,144]] face=entities.add_face(face_pts)
Transform the face's vertices so it is perpendicular to the vector of the first line in 'lines'
vector=pts[0].vector_to(pts[1]) angle=face.normal.angle_between(vector) transformation=Geom::Transformation.rotation(ORIGIN, Z_AXIS, angle) entities.transform_entities(transformation, face.vertices) face.reverse!
Move the face to the start of the first line in 'lines'
transformation=Geom::Transformation.translation(ORIGIN.vector_to(pts[0])) entities.transform_entities(transformation, face.vertices)
Now do the followme
face.followme(lines)
Done...
Advertisement