Improved LISP engine in Version 12.2.5 ??????

Hi,

i read in the ReleaseNotes of the new ver. 12.2.5 that
"...LISP engine: upgraded, offering better performance and new VLE- functions...."
Are there any more detailed(specific) information/description on these improvements
and a complete documentation of all NEW and VLE- functions  ???
I'd like to test them !

Regards
Konstantin

Comments

  • Hi Konstantin,

    I'm sure it will arrive. In the meantime you can find a summary of the functions, and their use here http://www.cadconcepts.co.nz/vle-lisp-function-summary/

    Regards,

    Jason Bourhill

    CAD Concepts


  • Many thanks Jason, that's great !
    Regards
    Konstantin

  • what about Acad compatibility ???
    Some kind of VLE-Emulation for ACAD for all VLE- functions ??
    Is it coming and when ?
  • Dear Konstantin, Dear All,

    I'm just working on a (quite) complete documentation for Bricscad Lisp's new features,
    introduced with V12.2.. It will then be provided as a package in ApplicationCatalog, under
    Developer Tools.

    Of course, the main thing is the VLE function set - and it is a start only, I already have
    a lot of more function in the pipeline (math / geometric / vector).

    Most of new features are under the hood - like "Lisp Optimiser", "Fast COM" (as either needed
    by Linux to have VLA+VLAX+VLR functions properly), "Lisp Profiler" - the side-effect of having
    "Fast COM" under Windows is a better performance here, by factor 10...30 for those (vla) functions;
    this kind of emulation is not yet completed, but already present for a good part of (vla) functions,
    so ongoing work as well.

    All this will be documented + explained then in that documentation (CHM, PDF, HTML).

    AutoLISP compatibility :
    yes, it is there - have a look into Bricscad installation folder - you will find "vle-extension.lsp";
    this file can be used for older Bricscad and AutoCAD; simply load that file in the beginning of
    your Lisp file, and/or in MenuLisp etc.
    Loading in Bricscad V12.2. does not harm, as the functions are only defined if not present yet
    (which it is in V12.2., as built.in).

    As we have declared "vle-extension.lsp" as freeware, you can use that file in your own applications,
    running on older Bricscad / AutoCAD.
    Additionally, that emulation file also contains documentations for the functions ...

    In any case, if someone has an idea / wish / suggestion what to include in VLE functions set :
    everything is highly welcome :-)

    Many greetings to all !
  • @Torsten,

    I couldn't find "vle-extension.lsp" in any of the V12 installation folders. Maybe this is why people are asking for more info.

    Regards,

    Jason Bourhill

    CAD Concepts


  • Many thanks Jason !

    I also found that file not to be installed with Bricscad, this is not what was intended :-(
    Maybe I was not clear enough for our development head, to include that file into installer.

    I will care to get this solved; in the meantime, it is attached here.

    Many greetings to all !

    vle-extension.lsp

  • Congrats and thanks,
    providing a lisp version of built-in functions for compatibility really seems a clever way to go.
    Just one question:
    is e.g. (vle-stringp obj) significantly faster than (= (type obj) 'STR)?
    If not, splitting a single, existing function into ten new doesn't look very appealing to me...
    (Just asking since some of the Visual LISP functions in AutoCAD were said to be even slower than the equivalent AutoLISP code)

    As to wishes:
    Are there currently ways to measure/divide a pline/spline in lisp? (I mean something returning a list with coordinates, maybe with tangent vector?
    Or retrieving surface area / edge length of all entities?
  • Dear Knut,

    for the pline/spline problems : try (vlax-curve-xxx) functions, these are perfect to query any kind of "curve" for length, length at specific position/point etc.;
    (vlax-curve-getarea obj) retrieves the area; needs VLA object names, instead of classical ename ...
    tangents etc. are also to be retrieved by these functions.

    Now for (vle-stringp) - first some benchmark results - I have a good Lisp benchmark, not yet published, but will come - on Vricscad V12.2. and AutoCAD 2008 :
    Bcad :
    * (Standard) : 0.051  VLE-STRINGP : 0.023

    Acad (using vle-extension.lsp emulation) :
    * (Standard) : 0.331  VLE-STRINGP : 0.379

    (Standard) means test using (= (type obj) 'STR) mechanism

    1. small performance reduction under AutoCAD is caused by redirection (1 more (defun) function call/level), but I think, acceptable.
    2. (vle-stringp) in Bricscad V12.2. and higher is ~ 120% faster than (= (type obj) 'STR), so more than doubled speed.

    Explanation for the effects :
    1. (vle-stringp) saves internal Lisp memory :
        as (type obj) returns a Lisp symbol, which is then compared in (= 'STR), it is a temporary object, which needs to
        be created as Lisp symbol, to be stored in Lisp memory, and then triggers earlier GarbageCollection, is that symbol is not used
        -> so (vle-stringp) reduces memory load directly, save time of creating+storing the memory object, and reduces GC calls

    2. (= (type obj) 'STR)is 2 calls : one call to (type) and another call to (= ) function;
        -> of course, 1 call as (vle-stringp= is faster than 2 calls :-)
        -> and using classical code, the result of (type obj) needs to be pushed on Lisp stack additionally, providing the argument
             for (= res 'STR) function; also push/pop on Lisp stack cost time and memory

    Besides, (type) is a quite heavy function, in both systems, as the given object needs to be verified against *many* Lisp data types
    (especially, many VLA/VLAX/VLR) data types, so (type) itself is not that fast;
    in turn, explicitely checking for particular type is (more or less) a single-line statement in internal implementation.

    That documentation for Lisp V12.2. will explain the benefits and improvements (why it is faster, and what memory is saved) for each VLE function.

    I hope this gives a good insight about VLE logic ?

    Many greetings to all !
  • Dear Torsten, Dear Knut,

    many thanks Torsten for your infos and explanations !
    I am looking forward to getting the whole VLE package at the appplications area...

    As for your wishes Knut :
    I have written a routine to calculate and display the Frenet Frame of a curve.
    I don't know your background so for an explanation have a look at
    http://en.wikipedia.org/wiki/Frenet_frame
    This routine calculates and draws the tangent-, normal- and binormal vector of a curve for any measure- or divide value chosen.
    You can call 2 commands :  FrenetF   and  FrenetFP

    The routine draws the three direction vectors ...tangent (red), normal (green), binormal (blue)
    and returns a list in the form of a list of lists , so here is a sequence in the command line

    : frenetf
    Please select the Curve (can be any curve):
    Please specify Operation ? (Measure-step/Devide-step) :    d
    Please input a STEP (any number < path-length = 131.87 :    15

        point on curve                                           a list of  the tangent,  normal  and binormal vector  
    ..........
    (  (6.0 5.5 0.0)     ((-0.0901081 0.987955 0.125796) (-0.961918 -0.0536052 -0.268029) (-0.258058 -0.145157 0.955163))    )
    ((6.16658 11.8179 -0.232523) ((0.218388 0.927047 -0.304779) (0.540884 -0.374945 -0.752902) (-0.812251 -0.000425834 -0.583308)))
    ((9.01309 18.3785 -4.18359) ((0.422161 0.694756 -0.582318) (0.428903 -0.718997 -0.546886) (-0.798638 -0.0188836 -0.601516)))
    ((12.5503 22.9825 -8.99031) ((0.525746 0.490274 -0.695142) (0.37491 -0.867097 -0.328002) (-0.763566 -0.0881703 -0.639682)))
    ((13.9953 23.0201 -10.668) ((-0.125768 -0.933497 0.335807) (-0.605386 0.34038 0.719478) (-0.785933 -0.112806 -0.607935)))
    ((12.5688 17.8933 -7.4538) ((-0.211293 -0.792057 0.572714) (0.865627 0.12048 0.485979) (-0.453923 0.59844 0.660169)))
    ((11.9381 11.4677 -2.51513) ((0.163183 -0.766698 0.620923) (0.984607 0.166501 -0.0531707) (-0.0626187 0.620042 0.782066)))
    ((16.2892 8.19629 0.339643) ((0.99386 -0.0451387 0.101019) (0.0922552 0.842113 -0.531352) (-0.061085 0.537409 0.841106)))
    ((21.0643 11.049 -0.22449) ((-0.150539 0.975208 -0.162196) (-0.924435 -0.0807141 0.3727) (0.350369 0.206045 0.913667)))
    ((19.0052 17.1405 2.70215) ((-0.129979 0.591467 0.795784) (0.451215 -0.679386 0.578653) (0.882899 0.434283 -0.178573)))
    ((19.5189 17.4974 5.89463) ((0.384772 -0.840498 -0.381463) (-0.216369 0.319632 -0.922507) (0.897293 0.437492 -0.0588725)))
    ((22.7957 11.9552 1.46489) ((0.571551 -0.557789 -0.601831) (0.757051 0.64138 0.124518) (0.316548 -0.526785 0.788856)))
    ((27.8673 12.7358 0.197049) ((0.745931 0.655289 0.119097) (-0.231697 0.422961 -0.876025) (-0.624423 0.62586 0.467328)))
    ((32.1113 14.7893 -2.92703) ((0.417686 -0.158827 -0.894602) (-0.500002 -0.862288 -0.0803585) (-0.758641 0.480868 -0.439579)))
    ((35.1616 12.9506 -7.99776) ((0.962581 -0.260321 -0.0753099) (0.151681 0.287261 0.945766) (-0.224569 -0.9218 0.315997)))
    ((38.5349 14.3964 -3.51454) ((0.322095 0.466792 0.823626) (-0.580112 0.784838 -0.217945) (-0.748148 -0.407596 0.523584)))
    ((39.3036 20.7859 1.25827) ((-0.138527 0.973258 0.183245) (-0.382138 0.118172 -0.916518) (-0.913663 -0.196988 0.355549)))
    ((37.7796 28.4172 0.810184) ((-0.155943 0.94857 -0.275492) (0.630468 -0.119117 -0.767021) (-0.760389 -0.293301 -0.579468)))
    ((39.2995 28.8532 -0.177022) ((0.655263 -0.755385 -0.0048522) (-0.628542 -0.548773 0.551165) (-0.419005 -0.358109 -0.834382)))
    ((43.6072 22.7593 0.0536736) ((0.521545 -0.853069 0.0162613) (-0.743708 -0.463861 -0.481384) (0.418197 0.23897 -0.876359)))
    ((46.5 17.5 1.249e-015) ((0.457 -0.889132 -0.024373) (-0.755685 -0.373666 -0.537879) (0.469138 0.264229 -0.84267)))

    You can also call the routine as follows
    (setq  FFlist (c:FrenetF))    
    just to get the list into a variable for further analysis !

    The command  FrenetFP  draws the Frenet Frame at a selected point on the curve and returns the same
    list but only for the selected point.

    : frenetfp
    Select curve:
    select point on curve:_nearest
    Snap to _nearest of:
     ( ( (31.3183 14.9354 -1.427) ((0.528326 0.00847742 -0.848999) (-0.528803 -0.779038 -0.336849) (-0.664258 0.62692 -0.407103)) ))

    In the attachment you find the DWG, the Lisp Source File and a screenshot !
    I hope this help...Enjoy
    If you need changes or additions could help ?

    As for your second wish .... retrieving surface area / edge length of all entities ?
    can you explain more thorougly what exactly you want to do ?

    Regards
    Konstantin


    FrenetFrame.dwg

    imageFrenetFrame.jpg

    FrenetFrame.lsp

  • @Torsten,
    thanks for the explanations, I really appreciate you care so much about speed and memory (so many now don't) .
    It's just that the number of functions has grown into something quite hard to grasp for somebody who only occasionally has a look into lisp (like me)...
    For example (to come back to the wish for area retrieving):
    Instead of
    (vlax-curve-getarea (vlax-ename->vla-object (car (entsel))))
    that I find hard to remember, I would prefer to have something like
    (vle-getarea (car (entsel)))
    that works on every entity that has a surface area, not just curves.
    @Konstantin:
    The maths on wikipedia are way over my head, but it seems the functions you wrote are exactly what I was suggesting (well, even more) ... GREAT and many thanks for sharing!

  • Dear Knut,

    yes, that is indeed a good idea for VLE, to have (vle-get-area) :-)
    Like with (vle-get-perimeter) ...

    I will check if it possible to emulate with normal Lisp (for vle-extension.lsp),
    and whether it can be extended for non-curves ...
    I would assume, you refer to hatches, 3dface, solid, trace ? Or what else can have an area ?

    At least, it is on ToDo list for VLE continuation :-)

    Many greetings to all !
  • @Torsten:
    Thanks for this!
    You didn't mention regions... but maybe there is more:
    I am wondering if a 'get-area' function should be confine to 2d-geometry - meshes and ACIS solids do have a surface, too.
    Maybe it would be best to give it an optional parameter, and (if the parameter is T) return NIL for non-planar entities.
    Would be great if ACIS surfaces would be processed as well - Bricscad currently doesn't even list them.
    @ Konstantin:
    Just had a quick look - on linux, c:frenetf doesn't run ootb, since vlax-get-property is not yet implemented. But no problem - I just replaced calls to SetObjColor with calls to CECOLOR, and it works like a charm. It just surprises me a little that the normal vector doesn't stay upright if you feed the routine a 2d-polyline, but as I said, I don't dig the math...
    Anyway, it is a breeze to rip out a simpler 2d version, that does nothing but return the list of points and tangent vectors, many thanks again!
  • Vle-alert is a welcome addition and works great. (system modal)

    I did notice one problem ... the help-file and vle-extension.lsp shows the format as (vle-alert title msg flags)

    But the format that works is (vle-alert msg title flags).

  • Dear Richard,

    many thanks for reporting !
    I will quickly fix the issue, should of course behave as documented :-)

    If the fix is in vle-extension.lsp as well, I will attach the fixed version here.

    Many greetings to all !
  • Yes, the issue was not in emulation (vle-extension.lsp), but in new built-in function ... just fixed.
    One of next Bricscad version(s) will have this fix included then.

    Greetings to all !
This discussion has been closed.