改良版(不需导入Lisp函数)- Public Sub BlockInsert(Name As String)
- Dim pLisp As String
- Dim obj As VLAX
- Dim pnt(2) As Double
- Set obj = New VLAX
- Set pObj = ThisDrawing.ModelSpace.InsertBlock(pnt, Name, 1, 1, 1, 0)
- obj.EvalLispExpression "(setq ed (entget (handent " & ToStr(pObj.Handle) & ")))"
- pLisp = "(while (not (= (caddr " & _
- "(setq pTime (grread t) " & _
- "pSt (car pTime) " & _
- "pnt (cond ((= pSt 3) (List 0 0 -1)) ((= pSt 5) (cadr pTime)) (t (List 0 0 1))))) -1)) " & _
- "(setq ed (subst (cons 10 pnt) (assoc 10 ed) ed)) " & _
- "(entmod ed) " & _
- ") "
- obj.EvalLispExpression pLisp
- Set obj = Nothing
- End Sub
- Public function ToStr(ByVal str) As String
- ToStr = Chr(34) & str & Chr(34)
- End Function
- Sub test()
- BlockInsert "123"
- End Sub
|