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

Fillet between lines with dotnet

8 REPLIES 8
Reply
Message 1 of 9
mabe2k11
1314 Views, 8 Replies

Fillet between lines with dotnet

Hello!

Is it possible to create the fillet between two lines or the lines of a polyline with dotnet?
In my application the user should select a polyline and the program creates the section of a metal sheet with the coordinates of the selected polyline. But to draw the section i need to create a lot of fillets.

I hope someone can help me. Unfortunately it is very difficult to find some manuals about dotnet-programming in AutoCAD.
8 REPLIES 8
Message 2 of 9
Anonymous
in reply to: mabe2k11

Filleting must be done manually via the API methods, or you
can use a more sensable/rational approach, and just drive the
FILLET command via the command line.

See the code that I posted in this newsgroup for an easy
to use wrapper for the command line, without the having to
deal with the asynchronous sendStringToExecute() nonsense.

--
http://www.caddzone.com

AcadXTabs: MDI Document Tabs for AutoCAD 2004/2005/2006/2007
http://www.acadxtabs.com

wrote in message news:5146485@discussion.autodesk.com...
Hello!

Is it possible to create the fillet between two lines or the lines of a polyline with dotnet?
In my application the user should select a polyline and the program creates the section of a metal sheet with the coordinates of the selected polyline. But to draw the section i need to create a lot of fillets.

I hope someone can help me. Unfortunately it is very difficult to find some manuals about dotnet-programming in AutoCAD.
Message 3 of 9
mabe2k11
in reply to: mabe2k11

Thank You!

I think the command-method is the better way. The API-method seems to be to difficult.

I looked at this discussion group and i found something.
Now i can run a command string to draw a line for example:
Document doc = Application.DocumentManager.MdiActiveDocument;
doc.SendStringToExecute("_line 100 100 ", false, false, false);

But how can i draw a fillet. I have to select the two lines, after running the "_fillet" command. Can I work with the entities which the user has already selected in my dotnet program?
Or is it necessary to learn LISP first to do something like drawing a fillet? Then it could useful to look in a LISP-forum for the answer.
Message 4 of 9
Anonymous
in reply to: mabe2k11

you mean you are doing .net and don't know lisp?
Either way, lisp would only use the command line to run the fillet command.
I guess it all comes down to having .net make a lisp callable selection set...not sure on that

mabe2k <>
|>Thank You!
|>
|>I think the command-method is the better way. The API-method seems to be to difficult.
|>
|>I looked at this discussion group and i found something.
|>Now i can run a command string to draw a line for example:
|> Document doc = Application.DocumentManager.MdiActiveDocument;
|> doc.SendStringToExecute("_line 100 100 ", false, false, false);
|>
|>But how can i draw a fillet. I have to select the two lines, after running the "_fillet" command. Can I work with the entities which the user has already selected in my dotnet program?
|>Or is it necessary to learn LISP first to do something like drawing a fillet? Then it could useful to look in a LISP-forum for the answer.
James Maeding
Civil Engineer and Programmer
jmaeding - athunsaker - com
Message 5 of 9
NathTay
in reply to: mabe2k11

You can use the following to pass the entity where objEnt is the entity.

" (handent " & Chr(34) & objEnt.Handle & Chr(34) & ") "

I don't see a connection between doing .NET and knowing lisp but this example shows where it is helpful.

Regards - Nathan
Message 6 of 9
NathTay
in reply to: mabe2k11

Sorry objEnt.Handle is the ActiveX Method. I don't know the .NET equivalent off hand.
Message 7 of 9
mabe2k11
in reply to: mabe2k11

Tony, I found the following code posted by you. I changed it to fillet the last polyline. But when I run TestInvokeLisp in AutoCAD i don't get a result. Nothing happens and I do not really understand what your code does, so it's very difficult to find the bug. Perhaps you can help me.

Thank you.

// Here ist the code I have

using System;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using System.Runtime.InteropServices;
using AcadApp = Autodesk.AutoCAD.ApplicationServices.Application;


namespace AcadTools
{
public class AcedInvokeSample
{
public const int RTLONG = 5010; // adscodes.h
public const int RTSTR = 5005;

public const int RTNORM = 5100;

public AcedInvokeSample()
{
}

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

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;
}

[CommandMethod("TestInvokeLisp")]
public static void TestInvokeLisp()
{
ResultBuffer args = new ResultBuffer();
int stat = 0;

args.Add(new TypedValue(RTSTR, "_fillet"));
args.Add(new TypedValue(RTSTR, "p"));
args.Add(new TypedValue(RTSTR, "_last"));

ResultBuffer res = InvokeLisp(args, ref stat);
if (stat == RTNORM && res != null)
{
PrintResbuf(res);
res.Dispose();
}
}
}
}
Message 8 of 9
Anonymous
in reply to: mabe2k11

Look at this topic: http://discussion.autodesk.com/thread.jspa?messageID=4858935 and find CommandTest() function by Tony.
With help of this function you can execute AutoCAD command, such as fillet.
InvokeLisp() is only for calling lisp/arx-function from .NET-application, but not for execute AutoCAD command directly.
Message 9 of 9
mabe2k11
in reply to: mabe2k11

Thanks to all of you. I got it 😉

I attached the C#-File which draws the section of a metal sheet. It's not finished jet (error-handling is not good), but i think it's a good start for people who have the same problem.

Info to MetalSheet.cs (I had to rename it for uploading): Run MetalSheet in ACAD and select a polyline. You get five new lines which look like a metalsheet.

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