Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 08/20/2019 in all areas

  1. Unbelievable!!! I want to thank you very much Tharwat and Emmanuel for you contribution, you just have no idea how much time and effort this will save me next week and going into the future! You guys are awesome and so darn smart!!! They both work great and does exactly what I want it to do. Consider this thread closed. Thank you very much again, David
    1 point
  2. Hi, This should be more than enough I believe. (defun c:Stamp ( / sel int ent obj) ;; Tharwat - Date: 20.Aug.2019 ;; (and (setq int -1 sel (ssget "_X" '((0 . "INSERT") (66 . 1)))) (while (setq int (1+ int) ent (ssname sel int)) (and (= (vla-get-EffectiveName (setq obj (vlax-ename->vla-object ent))) "Dynamic Stamp") (vl-some '(lambda (x) (if (= (vla-get-propertyname x) "Visibility1") (progn (vlax-put x 'Value "IFC") t))) (vlax-invoke obj 'getdynamicBlockproperties)) (foreach att (vlax-invoke obj 'getattributes) (and (= (vla-get-tagstring att) "DATE") (vla-put-textstring att "20/08/19")) ) ) ) ) (princ) ) (vl-load-com)
    1 point
  3. @dlanorh Thank you it worked !!!
    1 point
  4. Emmanuel, you are awesome. It works like a charm! Could a line be added to code to include date? I'm sorry for being picky but it would eliminate me using Lee's bfind. If it's to much trouble, please don't worry at all. Thank you much!!!
    1 point
  5. Okay, like this Command SDSV, for Set Dynamic Stamp Value (bottom function) It will change all the stamps in the dwg. Perhaps you have a stamp on each Layout, but you're currently on model space. Regardless, it will change all. (vl-load-com) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; GET ;; Get Dynamic Block Property Value - Lee Mac ;; Returns the value of a Dynamic Block property (if present) ;; blk - [vla] VLA Dynamic Block Reference object ;; prp - [str] Dynamic Block property name (case-insensitive) (defun LM:getdynpropvalue ( blk prp ) (setq prp (strcase prp)) (vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'value))) (vlax-invoke blk 'getdynamicblockproperties) ) ) ;; Get Dynamic Block Property Allowed Values - Lee Mac ;; Returns the allowed values for a specific Dynamic Block property. ;; blk - [vla] VLA Dynamic Block Reference object ;; prp - [str] Dynamic Block property name (case-insensitive) ;; Returns: [lst] List of allowed values for property, else nil if no restrictions (defun LM:getdynpropallowedvalues ( blk prp ) (setq prp (strcase prp)) (vl-some '(lambda ( x ) (if (= prp (strcase (vla-get-propertyname x))) (vlax-get x 'allowedvalues))) (vlax-invoke blk 'getdynamicblockproperties) ) ) ;; Get Visibility Parameter Name - Lee Mac ;; Returns the name of the Visibility Parameter of a Dynamic Block (if present) ;; blk - [vla] VLA Dynamic Block Reference object ;; Returns: [str] Name of Visibility Parameter, else nil (defun LM:getvisibilityparametername ( blk / vis ) (if (and (vlax-property-available-p blk 'effectivename) (setq blk (vla-item (vla-get-blocks (vla-get-document blk)) (vla-get-effectivename blk) ) ) (= :vlax-true (vla-get-isdynamicblock blk)) (= :vlax-true (vla-get-hasextensiondictionary blk)) (setq vis (vl-some '(lambda ( pair ) (if (and (= 360 (car pair)) (= "BLOCKVISIBILITYPARAMETER" (cdr (assoc 0 (entget (cdr pair))))) ) (cdr pair) ) ) (dictsearch (vlax-vla-object->ename (vla-getextensiondictionary blk)) "ACAD_ENHANCEDBLOCK" ) ) ) ) (cdr (assoc 301 (entget vis))) ) ) ;; Get Dynamic Block Visibility State - Lee Mac ;; Returns the value of the Visibility Parameter of a Dynamic Block (if present) ;; blk - [vla] VLA Dynamic Block Reference object ;; Returns: [str] Value of Visibility Parameter, else nil (defun LM:getvisibilitystate ( blk / vis ) (if (setq vis (LM:getvisibilityparametername blk)) (LM:getdynpropvalue blk vis) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; SET ;; Set Dynamic Block Visibility State - Lee Mac ;; Sets the Visibility Parameter of a Dynamic Block (if present) to a specific value (if allowed) ;; blk - [vla] VLA Dynamic Block Reference object ;; val - [str] Visibility State Parameter value ;; Returns: [str] New value of Visibility Parameter, else nil (defun LM:SetVisibilityState ( blk val / vis ) (if (and (setq vis (LM:getvisibilityparametername blk)) (member (strcase val) (mapcar 'strcase (LM:getdynpropallowedvalues blk vis))) ) (LM:setdynpropvalue blk vis val) ) ) ;; Set Dynamic Block Property Value - Lee Mac ;; Modifies the value of a Dynamic Block property (if present) ;; 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)))) (cond (val) (t)) ) ) ) (vlax-invoke blk 'getdynamicblockproperties) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Effective Block Name - Lee Mac ;; obj - [vla] VLA Block Reference object (defun LM:effectivename ( obj ) (vlax-get-property obj (if (vlax-property-available-p obj 'effectivename) 'effectivename 'name ) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Set Dynamic Stamp Value (defun c:sdsv ( / ss blockname val i obj) ;; settings (setq blockname "Dynamic Stamp") (setq val "IFC") (setq ss (ssget "_X" (list '(0 . "INSERT") ))) ;; selection of all blocks on the dwg, even if you're not on the right layout (model/paper) (setq i 0) (repeat (sslength ss) (setq obj (vlax-ename->vla-object (ssname ss i))) (if (= blockname (LM:effectivename obj)) ;; for dynamic blocks you need to know the effective name, (assoc 2 entity) doesn't get you what you need (LM:SetVisibilityState obj val) ) (setq i (+ i 1)) ) (princ) )
    1 point
  6. I respectfully disagree. It is an exact solution. Centering a circle of R2.38 (blue) anywhere on the circumference of the R2.32 circle (yellow) will position the circle tangent to the R0.06 circle. I agree that since B is above the center of the R0.06 circle the tangent point will be below its center (consistent with my post). Why did you mention quadrant?
    1 point
  7. No. Nothing works unless the form is hidden as @rkmcswain alluded to above. The "form" is Modal. Nothing will work until it hidden or ended. Are you collecting the exit state from the dialog, as you're using (done_dialog 1). I collect it by using (setq x_val (start_dialog)) Then change (action_tile "bt01" "(Inblk \"D_Poste\"\"9/300\" nil ) (done_dialog 1)") to (action_tile "bt01" "(done_dialog 1)") and after unloading the dialog (cond ( (= x_val 1) (Inblk "D_Poste" "9/300" ""))) You cannot set an attribute 'TEXTSTRING value to nil, it will error so you send it the null string "" If you are doing several block you can store the values in strings eg (action_tile "bt01" "(progn (setq blk \"D_Poste\" t1 \"9/300\" t2 "") (done_dialog 1))") Then (cond ( (= x_val 1) (Inblk blk t1 t2)))
    1 point
  8. Yes. You can't do this. See also: http://help.autodesk.com/view/ACD/2020/ENU/?guid=GUID-EA46DBF6-227F-409E-ABBB-DFC8CCE2C82F If you need the user to interact with the dialog further, then hide it, then restore it. Otherwise, close the dialog before trying to do any commands, as described in the link above.
    1 point
×
×
  • Create New...