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

    Script won't find face

    Scheduled Pinned Locked Moved Developers' Forum
    4 Posts 3 Posters 290 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.
    • D Offline
      davesexcel
      last edited by

      I have this one scripts,

       UI.menu("PlugIns").add_item("Draw Riser") { draw_riser }
       
       
       def draw_riser
      
      prompts = ["length", "Run","height","Rise","Total Rises","Riser Thickness"]
          defaults = [36.0,10.0,1.0,7.75,7,0.5]
          input = UI.inputbox prompts, defaults, "Risers."
              a,b,c,d,e,f=input
              ent = Sketchup.active_model.entities
      		#---------Clear All
      #Sketchup.active_model.entities.clear!
       #----------------Make 1st Riser
      ent.add_line [0,0,d-c+0.1875], [0,0,0]
        ent.add_line [0,-0.5,d-c+0.1875], [0,-0.5,0]
      ent.add_line [0,0,0], [0,-0.5,0]
        ent.add_line [0,0,d-c+0.1875], [0,-0.5,d-c+0.1875]
       #edg.find_faces; face=edg.faces[0]
                #face.pushpull a
      ##group5 = ent.add_group face.all_connected
      #----------------Make rest of Risers
      
      ent.add_line [0,b,2*d-c+0.1875], [0,b,d-c]
        ent.add_line [0,-0.5+b,2*d-c+0.1875], [0,-0.5+b,d-c]
      ent.add_line [0,b,d-c], [0,-0.5+b,d-c]
        ent.add_line [0,b,2*d-c+0.1875], [0,-0.5+b,2*d-c+0.1875]
      
      # edg.find_faces; face=edg.faces[0]
                #face.pushpull a
      
      #group3 = ent.add_group face.all_connected
      
      #for i in 1..e-2
       # group5 = group4.copy
       # tran = Geom;;Transformation.translation [0, b*i, d*i]
      #group5.transform! tran
        #end
       
      
             
      	end
      		
      

      Im having issues getting the code to make the faces and then pushpull.

      My idea is to make the 1st riser a group on it's own, then make the second riser a group and copy it up.

      Thanks


      Looks like this


      The code for the treads are here.

      1 Reply Last reply Reply Quote 0
      • Dan RathbunD Offline
        Dan Rathbun
        last edited by

        Do not add the edges to the model entities, they will intersect with the model.

        1. Create an empty group, and immediately add a cpoint into it (to keep SU garbage collection from deleting it.)

        2. then add the edges to the group's entities collection

        3. then do find_faces on the edges inside the group and the face should added to the group's entities.

        4. then do the push pull

        5. delete the temp cpoint

        6. then copy the group

        I'm not here much anymore.

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

          To expand that point...
          ent = Sketchup.active_model.entities **group = ent.add_group() ent = group.entities**

          Add the two 'BOLD' lines after the ent =
          Then everything is inside ' group', which you can 'name' etc as you wish...

          TIG

          1 Reply Last reply Reply Quote 0
          • D Offline
            davesexcel
            last edited by

            Thank you,
            That worked.

            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