10
23
20
初来乍到
Private Sub cmdPlot_Click() ' Define application Dim oApp As Inventor.Application Set oApp = ThisApplication ' Define document Dim oCurrentDoc As DrawingDocument Set oCurrentDoc = oApp.ActiveDocument ' Define sheets Dim oSheets As Sheets Set oSheets = oCurrentDoc.Sheets Dim oSheet As Sheet Set oSheet = oCurrentDoc.Sheets.Item(1) ' Define print manager Dim oPM As DrawingPrintManager Set oPM = oCurrentDoc.PrintManager ' Get sheet size Dim xx As Integer Dim xy As Integer Select Case oSheet.Size Case kADrawingSheetSize xx = (6 * 2.54) xy = (3.12 * 2.54) Case kBDrawingSheetSize xx = (12 * 2.54) xy = (3.12 * 2.54) Case kCDrawingSheetSize xx = (17 * 2.54) xy = (3.12 * 2.54) Case kDDrawingSheetSize xx = (29 * 2.54) xy = (3.12 * 2.54) Case kEDrawingSheetSize xx = (37 * 2.54) xy = (3.12 * 2.54) End Select For Each oSheet In oSheets [color=red]oSheet.Activate[/color] ' Create a new sketch on the active sheet Dim oSketch As DrawingSketch Set oSketch = oCurrentDoc.ActiveSheet.Sketches.Add ' Open sketch for edit so the texhbox can be created oSketch.Edit Dim oTG As TransientGeometry Set oTG = oApp.TransientGeometry Dim sText As String sText = txtStampText.Text Dim oTextBox As Inventor.TextBox Set oTextBox = oSketch.tectboxes.AddFitted(oTG.CreatePoint2d(xx, xy), sText) oSketch.ExitEdit ' Requires plot to activate text oPM.PrintToFile ("c:\temp\tmpinventor.plot") ' Predefine printers Dim PRN As String PRN = "\\PS64\HP Color LaserJet M750dn" Dim PLT As String PLT = "\\PS64\HP T2500" oPM.ScaleMode = kPrintFullScale oPM.PrintRange = kPrintAllSheets Select Case oSheet.Size Case kADrawingSheetSize oPM.Printer = PRN oPM.PaperSize = kPaperSizeLetter oPM.Orientation = kLandscapeOrientation Case kBDrawingSheetSize oPM.Printer = PRN oPM.PaperSize = kPaperSize11x17 oPM.Orientation = kLandscapeOrientation Case kCDrawingSheetSize oPM.Printer = PLT oPM.PaperSize = kPaperSizeCSheet oPM.Orientation = kLandscapeOrientation Case kDDrawingSheetSize oPM.Printer = PLT oPM.PaperSize = kPaperSizeDSheet oPM.Orientation = kLandscapeOrientation Case kEDrawingSheetSize oPM.Printer = PLT oPM.PaperSize = kPaperSizeESheet oPM.Orientation = kLandscapeOrientation End Select oPM.SubmitPrint oSketch.Delete Next End Sub
本帖以下内容被隐藏保护;需要你回复后,才能看到!
使用道具 举报
11
40
3
初露锋芒
Dim sText As String sText = txtStampText.Text
本版积分规则 发表回复 回帖后跳转到最后一页
微信公众平台
扫描访问手机版
点击图片下载手机App
|关于我们|小黑屋|乐筑天下 繁体中文
GMT+8, 2025-3-14 13:27 , Processed in 0.443911 second(s), 56 queries .
© 2020-2025 乐筑天下
在线时间:10:00-17:00
暂无
扫一扫,关注我们
帮助中心
关于我们
下载APP客户端