Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 04/09/2026 in all areas

  1. in good programming you have to figure out where it will fail or do what you don't want. if your ok with turning off layers that end in -PT that its not suppose to. maybe add an output to see what its doing or the command might do that already cant test right now. and while command is slower than vla or entmake and has some other quarks its often times simpler/easier to use. as this for example two lines of code vers what i just posted. (defun c:foo ( / doc layers lay name laylist) (vl-load-com) (setq laylist '()) (vla-StartUndoMark (setq doc (vla-get-ActiveDocument (vlax-get-acad-object)))) (setq layers (vla-get-Layers doc)) (vlax-for lay layers (if (wcmatch (setq name (strcase (vla-get-Name lay))) "*-PT") (progn (setq laylist (cons name laylist)) ;build list of layer names (vla-put-Freeze lay :vlax-true) (vla-put-Off lay :vlax-true) ) ) ) (vla-EndUndoMark doc) (if laylist (progn (princ (strcat "\nLayers frozen and turned off (" (itoa (length laylist)) "):\n")) (foreach n (reverse laylist) (princ (strcat " " n "\n")) ) ) (princ "\nNo Layers Matching *-PT found.") ) (princ) ) You could probably combine those two functions into one using ldata as a toggle between on and off. ill post later tonight.
    1 point
  2. Oh dear, my mistake. I didn't think it through. It's obvious that objects cant be frozen or turned off so I rewrote and shortened my functions to this: ; Freeze and turn off layers with -PT suffix (defun c:zOff () (command-s "_-layer" "_freeze" "*-PT" "") (command-s "_-layer" "_off" "*-PT" "") (princ) ) ; Thaw and turn on layers with -PT suffix (defun c:zOn () (command-s "_-layer" "_thaw" "*-PT" "") (command-s "_-layer" "_on" "*-PT" "") (princ) ) Now they do exactly what I need them to, but is that foolproof? I tested the function in a drawing that contains at least one of the above mentioned layers and on a drawing that doesn't. No issues, only a message like "no matching layers found". That should be fine. I've read that VL(A(X))-functions are faster, but the code code would be bulky. Do you recommend something different from my code? Best regards
    1 point
  3. I'm assuming its the new Notepad and not the one from 1995. it defaults to copy text with formatting. You have three options. You can change the default font and size in notepad settings, disable formatting also in settings ,or use Ctrl + Shift + V to paste as plain text. there also might be a right click paste as plain text option.
    1 point
  4. much easier to use the coords pastable.. I use them mid command with !pp <prev.point>... and needed to comment line '056'
    1 point
  5. You cant freeze\off only the points its either the whole layer or nothing. this makes a selection set and process it to find what layers they are on and turns feezes and turns off those layers. if their are other things on that layer they will also be frozen and off. (defun c:test01 ( / ss lay laylst) (vl-load-com) (setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (setq layers (vla-get-Layers doc)) (if (setq ss (ssget "_X" '((0 . "AECC_COGO_POINT") (8 . "*-PT")))) (foreach ent (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss))) (setq lay (cdr (assoc 8 (entget ent)))) (if (not (member lay laylst)) (setq laylst (cons lay laylst)) ) ) (foreach lay laylst (setq layerObj (vla-Item layers lay)) (vla-put-Freeze layerObj :vlax-true) (vla-put-Off layerObj :vlax-true) ) (prompt "\nNo matching COGO points found.") ) (princ) )
    1 point
×
×
  • Create New...