Jump to content

XDATA, what it is for and how it works (Please)!!


duke

Recommended Posts

Hello friends !!
I was wondering about XDATA,
What is it for and how does it work within AUTO-LISP ❓
Because I don't know exactly if it works for what I'm thinking.
Maybe you can create objects, for example:
CIRCLES and internally assign each circle an internal data to each one, so that each and every one of the circles has a unique and unrepeatable and totally identifiable "NAME" ❓❓
Example:
To join all the circles with a polyline, in a specific order, say from the circle called internally with a number 1 (ONE), to the circle number 5 (FIVE).
Or XDATA is not used like that ❓❓
I put that as an example, but if it is used for other things, could you write me a small example code to understand how XDATA works, please ❓❓
Something very simple and small, you can ❓❓
And in advance, thank you very much ‼‼

Link to comment
Share on other sites

8 hours ago, Steven P said:

XData is essentially an additional bit of information added to the entity definition, it doesn't change how the entity is shown on the screen. What you want to do can be done, and this link is a good description

https://www.afralisp.net/autolisp/tutorials/extended-entity-data-part-1.php

Great !!! i am going to read 
Thanks bro ‼‼‼👌👌👌👌👌

Link to comment
Share on other sites

Posted (edited)

"Joining circles via creation order", using ssget can most times do this, try it, but as was posted somewhere else doing a sort on the "Handle ID" of the objects is creation order. I seem to remember must change to a number not hex.

 

Quick and dirty

(defun wow ( / ss x)
(setq ss (ssget '((0 . "CIRCLE"))))
(command "pline")
(repeat (setq x (sslength ss))
(command (cdr (assoc 10 (entget (ssname ss (setq x (1- x)))))))
)
(command "")
)
(wow)

 

image.png.9b939f0fa886bacc09a87e51432d59ea.png

Edited by BIGAL
  • Like 1
Link to comment
Share on other sites

Posted (edited)
1 hour ago, BIGAL said:

"Joining circles via creation order", using ssget can most times do this, try it, but as was posted somewhere else doing a sort on the "Handle ID" of the objects is creation order. I seem to remember must change to a number not hex.

 

Quick and dirty

(defun wow ( / ss x)
(setq ss (ssget '((0 . "CIRCLE"))))
(command "pline")
(repeat (setq x (sslength ss))
(command (cdr (assoc 10 (entget (ssname ss (setq x (1- x)))))))
)
(command "")
)
(wow)

 

image.png.9b939f0fa886bacc09a87e51432d59ea.png

ty BIGAL
beauty example for creating a pline 👌👌👌👌👌👌👌‼‼‼‼‼

Edited by duke
Link to comment
Share on other sites

Posted (edited)

There aren't really many applications in which you would use xdata. I can only imagine needing one when you create your own applications like you would with a dictionary, in which you would like the objects to behave and "react" differently in respond to several commands. Again, what do I know... 🙃

 

Here is one example of one of my programs in which xdata is used. (I hardly ever use this because I hardly see its use, but I just created it as practice for myself. Hence, I stopped enhancing it.)

 

Edit: Apologies for the complex example, I didn't read the OP that it was intended to be simple...

ObjectPropertySync.lsp

Edited by Jonathan Handojo
  • Like 1
Link to comment
Share on other sites

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