Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 10/12/2022 in all areas

  1. All the steps you've carried out to APPLOAD are correct. AutoLISP routines are indeed saved in a file with the .lsp extension. Depending on the nature of the contents of the script, the behavior after the APPLOAD command is invoked will vary. The last thing you need to do is invoke the command into the command line. In AutoLISP, whenever you define a function using DEFUN, any name given to the function that prefixes with "c:" are the types of functions that you can call through the command line. In your example script, the function has been assigned the name "c:test". This means that, once you've loaded your LISP routine, you can begin by invoking "TEST" from the command line to execute the function. Whether the command is successful or not is a different story. Here's a more detailed explanation in this link.
    2 points
  2. Sorry for the late response. Other than one problem, this worked great! I couldn't get freezing to work with the VLA commands, though. This problem even persists in Autocad. This will freeze the cabinet layer just fine: (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "Cabinet")) :vlax-true) This doesn't seem to thaw the layer: (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "Cabinet")) :vlax-false) To make things even more confusing, it looks like the vla command doesn't freeze the layer completely. I'm wondering if this might be why it wont thaw. before freeze: after freeze: Also, I've simplified the code to test these statements, to try to limit the variables. (defun c:qfrz () (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "Cabinet")) :vlax-true) (getpoint) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "Cabinet")) :vlax-false) )
    1 point
  3. You have to escape ( ` ) the ( , ) in your pattern: (wcmatch "EV_003_VES_-0,5" "EV_00*_VES_-0`,5")
    1 point
  4. Yes sir, that is what i want. thank you I very beginning on custom Lisp.
    1 point
  5. You just want a number, prefixed to the current Layout name? What I did: "Layout 1" becomes "1 - Layout 1" That's with this extra " - " (vla-put-name lyt (strcat (itoa lyt_ord) " - " lyt_name)) If you just want "1Layout 1", then remove the " - ": (vla-put-name lyt (strcat (itoa lyt_ord) lyt_name)) Or put whatever you want there. command LPN Is this what you want? (vl-load-com) ;; using some Lee Mac's code posted here above ;; LPN for Layout Prefix Number (defun c:lpn ( / lyt lyt_name lyt_ord) ;; Obtain list of layout objects, current names, and sort index (vlax-for lyt (vla-get-layouts (vla-get-activedocument (vlax-get-acad-object))) (if (= :vlax-false (vla-get-modeltype lyt)) (progn (setq lyt_name (vla-get-name lyt)) ;; current name (setq lyt_ord (vla-get-taborder lyt)) ;; order of the layout. 1, 2, 3... the loop doesn't nececarily go through the same order (vla-put-name lyt (strcat (itoa lyt_ord) " - " lyt_name)) ) ) ) )
    1 point
  6. Hello Have to do a job that involves around 3000 loops + 2500 connection diagrams & IO-lists. Bottom line was, either I do it in half of the time and half of the money or else... (the job goes overseas) For example a loop diagram has a transmitter , connected to a Junction Box , then to a control panel + IO panel. Loops have to be made as-built (update revision, remove clouds etc). Ok already have an app for that. But I also have to check each loop against JB and CP channel (oh crap...) So I came up with the idea to first read all the titleblock titles in the project folder and save this to a (txt) file. Then, having the loop open in AutoCad , I wanted to be able to either type in part of the title in the search list box or select the JB or CP symbol and open the drawing. And that's when I decided to create my very own BFF (Bulk File Finder) App is still in its beta but so far it seems to be doing what I hoped it to do. (but some little points may yet come to surface , but hey , baby is only one weekend old so gimme a break) Make sure you put in (1) blockname of your (title)block , (2) name(s) of attributes with the titles in it, separated by comma's , (3) select your drawing source folder and (4) choose create (don't forget to save it afterwards) In the top left listbox (green) you can put in some search strings and you can also save this. When all this is done and you press ok , it should find all the drawing (titles) matching the search criterea. Some of the Select and Find buttons (purple section) are not working yet because those will involve some company special ops. Most of my time went into the interface and progress bar thats activated when scanning for folders, drawings & titles. Maybe it will be helpfull to others , maybe not because it might be too specific to my own situation but I present it on an as-it-is basis and because its been a while I posted something and posting on CadTutor seems to be getting rarer. If its not working or helpfull : trashcan , yes you can , because of my workload I don't have much time to do user request's RlxMyBFF.lsp
    1 point
  7. This is why I try to stay away from using (command it has the highest chance not to work between software. They say they use visual lisp so give this a try. (defun c:cnc ( / p b l ) ;(setq b (sl:boundary)) ;this doesn't set b to the offset in sl:boundary (sl:boundary) (vla-offset (vlax-ename->vla-object (setq b (entlast))) 0.1875) ;neg to offset the other direction ;(command "offset" "3/16" b '(0.0 0.0 0.0)"") (entdel b) ;deletes entity by name ;(vl-cmdf "erase" b "") ) (defun sl:boundary ( / p g n e) (setq Drawing (vla-get-activedocument (vlax-get-acad-object))) ;needed for regen for some visual lisp ;(setq g 0 ;g not needed (setq ;e (cdr(assoc -1(entget (entlast)))) e (entlast) l (getvar 'clayer) ) (while (eq e (entlast)) ;misclick check? (setq p (getpoint "Select Inside Object: ")) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "Cabinet")) :vlax-true) ;freeze layer Cabient (vla-Regen Drawing acAllViewports) (setvar 'clayer "cnc") ;set cnc to current layer ;(vl-cmdf "_.-layer" "freeze" "cabinet" "set" "cnc" "") (vl-cmdf "boundary" "a" "i" "n" "+x" "" p "") (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "Cabinet")) :vlax-false) ;thaw layer Cabinet (vla-Regen Drawing acAllViewports) (setvar 'clayer l) ;set current layer back to ;(vl-cmdf "_.-layer" "thaw" "cabinet" "set" l "") ;(setq n (cdr(assoc -1(entget(entlast))))) ;(cond ((not(equal e n ))(setq g 1))) ;(if (not (eq e (entlast))) (setq g 1)) ) )
    1 point
×
×
  • Create New...