Jump to content

vla-sendcommand


ollie

Recommended Posts

Hi All

 

I thought I'd share an observation

(setq adoc(vla-get-activedocument(vlax-get-acad-object)))
(vla-sendcommand adoc "something here such as lisp\r")

 

the \r return carriage is neccesary

 

Combine this with an vl-get-driectory-files and a for loop and you can run lisp scripts on a batch of drawings

 

I post this because I couldn't find information on this the other day.

 

sorry if its old news

 

Ollie

Link to comment
Share on other sites

2. Insert dwg file as block

Next post ShaggyDoc publish full

=========================================================

In addition, when a scenario is not handled situations. You will need Autocad for any file, any SHX, he asks the question and the whole scenario is broken. This way you can handle the familiar files, which would not be emergencies.

 

I mostly use now this feature

 

(defun ru-batch-file-operations (first_message files_list test_func 
                                                quoted_func / do_it) 
  (if (not first_message) 
    (setq do_it t) 
    (setq do_it ((eval test_func) first_message)) 
  ); _ End of if 
  (if do_it (mapcar quoted_func files_list)) 
  (princ) 
) 

 

More arguments:

first_message - a warning message before launching large-scale operations, or NIL, if the warning is not required;

files_list - Complete list of names of processed files;

test_func - the name of the test functions excretive first_message, and if the start of processing the files on the list;

quoted_func - the name of the function performing the operation with the name of a file from the list.

 

Since files can be made in any transaction, not necessarily requiring the opening of the files. Here is a sample application, which has no practical meaning, but shows the mechanism of the function:

 

 (ru-batch-file-operations (strcat "List Files" 
"\n USE CAUTION! \n\n will do) 
(list "ru-lib-bolt.dwg" "ru-lib-build.dwg" 
 "ru-lib-car.dwg") 
'ru-yes 'print) 

 

In this example, the main functions performed by the operation is print , then there will simply be removed the names of files. A test function ru-yes , displays a warning message, and if you press «Yes», print the list of hazardous operations will be implemented.

 

Of course, we need features that make something useful, and they can develop as long as you want, above all, that at the moment function ru-batch-file-operation s and a test, and the main function of have been determined .

 

Model algorithm (not universal), used by us for processing foreign DWG-files:

1. creates a new blank working file;

2. it into the processed file as a block;

3. performed the required processing;

4. re-processed block is stored in a file.

 

In particular variants are possible nuances (such as the explode of the inserted block, recording in another directory, keeping LOG-files), but binding was duplicated several times before and after removal of «garbage», providing a constant «void» the working file.

 

This way I have handled thousands of times before the files of topographic tablets. Run on a day off and left to give. But the method of is not universal . DWG to where only a model - well-suited.

Link to comment
Share on other sites

A similar issue was discussed at Russian-speaking forum.

A few ideas in my :o + computer translate.

1. Batch mode. Use bat+scr+lsp file. See attach.

 

I tried that, it's actually easier to have a scr+lsp, as a .bat file will open up a new instance of AutoCAD for each file (at least, it did with me). I have a setup that has a lisp create a script, and within that script it declares variables to use in a sub-function of the lisp, which the script calls.

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...