TheSwamp

Code Red => .NET => Topic started by: Danipon on November 20, 2018, 10:52:35 AM

Title: Programmatically select Solid3d faces
Post by: Danipon on November 20, 2018, 10:52:35 AM
I can't find a way to programmatically select solid3d subentities (faces or edges). Editor method SetImpliedSelection requires an array of ObjectId (unsuitable for subentities).

Code: [Select]
public void SetImpliedSelection(ObjectId[] selectedObjects);
Arx provides the acedSSSubentAdd function. I could probably PInvoke that function but, since I have several CAD versions to target, a natively managed method would be the best option.

None of the Editor Select* methods seems to accept a SubentityId or FullSubentityPath.

A possible (awful) workaround is to subscribe the Editor SelectionAdded event. The SelectionAddedEventArgs provides a promising AddSubEntity(SelectedSubObject) method, but no way to make it working. Here is the code I used.

Code: [Select]
var subEntPath = new FullSubentityPath(new[] { entId }, subentId);
var sso = new SelectedSubObject(subEntPath, SelectionMethod.NonGraphical, IntPtr.Zero);

Any suggestions would be appreciated.

Daniele
Title: Re: Programmatically select Solid3d faces
Post by: Bryco on November 20, 2018, 11:44:24 AM
http://adndevblog.typepad.com/autocad/2012/07/retrieving-a-solidThree-D has some good stuff.
I pick the solid then find the edge or face. It is very difficult to know what face was picked though
Title: Re: Programmatically select Solid3d faces
Post by: Danipon on November 21, 2018, 03:02:04 AM
I noticed I didn't explain properly. The problem is not selecting a face.
I already have the face/faces. What I need is setting the implied (active/pickfirst) selection providing my faces. This is possible to achieve using the mouse pointer so I guess there is a way to do that via code. The attached picture makes the concept clear.
Title: Re: Programmatically select Solid3d faces
Post by: Bryco on November 22, 2018, 03:25:33 PM
I posted the wrong address- this is the one
https://www.keanw.com/2010/06/temporarily-shading-a-face-of-an-autocad-solid-using-net.html
Title: Re: Programmatically select Solid3d faces
Post by: Danipon on November 23, 2018, 11:43:14 AM
For what I can see there is no definition of the implicit selection (PICKFIRST) of subentities (3D faces) on that post.