Merged PR #199 into pymod branch

This commit is contained in:
Matthias Koefferlein 2018-11-24 00:53:23 +01:00
parent 72127a302d
commit 643e58f856
5 changed files with 41 additions and 5 deletions

View File

@ -242,7 +242,8 @@ GenericWriterOptions::add_options (tl::CommandLineOptions &cmd, const std::strin
"* 0: create POLYLINE (default)\n"
"* 1: create LWPOLYLINE\n"
"* 2: decompose into SOLID\n"
"* 3: create HATCH"
"* 3: create HATCH\n"
"* 4: create LINE"
)
;

View File

@ -213,6 +213,7 @@ public:
* 1: create LWPOLYLINE
* 2: decompose into SOLID
* 3: create HATCH
* 4: create LINE: refer to 'void DXFWriter::write_polygon()' definition
*/
int polygon_mode;

View File

@ -507,7 +507,36 @@ DXFWriter::write_polygon (const db::Polygon &polygon, double sf)
}
}
} else if (m_options.polygon_mode == 4) {
//--------------------------------------------------------------------------------------
// Last modified by: Kazzz-S on October 21, 2018 (newly added)
//
// Description: When importing a DXF file comprising POLYLINEs or LWPOLYLINEs into
// Abaqus CAE, they are forcibly converted to points!
// *** This is a "specification" of Abaqus CAE. ***
// In contrast, LINEs are kept as lines, which will be then assembled into
// polygonal objects internally if required.
//--------------------------------------------------------------------------------------
for (unsigned int c = 0; c < polygon.holes () + 1; ++c) {
for (db::Polygon::polygon_contour_iterator p = polygon.contour (c).begin (); p != polygon.contour (c).end (); ++p) {
db::Polygon::polygon_contour_iterator q = p + 1;
if (q == polygon.contour (c).end ()) {
q = polygon.contour (c).begin ();
}
*this << 0 << endl << "LINE" << endl;
*this << 8 << endl; emit_layer (m_layer);
*this << 66 << endl << 1 << endl; // required by TrueView
*this << 10 << endl << (*p).x () * sf << endl;
*this << 20 << endl << (*p).y () * sf << endl;
*this << 11 << endl << (*q).x () * sf << endl;
*this << 21 << endl << (*q).y () * sf << endl;
}
}
}
}
void

8
src/plugins/streamers/dxf/db_plugin/gsiDeclDbDXF.cc Normal file → Executable file
View File

@ -361,7 +361,7 @@ gsi::ClassExt<db::LoadLayoutOptions> dxf_reader_options (
static void set_dxf_polygon_mode (db::SaveLayoutOptions *options, int mode)
{
if (mode < 0 || mode > 3) {
if (mode < 0 || mode > 4) {
throw tl::Exception (tl::to_string (tr ("Invalid polygon mode")));
}
@ -379,9 +379,9 @@ gsi::ClassExt<db::SaveLayoutOptions> dxf_writer_options (
gsi::method_ext ("dxf_polygon_mode=", &set_dxf_polygon_mode,
"@brief Specifies how to write polygons.\n"
"@args mode\n"
"The mode is 0 (write POLYLINE entities), 1 (write LWPOLYLINE entities), 2 (decompose into SOLID entities) or "
"or 3 (write HATCH entities).\n"
"\nThis property has been added in version 0.21.3.\n"
"The mode is 0 (write POLYLINE entities), 1 (write LWPOLYLINE entities), 2 (decompose into SOLID entities), "
"3 (write HATCH entities), or 4 (write LINE entities).\n"
"\nThis property has been added in version 0.21.3. '4', in version 0.25.6.\n"
) +
gsi::method_ext ("dxf_polygon_mode", &get_dxf_polygon_mode,
"@brief Specifies how to write polygons.\n"

View File

@ -73,6 +73,11 @@
<string>Write HATCH entity</string>
</property>
</item>
<item>
<property name="text" >
<string>Write LINE entity</string>
</property>
</item>
</widget>
</item>
</layout>