Community
PowerShape and PowerMill API Forum
Welcome to Autodesk’s PowerShape and PowerMill API Forums. Share your knowledge, ask questions, and explore popular API topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

selected meshes to a list

2 REPLIES 2
SOLVED
Reply
Message 1 of 3
luc_ponsaerts
444 Views, 2 Replies

selected meshes to a list

Hallo,

 

I have :

List<PSMesh> meshes = new List<PSMesh>();

psModel.Meshes.AddToSelection(false) ;

 

so, the meshes in psModel are selected, what is the code to insert the selected meshes in the list "meshes" ?

 

Thanks.

2 REPLIES 2
Message 2 of 3

a small clarification :

Starting with : 

PSMesh psMesh = psModel.Meshes.Last();
meshes = psMesh.Split();

 

meshes contains a list of a number of mesh items (in my case 6 entities)

Then 3 mesh entities are deleted

 

Next I want to update that list of meshes.

I thought of :

meshes.Clear();
psModel.ClearSelectedItems();
foreach (PSMesh m in psModel.Meshes)
{
meshes.Add(m);
}

 

but psModel.meshes still counts 6 entities in stead of the 3 left.

 

What do I forget here ?

 

Thanks.

Message 3 of 3

After studying answers  in this forum I found the perfect solution (forgot about it), thanks Luke.

 

meshes.Clear();
psModel.ClearSelectedItems();
psModel.Meshes.AddToSelection(false);
meshes = psModel.SelectedItems.Cast<PSMesh>().ToList();

 

This works perfectly.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums