.NET
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Returning a point location using a transparent function

2 REPLIES 2
Reply
Message 1 of 3
NilsL
253 Views, 2 Replies

Returning a point location using a transparent function

Dear All,

A have some old c++ code that implemented a transparent function. It returns a 3d location using acedRetVal and a resbuf.

I'm now trying to migrate this into .NET but so far I have been un successful in finding a way to return the location/resbuf.

I can use the transparent option on the commandmethod, but don't know how to return the resbuf

alternatively I can use the LispCommand settings in 2007, but I cannot find a way to make that command transparent..

Any clues on how to do this would be appreciated, I cannot for my life believe that I'm the only one who want's to do this.
2 REPLIES 2
Message 2 of 3
Anonymous
in reply to: NilsL

Try using the LispFunction attribute, but give
your 'LispFunction' a name starting with "C:":

[LispFunction("C:FOO")]
public static void foo()
{
}

Do not use the Transparent command flag.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com

wrote in message news:5619525@discussion.autodesk.com...
Dear All,

A have some old c++ code that implemented a transparent function. It returns a 3d location using acedRetVal and a resbuf.

I'm now trying to migrate this into .NET but so far I have been un successful in finding a way to return the location/resbuf.

I can use the transparent option on the commandmethod, but don't know how to return the resbuf

alternatively I can use the LispCommand settings in 2007, but I cannot find a way to make that command transparent..

Any clues on how to do this would be appreciated, I cannot for my life believe that I'm the only one who want's to do this.
Message 3 of 3
NilsL
in reply to: NilsL

Tony, thanks for the suggestion.

It works so so, when used from AutoCAD commands, it works fine, but when used from my own routines, I get the message 'Can't reenter LISP". This is true both for LISP based functions and ObjectARX.

Finally, If I go down this route, I will not be able to use this in AutoCAD 2006. Do you know if there is a way to return a resbuf from a VB.NET function using ACAD 2006 ? Alternatively, skipping 2006 and doing it in 2007.

Below is the function I use to test the solutions:

_
Public Function VB2function(ByVal rbfArgs As ResultBuffer) As ResultBuffer

Dim rbfResult As ResultBuffer
rbfResult = New ResultBuffer( _
New TypedValue(CInt(5001), 3.14159), _
New TypedValue(CInt(5001), 0), _
New TypedValue(CInt(5001), 400.4))
Return rbfResult

End Function

Hmm, searched the forum on the can't reenter LISP function found some answers.

Obviously the system believes my .NET function is now a LISP function and thus will deny access if called from LISP.

This then rules out the option of using the LISPFunction keyword unless all old code migrated to .NET

Message was edited by: NilsL Further investigations show that some of the old c++ objectARX code I have uses acedDefun and acedRegFunc. This obviously makes them lisp code in the same was as LispFunction does with vb.net code.

I did some modifications and removed the aceddefun, acedRegFunc, declared the function as an external function in .NET and called it. This made the function a .NET function and suddenly the transparent Lispfunction could be used.


Message was edited by: NilsL

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th


Autodesk Design & Make Report

”Boost