sketchucation logo sketchucation
    • Login
    1. Home
    2. JohnRees
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info
    J
    Offline
    • Profile
    • Following 0
    • Followers 0
    • Topics 1
    • Posts 3
    • Groups 1

    JohnRees

    @JohnRees

    10
    Reputation
    1
    Profile views
    3
    Posts
    0
    Followers
    0
    Following
    Joined
    Last Online

    JohnRees Unfollow Follow
    registered-users

    Latest posts made by JohnRees

    • RE: Followme in ruby not working as expected

      Hi Jim,

      Yes that's exactly what I wanted! Thank you. I've managed to get the code to draw the internal leaf as well. The only small problem now is I'm repeating myself in the code to get this result, which seems wrong.

      Is there anyway to get this result without have almost identical code running twice? Is there anyway to push two faces along the same path at the same time to give the result below?

      https://dl.dropboxusercontent.com/u/3806610/2014-06-23_1143.png

      fyi this is how the code looks now.

      ` mod = Sketchup.active_model # Open model
      ent = mod.entities # All entities in model
      sel = mod.selection # Current selection
      wallGroup = ent.add_group

      #face points
      pt1 = [0,0,0]
      pt2 = [0,10,0]
      pt3 = [0,10,100]
      pt4 = [0,0,100]

      pt5 = [0,20,0]
      pt6 = [0,30,0]
      pt7 = [0,30,100]
      pt8 = [0,20,100]

      #line points
      lpt1 = [0,0,0]
      lpt2 = [150,0,0]
      lpt3 = [100,150,0]
      lpt4 = [0,100,0]

      path = []

      face = ent.add_face pt1, pt2, pt3, pt4

      path.push ent.add_line lpt1, lpt2
      path.push ent.add_line lpt2, lpt3
      path.push ent.add_line lpt3, lpt4

      #line = ent.add_line lpt4, lpt1

      status = face.followme path

      path = []

      face= ent.add_face pt5, pt6, pt7, pt8

      path.push ent.add_line lpt1, lpt2
      path.push ent.add_line lpt2, lpt3
      path.push ent.add_line lpt3, lpt4

      status = face.followme path`

      posted in Developers' Forum
      J
      JohnRees
    • RE: Followme in ruby not working as expected

      Thanks TIG! Will give that a go.

      posted in Developers' Forum
      J
      JohnRees
    • Followme in ruby not working as expected

      My first post! I'm trying to write a sketchup importer that reads coordinates of walls from a text file then draws a line using the coordinates and draws the wall using followme.

      The reason I want to use followme rather than just drawing faces is I want to draw the external brick leave and then the internal block wall and have corners drawn neatly.

      Here is some example code (similar to how the importer will work)

      ` mod = Sketchup.active_model # Open model
      ent = mod.entities # All entities in model
      sel = mod.selection # Current selection
      wallGroup = ent.add_group

      #face points
      pt1 = [0,0,0]
      pt2 = [0,10,0]
      pt3 = [0,10,100]
      pt4 = [0,0,100]

      #line points
      lpt1 = [0,0,0]
      lpt2 = [150,0,0]
      lpt3 = [100,150,0]
      lpt4 = [0,100,0]

      face = ent.add_face pt1, pt2, pt3, pt4
      line = ent.add_line lpt1, lpt2
      line = ent.add_line lpt2, lpt3
      #the line below doesn't work with follow me
      #line = ent.add_line lpt3, lpt4

      #line = ent.add_line lpt4, lpt1

      status = face.followme line`

      follow me seems to be inconsistent in its behavior. If I draw the first two lines and use followme it works exactly how I want and the wall looks like this.

      https://dl.dropboxusercontent.com/u/3806610/2014-06-20_1620.png

      If however I try drawing three lines then followme I get this.

      https://dl.dropboxusercontent.com/u/3806610/2014-06-20_1620_001.png

      Can anyone explain where I'm going wrong? Any help is appreciated!

      posted in Developers' Forum
      J
      JohnRees