Skip to main content
Question

Check the presence of layer and attribute in the DWG file


mgeomaticien
Participant
Forum|alt.badge.img

Hi all

I want to Check the presence of one or more layers (which I already know the names) and in each of the layers verifies the existence of one or more attributes (already known) when reading the data source.

Thank for advance

21 replies

david_r
Celebrity
  • May 12, 2017

You can for example use a Tester for the known layer name based on fme_feature_type, followed by a NoFeaturesTester (from the FME Hub) to get a trigger if it doesn't exist.


mgeomaticien
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • May 12, 2017
david_r wrote:

You can for example use a Tester for the known layer name based on fme_feature_type, followed by a NoFeaturesTester (from the FME Hub) to get a trigger if it doesn't exist.

Thank you david. I've installed the "NoFeaturesTester", but I don't know how it work. It does not offer configuration options.

 

 


david_r
Celebrity
  • May 12, 2017
mgeomaticien wrote:
Thank you david. I've installed the "NoFeaturesTester", but I don't know how it work. It does not offer configuration options.

 

 

Have a look at the description, it's fairly straight-forward:

 

https://hub.safe.com/transformers/nofeaturestester

 

Not sure you need it though, it depends on what you want to achieve.

mgeomaticien
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • May 12, 2017
david_r wrote:
Have a look at the description, it's fairly straight-forward:

 

https://hub.safe.com/transformers/nofeaturestester

 

Not sure you need it though, it depends on what you want to achieve.
This process check if the layer exist in the list of my layer. But how to check that I have all of my presnt layer list in my input data set

 

 


david_r
Celebrity
  • May 12, 2017

This pattern will read a DWG and check for a layer called "Sector", notably

  1. That the layer "Sector" has at least one feature
  2. That every feature in the "Sector" layer has an attribute called "LabelString"

When creating the reader, make sure to create it as a merged feature type and to expose the format attribute "fme_feature_type":


mgeomaticien
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • May 12, 2017

Thank you david. I do not see the patern. The image is not visible


david_r
Celebrity
  • May 12, 2017
mgeomaticien wrote:

Thank you david. I do not see the patern. The image is not visible

In e.g. Chrome, right-click and select Open image in new tab.

 

It will open this file: https://i.imgur.com/g4BafRL.png

mgeomaticien
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • May 12, 2017

Thank you david. The image is visible. I will test it and I inform you of the result


david_r
Celebrity
  • May 12, 2017

Come to think of it, here's also the workspace pictured above.

acad2none.fmwt


mgeomaticien
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • May 15, 2017

Thanks david. I hope you had a good weekend.

The workbench works with the test of a single layer. But when I specify the name of two layers in the tester field, it doesn't work


mgeomaticien
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • May 15, 2017

Anyone knows how to specify the search for two layers ?


david_r
Celebrity
  • May 15, 2017
mgeomaticien wrote:

Thanks david. I hope you had a good weekend.

The workbench works with the test of a single layer. But when I specify the name of two layers in the tester field, it doesn't work

Can you please be a bit more specific? What happens and what do you expect?

mgeomaticien
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • May 15, 2017

So I will try to be more precise:

I have a DWG file from a designer. This file contains several layers. My workbench must check that among these layers are the layers: tree_layer, building_layer, and root_layer. Then it must also verify that tree_layer contains the attributes: name, type, size. And that the building_layer contains the attributes: name, type, surface. If one of the layers or attributes I have specified does not exist then my workbench writes the errors to another layer. I hope it's clearer now

david_r
Celebrity
  • May 15, 2017
mgeomaticien wrote:

So I will try to be more precise:

I have a DWG file from a designer. This file contains several layers. My workbench must check that among these layers are the layers: tree_layer, building_layer, and root_layer. Then it must also verify that tree_layer contains the attributes: name, type, size. And that the building_layer contains the attributes: name, type, surface. If one of the layers or attributes I have specified does not exist then my workbench writes the errors to another layer. I hope it's clearer now
Can you show a screenshot of how you configured the Tester?

 


mgeomaticien
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • May 15, 2017

Here's how I configured to search for my two layers


david_r
Celebrity
  • May 15, 2017
mgeomaticien wrote:

Here's how I configured to search for my two layers

There's the error, the value of "fme_feature_type" can't be both "tree_layer" AND "building_layer" at the same time.

mgeomaticien
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • May 15, 2017

Yes indeed. That's why I'm looking for a transformer that will allow me to enter several layer names I'm looking for


david_r
Celebrity
  • May 15, 2017
mgeomaticien wrote:

Yes indeed. That's why I'm looking for a transformer that will allow me to enter several layer names I'm looking for

Maybe the TestFilter can help you out. Make an output port for each of your required layers and re-direct each to their own NoFeaturesTester etc. There is no single transformer to do exactly what you need, you'll have to "program" the logic using the existing transformers.

mgeomaticien
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • May 15, 2017
david_r wrote:
Maybe the TestFilter can help you out. Make an output port for each of your required layers and re-direct each to their own NoFeaturesTester etc. There is no single transformer to do exactly what you need, you'll have to "program" the logic using the existing transformers.
Yes exactly, I have to put together several transform to do it. But since last week I don't come up with a very good solution

 

 


mgeomaticien
Participant
Forum|alt.badge.img
  • Author
  • Participant
  • May 15, 2017

Yes exactly, I have to put together several transform to do it. But since last week I don't come up with a very good solution


gio
Contributor
Forum|alt.badge.img+15
  • Contributor
  • May 15, 2017

read the fme_data_set (dwg name) and group the fme_feature_types (layers in the dwg) and or the attributes.

Use a listbuilder or aggregator for that.

Search the list for the items you require.

(you may want to test of the features contain objects maybe too.)

An autocad layer does not require it to have objects. (a no feature feature_type can exist)


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