Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/16/2021 in all areas

  1. You were close, just needed to use findfile for each path: (if (or (findfile (strcat "\\path\\" "one.txt")) (findfile (strcat "\\path\\" "two.txt")) ) ; one of the files was found .. do stuff ) Or if you need to determine if both files were found, you can use cond : (setq file1 (findfile (strcat "\\path\\" "one.txt"))) (setq file2 (findfile (strcat "\\path\\" "two.txt"))) (cond ( (and file1 file2) (princ "found both files") ; do stuff... ) ( file1 (princ "found file1") ; do stuff... ) ( file2 (princ "found file2") ; do stuff... ) (t (princ "no files were found") ; do stuff... ) ); cond
    2 points
  2. You may need to look at the relationship of the attribute to the insert point of the 1st block picked then apply that to second block based on its insertion point.
    1 point
  3. Something like this. (defun c:pl-c ( / ss ent k x y) (setq ss (ssget)) (setq lst '()) (repeat (setq x (sslength ss)) (setq ent (vlax-ename->vla-object (ssname ss (setq x (1- x))))) (cond ((= (vla-get-objectname ent) "AcDbLwpolyline")(setq pt (vlax-curve-getstartpoint ent))) ((= (vla-get-objectname ent) "AcDbLine")(setq pt (vlax-get ent 'StartPoint))) ) (setq lst (cons pt lst)) ) (setq x 0.0 y 0.0) (repeat (setq K (length lst)) (setq pt (nth (setq k (1- k)) lst)) (setq x (+ (car pt) x)) (setq y (+ (cadr pt) y)) ) (setq pt (list (/ x (length lst))(/ y (length lst)))) (setq rad (distance pt (nth 0 lst))) (command "circle" pt rad) (princ) )
    1 point
  4. Indeed that is also a good solution. But I thought you wanted actual circles, and that method gives polylines.
    1 point
  5. if you have the shortcut link then you -should- be able to get the relevant file path from that. I haven't tried it but this suggests you can do that in VBA ( https://social.msdn.microsoft.com/Forums/en-US/fd6a0d4c-94ea-43b0-87d7-a706eeb04734/how-to-retrieve-the-target-of-a-shortcut-file-in-vb-code ). I don't use VBA so I have no idea if it works or not.. so assuming you can, you should be able to put that in the vl-file-copy and go from there?
    1 point
  6. I have added strcase, so you can also answer in lower case. If you don't do if for both cases, the program only terminates when "N" is present. (initget (strcase "Y N")) (setq request (getkword "Want to do something more? [Yes/No] ")) (if (wcmatch request "N") (vl-exit-with-error (alert "the lisp is finished")) ) (alert "i will do some more commands..")
    1 point
  7. Let me educate you with how I would do it (there's more than one way to skin a lisp file). Quick overview: -Create a folder outside of AutoCAD's install to keep all your autolisp files (and any other custom files) -Add that folder to your File Search Path in AutoCAD -Load the Lisp file in AutoCAD -Execute the Lisp file in AutoCAD Setup: 1. Create a folder to house your custom files. I use C:\autocad_custom\ 2. Create a sub-folder for your lisp files. I use C:\autocad_custom\autolisp\ 3. Put your custom (downloaded) lisp file in the autolisp folder. 4. Start AutoCAD. 5. Go to Tools->Options and select the FILES tab. 6. Expand the Support File Search Path then click ADD on the right side. 7. Click BROWSE and find the autolisp folder you created earlier and click OK and OK to make the changes. Loading the Lisp file: 8. Type APPLOAD (AP for short) at the command prompt and hit enter. 9. Browse to your autolisp folder and click on the lisp file you want, then click LOAD and then CLOSE. Using the Lisp file: 10. Usually you type the name of the lisp file (once loaded) to use it. Sometimes, once loaded, the author displays what you need to type in ordered to use that lisp file. If the name (minus the .lsp extension) doesn't work, and the author didn't inform you what to type, then you'll need to open the lisp file (either in VLIDE or NOTEPAD) and look at the (defun c: ) part. What comes after the c: is what you need to type to run the file (once loaded). Example: C:SteelBeam ~ type steelbeam C:RodShelf ~ type rodshelf
    1 point
×
×
  • Create New...