Jump to content

Recommended Posts

Posted

Hello,
how can I access the attribut of the title block and frame?

 

In my case I want to write the "GEN-TITLE-SIZ" into an property called "sheet-size".

Can I access the attribut directly?

 

It's only for the "modell" tab! I dont use layouts.

Posted

Manually easy dbl click attribute atts pop up, version 2 Ctrl+pick attribute opens that attribute to edit.

 

Do you have lots of title blocks in Modelspace ?  Then google replace attribute value in multi blocks, Lee-mac.com has a good attribute editor.

 

I have stuff too but need to confirm more details about Titleblock. 

 

 

Posted
On 3/19/2021 at 1:16 PM, V4Mp said:

Hello,
how can I access the attribut of the title block and frame?

 

In my case I want to write the "GEN-TITLE-SIZ" into an property called "sheet-size".

Can I access the attribut directly?

 

It's only for the "modell" tab! I dont use layouts.

Hi,

What do you mean by property ? TAG string ?

If so, then try the following and let me know if this works for you.

(defun c:Test ( / s e g)
  (and (setq s (nentsel "\nPick directly at the attribute object to replace with 'GEN-TITLE-SIZ' : "))
       (or (= (cdr (assoc 0 (setq e (entget (car s))))) "ATTRIB")
           (alert "Invalid object. Try again")
           )
       (or (= (setq g (strcase (cdr (assoc 2 e)))) "SHEET-SIZE")
           (alert (strcat "Invalid TAG string < " g " > "))
           )
       (entmod (subst '(1 . "GEN-TITLE-SIZ") (assoc 1 e) e))
       )
  (princ)
  )

 

Posted

Hello @Tharwat

Thanks. 

I need it without picking an attribut manualy. :)

What I want is, that the "GEN-TITLE-SIZ" of the title block ("MYTITLE") is written into the DWG property "SIZE".
With property I mean the drawing properties (command DWGPROPS or german DWGEIGEN). "SIZE" ist a custom property I added.

I already have a lisp code, that runs automaticly  if the dwg is saved or the tab is changed.

My problem is how to find the attribute in the block and add it into a property.

Posted
1 hour ago, V4Mp said:

My problem is how to find the attribute in the block and add it into a property.

 

Is your attributed block dynamic ?

Do you have that attributed block inserted into your drawing only once ?

What is the TAG name ?

Posted

Here you go with UNTESTED function.

Your attributed block must be regular and not dynamic in this case, and inserted only once into your drawing since the following function get the info from the firstly found block.

Waiting for your kind reply.

(defun TH:Attribute:value:to:custom:key ( att:blk:name tag:name custom:key / att sum int)
  ;; Tharwat - Date: 22.Mar.2021	;;
  (and (setq sel (ssget "_X" (list '(0 . "INSERT") (cons 2 att:blk:name) '(66 . 1) (cons 410 (getvar 'CTAB)))))
       (foreach obj (vlax-invoke (vlax-ename->vla-object (ssname sel 0)) 'Getattributes)
         (and (= (vla-get-tagstring obj) tag:name)
              (setq att (vla-get-textstring obj))
              )
         )
       (setq sum (vla-get-SummaryInfo (vla-get-ActiveDocument (vlax-get-acad-object))))
       (repeat (setq int (vla-numcustominfo sum))
         (and (setq int (1- int))
              (progn
                (vla-getcustombyindex sum int 'name 'value)
                (and name (= name custom:key))
                )
              (not (vl-catch-all-apply 'vla-removecustombykey (list sum name)))
              (vla-addcustominfo sum name att)
              )
         )
       )
  (princ)
  ) (vl-load-com)

 

  • Like 1
  • 4 weeks later...
Posted

@Tharwat
Yes. Thanks for your kind replay. And I am sorry for my latly.
I have had hard days of work.

Thats perfect. Exactly what I needed. But one question...
Maybe you can explain the code a little bit?

As far as I undestand...

 

(and (setq sel (ssget "_X" (list '(0 . "INSERT") (cons 2 att:blk:name) '(66 . 1) (cons 410 (getvar 'CTAB)))))

you check all insert blocks and check the name in active tab?
But for what is the  "(66 . 1)"

 

then you check the attribut
 

(and (= (vla-get-tagstring obj) tag:name)

 

"sum" is what?

Posted

You're welcome anytime.

 

Yes the routine to find attributed blocks that reside in current active space only.

Group Code (66 . 1) is to consider attributed blocks only.

'sum' is just a variable name.

  • Thanks 1
Posted

Ah ok. I see. "sum" are the summary informations and there are the custom infos. 
And then you lit thrue all informations of the custom infos and add the value to the information with the key "name".

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...