BricsCAD Sample Programs for C#

Hi,

Just started to explore the BricsCAD system and have been told by the support guys that there are some sample programs for C# but unfortunately, there is only 1 C# example I could find. Coming from EyeShot CAD engine (60 examples) this does not seem right. I am not looking in the right location or is there only 1 sample.

If there is only 1 example then where would I find or learn BricsCAD programming.

Please see the screenshot.

Thanks

Comments

  • Unable to identify your needs... Is starting with Lisp an option perhaps?

  • I am a software developer and am exploring my options to build my software on top of (trying Inventor and BSB) .

    I am familiar with C based syntax such as C/C++, C# but LISP i don't have a clue. but, then again there is only 1 lisp sample ints own folder...

  • Hi,

    The one sample has various sample commands, forms to illustrate using many parts of the API. Since your familiar with C++, you might also find something useful in the BRX SDK.

    Also, check out TheSwamp.org , there's probably thousands of samples

    Cheers :)

  • Thanks Daniel, I will have a look!

  • faceter
    edited August 2019

    Most of BricsCad .net api equals AutoCAD Api.

    -> create an empty .net plugin for bricscad (add reference BRXMgd, TD_MGD - copylocal false)
    -> insert some of the x-thousands examples for AutoCAD (e.g. https://www.keanw.com/2011/01/combining-autocad-blocks-in-separate-files-into-a-single-dwg-using-net.html)
    -> replace Namespace and base classes from AutoCAD to bricscad (Intellisense of VS will help you)

    that's it

  • I tried to compile the code mentioned by @kode_kutter. It's failing. Missing sisl.dll :-(

  • I think any BricsCAD user with programming aptitude is missing out if they don't learn LISP. It's absolutely the API to go with if you only need to perform simple to intermediate tasks. I would recommend OP learns LISP, even at just a beginner level. I would have to see what they're trying to achieve however. If you can code in C# you can learn beginner LISP in weeks. I don't know your situation so I won't throw a 'strong' recommendation out there, rather just a friendly one.

  • @KeithsCADServices
    Good point, and it can be debugged and modified on any computer, so is ideal for CAD Managers who must troubleshoot many real other computers than theirs. Its just so easy that its crazy not to know the basics.
    Making things like acad.lsp and their bcad startup equivalents would be crazy with .net.

  • In that case, let me express my opinion.
    I wrote a whole article on this topic.
    There is absolutely no point in learning LISP today. This language died 30 years ago. It has a monstrous backward syntax. And it is impossible to write a full-fledged program on it - you will not have access to any hardware resources and Windows API. There is no normal IDE for LISP, you have to write code like your grandfather did. LISP has been retained as a throwback for compatibility with older designs. LISP command execution is disastrously slow. BricsCAD has only one suitable language for writing complete, fast and powerful plugins, and that's C#. Of course, C++ programs will be even faster, but the threshold for entering this environment is extremely high. And the basic features of C# can be mastered in a reasonable amount of time. And you can write any application for any task, not just plugins for BricsCAD. Net API examples are incredible - almost any code for AutoCAD will do. Examples of special API that differ from AutoCAD are right in the BricsCAD folder: C:\Program Files\Bricsys\BricsCAD V21 en_US\API\dotNet\
    LISP is a rat hole. C# is an open door. IMHO

  • "IMHO", really? Perhaps w/out the "H". And I don't believe LISP will ever die, wounded perhaps, but never die, too many uses.

  • I felt I had to stir up this swamp. I apologize if I offended anyone. But I'm worried about newbies getting stumped. The old-timers of course use and will use LISP. In this sense, it needs to be maintained for many more years. But this is not for beginners.

  • MDunn
    edited February 2021

    No worries; "IMHO" always triggers a "oh really" from me as I have not actually met too many truly humble people, especially CAD hands & weldors, & when they say it, it really rings hollow. But I can also relate to the Top Gun line about the arrogant pilot, "I like that in a pilot." There is something to be said for a certain amount of arrogance. So this is all in good humor & fun.
    Started doing lisp in the mid 90s mostly to print to various printers w/ various options "A", "B", "D" sizes, C or B&W, Port or Land, ect. So, how would one replace these lisp routines w/ your beloved Net API or whatever it is that would do the same? Simple challenge:
    This lisp changes between Tilemode 1 & 0 w/ only 2 key strokes: 1+Enter; or 0+Enter.
    Here's the code:
    (defun c:1 ()(command "tilemode" "1")
    (command "regen")(princ))
    (defun c:0 ()(command "tilemode" "0")
    (command "regen")(princ))
    What say ye? Let's have it big guy, gauntlet down... :sunglasses:

  • Torsten Moses
    edited February 2021

    I would say, someone who just says "this language for all & everything, nothing else" just shows a limited understanding of complex CAD environments, CAD history, context around CAD in companies etc. etc. etc. - I could continue for years;
    in other words, mostly affected by own view on the world ... never underestimate other contexts, especially those you do not know ...
    old greek philosophers even knew that !

    Besides the faults in details :

    There is no normal IDE for LISP, you have to write code like your grandfather did.

    not true, see BLADE :smile:

    LISP command execution is disastrously slow.

    also not true ... run the benchmarks from LDSP ... I would say, ours is close to .NET in performance (!)

    Not to forget, LISP code runs on all platforms, WIndows, Linux, Mac ...
    and .NET is not the salomonic solution - it was (and still is) designed for "closed box managed systems", never designed for mixed-mode, dealing with real-worlds DLLs ... later on Microsoft added that "mixed.mode" but it is more or less a dirty hack.
    As a proof, that "managed" concept (of automatic GarbageCollection) can not and does not completely coexist with unmanaged (C++) code ...
    tons of examples where it clashes.

    On both AutoCAD and BricsCAD, there are such clash problems, by nature ... and can not be fully resolved cleanly, also by design.
    .NET might be nice for standalone .exe modules ... but it was never designed as extension module for a given host application (aka plug-in into unmanaged hosts).

    Just my 20 cents :smile:

  • Anyone who things LISP is "disastrously slow" doesn't use LISP. Even my most poorly programming, UNCOMPILED LISP runs with almost zero hesitation, on an old Laptop.

    I'll say this again and again: It all depends on what you're trying to program.

    The reason I got back into LISP programming: A potential client had previously solicited the services of .NET developers. Everything they were quoted was WAY out of their price range (they had previously hired LISP programmers to write some relatively simple code with good success). Very often, the solution clients are requesting can simply be done in LISP. They don't want to spend more than $1,000 - $2,000 on the problem, sometimes even less. For simply to intermediate API programming, AutoLISP is extremely competitive. Using .NET instead of LISP for simple API is like getting groceries in a Lambo; fun but practical?

    Another common complaint about .NET developers is that their clients often aren't made aware of things such as the requirement to re-compile (and possibly adjust) the code each time they update their release. This turns into a yearly expense. Many clients enjoy the fact that LISP is very WYSIWYG. LISP developers market themselves less than 1% the amount that .NET developers do as their customers tend to come to them. Yes, companies are still paying people to build LISP software suites for them.

    For the simple stuff I fail to see how .NET is better. Even things like Dynamo for Revit. I remember trying to do something relatively simple and never again... had a "what the hell am I doing" moment. Minutes of LISP programming turned into days of Dynamo. It's inefficient and you can't even turn it into a command (at least back when I used it you couldn't). Had a similar moment with Revit itself, which is why I'm on Bricssys' forum ;-) . If a complicated API program is required, especially if it contains complex dialogs, and is guaranteed to increase the clients revenue enough to justify the developer's fee? Then I throw in the towel. No contest there - .NET is the way to go.

    Mr. Dunn: Adding an 'if' statement to your code, you could toggle your tilemode with one key:

    (if (= (getvar "tilemode") 0) (setvar "tilemode" 1) (setvar "tilemode" 0))

  • Lisp has limitations and advantages. But I do stumble a bit on the way an opinion is posted. It gives a non-objective and distorted view. The result is that visitors get the wrong idea and make wrong choices. That is unfortunate and damaging for their business.

    I could add a code snippet like (setvar "tilemode" (abs (1- (getvar "tilemode"))))) but all arguments have been mentioned. Lisp is business-critical and you can't avoid it in non-windows environments.

    Most welcome is that it lacks the typical windows bloat and capriciousness, that it is straightforward and that it has a low threshold for non-programmers to start making CAD processes more efficient.

    How powerful is it that a beginner can paste (command "point" "123,456") on the command line and immediately understands what that piece of Lisp code does? He or she will discover that there are also functions such as (entmake...) during the learning curve.

    As Frank Zappa said:

    Lisp is not dead, it just smells funny.

  • You should invest in a old computer and get a copy of Lisp2c which does just that converts lisp to c code. The but it disappeared like 20 years ago, it cam out when Autodesk introduced C as a viable platform.

    Like others draw a box pick 2 diagonal points its 1 line of code using lisp.

    It comes down to what are you trying to achieve ? A simple block editor or a spaceship automation tool.

    Oh yeah .net Acad, Bricscad recompile, ZWCAD Intellicad plus others who knows. Send a lisp chances are it will work 1st go. Forgot the Mac.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. Click one of the buttons on the top bar to get involved!