About 'intersect_with' method

About 'intersect_with' method

Postby Didier Bur » Fri Nov 28, 2008 9:33 pm

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 ;)
0
Didier Bur
Ecole Nationale Supérieure d'Architecture de Nancy (F)
User avatar
Didier Bur 
 

Re: About 'intersect_with' method

Postby Whaat » Fri Nov 28, 2008 10:14 pm

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


Code: Select all
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:
Code: Select all
cube_entities=group1.entities
sphere_entities=group2.entities


Then, get the transformations of each group:
Code: Select all
cube_trans=group1.transformation
sphere_trans=group2.transformation


Let's ignore recursion.
Code: Select all
recursion=false


To perform the intersection and make the intersection lines appear in the cube group:
Code: Select all
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:
Code: Select all
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:
Code: Select all
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):
Code: Select all
cube_entities.intersect_with(recursion,cube_trans,some_other_entities,some_other_entities_trans,false,[group2])



API Docs wrote: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
0

Whaat 
PluginStore Author
PluginStore Author
 

Re: About 'intersect_with' method

Postby Didier Bur » Fri Nov 28, 2008 11:54 pm

Thanks a lot Dale, very clear. You made my day :fecstatic:
0
Didier Bur
Ecole Nationale Supérieure d'Architecture de Nancy (F)
User avatar
Didier Bur 
 

Re: About 'intersect_with' method

Postby TIG » Sun Nov 30, 2008 9:30 pm

Didier Bur wrote: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...

.
0
Last edited by TIG on Mon Dec 01, 2008 6:49 pm, edited 1 time in total.
TIG
User avatar
TIG 
Global Moderator
 

Re: About 'intersect_with' method

Postby Didier Bur » Sun Nov 30, 2008 9:45 pm

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 !
0
Didier Bur
Ecole Nationale Supérieure d'Architecture de Nancy (F)
User avatar
Didier Bur 
 

Re: About 'intersect_with' method

Postby Edson » Mon Dec 01, 2008 1:44 pm

Didier Bur wrote: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.
0
edson mahfuz, architect | porto alegre • brasil
http://www.mahfuz.arq.br
User avatar
Edson 
Global Moderator
 

Re: About 'intersect_with' method

Postby Didier Bur » Mon Dec 01, 2008 7:54 pm

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
0
Didier Bur
Ecole Nationale Supérieure d'Architecture de Nancy (F)
User avatar
Didier Bur 
 

Re: About 'intersect_with' method

Postby Edson » Mon Dec 01, 2008 8:15 pm

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.
0
edson mahfuz, architect | porto alegre • brasil
http://www.mahfuz.arq.br
User avatar
Edson 
Global Moderator
 

SketchUcation One-Liner Adverts

by Ad Machine » 5 minutes ago



Ad Machine 
Robot
 



 

Return to Developers' Forum

Who is online

Users browsing this forum: No registered users and 10 guests