|
为什么用JIG类预览块的时候很不清晰。代码如下:
'旋转预览--镜像预览
Public Class False_Rotation
Inherits DrawJig
Public BasePt As Point3d
Public EntCopy() As Entity '复制出来预览的对象
Private BAngle As Single
Private AngleScale As Integer = 1
' WorldDraw函数用于刷新屏幕上显示的图形.
Protected Overrides Function WorldDraw(ByVal draw As WorldDraw) As Boolean
On Error Resume Next
For i = 0 To EntCopy.Length - 1
draw.Geometry.Draw(EntCopy(i))
Next
Return True
End Function
Protected Overrides Function Sampler(ByVal prompts As JigPrompts) As SamplerStatus
On Error Resume Next
' 定义一个角度拖动交互类.
Sampler = Nothing
Dim optJigAngle1 As New JigPromptAngleOptions(vbCrLf & "请指定旋转角度")
' 设置拖拽的光标类型.
optJigAngle1.Cursor = CursorType.RubberBand
' 设置拖动光标基点.
optJigAngle1.BasePoint = BasePt
optJigAngle1.UseBasePoint = True
' 用AcquireAngle函数得到用户输入的角度值.
Dim resJigAngle1 As PromptDoubleResult = prompts.AcquireAngle(optJigAngle1)
If BAngle resJigAngle1.Value Then
' 保存当前角度值.
For i = 0 To EntCopy.Length - 1
EntCopy(i).TransformBy(Matrix3d.Rotation((resJigAngle1.Value - BAngle) * AngleScale, Vector3d.ZAxis, BasePt))
Next
BAngle = resJigAngle1.Value
Return SamplerStatus.OK
Else
Return SamplerStatus.NoChange
End If
End Function
End Class
调用
Dim Ent(0) As Entity
Ent(0) = InserBlock
Dim QJI As New False_Move
QJI.EntCopy = Ent
QJI.BasePt = New Point3d()
QJI.CurrPt = New Point3d()
Dim jigRes As PromptResult = AcDocEd.Drag(QJI)‘移动预览没有问题
If jigRes.Status = PromptStatus.OK Then
Dim RJI As New False_Rotation'旋转预览就很闪烁。预览的对象不全
RJI.BasePt = QJI.CurrPt
RJI.EntCopy = Ent
QJI = Nothing
jigRes = AcDocEd.Drag(RJI)
If jigRes.Status = PromptStatus.OK Then
ModelSpace.AppendEntity(Ent(0))
End If
End If
|
|