About 'intersect_with' method
-
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 -
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 -
Thanks a lot Dale, very clear. You made my day
-
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 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.
-
@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 teamRead 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...
.
-
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 -
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.
Advertisement