Hi @lazarlubomir,
FME's AutoCAD writer will write any attributes defined on the output feature type to any points placed as blocks.
If the feature attribute is already defined on the block, FME will simply fill in the value for that attribute. If the feature attribute is not defined on the block, FME will create a new invisible attribute on the block, using the feature attribute value. By default, this attribute will be located at the block insertion point.
There are additional format attributes you can use to control the visibility and location of FME created block attributes, which are detailed at: https://docs.safe.com/fme/html/FME_Desktop_Documentation/FME_ReadersWriters/acad/Inserts.htm.
You can use the DWGStyler transformer to convert point features to blocks for output to AutoCAD.
At this time, blocks placed on layer '0' cannot have new attributes created, but all other layers are OK.
Hello @DaveAtSafe,
thank You so much for response. Anyway, what I need to know, if FME desktop is able to create and export an attribute to block, which design is different in block definition to model space.
I attach zip file. There is source file - DWG, which contains 3 blocks, but their design is different to their block definition, because their desing is not synchronized to current block definition. If I use test_2.fmw and try to convert source file DWG to exported file DWG, you can see in exported file with suffix "_doplneni", that design of blocks is totally different to blocks from source file. It is caused by template file, which is the same as source file, but block definition is different to block design in model space. But its bad for me, because I need in exported file 3 blocks with same design as in source file but with one new attribute. Key is design of blocks... Please, how to solve this problem?
fme_sample.zip
Thank You so much!
Lubo
Hi @lazarlubomir,
Please set the template file in the AutoCAD writer to your source DWG file. This way it will use the desired block definitions when writing out the new DWG file.
This is also a good technique for DWG -> DWG conversions where you don't have a proper template file.
The layer, linetype and block definitions will be copied from the source file, but not the data itself, unless you choose to set Preserve Template File Model Space Data to Yes.
Hi @lazarlubomir,
Please set the template file in the AutoCAD writer to your source DWG file. This way it will use the desired block definitions when writing out the new DWG file.
This is also a good technique for DWG -> DWG conversions where you don't have a proper template file.
The layer, linetype and block definitions will be copied from the source file, but not the data itself, unless you choose to set Preserve Template File Model Space Data to Yes.
Hello @DaveAtSafe,
yes, I understand. But I use proposed way of solution, as you can see in attached workspace, but unsuccesfully. You can try it in data, which I attached in last post.
The reason is simple - block used in model space of source file looks like this:
But block definition of this type looks like this:
It is caused by the fact that graphic of block is not synchronized to block definition via ATTSYNC command in ACAD.
So, if I use source file as template file for writer, block will look like this:
Some parts are filled - it depends on content of attributes.
I need just two things - the exported block should look like block at first picture (the same design as in source file before block synchronization) above and also I want to create new attribute to this block. Is that possible please?
Thank You so much!
Lubo
Hi @lazarlubomir,
I am attaching an annotated workspace illustrating how to set the attributes in order to force the output block to look as much as possible like the input.
The only thing FME can't handle is the text reversal on the two mirrored blocks.
test_2.fmw
Hi @lazarlubomir,
I am attaching an annotated workspace illustrating how to set the attributes in order to force the output block to look as much as possible like the input.
The only thing FME can't handle is the text reversal on the two mirrored blocks.
test_2.fmw
Hello @DaveAtSafe,
thank You so much, thats definitely what I need. It wasnt clear for me, how to use autocad_visible and autocad_invisible attributes.
Hi @lazarlubomir,
I am attaching an annotated workspace illustrating how to set the attributes in order to force the output block to look as much as possible like the input.
The only thing FME can't handle is the text reversal on the two mirrored blocks.
test_2.fmw
Hello @DaveAtSafe,
please, I have one addtional question about blocks (inserts). Does Your proposed solution work for writer in dynamic mode?
For better imagine - I have drawing with plenty of blocks and I wanna export these blocks to new drawing with keeping of all attributes and their values for each block from source drawing + I wanna add one my user defined attribute to every block. I thought that Dynamic mode on writer is solution with writing of my one user defined attribute, but it doesnt work :-(
I have many drawings which have block definitions that contain different attributes.
Could anybody help me please?
Thank You so much!
Lubo
Hello @DaveAtSafe,
please, I have one addtional question about blocks (inserts). Does Your proposed solution work for writer in dynamic mode?
For better imagine - I have drawing with plenty of blocks and I wanna export these blocks to new drawing with keeping of all attributes and their values for each block from source drawing + I wanna add one my user defined attribute to every block. I thought that Dynamic mode on writer is solution with writing of my one user defined attribute, but it doesnt work :-(
I have many drawings which have block definitions that contain different attributes.
Could anybody help me please?
Thank You so much!
Lubo
Hi @lazarlubomir,
The workspace is already set up to write back all the features to their appropriate layers, using the feature type fanout. Dynamic mode is more for attribute schemas for GIS or database formats. I am attaching a slightly modified version that will add the KKS attribute to all blocks.
test_3.fmw
Hi @lazarlubomir,
The workspace is already set up to write back all the features to their appropriate layers, using the feature type fanout. Dynamic mode is more for attribute schemas for GIS or database formats. I am attaching a slightly modified version that will add the KKS attribute to all blocks.
test_3.fmw
Hello @DaveAtSafe,
thank You, briliant solution! Probably my last question is, if there is possibility to keep the same number of attributes in output drawing as in source drawing?
I met problem that number of block attributes in source file is different than in output file from FME. I can demonstrate it here on pics below:
And drawing exported from FME with different number of attributes:
What I need is exported block has dynamically the same number of attributes as its source and also, I will add to this block one new (KKS) attribute.
I attached drawing, which can demostrate it.
P01300A&CLB002.zip
Thank You so much for ideas!
Lubo
Hi @lazarlubomir,
The workspace is already set up to write back all the features to their appropriate layers, using the feature type fanout. Dynamic mode is more for attribute schemas for GIS or database formats. I am attaching a slightly modified version that will add the KKS attribute to all blocks.
test_3.fmw
Hi @lazarlubomir,
I rethought the process, and switched to appending to the fme_attrib_info list. This also carries the block attribute information, and gives you more control over the block.
I had to scale the attribute size by 0.7 to get the text in the IN_INSTRUMENT_DCS blocks to be the right size and in the right location. Unfortunately, I had to resort to a PythonCaller, but this is often the best way to do complex operations on list attributes.
test_4.fmw
Hi @lazarlubomir,
I rethought the process, and switched to appending to the fme_attrib_info list. This also carries the block attribute information, and gives you more control over the block.
I had to scale the attribute size by 0.7 to get the text in the IN_INSTRUMENT_DCS blocks to be the right size and in the right location. Unfortunately, I had to resort to a PythonCaller, but this is often the best way to do complex operations on list attributes.
test_4.fmw
@DaveAtSafe,
perfect work! This is what I exactly need to solve! Thank You once again!
Lubo