Is there a GATTE equivalent for LT2025

Is there a GATTE equivalent for LT2025

h_s_walker
Mentor Mentor
2,740 Views
52 Replies
Message 1 of 53

Is there a GATTE equivalent for LT2025

h_s_walker
Mentor
Mentor

Ok so we will do drawings, sometimes with many pages.

In our title block with have an attribute for the name of the client.

Originally it is blank, but quite often the project leader does not give us the client name until late in the game when we've done many layout tabs.

Now you can understand going into each layout just to put in the client name is a PITA.

So is there a gatte equivalent I can use for LT2025

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Accepted solutions (3)
2,741 Views
52 Replies
Replies (52)
Message 2 of 53

cadffm
Consultant
Consultant

Hi,

 

select all of your title blocks and change the value in Properties palette CTRL+1

If we are not talking about dynBlocks:

 

Without Lisp: Use command FILTER and apply to ALL

With Lisp: (sssetfirst nil (ssget "_X" '((2 . "YourBlockName"))))

 

and because you ask about a tool, perhaps this simple GatteLT.lsp

 
 

 

 

Sebastian

0 Likes
Message 3 of 53

h_s_walker
Mentor
Mentor

@cadffm 

The blocks are all on separate layouts. I need to be able to change the attribute even when it is blank.

My knowledge of lisp is non existent.

Unfortunately the lisp you posted in that thread didn't work

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 4 of 53

cadffm
Consultant
Consultant

Hi Howard,

 

>>"The blocks are all on separate layouts."

You already said that / I already understood that.

 

 

 

>>"My knowledge of lisp is non existent."

I showed one way without lisp and one with, what needs no lispknowledge.

->select all of your title blocks and change the value in Properties palette CTRL+1

Object selection:

Without Lisp: Use command FILTER , filter for your Blockname and apply to ALL<enter>

With Lisp, direct in Commandline: (sssetfirst nil (ssget "_X" '((2 . "YourBlockName"))))

 

 

>>"Unfortunately the lisp you posted in that thread didn't work"

It works!

 

>>"I need to be able to change the attribute even when it is blank."

Ahh okay, so you can not use GatteLT, I understand.

In this case, the program need to know the name of the attribute !?

 

for you:

 

 

 

(defun C:GatteLT_HW ( / ESel EL BN TG newstr n ss1)
(setq ESel (entsel "\nSelect Block: "))
(setq EL (entget (car ESel)))
     (if (= (cdr (assoc 0 EL)) "INSERT")
         (setq BN (cdr (assoc 2 EL))
               TG "YOURATTRIBNAME" ; UPPERCASE!
         )
         (prompt "\nSelected item not an INSERT.")
     );end if
(setq newstr (getstring "\nEnter new attribute value "))
(setq n -1)

(if (setq ss1 (ssget "_X"  (list (cons 0 "INSERT") (cons 2 BN))))
(repeat (sslength ss1)
(setq n (1+ n))
(foreach att (vlax-invoke (vlax-ename->vla-object (ssname SS1 n)) 'getattributes)
        (if (= TG (strcase (vla-get-tagstring att)))
        (vla-put-textstring att newstr)
        ) ; end if
) ; end foreach
) ; end repeat
);_if
(princ)
)

 

 

 

 


Lisp(cope) How to handle, read this page <Click>
- Saving the AutoLISP File
- Loading the Program Method 1 or drag&drop the file into drawing editor
- Running the Program

 

 

 

 
 
 
 

 

 

 
 

 

 

Sebastian

0 Likes
Message 5 of 53

Brock_Olly
Collaborator
Collaborator

Hey,

 

You could use a field in the attribute referencing a custom field?
You can set up custom field names in DWGPROPS, I think that's a quick and easy solution in LT.

Brock_Olly_0-1740739705538.png

Brock_Olly_1-1740739720221.png

 

 

0 Likes
Message 6 of 53

Brock_Olly
Collaborator
Collaborator

@cadffm wrote:

 

Without Lisp: Use command FILTER , filter for your Blockname and apply to ALL<enter>

I tried this because I was curious and I rarely use the filter command myself.
However I can't get it to select blocks on another layout tab, apply to ALL isn't there and Ctrl+A also doesn't select layout objects?

0 Likes
Message 7 of 53

Moshe-A
Mentor
Mentor

@h_s_walker hi,

 

Check APPLYCLIENT command, it's classic autolisp and hope it will work in LT (which i do not have)

cause you did not post your block lines#5-6 define 2 constant BNAME & TAG, supply your block

and tag names respectively (otherwise it won't work 😀)

 

enjoy

Moshe

 

; apply client

(defun c:applyClient (/ BNAME TAG client ss ctr ename subent sube)

 (setq BNAME "title" ) ; const
 (setq TAG   "client") ; const
 
 (if (and
       (/= (setq client (getstring "\nClient name: ")) "")
       (setq ss (ssget "_x" (list '(0 . "insert") (cons '2 BNAME) '(66 . 1))))
     )
  (progn
   (setq ctr 0)
   (foreach ename (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
    (setq subent (entnext ename) sube (entget subent))
    (while (/= (cdr (assoc '0 sube)) "SEQEND")
     (if (eq (strcase (cdr (assoc '2 sube))) (strcase TAG))
      (progn
       (entmod (subst (cons '1 client) (assoc '1 sube) sube))
       (setq ctr (1+ ctr))
      ); progn
     ); if
     (setq subent (entnext subent) sube (entget subent))
    ); while
   ); foreach
   
   (cond
    ((= ctr 0)
     (prompt "\nNo attributes found to update.")
    ); case
    ( t
     (prompt (strcat "\n" (itoa ctr) " attribute(s) update."))
    ); case
   ); cond
  ); progn
 ); if

 (princ)
); c:applyClient

 

 

 

0 Likes
Message 8 of 53

cadffm
Consultant
Consultant

Hi,

 

>>"apply to ALL isn't there"

I am talking about the very basic object selection method: ALL

If AutoCAD ask  for object selection, answer with ALL<enter>

 

Read more about AutoCAD object selection methods in [F1] - SELECT (Command)

you don't need to use the command, but this help page is the one you get a good overview about the basic object selection methods

 

>>"and Ctrl+A also doesn't select layout objects?"

That's right, CTRL+A select objects in current space only.

 
 

 

 

Sebastian

Message 9 of 53

Brock_Olly
Collaborator
Collaborator

Thanks, that cleared it up for me. Didn't realise you could type ALL when it prompts for selection.

0 Likes
Message 10 of 53

h_s_walker
Mentor
Mentor

Unfortunately neither of them are working @Moshe-A @cadffm 

The lisps will not allow me to put more than one word, as soon as I hit space it "returns"

@cadffm Your update did not allow me to put the attribute name in

@Moshe-A We have several Title blocks which all have different names, so I cannot put a block name in the lisp, however the attribute tag for the client is always CLIENT

 

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 11 of 53

Brock_Olly
Collaborator
Collaborator
0 Likes
Message 12 of 53

cadffm
Consultant
Consultant

Hi,

 

>>Unfortunately neither of them are working @Moshe-A @cadffm 

hmm, all 4 works (3 way from me and the one from Moshe-A too)

 

>>The lisps will not allow me to put more than one word, as soon as I hit space it "returns"

That's refering to my and moshe-a lispcode, not to ma other solutions, okay:

So they does work! But you can not enter a space " "

 

Easy to solve, change

change
(getstring "\nEnter new attribute value ") to
(getstring T "\nEnter new attribute value ")
or
(getstring "\nClient name: ") to
(getstring T "\nClient name: ")

 

 

@cadffm Your update did not allow me to put the attribute name in

Hey, not just copy&paste, try to read the code aswell, also if you can't understand all things.

 

Hardcoded, change the name in the code:

TG "YOURATTRIBNAME" ; UPPERCASE!

TG "CLIENT" ; uppercase

 

@Moshe-A We have several Title blocks which all have different names,

from
(setq ss (ssget "_x" (list '(0 . "insert") (cons '2 BNAME) '(66 . 1)))) to
(setq ss (ssget "_x" (list '(0 . "insert") (assoc 2 (entget(car(entsel)))) '(66 . 1))))

or for all blocks with attribute "CLIENT"
(setq ss (ssget "_x" (list '(0 . "insert") '(66 . 1))))

 

 

 

Sebastian

0 Likes
Message 13 of 53

cadffm
Consultant
Consultant

@Brock_Olly  schrieb:

https://lee-mac.com/batte.html


This will not work in LT Versions

 

Sebastian

0 Likes
Message 14 of 53

Moshe-A
Mentor
Mentor

@h_s_walker ,

 

no problem, check this fix

 

; apply client

(defun c:applyClient (/ BNAME TAG client ss ctr ename subent sube)

 (setq BNAME "title1,title2,title3") ; const
 (setq TAG   "client") ; const
 
 (if (and
       (/= (setq client (getstring t "\nClient name: ")) "")
       (setq ss (ssget "_x" (list '(0 . "insert") (cons '2 BNAME) '(66 . 1))))
     )
  (progn
   (setq ctr 0)
   (foreach ename (vl-remove-if 'listp (mapcar 'cadr (ssnamex ss)))
    (setq subent (entnext ename) sube (entget subent))
    (while (/= (cdr (assoc '0 sube)) "SEQEND")
     (if (eq (strcase (cdr (assoc '2 sube))) (strcase TAG))
      (progn
       (entmod (subst (cons '1 client) (assoc '1 sube) sube))
       (setq ctr (1+ ctr))
      ); progn
     ); if
     (setq subent (entnext subent) sube (entget subent))
    ); while
   ); foreach
   
   (cond
    ((= ctr 0)
     (prompt "\nNo attributes found to update.")
    ); case
    ( t
     (prompt (strcat "\n" (itoa ctr) " attribute(s) update."))
    ); case
   ); cond
  ); progn
 ); if

 (princ)
); c:applyClient
0 Likes
Message 15 of 53

h_s_walker
Mentor
Mentor

@Moshe-A Unfortunately your update isn't working, could it be because the client attribute is a multiline attribute (sorry I should have said earlier)? 

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 16 of 53

Moshe-A
Mentor
Mentor

@h_s_walker ,

 

why don't you post sample dwg (clean the content keep some title blocks)

0 Likes
Message 17 of 53

cadffm
Consultant
Consultant

Hi,

 

>>"sorry I should have said earlier"

Yes.

But my code works also with multiline attributes

 

Moshe-A code need an update, like

cadffm_0-1740749953524.png

 

 

Sebastian

0 Likes
Message 18 of 53

h_s_walker
Mentor
Mentor

@Moshe-A Here is a sanitised drawing containing all the blocks which have the attribute CLIENT in them

 

Howard Walker
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Left Handed and Proud

0 Likes
Message 19 of 53

cadffm
Consultant
Consultant

Works perfect,

with all 3 ways offered

and with Moshe-A code and my mentioned edit (reverse sube) instead of sube

too

Sebastian

0 Likes
Message 20 of 53

dbroad
Mentor
Mentor

Why are you posting on the Visual Lisp forum?  AFAIK, LT2025 doesn't support LISP.  I don't have it but I believe that LT supports fields.  A couple of approaches.

  • Use the sheet set manager and populate your title blocks with sheet set fields.
  • Use dwgprops to add a user defined property called client.  Then add a document field to each titleblock layout that reports the client property.  The field can be inside an attribute definition within the titleblock.  Such attribute definitions should be flagged preset and the field would be in the default text.

To find appropriate support for LT, post to the LT forum.

Architect, Registered NC, VA, SC, & GA.
0 Likes