Skip to main content
Question

Extracting attributes from AutoCAD Blocks


Forum|alt.badge.img

Im working with this original template(https://knowledge.safe.com/articles/59335/autocad-dwg-block-attribute-extraction.html). Same reader, but now the Writer is a Geotable. I have added additional transformers for coordinates and to extract attributes in multiple fields instead of one field with all attributes as a list. This is where my question takes place, If I am for example exposing 10 elements(from the AttributeSplitter) but only 6 elements have attribute data, How can I set it up to automatically remove/delete the 4 elements from the Writer that have null values? Attached is the file I am working with, which has the example I mentioned above.

10 replies

xiaomengatsafe
Safer
Forum|alt.badge.img+3

Hello @gerardor. Thanks for your question. It sounds to me your question is about how to remove attributes that only contain null values from the schema, so they won't be written on the output. If my interpretation of your question is correct, I encourage you to check out this other Forum thread, where some community members, including myself, had provided some suggestions. https://knowledge.safe.com/questions/38286/remove-empty-fields.html

 

My answer included a template you could try and adapt to your own workflow.

 

Hope that helps!

 

Cheers,

Forum|alt.badge.img
  • Author
  • April 10, 2019
xiaomengatsafe wrote:

Hello @gerardor. Thanks for your question. It sounds to me your question is about how to remove attributes that only contain null values from the schema, so they won't be written on the output. If my interpretation of your question is correct, I encourage you to check out this other Forum thread, where some community members, including myself, had provided some suggestions. https://knowledge.safe.com/questions/38286/remove-empty-fields.html

 

My answer included a template you could try and adapt to your own workflow.

 

Hope that helps!

 

Cheers,

I believe this workflow from the Forum thread you directed me is more for a table or feature that is set in place or existing. The workflow that I am working with is extracting blocks with attributes(tags and values), and writing it out as a geotable. I am looking for a way to remove attributes within my workflow process. Does this make sense?


xiaomengatsafe
Safer
Forum|alt.badge.img+3
gerardor wrote:

I believe this workflow from the Forum thread you directed me is more for a table or feature that is set in place or existing. The workflow that I am working with is extracting blocks with attributes(tags and values), and writing it out as a geotable. I am looking for a way to remove attributes within my workflow process. Does this make sense?

Ah, I see your point @gerardor. Would love to hear what others think.

Currently, my only idea would be to write out a temporary file (could even consider FME's own internal format .ffs). You can still achieve this in one workspace:

  • Build on our current workflow. After you've extracted and exposed all the attribute, use a FeatureWriter to write out the intermediate output, that has all the attributes written, regardless of whether they have values or not.
  • Use the same method in the thread that I linked above, the FeatureReader can read back the intermediate output and produce the schema feature.

Would this work?

 


Forum|alt.badge.img
  • Author
  • April 24, 2019
xiaomengatsafe wrote:

Ah, I see your point @gerardor. Would love to hear what others think.

Currently, my only idea would be to write out a temporary file (could even consider FME's own internal format .ffs). You can still achieve this in one workspace:

  • Build on our current workflow. After you've extracted and exposed all the attribute, use a FeatureWriter to write out the intermediate output, that has all the attributes written, regardless of whether they have values or not.
  • Use the same method in the thread that I linked above, the FeatureReader can read back the intermediate output and produce the schema feature.

Would this work?

 

@xiaomengatsafe not quite sure what was the actual procedure you described. Is writing out to the temporary file part of the workflow you mentioned in both bullet points?


xiaomengatsafe
Safer
Forum|alt.badge.img+3
gerardor wrote:

@xiaomengatsafe not quite sure what was the actual procedure you described. Is writing out to the temporary file part of the workflow you mentioned in both bullet points?

@gerardor, sorry for the confusion. I'll try to clarify the steps:

  1. As you mentioned that you've already managed to extract attributes in multiple fields. Let's build on this workflow.
  2. Add a FeatureWriter transformer (which can write output in the middle of a workflow), to write out the result of step 1, as intermediate output.
  3. Add a FeatureReader after the FeatureWriter in step 2, to read the intermediate output back into the workspace.
  4. Now, the FeatureReader is the starting point of the workflow introduced in the other thread, which should help remove attributes that contain no value, so they won't be written to the final output.

Hope this is a bit more clear. :)


Forum|alt.badge.img
  • Author
  • May 30, 2019
xiaomengatsafe wrote:

@gerardor, sorry for the confusion. I'll try to clarify the steps:

  1. As you mentioned that you've already managed to extract attributes in multiple fields. Let's build on this workflow.
  2. Add a FeatureWriter transformer (which can write output in the middle of a workflow), to write out the result of step 1, as intermediate output.
  3. Add a FeatureReader after the FeatureWriter in step 2, to read the intermediate output back into the workspace.
  4. Now, the FeatureReader is the starting point of the workflow introduced in the other thread, which should help remove attributes that contain no value, so they won't be written to the final output.

Hope this is a bit more clear. :)

@xiaomengatsafe The output that I am getting is the same one if I would put together the first part of my workflow and just write to a dynamic writer. What can be the problem? I have attached my workbench file. It is automatically removing the AutoCAD attributes out(autocad_block_name, autocad_elevation,autocad_layer, etc.)

Also, will this work for when the FeatureWriter contains multiple features instead of a single feature?

Please advise

Thank you

AutoCADBlockExtraction_remove fields.fmw


xiaomengatsafe
Safer
Forum|alt.badge.img+3
gerardor wrote:

@xiaomengatsafe The output that I am getting is the same one if I would put together the first part of my workflow and just write to a dynamic writer. What can be the problem? I have attached my workbench file. It is automatically removing the AutoCAD attributes out(autocad_block_name, autocad_elevation,autocad_layer, etc.)

Also, will this work for when the FeatureWriter contains multiple features instead of a single feature?

Please advise

Thank you

AutoCADBlockExtraction_remove fields.fmw

Hi @gerardo, I had a look at the workspace you created, and spotted a few things that might be causing you trouble. I edited the workspace and added notes on why I suggested those changes.

Note: The changes suggested for the FeatureWriter should be made on your end.

27639-autocadblockextraction-remove-fields_new.fmw


Forum|alt.badge.img
  • Author
  • June 26, 2019
xiaomengatsafe wrote:

Hi @gerardo, I had a look at the workspace you created, and spotted a few things that might be causing you trouble. I edited the workspace and added notes on why I suggested those changes.

Note: The changes suggested for the FeatureWriter should be made on your end.

27639-autocadblockextraction-remove-fields_new.fmw

Hello @xiaomengatsafe, After applying the changes provide it doesnt seem to do anything after the FeatureReader. I have tried to under the FeatureReader within the "Feature Types to Read:" the 4 options it gives me to read but nothing is being output beyond the FeatureReader.


xiaomengatsafe
Safer
Forum|alt.badge.img+3
gerardor wrote:

Hello @xiaomengatsafe, After applying the changes provide it doesnt seem to do anything after the FeatureReader. I have tried to under the FeatureReader within the "Feature Types to Read:" the 4 options it gives me to read but nothing is being output beyond the FeatureReader.

Hello @gerardor, Sorry to hear you are still having issues. I think maybe the best way to get to the bottom of this, is through a support case with our technical experts. Please file a case under this link, and include your current workspace as well as a sample data. It would also help if you reference our discussion in this Q&A thread.

Thank you!


Forum|alt.badge.img
  • Author
  • July 29, 2019
xiaomengatsafe wrote:

Hello @gerardor, Sorry to hear you are still having issues. I think maybe the best way to get to the bottom of this, is through a support case with our technical experts. Please file a case under this link, and include your current workspace as well as a sample data. It would also help if you reference our discussion in this Q&A thread.

Thank you!

Hi @xiaomengatsafe, I will move forward in doing that. Thank you for your help.


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings