Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

BricsCAD Mac LISP compatibility (VLA-* functions)

Hello,
since 2002, I wrote a huge number of simple to complex LISP routines
for OtherCAD. 99% works OK in BricsCAD for Windows. Some colleagues,
for some reasons, switched to Mac, and many routines are failing.
For example, one that simply draws multiple of A4 frame with folding
marks stops with this message :

error : no function definition

BricsCAD Version : 21.2.06 (x64)
OS : Mac BIGSUR 11.5.2 (20G95)

Do BricsCAD for Mac support all these vla-* functions ? (all docs I've seen seems to say so)
If not, is there a list of unsupported functions ?
Maybe there's some extension to install to get them on Mac ?

Thanks in advance,
Fabien.

[full routine code here, if needed : ]
(defun C:A4(/ ModLarg ModHaut ad gcs factech ss2 tick)
(vl-load-com)
(setq ad (vla-get-activedocument (vlax-get-acad-object)))
(setq gcs (vla-GetCustomScale (vla-get-ActiveLayout ad) 'numerator 'denominator))
(setq factech (/ denominator numerator))
(setq tick (* 5 factech))
(setq ss2 (ssadd))

(setq ModLarg (getint "how many A4 sheets wide ?"))
(setq ModHaut (getint "how many A4 sheets high ?"))

(command
"_pline"
(list 0 0 0)
(list (* ModLarg 210 factech) 0 0)
(list (* ModLarg 210 factech) (* ModHaut 297 factech) 0)
(list 0 (* ModHaut 297 factech) 0)
"_c"
)
(ssadd (entlast) ss2)

(setq HautTot (* ModHaut 297 factech))
(setq LargTot (* ModLarg 210 factech))

(setq i 1)
(repeat ModLarg
(command "_line" (list (* i 210 factech) 0 0) (list (* i 210 factech) tick 0) "")
(ssadd (entlast) ss2)
(command "_line" (list (* i 210 factech) (- HautTot 0) 0) (list (* i 210 factech) (- HautTot tick) 0) "")
(ssadd (entlast) ss2)
(setq i (+ i 1))
)
(setq i 1)
(repeat ModHaut
(command "_line" (list 0 (* i 297 factech) 0) (list tick (* i 297 factech) 0) "")
(ssadd (entlast) ss2)
(command "_line" (list (- LargTot 0) (* i 297 factech) 0) (list (- LargTot tick) (* i 297 factech) 0) "")
(ssadd (entlast) ss2)
(setq i (+ i 1))
)
)

Comments

  • Hello Fabien,

    indeed, not all of those (~1570) vla-xxx functions are supported yet on Linux/Mac ... main reason is, that Linux/Mac do not have something similar to COM interfaces.

    AutoCAD/Mac does not even support 1 VLA/VLAX/VLR function at all :smile:

    VLAX + VL + VLR functions are fully supported on BricsCAD Linux/Mac - just not all VLA functions;
    the supported properties and methods are documented in our "Lisp Developer Support Package"
    freeware download from
    https://www.bricsys.com/applications/a/?lisp-developer-support-package-(ldsp)-a720-al1176

    But such code as you document here are a good help to extend the supported VLA properties + method functions;
    from your code above I see that "(vla-GetCustomScale)" is not supported yet, of IAcadLayout object ... I will put it on my ToDo list :smile:

    hope this clarifies a bit ?
    many greetings !

  • Workaround:

    (setq
      layoutEnm (vlax-vla-object->ename (vla-get-activelayout ad))
      numerator (vle-entget 142 layoutEnm)
      denominator (vle-entget 143 layoutEnm)
    )
    
  • @Torsten Moses said:

    But such code as you document here are a good help to extend the supported VLA properties + method functions;
    from your code above I see that "(vla-GetCustomScale)" is not supported yet, of IAcadLayout object ... I will put it on my ToDo list :smile:

    Thanks for your quick answer.
    I've extracted the list of vla-* functions I'm using, and removed the ones that are already in the doc's supported lists, here it is :

    --methods--

    vla-addpviewport
    vla-explode
    vla-getcanonicalmedianames
    vla-getcustomscale
    vla-getpapermargins
    vla-getpapersize
    vla-getplotdevicenames
    vla-getprojectfilepath
    vla-object
    vla-objects
    vla-refreshplotdeviceinfo
    vla-remove
    vla-setcustomscale
    vla-setprojectfilepath

    --properties--

    vla-get-displayscrollbars
    vla-get-freeze
    vla-get-layeron
    vla-get-lock
    vla-get-paperspace
    vla-get-paperunits

    vla-put-configname
    vla-put-customscale
    vla-put-dimensionlinecolor
    vla-put-displayscrollbars
    vla-put-extensionlinecolor
    vla-put-freeze
    vla-put-layeron
    vla-put-lock
    vla-put-stylesheet
    vla-put-taborder
    vla-put-textcolor
    vla-put-viewportdefault
    vla-put-viewporton

    If you think sample code giving usage context would be useful, I can send you my routines.

    Fabien.

  • Dear Fabien,

    many thanks ! Really helpful ...
    so I will hurry to get those functions available for V22 in October :-)
    many greetings !

  • Dont have Mac (vlax-get (vlax-ename->vla-object (car (entsel "Pick viewport"))) 'Customscale) is vlax version does it work ?

  • @Roy Klein Gebbinck said:
    Workaround:

    (setq
      layoutEnm (vlax-vla-object->ename (vla-get-activelayout ad))
      numerator (vle-entget 142 layoutEnm)
      denominator (vle-entget 143 layoutEnm)
    )
    

    Thanks.

  • @ALANH said:
    Dont have Mac (vlax-get (vlax-ename->vla-object (car (entsel "Pick viewport"))) 'Customscale) is vlax version does it work ?

    I'll try that monday (don't have a Mac myself neither). But I guess that if that kind of workaround was possible, it would be mentionned in the docs (i.e. the 'customscale' call isn't implemented at all).

  • @Torsten Moses said:
    Dear Fabien,

    many thanks ! Really helpful ...
    so I will hurry to get those functions available for V22 in October :-)
    many greetings !

    Wonderful ! My colleagues are delighted !

  • Dear Fabien, Dear Roy,

    Dont have Mac (vlax-get (vlax-ename->vla-object (car (entsel "Pick viewport"))) 'Customscale) is vlax version does it work ?

    yes, that is VLA based code :-)

    But I guess that if that kind of workaround was possible, it would be mentionned in the docs (i.e. the 'customscale' call isn't implemented at all).

    as mentione, there are >= 1500 COM properties + methods, ~ 350 are yet implemented ... documenting aroudn 1200 missing properties + methods, and their potential workarounds (such as Roy perfectly showed) would take more time to document than to implement :-)

    And yes, if colleagues use Linux or Mac, they have to pay a price for it, and to accept consequences :-(
    Under AutoCAD/Mac, those "consequences" are even much higher (no VLA functionality at all, no VLR reactors, no DCL dialogs, and much more ...);
    Linux + Mac are not Windows, and miss a LOT of basic programmers* APIs, both parties never really cared for "developer support", and the price they (and Linux + Mac customers) pay is "less applications" ... just the natural consequence of such a self-focused strategy ... sad enough about that.

    many greetings !

  • Didn't consider using CANNOSCALEVALUE instead? This is obviously different to using the current print scale applied to the layout, but is easy to access.

    Regards,
    Jason Bourhill
    BricsCAD V21 Ultimate
    CAD Concepts

  • Out of interest, it is also possible to create this as a parametric block. Attach an example.

    Regards,
    Jason Bourhill
    BricsCAD V21 Ultimate
    CAD Concepts

    zip
    zip
    Test_PaperSize.zip
    70K
    ParametricPaperSize.png
    798 x 858 - 32K
  • @Torsten Moses said:
    Under AutoCAD/Mac, those "consequences" are even much higher (no VLA functionality at all, no VLR reactors, no DCL dialogs, and much more ...);

    They did add DCL support to the latest release, but since there is no way to load a partial menu its still very lacking !!!

  • Dear Terry,

    They did add DCL support to the latest release,

    I seemd to recall this, but was not sure about :-) So thanks for clarification ...
    lack of VLA/VLAX/VLR/VL functionality is also somewhat severe :-)
    many greetings !

  • edited September 15

    @Torsten Moses said:

    lack of VLA/VLAX/VLR/VL functionality is also somewhat severe :-)

    Even though I bought VitalLisp from Basis before the 'desk did, I never adopted the VL functionality on a large scale (only when it couldn't be done in native). That worked out well in attempting to repurpose the Lisp for ACMAC until I hit the wall with no partial menu support. They continue to treat ACMAC like a second class CAD citizen. ACMAC doesn't even have a DWGPROPS command.

    If BricSys wanted to take over the MAC CAD environment, add the ability to run .NET code in BricsCAD Mac. I know Microsoft has done some work in that area.

  • Dear Terry,

    If BricSys wanted to take over the MAC CAD environment, add the ability to run .NET code in BricsCAD Mac. I know Microsoft has done some work in that area.

    maybe ... but likely, that kind of .NET support (which I think is also only very partially available at Linux, named Mono) is much too less ...
    .NET based development requires the entire .NET framework and all to be available, including compilers, frameworks etc. ...
    I was told that the amount of code for the MS .NET is even bigger than the code for Windows OS itself :-)

    Imho, one major reason for starting that .NET system on Windows was that Linux/Ubuntu was a major success at that time, and Microsoft was afraid to loose market share ... hence, invented .NET :-) As WIndows-only ...
    So for now, Microsoft reached their goal - all .NET based development remains "on-windows" ...
    personally, I never found a real reason to adapt to .NET, C++ was + is always enough
    (besides the fact, that Microsoft made some newer libraries like database interfaces only for .NET, to attract developers - they did not provide same for C++, by intention (!), to get devs attracted, very poor logic) ...
    and now, .NET based development has to pay the price for that decision : no Linux, no Mac ...
    and besides the fact, that running managed code inside an unmanaged host (Acad, Bcad) is a terrible design fault by itself, .NET was never designed to cooperate inside unmanaged code, it was always & only "closed box" system ... until Microsoft "invented" the "mixed-mode" hack ... and also this has consequences, which are obviously ignored/overlooked/unknown tzo 95% .NET developers :-(

    On the other side, 20 years ago when COM (OLE/OLE2/DCOM before) was provided, Microsoft made it explicitly platform-independent ... and invited Linux to also implement same COM ... naturally, never happened.

    many greetings !

  • edited September 16

    @Torsten Moses said:

    And yes, if colleagues use Linux or Mac, they have to pay a price for it, and to accept consequences :-(

    I agree.
    I don't understand why they made the move, seems like they've been attracted by the Mac's "cuteness", architects, you know...
    (they did that just afterI left the office - I'm maintening the routines collection as a friendly courtesy)
    Apple has an history of making big changes (Motorola to Intel, and now Intel to M1), forcing developpers to adapt, while Microsoft
    has an history of long backwards compatibility (sometimes at the cost of some clumsiness, well...). They should have known that.

    BTW, I made a mistake in my list, I included "vla-object" and "vla-objects", which doesn't exist. They popped because the strings are part of "vlax-ename->vla-object".

  • @Jason Bourhill said:
    Out of interest, it is also possible to create this as a parametric block. Attach an example.

    Thanks, that's clever.

  • Dear Fabien,
    I think I can feel with you :-) When decisions are made, based on "feelings" rather than "facts" ... :-)
    But that's how the world goes ...
    I will hurry to get all those mentioned VLA functions available for V22 then ... somewhat optimistic :-)
    many greetings !

  • Hi, I've been evaluating BricsCAD for some time now on account of the Linux support, and I'm very impressed by the existing vla-* support. We have some existing Lisp scripts that we'd like to continue to use, so I grepped the vla functions in the code base like Fa3ien did. I removed the documented functions from my list, and what remains is below:

    In common with Fa3ien's list:
    vla-AddPViewport
    vla-get-freeze
    vla-get-lock
    vla-get-CustomScale
    vla-Get-PaperSpace
    vla-put-customscale
    vla-put-freeze
    vla-put-lock

    Not on Fa3ien's list:
    vla-Display
    vla-getloopat
    vla-get-objectid
    vla-get-standardscale
    vla-get-textalignmentpoint
    vla-put-plottable
    vla-put-target
    vla-put-xscalefactor
    vla-put-yscalefactor
    vla-put-zscalefactor
    vlax-vbinteger

    Thanks for your attention.

  • Dear sbuller,

    many thanks for your feedback ! I have added your new functions to my list, for V22 (end of October) :-)

    I just checked "vlax-vbinteger" - it should be available, as integer 2 :
    (print vlax-vbinteger)
    is it really missing for you ?

    many greetings !

  • Am I missing something so none of the vlax functions are available either ? (vlax-put obj 'xscalefactor 2)

  • Dear Alan,
    no, you are not missing something :-)

    As the "xscalefactor/yscalefactor/zscalefactor" properties are not (yet) implemented for Linux/Mac, all the related (vla-get-xscalefactor), (vlax-get-property obj 'xscalefactor) and (vlax-get obj 'xscalefactor) are not available.

    I will hurry to get the above-mentioned properties + methods being implemented for V22 ...
    many greetings !

  • I added 78 more COM functions (methods + properties) for V22 for Linux/Mac ... all those listed here, and more.

    To note : since V20 we have those particular "Non-COM-Properties" (on all platforms) functions as AutoLISP introduced with version 2012 :

    (dumpallproperties ename [context])
    (ispropertyreadonly ename property)
    (getpropertyvalue ename property)
    (setpropertyvalue ename property value)

    BC specific :
    (ispropertyvalid ename property)

    also BC specific :
    under BricsCAD, also all properties of the MCAD+BIM+SheetMetal+Civil are accessible as well;
    also documented in our LDSP :
    LDSP
    https://www.bricsys.com/applications/a/?lisp-developer-support-package-(ldsp)-a720-al1176

    many greetings !

Sign In or Register to comment.
Origami
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam