Results 1 to 1 of 1

Thread: Lisp working with attribute, Sheet-set, dwgprop, field, revision date

  1. #1
    Woo! Hoo! my 1st post
    Join Date
    2021-02
    Posts
    1
    Login to Give a bone
    0

    Default Lisp working with attribute, Sheet-set, dwgprop, field, revision date

    hello
    can someone could help me with this program i try to made in Lisp
    the program is to automatically write revision on engeneering plan when new issue of plan or series of plan in sheetset

    i can give the files by email if someone wants the template and drawing to work with the lisp

    thank you and excuse my english

    Code:
    ;;; 2021-nov-03 by Martin Duval from Rochon experts Infrastructel
    
    ;;; revision sheet lisp for autocad
    
    ;;; REC_REVISION REVISION 2021-NOV-11-1
    
    
    ;; dwg document property (DWGPROP) add this to this lisp work...
    
    					;01SheetRevisionNumber
    					;01SheetRevisionDate
    					;01SheetIssuePurpose
    					;01SheetRevisionBy
    
    					;02SheetRevisionNumber
    					;02SheetRevisionDate
    					;02SheetIssuePurpose
    					;02SheetRevisionBy
    
    ;or use the template
    
    ;;NEED ALSO BLOCK REFERENCE SSREV
    
    ;;;WORK WITH THE SHEET SET MANAGER OR FORCE THE DEFAULT FIELD VALUE IN SSREV BLOCK REFERENCE
    
    (vl-load-com)
    
    (defun c:rec_revision
           (x / BlkName DwgName OldPath SSREVRN SSREVRD SSREVIP SSREVBY PNAME VERIFYSI TMP EPROP EVALUE DOC DB SI REVRN)
     
    
    (princ "SheetSet REVISION\: " DWGREVSSRN)
    (princ "REVISION A\: " DWGREVARN)
    (princ "REVISION B\: " DWGREVBRN)
      
    
    ;;;CHEK IF "TESTSheetRevisionNumber" EXIST ON CUSTOM DRAWING PROPERTY IF NOT CREATE IT
    
      (setq DOC (vla-get-ActiveDocument (vlax-get-Acad-Object)))
      (setq DB (vla-get-Database DOC))
      (setq SI (vla-get-SummaryInfo DB))
      (setq	VERIFYSI (vla-get-summaryinfo
    		   (vla-get-activedocument (Vlax-get-acad-object))
    		 )
    	TMP	 0
      )
    
    					;IN: PNAME - property name to search as string (NOT case sensitive)
    					;OUT: returns t if property exists, else nil
    
    
      (vla-GetCustomByIndex VERIFYSI TMP 'EPROP 'EVALUE)
    
      (while (and (not (eq (setq EPROP (strcase EPROP))
    		       (setq PNAME (strcase "01SheetRevisionNumber"))
    		   )
    	      )
    	      (< (+ TMP 1) (vla-numcustominfo VERIFYSI))
    	 )
        (setq TMP (1+ TMP))
        (vla-GetCustomByIndex VERIFYSI TMP 'EPROP 'EVALUE)
      )					;while
      (if (eq EPROP "01SheetRevisionNumber")
        t
        nil
      )
    )
    					
    
    
    
    ;; MAIN PROGRAM
    
    
    ;;;; get value of attributes to lisp variables function  DWGREVRN - DWGREVRD - DWGREVIP - DWGREVBY
    
    ;(function
     ; (lambda (x / BlkName DwgName OldPath)
    
        (setq BlkName "SSREV")
        (setq AttTagRN "SSREVRN")
    
        (vlax-for lo (vla-get-Layouts x)
          (vlax-for	obj (vla-get-Block lo)
    	(if
    	  (and
    	    (= (vla-get-ObjectName obj) "AcDBlockreference")
    	    (= (vla-get-Name obj) BlkName)
    	  )
    	   (foreach attRN	(vlax-invoke obj 'GetAttributes)
    	     (setq DWGREVRN (vla-get-TextString attRN)
    )))))
    
        (setq BlkName "SSREV")
        (setq AttTagRD "SSREVRD")
    
        (vlax-for lo (vla-get-Layouts x)
          (vlax-for	obj (vla-get-Block lo)
    	(if
    	  (and
    	    (= (vla-get-ObjectName obj) "AcDBlockreference")
    	    (= (vla-get-Name obj) BlkName)
    	  )
    	   (foreach attRD	(vlax-invoke obj 'GetAttributes)
    	     (setq DWGREVRD (vla-get-TextString attRD)
    )))))
    
        (setq BlkName "SSREV")
        (setq AttTagIP "SSREVIP")
    
        (vlax-for lo (vla-get-Layouts x)
          (vlax-for	obj (vla-get-Block lo)
    	(if
    	  (and
    	    (= (vla-get-ObjectName obj) "AcDBlockreference")
    	    (= (vla-get-Name obj) BlkName)
    	  )
    	   (foreach attIP	(vlax-invoke obj 'GetAttributes)
    	     (setq DWGREVIP (vla-get-TextString attIP)
    )))))
    
       (setq BlkName "SSREV")
        (setq AttTagRV "SSREVBY")
    
        (vlax-for lo (vla-get-Layouts x)
          (vlax-for	obj (vla-get-Block lo)
    	(if
    	  (and
    	    (= (vla-get-ObjectName obj) "AcDBlockreference")
    	    (= (vla-get-Name obj) BlkName)
    	  )
    	   (foreach attRV	(vlax-invoke obj 'GetAttributes)
    	     (setq DWGREVBY (vla-get-TextString attRV)
    )))))
    
    
    ;;;; SET VALUE TO VARIABLES DWGREV(#)RN - RD - IP - BY from DWGPROP CUSTOM PARAMETRES PRESET IN TEMPLATE OR DRAWING
    
    (setq DWGREVARN (vla-getcustombyKey SI "01SheetRevisionNumber"))
    (setq DWGREVARD (vla-getcustombyKey SI "01SheetRevisionDate"))
    (setq DWGREVAIP (vla-getcustombyKey SI "01SheetIssuePurpose"))
    (setq DWGREVABY (vla-getcustombyKey SI "01SheetRevisionBy"))
    
    (setq DWGREVBRN (vla-getcustombyKey SI "02SheetRevisionNumber"))
    (setq DWGREVBRD (vla-getcustombyKey SI "02SheetRevisionDate"))
    (setq DWGREVBIP (vla-getcustombyKey SI "02SheetIssuePurpose"))
    (setq DWGREVBBY (vla-getcustombyKey SI "02SheetRevisionBy"))
    
    
    
    ;;; CONDITION IF BY DEFAULT %% IS THE VALUE OF SHEET SET REVISION OR NOT FOR EACH LISP VARIABLE DWGREVSS##
    
    
    (cond
      (/= "%%" DWGREVSSRN)
      (setq REVRN 100)
    )
    
    ;;; set value of custom revision number A if =/ revsion number sheetlist and if they are value rev 00=revsheetlist
    (if
      (and
        (/= DWGREVARN DWGREVSSRN)
        (= 100 REVRN)
      )
      (vla-setcustombyKey SI "01SheetRevisionNumber" 'DWGREVSSRN)
    )
    
    ;;; set value REVRN1 IF CHANGE MADE ON VARIABLE DWGREVARN = DWGREVSSRN
    
    (cond
      (= DWGREVSSRN DWGREVARN)
      (setq REVRN 1)
    )
    
    
    ;;; set value of custom revision number A if =/ revsion number sheetlist and if they are value rev A=rev sheet list
    (if
      (and
        (/= DWGREVBRN DWGREVARN)
        (= 1 REVRN)
      )
      (vla-setcustombyKey SI "02SheetRevisionNumber" 'DWGREVSSRN)
    )
    
    ;;; set value REVRN1 IF CHANGE MADE ON VARIABLE DWGREVBRN = DWGREVSSRN
    
    (cond
      (= DWGREVSSRN DWGREVBRN)
      (setq REVRN 2)
    )
    
    
    ;;etc THE PROGRAM IS TESTING FOR REVISION NUMBER
    
    
    
    
    (vlax-release-object SI)
    (vlax-release-object DB)
    (vlax-release-object DOC)
    
    
    
    
    (princ)
    Attached Files Attached Files
    Last edited by BlackBox; 2021-11-12 at 01:51 AM. Reason: Please use [CODE] Tags

Similar Threads

  1. 2018: Current Revision Date/Description on a Cover Sheet
    By TMaceratini in forum Revit Architecture - Families
    Replies: 4
    Last Post: 2017-11-22, 02:57 PM
  2. 2014: Revision Field Values Missing in Revisions on Sheet Dialog
    By jeff351881 in forum Revit Architecture - General
    Replies: 8
    Last Post: 2014-06-23, 05:05 PM
  3. Replies: 5
    Last Post: 2007-01-29, 11:18 PM
  4. Sheet Set Eerror message "Sheet Set File Is Not Valid"
    By acortes24 in forum AutoCAD Sheet Set Manager
    Replies: 2
    Last Post: 2006-01-06, 12:26 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •