Usenet.com

www.Usenet.com

Group Index

Comp Thread Archive from Usenet.com

<-- __Chronological__ --> <-- __Thread__ -->

Re: Help: Entities with custom information



A snip from the online help:

You can use xdata to store any type of information you want. For
example, draw an entity (such as a line or a circle), then enter the
following code to attach xdata to the entity: 

(setq lastent (entget (entlast))) ; Gets the association
                                  ; list of definition data
                                  ; for the last entity.
(regapp "NEWDATA")                ; Registers the
                                  ; application name.
(setq exdata                      ; Sets the variable
 '((-3 ("NEWDATA"                 ; exdata equal to the
  (1000 . "This is a new thing!") ; new extended data—
  )))                             ; in this case, a text
)                                 ; string.
(setq newent  
  (append lastent exdata))  ; Appends new data list to 
                            ; entity's list.
(entmod newent)             ; Modifies the entity with the new 
                            ; definition data.
To verify that your new xdata has been attached to the entity, enter the
following code and select the object: 

(entget (car (entsel)) '("NEWDATA"))
This example shows the basic method for attaching extended data to an
entity. 


For more informations read the LISP online help, "Extended Data". You
can also see a good example how to use XDATA in the Express Tool
xdata.lsp.


Juergen

BTW: For Extended Entity Data you should use the codes 1000 and higher
(not a code 666 in your example).



Toni Benedico schrieb:
> 
> Hello,
>    I would be grateful if sbdy help me with that:
>    I'm trying to put custom information for my application inside some
> drawing entities. For example: in an "ARC" entity, I'd like to put a new
> custom code: (666 . "CounterClockwise") or (666 . "Clockwise"). I mean that,
> whether the 666 code already exists or not, my question is: "Can I add
> custom attributes? and how?, and how to access them later?"
> 
> Thanks in advance,
>    .- Toni
> 
> PD: I'm writing it in LISP, in case it is relevant.




<-- __Chronological__ --> <-- __Thread__ -->


Usenet.com



Please check out one of the premium Usenet Newsgroup Service Providers below for access to Usenet.