.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
C# Draw Arc with 3 points
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
1163 Views, 16 Replies
02-03-2008 12:56 PM
please help me, I'm trying to find a way to draw an Arc with 3 points but i can't.
here is parth of the code, (AddArc) method only accepts starting angle, end angle, radius, center point
I want to enter 3 points that define the Arc
AcadModelSpace mod;
mod.AddArc(p1, 23.4, 0, 180);
please Help
Thank you
here is parth of the code, (AddArc) method only accepts starting angle, end angle, radius, center point
I want to enter 3 points that define the Arc
AcadModelSpace mod;
mod.AddArc(p1, 23.4, 0, 180);
please Help
Thank you
Re: C# Draw Arc with 3 points
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-04-2008 11:16 AM in reply to:
newbie1221
Since you are using COM interop I would suggest you visit the VBA forums for help in the future.
To answer your question, you could use the AutoCad command prompt using SendCommand() but I would advise against it (unless you absolutely have to).
If the addarc() function only takes those 3 arguments, you will probably have no choice but to calculate what those three arguments should be, and feed them to AutoCad in the manner it expects. You could also create a dummy arc and modify its properties, but again you would need to calculate those said properties on your own (radius, angles, etc...).
ie: Calculate your start/end angles, ctr pt, and radius and use those to define your arc in the format that AutoCad expects. If you do not want to handle the math, you will have to send text to the AutoCad command line through a script.
To answer your question, you could use the AutoCad command prompt using SendCommand() but I would advise against it (unless you absolutely have to).
If the addarc() function only takes those 3 arguments, you will probably have no choice but to calculate what those three arguments should be, and feed them to AutoCad in the manner it expects. You could also create a dummy arc and modify its properties, but again you would need to calculate those said properties on your own (radius, angles, etc...).
ie: Calculate your start/end angles, ctr pt, and radius and use those to define your arc in the format that AutoCad expects. If you do not want to handle the math, you will have to send text to the AutoCad command line through a script.
*Laurie Comerford
Re: C# Draw Arc with 3 points
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-04-2008 12:17 PM in reply to:
newbie1221
Hi Jason,
What is the point of a poster using .NET with the COM interop trying to get
help in the VBA newsgroup? Users there will see C# and refer them back
here. This is the NG for programming using .NET and should be so regardless
of the methods used within .NET
--
Regards
Laurie Comerford
wrote in message news:5838476@discussion.autodesk.com...
Since you are using COM interop I would suggest you visit the VBA forums for
help in the future.
To answer your question, you could use the AutoCad command prompt using
SendCommand() but I would advise against it (unless you absolutely have to).
If the addarc() function only takes those 3 arguments, you will probably
have no choice but to calculate what those three arguments should be, and
feed them to AutoCad in the manner it expects. You could also create a dummy
arc and modify its properties, but again you would need to calculate those
said properties on your own (radius, angles, etc...).
ie: Calculate your start/end angles, ctr pt, and radius and use those to
define your arc in the format that AutoCad expects. If you do not want to
handle the math, you will have to send text to the AutoCad command line
through a script.
What is the point of a poster using .NET with the COM interop trying to get
help in the VBA newsgroup? Users there will see C# and refer them back
here. This is the NG for programming using .NET and should be so regardless
of the methods used within .NET
--
Regards
Laurie Comerford
Since you are using COM interop I would suggest you visit the VBA forums for
help in the future.
To answer your question, you could use the AutoCad command prompt using
SendCommand() but I would advise against it (unless you absolutely have to).
If the addarc() function only takes those 3 arguments, you will probably
have no choice but to calculate what those three arguments should be, and
feed them to AutoCad in the manner it expects. You could also create a dummy
arc and modify its properties, but again you would need to calculate those
said properties on your own (radius, angles, etc...).
ie: Calculate your start/end angles, ctr pt, and radius and use those to
define your arc in the format that AutoCad expects. If you do not want to
handle the math, you will have to send text to the AutoCad command line
through a script.
Re: C# Draw Arc with 3 points
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-04-2008 12:51 PM in reply to:
newbie1221
I didn't notice right away that his sample code was in C#.
However, on that subject, the other forum has much more info about the COM API that directly applies to questions like these. Most of the knowledge here seems to be biased towards the ObjectArx .NET libraries instead. Therefore the VBA forums is still a better place to look when interacting with the COM library, even when you need to translate any solutions you find into C#.
My comment was not meant to be a "stay out of this forum" post. It was more of a "here is better place to search for a solution".
ps: You like jumping on people, don't you?
However, on that subject, the other forum has much more info about the COM API that directly applies to questions like these. Most of the knowledge here seems to be biased towards the ObjectArx .NET libraries instead. Therefore the VBA forums is still a better place to look when interacting with the COM library, even when you need to translate any solutions you find into C#.
My comment was not meant to be a "stay out of this forum" post. It was more of a "here is better place to search for a solution".
ps: You like jumping on people, don't you?
Re: C# Draw Arc with 3 points
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-04-2008 01:22 PM in reply to:
newbie1221
It's all about the API. All users in the VBA group use the ActiveX API. This includes VB6 and Delphi (have you ever told them to get lost) users. The users in this group predominantly use the .NET API. Therefore the OP might be more likely to get help in the VBA group if the users can see past the language he is using.
In this group there are both VB.NET & C# users using the .NET API . The fact they are using different languages has not stopped them help each other on the real purpose of this group the .NET API.
In this group there are both VB.NET & C# users using the .NET API . The fact they are using different languages has not stopped them help each other on the real purpose of this group the .NET API.
Re: C# Draw Arc with 3 points
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-04-2008 01:53 PM in reply to:
newbie1221
Thank you so much, Jason
I'm a Programmer and I'm just starting to learn more about Programming for AutoCAD.
Is there a better way to Program for AutoCAD rather than using COM interop, I saw some Database work like Commit() ,and Stuff? I tried looking at samples it all make sense but I always get FILENOTFOUND Execption just if I used anything in these NameSpaces:
Autodesk.AutoCAD.Geometry
Autodesk.AutoCAD.DatabaseServices
Although I added the 2references:
acdbmgd.dll
acmgd.dll
Any Tips?
Thanx again for your Help
Message was edited by: Newbie1221
I'm a Programmer and I'm just starting to learn more about Programming for AutoCAD.
Is there a better way to Program for AutoCAD rather than using COM interop, I saw some Database work like Commit() ,and Stuff? I tried looking at samples it all make sense but I always get FILENOTFOUND Execption just if I used anything in these NameSpaces:
Autodesk.AutoCAD.Geometry
Autodesk.AutoCAD.DatabaseServices
Although I added the 2references:
acdbmgd.dll
acmgd.dll
Any Tips?
Thanx again for your Help
Re: C# Draw Arc with 3 points
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-04-2008 02:01 PM in reply to:
newbie1221
2005 had a very limited .NET API. If you have 2006 onwards checkout http://through-the-interface.typepad.com/through_t he_interface/2007/11/devtv-introduct.html
Re: C# Draw Arc with 3 points
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-04-2008 02:49 PM in reply to:
newbie1221
http://usa.autodesk.com/adsk/servlet/index?id=1911 627&siteID=123112
There should be links to documentation directly related to programming with the .NET arx API. Also look at the C++ documentation for ObjectArx, as I think there were some .NET samples hidden in the package you can download.
Also, Nathan is right about the "Through the interface" blogs. They have some great info.
As a last resort, you can search these forums.. The posts about how to set up a project that uses the arx.NET API are old, but they should still be here (they are what I used to get started).
Good luck.
There should be links to documentation directly related to programming with the .NET arx API. Also look at the C++ documentation for ObjectArx, as I think there were some .NET samples hidden in the package you can download.
Also, Nathan is right about the "Through the interface" blogs. They have some great info.
As a last resort, you can search these forums.. The posts about how to set up a project that uses the arx.NET API are old, but they should still be here (they are what I used to get started).
Good luck.
Re: C# Draw Arc with 3 points
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-04-2008 03:52 PM in reply to:
newbie1221
Thank you all for the tips, Indeed those were very helpful
)
*Tony Tanzillo
Re: C# Draw Arc with 3 points
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
02-04-2008 05:15 PM in reply to:
newbie1221
If you want to use the managed API (which means that you are building a NETLOAD-able DLL, not an .EXE), this is probably the easiest way to do what you need, without having to do the geometry calculations:
Using Autodesk.AutoCAD.Geometry;
Point3d startPoint = //... start point of the arc
Point3d pointOnArc = //... any point on the arc segment
Point3d endPoint = //... end point of the arc
CircularArc3d arc = new CircularArc3d( startPoint, pointOnArc, endPoint );
From there, you can query the properties of the CircularArc3d for its center, radius, and start/end angles, and use them to create an Arc entity.
If you've never used the managed ObjectARX API before, then be forewarned that it is not easy to learn (it can take years to learn it to the extent needed to develop real applications).
You can ease your way into the managed API gradually by using it in conjunction with ActiveX (your problem is a good example of that, because you can create the ARC through ActiveX, but use the managed API to do the needed calculations).
And contrary to what Laurie says, we generally don't link programming languages to APIs here. This newsgroup focuses mainly on using the managed ObjectARX API without regard for langauge. For ActiveX, your best bet is the VBA newsgroup because syntax differences aside, the API is the same regardless of what langauge you use.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com
wrote in message news:5838744@discussion.autodesk.com...
Thank you all for the tips, Indeed those were very helpful
)
Using Autodesk.AutoCAD.Geometry;
Point3d startPoint = //... start point of the arc
Point3d pointOnArc = //... any point on the arc segment
Point3d endPoint = //... end point of the arc
CircularArc3d arc = new CircularArc3d( startPoint, pointOnArc, endPoint );
From there, you can query the properties of the CircularArc3d for its center, radius, and start/end angles, and use them to create an Arc entity.
If you've never used the managed ObjectARX API before, then be forewarned that it is not easy to learn (it can take years to learn it to the extent needed to develop real applications).
You can ease your way into the managed API gradually by using it in conjunction with ActiveX (your problem is a good example of that, because you can create the ARC through ActiveX, but use the managed API to do the needed calculations).
And contrary to what Laurie says, we generally don't link programming languages to APIs here. This newsgroup focuses mainly on using the managed ObjectARX API without regard for langauge. For ActiveX, your best bet is the VBA newsgroup because syntax differences aside, the API is the same regardless of what langauge you use.
--
http://www.caddzone.com
AcadXTabs: MDI Document Tabs for AutoCAD 2008
Supporting AutoCAD 2000 through 2008
http://www.acadxtabs.com
Thank you all for the tips, Indeed those were very helpful


