Author Topic: lisp compatibility between Bricscad and AutoCAD  (Read 3848 times)

0 Members and 1 Guest are viewing this topic.

FengK

  • Guest
lisp compatibility between Bricscad and AutoCAD
« on: May 07, 2008, 05:04:53 AM »
Hello,

For those who have both Bricscad and AutoCAD, what is the lisp compatibility between them? Can you run the same codes in both products without much change, if any?

Thanks!



It's Alive!

  • Retired
  • Needs a day job
  • Posts: 7494
  • AKA Daniel
Re: lisp compatibility between Bricscad and AutoCAD
« Reply #1 on: May 07, 2008, 08:50:38 AM »
Most things work very well without any change, but there are functions here and there that arenít working yet.  The good thing is that if you find something, they are pretty fast a getting a fix out.  So far I found vla-offset doesnít work on a polyline yet, and some issues dealing with WMI.  I havenít done any DCL stuff so I can say. Overall Itís looking good though  8-)
Retired

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 7494
  • AKA Daniel
Re: lisp compatibility between Bricscad and AutoCAD
« Reply #2 on: May 07, 2008, 08:58:11 AM »
For example this works in both AutoCAD and Bricscad (just donít laugh at my lisp writing skills)  :lol:

Code: [Select]
;;;++--
;;;++ LISP COMMANDS LISO & LUISO --
;;;++ © 2008 DANIEL MARCOTTE --
;;;++ COMMAND LISO ISOLATE LAYER(S) DERIVED FROM SELECTED OBJECT(S) --
;;;++ OTHER "ON" LAYER(S) WILL BE TURNED OFF AND LOCKED. --
;;;++ COMMAND LUISO RETURNS LAYERS BACK TO THEIR PREVIUS STATE --
;;;++ GLOBALS *DRAWINGISINFLUX* *MYGLOBALLAYERLIST* --
;;;++ FOR BRICSCAD 8.2.6 OR NEWER
;;;++ todo add fade code :)
;;;++--
(DEFUN CRP:TABLE (S / D R);MP
 (WHILE (SETQ D (TBLNEXT S (NULL D)))
  (SETQ R (CONS (CDR (ASSOC 2 D)) R))
 )
)
;;;++--
(DEFUN CRP:ISON (NAME)
 (IF (EQ :VLAX-TRUE
  (VLAX-GET-PROPERTY
   (VLAX-ENAME->VLA-OBJECT
    (TBLOBJNAME "LAYER" NAME)) 'LAYERON))
  1
  0
 )
)
;;;++--
(DEFUN CRP:ISLOCKED (NAME)
 (IF (EQ :VLAX-TRUE
  (VLAX-GET-PROPERTY
   (VLAX-ENAME->VLA-OBJECT
    (TBLOBJNAME "LAYER" NAME)) 'LOCK))
  1
  0
 )
)
;;;++--
(DEFUN CRP:TURNOFF (NAME)
 (VLAX-PUT-PROPERTY
  (VLAX-ENAME->VLA-OBJECT
   (TBLOBJNAME "LAYER" NAME)) 'LAYERON :VLAX-FALSE)
)
;;;++--
(DEFUN CRP:TURNON (NAME)
 (VLAX-PUT-PROPERTY
  (VLAX-ENAME->VLA-OBJECT
   (TBLOBJNAME "LAYER" NAME)) 'LAYERON :VLAX-TRUE)
)
;;;++--
(DEFUN CRP:UNLOCK (NAME)
 (VLAX-PUT-PROPERTY
  (VLAX-ENAME->VLA-OBJECT
   (TBLOBJNAME "LAYER" NAME)) 'LOCK :VLAX-FALSE)
)
;;;++--
(DEFUN CRP:LOCK (NAME)
 (VLAX-PUT-PROPERTY
  (VLAX-ENAME->VLA-OBJECT
   (TBLOBJNAME "LAYER" NAME)) 'LOCK :VLAX-TRUE)
)
;;;++
(DEFUN CRP:GETONLIST (/ L)
 (SETQ L '())
 (FOREACH E (CRP:TABLE "LAYER")
  (IF (= 1 (CRP:ISON E))
   (SETQ L (CONS (CONS E (CRP:ISLOCKED E)) L))
  )
 )
 L
)
;;;++--
(DEFUN CRP:GETSELECTIONLIST (/ C L LAYERNAME S)
 (PRINC "Select object(s) on the layer(s) to be isolated")
 (SETQ L '()
       S (SSGET)
 )
 (IF S
  (PROGN
   (SETQ C 0)
   (WHILE (< C (SSLENGTH S))
    (SETQ LAYERNAME (VLAX-GET-PROPERTY
     (VLAX-ENAME->VLA-OBJECT
      (CDR (CAR (ENTGET (SSNAME S C))))) 'LAYER)
  L (CONS (CONS LAYERNAME (CRP:ISLOCKED LAYERNAME)) L)
  C (1+ C)
    )
   )
  )
 )
 L
)
;;;++--
(DEFUN CRP:REMOVEITEMS (L1 L2)
 (FOREACH E L2
  (SETQ L1 (VL-REMOVE E L1))
 )
 L1
)
;;;++--
(DEFUN CRP:REGEN()
 (VLA-REGEN
    (VLA-GET-ACTIVEDOCUMENT
     (VLAX-GET-ACAD-OBJECT))
       AcACTIVEVIEWPORT)
)
;;;++--
(DEFUN C:LISO (/ LAYERNAME SELECTIONLIST)
 (VL-LOAD-COM)
 (IF (EQ *DRAWINGISINFLUX* NIL)
  (PROGN
   (SETQ SELECTIONLIST (CRP:GETSELECTIONLIST))
   (IF (> (LENGTH SELECTIONLIST) 0)
    (PROGN
     (SETQ *DRAWINGISINFLUX* T
           *MYGLOBALLAYERLIST*
             (CRP:REMOVEITEMS (CRP:GETONLIST) SELECTIONLIST))
     (SETVAR "CLAYER" (CAR (CAR SELECTIONLIST)))
     (FOREACH E *MYGLOBALLAYERLIST*
      (CRP:TURNOFF (CAR E))
      (CRP:LOCK (CAR E))
     )
     (CRP:REGEN)
    )
   )
  )
  (PRINC "\nDoh! run luiso first")
 )
 (PRINC)
)
;;;++--
(DEFUN C:LUISO ()
 (VL-LOAD-COM)
 (IF (EQ *DRAWINGISINFLUX* T)
  (PROGN
   (SETQ *DRAWINGISINFLUX* NIL)
   (FOREACH E *MYGLOBALLAYERLIST*
    (CRP:TURNON (CAR E))
    (IF (= (CDR E) 0)
     (CRP:UNLOCK (CAR E))
    )
   )
   (CRP:REGEN)
  )
  (PRINC "\nDoh! run liso first")
 )
 (PRINC)
)
;;;++EOF--
Retired

SomeCallMeDave

  • Guest
Re: lisp compatibility between Bricscad and AutoCAD
« Reply #3 on: May 07, 2008, 09:01:13 AM »
In my current version (8.1.14), many of the vlax-curve... functions don't yet work.  Bricsys is working on them though.

But I can't download the latest version   :-(    It always stops with about 1 meg (of 64-65 megs) to go.  Anyone else having that problem?

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 7494
  • AKA Daniel
Re: lisp compatibility between Bricscad and AutoCAD
« Reply #4 on: May 07, 2008, 09:10:12 AM »
...
But I can't download the latest version   :-(    It always stops with about 1 meg (of 64-65 megs) to go.  Anyone else having that problem?

I havenít had this problem, I wonder if they have a mirror site, or can SwampExpress it to ya :laugh:
Retired

SomeCallMeDave

  • Guest
Re: lisp compatibility between Bricscad and AutoCAD
« Reply #5 on: May 07, 2008, 09:19:38 AM »

I haven’t had this problem, I wonder if they have a mirror site, or can SwampExpress it to ya :laugh:

I sent them an email this morning asking the same thing.  I have been having the problem for a while, but an email this morning reminded me of the trouble.

So I'm hopeful that I can upgrade.  I hate being  behind  :)

FengK

  • Guest
Re: lisp compatibility between Bricscad and AutoCAD
« Reply #6 on: May 07, 2008, 03:11:37 PM »
Most things work very well without any change, but there are functions here and there that arenít working yet.  The good thing is that if you find something, they are pretty fast a getting a fix out.  So far I found vla-offset doesnít work on a polyline yet, and some issues dealing with WMI.  I havenít done any DCL stuff so I can say. Overall Itís looking good though  8-)

Thanks Denial. I'm glad to know that. How about xdata and xrecord? Can Bricscad handle them?

Does Bricscad also have a COM interface, so I can automate it with languages like Python?

MickD

  • King Gator
  • Posts: 3520
  • (x-in)->[process]->(y-out)
Re: lisp compatibility between Bricscad and AutoCAD
« Reply #7 on: May 07, 2008, 06:09:15 PM »


Does Bricscad also have a COM interface, so I can automate it with languages like Python?

yep, it also has the vba ide but only with the pro version.

I'm not sure how all this will port to Linux though when they complete the native Linux version.
Forth is like the Tao: it is a Way, and is realized when followed.
Its fragility is its strength; its simplicity is its direction - Michael Ham

"The E in Javascript stands for 'easy'." ó Florin Pop tweet

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 7494
  • AKA Daniel
Re: lisp compatibility between Bricscad and AutoCAD
« Reply #8 on: May 08, 2008, 09:31:21 AM »
Most things work very well without any change, but there are functions here and there that arenít working yet.  The good thing is that if you find something, they are pretty fast a getting a fix out.  So far I found vla-offset doesnít work on a polyline yet, and some issues dealing with WMI.  I havenít done any DCL stuff so I can say. Overall Itís looking good though  8-)

Thanks Denial. I'm glad to know that. How about xdata and xrecord? Can Bricscad handle them?

Does Bricscad also have a COM interface, so I can automate it with languages like Python?

Yes, both xdata and xrecords work, both in traditional lisp and through ActiveX.
The other API worth mentioning is DRX which is similar to ARX, and if you want to do .NET
you can play around with this http://www.theswamp.org/index.php?topic=21601.msg261346#msg261346
Retired