面域的三维旋转必须用lisp语句
在用VBA时,使用以给定的面域绕轴创建旋转实体的Addrevolvesolid语句时,旋转成三维。AxisPoint
Variant[变体] (三元素双精度数组); 仅用于输入
指定旋转轴起点的三维WCS坐标。
AxisDir(理角不透,旋转成形后,三维旋转体成变形)
Variant[变体] (三元素双精度数组); 仅用于输入
指定旋转轴方向的三维矢量。
解决这个问题只能lisp语句才能实现,原因何在
gg = "(command ""Revolve"" qq """" ""o"" qqq """" )"
ThisDrawing.SendCommand gg & vbCr
程序如下Sub Example_AddRevolvedSolid()
' 该示例通过面域沿一个轴旋转以创建实体。
' 面域是由一个弧和一根直线创建的。
Dim curves(0 To 1) As AcadEntity
' 定义圆弧
Dim centerPoint(0 To 2) As Double
Dim radius As Double
Dim startAngle As Double
Dim endAngle As Double
centerPoint(0) = 5#: centerPoint(1) = 3#: centerPoint(2) = 0#
radius = 2#
startAngle = 0
endAngle = 3.141592
' 定义旋转轴
Dim axisPt(0 To 2) As Double
Dim axisDir(0 To 2) As Double
Dim angle As Double
Set curves(0) = ThisDrawing.ModelSpace.AddArc(centerPoint, radius, startAngle, endAngle)
' 定义直线
Set curves(1) = ThisDrawing.ModelSpace.AddLine(curves(0).StartPoint, curves(0).EndPoint)
pp = curves(0).StartPoint
For ii = 0 To 0
axisPt(ii) = pp(ii)
Next ii
ppp = curves(0).EndPoint
' 创建面域
Dim regionObj As Variant
regionObj = ThisDrawing.ModelSpace.AddRegion(curves)
tt = "(setq qq (handent """ & regionObj(0).Handle & """))"
ThisDrawing.SendCommand tt & vbCr
axisPt(0) = centerPoint(0): axisPt(1) = 0: axisPt(2) = 0
axisDir(0) = centerPoint(0) + 2: axisDir(1) = 0: axisDir(2) = 0
Set objLine = ThisDrawing.ModelSpace.AddLine(axisPt, axisDir)
ttt = "(setq qqq (handent """ & objLine.Handle & """))"
ThisDrawing.SendCommand ttt & vbCr
objLine.color = 3
angle = 6.28
' 创建实体
gg = "(command ""Revolve"" qq """" ""o"" qqq """" )"
ThisDrawing.SendCommand gg & vbCr
End Sub
Sub lll()
tt = "(setq qq (handent ""ba""))"
ThisDrawing.SendCommand tt
End Sub
页:
[1]