Mittwoch, 24. Mai 2017

Map Industry Model Plot Extension

If you use Map Industry Model Plot Extension make sure that the layers in your main display model do not contain a spatial filter. A spatial filter is automatically created when you save a display model. In order to remove the spatial filter you need to open the .layer file in an editor and remove the filter setting:

<Filter>GEOM ENVELOPEINTERSECTS GeomFromText('POLYGON XYZ ((698785 258855 0, 700411 258855 0, 700411 260393 0, 698785 260393 0, 698785 258855 0))')</Filter>



It seems that Map applies the filter from the layer file when generating a Map plot. If the spatial filter does not match with the area you want to create a plot for the layer content will not be shown.

Map 2017, Sp1

Donnerstag, 4. Mai 2017

simple web site for converting drawing file into 3d pdf using FME

Once in while our CIVIL users want to convert a drawing file into a 3d PDF file. As they are not familiar with FME and dont have access to it anyway I set up a web page where a drawing file can be uploaded and gets converted to a 3d PDF. FME 32bit is installed on the server just for this purpose.

The website consists of two frames. The first frame allows to upload the drawing file, the second frame just lists the contents of the folder on the server where the PDF file gets stored.

Here is the PHP code for the upload. After uploading it triggers the execution of a BATCH file (see below) which starts the FME workbench. The workbench is a simple ACAD drawing reader connected to an 3d PDF writer. Everything is kept very simple.

 //refresh download frame in order to list newly created PDF file  
 <h1>DWG zu 3D PDF</h1>  
 <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="post" enctype="multipart/form-data">  
   DWG ausw&auml;hlen:  
   <input type="file" name="uploaded" id="fileToUpload"><br><br>  
      DWG hochladen:  
   <input type="submit" value="DWG hochladen" name="submit">  
 Nach dem Hochladen kann es einige Zeit dauern, bis die DWG konvertiert wurde. Bitte warten, bis eine Meldung erscheint.<br><br>  
 Im unteren Fenster sollte nach erfolgreicher Erstellung der PDF diese zum Download aufgelistet sein - falls nicht die gesamte Webseite aktualisieren.  
 <br><b>PDF bitte herunterladen (rechte Maustaste >> "Link speichern unter") - im Webbrowser werden keine 3d PDFs angezeigt.</b>  
 // PHP.INI  
 // upload_max_filesize = 20M  
 // --> if files are too big variables such as $_FILES['uploaded']['name'] and others are empty  
 // max_execution_time = 90  
 // FastCGI PHP in IIS execution time set to 90 secs  
 // Upload folder : set permissions  
 if ($_POST['submit'] == '') die();       
 $target = "E:/www_fme_3dpdf_batch/uploads/";   
 $target = $target . basename( $_FILES['uploaded']['name']) ;   
 if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))  
      //sending message to browser - doesnt work with IIS it seems :-(  
      echo "<br><br>Datei <b>'". basename( $_FILES['uploaded']['name']). "'</b> hochgeladen.";   
      echo "<br><br>Dateikonvertierung gestartet....<br><br>";        
      echo "<small><pre>";  
      system("cmd /c E:/www_fme_3dpdf_batch/run_fme_acad2pdf.bat 2>&1", $output);  
      echo "</small></pre>";  
      echo "Problem aufgetreten. Datei nicht hochgeladen.";   

The batch file content:

 SET SOURCE="E:\www_fme_3dpdf_batch\uploads"  
 SET OUTPUT="E:\www_fme_3dpdf_batch\downloads"  
 DEL /Q %OUTPUT%\*.*  
 FOR %%F IN ("%SOURCE%\*.dwg") DO (    
     C:\apps\FME32\fme.exe acad2pdf.fmw --SourceDataset_ACAD "%%F"^  
                --DestDataset_PDF "%OUTPUT%\%%~nF.pdf"^  
                --LOG_FILE "%OUTPUT%\%%~nF_load.log"  
 DEL /Q %SOURCE%\*.*