• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

edit multiline attributes

  • Thread starter Thread starter Giuseppe Beatrice
  • Start date Start date

Giuseppe Beatrice

Guest
hi guys, I've got a question about multiline attributes, which I've just found out about quality.
the problem I have is that the extraction made with autolisp provides the value of the attribute as a normal text string, without any difference to normal attributes.
Moreover, the changes in the value of the attributes made with the normal routines, of which I eventually attach the relative function, do not change at all the value of the attribute, which remains the previous one.
By reading from autocad in attribute properties, I see characters (\w0.6000; ...\p...), but obviously the only possibility to change the value is to directly edit the new text as any multiline text.
Is there any possibility to edit attribute values directly as multiline text from autolisp?
thanks to all for the interest.
I attach the internal function that I normally use for changing attributes values:
[Bleep] [Bleep]
;;;; receives from function calling entity name and list containing pairs with the label and the new associated value, to be inserted in the block
;;; for the moment no verification of congruity on the type of entity (if different from block) or on the eventual lack of attributes, giving everything to check
(defun modif_attrib (objent lst_val / noment element attrib label val_attr)
(setq noment objent)
(setq element (entget noment))
(while (/= (cdr) "seqend")
(setq noment (entnext noment)
(setq element (entget noment))
(forach attrib lst_val)
(setq label (car attrib)
val_attr (cdr attrib)
(if (equal (assoc 2 element) (cons 2 label))
(progn (setq element (subst (cons 1 val_attr) (assoc 1 element))))) (incl. element)))
(entupd noment)
 
questa potrebbe essere una possibilità di modifica del lisp, con la verifies se ci sono or meno attributi. for quanto riguarda gli attributi multilinea devo verifye su una versione più evoluta di autocad 2007.

(defun modif_attrib (objent lst_val / listaattr)
(if (= (vla-get-hasattributes (vlax-ename->vla-object object object object object object) :vlax-true)
(progn)
(setq listaattr (vlax-safearray->list(vlax-variant-value (vla-getattributes (vlax-ename->vla-object object object object object object))))))
(mapcar '(lambda (elemento)
(if (= (vla-get-tagstring element)
(vla-put-textstring elemento (cadr lst_val))
)
)
Listaattr
)
)
)(princ)
)
 
I checked on the 2011 version.
the modification in visuallisp of the attribute editing program also works on multiline ones, it is enough to have the acknowledgment to make a return to head with \\p.
the syntax is always the same:
(modif_attrib entity list_values)
where:
entity - selected entity
list_values - list of 2 items, the first, string, is the label, the second is the value to change. in the case of multiline attributes must be a string, otherwise it can also be a number.

es:
(modif_attrib (car(entsel)) (list "xyz")\\pe' una stringa\\psu piu' linee"))
 
confutatis, you are a monster!!!
thanks for the precious help and thanks also for the modification of my program with vba instructions, which made it much more compact.
About these instructions, which unfortunately I don't know for nothing, and on which I found the help online rather "hot", could you give me some tips on any texts or websites from which to learn in a profitable way the use?
thanks again and good day.
 
even if the syntax is very similar, the instructions are not vba but visuallisp.

regarding the sites:http://www.afralisp.net/archive/methods/methods_ref.htm I think the best even if incomplete.
http://autocad.compago.it/guidasviluppatori2008/acadauto/idx_methods.phpthis is also contained in the online help of autocad in the voice: guide for developers->activex and vba reference->methods. the instructions are in vba but you can compare them with the previous site to "transfer" them to vlisp.
then in any case, since the methods are several, you have to try and try again until you find what is good for you.
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top