创建多行
你好有谁能告诉我一个使用vba绘制多行的好例子吗?
我查看了帮助文件,但似乎没有太多信息?
干杯
Col公司 将点作为XYZ集进行种子设定,因此直线“主要”部分的点数将是一个由3个集组成的数组:主线上的点将为第一个点的索引0,1,2,第二个点的索引3,4,5,第三个点的索引6,7,8。等等等等。
对正是要偏移的边。acTop和acBottom是偏移“主线”的“边”:acZero基本上是从点中间的假想线偏移两条线。
MLineScale控制偏移量。
帮助中提供的示例代码帮助不大。
取样本代码,删除除索引中的点以外的所有点
0-8,并使其具有以下值:
0=0. 1=0. 2=0.
3=0. 4=-10. 5=0.
6=10. 7=-10. 8=0
这基本上会形成一个“L”形,不同于样本源提供的重叠垃圾。
然后使用对齐和多尺度属性;那么你应该掌握诀窍了。 嗨,上校
不确定你的意思,但是
希望这会有所帮助,只需在屏幕上选择点即可
Public Sub DrawMLineDynamicaly()
' partially borrowed from Tony Tanzillo's 'Getpoint' function
Dim pickPt As Variant
Dim mlCoords() As Double
Dim i As Integer
Dim oMline As AcadMLine
i = 0
On Error Resume Next
pickPt = ThisDrawing.Utility.GetPoint(, vbCr & "First point: ")
If Err = 0 Then
ReDim mlCoords(2)
mlCoords(i) = pickPt(0): mlCoords(i + 1) = pickPt(1): mlCoords(i + 2) = 0#
Do Until Err.Number <> 0
i = i + 3
pickPt = ThisDrawing.Utility.GetPoint(pickPt, vbCr & "Pick next point or press Enter to stop: ")
ReDim Preserve mlCoords(UBound(mlCoords) + 3)
mlCoords(i) = pickPt(0): mlCoords(i + 1) = pickPt(1): mlCoords(i + 2) = 0#
If oMline Is Nothing Then
Set oMline = ThisDrawing.ModelSpace.AddMLine(mlCoords)
oMline.Update
Else
oMline.Coordinates = mlCoords
oMline.Update
End If
Loop
End If
End Sub
~'J'~ Fixo,
谢谢你。我试图创建的是您发布的代码的一个版本,但允许用户输入尺寸、宽度、高度和托架数量,并将最终产品设置为幕墙屏幕。
谢谢你的帮助。
干杯
col公司 罗西,
谢谢你的解释。你没提mlinestyle?我从帮助中看到它是只读的?
我试过了
MyObjMLine.stylename = “MLineStyleName”
它返回了一个错误。这是否意味着不能用vba更改,而必须手动更改?
干杯
Col公司 Col,请看一下帮助:
来自帮助
样式名
对于MLine对象,此属性为只读
要设置所需的MlineStyle,请使用:
ThisDrawing.SetVariable "CMLSTYLE", "MyStyleName" '<--style name
~'J'~ Fixo,
非常感谢。它运行得非常好。
我会努力进一步发展。
非常感谢,
Col公司 不客气
干杯
~'J'~ Fixo,
jpeg attached. it is a very simple example, the amount of columns/ rows could 10 or 100, for eg.
Im sure i can use you example, i just need to work out how to accept input from the command line and then work out the calculation required.
cheers,
col
页:
[1]
2