Jump to content

Leaderboard

Popular Content

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

  1. If you have super long text the 3 code could fail if the contents is not within the first entry: IMO it's much easier to select all text then remove items that don't match. (defun c:seltxt (/ ss) (if (setq ss (ssget "_X" (list '(0 . "*TEXT") (cons 410 (getvar 'ctab))))) (progn (foreach e (mapcar 'cadr (ssnamex ss)) (or (wcmatch (strcase (vla-get-textstring (vlax-ename->vla-object e))) "*DESIGNER*") (ssdel e ss) ) ) (sssetfirst nil ss) ) ) (princ) ) But you could also use the FIND command to do the same.
    3 points
  2. like StevenP said This needs an or logic. what your ssget is looking for text that have both 1and 3 strings. were you need to be looking for one or the other. http://www.lee-mac.com/ssget.html#logical (defun C:seltxt (/ SS) (setq SS (ssget "_X" (list '(0 . "*TEXT") '(-4 . "<OR") '(1 . "*DESIGNER*") '(3 . "*DESIGNER*") '(-4 . "OR>") (cons 410 (getvar 'ctab))))) (sssetfirst nil ss) (princ) ) --edit '(3 . "*DESIGNER*") worked for me Steven. Looks like SLW210 updated the file maybe thats why?
    3 points
  3. For your search you will need to put an OR statement to get the 1 or 3 texts, at the moment it is searching 1 and 3 and if true for both (Lee Mac has a good explanation and examples on his website) I tried this and -quickly- just searching for '(3 . "*DESIGNER*") didn't work for me, but '(1 did... not sure why yet though.
    2 points
  4. Wrong. AutoLISP does not use the backslash to escape wildcard characters. It is, as ronjonp has stated, the reverse quote. @Emmanuel Delay If you would like to escape all wildcard characters, take a page from Lee Mac's book and have a go using the iterative version of this. All the escape characters in that function is entailed in the list of numbers '(35 64 46 42 63 126 91 93 45 44). The asterisk has the ascii number of 42, therefore if you remove that from the list, that should escape everything except the asterisk, which is what you're after. For any other characters if you're unsure, just invoke (ascii ".") or (ascii ",") or the character you wish in the command line, and remove that number from the list.
    1 point
  5. Seems you need to use regen to "show" the updated state. Weird freezing layers works without a regen but not for thawing them. as for not showing up in the drop down menu. it probably doesn't update the status in the middle of a lisp. Adding regen command after both should fix this. (defun c:frz () (setq Drawing (vla-get-activedocument (vlax-get-acad-object))) ;needed for regen (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "Cabinet")) :vlax-true) (vla-Regen Drawing acAllViewports) (getpoint) (vla-put-freeze (vlax-ename->vla-object (tblobjname "layer" "Cabinet")) :vlax-false) (vla-Regen Drawing acAllViewports) ) --edit Same thing with updating a block with lisp if you don't regen it won't show the updates. Also updated original code above.
    1 point
  6. You have to escape ( ` ) the ( , ) in your pattern: (wcmatch "EV_003_VES_-0,5" "EV_00*_VES_-0`,5")
    1 point
  7. 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.
    1 point
  8. I also did some code, but my version strictly is doing rectangles in circular path - if there is central one it's also calculated giving bad result, and beside this it's also little buggy...
    1 point
×
×
  • Create New...