A360 Viewer Problems¶
AutoDesk web service A360 seems to be more picky than the AutoCAD desktop applications, may be it helps to use the latest DXF version supported by ezdxf, which is DXF R2018 (AC1032) in the year of writing this lines (2018).
DXF Entities Are Not Displayed in the Viewer¶
ezdxf does not automatically locate the main viewport of the modelspace at the entities, you have to perform the “Zoom to Extends” command, here in TrueView 2020:
And here in the Autodesk Online Viewer:
Add this line to your code to relocate the main viewport, adjust the center (in modelspace coordinates) and the height (in drawing units) arguments to your needs:
doc.set_modelspace_vport(height=10, center=(0, 0))
Show IMAGES/XREFS on Loading in AutoCAD¶
If you are adding XREFS and IMAGES with relative paths to existing drawings and they do not show up in AutoCAD
immediately, change the HEADER variable
$PROJECTNAME='' to (not really) solve this problem.
The ezdxf templates for DXF R2004 and later have
$PROJECTNAME='' as default value.
Thanks to David Booth:
If the filename in the IMAGEDEF contains the full path (absolute in AutoCAD) then it shows on loading, otherwise it won’t display (reports as unreadable) until you manually reload using XREF manager.
A workaround (to show IMAGES on loading) appears to be to save the full file path in the DXF or save it as a DWG.
So far - no solution for showing IMAGES with relative paths on loading.
Set Initial View/Zoom for the Modelspace¶
See section “General Document”: Set Initial View/Zoom for the Modelspace
Show Lineweights in DXF Viewers¶
By default lines and curves are shown without lineweights in DXF viewers. By setting the header variable $LWDISPLAY to 1 the DXF viewer should display lineweights, if supported by the viewer.
doc.header["$LWDISPLAY"] = 1