[solved] TechDraw exported svg has no dimensions

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
muzihuoyubai
Posts: 4
Joined: Wed Aug 17, 2022 12:21 pm

[solved] TechDraw exported svg has no dimensions

Post by muzihuoyubai »

After using TechDraw to generate dimensions, the svg exported using the python script has no dimensions information.
But using GUI to export svg can have dimensions information. How to use script in console mode without running freecad GUI to export svg the same as GUI exported svg ?

Code: Select all

TechDraw.viewPartAsSvg(App.activeDocument().View)
The output contains only shape information as below

Code: Select all

'<g fill="none" stroke="#000000" stroke-opacity="1" stroke-width="0.7" stroke-linecap="butt" stroke-linejoin="miter" stroke-miterlimit="4">\n<path id= "1" d=" M 190.5 78.5772 L -190.5 78.5772 " />\n<path id= "2" d=" M 190.5 -70.7991 L -190.5 -70.7991 " />\n<path id= "3" d=" M 190.5 78.5772 L 190.5 -70.7991 " />\n<path id= "4" d=" M -190.5 78.5772 L -190.5 -70.7991 " />\n<path id= "5" d=" M 190.5 -78.5772 L -190.5 -78.5772 " />\n<path id= "6" d=" M 190.5 -78.5772 L 190.5 -70.7991 " />\n<path id= "7" d=" M -190.5 -78.5772 L -190.5 -70.7991 " />\n</g>\n'
Image

Code: Select all

OS: Windows 10 Version 2009
Word size of FreeCAD: 64-bit
Version: 0.20.29177 (Git)
Build type: Release
Branch: releases/FreeCAD-0-20
Hash: 68e337670e227889217652ddac593c93b5e8dc94
Python 3.8.10, Qt 5.15.2, Coin 4.0.1, Vtk 8.2.0, OCC 7.6.2
Locale: Chinese/China (zh_CN)
Attachments
test.FCStd
(16.24 KiB) Downloaded 8 times
Last edited by muzihuoyubai on Sun Aug 21, 2022 2:28 am, edited 2 times in total.
User avatar
wandererfan
Veteran
Posts: 6265
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: TechDraw exported svg has no dimensions

Post by wandererfan »

muzihuoyubai wrote: Wed Aug 17, 2022 12:46 pm After using TechDraw to generate dimensions, the svg exported using the python script has no dimensions information.
That method only exports the geometry of the view.

Dimensions are only drawn in the Gui. Only limited information about Dimensions is available on the App side.
muzihuoyubai
Posts: 4
Joined: Wed Aug 17, 2022 12:21 pm

Re: TechDraw exported svg has no dimensions

Post by muzihuoyubai »

Thanks for your reply. From your experience, Is there any way to export a projection view with demissions without running App GUI?
User avatar
wandererfan
Veteran
Posts: 6265
Joined: Tue Nov 06, 2012 5:42 pm
Contact:

Re: TechDraw exported svg has no dimensions

Post by wandererfan »

muzihuoyubai wrote: Thu Aug 18, 2022 12:41 am Thanks for your reply. From your experience, Is there any way to export a projection view with demissions without running App GUI?
Not in the current implementation. It is possible to draw the graphics without displaying them in the Gui, but that will require a number of changes.
muzihuoyubai
Posts: 4
Joined: Wed Aug 17, 2022 12:21 pm

Re: TechDraw exported svg has no dimensions

Post by muzihuoyubai »

Got it, thanks a lot for your help
muzihuoyubai
Posts: 4
Joined: Wed Aug 17, 2022 12:21 pm

Re: TechDraw exported svg has no dimensions

Post by muzihuoyubai »

wandererfan wrote: Thu Aug 18, 2022 2:13 pm
muzihuoyubai wrote: Thu Aug 18, 2022 12:41 am Thanks for your reply. From your experience, Is there any way to export a projection view with demissions without running App GUI?
Not in the current implementation. It is possible to draw the graphics without displaying them in the Gui, but that will require a number of changes.
Got it, thanks a lot for your help
Post Reply