TheSwamp
Code Red => .NET => Topic started by: MaksimS on May 28, 2007, 09:43:40 AM
-
Dear all,
Any ideas on how to pass resulting value of my LispFunction to DIESEL? I'd like to show a menu item (using CUI) depending on the LispFunction result.
Regards,
Maksim Sestic
-
:-) Let me be more specific - here's a function that reads/stores given Short to some shared class variable (TestValue). If there's a value passed down to MyValue function via Lisp, then TestValue carries it down the session. Otherwise, it just returns current TestValue. Here it goes:
<LispFunction("MyValue")> _
Public Shared Function MyValue(ByVal resBuf As ResultBuffer) As Object
Dim m_Result As New ResultBuffer
If resBuf IsNot Nothing Then
Dim m_TypedValue() As TypedValue = resBuf.AsArray
Dim m_Value As Short = CShort(m_TypedValue(0).Value)
If TestValue <> m_Value Then
TestValue = m_Value
End If
End If
m_Result.Add(New TypedValue(5003, TestValue))
Return m_Result
End Function
Now, it's possible to control menu item appearance via DIESEL, e.g.:
$(if,(MyValue),~)Test Item
$(if,$(and,1,$(eval,MyValue)),!.)Test item
Alas, I can't make it work using MyValue Lisp function - somehow DIESEL doesn't evaluate it right. Any ideas on what am I doing wrong here? :-) Maybe the best solution is to somehow promote my LispFunction to system variable accessible via getvar, but I have no clue if this is possible at all.
Regards,
Maksim Sestic
-
Not sure what give you the impression that it
can, but DIESEL can't evaluate LISP expressions.
It can evaluate system variables that can be set
by LISP or any other API, but that's about it for
DIESEL extensibility.
:-) Let me be more specific - here's a function that reads/stores given Short to some shared class variable (TestValue). If there's a value passed down to MyValue function via Lisp, then TestValue carries it down the session. Otherwise, it just returns current TestValue. Here it goes:
<LispFunction("MyValue")> _
Public Shared Function MyValue(ByVal resBuf As ResultBuffer) As Object
Dim m_Result As New ResultBuffer
If resBuf IsNot Nothing Then
Dim m_TypedValue() As TypedValue = resBuf.AsArray
Dim m_Value As Short = CShort(m_TypedValue(0).Value)
If TestValue <> m_Value Then
TestValue = m_Value
End If
End If
m_Result.Add(New TypedValue(5003, TestValue))
Return m_Result
End Function
Now, it's possible to control menu item appearance via DIESEL, e.g.:
$(if,(MyValue),~)Test Item
$(if,$(and,1,$(eval,MyValue)),!.)Test item
Alas, I can't make it work using MyValue Lisp function - somehow DIESEL doesn't evaluate it right. Any ideas on what am I doing wrong here? :-) Maybe the best solution is to somehow promote my LispFunction to system variable accessible via getvar, but I have no clue if this is possible at all.
Regards,
Maksim Sestic
-
I understand, I was just hoping for DIESEL to automagically evaluate it somehow :-)
Tony, is there a way to trick ACAD by "artificially" promoting a value to ACAD's system/environment variable accessible via getvar/getenv?
Regards,
Maksim Sestic
Not sure what give you the impression that it
can, but DIESEL can't evaluate LISP expressions.
It can evaluate system variables that can be set
by LISP or any other API, but that's about it for
DIESEL extensibility.
-
USERI1 to USERI5 ,
USERR1 to USERR5 ,
USERS1 to USERS5 , are System Vars. Have you tried to use those ?
access with
Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable(string name);
Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable(string name, object value);
may be worth playing with.
... there's nothing magical or artificial about it though, sorry :-(
-
Hi Kerry,
I'm aware of ACAD's user variables, still I'm trying not to interfere with them since many applications use them here and there as either permanent or temporary data store. For DIESEL to evaluate one of USERx sysvars I'd need to reserve many of them exclusively, throughout the session.
Controlling menu appearance using DIESEL looks so lightweight, compared to bunch of events I'd need to implement to perform equal effect.
Regards,
Maksim Sestic
USERI1 to USERI5 ,
USERR1 to USERR5 ,
USERS1 to USERS5 , are System Vars. Have you tried to use those ?
access with
Autodesk.AutoCAD.ApplicationServices.Application.GetSystemVariable(string name);
Autodesk.AutoCAD.ApplicationServices.Application.SetSystemVariable(string name, object value);
may be worth playing with.
... there's nothing magical or artificial about it though, sorry :-(