/// <summary>
        /// 创建装配
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns></returns>
        public NXOpen.Assemblies.Component CreateCompPart()
        {
            CsysUtils.SetWcsOfCenteAndMatr(this.CenterPt, this.EleMatr.GetMatrix3());
            NXObject obj = AssmbliesUtils.CreateNew(this.AssembleName, WorkpiecePath);

            NXOpen.Assemblies.Component comp = obj as NXOpen.Assemblies.Component;
            this.PartTag = obj.Prototype as Part;
            SetAttribute();
            CsysUtils.SetWcsToAbs();
            return(comp);
        }
Esempio n. 2
0
 /// <summary>
 /// 创建装配
 /// </summary>
 /// <param name="filePath"></param>
 /// <returns></returns>
 public NXOpen.Assemblies.Component CreateCompPart(string directoryPath)
 {
     this.WorkpieceDirectoryPath = directoryPath;
     this.WorkpiecePath          = directoryPath + this.AssembleName + ".prt";
     CsysUtils.SetWcsToAbs();
     CsysUtils.SetWcsOfCenteAndMatr(this.Info.Matr.GetCenter(), this.Info.Matr.GetMatrix3());
     try
     {
         NXObject obj = AssmbliesUtils.CreateNew(this.AssembleName, WorkpiecePath);
         NXOpen.Assemblies.Component comp = obj as NXOpen.Assemblies.Component;
         this.PartTag = obj.Prototype as Part;
         if (this.PartTag != null)
         {
             SetAttribute(this.PartTag);
         }
         CsysUtils.SetWcsToAbs();
         return(comp);
     }
     catch (NXException ex)
     {
         ClassItem.WriteLogFile("创建装配档错误!" + ex.Message);
         throw ex;
     }
 }