@@ -57,6 +57,9 @@ char *Constraint::Label(void) {
5757 sprintf (Ret, " %.3f:1" , valA);
5858 } else if (type == COMMENT) {
5959 strcpy (Ret, comment.str );
60+ } else if (type == DIAMETER) {
61+ // leading spaces for diameter symbol
62+ sprintf (Ret, " %s" , SS.MmToString (valA));
6063 } else {
6164 // valA has units of distance
6265 strcpy (Ret, SS.MmToString (fabs (valA)));
@@ -506,7 +509,31 @@ void Constraint::DrawOrGetDistance(Vector *labelPos) {
506509 mark = mark.WithMagnitude (mark.Magnitude ()-r);
507510 DoLineTrimmedAgainstBox (ref, ref, ref.Minus (mark));
508511
509- DoLabel (ref, labelPos, gr, gu);
512+ Vector topLeft;
513+ DoLabel (ref, &topLeft, gr, gu);
514+ if (labelPos) *labelPos = topLeft;
515+
516+ // Draw the diameter symbol
517+ Vector dc = topLeft;
518+ dc = dc.Plus (gu.WithMagnitude (5 /SS.GW .scale ));
519+ dc = dc.Plus (gr.WithMagnitude (9 /SS.GW .scale ));
520+ double dr = 5 /SS.GW .scale ;
521+ double theta, dtheta = (2 *PI)/12 ;
522+ for (theta = 0 ; theta < 2 *PI-0.01 ; theta += dtheta) {
523+ LineDrawOrGetDistance (
524+ dc.Plus (gu.WithMagnitude (cos (theta)*dr)).Plus (
525+ gr.WithMagnitude (sin (theta)*dr)),
526+ dc.Plus (gu.WithMagnitude (cos (theta+dtheta)*dr)).Plus (
527+ gr.WithMagnitude (sin (theta+dtheta)*dr)));
528+ }
529+ theta = 25 *(PI/180 );
530+ dr *= 1.7 ;
531+ dtheta = PI;
532+ LineDrawOrGetDistance (
533+ dc.Plus (gu.WithMagnitude (cos (theta)*dr)).Plus (
534+ gr.WithMagnitude (sin (theta)*dr)),
535+ dc.Plus (gu.WithMagnitude (cos (theta+dtheta)*dr)).Plus (
536+ gr.WithMagnitude (sin (theta+dtheta)*dr)));
510537 break ;
511538 }
512539
0 commit comments