Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 07/29/2019 in all areas

  1. Two points, getvar will give you information about the requested System-Variable. For example, try changing the settings for osnap, then enter at the console (getvar 'osmode). Since fuzz ist just a simple symbol, which points to the value of a variable named fuzz, "getvar fuzz" will always give an error. BTW: if fuzz would be a existing system-variabe, you would have to quote fuzz or sett it within " " a) (getvar 'fuzz) b) (getvar "fuzz") And second, fuzz holds a "floating" value , such as 0.123 Using floating,or integer, values within a string requires always a conversion, otherwise it will throw an error. Change (strcat "All points/objects at zero \n[within " (getvar fuzz) " tolerance]" ) to (strcat "All points/objects at zero \n[within " (rtos fuzz 2) " tolerance]" ) Please read lisp documentation for the use fo itao and rtos functions. Note that your code requires the setting for fuzz, leaving it blank will also cause an error. regards Wolfgang
    1 point
  2. Try this .. will only keep the attribute values if the source and destination have the same amount of attributes .. if there are multiple the order of values is unknown! (defun c:bs (/ a at b co fl j n o r) ;; RJP » 2019-07-28 (cond ((and (setq a (car (entsel "\nPick block to replace with new: "))) (setq b (car (entsel "\nPick block to be used for replace: "))) (= "INSERT" (cdr (assoc 0 (entget a))) (cdr (assoc 0 (entget b)))) (setq n (vla-get-effectivename (vlax-ename->vla-object a))) (setq b (vlax-ename->vla-object b)) (/= n (vla-get-effectivename b)) ) ;; Check if the blocks have the same amount of attributes (setq fl (and (setq at (vlax-invoke (vlax-ename->vla-object a) 'getattributes)) (= (length at) (length (vlax-invoke b 'getattributes))) ) ) (foreach bl (mapcar 'cadr (ssnamex (ssget "_x" (list '(0 . "insert"))))) (cond ((= n (vla-get-effectivename (setq o (vlax-ename->vla-object bl)))) (setq co (vla-copy b)) (foreach p '(insertionpoint rotation xscalefactor yscalefactor zscalefactor) (vlax-put co p (vlax-get o p)) ) (if fl (mapcar '(lambda (r j) (vla-put-textstring r (vla-get-textstring j))) (vlax-invoke co 'getattributes) (vlax-invoke o 'getattributes) ) ) (entdel bl) ) ) ) ) ) (princ) ) (vl-load-com)
    1 point
  3. It's always good to hear a puzzle has been solved. Thanks for letting us know.
    1 point
×
×
  • Create New...