Add Export Page as Dxf to TD Gui
This commit is contained in:
@@ -1033,7 +1033,7 @@ bool CmdTechDrawSpreadsheet::isActive(void)
|
||||
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_ExportPage
|
||||
// TechDraw_ExportPage (Svg)
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawExportPage);
|
||||
@@ -1076,6 +1076,57 @@ bool CmdTechDrawExportPage::isActive(void)
|
||||
return DrawGuiUtil::needPage(this);
|
||||
}
|
||||
|
||||
//===========================================================================
|
||||
// TechDraw_ExportPage (Dxf)
|
||||
//===========================================================================
|
||||
|
||||
DEF_STD_CMD_A(CmdTechDrawExportPageDxf);
|
||||
|
||||
CmdTechDrawExportPageDxf::CmdTechDrawExportPageDxf()
|
||||
: Command("TechDraw_ExportPageDxf")
|
||||
{
|
||||
sGroup = QT_TR_NOOP("File");
|
||||
sMenuText = QT_TR_NOOP("Export page as DXF");
|
||||
sToolTipText = QT_TR_NOOP("Export a page to a DXF file");
|
||||
sWhatsThis = "TechDraw_SaveDXF";
|
||||
sStatusTip = sToolTipText;
|
||||
sPixmap = "actions/techdraw-saveDXF";
|
||||
}
|
||||
|
||||
void CmdTechDrawExportPageDxf::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
TechDraw::DrawPage* page = DrawGuiUtil::findPage(this);
|
||||
if (!page) {
|
||||
return;
|
||||
}
|
||||
|
||||
//WF? allow more than one TD Page per Dxf file?? 1 TD page = 1 DXF file = 1 drawing?
|
||||
QString defaultDir;
|
||||
QString fileName = Gui::FileDialog::getSaveFileName(Gui::getMainWindow(),
|
||||
QString::fromUtf8(QT_TR_NOOP("Save Dxf File ")),
|
||||
defaultDir,
|
||||
QString::fromUtf8(QT_TR_NOOP("Dxf (*.dxf)")));
|
||||
|
||||
if (fileName.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
std::string PageName = page->getNameInDocument();
|
||||
openCommand("Save page to dxf");
|
||||
doCommand(Doc,"import TechDraw");
|
||||
doCommand(Doc,"TechDraw.writeDXFPage(App.activeDocument().%s,u\"%s\")",PageName.c_str(),(const char*)fileName.toUtf8());
|
||||
updateActive();
|
||||
commitCommand();
|
||||
}
|
||||
|
||||
|
||||
bool CmdTechDrawExportPageDxf::isActive(void)
|
||||
{
|
||||
return DrawGuiUtil::needPage(this);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void CreateTechDrawCommands(void)
|
||||
{
|
||||
@@ -1094,6 +1145,7 @@ void CreateTechDrawCommands(void)
|
||||
rcCmdMgr.addCommand(new CmdTechDrawClipMinus());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawSymbol());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawExportPage());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawExportPageDxf());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawDraftView());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawArchView());
|
||||
rcCmdMgr.addCommand(new CmdTechDrawSpreadsheet());
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
<file>icons/actions/techdraw-draft-view.svg</file>
|
||||
<file>icons/actions/techdraw-arch-view.svg</file>
|
||||
<file>icons/actions/techdraw-saveSVG.svg</file>
|
||||
<file>icons/actions/techdraw-saveDXF.svg</file>
|
||||
<file>icons/actions/techdraw-viewsection.svg</file>
|
||||
<file>icons/actions/techdraw-hatch.svg</file>
|
||||
<file>icons/actions/techdraw-geomhatch.svg</file>
|
||||
|
||||
@@ -0,0 +1,349 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
id="svg2160"
|
||||
height="64"
|
||||
width="64"
|
||||
version="1.0">
|
||||
<metadata
|
||||
id="metadata8">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
<dc:creator>
|
||||
<cc:Agent>
|
||||
<dc:title>[WandererFan]</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:creator>
|
||||
<dc:title>techdraw-symbol</dc:title>
|
||||
<dc:date>2016-01-14</dc:date>
|
||||
<dc:relation>http://www.freecadweb.org/wiki/index.php?title=Artwork</dc:relation>
|
||||
<dc:publisher>
|
||||
<cc:Agent>
|
||||
<dc:title>FreeCAD</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:publisher>
|
||||
<dc:identifier>FreeCAD/src/Mod/TechDraw/Gui/Resources/icons/actions/techdraw-symbol.svg</dc:identifier>
|
||||
<dc:rights>
|
||||
<cc:Agent>
|
||||
<dc:title>FreeCAD LGPL2+</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:rights>
|
||||
<cc:license>https://www.gnu.org/copyleft/lesser.html</cc:license>
|
||||
<dc:contributor>
|
||||
<cc:Agent>
|
||||
<dc:title>[agryson] Alexander Gryson</dc:title>
|
||||
</cc:Agent>
|
||||
</dc:contributor>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs2162">
|
||||
<linearGradient
|
||||
id="linearGradient3900">
|
||||
<stop
|
||||
id="stop3902"
|
||||
offset="0"
|
||||
style="stop-color:#d3d7cf;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop3904"
|
||||
offset="1"
|
||||
style="stop-color:#ffffff;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient3775">
|
||||
<stop
|
||||
id="stop3777"
|
||||
offset="0"
|
||||
style="stop-color:#d3d7cf;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop3779"
|
||||
offset="1"
|
||||
style="stop-color:#ffffff;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
gradientTransform="translate(-64,3.8146973e-6)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
y2="25.999996"
|
||||
x2="53"
|
||||
y1="39.999996"
|
||||
x1="10"
|
||||
id="linearGradient3781"
|
||||
xlink:href="#linearGradient3775" />
|
||||
<linearGradient
|
||||
y2="32.273422"
|
||||
x2="61.526257"
|
||||
y1="35.470131"
|
||||
x1="22.62105"
|
||||
gradientTransform="matrix(1.4500001,0,0,1.4705882,-27.45,-15.05882)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient3012"
|
||||
xlink:href="#linearGradient3806" />
|
||||
<linearGradient
|
||||
id="linearGradient3895">
|
||||
<stop
|
||||
style="stop-color:#729fcf;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3897" />
|
||||
<stop
|
||||
style="stop-color:#204a87;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3899" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
gradientTransform="matrix(0,-1.4500001,1.4705882,0,-15.05882,91.45)"
|
||||
y2="36.079998"
|
||||
x2="21.689653"
|
||||
y1="29.279999"
|
||||
x1="56.172409"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient3036"
|
||||
xlink:href="#linearGradient3895" />
|
||||
<linearGradient
|
||||
id="linearGradient3253-6-5">
|
||||
<stop
|
||||
style="stop-color:#89d5f8;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3255-8-4" />
|
||||
<stop
|
||||
style="stop-color:#00899e;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3257-7-9" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient3253-6-5"
|
||||
id="radialGradient3270-0-1"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1.2166851,1.0433407,-0.52714011,0.61472119,-73.012055,-80.803852)"
|
||||
cx="83.590195"
|
||||
cy="32.60199"
|
||||
fx="83.590195"
|
||||
fy="32.60199"
|
||||
r="27.986706" />
|
||||
<radialGradient
|
||||
r="27.986706"
|
||||
fy="25.129232"
|
||||
fx="10.328116"
|
||||
cy="25.129232"
|
||||
cx="10.328116"
|
||||
gradientTransform="matrix(0.9781457,0.0053484,-0.00460223,0.8416912,-2.1599239,-18.716253)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="radialGradient3337"
|
||||
xlink:href="#linearGradient3253-6" />
|
||||
<linearGradient
|
||||
id="linearGradient3253-6">
|
||||
<stop
|
||||
style="stop-color:#89d5f8;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3255-8" />
|
||||
<stop
|
||||
style="stop-color:#00899e;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3257-7" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient3253"
|
||||
id="radialGradient3293"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.9781457,0.0053484,-0.00460223,0.8416912,-69.025653,-0.11788499)"
|
||||
cx="10.328116"
|
||||
cy="25.129232"
|
||||
fx="10.328116"
|
||||
fy="25.129232"
|
||||
r="27.986705" />
|
||||
<linearGradient
|
||||
y2="1726.0585"
|
||||
x2="2067.1702"
|
||||
y1="1726.0585"
|
||||
x1="1669.7314"
|
||||
gradientTransform="matrix(0.9135837,0,0,0.9135837,138.63723,130.60625)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
id="linearGradient3270"
|
||||
xlink:href="#linearGradient3393" />
|
||||
<linearGradient
|
||||
id="linearGradient3393">
|
||||
<stop
|
||||
style="stop-color:#003ddd;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3395" />
|
||||
<stop
|
||||
style="stop-color:#639ef0;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3397" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
xlink:href="#linearGradient3393"
|
||||
id="linearGradient3399"
|
||||
x1="1669.7314"
|
||||
y1="1726.0585"
|
||||
x2="2067.1702"
|
||||
y2="1726.0585"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.9135837,0,0,0.9135837,138.63723,130.60625)" />
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient6816"
|
||||
id="radialGradient6822"
|
||||
cx="33.369828"
|
||||
cy="51.929391"
|
||||
fx="33.369828"
|
||||
fy="51.929391"
|
||||
r="25.198714"
|
||||
gradientTransform="matrix(1.1581633,0,0,0.6558985,-7.29237,16.126077)"
|
||||
gradientUnits="userSpaceOnUse" />
|
||||
<linearGradient
|
||||
id="linearGradient6781">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop6783" />
|
||||
<stop
|
||||
style="stop-color:#3465a4;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop6785" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient6816">
|
||||
<stop
|
||||
style="stop-color:#000000;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop6818" />
|
||||
<stop
|
||||
style="stop-color:#000000;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop6820" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
xlink:href="#linearGradient3253"
|
||||
id="radialGradient3270"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(0.9781457,0.0053484,-0.00460223,0.8416912,-69.025653,-0.11788499)"
|
||||
cx="10.328116"
|
||||
cy="25.129232"
|
||||
fx="10.328116"
|
||||
fy="25.129232"
|
||||
r="27.986705" />
|
||||
<linearGradient
|
||||
id="linearGradient3253">
|
||||
<stop
|
||||
style="stop-color:#89d5f8;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3255" />
|
||||
<stop
|
||||
style="stop-color:#00899e;stop-opacity:1;"
|
||||
offset="1"
|
||||
id="stop3257" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
id="linearGradient3806">
|
||||
<stop
|
||||
id="stop3808"
|
||||
offset="0"
|
||||
style="stop-color:#ef2929;stop-opacity:1" />
|
||||
<stop
|
||||
id="stop3810"
|
||||
offset="1"
|
||||
style="stop-color:#a40000;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
gradientTransform="translate(-64,3.7403954e-6)"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
y2="25.999996"
|
||||
x2="53"
|
||||
y1="39.999996"
|
||||
x1="10"
|
||||
id="linearGradient3781-3"
|
||||
xlink:href="#linearGradient3775-6" />
|
||||
<linearGradient
|
||||
id="linearGradient3775-6">
|
||||
<stop
|
||||
id="stop3777-7"
|
||||
offset="0"
|
||||
style="stop-color:#d3d7cf;stop-opacity:1;" />
|
||||
<stop
|
||||
id="stop3779-5"
|
||||
offset="1"
|
||||
style="stop-color:#ffffff;stop-opacity:1" />
|
||||
</linearGradient>
|
||||
<linearGradient
|
||||
gradientUnits="userSpaceOnUse"
|
||||
y2="19"
|
||||
x2="15"
|
||||
y1="33"
|
||||
x1="22"
|
||||
id="linearGradient3906"
|
||||
xlink:href="#linearGradient3900" />
|
||||
</defs>
|
||||
<g
|
||||
id="g4425">
|
||||
<rect
|
||||
style="fill:#d3d7cf;fill-opacity:1;stroke:#2e3436;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="rect2987"
|
||||
width="45.999996"
|
||||
height="58.000004"
|
||||
x="-54.999996"
|
||||
y="3"
|
||||
transform="matrix(0,-1,1,0,0,0)" />
|
||||
<rect
|
||||
style="fill:url(#linearGradient3781-3);fill-opacity:1;stroke:#ffffff;stroke-width:2;stroke-linecap:round;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1"
|
||||
id="rect2987-1"
|
||||
width="41.999996"
|
||||
height="54.000004"
|
||||
x="-52.999996"
|
||||
y="5"
|
||||
transform="matrix(0,-1,1,0,0,0)" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:#555753;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
|
||||
id="rect3894"
|
||||
width="50"
|
||||
height="38"
|
||||
x="7"
|
||||
y="13" />
|
||||
<rect
|
||||
style="color:#000000;display:inline;overflow:visible;visibility:visible;fill:none;stroke:#555753;stroke-width:1.99999988;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;marker:none;enable-background:accumulate"
|
||||
id="rect4664"
|
||||
width="23.999994"
|
||||
height="12.000004"
|
||||
x="33"
|
||||
y="39" />
|
||||
<path
|
||||
style="fill:none;stroke:#555753;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 37,43 15.398794,0 0,0"
|
||||
id="path4666" />
|
||||
<path
|
||||
style="fill:none;stroke:#555753;stroke-width:2;stroke-linecap:round;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
d="m 37,47 15.642526,0 0,0"
|
||||
id="path4666-7" />
|
||||
<g
|
||||
id="layer1"
|
||||
transform="matrix(0,0.42543722,-0.42543722,0,60.785056,33.723688)">
|
||||
<path
|
||||
id="path3343"
|
||||
d="m 35.907323,8.8968626 0,14.1031384 -32.907323,0 10e-8,23.505231 32.9073229,0 0,14.103138 L 64.1136,34.752616 Z"
|
||||
style="fill:url(#linearGradient3012);fill-opacity:1;fill-rule:evenodd;stroke:#280000;stroke-width:4.70104599;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
id="path3343-2"
|
||||
d="m 40.608369,19.248595 0,8.452452 -32.9073228,0 0,14.103138 32.9073228,0 0,8.06651 16.453662,-15.118079 z"
|
||||
style="fill:none;stroke:#ef2929;stroke-width:4.70104599;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
</g>
|
||||
</g>
|
||||
<text
|
||||
id="text3551"
|
||||
y="30.290016"
|
||||
x="11.296877"
|
||||
style="font-style:normal;font-weight:normal;font-size:40px;line-height:125%;font-family:sans-serif;letter-spacing:0px;word-spacing:0px;fill:#000000;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
xml:space="preserve"><tspan
|
||||
style="font-size:20px;fill:#000000;fill-opacity:1;stroke:none"
|
||||
y="30.290016"
|
||||
x="11.296877"
|
||||
id="tspan3553">DXF</tspan></text>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 12 KiB |
@@ -79,6 +79,7 @@ Gui::MenuItem* Workbench::setupMenuBar() const
|
||||
*draw << "TechDraw_LinkDimension";
|
||||
*draw << "Separator";
|
||||
*draw << "TechDraw_ExportPage";
|
||||
*draw << "TechDraw_ExportPageDxf";
|
||||
*draw << "Separator";
|
||||
*draw << "TechDraw_NewHatch";
|
||||
*draw << "TechDraw_NewGeomHatch";
|
||||
@@ -130,6 +131,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
Gui::ToolBarItem *file = new Gui::ToolBarItem(root);
|
||||
file->setCommand("TechDraw File Access");
|
||||
*file << "TechDraw_ExportPage";
|
||||
*file << "TechDraw_ExportPageDxf";
|
||||
|
||||
Gui::ToolBarItem *decor = new Gui::ToolBarItem(root);
|
||||
decor->setCommand("TechDraw Decoration");
|
||||
@@ -138,7 +140,7 @@ Gui::ToolBarItem* Workbench::setupToolBars() const
|
||||
*decor << "TechDraw_Symbol";
|
||||
*decor << "TechDraw_Image";
|
||||
*decor << "TechDraw_ToggleFrame";
|
||||
*decor << "TechDraw_RedrawPage";
|
||||
// *decor << "TechDraw_RedrawPage";
|
||||
return root;
|
||||
}
|
||||
|
||||
@@ -181,6 +183,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
|
||||
Gui::ToolBarItem *file = new Gui::ToolBarItem(root);
|
||||
file->setCommand("TechDraw File Access");
|
||||
*file << "TechDraw_ExportPage";
|
||||
*file << "TechDraw_ExportPageDxf";
|
||||
|
||||
Gui::ToolBarItem *decor = new Gui::ToolBarItem(root);
|
||||
decor->setCommand("TechDraw Decoration");
|
||||
@@ -189,7 +192,7 @@ Gui::ToolBarItem* Workbench::setupCommandBars() const
|
||||
*decor << "TechDraw_Symbol";
|
||||
*decor << "TechDraw_Image";
|
||||
*decor << "TechDraw_ToggleFrame";
|
||||
*decor << "TechDraw_RedrawPage";
|
||||
// *decor << "TechDraw_RedrawPage";
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user