V4Mp Posted March 19, 2021 Posted March 19, 2021 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. Quote
BIGAL Posted March 20, 2021 Posted March 20, 2021 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. Quote
Tharwat Posted March 20, 2021 Posted March 20, 2021 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) ) Quote
V4Mp Posted March 22, 2021 Author Posted March 22, 2021 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. Quote
Tharwat Posted March 22, 2021 Posted March 22, 2021 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 ? Quote
Tharwat Posted March 22, 2021 Posted March 22, 2021 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) 1 Quote
V4Mp Posted April 19, 2021 Author Posted April 19, 2021 @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? Quote
Tharwat Posted April 19, 2021 Posted April 19, 2021 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. 1 Quote
V4Mp Posted April 19, 2021 Author Posted April 19, 2021 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". Quote
Recommended Posts
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.