- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to setup layers using previously written LISP code in my C# program. My LISP code is:
(defun c:SetUpLayers ()
(command "-layer" "m" "const1" "c" "1")
(command "")
(command "")
(command "-layer" "m" "const2" "c" "5")
(command "")
(command "")
(command "-layer" "m" "const3" "c" "3")
(command "")
(command "")
) ;ends and sets all layers for sloper building
I am calling this function from C# with this code:
[CommandMethod("SetUpLayers", CommandFlags.Modal)]
public void SetUpLayers() //Setup AutoCad drawing Layers
{
// build the arguments list
ResultBuffer args = new ResultBuffer(
new TypedValue((int)LispDataType.Text, "c:SetUpLayers"));
// call the LISP fuction anf get the return value
ResultBuffer result = Autodesk.AutoCAD.ApplicationServices.Application.Invoke(args);
Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
ed.WriteMessage(result.ToString());
}
Although this code ran perfectly when I invoked it in a LISP program, I am getting this error when I try and run it from C#
; error: AutoCAD command rejected: "-layer"
Can someone help me out?
Thanks,
~Vonnie
Solved! Go to Solution.