Exemple #1
0
    /// <summary>
    /// 创建基本视图
    /// </summary>
    /// <returns></returns>
    public static BaseView CreateBaseView(DrawingSheet ds, Snap.NX.Body body)
    {
        //UFUN创建基本视图函数
        var workPart      = NXOpen.Session.GetSession().Parts.Work;
        var theUFSession  = NXOpen.UF.UFSession.GetUFSession();
        var modelView     = workPart.ModelingViews.FindObject("FRONT");
        var draw_view_tag = CreateView(ds, body, modelView.Tag, new Snap.Position(ds.Length / 2, ds.Height / 2));


        Tag top     = Tag.Null;
        var topFace = body.Faces.FirstOrDefault(u => u.GetAttributeInfo().Where(m => m.Title == "ATTR_NAME_MARK" && u.GetStringAttribute("ATTR_NAME_MARK") == "BASE_BOT").Count() > 0);

        top = topFace.NXOpenTag;

        var box        = body.Box;
        var min        = new Snap.Position((box.MinX + box.MaxX) / 2, (box.MinY + box.MaxY) / 2, box.MinZ);
        var plane      = new Snap.Geom.Surface.Plane(min, topFace.GetFaceDirection());
        var bottomFace =
            body.Faces.OrderBy(u =>
                               Snap.Compute.Distance(min, u)
                               ).FirstOrDefault();

        Tag bottom = Tag.Null;

        //theUFSession.Obj.CycleByName("BOTTOMEDGE", ref bottom);
        bottom = bottomFace.NXOpenTag;

        CreateVerticalDim(draw_view_tag, top, bottom, new Snap.Position((ds.Length / 2) + GetBorderSize(draw_view_tag).X / 2, ds.Height / 2, 0));

        return(null);
    }
Exemple #2
0
 public static Transform CreateReflection(Surface.Plane plane)
 {
     return(CreateReflection(plane.Normal, plane.D));
 }