What transformer would I use to query an AutoCAD file's paperspace properties (specifically the MVIEW viewport's WCS xy center point, the viewport height and width, and the custom scale)? I don't need any of the graphics features per se, just the viewport information to construct a minimum bounding polygon for the plot-displayable "meat" of the drawing file?
Hi @rudystricklan1,
The AutoCAD readers have the option to read the paper space information from the DWG file:
If you choose to read the paper space layout information, the reader will produce features with an autocad_entity of autocad_viewport. The geometry of the viewport is in paper space units, but it does have the attributes:
autocad_viewport_view_center_x
autocad_viewport_view_center_y
autocad_viewport_custom_scale
autocad_viewport_height
autocad_viewport_width
The view center values are in model space units, while the height and width are in paper space units. The custom scale maps between the two, once unit conversion is taken into account.
Thanks, @DaveAtSafe. That is the route that I eventually stumbled upon. I pulled the modelspace height parameters, however, from the autocad_viewport_view_height parameter-- interesting that there's not an equivalent modelspace units parameter for the width.
I've sucked enough free advice from several users besides just you in helping through this issue. Time to give back. Is there a forum category for FME-QGIS use? I'd be glad to share the Python processing modules that I've developed that read fmw's and create graphics layers in QGIS.
Again, thanks mucho.
Thanks, @DaveAtSafe. That is the route that I eventually stumbled upon. I pulled the modelspace height parameters, however, from the autocad_viewport_view_height parameter-- interesting that there's not an equivalent modelspace units parameter for the width.
I've sucked enough free advice from several users besides just you in helping through this issue. Time to give back. Is there a forum category for FME-QGIS use? I'd be glad to share the Python processing modules that I've developed that read fmw's and create graphics layers in QGIS.
Again, thanks mucho.
We don't have a forum for that, and non-Safers aren't allowed to create articles yet. However, you could post it as a question that you then answer, ie 'Are there any QGIS modules that use FME?' or similar. I will accept the answer, then it will show up anytime someone searches the Knowledge base for QGIS.
We do this ourselves quite a bit, but as the FME_Lizard, when we want to share info that is too small for an article.
Hello @daveatsafe, how do you work out the units used in both paperspace and model space? And how do you work out unit conversion?
Hello @daveatsafe, how do you work out the units used in both paperspace and model space? And how do you work out unit conversion?
Hi @deanhowell,
The conversion factor is described in the following article on layouts: https://knowledge.safe.com/articles/34345/working-with-autocad-layouts.html
However, this assumes that you know what both the paper and model units are. If the unit type is set on the DWG file, you can extract this info by enabling Parameters - Advanced - Read Drawing System Variables. This will produce an autocad_info feature on layer 0 when reading, which will have the attribute autocad_isunits set to the DWG file unit (INCH, FEET, etc.).
I think the paper space units are always inches, based on Page Setup settings always having Plot Scale set to a conversion factor based on inches. However, I may well be wrong on this.
Hi @deanhowell,
The conversion factor is described in the following article on layouts: https://knowledge.safe.com/articles/34345/working-with-autocad-layouts.html
However, this assumes that you know what both the paper and model units are. If the unit type is set on the DWG file, you can extract this info by enabling Parameters - Advanced - Read Drawing System Variables. This will produce an autocad_info feature on layer 0 when reading, which will have the attribute autocad_isunits set to the DWG file unit (INCH, FEET, etc.).
I think the paper space units are always inches, based on Page Setup settings always having Plot Scale set to a conversion factor based on inches. However, I may well be wrong on this.
Hi @daveatsafe, I think paper space units can be millimeters too (setting in page setup).
Logically, the paper space units will follow the model space (imperial vs metric). but to be able to check this, it would be useful if paper space units could also be traced by the dwgreader. As far as I know or found out this isn't possible now?
edit: also pixels is an option if i understand well, by 'plotting' as tiff for example
Hi @deanhowell,
The conversion factor is described in the following article on layouts: https://knowledge.safe.com/articles/34345/working-with-autocad-layouts.html
However, this assumes that you know what both the paper and model units are. If the unit type is set on the DWG file, you can extract this info by enabling Parameters - Advanced - Read Drawing System Variables. This will produce an autocad_info feature on layer 0 when reading, which will have the attribute autocad_isunits set to the DWG file unit (INCH, FEET, etc.).
I think the paper space units are always inches, based on Page Setup settings always having Plot Scale set to a conversion factor based on inches. However, I may well be wrong on this.
Thanks @daveatsafe, that is terrific. I will investigate further to use the information suggested.
Hi @daveatsafe, I think paper space units can be millimeters too (setting in page setup).
Logically, the paper space units will follow the model space (imperial vs metric). but to be able to check this, it would be useful if paper space units could also be traced by the dwgreader. As far as I know or found out this isn't possible now?
edit: also pixels is an option if i understand well, by 'plotting' as tiff for example