MUTHUKUMAR1983 Posted April 2 Share Posted April 2 here i try this code not change correctly (defun C:chvis (/ ss i blk curVis newVis) (if (setq ss (ssget "_:L" '((0 . "INSERT")))) (progn (repeat (setq i (sslength ss)) (setq blk (vlax-ename->vla-object (ssname ss (setq i (1- i))))) (if (and (= "AcDbBlockReference" (vla-get-ObjectName blk)) (= :vlax-true (vla-get-IsDynamicBlock blk))) (progn (setq curVis (LM:getdynpropvalue blk "visibility")) (setq newVis (cond ((= "1" curVis) "2") ((= "2" curVis) "3") ((= "3" curVis) "4") ((= "4" curVis) "1") (t (progn (prompt "\nUnknown visibility value, setting to 1.") "1")) ; Default to 1 if visibility is unknown )) (LM:setdynpropvalue blk "visibility" newVis) ) ) ) ) ) (princ) ) ;; Set Dynamic Block Property Value ;; blk - [vla] VLA Dynamic Block Reference object ;; prp - [str] Dynamic Block property name (case-insensitive) ;; val - [any] New value for property ;; Returns: [any] New value if successful, else nil (defun LM:setdynpropvalue (blk prp val) (setq prp (strcase prp)) (vl-some '(lambda (x) (if (= prp (strcase (vla-get-propertyname x))) (progn (vla-put-value x (vlax-make-variant val (vlax-variant-type (vla-get-value x)))) val ) ) ) (vlax-invoke blk 'getdynamicblockproperties) ) ) ;; Get Dynamic Block Property Value ;; blk - [vla] VLA Dynamic Block Reference object ;; prp - [str] Dynamic Block property name (case-insensitive) ;; Returns: [any] Value of property if found, else nil (defun LM:getdynpropvalue (blk prp) (setq prp (strcase prp)) (vl-some '(lambda (x) (if (= prp (strcase (vla-get-propertyname x))) (vla-get-value x) ) ) (vlax-invoke blk 'getdynamicblockproperties) ) ) (vl-load-com) (princ) visibility.dwg Quote Link to comment Share on other sites More sharing options...
BIGAL Posted April 2 Share Posted April 2 My take on problem, I have saved Lee's dynamic block lisp as per name below, rather than having defuns in code, makes sure I get all defuns that are required, sometimes functions call another function in Lee's code Dynamic block get-put-part2.lsp Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.