.NET
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
acedcomman d function in .Net managed classes
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
1137 Views, 9 Replies
05-21-2005 04:13 AM
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
function acedcommand in the .NET managed classes?
*Albert Szilvasy
Re: acedcomman d function in .Net managed classes
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-22-2005 02:23 PM in reply to:
tangferry
There's none. This function isn't exposed via the .NET API. The function
that comes closest is Document.SendStringToExecute.
Albert
wrote in message news:4852689@discussion.autodesk.com...
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
that comes closest is Document.SendStringToExecute.
Albert
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
*Tony Tanzillo
Re: acedcomman d function in .Net managed classes
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-23-2005 01:48 AM in reply to:
tangferry
They didn't expose it.
Give the following a go, and see what happens.
Note that the same exact rules that govern the use
of acedCommand() in native ObjectARX apply here
(namely, you can't use it from the Application context).
////////////////// CommandSample.cs ///////////////////
// Copyright (c)2005 Tony Tanzillo, all rights reserved
//
// Shows how to execute commands without resorting
// to the kludgy SendStringToExecute method.
//
// The command 'COMMANDTEST' draws a circle
// centered at 2,2,0 with a radius of 4.0 units.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
public class CommandSample
{
const Int32 RTREAL = 5001;
const Int32 RTSTR = 5005;
const Int32 RT3DPOINT = 5009;
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="acedCmd")]
extern static int acedCmd(IntPtr pResbuf);
unsafe static int Command(ResultBuffer args)
{
if( ! AcadApp.DocumentManager.IsApplicationContext )
return acedCmd((IntPtr) args.UnmanagedObject.ToPointer());
else
return 0;
}
[Autodesk.AutoCAD.Runtime.CommandMethod("COMMANDTE ST")]
public static void CommandTest()
{
ResultBuffer args = new ResultBuffer();
args.Add(new TypedValue(RTSTR, "._circle"));
args.Add(new TypedValue(RT3DPOINT, new Point3d(2.0, 2.0, 0.0)));
args.Add(new TypedValue(RTREAL, 4.0));
Command(args);
}
}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
wrote in message news:4852689@discussion.autodesk.com...
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
Give the following a go, and see what happens.
Note that the same exact rules that govern the use
of acedCommand() in native ObjectARX apply here
(namely, you can't use it from the Application context).
////////////////// CommandSample.cs ///////////////////
// Copyright (c)2005 Tony Tanzillo, all rights reserved
//
// Shows how to execute commands without resorting
// to the kludgy SendStringToExecute method.
//
// The command 'COMMANDTEST' draws a circle
// centered at 2,2,0 with a radius of 4.0 units.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
public class CommandSample
{
const Int32 RTREAL = 5001;
const Int32 RTSTR = 5005;
const Int32 RT3DPOINT = 5009;
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="acedCmd")]
extern static int acedCmd(IntPtr pResbuf);
unsafe static int Command(ResultBuffer args)
{
if( ! AcadApp.DocumentManager.IsApplicationContext )
return acedCmd((IntPtr) args.UnmanagedObject.ToPointer());
else
return 0;
}
[Autodesk.AutoCAD.Runtime.CommandMethod("COMMANDTE
public static void CommandTest()
{
ResultBuffer args = new ResultBuffer();
args.Add(new TypedValue(RTSTR, "._circle"));
args.Add(new TypedValue(RT3DPOINT, new Point3d(2.0, 2.0, 0.0)));
args.Add(new TypedValue(RTREAL, 4.0));
Command(args);
}
}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
Re: acedcomman d function in .Net managed classes
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-23-2005 06:29 AM in reply to:
tangferry
can you tell me how to use Document.SendStringToExecute functioon?An example is not bad.
*Edward Merkins
Re: acedcomman d function in .Net managed classes
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-27-2005 08:37 AM in reply to:
tangferry
I am trying to learn C# based on examples that I find in this discussion
group. With that said, based on the example below, I am receiving the error
message: The name 'acedCmd' does not exist in the class or namespace
'AcadTest01.CommandSample' Can someone help?
"Tony Tanzillo" wrote in message
news:4853121@discussion.autodesk.com...
They didn't expose it.
Give the following a go, and see what happens.
Note that the same exact rules that govern the use
of acedCommand() in native ObjectARX apply here
(namely, you can't use it from the Application context).
////////////////// CommandSample.cs ///////////////////
// Copyright (c)2005 Tony Tanzillo, all rights reserved
//
// Shows how to execute commands without resorting
// to the kludgy SendStringToExecute method.
//
// The command 'COMMANDTEST' draws a circle
// centered at 2,2,0 with a radius of 4.0 units.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
public class CommandSample
{
const Int32 RTREAL = 5001;
const Int32 RTSTR = 5005;
const Int32 RT3DPOINT = 5009;
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="acedCmd")]
extern static int acedCmd(IntPtr pResbuf);
unsafe static int Command(ResultBuffer args)
{
if( ! AcadApp.DocumentManager.IsApplicationContext )
return acedCmd((IntPtr) args.UnmanagedObject.ToPointer());
else
return 0;
}
[Autodesk.AutoCAD.Runtime.CommandMethod("COMMANDTE ST")]
public static void CommandTest()
{
ResultBuffer args = new ResultBuffer();
args.Add(new TypedValue(RTSTR, "._circle"));
args.Add(new TypedValue(RT3DPOINT, new Point3d(2.0, 2.0, 0.0)));
args.Add(new TypedValue(RTREAL, 4.0));
Command(args);
}
}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
wrote in message news:4852689@discussion.autodesk.com...
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
group. With that said, based on the example below, I am receiving the error
message: The name 'acedCmd' does not exist in the class or namespace
'AcadTest01.CommandSample' Can someone help?
"Tony Tanzillo"
news:4853121@discussion.autodesk.com...
They didn't expose it.
Give the following a go, and see what happens.
Note that the same exact rules that govern the use
of acedCommand() in native ObjectARX apply here
(namely, you can't use it from the Application context).
////////////////// CommandSample.cs ///////////////////
// Copyright (c)2005 Tony Tanzillo, all rights reserved
//
// Shows how to execute commands without resorting
// to the kludgy SendStringToExecute method.
//
// The command 'COMMANDTEST' draws a circle
// centered at 2,2,0 with a radius of 4.0 units.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
public class CommandSample
{
const Int32 RTREAL = 5001;
const Int32 RTSTR = 5005;
const Int32 RT3DPOINT = 5009;
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="acedCmd")]
extern static int acedCmd(IntPtr pResbuf);
unsafe static int Command(ResultBuffer args)
{
if( ! AcadApp.DocumentManager.IsApplicationContext )
return acedCmd((IntPtr) args.UnmanagedObject.ToPointer());
else
return 0;
}
[Autodesk.AutoCAD.Runtime.CommandMethod("COMMANDTE
public static void CommandTest()
{
ResultBuffer args = new ResultBuffer();
args.Add(new TypedValue(RTSTR, "._circle"));
args.Add(new TypedValue(RT3DPOINT, new Point3d(2.0, 2.0, 0.0)));
args.Add(new TypedValue(RTREAL, 4.0));
Command(args);
}
}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
Re: acedcomman d function in .Net managed classes
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-27-2005 08:54 AM in reply to:
tangferry
Something like this:
Application.DocumentManager.MdiActiveDocument.Send StringToExecute("_Zoom _E ", False, True, False)
Application.DocumentManager.MdiActiveDocument.Send
*J. Daniel Smith
Re: acedcomman d function in .Net managed classes
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-27-2005 09:22 AM in reply to:
tangferry
You'll probably have more success "trying to learn C#" at places like
http://msdn.microsoft.com/vcsharp/gettingstarted/d efault.aspx; this
discussion group more-or-less assumes knowledge of a .NET language.
Dan
"Edward Merkins" wrote in message
news:4858845@discussion.autodesk.com...
I am trying to learn C# based on examples that I find in this discussion
group. With that said, based on the example below, I am receiving the error
message: The name 'acedCmd' does not exist in the class or namespace
'AcadTest01.CommandSample' Can someone help?
"Tony Tanzillo" wrote in message
news:4853121@discussion.autodesk.com...
They didn't expose it.
Give the following a go, and see what happens.
Note that the same exact rules that govern the use
of acedCommand() in native ObjectARX apply here
(namely, you can't use it from the Application context).
////////////////// CommandSample.cs ///////////////////
// Copyright (c)2005 Tony Tanzillo, all rights reserved
//
// Shows how to execute commands without resorting
// to the kludgy SendStringToExecute method.
//
// The command 'COMMANDTEST' draws a circle
// centered at 2,2,0 with a radius of 4.0 units.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
public class CommandSample
{
const Int32 RTREAL = 5001;
const Int32 RTSTR = 5005;
const Int32 RT3DPOINT = 5009;
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="acedCmd")]
extern static int acedCmd(IntPtr pResbuf);
unsafe static int Command(ResultBuffer args)
{
if( ! AcadApp.DocumentManager.IsApplicationContext )
return acedCmd((IntPtr) args.UnmanagedObject.ToPointer());
else
return 0;
}
[Autodesk.AutoCAD.Runtime.CommandMethod("COMMANDTE ST")]
public static void CommandTest()
{
ResultBuffer args = new ResultBuffer();
args.Add(new TypedValue(RTSTR, "._circle"));
args.Add(new TypedValue(RT3DPOINT, new Point3d(2.0, 2.0, 0.0)));
args.Add(new TypedValue(RTREAL, 4.0));
Command(args);
}
}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
wrote in message news:4852689@discussion.autodesk.com...
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
http://msdn.microsoft.com/vcsharp/gettingstarted/d
discussion group more-or-less assumes knowledge of a .NET language.
Dan
"Edward Merkins"
news:4858845@discussion.autodesk.com...
I am trying to learn C# based on examples that I find in this discussion
group. With that said, based on the example below, I am receiving the error
message: The name 'acedCmd' does not exist in the class or namespace
'AcadTest01.CommandSample' Can someone help?
"Tony Tanzillo"
news:4853121@discussion.autodesk.com...
They didn't expose it.
Give the following a go, and see what happens.
Note that the same exact rules that govern the use
of acedCommand() in native ObjectARX apply here
(namely, you can't use it from the Application context).
////////////////// CommandSample.cs ///////////////////
// Copyright (c)2005 Tony Tanzillo, all rights reserved
//
// Shows how to execute commands without resorting
// to the kludgy SendStringToExecute method.
//
// The command 'COMMANDTEST' draws a circle
// centered at 2,2,0 with a radius of 4.0 units.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
public class CommandSample
{
const Int32 RTREAL = 5001;
const Int32 RTSTR = 5005;
const Int32 RT3DPOINT = 5009;
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="acedCmd")]
extern static int acedCmd(IntPtr pResbuf);
unsafe static int Command(ResultBuffer args)
{
if( ! AcadApp.DocumentManager.IsApplicationContext )
return acedCmd((IntPtr) args.UnmanagedObject.ToPointer());
else
return 0;
}
[Autodesk.AutoCAD.Runtime.CommandMethod("COMMANDTE
public static void CommandTest()
{
ResultBuffer args = new ResultBuffer();
args.Add(new TypedValue(RTSTR, "._circle"));
args.Add(new TypedValue(RT3DPOINT, new Point3d(2.0, 2.0, 0.0)));
args.Add(new TypedValue(RTREAL, 4.0));
Command(args);
}
}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
*Edward Merkins
Re: acedcomman d function in .Net managed classes
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-27-2005 09:37 AM in reply to:
tangferry
Never mind - I had a typo.
"Edward Merkins" wrote in message
news:4858845@discussion.autodesk.com...
I am trying to learn C# based on examples that I find in this discussion
group. With that said, based on the example below, I am receiving the error
message: The name 'acedCmd' does not exist in the class or namespace
'AcadTest01.CommandSample' Can someone help?
"Tony Tanzillo" wrote in message
news:4853121@discussion.autodesk.com...
They didn't expose it.
Give the following a go, and see what happens.
Note that the same exact rules that govern the use
of acedCommand() in native ObjectARX apply here
(namely, you can't use it from the Application context).
////////////////// CommandSample.cs ///////////////////
// Copyright (c)2005 Tony Tanzillo, all rights reserved
//
// Shows how to execute commands without resorting
// to the kludgy SendStringToExecute method.
//
// The command 'COMMANDTEST' draws a circle
// centered at 2,2,0 with a radius of 4.0 units.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
public class CommandSample
{
const Int32 RTREAL = 5001;
const Int32 RTSTR = 5005;
const Int32 RT3DPOINT = 5009;
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="acedCmd")]
extern static int acedCmd(IntPtr pResbuf);
unsafe static int Command(ResultBuffer args)
{
if( ! AcadApp.DocumentManager.IsApplicationContext )
return acedCmd((IntPtr) args.UnmanagedObject.ToPointer());
else
return 0;
}
[Autodesk.AutoCAD.Runtime.CommandMethod("COMMANDTE ST")]
public static void CommandTest()
{
ResultBuffer args = new ResultBuffer();
args.Add(new TypedValue(RTSTR, "._circle"));
args.Add(new TypedValue(RT3DPOINT, new Point3d(2.0, 2.0, 0.0)));
args.Add(new TypedValue(RTREAL, 4.0));
Command(args);
}
}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
wrote in message news:4852689@discussion.autodesk.com...
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
"Edward Merkins"
news:4858845@discussion.autodesk.com...
I am trying to learn C# based on examples that I find in this discussion
group. With that said, based on the example below, I am receiving the error
message: The name 'acedCmd' does not exist in the class or namespace
'AcadTest01.CommandSample' Can someone help?
"Tony Tanzillo"
news:4853121@discussion.autodesk.com...
They didn't expose it.
Give the following a go, and see what happens.
Note that the same exact rules that govern the use
of acedCommand() in native ObjectARX apply here
(namely, you can't use it from the Application context).
////////////////// CommandSample.cs ///////////////////
// Copyright (c)2005 Tony Tanzillo, all rights reserved
//
// Shows how to execute commands without resorting
// to the kludgy SendStringToExecute method.
//
// The command 'COMMANDTEST' draws a circle
// centered at 2,2,0 with a radius of 4.0 units.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
public class CommandSample
{
const Int32 RTREAL = 5001;
const Int32 RTSTR = 5005;
const Int32 RT3DPOINT = 5009;
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="acedCmd")]
extern static int acedCmd(IntPtr pResbuf);
unsafe static int Command(ResultBuffer args)
{
if( ! AcadApp.DocumentManager.IsApplicationContext )
return acedCmd((IntPtr) args.UnmanagedObject.ToPointer());
else
return 0;
}
[Autodesk.AutoCAD.Runtime.CommandMethod("COMMANDTE
public static void CommandTest()
{
ResultBuffer args = new ResultBuffer();
args.Add(new TypedValue(RTSTR, "._circle"));
args.Add(new TypedValue(RT3DPOINT, new Point3d(2.0, 2.0, 0.0)));
args.Add(new TypedValue(RTREAL, 4.0));
Command(args);
}
}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
*Edward Merkins
Re: acedcomman d function in .Net managed classes
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
05-27-2005 09:42 AM in reply to:
tangferry
So I take it you didn't no the answer. Don't post responses if you don't
have anything intelligent to say! I am already somewhat familiar with C#.
Just like the majority of people in this discussion group, I am trying to
get a better understanding of using C# with AutoCAD.
"J. Daniel Smith" wrote in message
news:4858917@discussion.autodesk.com...
You'll probably have more success "trying to learn C#" at places like
http://msdn.microsoft.com/vcsharp/gettingstarted/d efault.aspx; this
discussion group more-or-less assumes knowledge of a .NET language.
Dan
"Edward Merkins" wrote in message
news:4858845@discussion.autodesk.com...
I am trying to learn C# based on examples that I find in this discussion
group. With that said, based on the example below, I am receiving the error
message: The name 'acedCmd' does not exist in the class or namespace
'AcadTest01.CommandSample' Can someone help?
"Tony Tanzillo" wrote in message
news:4853121@discussion.autodesk.com...
They didn't expose it.
Give the following a go, and see what happens.
Note that the same exact rules that govern the use
of acedCommand() in native ObjectARX apply here
(namely, you can't use it from the Application context).
////////////////// CommandSample.cs ///////////////////
// Copyright (c)2005 Tony Tanzillo, all rights reserved
//
// Shows how to execute commands without resorting
// to the kludgy SendStringToExecute method.
//
// The command 'COMMANDTEST' draws a circle
// centered at 2,2,0 with a radius of 4.0 units.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
public class CommandSample
{
const Int32 RTREAL = 5001;
const Int32 RTSTR = 5005;
const Int32 RT3DPOINT = 5009;
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="acedCmd")]
extern static int acedCmd(IntPtr pResbuf);
unsafe static int Command(ResultBuffer args)
{
if( ! AcadApp.DocumentManager.IsApplicationContext )
return acedCmd((IntPtr) args.UnmanagedObject.ToPointer());
else
return 0;
}
[Autodesk.AutoCAD.Runtime.CommandMethod("COMMANDTE ST")]
public static void CommandTest()
{
ResultBuffer args = new ResultBuffer();
args.Add(new TypedValue(RTSTR, "._circle"));
args.Add(new TypedValue(RT3DPOINT, new Point3d(2.0, 2.0, 0.0)));
args.Add(new TypedValue(RTREAL, 4.0));
Command(args);
}
}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
wrote in message news:4852689@discussion.autodesk.com...
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
have anything intelligent to say! I am already somewhat familiar with C#.
Just like the majority of people in this discussion group, I am trying to
get a better understanding of using C# with AutoCAD.
"J. Daniel Smith"
news:4858917@discussion.autodesk.com...
You'll probably have more success "trying to learn C#" at places like
http://msdn.microsoft.com/vcsharp/gettingstarted/d
discussion group more-or-less assumes knowledge of a .NET language.
Dan
"Edward Merkins"
news:4858845@discussion.autodesk.com...
I am trying to learn C# based on examples that I find in this discussion
group. With that said, based on the example below, I am receiving the error
message: The name 'acedCmd' does not exist in the class or namespace
'AcadTest01.CommandSample' Can someone help?
"Tony Tanzillo"
news:4853121@discussion.autodesk.com...
They didn't expose it.
Give the following a go, and see what happens.
Note that the same exact rules that govern the use
of acedCommand() in native ObjectARX apply here
(namely, you can't use it from the Application context).
////////////////// CommandSample.cs ///////////////////
// Copyright (c)2005 Tony Tanzillo, all rights reserved
//
// Shows how to execute commands without resorting
// to the kludgy SendStringToExecute method.
//
// The command 'COMMANDTEST' draws a circle
// centered at 2,2,0 with a radius of 4.0 units.
using System;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;
public class CommandSample
{
const Int32 RTREAL = 5001;
const Int32 RTSTR = 5005;
const Int32 RT3DPOINT = 5009;
[DllImport("acad.exe", CallingConvention = CallingConvention.Cdecl,
EntryPoint="acedCmd")]
extern static int acedCmd(IntPtr pResbuf);
unsafe static int Command(ResultBuffer args)
{
if( ! AcadApp.DocumentManager.IsApplicationContext )
return acedCmd((IntPtr) args.UnmanagedObject.ToPointer());
else
return 0;
}
[Autodesk.AutoCAD.Runtime.CommandMethod("COMMANDTE
public static void CommandTest()
{
ResultBuffer args = new ResultBuffer();
args.Add(new TypedValue(RTSTR, "._circle"));
args.Add(new TypedValue(RT3DPOINT, new Point3d(2.0, 2.0, 0.0)));
args.Add(new TypedValue(RTREAL, 4.0));
Command(args);
}
}
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006
http://www.acadxtabs.com
What is the corresponding functions or classes for thesethe arx Global
function acedcommand in the .NET managed classes?
*Russ Green
Re: acedcomman d function in .Net managed classes
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
01-05-2006 05:48 AM in reply to:
tangferry
Can Document.SendStringToExecute() be used (and executed) from within an
application? I'm trying to write a VB.NET batch script processor and what
seems to be happening is that the script doesn'tr execute until my app has
finished. When I've tested my DLL code on a single DWG file my app runs all
the way through, first setting FILEDIA to 0 then back to 1 but the command
my app sends as a string doesn't execute until my app has finished, so
FILEDIA is set back to 1 and the user has to browse for the script file to
run.
Is there a reson why SendCommand hasn't been exposed in the .NET API?
I've successfully built a version of my app as an exe using COM but I'm
trying to get my head into the .NET API. The code I have so far follows:
THIS WORKS IN MY EXE
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common
Public WithEvents AcadApp As Autodesk.AutoCAD.Interop.AcadApplication
Dim AcadDoc As Autodesk.AutoCAD.Interop.AcadDocument
Sub ProcessDwg(ByVal ThisDwg As String)
'open the file
AcadDoc.Application.Documents.Open(ThisDwg)
AcadDoc = AcadApp.ActiveDocument
'AcadApp.ZoomExtents()
'process the script
AcadDoc.SetVariable("filedia", 0)
AcadDoc.SendCommand("script" & vbCr & """" & Me.txtScriptFile.Text &
"""" & vbCr)
AcadDoc.SetVariable("filedia", 1)
'close the file
AcadDoc.Close(Me.chkSaveDWG.Checked, ThisDwg)
End Sub
THIS DOESN'T WORK IN MY DLL
Imports acadApp = Autodesk.AutoCAD.ApplicationServices.Application
Imports acadDoc = Autodesk.AutoCAD.ApplicationServices.Document
Dim file As acadDoc
Sub ProcessDwg(ByVal ThisDwg As String)
acadApp.DocumentManager.Open(ThisDwg)
file = acadApp.DocumentManager.MdiActiveDocument
'AcadApp.ZoomExtents()
'process the script
acadApp.SetSystemVariable("filedia", 0)
file.SendStringToExecute("script" & vbCr & """" & Me.txtScript.Text
& """" & vbCr, False, False, False)
acadApp.SetSystemVariable("filedia", 1)
'close the file
file.CloseAndSave(ThisDwg)
End Sub
application? I'm trying to write a VB.NET batch script processor and what
seems to be happening is that the script doesn'tr execute until my app has
finished. When I've tested my DLL code on a single DWG file my app runs all
the way through, first setting FILEDIA to 0 then back to 1 but the command
my app sends as a string doesn't execute until my app has finished, so
FILEDIA is set back to 1 and the user has to browse for the script file to
run.
Is there a reson why SendCommand hasn't been exposed in the .NET API?
I've successfully built a version of my app as an exe using COM but I'm
trying to get my head into the .NET API. The code I have so far follows:
THIS WORKS IN MY EXE
Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common
Public WithEvents AcadApp As Autodesk.AutoCAD.Interop.AcadApplication
Dim AcadDoc As Autodesk.AutoCAD.Interop.AcadDocument
Sub ProcessDwg(ByVal ThisDwg As String)
'open the file
AcadDoc.Application.Documents.Open(ThisDwg)
AcadDoc = AcadApp.ActiveDocument
'AcadApp.ZoomExtents()
'process the script
AcadDoc.SetVariable("filedia", 0)
AcadDoc.SendCommand("script" & vbCr & """" & Me.txtScriptFile.Text &
"""" & vbCr)
AcadDoc.SetVariable("filedia", 1)
'close the file
AcadDoc.Close(Me.chkSaveDWG.Checked, ThisDwg)
End Sub
THIS DOESN'T WORK IN MY DLL
Imports acadApp = Autodesk.AutoCAD.ApplicationServices.Application
Imports acadDoc = Autodesk.AutoCAD.ApplicationServices.Document
Dim file As acadDoc
Sub ProcessDwg(ByVal ThisDwg As String)
acadApp.DocumentManager.Open(ThisDwg)
file = acadApp.DocumentManager.MdiActiveDocument
'AcadApp.ZoomExtents()
'process the script
acadApp.SetSystemVariable("filedia", 0)
file.SendStringToExecute("script" & vbCr & """" & Me.txtScript.Text
& """" & vbCr, False, False, False)
acadApp.SetSystemVariable("filedia", 1)
'close the file
file.CloseAndSave(ThisDwg)
End Sub
