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

Any examples of c# methods that call ACE lisp API's

13 REPLIES 13
Reply
Message 1 of 14
JeffatSJE
1035 Views, 13 Replies

Any examples of c# methods that call ACE lisp API's

Looking for a c# example code that calls an AutoCAD Electrical lisp routine that accepts parameters:

(c:wd_insym2 sym xy scl options)

sym Symbol block name (AcadE's search path is used when full path name is omitted). Block name is auto-adjusted, if possible, to align with an underlying wire.
xy xy insertion point coordinate, nil=user prompted for insertion point.
scl scale (nil=1.0)
options 1's bit set = pop open "INSERT/EDIT" dialog box after insertion.
2's bit set = return "handle" of inserted symbol (otherwise return entity name).
4's bit set = (and when 1's bit = 0) suppress parent component or terminal tag auto-generation.
8's bit set = allow motor angled connections to go to non-wire LINE entity (used by CIRC BLDR).


Returns
ent name or "handle" (see "options") of inserted symbol or nil if fail.

Description
User hook into the INS COMPONENT command. All data is supplied on the command line with optional EDIT dialog box popping up after symbol inserts. Component automatically breaks any underlying wire(s), new wire number generates on new wire segment (if required), component tag automatically generates based on inserted line ref or next available sequential.

Example
To insert symbol "HPB11" into a wire at XY loc 5,6.25 at default scale and suppress popping up the INS/EDIT dialog box afterwards.

(setq new_entname (c:wd_insym2 "HPB11" (list 5.0 6.25) nil nil))


I want to be able to be able to pass the method a block name and update other attributes after the block is inserted. I have tride the following:
Document adoc = Application.DocumentManager.MdiActiveDocument;
adoc.SendStringToExecute("(command (InsertBlock (setq new_entname (c:wd_insym2 \"HPB11\" nil nil nil))))\r",true ,false ,true );

which seems to work but would like to know if there is a better way. The example in the .net developer guide only shows how to call a method form the applications command line.

Thanks,
J.
13 REPLIES 13
Message 2 of 14
Anonymous
in reply to: JeffatSJE

Search this newsgroup for 'acedInvoke'

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2010

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6358185@discussion.autodesk.com...
Looking for a c# example code that calls an AutoCAD Electrical lisp routine that
accepts parameters:

(c:wd_insym2 sym xy scl options)

sym Symbol block name (AcadE's search path is used when full path name is
omitted). Block name is auto-adjusted, if possible, to align with an underlying
wire.
xy xy insertion point coordinate, nil=user prompted for insertion point.
scl scale (nil=1.0)
options 1's bit set = pop open "INSERT/EDIT" dialog box after insertion.
2's bit set = return "handle" of inserted symbol (otherwise return entity name).
4's bit set = (and when 1's bit = 0) suppress parent component or terminal tag
auto-generation.
8's bit set = allow motor angled connections to go to non-wire LINE entity (used
by CIRC BLDR).


Returns
ent name or "handle" (see "options") of inserted symbol or nil if fail.

Description
User hook into the INS COMPONENT command. All data is supplied on the command
line with optional EDIT dialog box popping up after symbol inserts. Component
automatically breaks any underlying wire(s), new wire number generates on new
wire segment (if required), component tag automatically generates based on
inserted line ref or next available sequential.

Example
To insert symbol "HPB11" into a wire at XY loc 5,6.25 at default scale and
suppress popping up the INS/EDIT dialog box afterwards.

(setq new_entname (c:wd_insym2 "HPB11" (list 5.0 6.25) nil nil))


