span8
span4
span8
span4
The two most popular CAD formats,Microstation DGN and AutoCAD DWG,have their symbology defined by a large number of format attributes.It can be very time consuming to create database table fields to store all of these attributes,but most are required in order to recreate the data's appearance when writing back to CAD.As well,FME continues to add format attributes as it increases it CAD capabilities,so the table may need occasional updates.
An alternative to individual fields for each format attribute is to pack all the attributes into a single blob field,which would be unpacked when the features are written back to CAD.
The FME function @SupplyAttributes (accessible through the FunctionCaller transformer) has a mode that will pack all of the feature's attributes into a single new attribute in the structure name:value:name:value:name:value:etc.@SupplyAttributes can also unpack this packed attribute back to the original attributes.However,when packing,@SupplyAttributes packs all of the attributes,including those that are not required or desired.
The custom transformer PackAttributes (available for download above,or through the FME Store) uses a PythonCaller to pack the features attributes into the @SupplyAttributes structure,but allows you to set a filter prefix for the attributes to be packed.So to store all of the DGN file's format attributes,but ignore any user or generic FME attributes,you can set the filter to "igds_".For DWG files,you can use "acad_" instead.
The workspaces DGNToSqlite and SqliteToDGN (available for download above) illustrate how to implement this process:
DGNToSqlite reads the Microstation DGN file MajorRoads.dgn (also available for download above),uses PackAttributes to pack the format attributes into a new attribute "igds_packed",then writes the geometry and the packed attribute to Sqlite Spatial.
SqliteToDGN reads the Sqlite table,uses @SupplyAttributes in a FunctionCaller to restore the packed attributes back on to the feature,then writes out to a new DGN file.
All of the symbology from MajorRoads.DGN,including multi-lines and custom linestyles,is restored in the new file.
This method of storing CAD attributes is future-proofed.Any additional format attributes added in future versions of FME will be automatically included in the packed attribute due to the format prefix,and no table modifications will be necessary.
If you will be editing the location of CAD data while it is stored in the database,you will need to remove any locational attributes from the packed attribute and store them in separate fields.The easiest way to do this is to rename the attributes to remove the common filter prefix before packing.
How do I convert curved text from Geodatabase to Microstation DGN?
MicroStation Text Styles in FME 2015.1 and newer
MicroStation Cells to AutoCAD Blocks
Reading Basic Geodatabase Annotation - GDB to DGN
MicroStation Text Styles in FME 2015.0 and older
Performing spatial queries on database tables using the FeatureReader
Reading Basic Geodatabase Annotation - GDB to DWG
How to Convert DWG to DGN (AutoCAD to Microstation)
© 2019 亚搏在线Safe Software Inc |法律