Author Topic: Does visual lisp + com work on macintosh?  (Read 8067 times)

0 Members and 1 Guest are viewing this topic.

SIDESHOWBOB

  • Guest
Does visual lisp + com work on macintosh?
« on: November 23, 2012, 09:08:08 AM »
As per the title - it is possible to use visual lisp's COM functions (vlax-create-object, vlax-method-invoke etc) on the mac?

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Does visual lisp + com work on macintosh?
« Reply #1 on: November 23, 2012, 09:14:04 AM »
I believe you will need to use the new AutoLISP functions designed for Mac to overcome the inability to use VL:

getpropertyvalue (substitute for vlax-get-property)
setpropertyvalue (substitute for vlax-put-property)

Also,
dumpallproperties (substitute for vlax-dump-object)
ispropertyreadonly (substitute for vlax-property-available-p check-modify parameter)
« Last Edit: November 23, 2012, 09:18:11 AM by Lee Mac »

SIDESHOWBOB

  • Guest
Re: Does visual lisp + com work on macintosh?
« Reply #2 on: November 23, 2012, 09:25:21 AM »
Lee you legend you seem to answer practically everything I ask.

What about creating objects though?  Will the functions you mention be able to create and use external (non-autocad) COM objects - either in process or out?

Lee Mac

  • Seagull
  • Posts: 12906
  • London, England
Re: Does visual lisp + com work on macintosh?
« Reply #3 on: November 23, 2012, 09:40:04 AM »
Lee you legend you seem to answer practically everything I ask.

So far so good  8-)

What about creating objects though?  Will the functions you mention be able to create and use external (non-autocad) COM objects - either in process or out?

To my knowledge, I'm not sure that there are Mac alternatives for the vlax-create-object / vlax-get-or-create-object / vla-getinterfaceobject functions, though, I may be wrong as I don't have much experience working with Mac.


irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Does visual lisp + com work on macintosh?
« Reply #4 on: November 24, 2012, 07:15:54 AM »
AFAIK there are no COM/ActiveX in MAC at all. COM/ActiveX is a Microsoft developed interface system between windows programs and libraries. And it's an old one at that. MS has moved on to DotNet instead of COM, though the legacy COM system is still in operation.

That means that most (if not all) vl functions would not work on MAC. Definitely most of the vlax functions (i.e. the vla derived ones too) would not work since they work through COM. You might find one or two, and some of the vl functions working on MAC - though that would mean they are implemented direct in ADesk's ObjectARX system and do not use COM.

Unfortunately I can only think of using ALisp (entmake / entmakex) to create objects in ACad Mac. Not even sure if command-line calls are without hassles (though I'd be surprised if they don't work at all).
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

SIDESHOWBOB

  • Guest
Re: Does visual lisp + com work on macintosh?
« Reply #5 on: November 24, 2012, 11:47:29 AM »
I don't think it's fair to say that COM is legacy - isn't it what DotNet is made of under the hood?  Though direct use of COM by the app developer is becoming a thing of the past - you have to touch it less and less (thank god!)

Anyway if it doesn't work on mac that does leave a bit of a predicament when it comes to interfacing acad with stuff.  Your suggestion of command line calls is a good one, I'll look into that if I have to, cheers.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Does visual lisp + com work on macintosh?
« Reply #6 on: November 25, 2012, 05:53:46 AM »
COM is legacy: It was originally a replacement for the Win3's DDE, though even that is still around in new windows. It was still the major library in XP, though by then DotNet was starting to take over. And since Vista COM was not being developed / updated anymore.

DotNet is more in-line with Java than with COM. It's DLL files are not normal executables like COM's are, they're "compiled" to IL (Intermediate Language) - same as Java CLASS files which are bitcode (also a type of intermediate language). You can see this as similar to FAS files compiled from VLIDE. COM-DLL's are normal machine code executable files with some specific entry point functions which describe its contents and have specific interfaces for linking objects dynamically - there's no VM used when running COM files, but with DotNet you need the correct version of the VM same as you do with Java's VM. Further, MS made a clean break from COM since that library started to become a spread-open-giant with lots of inconsistencies and bugs. They actually designed the MS DotNet classes from scratch.

