sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Delete object with script?

    Scheduled Pinned Locked Moved SketchyPhysics
    12 Posts 5 Posters 1.8k 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.
    • H Offline
      hpnisse
      last edited by

      Hello!
      As the title say, I wonder if there is some way to delete objects with a script or something?

      example: If "Box A" touched "Box B" the "Box A" will be deleted!

      An ontouch script that delete everything that it touch, not just specific objects.

      Hope someone can ask and understanding my english.

      Thanks!
      /hpnisse

      ` /hpnisse`
      ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

      1 Reply Last reply Reply Quote 0
      • H Offline
        hobbnob
        last edited by

        It is, but not reccomended as noone has yet made a script to get the deleted objects back after the simulation.

        My WIP Thread:Here

        1 Reply Last reply Reply Quote 0
        • H Offline
          hpnisse
          last edited by

          ok, thats okej, cause the objects that touch "Box B" should not appear again after the simulation, the model I working on is a scripted bowling alley.

          The pins are emitted down on to the lane, and when a ball pull the pins down and back off the lane it will be deleted. Thats is how I want it to be:P

          so is there a script that delete everything that it touch, so would I be pleased to now that. It would be awesome. (I think)

          Thanks,
          Sorry for bad english, its early in the morning here in Sweden right now.
          /hpnisse

          ` /hpnisse`
          ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

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

            Why not 'hide' them or move them onto an invisible layer ?
            Then you can always 'unhide' or move them back onto a visible layer ??

            TIG

            1 Reply Last reply Reply Quote 0
            • H Offline
              hpnisse
              last edited by

              This should be done in the physics simulation, so if there is to much "pins" in the model at the same time the physics will run slowley.
              And when I hide the pins after they thrown down there will take up a lot of space.
              But I can test with hide the pins and ball when they fall down back of the lane, and see if the physics simulation will run slowley.
              The best thing would be to delete them cause there will be new pins emitted down on to the lane when a new "Round" will start.
              But if there is a script that delete everything that it touch, would I be pleased to know that.

              thanks TIG for the hide tip, I would try that.

              /hpnisse

              ` /hpnisse`
              ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

              1 Reply Last reply Reply Quote 0
              • H Offline
                hpnisse
                last edited by

                The hide idea would not work that well, so a script to delete objects when ontouch will probably work better:P (I hope)
                But thanks for the idea.

                /hpnisse

                ` /hpnisse`
                ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

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

                  @hpnisse said:

                  The hide idea would not work that well, so a script to delete objects when ontouch will probably work better:P (I hope)
                  But thanks for the idea.

                  /hpnisse

                  If the objects are groups moving them to an invisible layer would both hide them and remove them from interactions ?

                  TIG

                  1 Reply Last reply Reply Quote 0
                  • W Offline
                    Wacov
                    last edited by

                    Hiding an object in SP doesn't affect the simulation, as far as the Physics engine is concerned the object is still present and movable, you just can't see it. Deleting a group is simple, you just get the group handler and use '.erase!', but I don't know how this would affect the sim 😐

                    http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                    1 Reply Last reply Reply Quote 0
                    • H Offline
                      hpnisse
                      last edited by

                      What is the "Group handler"? Im searching for help in
                      http://code.google.com/intl/sv-SE/apis/sketchup/docs/ourdoc/group.html
                      but I can't find anything that I understand.

                      So a little more precise instruction would be great!
                      The idea is to delete groups/components when they touched another group.

                      /hpnisse

                      ` /hpnisse`
                      ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

                      1 Reply Last reply Reply Quote 0
                      • W Offline
                        Wacov
                        last edited by

                        The group's script 'object'. E.g. you've probably come across $curEvalGroup before, that is actual a variable, set to the current group's script object. It's just 'Group' on the API.

                        http://sketchup.google.com/3dwarehouse/cldetails?mid=3096a836877fb9af6cd8ad826e9017b8&prevstart=0

                        1 Reply Last reply Reply Quote 0
                        • H Offline
                          hpnisse
                          last edited by

                          Hello again!

                          I have seen the "$curEvalGroup" before, but I did't understand everything. I have test everything I come up with.

                          Can Wacov (or someone else) explain the "group handler", it sounds so simple when you say it.

                          @unknownuser said:

                          you just get the group handler and use '.erase!'
                          /Wacov

                          And when I test a few examples and combinations with ".erase!" the simulation will freeze, the only that works is to stop the simulation.

                          So a little more careful explanation would be helpful.

                          /hpnisse

                          ` /hpnisse`
                          ` Windows 7 U -Sketchup 8 -SketchyPhysics 3.2-Dec2 - from Sweden`

                          1 Reply Last reply Reply Quote 0
                          • M Offline
                            MrDailyBlah
                            last edited by

                            u should only ever delete objects created in simulation, eg emitted objects

                            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