Solved

AutoCAD DWG - Preserve pattern style of hatches

  • 13 September 2022
  • 2 replies
  • 37 views

Hello everyone,

 

I have a question with regard to preserving the pattern style of hatches in DWG files. 

 

I have a simple DWG file with two lines (blue), one text (yellow), a dimension (magenta), and a polygon (blue) which is filled with a hatch (cyan): 

00_DWG file 

If I now simply read the DWG file with a REALDWG reader and do nothing but write it again with the REALDWG writer, 

01_Workspacethe hatching pattern looks very different in the result - which is basically because the lines of the hatching pattern are much closer together than they were in the original DWG file:

02_Before vs AfterMore details below.

Does anyone know how I need to parameterize reader and/or writer such that the pattern style of the hatch is preserved 1:1? 

In the REALDWG reader, I already linked the read-in DWG file as a "Template File". This helped to preserve the styling of the dimension but unfortunately not with regard to the pattern style of the hatch.

 

 

Here some more details:

Regarding the parameterization of the REALDWG reader, I only unchecked the "Explode Dimensions" option, everything else if FME Default.

03_a_REALDWG readerAll the features are read as a single, merged feature type. For this feature type, I exposed the Format Attributes "autocad_layer" and "fme_feature_type":

 03_b_REALDWG feature type reader 

For the REALDWG writer, I did the following:

  • set "Attribute Output" to "Extended Entity Data"
  • set the DWG file which is read by the reader as "Template File"

04_a_REALDWG writerIn the feature type writer, the "autocad_layer" attribute is used for the "Layer Name":

04_b_REALDWG feature type writer 

The various objects are on different layers in the attached/read-in DWG file:

  • 01_Linien: The two lines and the polygon.
  • 02_Schraffur: The hatch located within the polygon.
  • 03_Text: The text.
  • 04_Maßlinie: The dimension.

 

icon

Best answer by jovitaatsafe 14 September 2022, 01:38

View original

2 replies

Userlevel 1
Badge +11

Hi @lbd-kufers​, everything you've got set up looks good, unfortunately we don't currently have support for writing associative hatches, which seems to be what your hatch is. You might be interested in upvoting and sharing your use case on this existing idea to add support for associative hatches to help inform our development team of this need. We've noted this internally and we're tracking this potential enhancement as (FMEENGINE-8155).

 

Comparing the output to the original in AutoCAD, the scale values look correct, but the hatch scale appears to be wrong visually and I suspect this may be tied to the fact that we don't support associative hatches yet.

 

While I experimented with the file, here are some things I noted that might hopefully offer some ideas:

  1. Changing Island Detection Style in AutoCAD to 'Normal' from 'Outer' makes the hatch look as we expect for the values given. Unfortunately setting this in the workspace (autocad_hatch_style = 0 sets it to Normal successfully without the same effect)
  2. Toggling the scale on the hatch in AutoCAD to something else and back to 0.05 makes it look like what we expected
  3. Unlikely to be desirable, but incidentally, I played with the scale in FME by adding an AttributeCreator to set the autocad_hatch_pattern_scale and had some success with multiplying the value by itself. This does change the value in the output though

 

Thanks @jovitaatsafe​ for your insightful answer and the suggested ideas. I'll get in touch with my colleagues about what is possible right now and see if this is sufficient. In the meantime, I'll also upvote the idea and share my case. Thanks again!

Reply