sketchucation logo sketchucation
    • Login
    πŸ€‘ SketchPlus 1.3 | 44 Tools for $15 until June 20th Buy Now

    Deleting Faces as they are drawn -splats

    Scheduled Pinned Locked Moved Developers' Forum
    6 Posts 5 Posters 145 Views 5 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.
    • Chris FullmerC Offline
      Chris Fullmer
      last edited by

      I've been working on a plugin and it erases faces as they are drawn with a simple entities observer. It just erases every face.

      It worked great at first, but I keep expanding what the observer is doing. And somewhere along the line I've got it so that it splats a lot now. I think its because I'm doing things inside the start/commit stack of the rectangle tool.

      But how would I queue up the face to deleted once the tool is done making the rectangle? Does that make sense?

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

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

        face.erase! if face and face.valid? only tries to erase a face if it [still] exists...

        TIG

        1 Reply Last reply Reply Quote 0
        • Chris FullmerC Offline
          Chris Fullmer
          last edited by

          I'll play with that, but I'm 99% sure the face still exists when I try to erase it. I think it is being erased correctly, and it is only after the rectangle tool tries to complete itself that it splats.

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

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jim
            last edited by

            It's not good to change the entities from within the observer method. You can use EntitiesObserver.onElementAdded to build references to the created faces, and then erase them from ModelObserver.onTransactionCommit.

            Hi

            1 Reply Last reply Reply Quote 0
            • thomthomT Offline
              thomthom
              last edited by

              Yea, trying to do any modification to the model in reaction to an observer event is asking for trouble. ( see my old DoubleCut thread ).
              Even stacking things off to onTransactionCommit isn't reliable, because onTransactionCommit doesn't map to model.commit_operation.

              Thomas Thomassen β€” SketchUp Monkey & Coding addict
              List of my plugins and link to the CookieWare fund

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

                You may need to combine your responces with a ToolsObserver

                I'm not here much anymore.

                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