I want to be able to be able to pass the method a block name and update other
attributes after the block is inserted. I have tride the following:
Document adoc =
Application.DocumentManager.MdiActiveDocument;
adoc.SendStringToExecute("(command (InsertBlock (setq
new_entname (c:wd_insym2 \"HPB11\" nil nil nil))))\r",true ,false ,true );

which seems to work but would like to know if there is a better way. The example
in the .net developer guide only shows how to call a method form the
applications command line.

Thanks,
J.
Message 3 of 14
JeffatSJE
in reply to: JeffatSJE

Thanks Tony,

I have tried using the following code you posted in the following thread :

http://discussion.autodesk.com/forums/message.jspa?messageID=5094885&tstart=0

I got it to work for the most part but when I send a nil for the insertion point, which tells the lisp function to prompt the user for an insertion point the program hangs. Is there an issue with using acedinvoke on lisp routines that require input?


thanks again
J.
Message 4 of 14
Anonymous
in reply to: JeffatSJE

Post your code.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6365866@discussion.autodesk.com...
Thanks Tony,

I have tried using the following code you posted in the following thread :

http://discussion.autodesk.com/forums/message.jspa?messageID=5094885&tstart=0

I got it to work for the most part but when I send a nil for the insertion
point, which tells the lisp function to prompt the user for an insertion point
the program hangs. Is there an issue with using acedinvoke on lisp routines that
require input?


thanks again
J.
Message 5 of 14
JeffatSJE
in reply to: JeffatSJE


public const int RTLONG = 5010; // adscodes.h
public const int RTSTR = 5005;
public const int RTNORM = 5100;
public const int RTNIL = 5019;
public const int RTLB = 5016;
public const int RTLE = 5017;
public const int RTREAL = 5001;
public const int RTPOINT = 5002;

[CommandMethod("testinvoke")]
public static void AcedInvokeSample()
{
for (int i = 0; i < 3; i++)
{
TestInvokeLisp("c:wd_insym2", "HPB11", 0, 0, 1.0, "nil");
}

}

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl)]
extern static private int acedInvoke(IntPtr args, out IntPtr result);

// Helper for acedInvoke()

public static ResultBuffer InvokeLisp(ResultBuffer args, ref int stat)
{
IntPtr rb = IntPtr.Zero;
stat = acedInvoke(args.UnmanagedObject, out rb);
if (stat == (int)PromptStatus.OK && rb != IntPtr.Zero)
return (ResultBuffer)
DisposableWrapper.Create(typeof(ResultBuffer), rb, true);
return null;
}

static void PrintResbuf(ResultBuffer rb)
{
string s = "\n-----------------------------";
foreach (TypedValue val in rb)
s += string.Format("\n{0} -> {1}", val.TypeCode,
val.Value.ToString());
s += "\n-----------------------------";
AcadApp.DocumentManager.MdiActiveDocument.
Editor.WriteMessage(s);
}

public static void TestInvokeLisp(string mycommand, string myblock, double mypointx, double mypointy, double myscale, string myoptions)
{
ResultBuffer args = new ResultBuffer();
int stat = 0;

string mypointnil = "nil";

args.Add(new TypedValue(RTSTR, mycommand));
args.Add(new TypedValue(RTSTR, myblock));
if (mypointx == 0 && mypointy == 0)
{
args.Add(new TypedValue(RTNIL, mypointnil));
}
else
{
args.Add(new TypedValue(RTLB, -1));
args.Add(new TypedValue(RTREAL, mypointx));
args.Add(new TypedValue(RTREAL, mypointy));
args.Add(new TypedValue(RTLE, -1));
}
args.Add(new TypedValue(RTREAL, myscale));
args.Add(new TypedValue(RTNIL, myoptions));

//args.Add(new TypedValue(RTLONG, 200));

ResultBuffer res = InvokeLisp(args, ref stat);
if (stat == RTNORM && res != null)
{
PrintResbuf(res);
res.Dispose();
}
}



I can work arround the hang by prompting the user for the insertpoint first, but I would rather not. I'm not sure how anyone without ACE can test this the lisp function is part of the API.

Thanks
J.
Message 6 of 14
Anonymous
in reply to: JeffatSJE

