UG OPENAPI 选择面上的点同时获取面tag

//UG OPENAPI 选择面上的点同时获取面tag

//c#

private void getpoint_face()
{

        UFSession theUFSession = UFSession.GetUFSession();


        int response;
        double[] point = new double[3];//点坐标


        //UFUi.PointBaseMethod Method = UFUi.PointBaseMethod.PointDialog;//点选择器
        UFUi.PointBaseMethod Method = UFUi.PointBaseMethod.PointOnSurfacePt;//默认 选面上的点
        Tag pointtag;
        theUFSession.Ui.PointConstruct("选择点", ref Method, out pointtag, point, out response);
        // UF_SO_ask_parents(const tag_t so, UF_SO_ASK_ALL_PARENTS, int * n_parents, tag_p_t * parents )//C++

        int n_parents;
        Tag []parents;//面tag
        theUFSession.So.AskParents(pointtag, UFConstants.UF_SO_ASK_ALL_PARENTS, out n_parents, out parents);

        for (int i = 0; i < parents.Length; i++)
        {
                int type, ssubtype;
                theUFSession.Obj.AskTypeAndSubtype(parents[i], out type, out ssubtype);

                if (type == 70 && ssubtype == 2)
                {
                        // MessageBox.Show("获取选择的面tag");
                        // theUFSession.Disp.SetHighlight(parents[i], 0);//取消高亮显示
                        theUFSession.Obj.SetColor(parents[i], 100);//修改面的颜色,测试
                }
        }

 

}

 

C++ 代码与此类似。

 

 

posted @ 2021-03-09 14:28  木艮木子  阅读(504)  评论(0)    收藏  举报