Show IDF keepout regions as construction entities.
This commit is contained in:
parent
e74e202465
commit
b5fb1dd429
@ -77,7 +77,7 @@ static hEntity newPoint(EntityList *el, int *id, Vector p, bool visible = true)
|
|||||||
return en.h;
|
return en.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static hEntity newLine(EntityList *el, int *id, hEntity p0, hEntity p1) {
|
static hEntity newLine(EntityList *el, int *id, hEntity p0, hEntity p1, bool keepout) {
|
||||||
Entity en = {};
|
Entity en = {};
|
||||||
en.type = Entity::Type::LINE_SEGMENT;
|
en.type = Entity::Type::LINE_SEGMENT;
|
||||||
en.point[0] = p0;
|
en.point[0] = p0;
|
||||||
@ -85,8 +85,8 @@ static hEntity newLine(EntityList *el, int *id, hEntity p0, hEntity p1) {
|
|||||||
en.extraPoints = 0;
|
en.extraPoints = 0;
|
||||||
en.timesApplied = 0;
|
en.timesApplied = 0;
|
||||||
en.group.v = 493;
|
en.group.v = 493;
|
||||||
en.construction = false;
|
en.construction = keepout;
|
||||||
en.style.v = Style::ACTIVE_GRP;
|
en.style.v = keepout? Style::CONSTRUCTION : Style::ACTIVE_GRP;
|
||||||
en.actVisible = true;
|
en.actVisible = true;
|
||||||
en.forceHidden = false;
|
en.forceHidden = false;
|
||||||
|
|
||||||
@ -117,7 +117,7 @@ static hEntity newNormal(EntityList *el, int *id, Quaternion normal) {
|
|||||||
return en.h;
|
return en.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static hEntity newArc(EntityList *el, int *id, hEntity p0, hEntity p1, hEntity pc, hEntity hnorm) {
|
static hEntity newArc(EntityList *el, int *id, hEntity p0, hEntity p1, hEntity pc, hEntity hnorm, bool keepout) {
|
||||||
Entity en = {};
|
Entity en = {};
|
||||||
en.type = Entity::Type::ARC_OF_CIRCLE;
|
en.type = Entity::Type::ARC_OF_CIRCLE;
|
||||||
en.point[0] = pc;
|
en.point[0] = pc;
|
||||||
@ -127,8 +127,8 @@ static hEntity newArc(EntityList *el, int *id, hEntity p0, hEntity p1, hEntity p
|
|||||||
en.extraPoints = 0;
|
en.extraPoints = 0;
|
||||||
en.timesApplied = 0;
|
en.timesApplied = 0;
|
||||||
en.group.v = 403;
|
en.group.v = 403;
|
||||||
en.construction = false;
|
en.construction = keepout;
|
||||||
en.style.v = Style::ACTIVE_GRP;
|
en.style.v = keepout? Style::CONSTRUCTION : Style::ACTIVE_GRP;
|
||||||
en.actVisible = true;
|
en.actVisible = true;
|
||||||
en.forceHidden = false; *id = *id+1;
|
en.forceHidden = false; *id = *id+1;
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ static hEntity newDistance(EntityList *el, int *id, double distance) {
|
|||||||
return en.h;
|
return en.h;
|
||||||
}
|
}
|
||||||
|
|
||||||
static hEntity newCircle(EntityList *el, int *id, hEntity p0, hEntity hdist, hEntity hnorm) {
|
static hEntity newCircle(EntityList *el, int *id, hEntity p0, hEntity hdist, hEntity hnorm, bool keepout) {
|
||||||
Entity en = {};
|
Entity en = {};
|
||||||
en.type = Entity::Type::CIRCLE;
|
en.type = Entity::Type::CIRCLE;
|
||||||
en.point[0] = p0;
|
en.point[0] = p0;
|
||||||
@ -167,8 +167,8 @@ static hEntity newCircle(EntityList *el, int *id, hEntity p0, hEntity hdist, hEn
|
|||||||
en.extraPoints = 0;
|
en.extraPoints = 0;
|
||||||
en.timesApplied = 0;
|
en.timesApplied = 0;
|
||||||
en.group.v = 399;
|
en.group.v = 399;
|
||||||
en.construction = false;
|
en.construction = keepout;
|
||||||
en.style.v = Style::ACTIVE_GRP;
|
en.style.v = keepout? Style::CONSTRUCTION : Style::ACTIVE_GRP;
|
||||||
en.actVisible = true;
|
en.actVisible = true;
|
||||||
en.forceHidden = false;
|
en.forceHidden = false;
|
||||||
|
|
||||||
@ -196,18 +196,18 @@ static Vector ArcCenter(Vector p0, Vector p1, double angle) {
|
|||||||
// Positive angles are counter clockwise, negative are clockwise. An angle of 360
|
// Positive angles are counter clockwise, negative are clockwise. An angle of 360
|
||||||
// indicates a circle centered at x1,y1 passing through x2,y2 and is a complete loop.
|
// indicates a circle centered at x1,y1 passing through x2,y2 and is a complete loop.
|
||||||
static void CreateEntity(EntityList *el, int *id, hEntity h0, hEntity h1, hEntity hnorm,
|
static void CreateEntity(EntityList *el, int *id, hEntity h0, hEntity h1, hEntity hnorm,
|
||||||
Vector p0, Vector p1, double angle) {
|
Vector p0, Vector p1, double angle, bool keepout) {
|
||||||
if (angle == 0.0) {
|
if (angle == 0.0) {
|
||||||
//line
|
//line
|
||||||
if(p0.Equals(p1)) return;
|
if(p0.Equals(p1)) return;
|
||||||
|
|
||||||
newLine(el, id, h0, h1);
|
newLine(el, id, h0, h1, keepout);
|
||||||
|
|
||||||
} else if(angle == 360.0) {
|
} else if(angle == 360.0) {
|
||||||
// circle
|
// circle
|
||||||
double d = p1.Minus(p0).Magnitude();
|
double d = p1.Minus(p0).Magnitude();
|
||||||
hEntity hd = newDistance(el, id, d);
|
hEntity hd = newDistance(el, id, d);
|
||||||
newCircle(el, id, h1, hd, hnorm);
|
newCircle(el, id, h1, hd, hnorm, keepout);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
// arc
|
// arc
|
||||||
@ -226,7 +226,7 @@ static void CreateEntity(EntityList *el, int *id, hEntity h0, hEntity h1, hEntit
|
|||||||
}
|
}
|
||||||
Vector c = m.Minus(perp.ScaledBy(dist));
|
Vector c = m.Minus(perp.ScaledBy(dist));
|
||||||
hEntity hc = newPoint(el, id, c, /*visible=*/false);
|
hEntity hc = newPoint(el, id, c, /*visible=*/false);
|
||||||
newArc(el, id, h0, h1, hc, hnorm);
|
newArc(el, id, h0, h1, hc, hnorm, keepout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,10 +355,9 @@ bool LinkIDF(const Platform::Path &filename, EntityList *el, SMesh *m, SShell *s
|
|||||||
} else if (line.find(".BOARD_OUTLINE") == 0) {
|
} else if (line.find(".BOARD_OUTLINE") == 0) {
|
||||||
section = board_outline;
|
section = board_outline;
|
||||||
record_number = 1;
|
record_number = 1;
|
||||||
// no keepouts for now - they should also be shown as construction?
|
} else if (line.find(".ROUTE_KEEPOUT") == 0) {
|
||||||
// } else if (line.find(".ROUTE_KEEPOUT") == 0) {
|
section = routing_keepout;
|
||||||
// section = routing_keepout;
|
record_number = 1;
|
||||||
// record_number = 1;
|
|
||||||
} else if(line.find(".DRILLED_HOLES") == 0) {
|
} else if(line.find(".DRILLED_HOLES") == 0) {
|
||||||
section = drilled_holes;
|
section = drilled_holes;
|
||||||
record_number = 1;
|
record_number = 1;
|
||||||
@ -433,13 +432,15 @@ bool LinkIDF(const Platform::Path &filename, EntityList *el, SMesh *m, SShell *s
|
|||||||
bool vis = (ang == 360.0);
|
bool vis = (ang == 360.0);
|
||||||
if (bottomEntities) {
|
if (bottomEntities) {
|
||||||
hEntity hp = newPoint(el, &entityCount, point, /*visible=*/vis);
|
hEntity hp = newPoint(el, &entityCount, point, /*visible=*/vis);
|
||||||
CreateEntity(el, &entityCount, hprev, hp, hnorm, pprev, point, ang);
|
CreateEntity(el, &entityCount, hprev, hp, hnorm, pprev, point, ang,
|
||||||
|
(section == routing_keepout) );
|
||||||
pprev = point;
|
pprev = point;
|
||||||
hprev = hp;
|
hprev = hp;
|
||||||
}
|
}
|
||||||
if (topEntities) {
|
if (topEntities) {
|
||||||
hEntity hp = newPoint(el, &entityCount, pTop, /*visible=*/vis);
|
hEntity hp = newPoint(el, &entityCount, pTop, /*visible=*/vis);
|
||||||
CreateEntity(el, &entityCount, hprevTop, hp, hnorm, pprevTop, pTop, ang);
|
CreateEntity(el, &entityCount, hprevTop, hp, hnorm, pprevTop, pTop,
|
||||||
|
ang, (section == routing_keepout) );
|
||||||
pprevTop = pTop;
|
pprevTop = pTop;
|
||||||
hprevTop = hp;
|
hprevTop = hp;
|
||||||
}
|
}
|
||||||
@ -467,12 +468,12 @@ bool LinkIDF(const Platform::Path &filename, EntityList *el, SMesh *m, SShell *s
|
|||||||
Vector cent = Vector::From(x,y,0.0);
|
Vector cent = Vector::From(x,y,0.0);
|
||||||
hEntity hcent = newPoint(el, &entityCount, cent);
|
hEntity hcent = newPoint(el, &entityCount, cent);
|
||||||
hEntity hdist = newDistance(el, &entityCount, d/2);
|
hEntity hdist = newDistance(el, &entityCount, d/2);
|
||||||
newCircle(el, &entityCount, hcent, hdist, hnorm);
|
newCircle(el, &entityCount, hcent, hdist, hnorm, false);
|
||||||
// and again for the top
|
// and again for the top
|
||||||
Vector cTop = Vector::From(x,y,board_thickness);
|
Vector cTop = Vector::From(x,y,board_thickness);
|
||||||
hcent = newPoint(el, &entityCount, cTop);
|
hcent = newPoint(el, &entityCount, cTop);
|
||||||
hdist = newDistance(el, &entityCount, d/2);
|
hdist = newDistance(el, &entityCount, d/2);
|
||||||
newCircle(el, &entityCount, hcent, hdist, hnorm);
|
newCircle(el, &entityCount, hcent, hdist, hnorm, false);
|
||||||
// create the curves for the extrusion
|
// create the curves for the extrusion
|
||||||
Vector pt = Vector::From(x+d/2, y, 0.0);
|
Vector pt = Vector::From(x+d/2, y, 0.0);
|
||||||
MakeBeziersForArcs(&sbl, cent, pt, pt, normal, 360.0);
|
MakeBeziersForArcs(&sbl, cent, pt, pt, normal, 360.0);
|
||||||
|
Loading…
Reference in New Issue
Block a user