Is there a .NET equivalent for ade_projentityforward ?

By Partha Sarkar

ade_*
functions are not exposed in the .NET API. We can work around this by defining a
LISP command and calling ade_* function in it and then in .NET application
invoke the command defined in LISP. See the bellow codes.

(defun
c:LispADE ()
(setq cscode (ade_projgetwscode))
(if (= cscode null)
(progn
(alert "Error in getting current coordinate system!")
(exit)
)
)
(setq rt (ade_projsetsrc "LL84"))
(if (/= rt t)
(progn
(alert "Error in getting current coordinate system!")
(exit)
)
)

(setq rt1 (ade_projsetdest cscode))
(if (/= rt1 t)
(progn
(alert "Error in setting destination coordinate system!")
(exit)
)
)
(setq entdata (car (entsel "select entity:")))
(setq rt2 (ade_projentityforward entdata))
(if (/= rt2 t)
(progn
(alert
"Error in projecting entity to destination coordinate system!"
)
(exit)
)
(alert "ok")
)

)

The .NET invoking code is here:

[CommandMethod("MyADE")]

public void InvokeAdeFun()

{

  Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.SendStringToExecute("LispADE", false, true, false);

}

 

Hope this is useful to you!

 


Comments

4 responses to “Is there a .NET equivalent for ade_projentityforward ?”

  1. What’s wrong with, e.g.:
    ResultBuffer buf = new ResultBuffer();
    TypedValue tv =
    new TypedValue(5005, “ade_projentityforward”);
    buf.Add(tv);
    ResultBuffer ans = Application.Invoke(buf);
    //and so on…?

  2. Sorry, for the first call, the TypedValue should be:
    TypedValue tv =
    new TypedValue(5005, “ade_projgetwscode”);

  3. Hi RasmusB,
    ade_projentityforward is a LISP function not a command name.
    Thanks,
    Partha

  4. So, every call but the last, ade_projentityforward, can be made in .NET by using Application.Invoke? At least, they all work for me, but invoking ade_projentityforward seems to be returning null as long as cscode != “”.

Leave a Reply

Discover more from Autodesk Developer Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading