TheSwamp
Code Red => VB(A) => Topic started by: krampaul82 on December 29, 2015, 10:17:16 AM
-
Hello swampers
Happy New Year! (A little early.)
I have the following code that inserts a block into the current open drawing as a block in model space which the user sees in paper space. Is there a way to now print that insert from within this code?
Public Sub PrintInsertCA_gtc_pump_hw_spyddcVFD()
PrintCA_gtc_pump1 ("V:\gtc_proj\Common_Assy\Hot_Water_Circ_Pump\ca-gtc_pump_assy_01.dwg")
End Sub
Sub PrintCA_gtc_pump1(strBlockName As String)
Dim dblInsertPt(0 To 2) As Double
Dim dblScale As Double
Dim dblRotation As Double
Dim objAcadDoc As AcadDocument
Dim objBlockRef As AcadBlockReference
GTC_comm_assy_main.Hide 'End vba Insert the selected block
dblInsertPt(0) = 0
dblInsertPt(1) = 0
dblInsertPt(2) = 0
dblScale = 1
dblRotation = 0
Set objAcadDoc = ThisDrawing
Set objBlockRef = objAcadDoc.ModelSpace.InsertBlock(dblInsertPt, strBlockName, dblScale, dblScale, dblScale, dblRotation)
'This is where I would like continue to plot the paperspace drawing with the new block insert and the program.
End Sub
can this be done? any help appreciated...
Mark
-
Here's a snippet from an old program that we don't use anymore (we use Sheet Sets to plot everything now). Basically it loops through all of the tabs in a drawing and if the name is "Model" or contains "PDF*" it skips it. There are variables being used that I didn't include in the code. Hopefully you can make sense of the rest.
For Each objLayout In ThisDrawing.Layouts
If objLayout.Name = "Model" Or UCase(objLayout.Name) Like "PDF*" Then
Debug.Print "Skipping Model Space or PDF tab."
ElseIf UCase$(objLayout.Name) Like (strTabID & "*") Then
ThisDrawing.ActiveLayout = ThisDrawing.Layouts(objLayout.Name)
ThisDrawing.ActiveLayout.RefreshPlotDeviceInfo
ThisDrawing.ActiveLayout.ViewToPlot = strPlotView
ThisDrawing.ActiveLayout.PlotType = acView
ThisDrawing.ActiveLayout.RefreshPlotDeviceInfo
With ThisDrawing.ActiveLayout
.RefreshPlotDeviceInfo
.ConfigName = "PDF-B&W.pc3"
.CanonicalMediaName = strMediaName
.StandardScale = ac1_1
.ScaleLineweights = False
.StyleSheet = strCTB
.PlotRotation = ac90degrees
.ViewToPlot = strPlotView
.CenterPlot = True
.PlotType = acView
End With
ThisDrawing.Plot.PlotToDevice
End If
Next objLayout
-
Matt,
I just wanted to take the time and thank you. You have always replied to my inquiries for help that gets me started in the right direction! That being said, you are a great example of what the swamp is all about. May you truly be blessed in the up and coming new year! I have used "and butchered" snippets of your code many times to make my daily tasks easier and faster. I just wish i had more time to truly get a better understanding of programming in VBa and VB.net but my daily job functions do not permit that. I will look at this and probably use some of this in the following weeks to come, with more inquiries i am sure.
Mark