COM was never meant to work on anything but windows. Whereas DotNet was intended from the very beginning to be "portable" across systems - though its portability was never enforced like Java's have. Thus we now have lots of system-specific stuff in DotNet as well.

Edit: BTW you might want to look at something I started a while back: http://alisp-ext.wikidot.com/
« Last Edit: November 25, 2012, 06:02:28 AM by irneb »
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

SIDESHOWBOB

  • Guest
Re: Does visual lisp + com work on macintosh?
« Reply #7 on: November 26, 2012, 06:08:52 AM »
I stand corrected.  Thank you :-)

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Does visual lisp + com work on macintosh?
« Reply #8 on: November 26, 2012, 07:08:41 AM »
No prob! I just know this since I went through the whole process since DOS. Started "programming" while at school using the Basic interpreters included in DOS (GW Basic & BasicA). Then through university went all the way from Pascal for DOS through Delphi Win3/95/98/NT3.5 up to C++ & Java for Windows NT 4.0. Then saw the DotNet revolution at the start of the Naughties!
 
It's a pain to have to learn new libraries each time. Especially if you know they won't be there for too long either. Thus far DotNet's been one of the longest running "official" MS libs around (more or less 10 years), only second to COM. This is probably one of my biggest reasons for liking Autolisp (though there are other contending reasons which come very close) so much: its vanilla functions (i.e. non-VLisp) have basically not changed at all in close to 25 years. It's the most consistent library I've come across. And what's more those very same "aincient" functions are the most portable ones too - they all work perfectly in ACad for Mac as well as BricsCAD for Linux.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

enderprime

  • Guest
Re: Does visual lisp + com work on macintosh?
« Reply #9 on: November 26, 2012, 08:28:43 AM »
A distinction should be made here since I was recently researching the same thing. There are standard "AutoLISP" functions that have existed since AutoCAD R14, and there are "Visual LISP" functions that were introduced and integrated since AutoCAD 2000.

Standard AutoLISP functions DO exist one way or another in Mac versions of AutoCAD, though they may be renamed.

Within the Visual LISP category, there is another distinction. Some functions were added simply to add, well, functionality to the language for the programmer. These functions were prefixed [vl-] when added to the existing vanilla AutoLISP functions, but are still considered native as far as the integrated compiler is concerned.

[vl-] functions DO exist one way or another in Mac versions of AutoCAD, though they may be renamed.

The last set of functions also introduced with Visual LISP include those that specifically interface with ActiveX, also known as COM. These functions were prefixed [vla-] or [vlax-], to distinguish that they rely on externally defined type interfaces as standardized by ActiveX defined by Microsoft.

Because of this dependency on a Microsoft technology, [vla-] and [vlax-] functions DO NOT exist on Mac versions of AutoCAD. For the same reason, you also will not find any VBA support or .Net support on Mac.

You can verify what LISP functions you will and will not have access to on Mac in the following Autodesk document:
http://docs.autodesk.com/ACDMAC/2013/ENU/PDFs/acdmac_2013_autolisp_reference_guide.pdf
« Last Edit: November 26, 2012, 08:44:14 AM by ender.prime »

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Does visual lisp + com work on macintosh?
« Reply #10 on: November 26, 2012, 08:56:08 AM »
In agreement to a point. Are you sure ALL the vl-* functions work irrespective of the system? What about functions such as vl-file-copy? Are all of them implemented directly in C++ without referencing any system libraries - if so how would they interoperate with system security?
 
And then towards the other side, e.g.: what about the vlax-ldata-* functions? Do these really use ActiveX - all they do is work on dictionary objects inside the DWG, I can't see why they'd need to go through ActiveX for that - the implementation would have been needlesly complex. So I guess the "truth" is somewhere between your post and my 1st post.
 
Anyhow, the acid-test would be to actually try them on a mac (or for that matter BCad on Linux) to see if they work or not.

Though the OP asked to "create objects" and use the vlax-create-object & vlax-invoke. Those would definitely NOT work on Mac.
« Last Edit: November 26, 2012, 08:59:47 AM by irneb »
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

enderprime

  • Guest