Sorry, I can't read it unformatted.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6366301@discussion.autodesk.com...
public const int RTLONG = 5010; // adscodes.h public const int RTSTR = 5005;
public const int RTNORM = 5100; public const int RTNIL = 5019; public const int
RTLB = 5016; public const int RTLE = 5017; public const int RTREAL = 5001;
public const int RTPOINT = 5002; [CommandMethod("testinvoke")] public static
void AcedInvokeSample() { for (int i = 0; i < 3; i++) {
TestInvokeLisp("c:wd_insym2", "HPB11", 0, 0, 1.0, "nil"); } }
[System.Security.SuppressUnmanagedCodeSecurity] [DllImport("acad.exe",
CallingConvention = CallingConvention.Cdecl)] extern static private int
acedInvoke(IntPtr args, out IntPtr result); // Helper for acedInvoke() public
static ResultBuffer InvokeLisp(ResultBuffer args, ref int stat) { IntPtr rb =
IntPtr.Zero; stat = acedInvoke(args.UnmanagedObject, out rb); if (stat ==
(int)PromptStatus.OK && rb != IntPtr.Zero) return (ResultBuffer)
DisposableWrapper.Create(typeof(ResultBuffer), rb, true); return null; } static
void PrintResbuf(ResultBuffer rb) { string s =
"\n-----------------------------"; foreach (TypedValue val in rb) s +=
string.Format("\n{0} -> {1}", val.TypeCode, val.Value.ToString()); s +=
"\n-----------------------------"; AcadApp.DocumentManager.MdiActiveDocument.
Editor.WriteMessage(s); } public static void TestInvokeLisp(string mycommand,
string myblock, double mypointx, double mypointy, double myscale, string
myoptions) { ResultBuffer args = new ResultBuffer(); int stat = 0; string
mypointnil = "nil"; args.Add(new TypedValue(RTSTR, mycommand)); args.Add(new
TypedValue(RTSTR, myblock)); if (mypointx == 0 && mypointy == 0) { args.Add(new
TypedValue(RTNIL, mypointnil)); } else { args.Add(new TypedValue(RTLB, -1));
args.Add(new TypedValue(RTREAL, mypointx)); args.Add(new TypedValue(RTREAL,
mypointy)); args.Add(new TypedValue(RTLE, -1)); } args.Add(new
TypedValue(RTREAL, myscale)); args.Add(new TypedValue(RTNIL, myoptions));
//args.Add(new TypedValue(RTLONG, 200)); ResultBuffer res = InvokeLisp(args, ref
stat); if (stat == RTNORM && res != null) { PrintResbuf(res); res.Dispose(); } }
I can work arround the hang by prompting the user for the insertpoint first, but
I would rather not. I'm not sure how anyone without ACE can test this the lisp
function is part of the API. Thanks J.
Message 7 of 14
JeffatSJE
in reply to: JeffatSJE

{code}
//adscodes.h
public const int RTLONG = 5010;
public const int RTSTR = 5005;
public const int RTNORM = 5100;
public const int RTNIL = 5019;
public const int RTLB = 5016;
public const int RTLE = 5017;
public const int RTREAL = 5001;
public const int RTPOINT = 5002;

[CommandMethod("testinvoke")]
public static void AcedInvokeSample()
{
for (int i = 0; i < 3; i++)
{
TestInvokeLisp("c:wd_insym2", "HPB11",0, 0, 1.0, "nil");
}
}

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl)]
extern static private int acedInvoke(IntPtr args, out IntPtr result);

// Helper for acedInvoke()

public static ResultBuffer InvokeLisp(ResultBuffer args, ref int stat)
{
IntPtr rb = IntPtr.Zero;
stat = acedInvoke(args.UnmanagedObject, out rb);
if (stat == (int)PromptStatus.OK && rb != IntPtr.Zero)
return (ResultBuffer)
DisposableWrapper.Create(typeof(ResultBuffer), rb, true);
return null;
}

static void PrintResbuf(ResultBuffer rb)
{
string s = "\n-----------------------------";
foreach (TypedValue val in rb)
s += string.Format("\n{0} -> {1}", val.TypeCode,
val.Value.ToString());
s += "\n-----------------------------";
AcadApp.DocumentManager.MdiActiveDocument.
Editor.WriteMessage(s);
}

