好建议,米克
作为插入函数,以下操作很好,但我必须稍后更改插入点(oBref.InsertionPoint=insPt),don';我不知道为什么
[代码0和函数
- Function GetActiveUcs() As AcadUCS
- Dim Origin
- Dim Xaxis
- Dim Yaxis
- Dim strNm As String, sUcs As String
- sUcs = ThisDrawing.GetVariable("UCSNAME")
- If sUcs = "" Then
- ' Current UCS is not saved so get the data and save it
- 'A ucs is saved when a user makes and saves one or
- ' a user clicks on an isoview button
- With ThisDrawing
- If .GetVariable("WORLDUCS") = 1 Then
- Xaxis = Zero: Yaxis = Zero
- Xaxis(0) = 1: Yaxis(1) = 1
- Set GetActiveUcs = ThisDrawing.UserCoordinateSystems.Add(Zero, Xaxis, Yaxis, "World")
- Exit Function
- End If
- Origin = .GetVariable("UCSORG")
- Xaxis = .GetVariable("UCSXDIR")
- Yaxis = .GetVariable("UCSYDIR")
- strNm = "Active"
- End With
- Set GetActiveUcs = ThisDrawing.UserCoordinateSystems.Add(Zero, Xaxis, Yaxis, strNm)
- 'Changing the origin later stops the error message
- '-2145320930 UCS X axis and Y axis are not perpendicular
- GetActiveUcs.Origin = Origin
- ThisDrawing.ActiveUCS = GetActiveUcs
- Else
- Select Case sUcs
- Case "*TOP*", "TOP"
- Set GetActiveUcs = SetOrthoUCS("Top")
- Case "*BOTTOM*"
- Set GetActiveUcs = SetOrthoUCS("Bottom")
- Case "*LEFT*"
- Set GetActiveUcs = SetOrthoUCS("Left")
- Case "*RIGHT*"
- Set GetActiveUcs = SetOrthoUCS("Right")
- Case "*FRONT*"
- Set GetActiveUcs = SetOrthoUCS("Front")
- Case "*BACK*"
- Set GetActiveUcs = SetOrthoUCS("Back")
- Case Else
- Set GetActiveUcs = ThisDrawing.ActiveUCS 'current UCS is saved
- End Select
- End If
- End Function
|