On Mar 30, 2019, at 2:00 PM, roofto...@mac.com wrote:

> We are in the midst of analyzing a very old 4D application. We’d like to 
> print/plot/PDF a structure diagram, in all it’s glory, to hang on the wall.  
> It must represent all structure elements such as Tables, Fields, Relations, 
> Indexes, etc….  I have seen these diagrams for other platforms but I haven’t 
> been successful in extracting such from 4D.  
> 
> Way back in the day I could print a tiled version of the structure from the 
> Structure editor window but that print menu seems to be disabled (at least 
> for me) in current versions of 4D.  Ideally I would like to export the 
> database as xml or JASON and load it into another charting specific 
> application to manipulate and print.  I just need to find the proper 
> application (or 4D component/methods) that can consume the xml/JASON and 
> provide the needed diagrams.
> 
> An example of what I am hoping for can be found in the top image of Vanessa 
> Talbot’s 4D blog entry titled, “Detailed Analysis of Your Database Structure” 
>  Here is the link if it is allowed on the Nug: 
> "https://blog.4d.com/detailed-analysis-database-structure/“  Something, 
> clean, clear, and readable.
> 
> FYI: We are on 4D v16R5 at the moment.  Moving to v17 soon.
> 
> Any help is appreciated!

I’m not aware of anything that can do what you want. You may have to build it 
yourself. 

The structure export to XML provides the coordinates for each table, so you 
could process that with some programming and create an SVG with a bunch of 
boxes representing each table. Then you’d have to fill in all the fields inside 
each box. Not too difficult. The tricky part is drawing the relation lines. All 
the data is there, but drawing lines like you see in the structure window would 
be an interesting challenge. 

I decided to see what it took to create a printed copy of what you see in the 
structure editor. Like what you used to be able to do in previous version of 
4D. I got it done, but it’s a multistep brute-force approach. 

The structure file I was using for this test has all the tables laid out to not 
overlap. Related tables are near the one table so relation lines are readable 
and traceable. If your structure window is a fricking mess with tables piled 
upon each other and relation lines going all over the place, the method below 
will just print out your fricking mess. But if you have an organized structure 
window, here is how you can create a giant image file that you can print out in 
tiles. Grab scissors and glue stick and create your giant printout of your 
structure. 

In my example it resulted in 15 image files. The final, big .png image file was 
9,006 x 8,110 pixels and 13MB in size.  Then printed at 200% “Tile scale” it 
created 8 pages on 8.5" x 11” paper — 4 pages by 2 pages . 

Here are the notes I made to accomplish this:

- Set Structure window background to white
        - Right-click in open area and choose “Structure Properties”
        - Set “Fill Color” to white
- Capture images of structure
        - Open structure window and expand to as big as possible
        - Move to top left corner
        - Take horizontal band pictures
                - Take picture of window (⌘⇧4 then hold down space bar and 
click on structure window)
                - Click horizontal scrollbar in the right size “page” area to 
move over 1 full screen page to the right
                - Repeat until you have moved horizontal scrollbar all the way 
to the right and taken pictures each time
        - Move to top left corner again
        - Click vertical scrollbar to move 1 full screen down
        - Take horizontal band pictures (see above)
        - Repeat going down until you have taken pictures of all of the 
structure window
        - Doing it this way you have every image the exact same size. Makes it 
easier to de-tile them and create a single, big image.
- Crop images to remove window frame
        - Should be able to create Automator to do this with Acorn, but 
couldn’t get it to work
        - I used BatchCrop to do the work
                - x = 0, y = 67, width = 4063, height = 1961
        - Need to special crop all images in the final column at the right so 
the match previous column
        - Need to special crop all images in the final row so they match 
previous row
- Combine images into a single big image with 4D method

        C_TEXT($folderPath_t;$fileName_t)
        ARRAY TEXT($fileName_at;0)
        C_LONGINT($index;$i;$j;$imagesPerRow_l;$numRows_l)
        C_PICTURE($emptyImage_c;$rowImage_c;$finalImage_c)
        
        $numRows_l:=5
        $imagesPerRow_l:=3
        
          // folder of structure images
        $folderPath_t:=System folder(Desktop)+"cropped"+Folder separator
        
          // load files names in folder
        DOCUMENT LIST($folderPath_t;$fileName_at;Ignore invisible)
        
          // sort by name
        SORT ARRAY($fileName_at;>)
        
          // create a single big image
          // process rows
        For ($i;1;$numRows_l)
                  // init row image
                $rowImage_c:=$emptyImage_c
                  // process images in the row
                For ($j;1;$imagesPerRow_l)
                          // set file name array index
                        $index:=$index+1
                          // get file name
                        $fileName_t:=$fileName_at{$index}
                          // load image
                        READ PICTURE FILE($folderPath_t+$fileName_t;$image_c)
                          // add image to row image
                        COMBINE PICTURES($rowImage_c;$rowImage_c;Horizontal 
concatenation;$image_c)
                End for 
                
                  // add row image to final image
                COMBINE PICTURES($finalImage_c;$finalImage_c;Vertical 
concatenation;$rowImage_c)
        End for 
        
          // write new picture to file
        WRITE PICTURE FILE($folderPath_t+"Big Picture.png";$finalImage_c)

- Open in Preview and Export to PDF
- Open PDF in Acrobat Reader
        - Select Print
        - Click on “Poster” in “Page Size & Handling”
        - Set “Tile Scale” to a value that give you the size you want (maybe 
200% or 300% for big structures)
                - Look at the preview area to the right and it shows how many 
pages it will take to print
        - Turn on “Cut marks” and “Labels” to help you arrange all the pages
        - Print

Tim

*****************************************
Tim Nevels
Innovative Solutions
785-749-3444
timnev...@mac.com
*****************************************

**********************************************************************
4D Internet Users Group (4D iNUG)
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to