Forum

Author Topic: Export Model to PDF  (Read 7189 times)

tforward2

  • Newbie
  • *
  • Posts: 17
    • View Profile
Export Model to PDF
« on: October 21, 2014, 01:15:42 AM »
I have the following code:

It creates a pdf yet it is blank but the file size is correct. If I manually run Export model from within the GUI it works fine.

Code: [Select]
def export_mesh_to_pdf(path, local_crs):
print ("\nExporting Mesh to PDF...\n")
result = doc.activeChunk.model.save(path, precision=6, texture_format='jpg', texture=True, normals=True, colors=True, cameras=True, projection=local_crs, format='pdf')
return result

whereby:
Code: [Select]
path = r"C:\Temp\test.pdf"

local_crs = local_crs.init('LOCAL_CS["Local CS",LOCAL_DATUM["Local Datum",0],UNIT["metre",1]]')

I've also tried using
Code: [Select]
crs.init("EPSG::4326") #WGS84 but with no luck.

Any suggestions?

+===========================================================================
[EDIT] - UPDATE

Using the shoe sample data, found here: http://www.agisoft.com/datasets/coded.zip

I was able to get a PDF to export using the Local_Crs. Only problem is that when I open the PDF the image is just a few pixels in size and I have to scroll-in to get the whole image in view. Again if I export the model using the GUI it works fine and preserves the current viewport. The image is in view when opened and no scrolling necessary. What I'm I missing?

This is the code about the viewpoint seems to have no affect on the exported PDF however.

Code: [Select]
viewpoint = PhotoScan.app.viewpoint

#center of the camera position
viewpoint.coo = PhotoScan.Vector([0.45886683543299805, -0.041361666212623126, 0.25853091993682015])
#3x3 rotational matrix
viewpoint.rot = PhotoScan.Matrix([[0.7757972110803226, 0.6180049790892628, 0.12731273738661547],
       [-0.5137108833332823, 0.7357805528203659, -0.441280077089705],
       [-0.36638752110972944, 0.27694191432904625, 0.8882923845574897]])
#magnitude
viewpoint.mag = 1613.0
#field of view (in degrees)
viewpoint.fov = 30.0


Thanks
« Last Edit: October 21, 2014, 06:27:33 PM by tforward2 »