@@ -170,22 +170,21 @@ class DxfWriteInterface : public DRW_Interface {
170170 }
171171
172172 if (writer->constraint ) {
173- Constraint *c;
174- for (c = writer->constraint ->First (); c; c = writer->constraint ->NextAfter (c)) {
175- if (!writer->NeedToOutput (c)) continue ;
176- switch (c->type ) {
173+ for (Constraint &c : *writer->constraint ) {
174+ if (!writer->NeedToOutput (&c)) continue ;
175+ switch (c.type ) {
177176 case Constraint::Type::PT_PT_DISTANCE: {
178- Vector ap = SK.GetEntity (c-> ptA )->PointGetNum ();
179- Vector bp = SK.GetEntity (c-> ptB )->PointGetNum ();
180- Vector ref = ((ap.Plus (bp)).ScaledBy (0.5 )).Plus (c-> disp .offset );
177+ Vector ap = SK.GetEntity (c. ptA )->PointGetNum ();
178+ Vector bp = SK.GetEntity (c. ptB )->PointGetNum ();
179+ Vector ref = ((ap.Plus (bp)).ScaledBy (0.5 )).Plus (c. disp .offset );
181180 writeAlignedDimension (xfrm (ap), xfrm (bp), xfrm (ref),
182- xfrm (ref), c-> Label (), c-> GetStyle (), c-> valA );
181+ xfrm (ref), c. Label (), c. GetStyle (), c. valA );
183182 break ;
184183 }
185184
186185 case Constraint::Type::PT_LINE_DISTANCE: {
187- Vector pt = SK.GetEntity (c-> ptA )->PointGetNum ();
188- Entity *line = SK.GetEntity (c-> entityA );
186+ Vector pt = SK.GetEntity (c. ptA )->PointGetNum ();
187+ Entity *line = SK.GetEntity (c. entityA );
189188 Vector lA = SK.GetEntity (line->point [0 ])->PointGetNum ();
190189 Vector lB = SK.GetEntity (line->point [1 ])->PointGetNum ();
191190 Vector dl = lB.Minus (lA);
@@ -194,7 +193,7 @@ class DxfWriteInterface : public DRW_Interface {
194193
195194 if (pt.Equals (closest)) break ;
196195
197- Vector ref = ((closest.Plus (pt)).ScaledBy (0.5 )).Plus (c-> disp .offset );
196+ Vector ref = ((closest.Plus (pt)).ScaledBy (0.5 )).Plus (c. disp .offset );
198197 Vector refClosest = ref.ClosestPointOnLine (lA, dl);
199198
200199 double ddl = dl.Dot (dl);
@@ -209,54 +208,54 @@ class DxfWriteInterface : public DRW_Interface {
209208
210209 Vector xdl = xfrm (lB).Minus (xfrm (lA));
211210 writeLinearDimension (xfrm (pt), xfrm (refClosest), xfrm (ref),
212- xfrm (ref), c-> Label (),
211+ xfrm (ref), c. Label (),
213212 atan2 (xdl.y , xdl.x ) / PI * 180.0 + 90.0 , 0.0 ,
214- c-> GetStyle (), c-> valA );
213+ c. GetStyle (), c. valA );
215214 break ;
216215 }
217216
218217 case Constraint::Type::DIAMETER: {
219- Entity *circle = SK.GetEntity (c-> entityA );
218+ Entity *circle = SK.GetEntity (c. entityA );
220219 Vector center = SK.GetEntity (circle->point [0 ])->PointGetNum ();
221220 Quaternion q = SK.GetEntity (circle->normal )->NormalGetNum ();
222221 Vector n = q.RotationN ().WithMagnitude (1 );
223222 double r = circle->CircleGetRadiusNum ();
224223
225- Vector ref = center.Plus (c-> disp .offset );
224+ Vector ref = center.Plus (c. disp .offset );
226225 // Force the label into the same plane as the circle.
227226 ref = ref.Minus (n.ScaledBy (n.Dot (ref) - n.Dot (center)));
228227
229228 Vector rad = ref.Minus (center).WithMagnitude (r);
230- if (/* isRadius*/ c-> other ) {
229+ if (/* isRadius*/ c. other ) {
231230 writeRadialDimension (
232231 xfrm (center), xfrm (center.Plus (rad)),
233- xfrm (ref), c-> Label (), c-> GetStyle (), c-> valA );
232+ xfrm (ref), c. Label (), c. GetStyle (), c. valA );
234233 } else {
235234 writeDiametricDimension (
236235 xfrm (center.Minus (rad)), xfrm (center.Plus (rad)),
237- xfrm (ref), c-> Label (), c-> GetStyle (), c-> valA );
236+ xfrm (ref), c. Label (), c. GetStyle (), c. valA );
238237 }
239238 break ;
240239 }
241240
242241 case Constraint::Type::ANGLE: {
243- Entity *a = SK.GetEntity (c-> entityA );
244- Entity *b = SK.GetEntity (c-> entityB );
242+ Entity *a = SK.GetEntity (c. entityA );
243+ Entity *b = SK.GetEntity (c. entityB );
245244
246245 Vector a0 = a->VectorGetStartPoint ();
247246 Vector b0 = b->VectorGetStartPoint ();
248247 Vector da = a->VectorGetNum ();
249248 Vector db = b->VectorGetNum ();
250- if (/* otherAngle*/ c-> other ) {
249+ if (/* otherAngle*/ c. other ) {
251250 a0 = a0.Plus (da);
252251 da = da.ScaledBy (-1 );
253252 }
254253
255254 bool skew = false ;
256- Vector ref = c-> disp .offset ;
255+ Vector ref = c. disp .offset ;
257256 Vector pi = Vector::AtIntersectionOfLines (a0, a0.Plus (da), b0, b0.Plus (db),
258257 &skew);
259- if (!skew) ref = pi.Plus (c-> disp .offset );
258+ if (!skew) ref = pi.Plus (c. disp .offset );
260259
261260 Vector norm = da.Cross (db);
262261 Vector dna = norm.Cross (da).WithMagnitude (1.0 );
@@ -277,7 +276,7 @@ class DxfWriteInterface : public DRW_Interface {
277276 Vector bisect = da.WithMagnitude (1.0 ).ScaledBy (cos (thetaf / 2.0 )).Plus (
278277 dna.ScaledBy (sin (thetaf / 2.0 )));
279278
280- ref = pi.Plus (bisect.WithMagnitude (c-> disp .offset .Magnitude ()));
279+ ref = pi.Plus (bisect.WithMagnitude (c. disp .offset .Magnitude ()));
281280
282281 // Get lines again to write exact line.
283282 a0 = a->VectorGetStartPoint ();
@@ -287,15 +286,15 @@ class DxfWriteInterface : public DRW_Interface {
287286
288287 writeAngularDimension (
289288 xfrm (a0), xfrm (a0.Plus (da)), xfrm (b0), xfrm (b0.Plus (db)), xfrm (ref),
290- xfrm (ref), c-> Label (), c-> GetStyle (), c-> valA );
289+ xfrm (ref), c. Label (), c. GetStyle (), c. valA );
291290 break ;
292291 }
293292
294293 case Constraint::Type::COMMENT: {
295- Style *st = SK.style .FindById (c-> GetStyle ());
296- writeText (xfrm (c-> disp .offset ), c-> Label (),
297- Style::TextHeight (c-> GetStyle ()) / SS.GW .scale ,
298- st->textAngle , st->textOrigin , c-> GetStyle ());
294+ Style *st = SK.style .FindById (c. GetStyle ());
295+ writeText (xfrm (c. disp .offset ), c. Label (),
296+ Style::TextHeight (c. GetStyle ()) / SS.GW .scale ,
297+ st->textAngle , st->textOrigin , c. GetStyle ());
299298 break ;
300299 }
301300
0 commit comments