Try attached code it I rewrote it completely
I added some other things take a look at
the additional functions
I wan't to do your homework sorry
In the attached file all is enough for
the basic operations
you have to read some books
about C# reference for more
Dear Hallex, Thanks very much for your patience andexcellent codes
I am reading some articles and books, I am sorry to cost you much time
Just a hint:
Don't forget to rewrite drawLineInObject function
easier yet to use double as start and end points as
public static object DrawLine (object oBlock, double p1, double p2, string layer)
// ... the rest portion of your code is goes here.....
I read your code and test in Win7 with .net2008 cad2010, runs very well ~
but in winXP .net2008 cad2008, error happens
it says cannot find the following files:
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start(String fileName)
at AcadTestExe.ReflectionCommands.TestACAD(String fname) in F:........
at AcadTestExe.Form1.button1 Click(Object sender. EventArgs e) in F:.......
Dear Hallex, should I add some libraries in winXP?
I am a little confused,
what language do you think is fit for me to learn cad devlopping?
ObjectARX, or VBA, or visual Lisp, or C# ?
can you introduce some reference book for me ?
right now I am more familiar with C#, C++ and matlab
Thanks for your patience and incredible codes~~~
On the quick glance it may occurs by User Permission
See here for more:
I test your code in anther computers
It runs well in WinXP and Win7 64bit, cad2004, 2007, 2008, 2010
you are genius, Hallex
I read many articles
and never see cad C# code without any libraries
your defined AcadApp and AcadDoc as Object
Is it the reason that can runs well in different OS and CAD ?
There is no magic in my crappy codes
just well-known runtime methods nothing else
Please see here for more:
Hey, cease to praise me, I same stupid, as my gray-haired @$$
I never found cad C# code as powerful as yours which even need not dll or com
so I admire you
I am reading cad VBA now, and take a look at the MSDN web link you gave me
I know your code use some VBA Method, just like AddLine, Open...
My question is :
how do you know the parameters of using vba method?
For example: object AcDoc = AcadDocs.GetType().InvokeMember("Open", BindingFlags.InvokeMethod, null, AcadDocs, args, null);
you define args: args = fname;(file path and name) args = false;(can write dwg)
I saw in vba is :ThisDrawing.Application.Documents.Open "c:\1.dwg"
how do you know need fname together with false?
where can I find the rules?
all in C# library reference, reflection???
No, all these arguments in AutoCAD Help file
That is a lot of work to digg it from there
Say, open VBA editor in AutoCAD by Alt+F11
Then in console add dummy Sub say:
Public sub Test()
type Open in here, then select a word Open
by double click on them and press F1
See then all arguments in the Help file
To convert any arguments to numeric values:
Open 'Immediate Window' in same editor and type here
any of AutoCad's constants preceded with question mark like this:
?acMiddleCenter ETC, ETC
Then press Enter
You should see a numeric equivalent of this constant
in the same window next line below
So nothing smart it's just a lot of work, you have to digg deeper yourself
Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register