Self intersect
-
I'm trying to intersect a group with itself like this:
group.entities.intersect_with false, group.transformation, group.entities, group.transformation, true, group.entities
but with a type mismatch error.
What is wrong,how to intersect a group with itself? -
From the user comments at the bottom of the Entities class:
@unknownuser said:
intersect_with is a little confusing. The parameter entities1 needs to be an Entities object. The parameter entities2 needs to be a single Entity, or an array of Entity - but NOT and Entities object. Better parm names would be "output_entities" and "entity_list"
-
Now it is ok,thanks.Here is the code:
transformation = Geom;;Transformation.new faces=[] group.entities.each do |entity| if entity.is_a?( Sketchup;;Face) faces.push entity end end group.entities.intersect_with false, transformation, group.entities,transformation, true, faces
p.s.where do you read the user comments of the API?
-
group.entities.intersect_with false, group.transformation, group.entities, group.transformation, true, group.entities.to_a
Should also work without having to filter out entities. -
Yes,but transformations should be "new",otherwise the intersection lines are displaced.
p.s.where do you read the user comments of the API? -
@voljanko said:
p.s.where do you read the user comments of the API?
At the bottom of the pages in the API docs.
Mind you, I found that if my browser is set to prefer a non-English language the reader is redirected to a page without the comments.The URL that has the comments look like this: http://code.google.com/apis/sketchup/docs/ourdoc/entities.html
If you are redirected then it's the Google pages trying to be "smart" and redirect you to a localized page - which is nothing but the very same page as the English, just without the comments.Annoyingly one has to change one's browser settings to prefer English first.
-
The API comments are at the end of each section and might be over more than one 'page' if there are several of them.
Using 'new' transformations, without arguments, sets it to the ORIGIN [0,0,0] - which may work OK.
But using the 'group.transformation' for both required transformations to ensure that the group's geometry intersects with itself, and it returns the intersection geometry in the same location should work ? Perhaps not if the group has been moved ?? -
Grrr,I hate the "smart" pages.
There are no comments on my API pages.I will try to change setting in my browser.@unknownuser said:
But using the 'group.transformation' for both required transformations to ensure that the group's geometry intersects with itself, and it returns the intersection geometry in the same location should work ? Perhaps not if the group has been moved ??
I have tested it... and it is only ok, if both the transformations are "new".
Advertisement