Jump to content

Title Block Attribute Script


crmosoldier
 Share

Recommended Posts

Are you talking about using the project "descriptions" option in AutoCAD Electrical to update the revision or something else? I am using Acad Elcectrical so is there an easy way do do what i want that I dont know about?

Link to comment
Share on other sites

  • Replies 30
  • Created
  • Last Reply

Top Posters In This Topic

  • pBe

    11

  • crmosoldier

    11

  • bradwitt17

    4

  • Lee Mac

    2

Top Posters In This Topic

Posted Images

:oops:...ok do I had a play around with the project Descriptions in Acad Electrical, it does what I need. It had been staring me in the face the whole time but i had never thought do do it like this.

 

Thanks very much for your help Pbe, much appreciated!! I will still look into the lisp you have provided so the guys who are using normal Acad can use it.

 

And also thanks to pmxcad for turning on the light in my head

Link to comment
Share on other sites

Thanks and sorry pBe, im still lost :unsure:

 

So is the whole process not as easy as I thought it would be, I was thinking there would be a way to have a script that just uses say ATTEDIT, chooses my template by name and then changes the attribute tags to the new values I have put in the script, i would then select multiple drawings using ScriptPro... Not that easy?

 

Its easy really, if you know how to star with :) The first option Gatte is almost same as ATTEDIT, you need Express Tools though. you will need the to run support code i posted just once for the whole script. granting (like i've said before) the runit code is pre-loaded and you have the scirpt at the ready. I personally never used ScriptPro but i can incorporate a sub for selecting multiple drawings for the script to process.

 

Anyhoo. Glad project descriptions worked for you, so no worries

 

Thanks very much for your help Pbe, much appreciated!! I will still look into the lisp you have provided so the guys who are using normal Acad can use it.

 

No problem crmosoldier :)

 

Cheers

Link to comment
Share on other sites

  • 2 months later...

I am trying to write a simple list code to change 3 attributes in my tltleblock for multiple sheets. I have attribute tags of REVISION1, REV_DESCRIPTION1, AND REV_DATE1. I would like write one that will find the next issuance and fill that in for me either using the wildcard or something else. I have been searching and reading and nothing is working for me. Can someone please help?

Link to comment
Share on other sites

I am trying to write a simple list code to change 3 attributes in my tltleblock for multiple sheets. I have attribute tags of REVISION1, REV_DESCRIPTION1, AND REV_DATE1. I would like write one that will find the next issuance and fill that in for me either using the wildcard or something else. I have been searching and reading and nothing is working for me. Can someone please help?

Remove all from your working drawing but title blocks

and post it here as attachment, probably it would be easier

for understanding your task

Link to comment
Share on other sites

I was trying to upload the file but am having some troubles. Basically I am looking to auto populate the next available issuance line on in my title block.

Link to comment
Share on other sites

I am trying to write a simple list code to change 3 attributes in my tltleblock for multiple sheets. I have attribute tags of REVISION1, REV_DESCRIPTION1, AND REV_DATE1. I would like write one that will find the next issuance and fill that in for me either using the wildcard or something else. I have been searching and reading and nothing is working for me. Can someone please help?

 

Does that mean the next rev value will depend on the current rev?

 

Letter to Number ? Number only?

REVISION1---> A to B

REVISION1---> A to 0

REVISION1---> 0 to 1

 

When found, same description for all sheets?

Date format: ----> "29DEC11" ?

Dyamic Block?

 

Also, right after REV_DATE1 tag, REVISION2 tag name follow?

 

Not thoroughly tested

 

