美文网首页
003 - 保存Inventor工程图文件为PDF格式

003 - 保存Inventor工程图文件为PDF格式

作者: 怪怪001 | 来源:发表于2023-11-10 08:45 被阅读0次

    背景:创建一个iLogic规则去保存工程图文件为pdf格式到指定的文件夹。

    创建 PDF规则

    WorkspacePath= ThisDoc.WorkspacePath()

    WorkspacePathLength = Len(WorkspacePath)

    PathOnly = ThisDoc.Path

    DirectoryPath = Strings.Right(PathOnly, PathOnly.Length-WorkspacePathLength)

    PDFPath = "C:\PDFs\" & DirectoryPath

    If(Not System.IO.Directory.Exists(PDFPath)) Then

        System.IO.Directory.CreateDirectory(PDFPath)

    End If

    ThisDoc.Document.SaveAs(PDFPath & "\" & ThisDoc.FileName(False)  & ".pdf" , True)

    高级创建 PDF规则

    Sub Main ()

        FileName = ThisDoc.FileName(True) 'with extension

        FileExtension = Right(FileName, 3)

        If FileExtension = "idw" Then

            Save_As_PDF

        Else If FileExtension = "dwg" Then

            Save_As_PDF

        Else

            ErrorMessage

        End If

    End Sub

    Sub Save_As_PDF

        WorkspacePath= ThisDoc.WorkspacePath()

        WorkspacePathLength = Len(WorkspacePath)

        PathOnly = ThisDoc.Path

        DirectoryPath = Strings.Right(PathOnly, PathOnly.Length - WorkspacePathLength)

        PDFPath = "C:\PDFs\" & DirectoryPath

        If(Not System.IO.Directory.Exists(PDFPath)) Then

            System.IO.Directory.CreateDirectory(PDFPath)

        End If

        ThisDoc.Document.SaveAs(PDFPath & "\" & ThisDoc.FileName(False) & (".pdf") , True)

    End Sub

    Sub ErrorMessage

        i = MessageBox.Show("This is not a drawing file. No PDF will be

        created.", "Create PDF", MessageBoxButtons.OK, MessageBoxIcon.Hand,

        MessageBoxDefaultButton.Button1)

    End Sub

    相关文章

      网友评论

          本文标题:003 - 保存Inventor工程图文件为PDF格式

          本文链接:https://www.haomeiwen.com/subject/yiyhwdtx.html