How can I use @FitDGN factory function to fit the view of dgn files to the content. The DGN file is also created using FME from an oracle spatial database.
Is it possible to call it at the shutdown script using python.
How can I use @FitDGN factory function to fit the view of dgn files to the content. The DGN file is also created using FME from an oracle spatial database.
Is it possible to call it at the shutdown script using python.
Hi @cnav, I don't know how the @FitDGN function should work, but the syntax is described in this documentation.
FME Factory and Function Documentation | Functions | @FitDGN
You can call an FME function via the Python fmeobjects.FMEFeature.performFunction method. e.g.
# Shutdown Python Script Example: Perform @FitDGN Function
# Assume that the value of a user parameter called "DestDataset_IGDS"
# is an existing DGN (Bentley MicroStation Design V7) file path.
import fme, fmeobjects
fitDGNÂ =Â '@FitDGN(%s,MASTER,0)'Â %Â fme.macroValues 'DestDataset_IGDS']
if fme.status:
    xmin, ymin, xmax, ymax = 0.0, 0.0, 100.0, 100.0
    feature = fmeobjects.FMEFeature()
    feature.addCoordinates(Â(xmin, ymin), (xmax, ymax)])
    feature.performFunction(fitDGN)
Alternatively, you can also use the FMEFunctionCaller transformer to perform the function without writing a script, if you write the DGN file with the FeatureWriter. e.g.Â
Hi @cnav, I don't know how the @FitDGN function should work, but the syntax is described in this documentation.
FME Factory and Function Documentation | Functions | @FitDGN
You can call an FME function via the Python fmeobjects.FMEFeature.performFunction method. e.g.
# Shutdown Python Script Example: Perform @FitDGN Function
# Assume that the value of a user parameter called "DestDataset_IGDS"
# is an existing DGN (Bentley MicroStation Design V7) file path.
import fme, fmeobjects
fitDGNÂ =Â '@FitDGN(%s,MASTER,0)'Â %Â fme.macroValues 'DestDataset_IGDS']
if fme.status:
    xmin, ymin, xmax, ymax = 0.0, 0.0, 100.0, 100.0
    feature = fmeobjects.FMEFeature()
    feature.addCoordinates(Â(xmin, ymin), (xmax, ymax)])
    feature.performFunction(fitDGN)
Alternatively, you can also use the FMEFunctionCaller transformer to perform the function without writing a script, if you write the DGN file with the FeatureWriter. e.g.Â
Hi @takashi I have tried the script as suggested, received the following error.I wonder if this function is for v7 or v8. I am sending output as V8 DGN file? I have checked the output file it contains data as expected and reads properly in Microstation v8 XM edition. Only issue is data is zoomed out to a different location. So a user who opens the file will see black screen instead of the content.
Â
FME_END_PYTHON: evaluating python script from string...
@FitDGN: Bounding box of feature after shrinkage is: (363000,2673000),(364000,2673500)
IGDS Coordinate Information:
0 UORs per ` ' and 0 ` ' per ` '
Global origin X: -1.70141183460469e+038 Y: -1.70141183460469e+038 Z: -1.70141183460469e+038
One FME Feature coordinate unit is equal to 0 UORs (Master Units used)
Unable to read element in design file `c:\\temp\\ora2dgn\\B29C.9Q' -- ensure file has not be truncated
A fatal error has occurred. Check the logfile above for details
Error executing string `import fme,fmeobjects
fitDGN="@FitDGN(%s,MASTER,0)" % fme.macroValuess'OutputDGN']
if fme.status:
xmin = float(fme.macroValuess'X1'])
ymin = float(fme.macroValuess'Y1'])
xmax = float(fme.macroValuess'X2'])
ymax = float(fme.macroValuess'Y2'])
feature=fmeobjects.FMEFeature()
feature.addCoordinates(((xmin,ymin),(xmax,ymax)])
feature.performFunction(fitDGN)
'
FME_END_PYTHON failed to execute provided script
FME_END_PYTHON failure
Program Terminating
Hi @takashi I have tried the script as suggested, received the following error.I wonder if this function is for v7 or v8. I am sending output as V8 DGN file? I have checked the output file it contains data as expected and reads properly in Microstation v8 XM edition. Only issue is data is zoomed out to a different location. So a user who opens the file will see black screen instead of the content.
Â
FME_END_PYTHON: evaluating python script from string...
@FitDGN: Bounding box of feature after shrinkage is: (363000,2673000),(364000,2673500)
IGDS Coordinate Information:
0 UORs per ` ' and 0 ` ' per ` '
Global origin X: -1.70141183460469e+038 Y: -1.70141183460469e+038 Z: -1.70141183460469e+038
One FME Feature coordinate unit is equal to 0 UORs (Master Units used)
Unable to read element in design file `c:\\temp\\ora2dgn\\B29C.9Q' -- ensure file has not be truncated
A fatal error has occurred. Check the logfile above for details
Error executing string `import fme,fmeobjects
fitDGN="@FitDGN(%s,MASTER,0)" % fme.macroValuess'OutputDGN']
if fme.status:
xmin = float(fme.macroValuess'X1'])
ymin = float(fme.macroValuess'Y1'])
xmax = float(fme.macroValuess'X2'])
ymax = float(fme.macroValuess'Y2'])
feature=fmeobjects.FMEFeature()
feature.addCoordinates(((xmin,ymin),(xmax,ymax)])
feature.performFunction(fitDGN)
'
FME_END_PYTHON failed to execute provided script
FME_END_PYTHON failure
Program Terminating
Â