• Login
sketchucation logo sketchucation
  • Login
⚠️ Libfredo 15.4b | Minor release with bugfixes and improvements Update

I need a script

Scheduled Pinned Locked Moved Developers' Forum
4 Posts 4 Posters 285 Views 4 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.
  • B Offline
    Builder Boy
    last edited by Builder Boy 29 Dec 2009, 18:47

    I need a ruby script that works just like the "rectangle.rb", but does NOT make a face. I looked at the script, and found the line that tells it to make the face. I tried deleting that line, but then it stopped working completely. I don't know much about ruby, so I was hoping someone could reply with the script I need.


    rectangle.rb

    All my plugins

    1 Reply Last reply Reply Quote 0
    • R Offline
      remus
      last edited by 29 Dec 2009, 19:01

      You could try changing line 110 from Sketchup.active_model.active_entities.add_face @pts to true.

      http://remusrendering.wordpress.com/

      1 Reply Last reply Reply Quote 0
      • C Offline
        Chris Fullmer
        last edited by 29 Dec 2009, 19:14

        Try changing the line 110 from:

        Sketchup.active_model.active_entities.add_face @pts

        to:

        f = Sketchup.active_model.active_entities.add_face @pts Sketchup.active_model.entities.erase_entities f

        That is then pointing the variable f to point to the face that was made. The next line then deletes the face. But that will leave the edges behind. It could be a bit problematic if this rectangle is drawn over existing geometry though. I suppose the better way would be to just draw the lines individually, which is also pretty easy.

        Maybe I'll write that up later. or maybe someone else will.

        Chris

        Ope, remus already posted. Oh well try them both.

        Lately you've been tan, suspicious for the winter.
        All my Plugins I've written

        1 Reply Last reply Reply Quote 0
        • T Offline
          TIG Moderator
          last edited by 29 Dec 2009, 19:17

          Without reworking it to draw just four edges rather than make a face_with_its_four_edges, you can recast it to make the face and then erase it immediately - its four edges should get left behind...

          lines 107 et al...

          
          def create_rectangle
              # check for zero height
              if( @pts[0] != @pts[3] )
                  face=Sketchup.active_model.active_entities.add_face @pts
                  face.erase! if face.valid?
                  ### edges will remain...
              end
              self.reset
          end
          
          

          EDIT: CF beat me to it ! ☀

          TIG

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

          Advertisement