+ optimize creation of hexagonal sketch profile, add icon
This commit is contained in:
parent
5917d21395
commit
409285d53f
|
@ -22,11 +22,10 @@
|
|||
|
||||
#include "PreCompiled.h"
|
||||
#include <sstream>
|
||||
#include "Mod/Sketcher/App/Constraint.h"
|
||||
|
||||
// inclusion of the generated files (generated out of ConstraintPy.xml)
|
||||
#include "Constraint.h"
|
||||
#include "ConstraintPy.h"
|
||||
#include "ConstraintPy.cpp"
|
||||
#include <Base/QuantityPy.h>
|
||||
|
||||
using namespace Sketcher;
|
||||
|
||||
|
@ -109,6 +108,11 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
|||
valid = true;
|
||||
}
|
||||
else if (strcmp("Angle",ConstraintType) == 0 ) {
|
||||
if (PyObject_TypeCheck(index_or_value, &(Base::QuantityPy::Type))) {
|
||||
Base::Quantity q = *(static_cast<Base::QuantityPy*>(index_or_value)->getQuantityPtr());
|
||||
if (q.getUnit() == Base::Unit::Angle)
|
||||
Value = q.getValueAs(Base::Quantity::Radian);
|
||||
}
|
||||
this->getConstraintPtr()->Type = Angle;
|
||||
valid = true;
|
||||
}
|
||||
|
@ -172,6 +176,11 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
|||
//}
|
||||
//else
|
||||
if (strcmp("Angle",ConstraintType) == 0) {
|
||||
if (PyObject_TypeCheck(index_or_value, &(Base::QuantityPy::Type))) {
|
||||
Base::Quantity q = *(static_cast<Base::QuantityPy*>(index_or_value)->getQuantityPtr());
|
||||
if (q.getUnit() == Base::Unit::Angle)
|
||||
Value = q.getValueAs(Base::Quantity::Radian);
|
||||
}
|
||||
this->getConstraintPtr()->Type = Angle;
|
||||
this->getConstraintPtr()->First = FirstIndex;
|
||||
this->getConstraintPtr()->Second = SecondIndex;
|
||||
|
@ -279,6 +288,11 @@ int ConstraintPy::PyInit(PyObject* args, PyObject* /*kwd*/)
|
|||
valid = true;
|
||||
}
|
||||
else if (strcmp("Angle",ConstraintType) == 0 ) {
|
||||
if (PyObject_TypeCheck(index_or_value, &(Base::QuantityPy::Type))) {
|
||||
Base::Quantity q = *(static_cast<Base::QuantityPy*>(index_or_value)->getQuantityPtr());
|
||||
if (q.getUnit() == Base::Unit::Angle)
|
||||
Value = q.getValueAs(Base::Quantity::Radian);
|
||||
}
|
||||
this->getConstraintPtr()->Type = Angle;
|
||||
valid = true;
|
||||
}
|
||||
|
|
|
@ -174,10 +174,12 @@ int Sketch::addGeometry(const Part::Geometry *geo, bool fixed)
|
|||
}
|
||||
}
|
||||
|
||||
void Sketch::addGeometry(const std::vector<Part::Geometry *> &geo, bool fixed)
|
||||
int Sketch::addGeometry(const std::vector<Part::Geometry *> &geo, bool fixed)
|
||||
{
|
||||
int ret = -1;
|
||||
for (std::vector<Part::Geometry *>::const_iterator it=geo.begin(); it != geo.end(); ++it)
|
||||
addGeometry(*it, fixed);
|
||||
ret = addGeometry(*it, fixed);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Sketch::addPoint(const Part::GeomPoint &point, bool fixed)
|
||||
|
|
|
@ -73,7 +73,7 @@ public:
|
|||
/// add unspecified geometry
|
||||
int addGeometry(const Part::Geometry *geo, bool fixed=false);
|
||||
/// add unspecified geometry
|
||||
void addGeometry(const std::vector<Part::Geometry *> &geo, bool fixed=false);
|
||||
int addGeometry(const std::vector<Part::Geometry *> &geo, bool fixed=false);
|
||||
/// returns the actual geometry
|
||||
std::vector<Part::Geometry *> extractGeometry(bool withConstrucionElements=true,
|
||||
bool withExternalElements=false) const;
|
||||
|
|
|
@ -307,7 +307,16 @@ Base::Axis SketchObject::getAxis(int axId) const
|
|||
|
||||
int SketchObject::addGeometry(const std::vector<Part::Geometry *> &geoList)
|
||||
{
|
||||
return -1;
|
||||
const std::vector< Part::Geometry * > &vals = getInternalGeometry();
|
||||
|
||||
std::vector< Part::Geometry * > newVals(vals);
|
||||
for (std::vector<Part::Geometry *>::const_iterator it = geoList.begin(); it != geoList.end(); ++it) {
|
||||
newVals.push_back(*it);
|
||||
}
|
||||
Geometry.setValues(newVals);
|
||||
Constraints.acceptGeometry(getCompleteGeometry());
|
||||
rebuildVertexIndex();
|
||||
return Geometry.getSize()-1;
|
||||
}
|
||||
|
||||
int SketchObject::addGeometry(const Part::Geometry *geo)
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
# include <sstream>
|
||||
#endif
|
||||
|
||||
#include "Mod/Sketcher/App/SketchObject.h"
|
||||
#include <Mod/Sketcher/App/SketchObject.h>
|
||||
#include <Mod/Part/App/LinePy.h>
|
||||
#include <Mod/Part/App/Geometry.h>
|
||||
#include <Base/GeometryPyCXX.h>
|
||||
|
@ -34,6 +34,7 @@
|
|||
#include <Base/Tools.h>
|
||||
#include <Base/QuantityPy.h>
|
||||
#include <App/Document.h>
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
// inclusion of the generated files (generated out of SketchObjectSFPy.xml)
|
||||
#include "SketchObjectPy.h"
|
||||
|
@ -66,7 +67,30 @@ PyObject* SketchObjectPy::addGeometry(PyObject *args)
|
|||
Part::Geometry *geo = static_cast<Part::GeometryPy*>(pcObj)->getGeometryPtr();
|
||||
return Py::new_reference_to(Py::Int(this->getSketchObjectPtr()->addGeometry(geo)));
|
||||
}
|
||||
Py_Return;
|
||||
else if (PyObject_TypeCheck(pcObj, &(PyList_Type)) ||
|
||||
PyObject_TypeCheck(pcObj, &(PyTuple_Type))) {
|
||||
std::vector<Part::Geometry *> geoList;
|
||||
Py::Sequence list(pcObj);
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
if (PyObject_TypeCheck((*it).ptr(), &(Part::GeometryPy::Type))) {
|
||||
Part::Geometry *geo = static_cast<Part::GeometryPy*>((*it).ptr())->getGeometryPtr();
|
||||
geoList.push_back(geo);
|
||||
}
|
||||
}
|
||||
|
||||
int ret = this->getSketchObjectPtr()->addGeometry(geoList) + 1;
|
||||
std::size_t numGeo = geoList.size();
|
||||
Py::Tuple tuple(numGeo);
|
||||
for (std::size_t i=0; i<numGeo; ++i) {
|
||||
int geoId = ret - int(numGeo - i);
|
||||
tuple.setItem(i, Py::Int(geoId));
|
||||
}
|
||||
return Py::new_reference_to(tuple);
|
||||
}
|
||||
|
||||
std::string error = std::string("type must be 'Geometry' or list of 'Geometry', not ");
|
||||
error += pcObj->ob_type->tp_name;
|
||||
throw Py::TypeError(error);
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::delGeometry(PyObject *args)
|
||||
|
@ -130,7 +154,30 @@ PyObject* SketchObjectPy::addConstraint(PyObject *args)
|
|||
this->getSketchObjectPtr()->solve();
|
||||
return Py::new_reference_to(Py::Int(ret));
|
||||
}
|
||||
Py_Return;
|
||||
else if (PyObject_TypeCheck(pcObj, &(PyList_Type)) ||
|
||||
PyObject_TypeCheck(pcObj, &(PyTuple_Type))) {
|
||||
std::vector<Constraint*> values;
|
||||
Py::Sequence list(pcObj);
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
if (PyObject_TypeCheck((*it).ptr(), &(ConstraintPy::Type))) {
|
||||
Constraint *con = static_cast<ConstraintPy*>((*it).ptr())->getConstraintPtr();
|
||||
values.push_back(con);
|
||||
}
|
||||
}
|
||||
|
||||
int ret = getSketchObjectPtr()->addConstraints(values) + 1;
|
||||
std::size_t numCon = values.size();
|
||||
Py::Tuple tuple(numCon);
|
||||
for (std::size_t i=0; i<numCon; ++i) {
|
||||
int conId = ret - int(numCon - i);
|
||||
tuple.setItem(i, Py::Int(conId));
|
||||
}
|
||||
return Py::new_reference_to(tuple);
|
||||
}
|
||||
|
||||
std::string error = std::string("type must be 'Constraint' or list of 'Constraint', not ");
|
||||
error += pcObj->ob_type->tp_name;
|
||||
throw Py::TypeError(error);
|
||||
}
|
||||
|
||||
PyObject* SketchObjectPy::delConstraint(PyObject *args)
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <Mod/Part/App/GeometryCurvePy.h>
|
||||
#include <Mod/Part/App/LinePy.h>
|
||||
#include <Mod/Part/App/TopoShapePy.h>
|
||||
#include <CXX/Objects.hxx>
|
||||
|
||||
#include "Sketch.h"
|
||||
#include "Constraint.h"
|
||||
|
@ -71,50 +72,71 @@ PyObject* SketchPy::addGeometry(PyObject *args)
|
|||
if (!PyArg_ParseTuple(args, "O", &pcObj))
|
||||
return 0;
|
||||
|
||||
if (PyObject_TypeCheck(pcObj, &(LinePy::Type))) {
|
||||
GeomLineSegment *line = static_cast<LinePy*>(pcObj)->getGeomLineSegmentPtr();
|
||||
return Py::new_reference_to(Py::Int(this->getSketchPtr()->addGeometry(line->clone())));
|
||||
if (PyObject_TypeCheck(pcObj, &(Part::GeometryPy::Type))) {
|
||||
Part::Geometry *geo = static_cast<Part::GeometryPy*>(pcObj)->getGeometryPtr();
|
||||
return Py::new_reference_to(Py::Int(this->getSketchPtr()->addGeometry(geo)));
|
||||
}
|
||||
Py_Return;
|
||||
else if (PyObject_TypeCheck(pcObj, &(PyList_Type)) ||
|
||||
PyObject_TypeCheck(pcObj, &(PyTuple_Type))) {
|
||||
std::vector<Part::Geometry *> geoList;
|
||||
Py::Sequence list(pcObj);
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
if (PyObject_TypeCheck((*it).ptr(), &(Part::GeometryPy::Type))) {
|
||||
Part::Geometry *geo = static_cast<Part::GeometryPy*>((*it).ptr())->getGeometryPtr();
|
||||
geoList.push_back(geo);
|
||||
}
|
||||
}
|
||||
|
||||
int ret = this->getSketchPtr()->addGeometry(geoList) + 1;
|
||||
std::size_t numGeo = geoList.size();
|
||||
Py::Tuple tuple(numGeo);
|
||||
for (std::size_t i=0; i<numGeo; ++i) {
|
||||
int geoId = ret - int(numGeo - i);
|
||||
tuple.setItem(i, Py::Int(geoId));
|
||||
}
|
||||
return Py::new_reference_to(tuple);
|
||||
}
|
||||
|
||||
std::string error = std::string("type must be 'Geometry' or list of 'Geometry', not ");
|
||||
error += pcObj->ob_type->tp_name;
|
||||
throw Py::TypeError(error);
|
||||
}
|
||||
|
||||
PyObject* SketchPy::addConstraint(PyObject *args)
|
||||
{
|
||||
int ret = -1;
|
||||
PyObject *pcObj;
|
||||
if (!PyArg_ParseTuple(args, "O", &pcObj))
|
||||
return 0;
|
||||
|
||||
if (PyList_Check(pcObj)) {
|
||||
Py_ssize_t nSize = PyList_Size(pcObj);
|
||||
if (PyObject_TypeCheck(pcObj, &(PyList_Type)) || PyObject_TypeCheck(pcObj, &(PyTuple_Type))) {
|
||||
std::vector<Constraint*> values;
|
||||
values.resize(nSize);
|
||||
|
||||
for (Py_ssize_t i=0; i<nSize;++i) {
|
||||
PyObject* item = PyList_GetItem(pcObj, i);
|
||||
if (!PyObject_TypeCheck(item, &(ConstraintPy::Type))) {
|
||||
std::string error = std::string("types in list must be 'Constraint', not ");
|
||||
error += item->ob_type->tp_name;
|
||||
throw Py::TypeError(error);
|
||||
Py::Sequence list(pcObj);
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
if (PyObject_TypeCheck((*it).ptr(), &(ConstraintPy::Type))) {
|
||||
Constraint *con = static_cast<ConstraintPy*>((*it).ptr())->getConstraintPtr();
|
||||
values.push_back(con);
|
||||
}
|
||||
|
||||
values[i] = static_cast<ConstraintPy*>(item)->getConstraintPtr();
|
||||
}
|
||||
|
||||
ret = getSketchPtr()->addConstraints(values);
|
||||
int ret = getSketchPtr()->addConstraints(values) + 1;
|
||||
std::size_t numCon = values.size();
|
||||
Py::Tuple tuple(numCon);
|
||||
for (std::size_t i=0; i<numCon; ++i) {
|
||||
int conId = ret - int(numCon - i);
|
||||
tuple.setItem(i, Py::Int(conId));
|
||||
}
|
||||
return Py::new_reference_to(tuple);
|
||||
}
|
||||
else if(PyObject_TypeCheck(pcObj, &(ConstraintPy::Type))) {
|
||||
ConstraintPy *pcObject = static_cast<ConstraintPy*>(pcObj);
|
||||
ret = getSketchPtr()->addConstraint(pcObject->getConstraintPtr());
|
||||
int ret = getSketchPtr()->addConstraint(pcObject->getConstraintPtr());
|
||||
return Py::new_reference_to(Py::Int(ret));
|
||||
}
|
||||
else {
|
||||
std::string error = std::string("type must be 'Constraint' or list of 'Constraint', not ");
|
||||
error += pcObj->ob_type->tp_name;
|
||||
throw Py::TypeError(error);
|
||||
}
|
||||
|
||||
return Py::new_reference_to(Py::Int(ret));
|
||||
|
||||
}
|
||||
|
||||
PyObject* SketchPy::clear(PyObject *args)
|
||||
|
|
|
@ -70,6 +70,7 @@
|
|||
<file>icons/Sketcher_Sketch.svg</file>
|
||||
<file>icons/Sketcher_ViewSketch.svg</file>
|
||||
<file>icons/Sketcher_AlterConstruction.svg</file>
|
||||
<file>icons/Sketcher_ProfilesHexagon1.svg</file>
|
||||
<file>translations/Sketcher_af.qm</file>
|
||||
<file>translations/Sketcher_de.qm</file>
|
||||
<file>translations/Sketcher_fi.qm</file>
|
||||
|
|
|
@ -0,0 +1,162 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<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"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="32"
|
||||
height="32"
|
||||
id="svg2"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.4 r9939"
|
||||
sodipodi:docname="Sketcher_Create_Profile_Hexagong_2.svg"
|
||||
inkscape:export-filename="/home/user/Downloads/cad/mystuff/icons/sketcher/profiles/green_theme_1/Sketcher_Create_Profile_Hexagong_2_32px.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
<defs
|
||||
id="defs4">
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3144"
|
||||
id="radialGradient3265"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
|
||||
cx="225.26402"
|
||||
cy="672.79736"
|
||||
fx="225.26402"
|
||||
fy="672.79736"
|
||||
r="34.345188" />
|
||||
<linearGradient
|
||||
inkscape:collect="always"
|
||||
id="linearGradient3144">
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:1;"
|
||||
offset="0"
|
||||
id="stop3146" />
|
||||
<stop
|
||||
style="stop-color:#ffffff;stop-opacity:0;"
|
||||
offset="1"
|
||||
id="stop3148" />
|
||||
</linearGradient>
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3144"
|
||||
id="radialGradient4928"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
|
||||
cx="225.26402"
|
||||
cy="672.79736"
|
||||
fx="225.26402"
|
||||
fy="672.79736"
|
||||
r="34.345188" />
|
||||
<radialGradient
|
||||
inkscape:collect="always"
|
||||
xlink:href="#linearGradient3144"
|
||||
id="radialGradient4936"
|
||||
gradientUnits="userSpaceOnUse"
|
||||
gradientTransform="matrix(1,0,0,0.6985294,0,202.82863)"
|
||||
cx="225.26402"
|
||||
cy="672.79736"
|
||||
fx="225.26402"
|
||||
fy="672.79736"
|
||||
r="34.345188" />
|
||||
</defs>
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="24.65625"
|
||||
inkscape:cx="9.2065906"
|
||||
inkscape:cy="16"
|
||||
inkscape:document-units="px"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="false"
|
||||
inkscape:showpageshadow="false"
|
||||
inkscape:window-width="1680"
|
||||
inkscape:window-height="995"
|
||||
inkscape:window-x="-2"
|
||||
inkscape:window-y="-3"
|
||||
inkscape:window-maximized="1" />
|
||||
<metadata
|
||||
id="metadata7">
|
||||
<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>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer"
|
||||
id="layer1"
|
||||
transform="translate(0,-1020.3622)">
|
||||
<path
|
||||
style="fill:none;stroke:#008900;stroke-width:2.50000000000000000;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="M 3,22.833967 3,9.1254753 16,2 29,9.0443599 29,22.671736 16,30.134348 z"
|
||||
id="path4867"
|
||||
inkscape:connector-curvature="0"
|
||||
transform="translate(0,1020.3622)"
|
||||
sodipodi:nodetypes="ccccccc" />
|
||||
<g
|
||||
id="g4924"
|
||||
transform="matrix(0.52610081,0,0,0.51308669,6.0609957,501.99515)">
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:#ff2000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:5.79999971;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
id="path2188"
|
||||
sodipodi:cx="197.14285"
|
||||
sodipodi:cy="655.2193"
|
||||
sodipodi:rx="48.57143"
|
||||
sodipodi:ry="48.57143"
|
||||
d="m 245.71428,655.2193 c 0,26.82526 -21.74617,48.57143 -48.57143,48.57143 -26.82526,0 -48.57143,-21.74617 -48.57143,-48.57143 0,-26.82526 21.74617,-48.57143 48.57143,-48.57143 26.82526,0 48.57143,21.74617 48.57143,48.57143 z"
|
||||
transform="matrix(-0.14873711,-0.00599525,0.00599525,-0.14873711,44.131897,1139.4406)" />
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:url(#radialGradient4928);fill-opacity:1;stroke:none"
|
||||
id="path2190"
|
||||
sodipodi:cx="225.26402"
|
||||
sodipodi:cy="672.79736"
|
||||
sodipodi:rx="34.345188"
|
||||
sodipodi:ry="23.991123"
|
||||
d="m 259.60921,672.79736 c 0,13.24993 -15.37686,23.99113 -34.34519,23.99113 -18.96832,0 -34.34519,-10.7412 -34.34519,-23.99113 0,-13.24993 15.37687,-23.99112 34.34519,-23.99112 18.96833,0 34.34519,10.74119 34.34519,23.99112 z"
|
||||
transform="matrix(-0.1297658,0.07293494,-0.07293494,-0.1297658,95.792839,1109.6127)" />
|
||||
</g>
|
||||
<g
|
||||
transform="matrix(0.52610081,0,0,0.51308669,17.701046,508.68717)"
|
||||
id="g4930">
|
||||
<path
|
||||
transform="matrix(-0.14873711,-0.00599525,0.00599525,-0.14873711,44.131897,1139.4406)"
|
||||
d="m 245.71428,655.2193 c 0,26.82526 -21.74617,48.57143 -48.57143,48.57143 -26.82526,0 -48.57143,-21.74617 -48.57143,-48.57143 0,-26.82526 21.74617,-48.57143 48.57143,-48.57143 26.82526,0 48.57143,21.74617 48.57143,48.57143 z"
|
||||
sodipodi:ry="48.57143"
|
||||
sodipodi:rx="48.57143"
|
||||
sodipodi:cy="655.2193"
|
||||
sodipodi:cx="197.14285"
|
||||
id="path4932"
|
||||
style="fill:#ff2000;fill-opacity:1;fill-rule:nonzero;stroke:#000000;stroke-width:5.79999971;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none;stroke-dashoffset:0;marker:none;visibility:visible;display:inline;overflow:visible;enable-background:accumulate"
|
||||
sodipodi:type="arc" />
|
||||
<path
|
||||
transform="matrix(-0.1297658,0.07293494,-0.07293494,-0.1297658,95.792839,1109.6127)"
|
||||
d="m 259.60921,672.79736 c 0,13.24993 -15.37686,23.99113 -34.34519,23.99113 -18.96832,0 -34.34519,-10.7412 -34.34519,-23.99113 0,-13.24993 15.37687,-23.99112 34.34519,-23.99112 18.96833,0 34.34519,10.74119 34.34519,23.99112 z"
|
||||
sodipodi:ry="23.991123"
|
||||
sodipodi:rx="34.345188"
|
||||
sodipodi:cy="672.79736"
|
||||
sodipodi:cx="225.26402"
|
||||
id="path4934"
|
||||
style="fill:url(#radialGradient4936);fill-opacity:1;stroke:none"
|
||||
sodipodi:type="arc" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
After Width: | Height: | Size: 6.6 KiB |
|
@ -36,28 +36,30 @@ def makeHexagonSimple(sketchName=None):
|
|||
else:
|
||||
sketch = App.ActiveDocument.getObject(sketchName)
|
||||
|
||||
l1=sketch.addGeometry(Part.Line(App.Vector(-20.00,34.64,0),App.Vector(20.00,34.64,0)))
|
||||
l2=sketch.addGeometry(Part.Line(App.Vector(20.00,34.64,0),App.Vector(47.082363,0.00,0)))
|
||||
sketch.addConstraint(Sketcher.Constraint('Coincident',l1,2,l2,1))
|
||||
l3=sketch.addGeometry(Part.Line(App.Vector(40.00,0.00,0),App.Vector(20.00,-34.64,0)))
|
||||
sketch.addConstraint(Sketcher.Constraint('Coincident',l2,2,l3,1))
|
||||
l4=sketch.addGeometry(Part.Line(App.Vector(20.00,-34.64,0),App.Vector(-20.00,-34.64,0)))
|
||||
sketch.addConstraint(Sketcher.Constraint('Coincident',l3,2,l4,1))
|
||||
l5=sketch.addGeometry(Part.Line(App.Vector(-20.00,-34.64,0),App.Vector(-40.00,0.00,0)))
|
||||
sketch.addConstraint(Sketcher.Constraint('Coincident',l4,2,l5,1))
|
||||
l6=sketch.addGeometry(Part.Line(App.Vector(-40.00,0.00,0),App.Vector(-20.00,34.64,0)))
|
||||
sketch.addConstraint(Sketcher.Constraint('Coincident',l5,2,l6,1))
|
||||
sketch.addConstraint(Sketcher.Constraint('Coincident',l6,2,l1,1))
|
||||
sketch.addConstraint(Sketcher.Constraint('Equal',l1,l2))
|
||||
sketch.addConstraint(Sketcher.Constraint('Equal',l2,l3))
|
||||
sketch.addConstraint(Sketcher.Constraint('Equal',l3,l4))
|
||||
sketch.addConstraint(Sketcher.Constraint('Equal',l4,l5))
|
||||
sketch.addConstraint(Sketcher.Constraint('Equal',l5,l6))
|
||||
a1=sketch.addConstraint(Sketcher.Constraint('Angle',l1,2,l2,1,2.0943951023931953))
|
||||
sketch.setDatum(a1,App.Units.Quantity('120.000000 deg'))
|
||||
a2=sketch.addConstraint(Sketcher.Constraint('Angle',l3,2,l4,1,2.0943951023931953))
|
||||
sketch.setDatum(a2,App.Units.Quantity('120.000000 deg'))
|
||||
a3=sketch.addConstraint(Sketcher.Constraint('Angle',l5,2,l6,1,2.0943951023931953))
|
||||
sketch.setDatum(a3,App.Units.Quantity('120.000000 deg'))
|
||||
geoList = []
|
||||
geoList.append(Part.Line(App.Vector(-20.00,34.64,0),App.Vector(20.00,34.64,0)))
|
||||
geoList.append(Part.Line(App.Vector(20.00,34.64,0),App.Vector(47.082363,0.00,0)))
|
||||
geoList.append(Part.Line(App.Vector(40.00,0.00,0),App.Vector(20.00,-34.64,0)))
|
||||
geoList.append(Part.Line(App.Vector(20.00,-34.64,0),App.Vector(-20.00,-34.64,0)))
|
||||
geoList.append(Part.Line(App.Vector(-20.00,-34.64,0),App.Vector(-40.00,0.00,0)))
|
||||
geoList.append(Part.Line(App.Vector(-40.00,0.00,0),App.Vector(-20.00,34.64,0)))
|
||||
(l1,l2,l3,l4,l5,l6) = sketch.addGeometry(geoList)
|
||||
|
||||
conList = []
|
||||
conList.append(Sketcher.Constraint('Coincident',l1,2,l2,1))
|
||||
conList.append(Sketcher.Constraint('Coincident',l2,2,l3,1))
|
||||
conList.append(Sketcher.Constraint('Coincident',l3,2,l4,1))
|
||||
conList.append(Sketcher.Constraint('Coincident',l4,2,l5,1))
|
||||
conList.append(Sketcher.Constraint('Coincident',l5,2,l6,1))
|
||||
conList.append(Sketcher.Constraint('Coincident',l6,2,l1,1))
|
||||
conList.append(Sketcher.Constraint('Equal',l1,l2))
|
||||
conList.append(Sketcher.Constraint('Equal',l2,l3))
|
||||
conList.append(Sketcher.Constraint('Equal',l3,l4))
|
||||
conList.append(Sketcher.Constraint('Equal',l4,l5))
|
||||
conList.append(Sketcher.Constraint('Equal',l5,l6))
|
||||
conList.append(Sketcher.Constraint('Angle',l1,2,l2,1,App.Units.Quantity('120.000000 deg')))
|
||||
conList.append(Sketcher.Constraint('Angle',l3,2,l4,1,App.Units.Quantity('120.000000 deg')))
|
||||
conList.append(Sketcher.Constraint('Angle',l5,2,l6,1,App.Units.Quantity('120.000000 deg')))
|
||||
sketch.addConstraint(conList)
|
||||
return
|
||||
|
||||
|
|
|
@ -53,11 +53,11 @@ def getSketch():
|
|||
class _CommandProfileHexagon1:
|
||||
"The basis hexagon profile command definition"
|
||||
def GetResources(self):
|
||||
return {'Pixmap' : 'Sketcher_Hexagon',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Sketcher_ProfilesHexagon1","Creates a hexagon profile"),
|
||||
return {'Pixmap' : 'Sketcher_ProfilesHexagon1',
|
||||
'MenuText': QtCore.QT_TRANSLATE_NOOP("Sketcher_ProfilesHexagon1","Creates a hexagonal profile"),
|
||||
'Accel': "",
|
||||
'CmdType': "ForEdit",
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Sketcher_ProfilesHexagon1","Creates a hexagon profile in the sketch")}
|
||||
'ToolTip': QtCore.QT_TRANSLATE_NOOP("Sketcher_ProfilesHexagon1","Creates a hexagonal profile in the sketch")}
|
||||
|
||||
def Activated(self):
|
||||
FreeCAD.ActiveDocument.openTransaction("Create hexagon profile")
|
||||
|
|
Loading…
Reference in New Issue
Block a user