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

    About 'intersect_with' method

    Scheduled Pinned Locked Moved Developers' Forum
    8 Posts 4 Posters 1.6k 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.
    • Didier BurD Offline
      Didier Bur
      last edited by

      Hi,
      Has anyone ever figured out how this method works? Doc is sparse, no example and I cannot see what are all these entities and transformations parameters for.
      Any help anyone ? Please be more clear than SU team πŸ˜‰

      DB

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

        I have used this method a few times. Look at my Zorro script for an example.

        entities.intersect_with recurse, transformation1, entities1, transformation2, hidden, entites2
        

        Let's say you want to intersect two groups. Assume that group 1 is a cube and group 2 is a sphere.

        First get the necessary entities objects:

        cube_entities=group1.entities
        sphere_entities=group2.entities
        

        Then, get the transformations of each group:

        cube_trans=group1.transformation
        sphere_trans=group2.transformation
        

        Let's ignore recursion.

        recursion=false
        

        To perform the intersection and make the intersection lines appear in the cube group:

        cube_entities.intersect_with(recursion,cube_trans,cube_entities,cube_trans,false,[group2])
        

        The API docs seem to be incorrect. The last argument of this method must be an array of entities, not an entities object. The last argument is the just list of entities that you want intersect with.

        To make the intersection lines appear in the sphere group:

        sphere_entities.intersect_with(recursion,sphere_trans,sphere_entities,sphere_trans,false,[group1])
        

        However, the following might also work but I haven't tried it this way:

        cube_entities.intersect_with(recursion,cube_trans,sphere_entities,sphere_trans,false,[group2])
        

        To make the intersection lines appear in some other entities object, I would try this (haven't tested):

        cube_entities.intersect_with(recursion,cube_trans,some_other_entities,some_other_entities_trans,false,[group2])
        

        @unknownuser said:

        Arguments
        recurse - true if you want this entities object to be recursed (intersection lines will be put inside of groups and components within this entities object)

        transformation1 - the transformation for this entities object

        entities1 - the entities where you want the intersection lines to appear

        transformation2 - the transformation for entities1

        hidden - true if you want hidden geometry in this entities object to be used in the intersection

        entities2 - an entities object, or an array of entity

        Hope this works...
        Dale

        SketchUp Plugins for Professionals

        1 Reply Last reply Reply Quote 0
        • Didier BurD Offline
          Didier Bur
          last edited by

          Thanks a lot Dale, very clear. You made my day

          DB

          1 Reply Last reply Reply Quote 0
          • Didier BurD Offline
            Didier Bur
            last edited by

            Hi TIG,
            Thanks for pointing me to your scripts (I had read them already). I've finally achieved what I was searching for: cropping a terrain mesh with a shape (a face that pushpulls itself, does intersect with terrain, and then erase all that is outside this cropping prism). It's like a 'drape and clean' function. Fun !

            DB

            1 Reply Last reply Reply Quote 0
            • EdsonE Offline
              Edson
              last edited by

              @didier bur said:

              Hi TIG,
              Thanks for pointing me to your scripts (I had read them already). I've finally achieved what I was searching for: cropping a terrain mesh with a shape (a face that pushpulls itself, does intersect with terrain, and then erase all that is outside this cropping prism). It's like a 'drape and clean' function. Fun !

              didier,

              this is the method i use for putting roads and stuff onto a terrain. it works much better than the drape tool. it is just more time consuming.

              edson mahfuz, architect| porto alegre β€’ brasil
              http://www.mahfuz.arq.br

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

                @didier bur said:

                Hi,
                Has anyone ever figured out how this method works? Doc is sparse, no example and I cannot see what are all these entities and transformations parameters for.
                Any help anyone ? Please be more clear than SU team πŸ˜‰

                Read my scripts like Slicer, ContourMaker, Volume(v1) etc that all use method it - there is a ## part that explains what it's doing within the method - actually that's so I don't forget it later !!!!! - it's all a bit "trial and error"... but it is logical when you 'get' how the parts interact...

                .

                TIG

                1 Reply Last reply Reply Quote 0
                • Didier BurD Offline
                  Didier Bur
                  last edited by

                  Hi Edson,
                  You would save a lot of time using the script I'm working on (WIP) but it is part of a private contract submission, so I don't know if I can release it to public. I think no 😞
                  Regards,
                  crop.swf

                  DB

                  1 Reply Last reply Reply Quote 0
                  • EdsonE Offline
                    Edson
                    last edited by

                    didier,

                    my mouth was watery after i saw the animation! i wish you find a way of making it public. it would be a success, for sure.

                    congratulations.

                    edson mahfuz, architect| porto alegre β€’ brasil
                    http://www.mahfuz.arq.br

                    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