Skip to main content
Good morning everyone.I am working with a text type file that I take as an example for cadastral constructions.This text file has a specific structure but a variable number of lines depending on the number of heights of the buildings and the number of premises in each height.I use the file to:Know the name of the floor, for example “Basement”, “Floor 00”, “Floor 1”, etc. Know the number of heights it represents, that is, I do not have to draw floor 02 if it is the same as floor 01.This plant name and the number of heights it represents are related to a DXF file that I am not using at the moment.The first line that I need to read in any file is 27 where the number of heights of the building is expressed, this line number is fixed; and for each of the plants I find the following structure. “23” (Number of total heights of the building” (line 27 of the file)“01” (Number of heights that the drawing represents) (line 28 of the file)“SOTANO -2” (Floor name) (line 29 of the file)“95” (Number of premises on each floor) (line 30 of the file)“V.01.1” Name of premises 1 (line 31 of the file)“0000080” Area of ​​premises X (line 32 of the file)“CCE.01.1” Local name x1“0000139” Area of ​​premises X1And so on, the name of the premises is repeated and in the next line its surfaceAs I said, the first line that I need to read in any file is line 27 where the number of heights of the building is expressed.Thus, knowing this data, I can know that the next height represented in the file begins at line 221. I reach this conclusion knowing that 30+ (95*2)+1= 221. (Start line+(Number of premises*2  the name of the premises and the surface])+1=221And I'll have to read lines 221-234.I will have to repeat this process until the last height, so I have tried repeating this block of code by using a loop; but since I have never used it I am doing something wrong.I appreciate any helpThank you all.
This is a machine translation, sorry for my bad EnglishI attach the fmw file as well as the txt file

What a struggle it will be to convert this file.

I would read the file as individual lines and do the same as you are doing it manualy.

So first Test for the text_line 27 to get the value of the number of floors.

Then multiply this value to get the block sizes. This value you merge back to all your features. That way you can figure out what group that line should be in. @ceil(line_number/blocksize) or something.

Then you could figure out the linenumber within the block to know what information it should contain.

Maybe you could also use adjacent features function within the attributecreator to connect the value of row 31 to row 32.

 


This should be possible without a loop. Most of the work can be done in a single AttributeManager with 'Enable Adjacent Feature Attributes’ enabled, and using 1 prior feature. But you will have to put a lot of logic in Conditional Values: when to copy the value from the prior feature, and when to enter another value (and what value).

Something like this:

The workspace could look like this:

 


I hope this workspace provides a good start:

 


Note: I did not take into account

“01” (Number of heights that the drawing represents)

If this value is greater than 1 for any drawing in the file that is read, the workspace will not provide the right results.


 

Thank you all very much, I will continue trying with your advice and I will inform you. Thanks again.


Reply