public static void TestInvokeLisp(string mycommand, string myblock, double mypointx,
double mypointy, double myscale, string myoptions)
{
ResultBuffer args = new ResultBuffer();
int stat = 0;

string mypointnil = "nil";

args.Add(new TypedValue(RTSTR, mycommand));
args.Add(new TypedValue(RTSTR, myblock));
if (mypointx == 0 && mypointy == 0)
{
args.Add(new TypedValue(RTNIL, mypointnil));
}
else
{

args.Add(new TypedValue(RTLB, -1));
args.Add(new TypedValue(RTREAL, mypointx));
args.Add(new TypedValue(RTREAL, mypointy));
args.Add(new TypedValue(RTLE, -1));
}
args.Add(new TypedValue(RTREAL, myscale));
args.Add(new TypedValue(RTNIL, myoptions));

ResultBuffer res = InvokeLisp(args, ref stat);
if (stat == RTNORM && res != null)
{
PrintResbuf(res);
res.Dispose();
}
}
{code}

added {code} tags hope this helps,
Pretty colors 🙂
Message 8 of 14
Anonymous
in reply to: JeffatSJE

Points aren't passed as lists, they're passed as points.

{code}

Point3d inspoint = new Point3d( 0.0, 0.0, 0.0 );
double scale = 1.0;

ResultBuffer buffer = new ResultBuffer();

buffer.Add( new TypedValue( (int) LispDataType.Text, "C:WD_INSYM2" ) );
buffer.Add( new TypedValue( (int) LispDataType.Text, "HPB11" ) );
buffer.Add( new TypedValue( (int) LispDataType.Point3d, inspoint ));
buffer.Add( new TypedValue( (int) LispDataType.Double, scale ) );
buffer.Add( new TypedValue( (int) LispDataType.Nil ) );

{code}

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6366482@discussion.autodesk.com...
{code}
//adscodes.h
public const int RTLONG = 5010;
public const int RTSTR = 5005;
public const int RTNORM = 5100;
public const int RTNIL = 5019;
public const int RTLB = 5016;
public const int RTLE = 5017;
public const int RTREAL = 5001;
public const int RTPOINT = 5002;

[CommandMethod("testinvoke")]
public static void AcedInvokeSample()
{
for (int i = 0; i < 3; i++)
{
TestInvokeLisp("c:wd_insym2", "HPB11",0, 0, 1.0, "nil");
}
}

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl)]
extern static private int acedInvoke(IntPtr args, out IntPtr result);

// Helper for acedInvoke()

public static ResultBuffer InvokeLisp(ResultBuffer args, ref int stat)
{
IntPtr rb = IntPtr.Zero;
stat = acedInvoke(args.UnmanagedObject, out rb);
if (stat == (int)PromptStatus.OK && rb != IntPtr.Zero)
return (ResultBuffer)
DisposableWrapper.Create(typeof(ResultBuffer), rb, true);
return null;
}

static void PrintResbuf(ResultBuffer rb)
{
string s = "\n-----------------------------";
foreach (TypedValue val in rb)
s += string.Format("\n{0} -> {1}", val.TypeCode,
val.Value.ToString());
s += "\n-----------------------------";
AcadApp.DocumentManager.MdiActiveDocument.
Editor.WriteMessage(s);
}

public static void TestInvokeLisp(string mycommand, string myblock,
double mypointx,
double mypointy, double myscale, string myoptions)
{
ResultBuffer args = new ResultBuffer();
int stat = 0;

string mypointnil = "nil";

args.Add(new TypedValue(RTSTR, mycommand));
args.Add(new TypedValue(RTSTR, myblock));
if (mypointx == 0 && mypointy == 0)
{
args.Add(new TypedValue(RTNIL, mypointnil));
}
else
{

args.Add(new TypedValue(RTLB, -1));
args.Add(new TypedValue(RTREAL, mypointx));
args.Add(new TypedValue(RTREAL, mypointy));
args.Add(new TypedValue(RTLE, -1));
}
args.Add(new TypedValue(RTREAL, myscale));
args.Add(new TypedValue(RTNIL, myoptions));

ResultBuffer res = InvokeLisp(args, ref stat);
if (stat == RTNORM && res != null)
{
PrintResbuf(res);
res.Dispose();
}
}
{code}

added {code} tags hope this helps,
Pretty colors 🙂
Message 9 of 14
JeffatSJE
in reply to: JeffatSJE

