Add_faces_from_mesh returns what ?
-
Hi guys,
As the API doc says, 'add_faces_from_mesh' is supposed to return an array of newly created faces, if successful.
I always got 0 or nil as return values (like 'fill_from_mesh').
If I want to retrieve the newly created faces, do I have to store the number of entities before an 'add_faces_from_mesh', then count the new entities.length after the 'add_faces_from_mesh' call, then iterate through these new entities to retrieve the faces ???
Any help appreciated
-
Yea, the docs are wrong.
To get the new entities:
entities = Sketchup.active_model.active_entities cache = entities.to_a entities.add_faces_from_mesh( mesh ) new_entities = entities.to_a - cache -
Thanks ThomThom,
Here is what I planned to do:nEntsBefore=Sketchup.active_model.entities.length Sketchup.active_model.entities.add_faces_from_mesh(m) nEntsAfter=Sketchup.active_model.entities.length arrayOfNewFaces=[] nEntsBefore.upto(nEntsAfter-1) { |i| next if ent=Sketchup.active_model.entities[i]; arrayOfNewFaces.push(ent) }Your code is mush more simple than mine

Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better π
Register LoginAdvertisement