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!
    🚨 Skimp | 25% Off until March 30 Buy Now

    Create a new line

    Scheduled Pinned Locked Moved Developers' Forum
    3 Posts 3 Posters 233 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

          Hello! It looks like you're interested in this conversation, but you don't have an account yet.

          Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

          With your input, this post could be even better πŸ’—

          Register Login
          • 1 / 1
          • First post
            Last post
          Buy SketchPlus
          Buy SUbD
          Buy WrapR
          Buy eBook
          Buy Modelur
          Buy Vertex Tools
          Buy SketchCuisine
          Buy FormFonts

          Advertisement