PDA

View Full Version : Doubt about using C # or LISP



frankjanuba715924
2015-12-09, 03:07 PM
Excuse me if I am repeating something that already exists in the forum, I recently-started my studies with AutoLISP, however, i already have experience with C #. Really need to learn AutoLISP or get the same results with the .NET libraries?
For example, I need to create a command que will allow me to draw the line on the surface and return the slope. Basically the code would need to collect the initial and final elevations intercepted by the line and with length of the line, return the slope calculus in percent.
How could I develop this code? With C # or AutoLISP? Both?

dgorsman
2015-12-09, 04:36 PM
Could do it in either. dotNET requires a little more up front but is easier put everything together, and easier to extend (especially with OO design practices). LISP is easier to get going with but can bog down with implementing the math.

frankjanuba715924
2015-12-09, 04:47 PM
Thank you, in which case I will leave the AutoLIPS for now and study the SDK for .NET

BlackBox
2015-12-09, 10:27 PM
You ultimately use what's best for the job/task, generally based on the Object(s) you're needing to interact with, and what Properties, Methods, and Events they make available to a given API.

So for example, if your Surface exposes a would-be GetElevationAtPoint Method to both APIs, then a simple LISP which prompts user for start/end point, and a pair of calls to the Surface's GetElevationAtPoint Method supplying each of the aforementioned points as parameter, then you no longer have a need to append a line entity to the drawing's database, and subsequently query the intersection points.

Whereas if this method isn't exposed to LISP, you could use .NET API to perform this task directly, or instead develop a custom LispFunction Method to expose the necessary Transaction to LISP indirectly supplying parameters within the LispFunction Method call within your Defun, if that makes sense.

... It's all about choosing the right tool for the job, and then overruling that choice with your preference, of course. Haha

Cheers

frankjanuba715924
2015-12-10, 09:27 AM
Thanks BlackBox, about this handlers/methods lisp, have you any reference for search? As I am still starting, I have read very basic reference available on some sites listed here on the forum, but found nothing about information objects "surface" Civil 3D for example through LISP. Maybe I have read little or in the wrong places.

BlackBox
2015-12-10, 05:04 PM
As always, within Visual Studio, Object Browser is your friend. Haha

There's a lot of documentation in the SDK itself, however, you may also find this to be invaluable:

http://docs.autodesk.com/CIV3D/2016/ENU/API_Reference_Guide/



That said, you will learn a great deal from my friend who develops SincPac C3D as well:

http://www.quuxsoft.com/



Cheers

dgorsman
2015-12-10, 05:06 PM
A good definition of the problem helps. If I had known this was Civil3D objects rather than generic/mathematic "surface", "line", etc. then I would definitely recommend dotNET over LISP. You may stumble over additional problems as well. As I am fond of saying "Code is the end result, not the starting point". By solving the design issues up front you only need to deal with syntax and API limitations when writing the code.

frankjanuba715924
2015-12-11, 04:59 PM
Thanks a lot, this links are very usefull!

BlackBox
2015-12-12, 01:53 AM
Thanks a lot, this links are very usefull!

You're welcome; I'm happy to help. :beer:

Not that this wouldn't apply to other topics, and there's obviously a learning curve (even for me), but particularly for topics of software development, try to be more descriptive when posing questions, providing as much clarity as you can - those of us who volunteer our time to help, can only do so with the information which is provided us - it will only help us to help you in the end.

Cheers