Still hangs if I give it a nil for the insert point. The example looks like it wants a list for the insert point. Regardless, sending it a nil tells the API to prompt for the insert point which it does, but just after I select a point the wire does not break and the system hangs.

Example
To insert symbol "HPB11" into a wire at XY loc 5,6.25 at default scale and
suppress popping up the INS/EDIT dialog box afterwards.

(setq new_entname (c:wd_insym2 "HPB11" (list 5.0 6.25) nil nil))

Thanks
J.
Message 10 of 14
Anonymous
in reply to: JeffatSJE

You can't use NIL for the insertion point.

The sample code I posted passes a Point3d for the insertion point, which is
converted to a list of 3 doubles on the LISP side.


--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6366691@discussion.autodesk.com...
Still hangs if I give it a nil for the insert point. The example looks like it
wants a list for the insert point. Regardless, sending it a nil tells the API to
prompt for the insert point which it does, but just after I select a point the
wire does not break and the system hangs.

Example
To insert symbol "HPB11" into a wire at XY loc 5,6.25 at default scale and
suppress popping up the INS/EDIT dialog box afterwards.

(setq new_entname (c:wd_insym2 "HPB11" (list 5.0 6.25) nil nil))

Thanks
J.
Message 11 of 14
JeffatSJE
in reply to: JeffatSJE

Point3d? How do I set the Point3d value to produce a nil on the lisp side 🙂

xy xy insertion point coordinate, nil=user prompted for insertion point.



Confused
J.
Message 12 of 14
Anonymous
in reply to: JeffatSJE

Rather than just telling me what you did, show the code.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6366812@discussion.autodesk.com...
Point3d? How do I set the Point3d value to produce a nil on the lisp side 🙂

xy xy insertion point coordinate, nil=user prompted for insertion point.



Confused
J.
Message 13 of 14
JeffatSJE
in reply to: JeffatSJE

My test code thus far:

{code}
public const int RTNORM = 5100;
[CommandMethod("testinvoke")]
public static void AcedInvokeSample()
{
for (int i = 0; i < 3; i++)
{

//Document acDoc = Application.DocumentManager.MdiActiveDocument;
//Database acCurDb = acDoc.Database;
//
//PromptPointResult pPtRes;
//PromptPointOptions pPtOpts = new PromptPointOptions("");

// Prompt for the insert point
//pPtOpts.Message = "\nPick Insert point: ";
//pPtRes = acDoc.Editor.GetPoint(pPtOpts);

//if (pPtRes.Status == PromptStatus.Cancel) break;

//Point3d ptInsert = pPtRes.Value;

double pointx = 0.0;
double pointy = 0.0;
//double pointz = 0.0;

TestInvokeLisp("c:wd_insym2", "HPB11", pointx, pointy, 1.0, "nil");
}

}

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl)]
extern static private int acedInvoke(IntPtr args, out IntPtr result);

// Helper for acedInvoke()

public static ResultBuffer InvokeLisp(ResultBuffer args, ref int stat)
{
IntPtr rb = IntPtr.Zero;
stat = acedInvoke(args.UnmanagedObject, out rb);
if (stat == (int)PromptStatus.OK && rb != IntPtr.Zero)
return (ResultBuffer)
DisposableWrapper.Create(typeof(ResultBuffer), rb, true);
return null;
}

static void PrintResbuf(ResultBuffer rb)
{
string s = "\n-----------------------------";
foreach (TypedValue val in rb)
s += string.Format("\n{0} -> {1}", val.TypeCode,
val.Value.ToString());
s += "\n-----------------------------";
AcadApp.DocumentManager.MdiActiveDocument.
Editor.WriteMessage(s);
}

