TheSwamp

Code Red => ARX Programming => Topic started by: jtm2020hyo on April 14, 2020, 06:01:09 PM

Title: when use ARX?
Post by: jtm2020hyo on April 14, 2020, 06:01:09 PM
Hi, new in ARX, when is it recommended to use anything related to ARX?
Title: Re: when use ARX?
Post by: MickD on April 14, 2020, 07:41:08 PM
When you really need a more secure code base (that is, hard(er) to decompile to look at the source code) to protect IP, you need an API not available via .Net or you have a very intensive data crunching application that require squeezing out every last bit of performance out of your processor.

The .Net (C#/VB.net/F# etc) API for ARX has pretty much the whole ObjectARX API covered and you could possibly PInvoke or wrap what isn't. You also have access to WinForms and WPF for GUI programming which is a LOT easier than dealing MFC/Win32 or a third party  C/C++ GUI library.
While .Net is a bit slower to get going being JIT compiled by nature, after being compiled once it's just as fast as the native code with some minor fluctuations/exceptions not really worth worrying about unless performance is absolutely critical (we're talking milliseconds here!).
The other advantage with .Net is maintenance, rarely do you need to update or recompile code for later releases of AutoCAD whereas with ObjectARX/C++ you need a full recompile each major file format release. Then there's the refactoring for C++ versions...

C++ is fun to use but be prepared for a lot of work unless you use it every day, if you need to get things done, use C#.
Title: Re: when use ARX?
Post by: jtm2020hyo on April 14, 2020, 08:07:47 PM
how can I start with .NET?

for example:
for lisp, I search similar lisp to my needs, then I change Line 3 and Line 4

for .NET, I tried to search for some code that simulates REPLACEBLOCK command, for replacing in AutoCAD MEP, Devices for blocks and vice-versa, no luck.
for .NET again, I tried to search for some code that converts polylines to Conduit or Cable Trays Objects vice-versa, in AutoCAD MEP, but no luck.

then some questions:

1 How can I start since zero to create both codes in NET?
2 Why does it not exist code in NET for common problems?
3 Is NET or AutoCAD MEP begin deprecated and replaced for REVIT and Dynamo?

Title: Re: when use ARX?
Post by: MickD on April 14, 2020, 09:45:16 PM
Why don't you want to keep using lisp? It's very capable and easier to use and as you say there is plenty of examples to pick from to create your own versions.

As John mentioned in your other thread on C++, you will be moving from a higher level, interpreted 'scripting' language (AutoLisp) to a compiled 'programming' language and as far as compiled languages go C# is by far the easiest with more code samples (compared to C++ and for general .Net at least).

When you move to a lower level it does give you a lot more power and flexibility but there is less hand holding and you need to study and practice/write a lot more code to get the hang of things and how it all works together. We're talking maybe months to years (depending on you understanding of lower level programming) to be really productive.

If you know lisp, keep going with it and move slowly into say C# or C++/ARX and just get a small app with a command working and build upon that.
The key to understanding ObjectARX (C#/C++) is to understand how the document/editor/database works and you just need to keep looking for tutorials and sample code and eventually it will click.

Here's a start -> https://help.autodesk.com/view/OARX/2019/ENU/
For C# look at the links for the ObjectARX Managed .Net Developers and Reference guides.
For C++ look at the links for the ObjectARX Developers and Reference guides.

hth
Title: Re: when use ARX?
Post by: MickD on April 14, 2020, 09:46:38 PM
There's also a pinned link here at The Swamp with heaps of info -> https://www.theswamp.org/index.php?topic=32381.0
Title: Re: when use ARX?
Post by: jtm2020hyo on April 14, 2020, 11:20:12 PM
thanks a lot for your help. I will learn everything as possible.

... but actually I just have 2 problems,


Quote
for .NET, I tried to search for some code that simulates REPLACEBLOCK command, for replacing in AutoCAD MEP, Devices for blocks and vice-versa, no luck.
for .NET again, I tried to search for some code that converts polylines to Conduit or Cable Trays Objects vice-versa, in AutoCAD MEP, but no luck.

As I mentioned, I need one alternative for REPLACEBLOCK command in AutoCAD MEP and convert any type of *line to Conduit, Cable Tray, Duct, Pipe, or any object with length and vice-versa. I am searching for help desperately and I do not know how to solve this.

I was posting for help in another forum, but no luck. Just a guy, in Autodesk Autocad MEP forum, suggest me search for .NET code to realize this and solve both.

I appreciate in advance to everyone for any help.
Title: Re: when use ARX?
Post by: MickD on April 15, 2020, 12:57:52 AM
Your 2 problems require more than a 5 minute solution....

As I said, if you read the doc's and understand what a BLOCK is then REPLACEBLOCK won't be so hard ;)
Learn the basics of Entities and the database then things like Cable Trays should/might have an API you can hook into to do your thing. Get the properties for the line, create the cable tray setting the necessary properties from the line and add it to the database.

If someone has done it they might share what they have or have ideas, if not you will have to work it out yourself.
If you do go it alone then make a start and ask here or in the .Net section for help when you get stuck.

If you're really in a hurry it would be much more affordable and quicker to hire an experienced AutoCAD programmer, preferably with experience in MEP.
Like I said, you will be looking at months not hours or days to get this done without experience.