Jump to content

Recommended Posts

Posted

Thanks Lee, it works great. Good stuff!

  • Replies 144
  • Created
  • Last Reply

Top Posters In This Topic

  • Lee Mac

    58

  • au-s

    23

  • JeepMaster

    9

  • wakibd

    7

Posted
Thanks Lee, it works great. Good stuff!

 

You're very welcome :)

Posted

oh, a small request, can the MacAttEdit change an existing attribute to "nothing" as in delete the value? I tried to remove the value, but it won't run.

 

EDIT: oh, nevermind, it actually does work. Just picked the wrong block. THANKS.

Posted

one small problem I run into is if I have multiple copies of the same block but frozen off by different layers...(ie: different package of drawings) If I change one copy of the attributes, all the other copies change too, which I don't want. I have many different packages of this drawing at different time of the project.

So my question would be is there a way to only change the attributes on layers that's currently shown and not the ones that's frozen off?:wink:

Posted

Yes, I think this could be incorporated in the near future - nice idea :)

Posted

cool, will be waiting for your awsome updates...I hope people are donating to you for all your efforts.

 

Now where is your donation button gone to?

Posted

Found a small bug,

If I take the attribute off (as in delete the attribute value), it works fine. But if I need to put the attribute back (replace it with a value), the alignment gets all screw up. It doesn't line up anymore. It happen to one of my attribute that's aligned to the right.:(

 

Thanks for your hard work Lee.

Posted

Yes, thats a known bug in ObjectDBX - see the header - I have included a sub to allow for most cases, but its not 100% foolproof. :(

Posted

Hi Lee,

I am Ted, initiated this thread more than a year ago and got from you at that time a very nice routine (probably the beginning of the elaborate one you have now). The new one works great, it's easy to use, logical, and covers most of the possible requests. Excellent job!!!

 

I noticed what JeepMaster also mentioned about the alignment, it changes to me too. What I did was only to open the attribute editor (_eatedit) and close it without changing anything, and all attributes came back to original location.

I tried this with various blocks and it fixed all of them.

If you can incorporate this somehow at the end of your routine it may solve the problem (the trick is to select somehow all blocks).

Posted
If you can incorporate this somehow at the end of your routine it may solve the problem (the trick is to select somehow all blocks).

 

Hi Ted,

 

Many thanks for your kind words - I was seeing so many requests for this type of program that I felt the need to write a proper one. :)

 

I have tried many things to get around the alignment issue, I realise that any modification of the block (manually) will update the attribute position, but the utility that AutoCAD employs to update the attribute position after modification isn't available through ObjectDBX (a bug of ODBX so to speak), and so any movement of the blocks to try to update the attribute position is in vain. And, of course, when using ObjectDBX, one cannot use any command calls, ssget methods, or many of the ent* methods.

 

Another bug with ObjectDBX that you may notice is that the drawing thumbnails are lost when the drawings are saved when using the Attribute Editor - yet another bug with ObjectDBX. But these will reappear when the drawing is saved manually.

 

So, you might ask - why use ObjectDBX? The answer - its shear speed at processing a lot of drawings... I'm sure you'll agree its a lot faster than a script as it doesn't have to open the drawings, but rather create an ObjectDBX document object that represents the drawing.

 

With all this said - the Global Attribute Extractor will function correctly and will not affect the attribute position whatsoever, as there is no modification of the text string length.

 

Anyway, I'm glad you like the program.

 

Regards,

 

Lee

  • 2 months later...
Posted

I modified this script to autofill numbers from the drawing name into the templates.

There is only one problem and that is: How to run this true all layouts? The best way would be that it does every layout separate, so i can also set the layout name. I found this code:

(defun getlayout (Obj)
 (vla-get-Name
   (vla-get-layout
     (vla-objectidtoobject
       (vla-get-ActiveDocument
         (vlax-get-acad-object))
           (vla-get-ownerid Obj))))) 

source: http://www.cadtutor.net/forum/showthread.php?38880-Replacing-blocks-across-multiple-layouts/page3

 

And wanted to use this so I can: If found drw-template goto layout change layout name to drw-partofdwgname-1 and update the template-block. etc

 

Further more I don't get this part: (while (not (eq "SEQEND" (cdadr (entget att))))

 

Here is my code that works only on layouts that are open. You need to adjust str 4 and 5 to match your filename.

(defun attnumb (/ ss att str1 str4 str5)

 (if (setq ss (ssget "X" (list (cons 0 "INSERT")(cons 2 "TEMPLATE")
      (cons 66 1)(if (getvar "CTAB")(cons 410 (getvar "CTAB"))
             (cons 67 (- 1 (getvar "TILEMODE")))))))
   (progn
     (foreach ent (mapcar 'cadr (ssnamex ss))
   (setq att (entnext ent))
   (while (not (eq "SEQEND" (cdadr (entget att))))
     (cond (
     (eq "EQ-nr" (cdr (assoc 2 (entget att))))
       (setq str1 (strcat (vl-filename-base (getvar 'dwgname))))
	(setq str4(substr str1 5 )
 		(princ str4)
        	(entmod (subst (cons 1 str4) (assoc 1 (entget att)) (entget att)))
     )
           (
     (eq "REV-nr" (cdr (assoc 2 (entget att))))
     (setq str1 (strcat (vl-filename-base (getvar 'dwgname))))
     (setq str5(substr str1 14 14))
        		(entmod (subst (cons 1 str5) (assoc 1 (entget att)) (entget att))))
    )
     (setq att (entnext att))))
     (command "_regenall"))
   (princ "\n<!> No DSH Blocks Found <!>"))
 (princ))

  • 1 year later...
Posted

Dear Mac,

I m really quite fresh new like dummy,

My aim is the same to change the project name in all about 450 dwg files. All those files have the same block which name is Head.

So I need a tool which can change Project name in this block through 450 dwg files a bulk job needed to be completed

Pls find my quiestions

1. How I will use pat.dcl and pat.lsp, I have never saw before such a file

2. where I will copy those two files

3. How I will run them ?

4. Will I call then inside the AutoCad and how can I make it run ?

I would really appreciate if you can guide me

 

Best Regards

Posted

Perhaps take a look at my Global Attribute Editor here - it uses ObjectDBX to process many drawings quickly.

 

Although, test it on copies of drawings since there is a known bug with ObjectDBX in which attributes may shift their position depending on their alignment.

 

Lee

  • 3 weeks later...
Posted

Hi patrick..what should be the command line for this lisp???

  • 4 months later...
Posted

Hello,

I tryed using the LISP command given and tailoring it but I had no success.... I am new to coding and know little about it. Can you help me?

 

My titleblock is named "corp-d" and the attributes are named "Facility Name & Type", "PL NUMBER", and "Dwg Date (ie. MO/DD/YYYY)". I dont know much about coding but im thinking maybe its my attribute names?

  • 6 months later...
Posted (edited)

Hi Lee mac,

 

I have simple lisp which calucalates weight of the part . I want that weight to update automatically in the title block in WEIGHT promt, and also i want the file name to update in CAT# promt (need to remove prefix "rem", just the nummber)

 

I have attached template and aslo lisp whcih calucaltes the weight.

 

;;;To calucalate area & weight
(defun c:WT()
(COMMAND "OSNAP" "")
(setq g1(getpoint "pick the point inside the boundry of the Plate :.."))
(setq a(getreal "\nEnter the plate Thickness: "))
(command "-boundary" g1 "")
(command "area" "o" "l" )
(command "erase" "l" "")
(setq g2(getvar "area"))
(setq aa "    AREA :  ")
(setq g3(rtos g2))
(setq tt(* g2 0.2836 a))
(setq g4(rtos TT))
(setq NN "
")
(setq cc "WEIGHT :  ")
(setq KK " Pounds.")
(setq bb(strcat aa g3 NN NN CC G4 KK))
;(alert bb)
(setq b1(strcat aa g3 NN CC G4 KK))
;(textscr)
)

 

 

Thanks in advance

rem4545.dwg

Edited by SLW210
CODE TAGS PLEASE!!!!
  • 2 weeks later...
Posted
Thank you for your help Lee Mac and Dbroada!

I was able to put together the lisp, batch and script files,

with absolute minimal knowledge. Even now I have no clue

what exactly means each part of the script, but am able to use it.

 

Hello,

I would like to use this simple basic lisp programming code to simply change the value of an attribute called FACILITY in the title block of many drawings (all with the same title block name (11X17 TB) and attribute name). I don't need anything fancy such as the user being able to enter the attribute they want to change or anything like that. This forum got a little complicated as it went on and I just wanted to know how t357 did this to a batch of files way back on page 2 of this forum? I took some of the early codes and turned them into .lsp files through Notepad. I saw someone posted a batch code on this forum too (not sure if it works or not), but I have absolutely no idea how to run this all (lisp,batch,script). Please help with simple instructions.

Posted

Thank you so much Lee Mac. That program is genius and super user-friendly. It worked perfectly for what I was trying to do and saved me much time.

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.


×
×
  • Create New...