public static void TestInvokeLisp(string mycommand, string myblock, double mypointx, double mypointy, double myscale, string myoptions)
{
//ResultBuffer args = new ResultBuffer();
int stat = 0;

//string mypointnil = "nil";
Point2d inspoint = new Point2d(mypointx, mypointy);
//double scale = 1.0;

ResultBuffer buffer = new ResultBuffer();

buffer.Add(new TypedValue((int)LispDataType.Text, mycommand));
buffer.Add(new TypedValue((int)LispDataType.Text, myblock));
if (mypointx == 0 && mypointy == 0)
{
buffer.Add(new TypedValue((int)LispDataType.Nil));
}
else
{
buffer.Add(new TypedValue((int)LispDataType.Point2d, inspoint));
}
buffer.Add(new TypedValue((int)LispDataType.Double, myscale));
buffer.Add(new TypedValue((int)LispDataType.Nil));

ResultBuffer res = InvokeLisp(buffer, ref stat);
if (stat == RTNORM && res != null)
{
//PrintResbuf(res);
res.Dispose();
}
}
{code}
Message 14 of 14
Anonymous
in reply to: JeffatSJE

Instead of defining your 'TESTINVOKE' command using
[CommandMethod("TESTINVOKE")], try doing this instead:

{code}

[LispFunction( "C:TESTINVOKE" )]
public static object AcedInvokeSample(ResultBuffer args)
{
//....

return null;
}

{code}

Leave everything else as-is, and see if that fixes it.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD
Supporting AutoCAD 2000 through 2011

http://www.acadxtabs.com

Email: string.Format("{0}@{1}.com", "tonyt", "caddzone");

wrote in message news:6367173@discussion.autodesk.com...
My test code thus far:

{code}
public const int RTNORM = 5100;
[CommandMethod("testinvoke")]
public static void AcedInvokeSample()
{
for (int i = 0; i < 3; i++)
{

//Document acDoc = Application.DocumentManager.MdiActiveDocument;
//Database acCurDb = acDoc.Database;
//
//PromptPointResult pPtRes;
//PromptPointOptions pPtOpts = new PromptPointOptions("");

// Prompt for the insert point
//pPtOpts.Message = "\nPick Insert point: ";
//pPtRes = acDoc.Editor.GetPoint(pPtOpts);

//if (pPtRes.Status == PromptStatus.Cancel) break;

//Point3d ptInsert = pPtRes.Value;

double pointx = 0.0;
double pointy = 0.0;
//double pointz = 0.0;

TestInvokeLisp("c:wd_insym2", "HPB11", pointx, pointy, 1.0,
"nil");
}

}

[System.Security.SuppressUnmanagedCodeSecurity]
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl)]
extern static private int acedInvoke(IntPtr args, out IntPtr result);

// Helper for acedInvoke()

public static ResultBuffer InvokeLisp(ResultBuffer args, ref int stat)
{
IntPtr rb = IntPtr.Zero;
stat = acedInvoke(args.UnmanagedObject, out rb);
if (stat == (int)PromptStatus.OK && rb != IntPtr.Zero)
return (ResultBuffer)
DisposableWrapper.Create(typeof(ResultBuffer), rb, true);
return null;
}

static void PrintResbuf(ResultBuffer rb)
{
string s = "\n-----------------------------";
foreach (TypedValue val in rb)
s += string.Format("\n{0} -> {1}", val.TypeCode,
val.Value.ToString());
s += "\n-----------------------------";
AcadApp.DocumentManager.MdiActiveDocument.
Editor.WriteMessage(s);
}

public static void TestInvokeLisp(string mycommand, string myblock,
double mypointx, double mypointy, double myscale, string myoptions)
{
//ResultBuffer args = new ResultBuffer();
int stat = 0;

//string mypointnil = "nil";
Point2d inspoint = new Point2d(mypointx, mypointy);
//double scale = 1.0;

ResultBuffer buffer = new ResultBuffer();

buffer.Add(new TypedValue((int)LispDataType.Text, mycommand));
buffer.Add(new TypedValue((int)LispDataType.Text, myblock));
if (mypointx == 0 && mypointy == 0)
{
buffer.Add(new TypedValue((int)LispDataType.Nil));
}
else
{
buffer.Add(new TypedValue((int)LispDataType.Point2d, inspoint));
}
buffer.Add(new TypedValue((int)LispDataType.Double, myscale));
buffer.Add(new TypedValue((int)LispDataType.Nil));

ResultBuffer res = InvokeLisp(buffer, ref stat);
if (stat == RTNORM && res != null)
{
//PrintResbuf(res);
res.Dispose();
}
}
{code}

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