krampaul82 发表于 2015-12-29 10:17:16

从vba程序打印

大家好,沼泽们,新年快乐!(有点早。)
我有以下代码;将块插入到;用户在图纸空间中看到的模型空间中作为块的当前打开图形 现在有没有办法从这段代码中打印插入的内容
公共子打印insertca\u gtc\u pump\u hw\u spyddcVFD();PrintCA\u gtc\u pump1(“V:\gtc\U proj\Common\u Assy\Hot\u Water\u Circ\u Pump\ca-gtc\uPump\u assly\u 01.dwg”)
结束Sub;子打印CA\u gtc\u pump1(strBlockName作为字符串);Dim dblInsertPt(0到2)为双精度;Dim dblScale为双精度;Dim DBL旋转为双;Dim objacadoc As AcadDocument;Dim objBlockRef作为AcadBlockReference;GTC\u comm\u assy\u main。隐藏'结束vba插入所选块;dblInsertPt(0)=0;dblInsertPt(1)=0;dblInsertPt(2)=0;dblScale=1;dblRotation=0
设置objacadoc=ThisDrawing
设置objBlockRef=objAcadDoc.ModelSpace。插入块(dblInsertPt,strBlockName,dblScale,dblScale,dblScale,dblRotation)
&039;这是我想继续用新的块插入和程序绘制图纸的地方
可以这样做吗?感谢您的帮助……
马克

Matt__W 发表于 2015-12-29 12:35:39

这里是#039;这是一个我们不知道的旧程序的片段;不再使用(我们现在使用图纸集绘制所有内容)。基本上,它在图形中的所有选项卡中循环,如果名称为“0”;型号;或包含;PDF*"它跳过了它。有一些我没有使用的变量'不包括在代码中。希望你能理解剩下的部分    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

krampaul82 发表于 2015-12-31 07:47:17

马特,我只是想抽时间谢谢你 你总是回复我寻求帮助的请求,让我朝着正确的方向开始!话虽如此,你是一个伟大的例子,沼泽是什么 愿你在新的一年里得到真正的祝福 我使用了;然后被屠宰;你的代码片段多次,使我的日常任务更容易和更快 我只希望有更多的时间真正更好地理解VBa和VB.net中的编程,但我的日常工作功能不允许这样做 在接下来的几周里,我会看看这个,可能会用到其中的一些,我相信还会有更多的查询
页: [1]
查看完整版本: 从vba程序打印