Load a lisp routine from the new vs studio editor into a drawing?

Load a lisp routine from the new vs studio editor into a drawing?

Anonymous
Not applicable
1,005 Views
1 Reply
Message 1 of 2

Load a lisp routine from the new vs studio editor into a drawing?

Anonymous
Not applicable

With the old VLIDE, you could click on the load button and the lisp routine is loaded into your drawing, ready to roll.

But I can't seem to figure out the steps to do that in the new vs studio editor.

Is this possible or do I have to go back into the drawing and use the (load "lispfiel.lsp") or the Load Application dialog each time?

0 Likes
1,006 Views
1 Reply
Reply (1)
Message 2 of 2

andkal
Collaborator
Collaborator

I don't use VSC much but I suppose it cannot perform such operation in separate program (in this case Austocad).
But if you find some extension for VSC that will copy to clipboard a filepath of your file after with just a keyboard shortcut, then you can use the following Lisp routine to load your test-lisp easier. More about the application>here<.

;;; =================================================
;;;        QUICKAPPLOAD_v1_01.LSP     
;;;
;;;        Written by Andrzej Kalinowski,     www.autolisps.blogspot.com
;;;        v1.00 - 16.07.2016
;;;        v1.01 - 03.03.2019 - VLS and ZELX added to supported file formats
;;;
;;;        Command: QA or QUICKAPPLOAD - loads path of autocad application stored in clipboard
;;;
;;; =================================================
;
(vl-load-com)
(defun c:QA () (c:QUICKAPPLOAD))
(defun C:QUICKAPPLOAD (/ txtstring txtstringlen ext1 lispname pozslash)
    (setq txtstring (TXTFROMCLIPBOARD) );geting path (string type) from clipboard

    ;-----------------------------------------
    ;checks if text string is a path to autocad app
    ;-----------------------------------------
    (setq
         txtstringlen (strlen txtstring)
         ext1 (strcase (substr txtstring (- txtstringlen 3) txtstringlen) )
    );setq
    
    (if
        (not
            (or
                (= ext1 ".LSP"); Autolisp files
                (= ext1 ".VLX"); Visual Lisp Executables
                (= ext1 ".FAS"); Fast load Autolisp files
                (= ext1 ".ARX"); ObjectARX files
                (= ext1 ".CRX"); Core ObjectARX files
                (= ext1 ".DVB"); VBA files
                (= ext1 ".DBX"); ObjectDBX files
                (= ext1 ".VLS"); ObjectDBX files (ZWCAD analoque format to VLX)
                (= ext1 ".ZELX"); ObjectDBX files (ZWCAD analoque format to FAS)
            );or
        );not
        (progn
            (princ "\nIts not a path to a Autocad App file")
            (exit)
        );progn 
    );if
    ;-----------------------------------------
    ;reading of the name of the lisp
    ;-----------------------------------------
    (setq
            lispname (vl-list->string (reverse (vl-string->list txtstring) )) ;reversing of string
      pozslash (vl-string-position (ascii "\\") lispname);findong of "\\" sign position
      lispname (substr lispname 1 pozslash);cuting name of file from the path
      lispname (vl-list->string (reverse (vl-string->list lispname) ) );reversing of string back
    );setq
    ;-----------------------------------------
    ;loading of the lisp
    ;-----------------------------------------
    (if (load txtstring nil)
        ;(princ (strcat "\nLoaded lisp: " lispname) )
        (princ (strcat "\nLoaded lisp: " lispname "\t\tFile path: " txtstring) )
        (princ (strcat "\n" lispname " Lisp didnt load!!!!!!!!!!!!!!") )
    );if
    (princ)
);defun
;;; =======================================================
;;;                          TXTFROMCLIPBOARD                           
;;; =======================================================
(defun TXTFROMCLIPBOARD (/ htmlfl PrntWndw CBdata txtstr1)
    (setq
            htmlfl (vlax-create-object "HTMLfile");starts application
            PrntWndw (vlax-get-property htmlfl 'ParentWindow)
            CBdata (vlax-get-property PrntWndw 'ClipBoardData)
    );setq
    ;(vlax-dump-object CBdata t);->displays supported methods: -> fod ClipboardData: clearData, GetData and SetData
    (setq
            txtstr1 (vlax-invoke-method CBdata 'GetData "TEXT");returns variant
            txtstr1 (vlax-variant-value txtstr1);Returns the value of a variant 
    );setq
    (vlax-release-object htmlfl)

    txtstr1
);defun

 Example of usage:
QUICKAPPLOAD.gif


• www.autolisps.blogspot.com - Productivity plugins for Autocad and Autocad MEP
• Autodesk AppStore
0 Likes