Re: Does visual lisp + com work on macintosh?
« Reply #11 on: November 26, 2012, 09:48:23 AM »
Quote
Are you sure ALL the vl-* functions work irrespective of the system? What about functions such as vl-file-copy? Are all of them implemented directly in C++ without referencing any system libraries - if so how would they interoperate with system security?

Yes, vl- functions work including vl-file-copy and vl-file-delete. Remember that there is a separation between interface and implementation, so the interface (and in this case the specific command name) has remained the same even though the implementation has changed to work with the new file system. Here is a complete list of [vl-] functions included in MacLISP 2013:

  • vl-acad-defun
  • vl-acad-undefun
  • vl-bb-ref
  • vl-bb-set
  • vl-catch-all-apply
  • vl-catch-all-error-message
  • vl-catch-all-error-p
  • vl-cmdf
  • vl-consp
  • vl-directory-files
  • vl-doc-ref
  • vl-doc-set
  • vl-every
  • vl-exit-with-error
  • vl-exit-with-value
  • vl-file-copy
  • vl-file-delete
  • vl-file-directory-p
  • vl-file-rename
  • vl-file-size
  • vl-file-systime
  • vl-filename-base
  • vl-filename-directory
  • vl-filename-extension
  • vl-filename-mktemp
  • vl-list
  • vl-list->string
  • vl-list-length
  • vl-load-all
  • vl-mkdir
  • vl-member-if
  • vl-member-if-not
  • vl-position
  • vl-prin1-to-string
  • vl-princ-to-string
  • vl-propagate
  • vl-registry-delete
  • vl-registry-descendents
  • vl-registry-read
  • vl-registry-write
  • vl-remove
  • vl-remove-if
  • vl-remove-if-not
  • vl-some
  • vl-sort
  • vl-sort-i
  • vl-string->list
  • vl-string-elt
  • vl-string-left-trim
  • vl-string-mismatch
  • vl-string-position
  • vl-string-right-trim
  • vl-string-search
  • vl-string-subst
  • vl-string-translate
  • vl-string-trim
  • vl-symbol-name
  • vl-symbol-value
  • vl-symbolp

Quote
what about the vlax-ldata-* functions? Do these really use ActiveX - all they do is work on dictionary objects inside the DWG..

[vlax-ldata-] functions are gone, and only the entity-level native functions remain:
  • dictadd
  • dictnext
  • dictremove
  • dictrename
  • dictsearch

Quote
Anyhow, the acid-test would be to actually try them on a mac..

I have written and tested a very limited number of functions on mac side on a friend's machine, but so far I can say that if they are listed in the Autodesk documentation for Mac they are working as intended. No, vlax-create functions do not exist in any way. However, using command (or command-s on Mac) is a decent workaround followed by (entget (entlast)). (entmake) is also still on option if you don't mind that method.

One more thing, the almighty (vlax-dump-object) is now (dumpallproperties). It is important to note that just because the ActiveX methods for getting properties is gone, that doesn't change what properties the objects actually have. Use (getpropertyvalue) and (setpropertyvalue) to work with these in MacLISP.

Unfortunately, I am not aware of a translation of vlax-invoke-method..
« Last Edit: November 26, 2012, 02:48:44 PM by ender.prime »

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Does visual lisp + com work on macintosh?
« Reply #12 on: November 26, 2012, 01:34:11 PM »
Thanks for that. I'd still like to know if the vlax-ldata-delete/get/list/put/test would work in Mac. IMO there shouldn't be a reason not to, though it's not listed as compatible. And yes I know of the dict* functions - those are non-VLisp functions (similar to entmod) - they are like a raw version of the ldata stuff.

And of course (self evident) the vlr functions are not listed either. And probably correctly since they use vla-objects in their arguments, at least the call-backs do.
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

enderprime

  • Guest
Re: Does visual lisp + com work on macintosh?
« Reply #13 on: November 26, 2012, 02:46:07 PM »
Ah yes, sorry, you are correct. The vlax-ldata-* functions are not included in MacLISP...

The main problem is that Mac side does not include (vl-load-com). What this function actually does is load extensions for existing ActiveX classes, effectively acting as a bridge between the two libraries.

