Ejemplo n.º 1
0
        private void BtnSetMultiPartView_Click(object sender, EventArgs e)
        {
            Inventor.File pFile     = mInvApplication.ActiveDocument.File;
            CModelViews   ModelView = new CModelViews(ref mInvApplication);

            ModelView.ProcessFileRefs(pFile);
        }
Ejemplo n.º 2
0
        public void ProcessFileRefs(Inventor.File File)
        {
            foreach (Inventor.FileDescriptor DescriptedFile in File.ReferencedFileDescriptors)
            {
                if (!DescriptedFile.ReferenceMissing)
                {
                    if (DescriptedFile.ReferencedFileType != Inventor.FileTypeEnum.kForeignFileType)
                    {
                        if (DescriptedFile.ReferencedFileType != Inventor.FileTypeEnum.kUnknownFileType)
                        {
                            Inventor.Document Document = mInvApplication.Documents.Open(DescriptedFile.FullFileName, true);
                            SetModelView(Document);

                            Document.Close(false);
                            //  ProcessFileRefs(DescriptedFile.ReferencedFile);
                        }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        private void ProcessFileRefs(Inventor.File File)
        {
            foreach (Inventor.FileDescriptor DescriptedFile in File.ReferencedFileDescriptors)
            {
                if (!DescriptedFile.ReferenceMissing)
                {
                    if (DescriptedFile.ReferencedFileType != Inventor.FileTypeEnum.kForeignFileType)
                    {
                        if (DescriptedFile.ReferencedFileType == Inventor.FileTypeEnum.kPartFileType) //part or sub;
                        {
                            string TartgetPartNumber           = "";
                            Inventor.PartDocument PartDocument = (Inventor.PartDocument)mInvApplication.Documents.Open(DescriptedFile.FullFileName, false);
                            TartgetPartNumber = PartDocument.PropertySets["{32853F0F-3444-11d1-9E93-0060B03C1CA6}"].get_ItemByPropId((int)Inventor.PropertiesForDesignTrackingPropertiesEnum.kPartNumberDesignTrackingProperties).Value;

                            if (TartgetPartNumber.StartsWith(txtPartID))
                            {
                                string             TypeOfPart = "";
                                Inventor._Document Document   = (Inventor._Document)PartDocument;

                                // normal part
                                if (PartDocument.SubType != "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}")
                                {
                                    TypeOfPart = "Plate";
                                    DrawDocument(Document, TypeOfPart);
                                }
                                else // if sheet metal
                                {
                                    TypeOfPart = "SheetMetal";
                                    DrawDocument(Document, TypeOfPart);
                                }

                                // Document.Close(false);
                            }
                            PartDocument.Close(false);
                        }
                    }
                }
            }
        }
Ejemplo n.º 4
0
        private void ProcessFileRefs(Inventor.File PartFile)
        {
            FileSaveUrl = "";

            foreach (Inventor.FileDescriptor FileDescriptor in PartFile.ReferencedFileDescriptors)
            {
                if (!FileDescriptor.ReferenceMissing)
                {
                    if (FileDescriptor.ReferencedFileType != Inventor.FileTypeEnum.kUnknownFileType || FileDescriptor.ReferencedFileType != Inventor.FileTypeEnum.kForeignFileType)
                    {
                        Inventor.File File = FileDescriptor.ReferencedFile;
                        if (File.Type != Inventor.ObjectTypeEnum.kContentCenterObject)
                        {
                            if (FileDescriptor.ReferencedFileType == Inventor.FileTypeEnum.kPartFileType)
                            {
                                string PartNumber = "";
                                string PartQty    = "-Qty";
                                // FileDescriptor.
                                Inventor.PartDocument mPartDocument = (Inventor.PartDocument)mInvApplication.Documents.Open(FileDescriptor.FullFileName, true);
                                PartNumber = mPartDocument.PropertySets["{32853F0F-3444-11d1-9E93-0060B03C1CA6}"].get_ItemByPropId((int)Inventor.PropertiesForDesignTrackingPropertiesEnum.kPartNumberDesignTrackingProperties).Value;
                                PartQty   += mPartDocument.PropertySets["{F29F85E0-4FF9-1068-AB91-08002B27B3D9}"].get_ItemByPropId((int)Inventor.PropertiesForSummaryInformationEnum.kKeywordsSummaryInformation).Value;

                                if (CFileNames.IsPartNumberPreFixsMatch(PartNumber, PartNumberID))
                                {
                                    if (FileSaveUrl == "")
                                    {
                                        if (!IsFileNameQtyAdded)
                                        {
                                            FileSaveUrl = FileDescriptor.FullFileName.Substring(0, FileDescriptor.FullFileName.LastIndexOf("."));
                                        }
                                        else
                                        {
                                            FileSaveUrl = FileDescriptor.FullFileName.Substring(0, FileDescriptor.FullFileName.LastIndexOf("."));
                                            FileSaveUrl = CFileNames.AppendAffixToFileNameInFullFileName(FileSaveUrl, "-", PartQty);
                                        }

                                        //check for Flat Pattern
                                        if (mPartDocument.SubType == "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}")
                                        {
                                            DXFExport(FileSaveUrl, mPartDocument);
                                        }
                                        else
                                        {
                                            //if (true)
                                            //{
                                            //    logWriter.WriteAsync(PartNumber);
                                            //}
                                            DoCommandExportDXF(mPartDocument);
                                        }
                                    }
                                    else //with user folder
                                    {
                                        CFileNames.GetFolderFromFullFileName(FileDescriptor.FullFileName, ref FileSaveUrl, false);
                                        FileSaveUrl += PartNumber;
                                        //check for Flat Pattern
                                        if (mPartDocument.SubType == "{9C464203-9BAE-11D3-8BAD-0060B0CE6BB4}")
                                        {
                                            DXFExport(FileSaveUrl, mPartDocument);
                                        }
                                        else
                                        {
                                        }
                                    }
                                }
                                mPartDocument.Close(false);
                                mPartDocument = null;
                            }
                        }
                        ProcessFileRefs(FileDescriptor.ReferencedFile);
                    }
                }
            }
        }
Ejemplo n.º 5
0
        public void GetFileRefs()
        {
            Inventor.File pFile = (Inventor.File)mInvApplication.ActiveDocument.File;

            ProcessFileRefs(pFile);
        }