BRICSCAD/AUTOCAD

Hi guys,

Here at our office we took a look at Bricscad and we found it allright.

I am allthough woindering how I can combine DOSLib to load into Bricscad? I tried with a condition statement.

My original lisp loads only arx-files and determins if it 64 or 32 bit version of OS.

Here is the lisp taken from the internet

 

PASTE CODE HERE

 

(defun ISX64 (/ proc_arch) ;; from Owen Wengard
(and
(setq proc_arch (getenv "PROCESSOR_ARCHITECTURE"))
(< 1 (strlen proc_arch))
(eq "64" (substr proc_arch (1- (strlen proc_arch))))
)
)

 ;determine whether appropriate version of DOSLib is already loaded.
 ;if not, try to load it.
(setq CADver (substr (getvar "acadver") 1 2)) ;; i.e., "17", "18", etc.

(setq arxlist (arx))
(if (isX64)
(setq DOSLibname (strcat "doslib" CADver "x64.arx"))
(setq DOSLibname (strcat "doslib" CADver ".arx"))

)

(foreach a arxlist (if (equal a DOSLibname) (setq loadedAtStartup T) ))
(if (not loadedAtStartup)
(vl-cmdf "._arx" "_load" (findfile DOSLibname))
)

 ;verify that load was successful.
 ;if not, quit.
