Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/04/2023 in all areas

  1. Just give me a moment, I'm still working on the calculations to make it as user-friendly as possible.
    1 point
  2. Maybe - (defun 2parea ( p1 p2 ) (abs (apply '* (mapcar '- p2 p1 '(0 0)))) )
    1 point
  3. Apologies - I misread your question - to implement both the minimum & maximum, try the following: (defun c:sellowhigh ( / e i l m n r s z ) (if (setq s (ssget '((0 . "POINT")))) (progn (setq n 1e308 m -1e308) (repeat (setq i (sslength s)) (setq i (1- i) e (ssname s i) z (cadddr (assoc 10 (entget e))) ) (if (< m z) (setq m z)) (if (< z n) (setq n z)) (setq l (cons (cons z e) l)) ) (setq r (ssadd)) (foreach x l (if (or (equal (car x) m 1e-8) (equal (car x) n 1e-8)) (ssadd (cdr x) r) ) ) (princ (strcat "\nMin Z: " (rtos n) " | Max Z: " (rtos m))) (sssetfirst nil r) ) ) (princ) )
    1 point
  4. Ok pulling this apart with explanations (setq ent (nentsel "\nPick an attribute ")) ; using nentsel allows you to pick the attribute rather than a block (setq ent2 (ssname (ssget (cadr ent)) 0)) ; does a reselect and selects block based on attribute (setq bname (cdr (assoc 2 (entget ent2)))) ; gets block name (setq oldtagn (cdr (assoc 2 (entget (car ent))))) ; gets tag name of attribute selected So if you don't want any picking remove the 4 lines and hard code the blockname and tagname. Bname & oldtagn It is coded to look in layouts not model.
    1 point
  5. Why would you want to do that? Sounds like you're creating a mess.
    1 point
  6. This may be a useful starting point. You need block name and attribute tagname. ; simple update 1 attribute across all layouts ; By Alan H Nov 2020 (defun c:1rev ( / len lay plotabs newstr tabname oldtagn ss1 att x y) (setq doc (vla-get-activedocument (vlax-get-acad-object))) (setq tabs (vla-get-Layouts (vla-get-activedocument (vlax-get-acad-object)))) (setq y 0) (setq ent (nentsel "\nPick an attribute ")) (setq ent2 (ssname (ssget (cadr ent)) 0)) (setq bname (cdr (assoc 2 (entget ent2)))) (setq oldtagn (cdr (assoc 2 (entget (car ent))))) (SETQ NEWSTR (getstring "\nEnter new string ")) (repeat (vla-get-count tabs) (vlax-for lay tabs (setq x (vla-get-taborder lay)) (setq tabname (vla-get-name lay)) (if (and (= y x) (/= tabname "Model")) (progn (setvar "ctab" tabname) (if (setq ss1 (ssget "x" (list (cons 0 "INSERT") (cons 2 bname)(cons 410 tabname)))) (foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 0 )) 'getattributes) (if (= oldtagn (strcase (vla-get-tagstring att))) (vla-put-textstring att newstr) ) ) ) ) ) ) (setq y (+ y 1)) ) ) (c:1rev)
    1 point
  7. Using lisp you can change variables, for a selected object, so the (command "DIMLUNIT" .... has no effect on what you have selected. Often with dims though need to reset more than 1 variable. Use dumpit.lsp to look at properties you can change them. For a ssget you need to loop through the selection set and use (ssname ssdim x) x is the selection set item number starts at 0. I would also add a filter to your ssget (setq ssdim (ssget '((0 . "DIMENSION") ))) ;;;===================================================================; ;;; DumpIt ; ;;;-------------------------------------------------------------------; ;;; Dump all methods and properties for selected objects ; ;;;===================================================================; (defun C:Dumpit ( / ent) (while (setq ent (entsel)) (vlax-Dump-Object (vlax-Ename->Vla-Object (car ent)) ) ) (princ) ) ;(dumpallproperties (car (entsel))) example of a change a dim (vla-put-arrowheadsize dimobj 5) Do you know how to loop through a selection set ?
    1 point
×
×
  • Create New...