
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi Guys,
I found this code (CAD pro systems ltd) to create an image file screenshot which works really well.
It saves the image file to the same location as the part or assembly that you have screenshot.
Does anyone know how to print the screenshot directly to my printer?
‘Create the pre-set list of output resolutions
availableRes = New String() {“640 x 480”, “1024 x 768”, “1280 x 1024”, “1920 x 1080”}
‘Get the required resolution from an InputListBox.
selectedRes = InputListBox(“Select Resolution”,availableRes, “”, “Export JPG”, “Available Size”)
‘Set the required background colour
'using the RGB values below.
‘Note that this will not work if you
'have a image image as your background!
Dim topColor As Color = ThisApplication.TransientObjects.CreateColor(255, 255, 255)‘255,255,255 = white.
Select Case selectedRes
Case = “640 x 480”
width = 640
height = 480
Case = “1024 x 768”
width = 1024
height = 768
Case = “1280 x 1024”
width = 1280
height = 1024
Case = “1920 x 1080”
width = 1920
height = 1080
End Select
imageName = ThisDoc.PathAndFileName(False)
Dim cam As Camera
cam = ThisApplication.ActiveView.Camera
Dim Time As DateTime = DateTime.Now
‘Reformat the time to remove the :
'symbol because it not allowed for file names.
Dim Format As String = “HH.mm.ss”
currentTime = Time.ToString(Format) ‘Replaces : with . from time format.
‘Add current filename, resolution, and current time to make the image filename.
imageName = imageName & ” ” & selectedRes & ” ” & currentTime
cam.SaveAsBitmap((imageName & “.jpg”), width, height, topColor)
This is my code I have to print drawings, can this be modified?
SyntaxEditor Code Snippet
Dim oDrgDoc As DrawingDocument oDrgDoc = ThisApplication.ActiveDocument ' Set reference to drawing print manager ' DrawingPrintManager has more options than PrintManager ' as it's specific to drawing document Dim oDrgPrintMgr As DrawingPrintManager oDrgPrintMgr = oDrgDoc.PrintManager ' Set the printer name ' comment this line to use default printer or assign another one oDrgPrintMgr.Printer = "\\virginia\Canon 3500" 'oDrgPrintMgr.AllColorsAsBlack = False 'oDrgPrintMgr.ColorMode = kPrintDefaultColorMode 'Set the paper size , scale and orientation oDrgPrintMgr.ScaleMode = kPrintBestFitScale oDrgPrintMgr.PaperSize = PaperSizeEnum.kPaperSizeA3 oDrgPrintMgr.PrintRange = kPrintAllSheets oDrgPrintMgr.Orientation = kLandscapeOrientation oDrgPrintMgr.SubmitPrint
Cheers
Tony
Solved! Go to Solution.