Forums:
I am making a journal that orients a modeling view in an assembly when a user clicks on a planar surface - just one click operation -, but I'm stuck.
I used the following code to get a surface, which was on this site in VB and I converted to c#.
Although I can get a surface, it is NOT an occurrence but a prototype since its IsOccurrence property is "false" and, when I get the normal of the surface, it's not in the assembly context.
How can I get a surface occurrence without any additional user's operations ?
Any advice will be appreciated.
publicstatic Selection.Response SelectPlanarFace(string prompt, out Face myPlanarFace,out Point3d cursor){ UI theUI = UI.GetUI();string title ="Select a planar face"; Selection.SelectionScope scope = Selection.SelectionScope.WorkPartAndOccurrence; Selection.SelectionAction selAction = Selection.SelectionAction.ClearAndEnableSpecific;bool includeFeatures =false;bool keepHighlighted =false; Selection.MaskTriple[] selectionMask_array=new Selection.MaskTriple[1]; selectionMask_array[0].Type= UFConstants.UF_solid_type; selectionMask_array[0].SolidBodySubtype= UFConstants.UF_UI_SEL_FEATURE_PLANAR_FACE; TaggedObject selObj; Selection.Response resp = theUI.SelectionManager.SelectTaggedObject(prompt, title, scope, selAction,includeFeatures, keepHighlighted, selectionMask_array, out selObj, out cursor);if(resp == Selection.Response.ObjectSelected|| resp == Selection.Response.ObjectSelectedByName){ myPlanarFace =(Face)selObj;return Selection.Response.Ok;}else{ myPlanarFace=null;return Selection.Response.Cancel;}}