BRX Custom Entity not using the latest lrx file.

Hello all :+)

So I am just starting out with my first BRX application, and am making alterations to the Sample project that comes with BRX - the one that draws a circle with a filled triangle. I am taking the approach of doing really trivial changes, then recompiling and reloading. In the zip file below, one can see where I have commented the existing code and added a little new code.

What I have done so far:

  1. Removed the fill from the triangle;
  2. Draw another small circle radius 0.1.  To do this, I added another constructor which had a Center point. I altered the corresponding call to placement new in cmdDbx.cpp
These things worked.

Now, I have changed the radius of my small circle to 0.5.  But this didn't work - It still draws the circle with radius 0.1. It seems that the new lrx file is not being used. This is despite me rebuilding the entire CodeBlocks Workspace, and reloading the new lrx file.

If I use the appload command on the Tools Menu; then Unload the app; then remove it; then Add the new file; then Load the App  : All the existing drawing Entites disappear from the screen; the CUSTENT is not available. If I then reload the App again, then CUSTENT is available again.

If I just remove the existing App, Add and Load the new one - I don't have the problems mentioned in the last paragraph.

So I what am I missing in the procedure to Load an app - or is there something else going on?

My initial aim for this little project is to create a point which has some of the features of an AutoDesk Civil3D point. For now, I would just like each point to have it's own symbol (hence the small circle); and to have a alphanumeric Point Name; an unsigned integer point number which can be input by the user. These things should be displayed as text next to the point symbol, and to be displayed in the properties (I haven't really looked into doing that just yet - trying to get basic things working first)

Thanks in advance for any help with this :+)

Comments

  • Dear David,

    I just reviewed our BRX sample :
    there was a minor detail missing, which is important for unlocking + unloading the sample code :

            AcRx::AppRetCode result = AcRxArxApp::On_kInitAppMsg(pAppData);
            acrxRegisterAppMDIAware(pAppData);
            acrxUnlockApplication(pAppData);

    the usual "acrxRegisterAppMDIAware" and "acrxUnlockApplication" were missing, as we wanted to keep the sample as simple as possible ...
    So likely due to missing "acrxUnlockApplication(pAppData)" call, the unloading was not (or not completely) successfully.

    I added that code to our sample now (as it is indeed the normal, default behaviour), you might also add the 3 lines as well, maybe it makes a difference then ?

    from your post :
    "If I use the appload command on the Tools Menu; then Unload the app; then remove it; then Add the new file; then Load the App  : All the existing drawing Entites disappear from the screen; the CUSTENT is not available. If I then reload the App again, then CUSTENT is available again.

    If I just remove the existing App, Add and Load the new one - I don't have the problems mentioned in the last paragraph. "

    I'm not sure I fully understand :
    what is the difference between both scenarios ? Probably, unloading failed, due to missing "acrxUnlockApplication()", hence the module remained loaded;
    the first scenario seems to be all correct.

    To be able to truly unload the module, and reload a rebuild module, then the mentioned "acrxUnlockApplication()" is truly necessary,

    Maybe this explains the confusion ?
    many greetings & good luck !
  • Hi Torsten,

    Thanks for helping me again :+)

    >"...you might also add the 3 lines as well, maybe it makes a difference then ?"

    No difference after adding those 2 lines to acrxEntryPoint.cpp (the first one was there).

    > "I'm not sure I fully understand :
    what is the difference between both scenarios ? "

    The first one: Unload, Remove, Add,Load.
    The second one: Remove, Add, Load.

    With the first one, it's a little odd that all the existing drawing entities disappear (and don't come back). At one stage, I had a problem with the Standard Toolbar disappearing and not being available to put back. I had to Reset the customization to restore the Toolbars.

    I also tried starting a new drawing, and loading the lrx file into that - no luck there either :+(

    Were you able to load the lrx file into a drawing? Did it produce a circle 1.0 in diameter ?

    In the LinuxBuild.txt guide, it mentions:

    Loading "Sample.lrx" BRX module :
    ---------------------------------
    after successful compilation, you will find "Sample.lrx" (Linux Runtime eXtension)
    generated in output folder - copy into BricsCAD program folder, and load by
      (arxload "Sample.lrx")
    You will see a printed message in commandline, and CUSTENT command is available.

    I have been using the GUI Tools/Load Application. There is no ARXLOAD command - maybe that is a windows thing that was copy pasted? The APPLOAD command gives the same dialog box as if using the menu option.

    I will try to start again: only make 1 change - draw another circle. I will see how that goes :+)

    Regards :+)


  • Hello again,

    I managed to get it working:

    1. Closed the existing drawing.
    2. Exit BricsCAD - crucial
    3. Start BricsCAD
    4. Start a new drawing / or open previous drawing.
    5. Unload the CUSTENT app
    6. Remove CUSTENT app
    7. Load Sample.lrx - which was built with 2 extra lines mentioned earlier. All entities disappear. CUSTENT not available.
    8. Load Sample.lrx again. Existing entities reappear with the modifications to CUSTENT applied, CUSTENT is now available.
    I should have tried exiting BricsCAD altogether earlier in the day, but there perhaps appears to be more to unloading than first thought.

    Maybe the Save Updates check-box on the AppLoad dialog has something to do with it?

    Regards :+)


  • Hello, one more question:

    > "...... as we wanted to keep the sample as simple as possible ... "

    Just wondering if there are other things that have been taken out of the sample app? For example there is a TODO comment in the CMyEntity::getOsnapPoints function. That could be very handy - actually I need it for my little app - My custom entity is a Point, so one needs to be able to Snap to it.

    I know that adding more things to the Sample app makes it more complex - but I can't help thinking that might be better than not including something. The very thing that is not included is the thing that someone needs to know how to do.

    Thanks again for all the help - Regards :+)
  • Dear David,

    of course, it would have an advantage if getOsnapPoints() would be part of the sample ...
    but ARX / BRX contains hundreds (?) of virtual functions, which might be overloaded by custom object code - if getOsnapPoint() is not overloaded, then the default behaviour (in your case, of an AcDbPoint) should apply.

    The ARX SDK contains plenty of sample code ... you will also find tons of ARX samples (also for custom objects / entities) on the web ...
    if you need a more detailed sample, please send us a support request, we can then send you several custom entities, as we use that in our BRX test system.

    many greetings !
This discussion has been closed.