The exclusion of these extensions means none of the following:

  • ActiveX object model support (controlling external apps by handle)
  • AutoCAD reactor support
  • ActiveX utility and data conversion functions
  • ActiveX data dictionary functions
  • ActiveX curve measurement functions

Also curious, Mac does not include (vl-arx-import), which makes no sense because ARX types should be native.
I can only assume at this point that Apple intends to implement its own API through XCode / Objective C.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: Does visual lisp + com work on macintosh?
« Reply #14 on: November 26, 2012, 03:50:47 PM »
Hi,

I'm surprised the vl-registry* functions work on Mac, as far as I know there's no registry on Mac OS.
Speaking English as a French Frog

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Does visual lisp + com work on macintosh?
« Reply #15 on: November 27, 2012, 12:10:44 AM »
That is strange. Perhaps it's implemented in the ARX to save & read from some file instead (perhaps something like an INI)?
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Does visual lisp + com work on macintosh?
« Reply #16 on: November 27, 2012, 01:06:02 AM »
Another thing which I'm surprised does not work in MAC: vlax-curve-*
 
Especially since those functions actually work faster if you don't send them vla-objects but enames instead. That tells me they're implemented direct in ARX and if the argument contains an ActiveX object it needs to be converted. So you'd guess that it should work extremely easily in Mac ... but apparently it doesn't!  :ugly:
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

enderprime

  • Guest
Re: Does visual lisp + com work on macintosh?
« Reply #17 on: November 27, 2012, 01:59:49 AM »
Hi,

I'm surprised the vl-registry* functions work on Mac, as far as I know there's no registry on Mac OS.

That made me laugh too. Apparently they read/write application property list (plist) key-value pairs now, which is the closest equivalent on Mac. I guess they just didn't want to rename them..  :-o

@irneb

Agreed all around, its retarded. My best guess right now is that something in ObjectARX breaks on Mac. Autodesk was very slow to move AutoCAD over, and has stripped most of the development options now that its there. I'm very interested to see what the future will be for Mac CAD Customization, or if all those poor designers will be stuck dual-booting Windows until the end of time..
« Last Edit: November 27, 2012, 02:10:42 AM by ender.prime »

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Does visual lisp + com work on macintosh?
« Reply #18 on: November 27, 2012, 10:32:13 AM »
Anyhow, the acid-test would be to actually try them on a mac (or for that matter BCad on Linux) to see if they work or not.
Bricscad is introducing a system called Fast-Com to by-pass the com-dependency of lisp functions. Their goal is to implement the VL* functions in Bricscad for Linux and Mac. Because there are (speed) advantages to Fast-Com, this system is also being used in Bricscad for Windows. I don't know to what extent this project is finished, but Fast-Com was introduced during the V12 life-cycle.

By default Fast-Com is switched on, but it can switched off:
Code - Auto/Visual Lisp: [Select]
  1. (lisp$enablefastcom nil) ; Switch Fast-Com off.
  2. (lisp$enablefastcom T)   ; Switch Fast-Com on.

irneb

  • Water Moccasin
  • Posts: 1794
  • ACad R9-2016, Revit Arch 6-2016
Re: Does visual lisp + com work on macintosh?
« Reply #19 on: November 27, 2012, 11:50:16 PM »
I was actually quite surprised by BC. Even the V11 worked on Linux: http://www.theswamp.org/index.php?topic=39158.msg445662#msg445662
 
Though the ActiveX objects themselves just gave nil results, at least the functions didn't just fail. And since then I've run into lots of issues trying to install V12 on a 64 bit linux (Fedora-17), will look into it when time permits again (last time I spent a week going to-and-fro).
Common sense - the curse in disguise. Because if you have it, you have to live with those that don't.

roy_043

  • Water Moccasin
  • Posts: 1895
  • BricsCAD 18
Re: Does visual lisp + com work on macintosh?
« Reply #20 on: November 28, 2012, 04:40:43 AM »
Even the V11 worked on Linux
It may actually be the case that Fast-Com was introduced earlier. I checked for the presence of the (lisp$enablefastcom) function (available in V12.2.18 but not in V11) and just assumed from this that Fast-Com was introduced in V12.