sketchucation logo sketchucation
    • Login
    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

    Create a new line

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 185 Views 3 Watching
    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.
    • T Offline
      Thomas214
      last edited by

      Does the code create a new line next to a existing line?

      model = Sketchup.active_model
      entities = model.active_entities
      pts = []
      pts[0] = [0, 0, 0]
      pts[1] = [x, 0, 0]
      pts[2] = [x, y, 0]
      pts[3] = [0, y, 0]

      Add the face to the entities in the model

      face = entities.add_face pts

      I just happen to know that the second and third entities in the

      entities objects are edges.

      entity1 = entities[1]
      entity2 = entities[2]
      edges = entity1.all_connected
      if (edges)
      UI.messagebox edges.to_s
      else
      UI.messagebox "Failure"
      end

      1 Reply Last reply Reply Quote 0
      • sdmitchS Offline
        sdmitch
        last edited by

        No, it creates a rectangel on the xy plane.

        Nothing is worthless, it can always be used as a bad example.

        http://sdmitch.blogspot.com/

        1 Reply Last reply Reply Quote 0
        • TIGT Offline
          TIG Moderator
          last edited by

          You're making it too complex...
          pt0=[0,0,0]
          pt1=[1,0,0]
          Sketchup.active_model.active_entities.add_line(pt0,pt1)
          Adds a new line from the origin 1" long, to the right [i.e. X/red axis]
          The entities.add_... methods are listed in the API guides and cover many aspects of adding lines, arcs, circles, polygons, clines, cpoints, faces, text etc... please read them and have a mess around...

          TIG

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

          Advertisement