samehhosny Posted February 28, 2020 Posted February 28, 2020 Good day Everyone, I have an old topic here where I wanted to visualize my lisp routines into drop down menus. I have succeeded in developing an excel sheet to automate the process of adding and removing items into my menus without any hassle or any typing mistakes. However, I am stuck in a small portion of my lisp routines where I would like to call a specific command loaded from a .VLX file into my big .LSP routine. To be more clear, I have the following setup: Excel Sheet has all my data with all commands with their relative routines needed to exist in mylisp.lsp Same excel sheet has the hierarchy of the drop down menu. Each menu item is connected the commands above by calling the command with a simple macro. So far, all my lisp routines consists of native autocad commands which I do not face any issue with them so far. Last menu with last set of lisp routines should consist of simple and native commands combined with an external command loaded from .VLX file. every time I try to include this command loaded from the .VLX into another .LSP file, it can not be loaded and I can not pass any parameter to it as well. Let me show simple example: This is the routine which includes only native autocad commands: BlockName contains 7 different attributes (Some Text). (DEFUN C:EBMSS () (COMMAND "INSERT" "BlockName" "S" "1" "R" "0" (setq p (getpoint "\nSpecify insertion point: ")) "Some Text" "Some Text" "Some Text" "Some Text" "Some Text" "Some Text" "Some Text" ) (COMMAND "LAYMCH" "L" "" "N""ITEM")) Same lisp routine with added the last command which is loaded from the VLX file. It does not work. (DEFUN C:K0 () (COMMAND "INSERT" "BlockName" "S" "1" "R" "0" (setq p (getpoint "\nSpecify insertion point: ")) "Some Text" "Some Text" "Some Text" "Some Text" "Some Text" "Some Text" "Some Text") (COMMAND "LAYMCH" "L" "" "N""ITEM") (COMMAND "BLOCKC" "L" "R" "0" "PREFIX TEXT" "SUFFIX TEXT")) ;This command is executed from loaded .VLX file. FYI, I do not have access to the source code and I do not need to. All I need is to be able to initiate the command into the lisp routine to auto select the last added block with some attributes and passing some arguments to it. I wish if anyone can help me achieving this target. By the way, I am developing these programs to help me and my teammates speeding up the work progress at our design office. Thanks in advance and wish you all a wonderful day. Regards, Sameh Hosny Quote
samehhosny Posted February 29, 2020 Author Posted February 29, 2020 Hello again everyone, After days of searching, I found the solution. Natively, you can not pass arguments for an external lisp command loaded inside another lisp as per autodesk visual lisp help files. The only way, I found it is through activex which through some keystrokes to autocad command line. Here is my routine: (defun c:mycommand () (vl-load-com) (setq thisdrawing (vla-get-activedocument(vlax-get-acad-object))) (vla-SendCommand thisdrawing (strcat "blockc" "\n" "L" "\n" "\n" "R" "\n" "0" "\n" "K" "\n" "." "\n")) (princ) ) That's it. Hope it helps anyone else searching for the same scenario. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.