[pre-commit.ci] auto fixes from pre-commit.com hooks

for more information, see https://pre-commit.ci
This commit is contained in:
pre-commit-ci[bot]
2023-09-12 13:03:02 +00:00
committed by WandererFan
parent a207d11fa4
commit e92ed45df9
435 changed files with 2669 additions and 2645 deletions

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#if defined(__MINGW32__)
#define WNT// avoid conflict with GUID
#define WNT // avoid conflict with GUID
#endif
#ifndef _PreComp_
#include <climits>
@@ -123,7 +123,7 @@ public:
&Module::writeDXFObject,
"writeDXFObject([objects],filename [,version,usePolyline,optionSource]): Exports "
"DocumentObject(s) to a DXF file.");
initialize("This module is the Import module.");// register with Python
initialize("This module is the Import module."); // register with Python
}
~Module() override = default;
@@ -765,4 +765,4 @@ PyObject* initModule()
return Base::Interpreter().addModule(new Module);
}
}// namespace Import
} // namespace Import

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#if defined(__MINGW32__)
#define WNT// avoid conflict with GUID
#define WNT // avoid conflict with GUID
#endif
#ifndef _PreComp_
#include <Quantity_ColorRGBA.hxx>
@@ -39,7 +39,7 @@
#include <climits>
#include <gp_Ax1.hxx>
#include <gp_Dir.hxx>
#include <gp_Pln.hxx>// for Precision::Confusion()
#include <gp_Pln.hxx> // for Precision::Confusion()
#include <gp_Trsf.hxx>
#endif

View File

@@ -45,7 +45,7 @@ namespace App
class Document;
class DocumentObject;
class Part;
}// namespace App
} // namespace App
namespace Part
{
class Feature;
@@ -120,6 +120,6 @@ private:
};
}// namespace Import
} // namespace Import
#endif// IMPORT_EXPORTOCAF_H
#endif // IMPORT_EXPORTOCAF_H

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#if defined(__MINGW32__)
#define WNT// avoid conflict with GUID
#define WNT // avoid conflict with GUID
#endif
#ifndef _PreComp_
#include <BRepBndLib.hxx>
@@ -43,7 +43,7 @@
#include <XCAFDoc_DocumentTool.hxx>
#include <XCAFDoc_Location.hxx>
#include <climits>
#include <gp_Pln.hxx>// for Precision::Confusion()
#include <gp_Pln.hxx> // for Precision::Confusion()
#include <gp_Trsf.hxx>
#endif
@@ -553,7 +553,7 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna
jt = myColorMap.find(shape.HashCode(INT_MAX));
App::Color partColor(0.8f, 0.8f, 0.8f);
#if 0// TODO
#if 0 // TODO
Gui::ViewProvider* vp = Gui::Application::Instance->getViewProvider(part);
if (vp && vp->isDerivedFrom(PartGui::ViewProviderPart::getClassTypeId())) {
if (jt != myColorMap.end()) {
@@ -601,7 +601,7 @@ void ImportXCAF::createShape(const TopoDS_Shape& shape, bool perface, bool setna
}
if (found_face_color) {
#if 0// TODO
#if 0 // TODO
Gui::ViewProvider* vp = Gui::Application::Instance->getViewProvider(part);
if (vp && vp->isDerivedFrom(PartGui::ViewProviderPartExt::getClassTypeId())) {
static_cast<PartGui::ViewProviderPartExt*>(vp)->DiffuseColor.setValues(faceColors);

View File

@@ -47,7 +47,7 @@ namespace App
{
class Document;
class DocumentObject;
}// namespace App
} // namespace App
namespace Part
{
class Feature;
@@ -140,6 +140,6 @@ private:
std::map<Standard_Integer, std::string> myNameMap;
};
}// namespace Import
} // namespace Import
#endif// IMPORT_IMPORTOCAF_H
#endif // IMPORT_IMPORTOCAF_H

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#if defined(__MINGW32__)
#define WNT// avoid conflict with GUID
#define WNT // avoid conflict with GUID
#endif
#ifndef _PreComp_
#include <Interface_Static.hxx>
@@ -1071,7 +1071,7 @@ static Standard_Boolean FindSHUO(const TDF_LabelSequence& theLabels,
// check for any upper_usage
::XCAFDoc_ShapeTool::GetSHUOUpperUsage(anSHUO->Label(), aUpLabels);
if (aUpLabels.Length() > 0) {
continue;// reject if there is one
continue; // reject if there is one
}
int j = 2;
for (; anSHUO->NbChildren(); ++j) {

View File

@@ -50,7 +50,7 @@ namespace App
{
class Document;
class DocumentObject;
}// namespace App
} // namespace App
namespace Part
{
class Feature;
@@ -292,6 +292,6 @@ private:
ExportOCAFOptions options;
};
}// namespace Import
} // namespace Import
#endif// IMPORT_IMPORTOCAF2_H
#endif // IMPORT_IMPORTOCAF2_H

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#if defined(__MINGW32__)
#define WNT// avoid conflict with GUID
#define WNT // avoid conflict with GUID
#endif
#ifndef _PreComp_
#include <Quantity_Color.hxx>

View File

@@ -42,7 +42,7 @@ namespace App
{
class Document;
class DocumentObject;
}// namespace App
} // namespace App
namespace Part
{
class Feature;
@@ -90,6 +90,6 @@ private:
};
}// namespace Import
} // namespace Import
#endif// IMPORT_ImportOCAFAssembly_H
#endif // IMPORT_ImportOCAFAssembly_H

View File

@@ -32,7 +32,7 @@
#pragma warning(disable : 4251)
#pragma warning(disable : 4275)
#pragma warning(disable : 4503)
#pragma warning(disable : 4786)// specifier longer then 255 chars
#pragma warning(disable : 4786) // specifier longer then 255 chars
#endif
@@ -53,6 +53,6 @@
// Base
#include <Mod/Part/App/OpenCascadeAll.h>
#endif//_PreComp_
#endif //_PreComp_
#endif

View File

@@ -43,7 +43,7 @@ public:
int read(const char* fileName);
};
}// namespace Import
} // namespace Import
#endif// IMPORT_STEPSHAPE_H
#endif // IMPORT_STEPSHAPE_H

View File

