Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 09/13/2018 in all areas

  1. Fuccaro tried the code had a little problem with the foreach l1 lst but anyway got the dwglist to have a play. I used 2* as our dwgs all start with a year date eg 2018123. Just a suggestion you can open the list up in say lee-mac List to dcl select the name rather than asking for an item number "ListBoxV1-2.lsp" There is though a maximum limit in the list box something like 256 items. (if (not LM:listbox)(Load "listboxV1-2")) (setq n (nth 0 (lm:listbox "Pick dwg" dwglist 2))) (command "fileopen" "y" (nth n DWGlist))
    1 point
  2. You could also dig through the dict... Here, LSName being the mleader style name and tag being the tag we seek for... (defun c:tst ( / LSName tag mldict mlstyle maxval mlsdef interrupt subent mlssubents found tmp vlobj) (setq LSName "Standard") (setq tag "SEQ_NO") (setq mldict (cdr (assoc 350 (member '(3 . "ACAD_MLEADERSTYLE") (entget(namedobjdict)))))) (setq mlstyle (cdr (assoc 350 (member (cons 3 LSName) (entget mldict))))) (setq maxval 0) (if (setq mlsDef (entget mlstyle)) (foreach subent (setq mlsSubents (massoc 330 mlsDef)) (if (and (= (vla-get-objectname (vlax-ename->vla-object subent)) "AcDbMLeader") (setq tmp (massoc 330 (entget subent))) ) (foreach x tmp (if (and (= (vla-get-objectname (setq vlobj (vlax-ename->vla-object x))) "AcDbAttributeDefinition") (= (vla-get-TagString vlobj) tag) ) (progn (setq found (cdr(assoc 302 (member (cons 330 x) (entget subent))))) ;(alert found) (if (vl-every '(lambda (x) (< 47 x 58)) (vl-string->list found )) (setq maxval (max maxval (atoi found))) ) ) ) ) ) ) ) (if (not found) (princ (strcat "\n"tag " not found in " LSName" MLStyle")) ) (alert (strcat "Next leader should have a seq_no of " (itoa(1+ maxval)))) (1+ maxval) ) (defun massoc (key alist / x nlist) (foreach x alist (if (eq key (car x)) (setq nlist (cons (cdr x) nlist)) ) ) (reverse nlist) ) the vl-every make sure only numbers are taken in consideration. I take the max value found, and increment by 1 to determine the next one. Cheers.
    1 point
  3. I would say the trick to using AutoCAD for piping isos is to not draw a 2D iso, but rather a Ortho layout but viewed in a 3D iso view. As an example, in MS, switch to a SW Isometric view, turn Ortho on. Start drawing your iso, when you need to show a radius you just use fillet command, need a valve, insert one and it will look perfect, text is entered the same as always, just like dimensions. No need for iso text styles, iso dim styles; no need for every block to be created in different planes, etc. Wish you had shown that from a SE isometric view, no problem - switch to SE and finish and print. When you have to show a Z direction then you will need to manipulate the UCS to input text and dims in the right location and plane, so that takes some learning but not much.
    1 point
  4. I've sent my previous post in a hurry, so let me add here a few sentences. To search for a file named 1A-1234yyy, you should enter *1234* All the files that match the name (and are in the search path, of course) are listed. Enter the number of the desired file to start it. The code could be improved a little, so that: -if only one file is found, it is opened immediately -if more files are found, they are all listed (as it does now) AND AutoCAD is switched to the text screen waiting for your input Oh, and you must replace the search path in the second line of the program. Does this help?
    1 point
  5. (defun c:FindIt() (setq path "C:\\Users\\miklos.fuccaro\\Documents") (setq DWGlist nil) (dwgs path) (setq fn (getstring "enter file name to search for ")) (setq matches nil i 0) (foreach file DWGlist (cond ((wcmatch (vl-filename-base file) fn)(princ (strcat "\n" (itoa i) " " file))) ) (setq i (1+ i)) ) (princ "\n>>>>>>") (command "fileopen" "y" (nth (getint "\nenter number of file to open\n") DWGlist)) ) (defun DWGs(path) ;grab all DWGs starting from PATH -including subfolders (setq lst (vl-directory-files path)) (foreach l1 lst (cond ((or (= l1 ".")(= l1 "..")) nil) ((vl-file-directory-p (strcat path "\\" l1))(dwgs(strcat path "\\" l1))) ((= (vl-filename-extension l1) ".dwg") (setq DWGlist (cons (strcat path "\\" l1) DWGlist))) ) ) ) Something like this one? Thanks BIGAL for your useful comment.
    1 point
  6. Fuccaro & vdungcom a couple of suggestions to narrow the search speed. The (findfile) function will only search the current AutoCAD search path if a drive/directory prefix is not supplied. To quote help getfile supports a starting directory (getfiled "Title" "Directory Path and/or File name" "File Extension" Flag)
    1 point
×
×
  • Create New...