Question

Unable to add xdata to a .dwg

  • 10 December 2014
  • 4 replies
  • 15 views

Badge
Hi

 

 

I would like to read a layer from a .dwg (polygons) and add different types of xdata (code 1000/string, code 1002/control, code1005/handle, …) to each polygon in a predefined position (ex. autocad_extended_data_list{6} to {9}) and writing it back to the .dwg source. This is what I did:
  1. Read the .dwg using ACAD reader (DXF/DWG)
  2. Expose the autocad_extended_data_list{} and its items
  3. Using a PythonCaller or AttributeCreator set the values for each item of the list
  4. Using ACAD writer (DXF/DWG) write back the layer to .dwg (set attribute output: Extended Entity Data)
Here is the problem:

 

I couldn't get the FME to write back the xdata!

 

 

I can get my xdata only if I create some "User Attributes" in my outpt layer (feature type properties), however the final values are not what I expected: instead of « string:test1 » I will get « string:"Name of User Attribute"=test1 » !

 

 

Could you please help me with that

 

Many thanks

 

 

Hani 

4 replies

Userlevel 2
Badge +17
Hi Hani,

 

 

If the source features have "autocad_extended_data_list{n}" (n = 6-9), I think you can overwrite them with the AttributeCreator.

 

 

Takashi
Badge +3
not entity_handle. Writer will (re)create it.
Badge
@Takashi

 

 

Thanks Takashi, yes you are right. I can modify the values and keep the part which I need in second step, however I was looking for a method to add xdata in one shot. Is it impossible with FME?!

 

 

@Gio

 

 

You read my mind! here my questions reagrding polygon handles:

 

 

1- Is there any way to write xdata to a polygon without touching its handle? in simple words, Is it possible in FME to simply modify a .dwg and not rewrite it?

 

 

2- Using FME can I set the value for "autocad_entity_handle" using values from another field?

 

 

Many thanks in advance for your answer

 

 

Hani
Badge
I kind of found a way out :)

 

 

I realized that ACAD writer in each run gives a same handle to polygon! so:

 

1- Run workspace with ACAD writer for first time

 

2- Saving "autocad_entity_handle" values in a table using second workspace

 

3- Run original workspace for sencond time and add entity_handles as xdata for each polygon

 

 

I hope that helps the others

 

 

Hani

Reply