@@ -53,6 +53,20 @@ static std::vector <std::string> splitString(const std::string line) {
53
53
return v;
54
54
}
55
55
56
+ static bool isHoleDuplicate (EntityList *el, double x, double y, double r) {
57
+ bool duplicate = false ;
58
+ for (int i = 0 ; i < el->n && !duplicate; i++) {
59
+ Entity &en = el->Get (i);
60
+ if (en.type != Entity::Type::CIRCLE)
61
+ continue ;
62
+ Entity *distance = el->FindById (en.distance );
63
+ Entity *center = el->FindById (en.point [0 ]);
64
+ duplicate =
65
+ center->actPoint .x == x && center->actPoint .y == y && distance->actDistance == r;
66
+ }
67
+ return duplicate;
68
+ }
69
+
56
70
// ////////////////////////////////////////////////////////////////////////////
57
71
// Functions for linking an IDF file - we need to create entities that
58
72
// get remapped into a linked group similar to linking .slvs files
@@ -462,9 +476,10 @@ bool LinkIDF(const Platform::Path &filename, EntityList *el, SMesh *m, SShell *s
462
476
double d = stof (values[0 ]);
463
477
double x = stof (values[1 ]);
464
478
double y = stof (values[2 ]);
479
+ bool duplicate = isHoleDuplicate (el, x, y, d / 2 );
465
480
// Only show holes likely to be useful in MCAD to reduce complexity.
466
- if ((d > 1.7 ) || (values[5 ].compare (0 ,3 ," PIN" ) == 0 )
467
- || (values[5 ].compare (0 ,3 ," MTG" ) == 0 )) {
481
+ if ((( d > 1.7 ) || (values[5 ].compare (0 ,3 ," PIN" ) == 0 )
482
+ || (values[5 ].compare (0 ,3 ," MTG" ) == 0 )) && !duplicate) {
468
483
// create the entity
469
484
Vector cent = Vector::From (x,y,0.0 );
470
485
hEntity hcent = newPoint (el, &entityCount, cent);
0 commit comments