Loading th color picker in VBA for autocad 2008

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi all
I have a problem in loading the color picker in autocad 2008 using the VLAX class module, althought it was working well in autocad 2006.
The following represent the code for the VLAX class module:
Private VL As Object
Private VLF As Object
Private Sub Class_Initialize()
Set VL = ThisDrawing.Application.GetInterfaceObject("VL.Application.16")
Set VLF = VL.ActiveDocument.Functions
End Sub
Private Sub Class_Terminate()
Set VLF = Nothing
Set VL = Nothing
End Sub
Public Function EvalLispExpression(lispStatement As String)
Dim sym As Object, RET As Object, retVal
Set sym = VLF.Item("read").funcall(lispStatement)
' on error resume next
retVal = VLF.Item("eval").funcall(sym)
If Err Then
EvalLispExpression = ""
Else
EvalLispExpression = retVal
End If
End Function
Public Sub SetLispSymbol(symbolName As String, value)
Dim sym As Object, RET, symValue
symValue = value
Set sym = VLF.Item("read").funcall(symbolName)
RET = VLF.Item("set").funcall(sym, symValue)
EvalLispExpression "(defun translate-variant (data) (cond ((= (type data) 'list) (mapcar 'translate-variant data)) ((= (type data) 'variant) (translate-variant (vlax-variant-value data))) ((= (type data) 'safearray) (mapcar 'translate-variant (vlax-safearray->list data))) (t data)))"
EvalLispExpression "(setq " & symbolName & "(translate-variant " & symbolName & "))"
EvalLispExpression "(setq translate-variant nil)"
End Sub
Public Function GetLispSymbol(symbolName As String)
Dim sym As Object, RET, symValue
symValue = value
Set sym = VLF.Item("read").funcall(symbolName)
GetLispSymbol = VLF.Item("eval").funcall(sym)
End Function
Public Function GetLispList(symbolName As String) As Variant
Dim sym As Object, list As Object
Dim count, elements(), i As Long
Set sym = VLF.Item("read").funcall(symbolName)
Set list = VLF.Item("eval").funcall(sym)
count = VLF.Item("length").funcall(list)
ReDim elements(0 To count - 1) As Variant
For i = 0 To count - 1
elements(i) = VLF.Item("nth").funcall(i, list)
Next
GetLispList = elements
End Function
Public Sub NullifySymbol(ParamArray symbolName())
Dim i As Integer
For i = LBound(symbolName) To UBound(symbolName)
EvalLispExpression "(setq " & CStr(symbolName(i)) & " nil)"
Next
End Sub
The line code highligthed in red is the line where an error occurs for the autocad2008
So does anyone know whats wrong with this module and also is there another way to call the autocad color picker?
Thanks 4 ur help.....................