muck 发表于 2022-7-6 11:47:49

有可能得到普洛特吗

AutoCAD VBA 2010。
 
是否可以获取绘图驱动程序名称并将其放入组合框或更高版本
编程绘图使用。
 
我正在尝试以下代码,但我没有任何运气。
 
私有子命令按钮12\u Click()
将P作为对象
将p1设置为对象
Dim PL作为字符串
尺寸x为整数
设置P=ThisDrawing。打印配置
'设置p1=
PL=P.ConfigName
ComboBox1.Value=“绘图仪名称”
对于P.ConfigName中的每个PL
'ComboBox1.AddItem(P.Name)
MsgBox P.Name
下一个
末端接头
 
我也有兴趣在一个组合框中获得可用的pin文件,但
我需要先弄清楚如何使用绘图仪名称。
 
非常感谢。

dbroada 发表于 2022-7-6 12:06:51

我试过这样的东西。。。
 
Dim i As Integer
Dim default As Integer
Dim PName As String
'DirList1.Drive = "H:"
'DirList1.Path = "\Design_Office"
'DirList1.Pattern = "*.dwg"
default = 0
For i = 1 To UBound(ThisDrawing.ModelSpace.Layout.GetPlotDeviceNames)
PName = ThisDrawing.ModelSpace.Layout.GetPlotDeviceNames(i)
cmbPrinters.AddItem PName
If PName = "PR03" Then default = i - 1
Next
cmbPrinters.ListIndex = default
For i = 0 To UBound(ThisDrawing.ModelSpace.Layout.GetPlotStyleTableNames)
cmbStyle.AddItem (ThisDrawing.ModelSpace.Layout.GetPlotStyleTableNames(i))
Next
cmbStyle.ListIndex = 0
End Sub

Lee Mac 发表于 2022-7-6 12:25:01

我从未真正用VBA编程,但这有帮助吗?
 

Sub GetPlotNames ()

   Dim i As Integer
   Dim Layout As ACADLayout
   Set Layout = ThisDrawing.ModelSpace.Layout
   
   Layout.RefreshPlotDeviceInfo

   Dim plotDevices As Variant
   plotDevices = Layout.GetPlotDeviceNames()
   
   For i = LBound(plotDevices) To UBound(plotDevices)
       MsgBox plotDevices(i)
   Next
   
End Sub

muck 发表于 2022-7-6 12:35:06

感谢第二组代码的使用。我还没有试过第一个。
 
 
可以修改该代码以获取pin设置文件的位置吗???
 
是否有关于AutoCAD打印对象的任何信息/教程
这样我就能自己搞清楚这件事了。
 
非常感谢。

Lee Mac 发表于 2022-7-6 12:49:35

 
 
Visual LISP编辑器帮助文件中有很多信息:wink:
页: [1]
查看完整版本: 有可能得到普洛特吗