libredwg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libredwg] User data (pointer) in objects and entities struct


From: Андрей
Subject: Re: [libredwg] User data (pointer) in objects and entities struct
Date: Wed, 03 Aug 2022 17:53:42 +0500

No,

custom user_data can only be added as EED to each entity.
I don't think you understand me((
Of course if I want to save my data in a DWG file I will use XData.
But I just want to keep the correspondence between DWG objects and my objects so that I can quickly find what I need while importing primitives from DWG, without organizing external data structures and without wasting time building and searching for them.
This does not affect the file storage format on disk and only works when I create my primitives based on the information downloaded from the dwg.
 
03.08.2022, 16:49, "Reini Urban" <reini.urban@gmail.com>:
Андрей <zamtmn@yandex.ru> schrieb am Mi., 3. Aug. 2022, 13:02:
 
 
I do not know C, I think it should look like this patch:
 
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 include/dwg.h | 4 ++++
 1 file changed, 4 insertions(+)
 
diff --git a/include/dwg.h b/include/dwg.h
index 946df205..4b040939 100644
--- a/include/dwg.h
+++ b/include/dwg.h
@@ -8237,6 +8237,8 @@ typedef struct _dwg_object_entity
   BITCODE_H full_visualstyle; /*!< r2010+ code 5, DXF 348 */
   BITCODE_H face_visualstyle;
   BITCODE_H edge_visualstyle;
+  void *user_data /* this is not used in any way in LibreDWG,  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+                  /* it is created and freed in the application!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
 } Dwg_Object_Entity;
 
 /**
@@ -8494,6 +8496,8 @@ typedef struct _dwg_object_object
 
   /*unsigned int num_handles;*/
   Dwg_Handle *handleref; //??
+  void *user_data /* this is not used in any way in LibreDWG,  !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
+                  /* it is created and freed in the application!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! */
 } Dwg_Object_Object;
 
 /**
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
 
It makes sense to be able to store your data in the DWG structure, of course, this data should not fall into the file, only be used by the application at the time of creating its primitives based on the information read from the DWG
 
 
02.08.2022, 20:50, "Rodrigo Rodrigues da Silva" <pitanga@members.fsf.org>:
On Mon, 1 Aug 2022 at 22:24, Андрей <zamtmn@yandex.ru> wrote:
I'm trying to use LibreDWG to read DWG files in my cad app (https://github.com/zamtmn/zcad)
nice!
 
Can you suggest me if there are fields in objects and entities data structure to store user data for the "parsing" time? I didn't see any of them. Is it possible to add them? this would greatly simplify the resolution of entities referring to each other
 
What do you mean by "user data"? Could you give an example of what you are trying to achieve through client code?
 
happy hacking,

reply via email to

[Prev in Thread] Current Thread [Next in Thread]