(defun C:NRev  (/ aDoc BLkName TagN Data num vls pvl_ ss)
(vl-load-com)
(defun _Next (vl / v)
    (if (> (setq v (ascii vl)) 58)
     (chr (1+ v))
      (itoa (1+ (atoi vl)))))  
(setq aDoc (vla-get-ActiveDocument (vlax-get-acad-object)))
;;;   Data list   ;;;
;;; Can be modified to prompt for values  ;;;
(setq  BLkName [color=blue]"TITLE_BLOCK" [/color]     ;<-- [color=blue]Change to your Block Name
[/color]   TagN [color=blue]"REVISION"[/color]
  Data
   (list  [color=blue]"Description String value"
[/color]      (strcase (menucmd "M=$(edtime,$(getvar,date),[color=blue]DDMONYY[/color])"))  ;<-- [color=blue]Change to your DATE Format
[/color]      )
 )
;;;       ;;;
(if (ssget "_X" (list '(0 . "INSERT")
                 '(66 . 1)
                 (cons 2  BLkName))
     )
(progn (vlax-for itm (setq ss (vla-get-ActiveSelectionSet aDoc))
 (setq vls (member (strcat TagN (itoa (setq num 1)))
                                 (apply 'append (mapcar '(lambda (j)
   (list (vla-get-tagstring j) j))                           
             (vlax-invoke 
                                         itm 'Getattributes)))))
  (cond ((and
                                (while (and
                                vls
                                (/= (vla-get-textstring (cadr vls)) ""))
                           (setq pvl_ (vla-get-textstring (cadr vls))
                                 vls  (vl-catch-all-apply 'member 
                                       (list (strcat TagN
                                              (itoa (setq num (1+ num)))
                                              ) vls ))))
                               (foreach  itm (list
                                            (list 1 (_Next pvl_))
                                            (list 3 (car Data))
                                            (list 5 (cadr Data)))
            (vla-put-textstring (nth (car itm) vls) (cadr itm)))
                              )
                         )
                )
                )
          (vla-delete ss)
         )(princ (strcat "\nBlock " BLkName " Not Found"))
 )(princ)
 )

Edited by pBe
Link to comment
Share on other sites

The tags like REV_DATE would be an actual date which I would fill in for each instance, the REV_DESCRIPTION is something like "Issued for Construction". The attributes are just a regular block nothing special. Hopefully I can create something that I can fill in what I want in the attribute and place it in a script to run through all the sheets. Now all sheet may have different spots in the block where the information will go, for instance one sheet maybe have been issued for a bulletin or a revision so the next issuance line will not match with the others. I hope this helps.

Link to comment
Share on other sites

The tags like REV_DATE would be an actual date which I would fill in for each instance, the REV_DESCRIPTION is something like "Issued for Construction". The attributes are just a regular block nothing special. Hopefully I can create something that I can fill in what I want in the attribute and place it in a script to run through all the sheets. Now all sheet may have different spots in the block where the information will go, for instance one sheet maybe have been issued for a bulletin or a revision so the next issuance line will not match with the others. I hope this helps.

 

Are you telling me there's only one titlblock on each drawing and its all on a separate sheet for the whole set so would run it with a script? so its close to the approach on the code i posted for crmosoldier?

 

Did you even try the code i posted bradwitt17?

 

You never did answer my question regarding Revision Value

 

Does that mean the next rev value will depend on the current rev?

Letter to Number ? Number only?

REVISION1---> A to B

REVISION1---> A to 0

REVISION1---> 0 to 1

 

We can convert the routine above to accept arguments to run with a script if the situation calls for it.

 
_.open "D:\path\sheet1.dwg" (NRev  "blknme" "Datalist" "Rev Description" "Date") _.save _Y _.close

 

But you need to be clear on what you need done.

Link to comment
Share on other sites

pBe, I have tried the code you previously provided and it didnt work. There was a program we used back with XP called Attribute Manager that would you could input your block name, the tag info, and the new values of the tags. Then you could choose update by line or next available, then you could select all your drawings and process it that way but I cannot seem to find a newer version. If you would like to email me I could possibly explain what I am looking for a little easier. Sorry for any confusion

Link to comment
Share on other sites

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share


×
×
  • Create New...