• Login
sketchucation logo sketchucation
  • Login
🤑 SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

Creating a 3D wall from 2Dpoints(line),Width and Height

Scheduled Pinned Locked Moved Developers' Forum
2 Posts 2 Posters 282 Views
Loading More Posts
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    bilianb
    last edited by 24 Feb 2011, 20:35

    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 points

    366.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

    1 Reply Last reply Reply Quote 0
    • T Offline
      TIG Moderator
      last edited by 1 Mar 2011, 16:24

      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...

      TIG

      1 Reply Last reply Reply Quote 0
      • 1 / 1
      1 / 1
      • First post
        1/2
        Last post
      Buy SketchPlus
      Buy SUbD
      Buy WrapR
      Buy eBook
      Buy Modelur
      Buy Vertex Tools
      Buy SketchCuisine
      Buy FormFonts

      Advertisement