woodman78 Posted April 27, 2012 Author Posted April 27, 2012 I was thinking of writing a routine that will show only ACTIVE rev lines + 1 Blank depending on the last current Rev number instead of Dynamic block with visibilty. What do you think? That sounds very good pBe. We would only ever have one title block per layout but we could have 5 or 6 layouts per drawing. It may be the case that they don't always rev up the same though. It may be the case for instance a drawing we have L2472-LA-01,02,03_A0 would have all 3 layouts at rev A0. Then one of them might need to be changed and we would generally rev up only that one so we would have L2472-LA-01,02_A0,03_A1. It may be messy. Is there a better way of doing this? Thanks for all your help with this. Quote
woodman78 Posted April 27, 2012 Author Posted April 27, 2012 Would it be the case that you could select the layouts you want to apply the changes to and leave the others as they are. Even by some kind of a list box or something. Does that get very messy in terms of coding? That is why I was thinking of dynamic blocks. The CTAB setting you gave me yesterday works for an individual tab which means I could control visibility in each. And if there was some way to also apply to all. Quote
pBe Posted April 27, 2012 Posted April 27, 2012 Would it be the case that you could select the layouts you want to apply the changes to and leave the others as they are. Even by some kind of a list box or something. Does that get very messy in terms of coding? . Not at all messy. Doable Yes. Is that what you want? That is why I was thinking of dynamic blocks. The CTAB setting you gave me yesterday works for an individual tab which means I could control visibility in each. And if there was some way to also apply to all. The snippet at post # 15 will do that for you. (_sel arg1 arg2 arg3) Do you already have a routine to change visibility? I could have sworn the file you attached is not a Dblock? or was it DWGTruview conversion the hosed the file? Did you try the DCL code at post # 20? Quote
woodman78 Posted April 27, 2012 Author Posted April 27, 2012 I tried the DCL and it looks good. I was only looking at dynamic blocks because I was thinking that it couldn't be done by layers since the layer would be turned on on the alyout that I didn't want to chagne too. But if it can be done by coding then that would be great. Thanks. Quote
woodman78 Posted April 30, 2012 Author Posted April 30, 2012 Hi pBe, did you get a chance to look at this? Quote
pBe Posted April 30, 2012 Posted April 30, 2012 Hi pBe, did you get a chance to look at this? Not really Woodman78, All this time i thought your down with btraemoore approach of using coordintes to determine the last rev. btraemoore, I like that. I could setup my block and drop them in as needed. How could I count? By taking the first blank attribute and setpping back one? I personally would've done it differently, IMO targeting coordinates is not very reliable. But really, i wanted to see how you'll manage with that approach before I take another look at your reqeust. Besides, I focused on your DCL instead of the lisp rouitne. So tell me, how did it go with the btraemoore suggestion? Quote
woodman78 Posted April 30, 2012 Author Posted April 30, 2012 pBe. I don't like the coord approach either. Too many things to go wrong I think. I am going to try to press on with the dynamic block method. I have a rev-box dynamic block that I at the moment but when I load the lisp it won't recognise it. I changed the block name to be "rev-box" as the code but it won't detect it. Is it something to do with it being dynamic? Quote
woodman78 Posted April 30, 2012 Author Posted April 30, 2012 pBe, another problem I am hvaing is that the dialog seems to keep reverting back to an earlier version. I have deleted the attab.dcl from my directory and pasted in your modified dcl and it might display your dcl once and then revert back to mine. I have replaced it a few times but this keeps happening. Any ideas? Is the code suing the old one? EDIT: No worries I got this sorted. Quote
pBe Posted April 30, 2012 Posted April 30, 2012 pBe. I don't like the coord approach either. Too many things to go wrong I think. I am going to try to press on with the dynamic block method. I have a rev-box dynamic block that I at the moment but when I load the lisp it won't recognise it. I changed the block name to be "rev-box" as the code but it won't detect it. Is it something to do with it being dynamic? Press away Woodman78.If you need our help here, we need a copy of your DB. pBe, another problem I am hvaing is that the dialog seems to keep reverting back to an earlier version. You probably have more than one copy of that DCL. especially if the call to dialog box is without a path. it will search on the current folder your working on then thru SFSP. Quote
woodman78 Posted May 1, 2012 Author Posted May 1, 2012 pBe, this is what I have so far. I have used LeeMac's dynamic block functions to try to change the block visibility but I am having some problems. This is the dynamic block. EDIT: Since I made the block dynamic the code won't recognise it anymore. (prompt "\nATTAB Loaded....Type ATTAB to run.....") (defun c:attab12 (/) (setq ss1 (ssget "X" (list '(0 . "INSERT")'(66 . 1)'(2 . "rev-box")(cons 410 (getvar 'CTAB))))) (if ss1 (progn (setq count 0 emax (sslength ss1) ) (while (< count emax) (setq en (ssname ss1 count) ed (entget en) blkn (dxf 2 ed) ) (if (= "rev-box" blkn) (setq count emax found T ) (setq count (1+ count)) );if );while (if found (ddisplay) (alert "\nDrawing Sheet has No Attributes \n Use Manual Edit" ) );if );progn (alert "\nIncorrect Drawing Sheet \n Use Manual Edit" ) );if (princ) );defun ;;;********************************************************** (defun ddisplay (/) (setq dcl_id (load_dialog "attab12.dcl")) (if (not (new_dialog "attab12" dcl_id)) (exit) );if (setq edata (entget en)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (action_tile "rbl9" "(setq visistate \"Line9\")") (action_tile "rbl8" "(setq visistate \"Line8\")") (action_tile "rbl7" "(setq visistate \"Line7\")") (action_tile "rbl6" "(setq visistate \"Line6\")") (action_tile "rbl5" "(setq visistate \"Line5\")") (action_tile "rbl4" "(setq visistate \"Line4\")") (action_tile "rbl3" "(setq visistate \"Line3\")") (action_tile "rbl2" "(setq visistate \"Line2\")") (action_tile "rbl1" "(setq visistate \"Line1\")") (LM:SetVisibilityState rev-box visistate) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq L1-Rev (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L1-By (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L1-Date (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L1-Description (dxf 1 edata)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq L2-Rev (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L2-By (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L2-Date (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L2-Description (dxf 1 edata)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq L3-Rev (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L3-By (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L3-Date (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L3-Description (dxf 1 edata)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq L4-Rev (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L4-By (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L4-Date (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L4-Description (dxf 1 edata)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq L5-Rev (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L5-By (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L5-Date (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L5-Description (dxf 1 edata)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq L6-Rev (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L6-By (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L6-Date (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L6-Description (dxf 1 edata)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq L7-Rev (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L7-By (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L7-Date (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L7-Description (dxf 1 edata)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq L8-Rev (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L8-By (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L8-Date (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L8-Description (dxf 1 edata)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq L9-Rev (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L9-By (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L9-Date (dxf 1 edata)) (setq edata (entget (entnext (dxf -1 edata)))) (setq L9-Description (dxf 1 edata)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (set_tile "L1-Rev" L1-Rev) (set_tile "L1-By" L1-By) (set_tile "L1-Date" L1-Date) (set_tile "L1-Description" L1-Description) (set_tile "L2-Rev" L2-Rev) (set_tile "L2-By" L2-By) (set_tile "L2-Date" L2-Date) (set_tile "L2-Description" L2-Description) (set_tile "L3-Rev" L3-Rev) (set_tile "L3-By" L3-By) (set_tile "L3-Date" L3-Date) (set_tile "L3-Description" L3-Description) (set_tile "L4-Rev" L4-Rev) (set_tile "L4-By" L4-By) (set_tile "L4-Date" L4-Date) (set_tile "L4-Description" L4-Description) (set_tile "L5-Rev" L5-Rev) (set_tile "L5-By" L5-By) (set_tile "L5-Date" L5-Date) (set_tile "L5-Description" L5-Description) (set_tile "L6-Rev" L6-Rev) (set_tile "L6-By" L6-By) (set_tile "L6-Date" L6-Date) (set_tile "L6-Description" L6-Description) (set_tile "L7-Rev" L7-Rev) (set_tile "L7-By" L7-By) (set_tile "L7-Date" L7-Date) (set_tile "L7-Description" L7-Description) (set_tile "L8-Rev" L8-Rev) (set_tile "L8-By" L8-By) (set_tile "L8-Date" L8-Date) (set_tile "L8-Description" L8-Description) (set_tile "L9-Rev" L9-Rev) (set_tile "L9-By" L9-By) (set_tile "L9-Date" L9-Date) (set_tile "L9-Description" L9-Description) (mode_tile "L1-Rev" 2) (action_tile "cancel" "(done_dialog) (setq userclick nil)" ) (action_tile "accept" (strcat "(progn (setq L1-Reva (get_tile \"L1-Rev\"))" "(setq L1-Bya (get_tile \"L1-By\"))" "(setq L1-Datea (get_tile \"L1-Date\"))" "(setq L1-Descriptiona (get_tile \"L1-Description\"))" "(setq L2-Reva (get_tile \"L2-Rev\"))" "(setq L2-Bya (get_tile \"L2-By\"))" "(setq L2-Datea (get_tile \"L2-Date\"))" "(setq L2-Descriptiona (get_tile \"L2-Description\"))" "(setq L3-Reva (get_tile \"L3-Rev\"))" "(setq L3-Bya (get_tile \"L3-By\"))" "(setq L3-Datea (get_tile \"L3-Date\"))" "(setq L3-Descriptiona (get_tile \"L3-Description\"))" "(setq L4-Reva (get_tile \"L4-Rev\"))" "(setq L4-Bya (get_tile \"L4-By\"))" "(setq L4-Datea (get_tile \"L4-Date\"))" "(setq L4-Descriptiona (get_tile \"L4-Description\"))" "(setq L5-Reva (get_tile \"L5-Rev\"))" "(setq L5-Bya (get_tile \"L5-By\"))" "(setq L5-Datea (get_tile \"L5-Date\"))" "(setq L5-Descriptiona (get_tile \"L5-Description\"))" "(setq L6-Reva (get_tile \"L6-Rev\"))" "(setq L6-Bya (get_tile \"L6-By\"))" "(setq L6-Datea (get_tile \"L6-Date\"))" "(setq L6-Descriptiona (get_tile \"L6-Description\"))" "(setq L7-Reva (get_tile \"L7-Rev\"))" "(setq L7-Bya (get_tile \"L7-By\"))" "(setq L7-Datea (get_tile \"L7-Date\"))" "(setq L7-Descriptiona (get_tile \"L7-Description\"))" "(setq L8-Reva (get_tile \"L8-Rev\"))" "(setq L8-Bya (get_tile \"L8-By\"))" "(setq L8-Datea (get_tile \"L8-Date\"))" "(setq L8-Descriptiona (get_tile \"L8-Description\"))" "(setq L9-Reva (get_tile \"L9-Rev\"))" "(setq L9-Bya (get_tile \"L9-By\"))" "(setq L9-Datea (get_tile \"L9-Date\"))" "(setq L9-Descriptiona (get_tile \"L9-Description\"))" " (done_dialog)(setq userclick T))" ) ) follows below rev-box.dwg Quote
woodman78 Posted May 1, 2012 Author Posted May 1, 2012 remainder of code (start_dialog) (unload_dialog dcl_id) (if userclick (progn (setq edata (entget en)) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L1-Reva) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L1-Bya) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L1-Datea) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L1-Descriptiona) (assoc 1 edata) edata)) (entmod el) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L2-Reva) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L2-Bya) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L2-Datea) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L2-Descriptiona) (assoc 1 edata) edata)) (entmod el) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L3-Reva) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L3-Bya) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L3-Datea) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L3-Descriptiona) (assoc 1 edata) edata)) (entmod el) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L4-Reva) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L4-Bya) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L4-Datea) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L4-Descriptiona) (assoc 1 edata) edata)) (entmod el) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L5-Reva) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L5-Bya) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L5-Datea) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L5-Descriptiona) (assoc 1 edata) edata)) (entmod el) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L6-Reva) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L6-Bya) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L6-Datea) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L6-Descriptiona) (assoc 1 edata) edata)) (entmod el) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L7-Reva) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L7-Bya) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L7-Datea) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L7-Descriptiona) (assoc 1 edata) edata)) (entmod el) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L8-Reva) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L8-Bya) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L8-Datea) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L8-Descriptiona) (assoc 1 edata) edata)) (entmod el) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L9-Reva) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L9-Bya) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L9-Datea) (assoc 1 edata) edata)) (entmod el) (setq edata (entget (entnext (dxf -1 edata)))) (setq el (subst (cons 1 L9-Descriptiona) (assoc 1 edata) edata)) (entmod el) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; (command "REGEN") );progn );if (princ) );defun ;;;********************************************************** (defun dxf (code elist) (cdr (assoc code elist)) );defun ;;;********************************************************** (princ) ;;;********************************************************** ; ;CODING ENDS HERE ;;----------------=={ Set Visibility State }==----------------;; ;; ;; ;; Sets the Visibility Parameter of a Dynamic Block ;; ;; (if present) to a specific value (if allowed). ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;; ;;------------------------------------------------------------;; (defun LM:SetVisibilityState ( block value ) ( (lambda ( name value ) (vl-some (function (lambda ( prop ) (if (and (eq name (vla-get-propertyname prop)) (member value (mapcar 'strcase (vlax-get prop 'allowedvalues))) ) (progn (vla-put-value prop (vlax-make-variant value (vlax-variant-type (vla-get-value prop))) ) value ) ) ) ) (vlax-invoke block 'getdynamicblockproperties) ) ) (LM:GetVisibilityParameterName block) (strcase value) ) ) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;-----------=={ Get Visibility Parameter Name }==------------;; ;; ;; ;; Returns the name of the Visibility Parameter of a ;; ;; Dynamic Block (if present). ;; ;;------------------------------------------------------------;; ;; Author: Lee Mac, Copyright © 2011 - www.lee-mac.com ;; ;;------------------------------------------------------------;; (defun LM:GetVisibilityParameterName ( block / visib ) (if (and (vlax-property-available-p block 'effectivename) (setq block (vla-item (vla-get-blocks (vla-get-document block)) (vla-get-effectivename block) ) ) (eq :vlax-true (vla-get-isdynamicblock block)) (eq :vlax-true (vla-get-hasextensiondictionary block)) (setq visib (vl-some (function (lambda ( pair ) (if (and (= 360 (car pair)) (eq "BLOCKVISIBILITYPARAMETER" (cdr (assoc 0 (entget (cdr pair))))) ) (cdr pair) ) ) ) (dictsearch (vlax-vla-object->ename (vla-getextensiondictionary block)) "ACAD_ENHANCEDBLOCK" ) ) ) ) (cdr (assoc 301 (entget visib))) ) ) DCL is below. Quote
woodman78 Posted May 1, 2012 Author Posted May 1, 2012 ed1 : edit_box { edit_limit = 2; edit_width = 2;} ed2 : edit_box { edit_limit = 3; edit_width = 3;} ed3 : edit_box { edit_limit = 10; edit_width = 9;} ed4 : edit_box { edit_limit = 58; edit_width = 58;} attab12 : dialog { label = "Drawing Title Block"; : boxed_radio_column { label = "Application" ; //give it a label : row { : radio_button { //define radion button key = "rb1" ; //give it a name label = "Apply to Current Layout ONLY" ; //give it a label value = "1" ; //switch it on } : radio_button { //define radion button key = "rb2" ; //give it a name label = "Apply to All Layouts" ; //give it a label } } } : boxed_column { label = "Revision Data" ; //give it a label : row { : column { : text {label = "Lines"; } : radio_button { key = "rbl9" ;label = "Line 9" ; } : radio_button { key = "rbl8" ;label = "Line 8" ; } : radio_button { key = "rbl7" ;label = "Line 7" ; } : radio_button { key = "rbl6" ;label = "Line 6" ; } : radio_button { key = "rbl5" ;label = "Line 5" ; } : radio_button { key = "rbl4" ;label = "Line 4" ; } : radio_button { key = "rbl3" ;label = "Line 3" ; } : radio_button { key = "rbl2" ;label = "Line 2" ; } : radio_button { key = "rbl1" ;label = "Line 1" ;value = "1" ; } } : column { : text {label = "Rev"; alignment = centered;} : ed1 { key = "L9-Rev"; } : ed1 { key = "L8-Rev"; } : ed1 { key = "L7-Rev"; } : ed1 { key = "L6-Rev"; } : ed1 { key = "L5-Rev"; } : ed1 { key = "L4-Rev"; } : ed1 { key = "L3-Rev"; } : ed1 { key = "L2-Rev"; } : ed1 { key = "L1-Rev"; } } : column { : text {label = "By"; alignment = centered;} : ed2 { key = "L9-By" ; } : ed2 { key = "L8-By" ; } : ed2 { key = "L7-By" ; } : ed2 { key = "L6-By" ; } : ed2 { key = "L5-By" ; } : ed2 { key = "L4-By" ; } : ed2 { key = "L3-By" ; } : ed2 { key = "L2-By" ; } : ed2 { key = "L1-By" ; } } : column { : text {label = "Date"; alignment = centered;} : ed3 { key = "L9-Date"; } : ed3 { key = "L8-Date"; } : ed3 { key = "L7-Date"; } : ed3 { key = "L6-Date"; } : ed3 { key = "L5-Date"; } : ed3 { key = "L4-Date"; } : ed3 { key = "L3-Date"; } : ed3 { key = "L2-Date"; } : ed3 { key = "L1-Date"; } } : column { : text {label = "Description"; } : ed4 { key = "L9-Description"; } : ed4 { key = "L8-Description"; } : ed4 { key = "L7-Description"; } : ed4 { key = "L6-Description"; } : ed4 { key = "L5-Description"; } : ed4 { key = "L4-Description"; } : ed4 { key = "L3-Description"; } : ed4 { key = "L2-Description"; } : ed4 { key = "L1-Description"; } } } spacer ; } : row { ok_cancel ; //predifined OK/Cancel } } Quote
pBe Posted May 1, 2012 Posted May 1, 2012 Woodman78, I'm using ACAD2009 and cant open your DB. I tried DWGTrueview but the dynamic properties disappears whenever i convert a file. Quote
woodman78 Posted May 1, 2012 Author Posted May 1, 2012 Try this pBe. rev-box.dwg EDIT: I saved it in 2007 format. Quote
pBe Posted May 2, 2012 Posted May 2, 2012 (edited) Try this pBe.[ATTACH]34519[/ATTACH] EDIT: I saved it in 2007 format. Thats very nice of you to do that woodman78, I've have a look-see. keep you posted. EDIT: i had a look at your code. Question for you, how often does a drawing contains varying rev number from one layout to another? Is MODEL SPACE count as layout"? Whats the deal with the radio_buttons (line 1, Line 2....) whats suppose to happen if you if you click one other than Line 1? Edited May 2, 2012 by pBe Quote
woodman78 Posted May 2, 2012 Author Posted May 2, 2012 Thanks pBe. Firstly the model tab does not count. We never have a title block in the model tab. Next, the radio buttons were an attempt to control the visibility state of the dynamic block. I was going to get the person to manually select which line to show. That was why I was using LeeMac's sub routines. Lastly, after testing different ways of storing our drawing files we settled on what follows: 1. A drawing is created that may have a few layouts. The layouts are used to cover the length of a project which could be a few kilometers long. 2. Say for example the drawing would then have the name L2472-LA-01,02,03_A0 (L2472 is the project code, LA represents the drawing type - Layout Plan, 01,02,03 are the drawing number and the A0 is the revision.) it may happen that one of those drawings needs to be altered and reved up. What we do in that case is that we make a copy of the original drawing, make the changes and save it as say L2472-LA-01_A0,02_A1,03_A0. In this case 02 would have been revved up to A1 and the other two left alone. We found this to be the best way of controlling the drawings so that we would not split the set and risk that someone would bypass the latest version. This does happen quite often. If you or anyopne suggests a better way of doing this then please let me know and I will look at it. Hope this helps pBe and thanks for your time and your help. Quote
pBe Posted May 2, 2012 Posted May 2, 2012 (edited) Okay here's hafl of the idea Woodman78, [up to the point where i scratch my head and wondering what the radio buttons are for] Redefine your DBlock and remove all Default values. Re-write the way the program select the DBlocks For now I grayed out Apply to All Layout [as of this time] The code to include the ff LM routines [You know where to find this] http://www.lee-mac.com/dynamicblockfunctions.html LM:GetVisibilityState LM:SetVisibilityState LM:GetVisibilityParameterName and pBe's [included in the post] _AttFunc _PutValtoVar _AssignVal _ReduceList Lisp Code (defun c:[b][color=blue]attab12[/color][/b] ( / bn Adoc Layt BlkColl RevList) (setq bn "rev-box" Visname "Visibility1") (setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object)) Layt (vla-get-layouts aDoc)) (setq BlkColl nil lytn (vla-get-name (vla-get-ActiveLayout aDoc))) (if (foreach layoutname (layoutlist) (vlax-for itm (vlax-get (vla-item Layt layoutname) 'Block) (if (and (eq (vla-get-ObjectName itm) "AcDbBlockReference") (vlax-property-available-p itm 'effectivename) (eq (vla-get-EffectiveName itm) bn) (eq (LM:GetVisibilityParameterName itm) Visname) ) (setq BlkColl (cons (list layoutname (LM:GetVisibilityState itm) itm) BlkColl))))) [b][color=blue](ddisplay lytn BlkColl)[/color][/b] ) ) (defun ddisplay (clay lst / dcl_id RevList ByList DateList DescList DescList RButtons ATTData NewVal VisState [b][color=blue]RunHere[/color][/b]) (setq RevList '("L1-REV" "L2-REV" "L3-REV" "L4-REV" "L5-REV" "L6-REV" "L7-REV" "L8-REV" "L9-REV") ByList '("L1-BY" "L2-BY" "L3-BY" "L4-BY" "L5-BY" "L6-BY" "L7-BY" "L8-BY" "L9-BY") DateList '("L1-DATE" "L2-DATE" "L3-DATE" "L4-DATE" "L5-DATE" "L6-DATE" "L7-DATE" "L8-DATE" "L9-DATE") DescList '("L1-DESCRIPTION" "L2-DESCRIPTION" "L3-DESCRIPTION" "L4-DESCRIPTION" "L5-DESCRIPTION" "L6-DESCRIPTION" "L7-DESCRIPTION" "L8-DESCRIPTION" "L9-DESCRIPTION") RButtons '("rbl1" "rbl2" "rbl3" "rbl4" "rbl5" "rbl6" "rbl7" "rbl8" "rbl9")) (setq ATTData (_AttFunc (last (setq CRevB (assoc clay lst))) nil)) (setq dcl_id (load_dialog "attab.dcl")) (if (not (new_dialog "attab12" dcl_id)) (exit)) [color=blue][b](set_tile (if (null rbd) "rbl1" (strcat "rbl" rbd)) "1")[/b][/color] (_AssignVal RevList (_ReduceList "REV" ATTData)) (_AssignVal ByList (_REDUCELIST "BY" ATTData)) (_AssignVal DateList (_REDUCELIST "DATE" ATTData)) (_AssignVal DescList (_REDUCELIST "DESCRIPTION" ATTData)) (action_tile "accept" "(setq NewVal (_PutValtoVar (mapcar 'car ATTData))) (setq VisState (_PutValtoVar RButtons)) (setq RunHere (get_tile \"rb1\")) (done_dialog 1)") (action_tile "cancel" "(done_dialog 0)") (start_dialog) (unload_dialog dcl_id) (if (and NewVal VisState) (progn (foreach Blk [b][color=blue](if (eq RunHere "1") (list CRevB) lst)[/color][/b] [b][color=blue] ( _AttFunc (last Blk) NewVal)[/color][/b] (LM:SetVisibilityState (last Blk) [color=blue][b](strcat "Line" (setq rbd (itoa (1+ (vl-position "1" (mapcar 'cadr VisState))))))[/b][/color] ))) ) ) (defun _ReduceList (str lst) (vl-remove-if-not '(lambda (ly)(wcmatch (car ly) (strcat "*" str)) ) lst)) (defun _AssignVal (lst1 lst2) (mapcar '(lambda (d1 d2) (set_tile d1 (cadr d2))) lst1 lst2)) (defun _PutValtoVar (lst_) (mapcar '(lambda (vr) (list vr (set (read vr) (get_tile vr)))) lst_) ) (defun _AttFunc (en lst / vals v) (mapcar (function (lambda (at) (setq vals (list (vla-get-tagstring at)(vla-get-textstring at))) (if (and lst (setq v (assoc (car vals) lst))) (vla-put-textstring at (cadr v))) vals)) (vlax-invoke (if (eq (type en) 'VLA-OBJECT) en (vlax-ename->vla-object en)) 'Getattributes) ) ) REMINDER: The Only thing I changed on the DCL is capitalize all key values except those "rbl1" "rbl2"...... and "br1" "br2" "accept" cancel" Try it. HTH rev-box.dwg CODE UPDATED Edited May 4, 2012 by pBe UPDATE CODE for Layout Toggle Quote
asos2000 Posted May 2, 2012 Posted May 2, 2012 I seached for this lisp on afralisp but not found So Could you please upload the lisp with DCL? Quote
pBe Posted May 2, 2012 Posted May 2, 2012 (edited) I seached for this lisp on afralisp but not found So Could you please upload the lisp with DCL? ^ || || || =======>>> Next Page ======>> Edited May 3, 2012 by pBe Quote
woodman78 Posted May 2, 2012 Author Posted May 2, 2012 pBe, when I run the lisp with your version of the block the dialog loads and I can enter information but when I press ok I get the following error: ; error: ActiveX Server returned an error: Parameter not optional Quote
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.