(setq arxlist (arx))
(foreach a arxlist (if (equal a DOSLibname) (setq loadedAtRuntime T) ))
(if (not loadedAtRuntime)
(progn
(prompt "Sorry - DOSLib is not loaded and cannot be found in the
AutoCAD search path.")
(vlr-beep-reaction)
(quit)
)
)

 

I want to rewrite it so it loads brx files if it finds out if a user is running AUTOCAD or BRICSCAD...

May you help me with this?

 

Thanx in advance,

BEst regards

 

 

Comments

  • I think doslib supports  demand-loading via installer now.. Anyway since your already using ACADVER,  just do a

    (if (= (substr (getvar "acadver") 6) "Bricscad")

  • this is untested but maybe something like this

     

     

    ; example filename
    ; doslibV10x32.brx
    ; doslibV17x32.arx
    ; doslibV17x64.arx
    (defun AcadPlatform (/ proc_arch str)
        (if (and (setq proc_arch (getenv "PROCESSOR_ARCHITECTURE"))
                 (< 1 (strlen proc_arch))
                 (eq "64" (substr proc_arch (1- (strlen proc_arch))))
            )
            (setq str "x64")
            (setq str "x32")
        )
        str
    )
    (defun LOADDOSLIB (/ FN)
      (if (= (substr (getvar "acadver") 6) "Bricscad")
       (progn
        (and (not (= 'EXRXSUBR (type dos_about )))
             (setq FN (findfile (strcat "doslibv"
                                        (substr (getvar "_vernum") 1 2)
                                        (AcadPlatform)
                                        ".BRX"
                                )
                      )
             )
             (arxload FN (strcat "\nError loading " FN))
        )
      )
      (progn
        (and (not (= 'EXRXSUBR (type dos_about)))
             (setq FN (findfile (strcat "doslib"
                                        (substr (getvar "acadver") 1 2)
                                        (AcadPlatform)
                                        ".ARX"
                                )
                      )
             )
             (arxload FN (strcat "\nError loading " FN))
        )
        (if (not (= 'EXRXSUBR (type dos_about)))
            (progn (alert
                      "Can't Find doslib.ARX, Make sure its loaded")
                   (exit)
            )
         )
       )
      )
    )
  • oops

    ; example filename
    ; doslibV10x32.brx
    ; doslib17x32.arx
    ; doslib17x64.arx

  • And check for Pro version before loading BRX as Daniel suggested for me:

    (= 2 (boole 1 (getvar "licflags") 2))

  • Loading C:\Users\artur\Desktop\bricdos.lsp
    : (LOAD "C:/Users/artur/Desktop/bricdos.lsp")nil

     

    is what I get

  • Artur: please note that Daniel doesn't use the "standard" filename. Out of the box the filename is: DOSLib10.brx (current version).

    To look for DOSLib10.brx update this section of Daniel's code:

          (and (not (= 'EXRXSUBR (type dos_about )))
    (setq FN (findfile (strcat "doslib" ; letter v removed
    (substr (getvar "_vernum") 1 2) ; (AcadPlatform) removed
    ".BRX"
    )
    )
    )
    (arxload FN (strcat "\nError loading " FN))
    )

    Of course the file also has to be in the search path.

     

  • Artur: To make Daniel's routine run automatically on load, just like your example, add this line at the bottom of the file:

    (LOADDOSLIB)

  • Well... I am sorry to bother you with a simple thing I guess But I can't et it to work :(

    Can't work, I have BricsCAD Trial PRO. I have added support paths where the file is located.

    This is the code.

     


    (defun AcadPlatform (/ proc_arch str)
        (if (and (setq proc_arch (getenv "PROCESSOR_ARCHITECTURE"))
                 (< 1 (strlen proc_arch))
                 (eq "64" (substr proc_arch (1- (strlen proc_arch))))
            )
            (setq str "x64")
            (setq str "x32")
        )
        str
    )
    (defun LOADDOSLIB (/ FN)
      (if (= (substr (getvar "acadver") 6) "Bricscad")
       (progn
        (and (not (= 'EXRXSUBR (type dos_about )))
             (setq FN (findfile (strcat "doslib10"
                                        (substr (getvar "_vernum") 1 2)
                                        (AcadPlatform)
                                        ".brx"
                                )
                      )
             )
             (arxload FN (strcat "\nError loading " FN))
        )
      )
      (progn
        (and (not (= 'EXRXSUBR (type dos_about)))
             (setq FN (findfile (strcat "doslib"
                                        (substr (getvar "acadver") 1 2)
                                        (AcadPlatform)
                                        ".ARX"
                                )
                      )
             )
             (arxload FN (strcat "\nError loading " FN))
        )

        (if (not (= 'EXRXSUBR (type dos_about)))
            (progn (alert
                      "Can't Find doslib.ARX, Make sure its loaded")
                   (exit)
            )
         )
       )
      )
    )
    ;;(LOADDOSLIB)
  • This combines Daniel's code with my two previous posts:

    (defun AcadPlatform (/ proc_arch str)
    (if (and (setq proc_arch (getenv "PROCESSOR_ARCHITECTURE"))
    (< 1 (strlen proc_arch))
    (eq "64" (substr proc_arch (1- (strlen proc_arch))))
    )
    (setq str "x64")
    (setq str "x32")
    )
    str
    )
    (defun LOADDOSLIB (/ FN)
    (if (= (substr (getvar "acadver") 6) "Bricscad")
    (progn
    (and (not (= 'EXRXSUBR (type dos_about )))
    (setq FN (findfile (strcat "doslib" ; letter v removed
    (substr (getvar "_vernum") 1 2) ; (AcadPlatform) removed
    ".BRX"
    )
    )
    )
    (arxload FN (strcat "\nError loading " FN))
    )
    )
    (progn
    (and (not (= 'EXRXSUBR (type dos_about)))
    (setq FN (findfile (strcat "doslib"
    (substr (getvar "acadver") 1 2)
    (AcadPlatform)
    ".ARX"
    )
    )
    )
    (arxload FN (strcat "\nError loading " FN))
    )


    (if (not (= 'EXRXSUBR (type dos_about)))
    (progn (alert
    "Can't Find doslib.ARX, Make sure its loaded")
    (exit)
    )
    )
    )
    )
    )
    (LOADDOSLIB)

    This assumes that the filename is DOSLib10.brx and that the file can be found in the search path. If DOSLib is already loaded it won't be loaded again.

This discussion has been closed.