@@ -36,7 +36,7 @@ std::string StepShapePy::representation() const
return {"<StepShape object>"};
}
PyObject* StepShapePy::PyMake(struct _typeobject*, PyObject*, PyObject*)// Python wrapper
PyObject* StepShapePy::PyMake(struct _typeobject*, PyObject*, PyObject*) // Python wrapper
{
// create a new instance of StepShapePy and the Twin object
return new StepShapePy(new StepShape);

View File

@@ -425,8 +425,8 @@ std::string ImpExpDxfRead::Deformat(const char* text)
{
// this function removes DXF formatting from texts
std::stringstream ss;
bool escape = false; // turned on when finding an escape character
bool longescape = false;// turned on for certain escape codes that expect additional chars
bool escape = false; // turned on when finding an escape character
bool longescape = false; // turned on for certain escape codes that expect additional chars
for (unsigned int i = 0; i < strlen(text); i++) {
if (text[i] == '\\') {
escape = true;
@@ -472,7 +472,7 @@ void ImpExpDxfRead::AddGraphics() const
TopoDS_Compound comp;
builder.MakeCompound(comp);
std::string k = i->first;
if (k == "0") {// FreeCAD doesn't like an object name being '0'...
if (k == "0") { // FreeCAD doesn't like an object name being '0'...
k = "LAYER_0";
}
std::vector<Part::TopoShape*> v = i->second;
@@ -563,7 +563,7 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
if (m_version >= 14) {
exportLWPoly(adapt);
}
else {// m_version < 14
else { // m_version < 14
exportPolyline(adapt);
}
}
@@ -571,11 +571,11 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
if (m_version >= 14) {
exportLWPoly(adapt);
}
else {// m_version < 14
else { // m_version < 14
exportPolyline(adapt);
}
}
else {// no overrides, do what's right!
else { // no overrides, do what's right!
if (m_version < 14) {
exportPolyline(adapt);
}
@@ -584,12 +584,12 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
}
}
}
else {// it's an arc
else { // it's an arc
if (m_polyOverride) {
if (m_version >= 14) {
exportLWPoly(adapt);
}
else {// m_version < 14
else { // m_version < 14
exportPolyline(adapt);
}
}
@@ -597,11 +597,11 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
if (m_version >= 14) {
exportLWPoly(adapt);
}
else {// m_version < 14
else { // m_version < 14
exportPolyline(adapt);
}
}
else {// no overrides, do what's right!
else { // no overrides, do what's right!
if (m_version < 14) {
exportPolyline(adapt);
}
@@ -616,7 +616,7 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
if (m_version >= 14) {
exportLWPoly(adapt);
}
else {// m_version < 14
else { // m_version < 14
exportPolyline(adapt);
}
}
@@ -624,11 +624,11 @@ void ImpExpDxfWrite::exportShape(const TopoDS_Shape input)
if (m_version >= 14) {
exportLWPoly(adapt);
}
else {// m_version < 14
else { // m_version < 14
exportPolyline(adapt);
}
}
else {// no overrides, do what's right!
else { // no overrides, do what's right!
if (m_version < 14) {
exportPolyline(adapt);
}
@@ -683,11 +683,11 @@ bool ImpExpDxfWrite::gp_PntEqual(gp_Pnt p1, gp_Pnt p2)
bool ImpExpDxfWrite::gp_PntCompare(gp_Pnt p1, gp_Pnt p2)
{
bool result = false;
if (!(p1.IsEqual(p2, Precision::Confusion()))) { // ie v1 != v2
if (!(fabs(p1.X() - p2.X()) < Precision::Confusion())) {// x1 != x2
if (!(p1.IsEqual(p2, Precision::Confusion()))) { // ie v1 != v2
if (!(fabs(p1.X() - p2.X()) < Precision::Confusion())) { // x1 != x2
result = p1.X() < p2.X();
}
else if (!(fabs(p1.Y() - p2.Y()) < Precision::Confusion())) {// y1 != y2
else if (!(fabs(p1.Y() - p2.Y()) < Precision::Confusion())) { // y1 != y2
result = p1.Y() < p2.Y();
}
else {
@@ -720,7 +720,7 @@ void ImpExpDxfWrite::exportEllipse(BRepAdaptor_Curve& c)
double major = ellp.MajorRadius();
double minor = ellp.MinorRadius();
gp_Dir xaxis = ellp.XAxis().Direction();// direction of major axis
gp_Dir xaxis = ellp.XAxis().Direction(); // direction of major axis
// rotation appears to be the clockwise(?) angle between major & +Y??
double rotation = xaxis.AngleWithRef(gp_Dir(0, 1, 0), gp_Dir(0, 0, 1));
@@ -765,7 +765,7 @@ void ImpExpDxfWrite::exportEllipseArc(BRepAdaptor_Curve& c)
double major = ellp.MajorRadius();
double minor = ellp.MinorRadius();
gp_Dir xaxis = ellp.XAxis().Direction();// direction of major axis
gp_Dir xaxis = ellp.XAxis().Direction(); // direction of major axis
// rotation appears to be the clockwise angle between major & +Y??
double rotation = xaxis.AngleWithRef(gp_Dir(0, 1, 0), gp_Dir(0, 0, 1));
@@ -778,14 +778,14 @@ void ImpExpDxfWrite::exportEllipseArc(BRepAdaptor_Curve& c)
gp_Vec v1(m, s);
gp_Vec v2(m, e);
gp_Vec v3(0, 0, 1);
double a = v3.DotCross(v1, v2);// a = v3 dot (v1 cross v2)
// relates to "handedness" of 3 vectors
// a > 0 ==> v2 is CCW from v1 (righthanded)?
// a < 0 ==> v2 is CW from v1 (lefthanded)?
double a = v3.DotCross(v1, v2); // a = v3 dot (v1 cross v2)
// relates to "handedness" of 3 vectors
// a > 0 ==> v2 is CCW from v1 (righthanded)?
// a < 0 ==> v2 is CW from v1 (lefthanded)?
double startAngle = fmod(f, 2.0 * M_PI);// revolutions
double startAngle = fmod(f, 2.0 * M_PI); // revolutions
double endAngle = fmod(l, 2.0 * M_PI);
bool endIsCW = (a < 0) ? true : false;// if !endIsCW swap(start,end)
bool endIsCW = (a < 0) ? true : false; // if !endIsCW swap(start,end)
// not sure if this is a hack or not. seems to make valid arcs.
if (!endIsCW) {
startAngle = -startAngle;
@@ -810,7 +810,7 @@ void ImpExpDxfWrite::exportBSpline(BRepAdaptor_Curve& c)
spline = approx.Curve();
}
else {
if (approx.HasResult()) {// result, but not within tolerance
if (approx.HasResult()) { // result, but not within tolerance
spline = approx.Curve();
Base::Console().Message("DxfWrite::exportBSpline - result not within tolerance\n");
}
@@ -840,7 +840,7 @@ void ImpExpDxfWrite::exportBSpline(BRepAdaptor_Curve& c)
sd.flag = spline->IsClosed();
sd.flag += spline->IsPeriodic() * 2;
sd.flag += spline->IsRational() * 4;
sd.flag += 8;// planar spline
sd.flag += 8; // planar spline
sd.degree = spline->Degree();
sd.control_points = spline->NbPoles();

View File

@@ -66,8 +66,8 @@ public:
void AddGraphics() const override;
// FreeCAD-specific functions
void AddObject(Part::TopoShape* shape);// Called by OnRead functions to add Part objects
std::string Deformat(const char* text);// Removes DXF formatting from texts
void AddObject(Part::TopoShape* shape); // Called by OnRead functions to add Part objects
std::string Deformat(const char* text); // Removes DXF formatting from texts
std::string getOptionSource()
{
@@ -146,7 +146,7 @@ protected:
void exportBSpline(BRepAdaptor_Curve& c);
void exportBCurve(BRepAdaptor_Curve& c);
void exportLine(BRepAdaptor_Curve& c);
void exportLWPoly(BRepAdaptor_Curve& c);// LWPolyline not supported in R12?
void exportLWPoly(BRepAdaptor_Curve& c); // LWPolyline not supported in R12?
void exportPolyline(BRepAdaptor_Curve& c);
// std::string m_optionSource;
@@ -155,6 +155,6 @@ protected:
bool optionExpPoints;
};
}// namespace Import
} // namespace Import
#endif// IMPEXPDXF_H
#endif // IMPEXPDXF_H

View File

@@ -34,14 +34,14 @@ Base::Vector3d toVector3d(const double* a)
}
CDxfWrite::CDxfWrite(const char* filepath)
:// TODO: these should probably be parameters in config file
// handles:
// boilerplate 0 - A00
// used by dxf.cpp A01 - FFFE
// ACAD HANDSEED FFFF
: // TODO: these should probably be parameters in config file
// handles:
// boilerplate 0 - A00
// used by dxf.cpp A01 - FFFE
// ACAD HANDSEED FFFF
m_handle(0xA00)
,// room for 2560 handles in boilerplate files
, // room for 2560 handles in boilerplate files
// m_entityHandle(0x300), //don't need special ranges for handles
// m_layerHandle(0x30),
// m_blockHandle(0x210),
@@ -417,7 +417,7 @@ void CDxfWrite::makeBlockSectionHead()
(*m_ssBlock) << m_savePaperSpaceHandle << endl;
(*m_ssBlock) << "100" << endl;
(*m_ssBlock) << "AcDbEntity" << endl;
(*m_ssBlock) << " 67" << endl;// paper_space flag
(*m_ssBlock) << " 67" << endl; // paper_space flag
(*m_ssBlock) << " 1" << endl;
}
(*m_ssBlock) << " 8" << endl;
@@ -531,24 +531,24 @@ void CDxfWrite::putLine(const Base::Vector3d s,
(*outStream) << "100" << endl;
(*outStream) << "AcDbEntity" << endl;
}
(*outStream) << " 8" << endl; // Group code for layer name
(*outStream) << getLayerName() << endl;// Layer number
(*outStream) << " 8" << endl; // Group code for layer name
(*outStream) << getLayerName() << endl; // Layer number
if (m_version > 12) {
(*outStream) << "100" << endl;
(*outStream) << "AcDbLine" << endl;
}
(*outStream) << " 10" << endl;// Start point of line
(*outStream) << s.x << endl; // X in WCS coordinates
(*outStream) << " 10" << endl; // Start point of line
(*outStream) << s.x << endl; // X in WCS coordinates
(*outStream) << " 20" << endl;
(*outStream) << s.y << endl;// Y in WCS coordinates
(*outStream) << s.y << endl; // Y in WCS coordinates
(*outStream) << " 30" << endl;
(*outStream) << s.z << endl; // Z in WCS coordinates
(*outStream) << " 11" << endl;// End point of line
(*outStream) << e.x << endl; // X in WCS coordinates
(*outStream) << s.z << endl; // Z in WCS coordinates
(*outStream) << " 11" << endl; // End point of line
(*outStream) << e.x << endl; // X in WCS coordinates
(*outStream) << " 21" << endl;
(*outStream) << e.y << endl;// Y in WCS coordinates
(*outStream) << e.y << endl; // Y in WCS coordinates
(*outStream) << " 31" << endl;
(*outStream) << e.z << endl;// Z in WCS coordinates
(*outStream) << e.z << endl; // Z in WCS coordinates
}
@@ -568,37 +568,37 @@ void CDxfWrite::writeLWPolyLine(const LWPolyDataOut& pd)
(*m_ssEntity) << "AcDbEntity" << endl;
}
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;// 100 groups are not part of R12
(*m_ssEntity) << "100" << endl; // 100 groups are not part of R12
(*m_ssEntity) << "AcDbPolyline" << endl;
}
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl;// Layer name
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl; // Layer name
(*m_ssEntity) << " 90" << endl;
(*m_ssEntity) << pd.nVert << endl;// number of vertices
(*m_ssEntity) << pd.nVert << endl; // number of vertices
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << pd.Flag << endl;
(*m_ssEntity) << " 43" << endl;
(*m_ssEntity) << "0" << endl;// Constant width opt
(*m_ssEntity) << "0" << endl; // Constant width opt
// (*m_ssEntity) << pd.Width << endl; //Constant width opt
// (*m_ssEntity) << " 38" << endl;
// (*m_ssEntity) << pd.Elev << endl; // Elevation
// (*m_ssEntity) << " 39" << endl;
// (*m_ssEntity) << pd.Thick << endl; // Thickness
for (auto& p : pd.Verts) {
(*m_ssEntity) << " 10" << endl;// Vertices
(*m_ssEntity) << " 10" << endl; // Vertices
(*m_ssEntity) << p.x << endl;
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << p.y << endl;
}
for (auto& s : pd.StartWidth) {
(*m_ssEntity) << " 40" << endl;
(*m_ssEntity) << s << endl;// Start Width
(*m_ssEntity) << s << endl; // Start Width
}
for (auto& e : pd.EndWidth) {
(*m_ssEntity) << " 41" << endl;
(*m_ssEntity) << e << endl;// End Width
(*m_ssEntity) << e << endl; // End Width
}
for (auto& b : pd.Bulge) {// Bulge
for (auto& b : pd.Bulge) { // Bulge
(*m_ssEntity) << " 42" << endl;
(*m_ssEntity) << b << endl;
}
@@ -626,13 +626,13 @@ void CDxfWrite::writePolyline(const LWPolyDataOut& pd)
(*m_ssEntity) << "AcDbEntity" << endl;
}
(*m_ssEntity) << " 8" << endl;
(*m_ssEntity) << getLayerName() << endl;// Layer name
(*m_ssEntity) << getLayerName() << endl; // Layer name
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;// 100 groups are not part of R12
(*m_ssEntity) << "100" << endl; // 100 groups are not part of R12
(*m_ssEntity) << "AcDbPolyline" << endl;
}
(*m_ssEntity) << " 66" << endl;
(*m_ssEntity) << " 1" << endl;// vertices follow
(*m_ssEntity) << " 1" << endl; // vertices follow
(*m_ssEntity) << " 10" << endl;
(*m_ssEntity) << "0.0" << endl;
(*m_ssEntity) << " 20" << endl;
@@ -675,18 +675,18 @@ void CDxfWrite::writePoint(const double* s)
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbEntity" << endl;
}
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl;// Layer name
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl; // Layer name
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbPoint" << endl;
}
(*m_ssEntity) << " 10" << endl;
(*m_ssEntity) << s[0] << endl;// X in WCS coordinates
(*m_ssEntity) << s[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << s[1] << endl;// Y in WCS coordinates
(*m_ssEntity) << s[1] << endl; // Y in WCS coordinates
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << s[2] << endl;// Z in WCS coordinates
(*m_ssEntity) << s[2] << endl; // Z in WCS coordinates
}
void CDxfWrite::writeArc(const double* s, const double* e, const double* c, bool dir)
@@ -714,31 +714,31 @@ void CDxfWrite::writeArc(const double* s, const double* e, const double* c, bool
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbEntity" << endl;
}
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl;// Layer number
// (*m_ssEntity) << " 62" << endl;
// (*m_ssEntity) << " 0" << endl;
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl; // Layer number
// (*m_ssEntity) << " 62" << endl;
// (*m_ssEntity) << " 0" << endl;
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbCircle" << endl;
}
(*m_ssEntity) << " 10" << endl;// Centre X
(*m_ssEntity) << c[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 10" << endl; // Centre X
(*m_ssEntity) << c[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << c[1] << endl;// Y in WCS coordinates
(*m_ssEntity) << c[1] << endl; // Y in WCS coordinates
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << c[2] << endl; // Z in WCS coordinates
(*m_ssEntity) << " 40" << endl; //
(*m_ssEntity) << radius << endl;// Radius
(*m_ssEntity) << c[2] << endl; // Z in WCS coordinates
(*m_ssEntity) << " 40" << endl; //
(*m_ssEntity) << radius << endl; // Radius
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbArc" << endl;
}
(*m_ssEntity) << " 50" << endl;
(*m_ssEntity) << start_angle << endl;// Start angle
(*m_ssEntity) << start_angle << endl; // Start angle
(*m_ssEntity) << " 51" << endl;
(*m_ssEntity) << end_angle << endl;// End angle
(*m_ssEntity) << end_angle << endl; // End angle
}
void CDxfWrite::writeCircle(const double* c, double radius)
@@ -753,20 +753,20 @@ void CDxfWrite::writeCircle(const double* c, double radius)
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbEntity" << endl;
}
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl;// Layer number
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl; // Layer number
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbCircle" << endl;
}
(*m_ssEntity) << " 10" << endl;// Centre X
(*m_ssEntity) << c[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 10" << endl; // Centre X
(*m_ssEntity) << c[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << c[1] << endl;// Y in WCS coordinates
// (*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << c[1] << endl; // Y in WCS coordinates
// (*m_ssEntity) << " 30" << endl;
// (*m_ssEntity) << c[2] << endl; // Z in WCS coordinates
(*m_ssEntity) << " 40" << endl; //
(*m_ssEntity) << radius << endl;// Radius
(*m_ssEntity) << " 40" << endl; //
(*m_ssEntity) << radius << endl; // Radius
}
void CDxfWrite::writeEllipse(const double* c,
@@ -784,7 +784,7 @@ void CDxfWrite::writeEllipse(const double* c,
double ratio = minor_radius / major_radius;
if (!endIsCW) {// end is NOT CW from start
if (!endIsCW) { // end is NOT CW from start
double temp = start_angle;
start_angle = end_angle;
end_angle = temp;
@@ -799,36 +799,37 @@ void CDxfWrite::writeEllipse(const double* c,
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbEntity" << endl;
}
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl;// Layer number
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl; // Layer number
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbEllipse" << endl;
}
(*m_ssEntity) << " 10" << endl;// Centre X
(*m_ssEntity) << c[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 10" << endl; // Centre X
(*m_ssEntity) << c[0] << endl; // X in WCS coordinates
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << c[1] << endl;// Y in WCS coordinates
(*m_ssEntity) << c[1] << endl; // Y in WCS coordinates
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << c[2] << endl; // Z in WCS coordinates
(*m_ssEntity) << " 11" << endl;//
(*m_ssEntity) << m[0] << endl; // Major X
(*m_ssEntity) << c[2] << endl; // Z in WCS coordinates
(*m_ssEntity) << " 11" << endl; //
(*m_ssEntity) << m[0] << endl; // Major X
(*m_ssEntity) << " 21" << endl;
(*m_ssEntity) << m[1] << endl;// Major Y
(*m_ssEntity) << m[1] << endl; // Major Y
(*m_ssEntity) << " 31" << endl;
(*m_ssEntity) << m[2] << endl; // Major Z
(*m_ssEntity) << " 40" << endl;//
(*m_ssEntity) << ratio << endl;// Ratio
// (*m_ssEntity) << "210" << endl; //extrusion dir??
// (*m_ssEntity) << "0" << endl;
// (*m_ssEntity) << "220" << endl;
// (*m_ssEntity) << "0" << endl;
// (*m_ssEntity) << "230" << endl;
// (*m_ssEntity) << "1" << endl;
(*m_ssEntity) << m[2] << endl; // Major Z
(*m_ssEntity) << " 40" << endl; //
(*m_ssEntity) << ratio
<< endl; // Ratio
// (*m_ssEntity) << "210" << endl; //extrusion dir??
// (*m_ssEntity) << "0" << endl;
// (*m_ssEntity) << "220" << endl;
// (*m_ssEntity) << "0" << endl;
// (*m_ssEntity) << "230" << endl;
// (*m_ssEntity) << "1" << endl;
(*m_ssEntity) << " 41" << endl;
(*m_ssEntity) << start_angle << endl;// Start angle (radians [0..2pi])
(*m_ssEntity) << start_angle << endl; // Start angle (radians [0..2pi])
(*m_ssEntity) << " 42" << endl;
(*m_ssEntity) << end_angle << endl;// End angle
(*m_ssEntity) << end_angle << endl; // End angle
}
//***************************
@@ -846,8 +847,8 @@ void CDxfWrite::writeSpline(const SplineDataOut& sd)
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbEntity" << endl;
}
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl;// Layer name
(*m_ssEntity) << " 8" << endl; // Group code for layer name
(*m_ssEntity) << getLayerName() << endl; // Layer name
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
(*m_ssEntity) << "AcDbSpline" << endl;
@@ -860,7 +861,7 @@ void CDxfWrite::writeSpline(const SplineDataOut& sd)
(*m_ssEntity) << "1" << endl;
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << sd.flag << endl;// flags
(*m_ssEntity) << sd.flag << endl; // flags
(*m_ssEntity) << " 71" << endl;
(*m_ssEntity) << sd.degree << endl;
(*m_ssEntity) << " 72" << endl;
@@ -895,19 +896,19 @@ void CDxfWrite::writeSpline(const SplineDataOut& sd)
for (auto& c : sd.control) {
(*m_ssEntity) << " 10" << endl;
(*m_ssEntity) << c.x << endl;// X in WCS coordinates
(*m_ssEntity) << c.x << endl; // X in WCS coordinates
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << c.y << endl;// Y in WCS coordinates
(*m_ssEntity) << c.y << endl; // Y in WCS coordinates
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << c.z << endl;// Z in WCS coordinates
(*m_ssEntity) << c.z << endl; // Z in WCS coordinates
}
for (auto& f : sd.fit) {
(*m_ssEntity) << " 11" << endl;
(*m_ssEntity) << f.x << endl;// X in WCS coordinates
(*m_ssEntity) << f.x << endl; // X in WCS coordinates
(*m_ssEntity) << " 21" << endl;
(*m_ssEntity) << f.y << endl;// Y in WCS coordinates
(*m_ssEntity) << f.y << endl; // Y in WCS coordinates
(*m_ssEntity) << " 31" << endl;
(*m_ssEntity) << f.z << endl;// Z in WCS coordinates
(*m_ssEntity) << f.z << endl; // Z in WCS coordinates
}
}
@@ -990,7 +991,7 @@ void CDxfWrite::putText(const char* text,
}
// (*outStream) << " 39" << endl;
// (*outStream) << 0 << endl; //thickness
(*outStream) << " 10" << endl;// first alignment point
(*outStream) << " 10" << endl; // first alignment point
(*outStream) << location1.x << endl;
(*outStream) << " 20" << endl;
(*outStream) << location1.y << endl;
@@ -1008,14 +1009,14 @@ void CDxfWrite::putText(const char* text,
// (*outStream) << 0 << endl;
(*outStream) << " 7" << endl;
(*outStream) << "STANDARD" << endl;// style
(*outStream) << "STANDARD" << endl; // style
// (*outStream) << " 71" << endl; //default
// (*outStream) << "0" << endl;
(*outStream) << " 72" << endl;
(*outStream) << horizJust << endl;
//// (*outStream) << " 73" << endl;
//// (*outStream) << "0" << endl;
(*outStream) << " 11" << endl;// second alignment point
(*outStream) << " 11" << endl; // second alignment point
(*outStream) << location2.x << endl;
(*outStream) << " 21" << endl;
(*outStream) << location2.y << endl;
@@ -1114,14 +1115,14 @@ void CDxfWrite::writeLinearDim(const double* textMidPoint,
(*m_ssEntity) << "AcDbDimension" << endl;
}
(*m_ssEntity) << " 2" << endl;
(*m_ssEntity) << "*" << getLayerName() << endl;// blockName
(*m_ssEntity) << " 10" << endl; // dimension line definition point
(*m_ssEntity) << "*" << getLayerName() << endl; // blockName
(*m_ssEntity) << " 10" << endl; // dimension line definition point
(*m_ssEntity) << lineDefPoint[0] << endl;
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << lineDefPoint[1] << endl;
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << lineDefPoint[2] << endl;
(*m_ssEntity) << " 11" << endl;// text mid point
(*m_ssEntity) << " 11" << endl; // text mid point
(*m_ssEntity) << textMidPoint[0] << endl;
(*m_ssEntity) << " 21" << endl;
(*m_ssEntity) << textMidPoint[1] << endl;
@@ -1129,18 +1130,18 @@ void CDxfWrite::writeLinearDim(const double* textMidPoint,
(*m_ssEntity) << textMidPoint[2] << endl;
if (type == ALIGNED) {
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << 1 << endl;// dimType1 = Aligned
(*m_ssEntity) << 1 << endl; // dimType1 = Aligned
}
if ((type == HORIZONTAL) || (type == VERTICAL)) {
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << 32 << endl;// dimType0 = Aligned + 32 (bit for unique block)?
(*m_ssEntity) << 32 << endl; // dimType0 = Aligned + 32 (bit for unique block)?
}
// (*m_ssEntity) << " 71" << endl; // not R12
// (*m_ssEntity) << 1 << endl; // attachPoint ??1 = topleft
(*m_ssEntity) << " 1" << endl;
(*m_ssEntity) << dimText << endl;
(*m_ssEntity) << " 3" << endl;
(*m_ssEntity) << "STANDARD" << endl;// style
(*m_ssEntity) << "STANDARD" << endl; // style
// linear dims
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
@@ -1202,7 +1203,7 @@ void CDxfWrite::writeAngularDim(const double* textMidPoint,
(*m_ssEntity) << "AcDbDimension" << endl;
}
(*m_ssEntity) << " 2" << endl;
(*m_ssEntity) << "*" << getLayerName() << endl;// blockName
(*m_ssEntity) << "*" << getLayerName() << endl; // blockName
(*m_ssEntity) << " 10" << endl;
(*m_ssEntity) << endExt2[0] << endl;
@@ -1219,14 +1220,14 @@ void CDxfWrite::writeAngularDim(const double* textMidPoint,
(*m_ssEntity) << textMidPoint[2] << endl;
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << 2 << endl;// dimType 2 = Angular 5 = Angular 3 point
// +32 for block?? (not R12)
(*m_ssEntity) << 2 << endl; // dimType 2 = Angular 5 = Angular 3 point
// +32 for block?? (not R12)
// (*m_ssEntity) << " 71" << endl; // not R12? not required?
// (*m_ssEntity) << 5 << endl; // attachPoint 5 = middle
(*m_ssEntity) << " 1" << endl;
(*m_ssEntity) << dimText << endl;
(*m_ssEntity) << " 3" << endl;
(*m_ssEntity) << "STANDARD" << endl;// style
(*m_ssEntity) << "STANDARD" << endl; // style
// angular dims
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
@@ -1295,27 +1296,27 @@ void CDxfWrite::writeRadialDim(const double* centerPoint,
(*m_ssEntity) << "AcDbDimension" << endl;
}
(*m_ssEntity) << " 2" << endl;
(*m_ssEntity) << "*" << getLayerName() << endl;// blockName
(*m_ssEntity) << " 10" << endl; // arc center point
(*m_ssEntity) << "*" << getLayerName() << endl; // blockName
(*m_ssEntity) << " 10" << endl; // arc center point
(*m_ssEntity) << centerPoint[0] << endl;
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << centerPoint[1] << endl;
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << centerPoint[2] << endl;
(*m_ssEntity) << " 11" << endl;// text mid point
(*m_ssEntity) << " 11" << endl; // text mid point
(*m_ssEntity) << textMidPoint[0] << endl;
(*m_ssEntity) << " 21" << endl;
(*m_ssEntity) << textMidPoint[1] << endl;
(*m_ssEntity) << " 31" << endl;
(*m_ssEntity) << textMidPoint[2] << endl;
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << 4 << endl;// dimType 4 = Radius
// (*m_ssEntity) << " 71" << endl; // not R12
(*m_ssEntity) << 4 << endl; // dimType 4 = Radius
// (*m_ssEntity) << " 71" << endl; // not R12
// (*m_ssEntity) << 1 << endl; // attachPoint 5 = middle center
(*m_ssEntity) << " 1" << endl;
(*m_ssEntity) << dimText << endl;
(*m_ssEntity) << " 3" << endl;
(*m_ssEntity) << "STANDARD" << endl;// style
(*m_ssEntity) << "STANDARD" << endl; // style
// radial dims
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
@@ -1327,7 +1328,7 @@ void CDxfWrite::writeRadialDim(const double* centerPoint,
(*m_ssEntity) << arcPoint[1] << endl;
(*m_ssEntity) << " 35" << endl;
(*m_ssEntity) << arcPoint[2] << endl;
(*m_ssEntity) << " 40" << endl;// leader length????
(*m_ssEntity) << " 40" << endl; // leader length????
(*m_ssEntity) << 0 << endl;
writeDimBlockPreamble();
@@ -1360,27 +1361,27 @@ void CDxfWrite::writeDiametricDim(const double* textMidPoint,
(*m_ssEntity) << "AcDbDimension" << endl;
}
(*m_ssEntity) << " 2" << endl;
(*m_ssEntity) << "*" << getLayerName() << endl;// blockName
(*m_ssEntity) << "*" << getLayerName() << endl; // blockName
(*m_ssEntity) << " 10" << endl;
(*m_ssEntity) << arcPoint1[0] << endl;
(*m_ssEntity) << " 20" << endl;
(*m_ssEntity) << arcPoint1[1] << endl;
(*m_ssEntity) << " 30" << endl;
(*m_ssEntity) << arcPoint1[2] << endl;
(*m_ssEntity) << " 11" << endl;// text mid point
(*m_ssEntity) << " 11" << endl; // text mid point
(*m_ssEntity) << textMidPoint[0] << endl;
(*m_ssEntity) << " 21" << endl;
(*m_ssEntity) << textMidPoint[1] << endl;
(*m_ssEntity) << " 31" << endl;
(*m_ssEntity) << textMidPoint[2] << endl;
(*m_ssEntity) << " 70" << endl;
(*m_ssEntity) << 3 << endl;// dimType 3 = Diameter
// (*m_ssEntity) << " 71" << endl; // not R12
(*m_ssEntity) << 3 << endl; // dimType 3 = Diameter
// (*m_ssEntity) << " 71" << endl; // not R12
// (*m_ssEntity) << 5 << endl; // attachPoint 5 = middle center
(*m_ssEntity) << " 1" << endl;
(*m_ssEntity) << dimText << endl;
(*m_ssEntity) << " 3" << endl;
(*m_ssEntity) << "STANDARD" << endl;// style
(*m_ssEntity) << "STANDARD" << endl; // style
// diametric dims
if (m_version > 12) {
(*m_ssEntity) << "100" << endl;
@@ -1392,7 +1393,7 @@ void CDxfWrite::writeDiametricDim(const double* textMidPoint,
(*m_ssEntity) << arcPoint2[1] << endl;
(*m_ssEntity) << " 35" << endl;
(*m_ssEntity) << arcPoint2[2] << endl;
(*m_ssEntity) << " 40" << endl;// leader length????
(*m_ssEntity) << " 40" << endl; // leader length????
(*m_ssEntity) << 0 << endl;
writeDimBlockPreamble();
@@ -1430,7 +1431,7 @@ void CDxfWrite::writeDimBlockPreamble()
(*m_ssBlock) << "AcDbBlockBegin" << endl;
}
(*m_ssBlock) << " 2" << endl;
(*m_ssBlock) << "*" << getLayerName() << endl;// blockName
(*m_ssBlock) << "*" << getLayerName() << endl; // blockName
(*m_ssBlock) << " 70" << endl;
(*m_ssBlock) << " 1" << endl;
(*m_ssBlock) << " 10" << endl;
@@ -1440,7 +1441,7 @@ void CDxfWrite::writeDimBlockPreamble()
(*m_ssBlock) << " 30" << endl;
(*m_ssBlock) << 0.0 << endl;
(*m_ssBlock) << " 3" << endl;
(*m_ssBlock) << "*" << getLayerName() << endl;// blockName
(*m_ssBlock) << "*" << getLayerName() << endl; // blockName
(*m_ssBlock) << " 1" << endl;
(*m_ssBlock) << " " << endl;
}
@@ -1482,7 +1483,7 @@ void CDxfWrite::writeLinearDimBlock(const double* textMidPoint,
{
Base::Vector3d e1S(e1Start[0], e1Start[1], e1Start[2]);
Base::Vector3d e2S(e2Start[0], e2Start[1], e2Start[2]);
Base::Vector3d dl(dimLine[0], dimLine[1], dimLine[2]);// point on DimLine (somewhere!)
Base::Vector3d dl(dimLine[0], dimLine[1], dimLine[2]); // point on DimLine (somewhere!)
Base::Vector3d perp = dl.DistanceToLineSegment(e2S, e1S);
Base::Vector3d e1E = e1S - perp;
Base::Vector3d e2E = e2S - perp;
@@ -1499,13 +1500,13 @@ void CDxfWrite::writeLinearDimBlock(const double* textMidPoint,
e1E = Base::Vector3d(x, y, 0.0);
x = e2Start[0];
e2E = Base::Vector3d(x, y, 0.0);
perp = Base::Vector3d(0, -1, 0);// down
para = Base::Vector3d(1, 0, 0); // right
perp = Base::Vector3d(0, -1, 0); // down
para = Base::Vector3d(1, 0, 0); // right
if (dimLine[1] > e1Start[1]) {
perp = Base::Vector3d(0, 1, 0);// up
perp = Base::Vector3d(0, 1, 0); // up
}
if (e1Start[0] > e2Start[0]) {
para = Base::Vector3d(-1, 0, 0);// left
para = Base::Vector3d(-1, 0, 0); // left
}
angle = 0;
}
@@ -1526,8 +1527,8 @@ void CDxfWrite::writeLinearDimBlock(const double* textMidPoint,
angle = 90;
}
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0;// magic number calc!
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0; // magic number calc!
putLine(e2S, e2E, m_ssBlock, getBlockHandle(), m_saveBlkRecordHandle);
@@ -1569,7 +1570,7 @@ void CDxfWrite::writeAngularDimBlock(const double* textMidPoint,
const double* endExt2,
const char* dimText)
{
Base::Vector3d e1S(startExt1[0], startExt1[1], startExt1[2]);// apex
Base::Vector3d e1S(startExt1[0], startExt1[1], startExt1[2]); // apex
Base::Vector3d e2S(startExt2[0], startExt2[1], startExt2[2]);
Base::Vector3d e1E(endExt1[0], endExt1[1], endExt1[2]);
Base::Vector3d e2E(endExt2[0], endExt2[1], endExt2[2]);
@@ -1595,7 +1596,7 @@ void CDxfWrite::writeAngularDimBlock(const double* textMidPoint,
double radius = (e2S - linePt).Length();
(*m_ssBlock) << " 0" << endl;
(*m_ssBlock) << "ARC" << endl;// dimline arc
(*m_ssBlock) << "ARC" << endl; // dimline arc
(*m_ssBlock) << " 5" << endl;
(*m_ssBlock) << getBlockHandle() << endl;
if (m_version > 12) {
@@ -1613,21 +1614,21 @@ void CDxfWrite::writeAngularDimBlock(const double* textMidPoint,
(*m_ssBlock) << "AcDbCircle" << endl;
}
(*m_ssBlock) << " 10" << endl;
(*m_ssBlock) << startExt2[0] << endl;// arc center
(*m_ssBlock) << startExt2[0] << endl; // arc center
(*m_ssBlock) << " 20" << endl;
(*m_ssBlock) << startExt2[1] << endl;
(*m_ssBlock) << " 30" << endl;
(*m_ssBlock) << startExt2[2] << endl;
(*m_ssBlock) << " 40" << endl;
(*m_ssBlock) << radius << endl;// radius
(*m_ssBlock) << radius << endl; // radius
if (m_version > 12) {
(*m_ssBlock) << "100" << endl;
(*m_ssBlock) << "AcDbArc" << endl;
}
(*m_ssBlock) << " 50" << endl;
(*m_ssBlock) << startAngle << endl;// start angle
(*m_ssBlock) << startAngle << endl; // start angle
(*m_ssBlock) << " 51" << endl;
(*m_ssBlock) << endAngle << endl;// end angle
(*m_ssBlock) << endAngle << endl; // end angle
putText(dimText,
toVector3d(textMidPoint),
@@ -1650,8 +1651,8 @@ void CDxfWrite::writeAngularDimBlock(const double* textMidPoint,
Base::Vector3d perp1(-tanP1.y, tanP1.x, tanP1.z);
Base::Vector3d tanP2 = (arrow2Start - endTan).Normalize();
Base::Vector3d perp2(-tanP2.y, tanP2.x, tanP2.z);
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0;// magic number calc!
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0; // magic number calc!
Base::Vector3d barb1 = arrow1Start + perp1 * arrowWidth - tanP1 * arrowLen;
Base::Vector3d barb2 = arrow1Start - perp1 * arrowWidth - tanP1 * arrowLen;
@@ -1690,8 +1691,8 @@ void CDxfWrite::writeRadialDimBlock(const double* centerPoint,
Base::Vector3d c(centerPoint[0], centerPoint[1], centerPoint[2]);
Base::Vector3d a(arcPoint[0], arcPoint[1], arcPoint[2]);
Base::Vector3d para = a - c;
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0;// magic number calc!
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0; // magic number calc!
para.Normalize();
Base::Vector3d perp(-para.y, para.x, para.z);
Base::Vector3d arrowStart = a;
@@ -1727,8 +1728,8 @@ void CDxfWrite::writeDiametricDimBlock(const double* textMidPoint,
Base::Vector3d a1(arcPoint1[0], arcPoint1[1], arcPoint1[2]);
Base::Vector3d a2(arcPoint2[0], arcPoint2[1], arcPoint2[2]);
Base::Vector3d para = a2 - a1;
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0;// magic number calc!
double arrowLen = 5.0; // magic number
double arrowWidth = arrowLen / 6.0 / 2.0; // magic number calc!
para.Normalize();
Base::Vector3d perp(-para.y, para.x, para.z);
Base::Vector3d arrowStart = a1;
@@ -1803,7 +1804,7 @@ CDxfRead::CDxfRead(const char* filepath)
m_ColorIndex = 0;
m_eUnits = eMillimeters;
m_measurement_inch = false;
strcpy(m_layer_name, "0");// Default layer name
strcpy(m_layer_name, "0"); // Default layer name
memset(m_section_name, '\0', sizeof(m_section_name));
memset(m_block_name, '\0', sizeof(m_block_name));
m_ignore_errors = true;
@@ -1842,7 +1843,7 @@ double CDxfRead::mm(double value) const
switch (m_eUnits) {
case eUnspecified:
return (value * 1.0);// We don't know any better.
return (value * 1.0); // We don't know any better.
case eInches:
return (value * 25.4);
case eFeet:
@@ -1884,9 +1885,9 @@ double CDxfRead::mm(double value) const
case eParsecs:
return (value * 30856774879000000000.0);
default:
return (value * 1.0);// We don't know any better.
} // End switch
}// End mm() method
return (value * 1.0); // We don't know any better.
} // End switch
} // End mm() method
bool CDxfRead::ReadLine()
@@ -1914,12 +1915,12 @@ bool CDxfRead::ReadLine()
hidden = false;
return true;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
case 6:// line style name follows
case 6: // line style name follows
get_line();
if (m_str[0] == 'h' || m_str[0] == 'H') {
hidden = true;
@@ -2017,7 +2018,7 @@ bool CDxfRead::ReadLine()
}
catch (...) {
if (!IgnoreErrors()) {
throw;// Re-throw the exception.
throw; // Re-throw the exception.
}
}
@@ -2046,7 +2047,7 @@ bool CDxfRead::ReadPoint()
OnReadPoint(s);
return true;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -2113,7 +2114,7 @@ bool CDxfRead::ReadPoint()
}
catch (...) {
if (!IgnoreErrors()) {
throw;// Re-throw the exception.
throw; // Re-throw the exception.
}
}
@@ -2122,10 +2123,10 @@ bool CDxfRead::ReadPoint()
bool CDxfRead::ReadArc()
{
double start_angle = 0.0;// in degrees
double start_angle = 0.0; // in degrees
double end_angle = 0.0;
double radius = 0.0;
double c[3] = {0, 0, 0};// centre
double c[3] = {0, 0, 0}; // centre
double z_extrusion_dir = 1.0;
bool hidden = false;
@@ -2147,12 +2148,12 @@ bool CDxfRead::ReadArc()
hidden = false;
return true;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
case 6:// line style name follows
case 6: // line style name follows
get_line();
if (m_str[0] == 'h' || m_str[0] == 'H') {
hidden = true;
@@ -2285,7 +2286,7 @@ bool CDxfRead::ReadSpline()
ResolveColorIndex();
OnReadSpline(sd);
return true;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -2545,7 +2546,7 @@ bool CDxfRead::ReadSpline()
bool CDxfRead::ReadCircle()
{
double radius = 0.0;
double c[3] = {0, 0, 0};// centre
double c[3] = {0, 0, 0}; // centre
bool hidden = false;
while (!((*m_ifs).eof())) {
@@ -2565,14 +2566,14 @@ bool CDxfRead::ReadCircle()
hidden = false;
return true;
case 6:// line style name follows
case 6: // line style name follows
get_line();
if (m_str[0] == 'h' || m_str[0] == 'H') {
hidden = true;
}
break;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -2649,7 +2650,7 @@ bool CDxfRead::ReadCircle()
bool CDxfRead::ReadText()
{
double c[3];// coordinate
double c[3]; // coordinate
double height = 0.03082;
std::string textPrefix;
@@ -2667,7 +2668,7 @@ bool CDxfRead::ReadText()
switch (n) {
case 0:
return false;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -2771,11 +2772,11 @@ bool CDxfRead::ReadText()
bool CDxfRead::ReadEllipse()
{
double c[3] = {0, 0, 0};// centre
double m[3] = {0, 0, 0};// major axis point
double ratio = 0; // ratio of major to minor axis
double start = 0; // start of arc
double end = 0; // end of arc
double c[3] = {0, 0, 0}; // centre
double m[3] = {0, 0, 0}; // major axis point
double ratio = 0; // ratio of major to minor axis
double start = 0; // start of arc
double end = 0; // end of arc
while (!((*m_ifs).eof())) {
get_line();
@@ -2792,7 +2793,7 @@ bool CDxfRead::ReadEllipse()
ResolveColorIndex();
OnReadEllipse(c, m, ratio, start, end);
return true;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -2963,7 +2964,7 @@ AddPolyLinePoint(CDxfRead* dxf_read, double x, double y, double z, bool bulge_fo
}
catch (...) {
if (!dxf_read->IgnoreErrors()) {
throw;// Re-throw it.
throw; // Re-throw it.
}
}
}
@@ -3012,7 +3013,7 @@ bool CDxfRead::ReadLwPolyLine()
}
next_item_found = true;
break;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -3129,11 +3130,11 @@ bool CDxfRead::ReadVertex(double* pVertex, bool* bulge_found, double* bulge)
switch (n) {
case 0:
ResolveColorIndex();
put_line(m_str);// read one line too many. put it back.
put_line(m_str); // read one line too many. put it back.
return (x_found && y_found);
break;
case 8:// Layer name follows
case 8: // Layer name follows
get_line();
strcpy(m_layer_name, m_str);
break;
@@ -3323,7 +3324,7 @@ void CDxfRead::OnReadCircle(const double* c, double radius, bool hidden)
OnReadCircle(s,
c,
false,
hidden);// false to change direction because otherwise the arc length is zero
hidden); // false to change direction because otherwise the arc length is zero
}
void CDxfRead::OnReadEllipse(const double* c,
@@ -3347,9 +3348,9 @@ void CDxfRead::OnReadEllipse(const double* c,
bool CDxfRead::ReadInsert()
{
double c[3] = {0, 0, 0};// coordinate
double s[3] = {1, 1, 1};// scale
double rot = 0.0; // rotation
double c[3] = {0, 0, 0}; // coordinate
double s[3] = {1, 1, 1}; // scale
double rot = 0.0; // rotation
char name[1024] = {0};
while (!((*m_ifs).eof())) {
@@ -3472,10 +3473,10 @@ bool CDxfRead::ReadInsert()
bool CDxfRead::ReadDimension()
{
double s[3] = {0, 0, 0};// startpoint
double e[3] = {0, 0, 0};// endpoint
double p[3] = {0, 0, 0};// dimpoint
double rot = -1.0; // rotation
double s[3] = {0, 0, 0}; // startpoint
double e[3] = {0, 0, 0}; // endpoint
double p[3] = {0, 0, 0}; // dimpoint
double rot = -1.0; // rotation
while (!((*m_ifs).eof())) {
get_line();
@@ -3701,13 +3702,13 @@ void CDxfRead::put_line(const char* value)
bool CDxfRead::ReadUnits()
{
get_line();// Skip to next line.
get_line();// Skip to next line.
get_line(); // Skip to next line.
get_line(); // Skip to next line.
int n = 0;
if (sscanf(m_str, "%d", &n) == 1) {
m_eUnits = eDxfUnits_t(n);
return (true);
}// End if - then
} // End if - then
else {
printf("CDxfRead::ReadUnits() Failed to get integer from '%s'\n", m_str);
return (false);
@@ -3732,7 +3733,7 @@ bool CDxfRead::ReadLayer()
std::istringstream ss;
ss.imbue(std::locale("C"));
switch (n) {
case 0:// next item found, so finish with line
case 0: // next item found, so finish with line
if (layername.empty()) {
printf("CDxfRead::ReadLayer() - no layer name\n");
return false;
@@ -3740,7 +3741,7 @@ bool CDxfRead::ReadLayer()
m_layer_ColorIndex_map[layername] = colorIndex;
return true;
case 2:// Layer name follows
case 2: // Layer name follows
get_line();
layername = m_str;
break;
@@ -3753,8 +3754,8 @@ bool CDxfRead::ReadLayer()
}
break;
case 6: // linetype name
case 70:// layer flags
case 6: // linetype name
case 70: // layer flags
case 100:
case 290:
case 370:
@@ -3812,8 +3813,8 @@ bool CDxfRead::ReadDWGCodePage()
{
get_line();
get_line();
assert(m_CodePage == nullptr);// If not, we have found two DWGCODEPAGE variables or DoRead was
// called twice on the same CDxfRead object.
assert(m_CodePage == nullptr); // If not, we have found two DWGCODEPAGE variables or DoRead was
// called twice on the same CDxfRead object.
m_CodePage = new std::string(m_str);
return ResolveEncoding();
@@ -3825,7 +3826,7 @@ bool CDxfRead::ResolveEncoding()
delete m_encoding;
m_encoding = nullptr;
}
if (m_version >= R2007) {// Note this does not include RUnknown, but does include RLater
if (m_version >= R2007) { // Note this does not include RUnknown, but does include RLater
m_encoding = new std::string("utf_8");
stringToUTF8 = &CDxfRead::UTF8ToUTF8;
}
@@ -3856,7 +3857,7 @@ bool CDxfRead::ResolveEncoding()
Base::PyGILStateLocker lock;
PyObject* pyDecoder = PyCodec_Decoder(m_encoding->c_str());
if (pyDecoder == nullptr) {
return false;// A key error exception will have been placed.
return false; // A key error exception will have been placed.
}
PyObject* pyUTF8Decoder = PyCodec_Decoder("utf_8");
assert(pyUTF8Decoder != nullptr);
@@ -3916,7 +3917,7 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */)
return;
}
continue;
}// End if - then
} // End if - then
if (!strcmp(m_str, "$MEASUREMENT")) {
get_line();
@@ -3928,21 +3929,21 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */)
}
}
continue;
}// End if - then
} // End if - then
if (!strcmp(m_str, "$ACADVER")) {
if (!ReadVersion()) {
return;
}
continue;
}// End if - then
} // End if - then
if (!strcmp(m_str, "$DWGCODEPAGE")) {
if (!ReadDWGCodePage()) {
return;
}
continue;
}// End if - then
} // End if - then
if (!strcmp(m_str, "0")) {
get_line();
@@ -3955,7 +3956,7 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */)
}
strcpy(m_block_name, "");
}// End if - then
} // End if - then
else if (!strcmp(m_str, "TABLE")) {
get_line();
get_line();
@@ -3977,12 +3978,12 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */)
return;
}
continue;
}// End if - then
} // End if - then
else if (!strcmp(m_str, "ENDSEC")) {
strcpy(m_section_name, "");
strcpy(m_block_name, "");
}// End if - then
} // End if - then
else if (!strcmp(m_str, "LINE")) {
if (!ReadLine()) {
printf("CDxfRead::DoRead() Failed to read line\n");
@@ -4078,7 +4079,7 @@ void CDxfRead::DoRead(const bool ignore_errors /* = false */)
void CDxfRead::ResolveColorIndex()
{
if (m_ColorIndex == ColorBylayer)// if color = layer color, replace by color from layer
if (m_ColorIndex == ColorBylayer) // if color = layer color, replace by color from layer
{
m_ColorIndex = m_layer_ColorIndex_map[std::string(m_layer_name)];
}

View File

@@ -21,11 +21,11 @@
#include <Mod/Import/ImportGlobal.h>
typedef int ColorIndex_t;// DXF color index
typedef int ColorIndex_t; // DXF color index
typedef enum
{
eUnspecified = 0,// Unspecified (No units)
eUnspecified = 0, // Unspecified (No units)
eInches,
eFeet,
eMiles,
@@ -319,7 +319,7 @@ private:
std::map<std::string, ColorIndex_t>
m_layer_ColorIndex_map;// Mapping from layer name -> layer color index
m_layer_ColorIndex_map; // Mapping from layer name -> layer color index
const ColorIndex_t ColorBylayer = 256;
const ColorIndex_t ColorByBlock = 0;
@@ -360,27 +360,27 @@ private:
protected:
ColorIndex_t m_ColorIndex;
eDXFVersion_t m_version;// Version from $ACADVER variable in DXF
eDXFVersion_t m_version; // Version from $ACADVER variable in DXF
const char* (CDxfRead::*stringToUTF8)(const char*) const;
private:
const std::string* m_CodePage;// Code Page name from $DWGCODEPAGE or null if none/not read yet
const std::string* m_CodePage; // Code Page name from $DWGCODEPAGE or null if none/not read yet
// The following was going to be python's canonical name for the encoding, but this is (a) not
// easily found and (b) does not speed up finding the encoding object.
const std::string* m_encoding;// A name for the encoding implied by m_version and m_CodePage
const std::string* m_encoding; // A name for the encoding implied by m_version and m_CodePage
const char* UTF8ToUTF8(const char* encoded) const;
const char* GeneralToUTF8(const char* encoded) const;
public:
ImportExport CDxfRead(const char* filepath);// this opens the file
ImportExport virtual ~CDxfRead(); // this closes the file
ImportExport CDxfRead(const char* filepath); // this opens the file
ImportExport virtual ~CDxfRead(); // this closes the file
ImportExport bool Failed()
{
return m_fail;
}
ImportExport void DoRead(
const bool ignore_errors = false);// this reads the file and calls the following functions
const bool ignore_errors = false); // this reads the file and calls the following functions
ImportExport double mm(double value) const;

View File

@@ -22,7 +22,7 @@
#include "PreCompiled.h"
#if defined(__MINGW32__)
#define WNT// avoid conflict with GUID
#define WNT // avoid conflict with GUID
#endif
#ifndef _PreComp_
#include <climits>
@@ -385,7 +385,7 @@ public:
&Module::exporter,
"export(list,string) -- Export a list of objects into a single file.");
add_varargs_method("ocaf", &Module::ocaf, "ocaf(string) -- Browse the ocaf structure.");
initialize("This module is the ImportGui module.");// register with Python
initialize("This module is the ImportGui module."); // register with Python
}
private:
@@ -917,4 +917,4 @@ PyObject* initModule()
return Base::Interpreter().addModule(new Module);
}
}// namespace ImportGui
} // namespace ImportGui

View File

@@ -32,7 +32,7 @@
#pragma warning(disable : 4005)
#pragma warning(disable : 4251)
#pragma warning(disable : 4503)
#pragma warning(disable : 4786)// specifier longer then 255 chars
#pragma warning(disable : 4786) // specifier longer then 255 chars
#endif
#ifdef _PreComp_
@@ -94,6 +94,6 @@
#endif
#endif//_PreComp_
#endif //_PreComp_
#endif// __PRECOMPILED_GUI__
#endif // __PRECOMPILED_GUI__

View File

@@ -45,7 +45,7 @@ protected:
Gui::ToolBarItem* setupCommandBars() const override;
};
}// namespace ImportGui
} // namespace ImportGui
#endif// IMPORT_WORKBENCH_H
#endif // IMPORT_WORKBENCH_H

View File

@@ -44,4 +44,4 @@
#endif
#endif
#endif// IMPORT_GLOBAL_H
#endif // IMPORT_GLOBAL_H