sketchucation logo sketchucation
    • Login
    1. Home
    2. ahjkuipers
    3. Topics
    Oops, your profile's looking a bit empty! To help us tailor your experience, please fill in key details like your SketchUp version, skill level, operating system, and more. Update and save your info on your profile page today!
    🛣️ Road Profile Builder | Generate roads, curbs and pavements easily Download
    A
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 2
    • Posts 9
    • Groups 1

    Topics

    • A

      Pickray

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      2
      0 Votes
      2 Posts
      786 Views
      thomthomT
      Maybe due to precision issue? Not sure, but you don't have to convert between screenpoints like that: mod = Sketchup.active_model view = mod.active_view ents = mod.entities ents.clear! edges = ents.add_edges([0, 0, 0] , [100, 100, 100]) edge = edges[0] pt1 = edge.start.position pt2 = view.camera.eye Geom.intersect_line_line(edge.line, [pt1, pt2])
    • A

      Loops

      Watching Ignoring Scheduled Pinned Locked Moved Developers' Forum
      15
      0 Votes
      15 Posts
      994 Views
      A
      Problem solved!!! It's all about vectors. One of the arguments of the method that is resposable for creating the protrusions must be a vector or the order of the four given points of the rectangle must choosen in a way that the vector can be derived as the difference between the first two points of de rectangle. ` def findface(pt) arr = Sketchup.active_model.entities.grep(Sketchup::Face) arr.each {|f| return f if f.classify_point(pt) == Sketchup::Face::PointInside} return nil end def body ents = Sketchup.active_model.entities ents.clear! f = ents.add_face([0, 0, 0], [60, 0, 0], [60, 40, 0], [0, 40, 0]) f.pushpull(-30) end def protr(array, extrusion) ents = Sketchup.active_model.entities base = ents.add_face(array) arcvector = array[1].vector_to(array[0]) basenormal = base.normal depthvector = basenormal.cross(arcvector).reverse width = array[1].distance(array[0]) depth = array[2].distance(array[1]) basenormal.length = extrusion - width/2 basecenter = Geom::Point3d.new basecenter.x = (array[0].x + array[1].x)/2 basecenter.y = (array[0].y + array[1].y)/2 basecenter.z = (array[0].z + array[1].z)/2 center = basecenter + basenormal base.pushpull(extrusion + 1) ents.add_arc(center, arcvector, depthvector, width/2, 0, Math::PI) basenormal.length = extrusion + 0.5 findface(basecenter + basenormal).pushpull(-depth) ents.add_circle(center, depthvector, 1) findface(center).pushpull(-depth) end def test body protr [[22.0, 8.0, 30.0], [22.0, 20.0, 30.0], [10.0, 20.0, 30.0], [10.0, 8.0, 30.0]], 14.0 protr [[35.0, 8.0, 30.0], [47.0, 8.0, 30.0], [47.0, 20.0, 30.0], [35.0, 20.0, 30.0]], 14.0 end`
    • 1 / 1