• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

DomCR / ACadSharp / 18679832337

21 Oct 2025 09:46AM UTC coverage: 77.883% (-0.2%) from 78.126%
18679832337

push

github

web-flow
Merge pull request #832 from DomCR/multileader-dxf

multileader dxf

6920 of 9695 branches covered (71.38%)

Branch coverage included in aggregate %.

341 of 429 new or added lines in 16 files covered. (79.49%)

77 existing lines in 8 files now uncovered.

26664 of 33426 relevant lines covered (79.77%)

110330.18 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

61.26
/src/ACadSharp/Entities/MultiLeader.cs
1
using System;
2
using System.Collections.Generic;
3
using ACadSharp.Attributes;
4
using ACadSharp.Objects;
5
using ACadSharp.Tables;
6

7
using CSMath;
8

9
namespace ACadSharp.Entities
10
{
11
        /// <summary>
12
        /// Represents a <see cref="MultiLeader"/> entity.
13
        /// </summary>
14
        /// <remarks>
15
        /// Object name <see cref="DxfFileToken.EntityMultiLeader"/> <br/>
16
        /// Dxf class name <see cref="DxfSubclassMarker.MultiLeader"/>
17
        /// </remarks>
18
        [DxfName(DxfFileToken.EntityMultiLeader)]
19
        [DxfSubClass(DxfSubclassMarker.MultiLeader)]
20
        public partial class MultiLeader : Entity
21
        {
22
                /// <summary>
23
                /// Gets or sets a <see cref="BlockRecord"/> representing the arrowhead
24
                /// (see <see cref="MultiLeaderStyle.Arrowhead"/>) to be displayed with every leader line.
25
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
26
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.Arrowhead"/> flag is set in the
27
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
28
                /// </summary>
29
                /// <remarks>
30
                /// The value for all leader lines can be overridden for each individual leader line by the
31
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.Arrowhead"/> property when the
32
                /// <see cref="LeaderLinePropertOverrideFlags.Arrowhead"/> flag is set in the
33
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
34
                /// </remarks>
35
                [DxfCodeValue(DxfReferenceType.Handle, 342)]
36
                public BlockRecord Arrowhead
37
                {
38
                        get { return this._arrowhead; }
12✔
39
                        set
40
                        {
×
41
                                this._arrowhead = updateCollection(value, this.Document?.BlockRecords);
×
42
                        }
×
43
                }
44

45
                /// <summary>
46
                /// Gets or sets the arrowhead size (see <see cref="MultiLeaderStyle.Arrowhead"/>)
47
                /// for every leader line
48
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.ArrowheadSize"/> flag is set in the
49
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
50
                /// </summary>
51
                /// <remarks>
52
                /// <para>
53
                /// The value for all leader lines can be overridden for each individual leader line by the
54
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.ArrowheadSize"/> property when the
55
                /// <see cref="LeaderLinePropertOverrideFlags.ArrowheadSize"/> flag is set in the
56
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
57
                /// </para><para>
58
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
59
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.ArrowheadSize"/> is
60
                /// assumed to be used.
61
                /// </para>
62
                /// </remarks>
63
                [DxfCodeValue(42)]
64
                public double ArrowheadSize { get; set; }
5,999✔
65

66
                ///<subject>
67
                /// Gets a list of <see cref="BlockAttribute"/> objects representing
68
                /// a reference to a "block attribute"? and some properties to adjust
69
                /// the attribute.
70
                /// </subject>
71
                public IList<BlockAttribute> BlockAttributes { get; private set; } = new List<BlockAttribute>();
11,215✔
72

73
                /// <summary>
74
                /// Gets or sets a value indicating whether the content of this <see cref="MultiLeader"/>
75
                /// is a text label, a content block, or a tolerance.
76
                /// </summary>
77
                [DxfCodeValue(172)]
78
                public LeaderContentType ContentType { get; set; }
5,994✔
79

80
                /// <summary>
81
                /// Gets the embedded <see cref="MultiLeaderObjectContextData"/> object
82
                /// contains the multileader content (block/text) and the leaders.
83
                /// </summary>
84
                /// <remarks><para>
85
                /// The embedded <see cref="MultiLeaderObjectContextData"/> object is used
86
                /// if the <see cref="EnableAnnotationScale"/> property is <b>false</b>.
87
                /// If <see cref="EnableAnnotationScale"/> is <b>true</b> an alternate
88
                /// <see cref="MultiLeaderObjectContextData"/> object with the respective
89
                /// scaling value that is linked via the <see cref="CadObject.XDictionary"/>
90
                /// property.
91
                /// </para><para>
92
                /// Note: The properties of the various <see cref="MultiLeaderObjectContextData"/> objects
93
                /// are currently not synchronized.
94
                /// </para>
95
                /// </remarks>
96
                public MultiLeaderObjectContextData ContextData
97
                {
98
                        get
99
                        {
14,486✔
100
                                return _contextData;
14,486✔
101
                        }
14,486✔
102
                }
103

104
                /// <summary>
105
                /// Enable Annotation Scale
106
                /// </summary>
107
                [DxfCodeValue(293)]
108
                public bool EnableAnnotationScale { get; set; }
5,999✔
109

110
                /// <summary>
111
                /// Gets or sets a value indicating that leader lines of this <see cref="MultiLeader"/>
112
                /// are to be drawn with a dogleg (see <see cref="MultiLeaderStyle.EnableDogleg"/>).
113
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
114
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.EnableDogleg"/> flag is set in the
115
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
116
                /// </summary>
117
                [DxfCodeValue(291)]
118
                public bool EnableDogleg { get; set; }
5,999✔
119

120
                /// <summary>
121
                /// Gets or sets a value indicating whether landing is enabled.
122
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
123
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.EnableLanding"/> flag is set in the
124
                /// <see cref="PropertyOverrideFlags"/> property.
125
                /// </summary>
126
                [DxfCodeValue(290)]
127
                public bool EnableLanding { get; set; }
5,999✔
128

129
                /// <summary>
130
                /// Leader extended to text
131
                /// </summary>
132
                [DxfCodeValue(295)]
133
                public bool ExtendedToText { get; set; }
1,777✔
134

135
                /// <summary>
136
                /// Gets or sets the landing distance, i.e. the length of the dogleg, for this <see cref="MultiLeader"/>.
137
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
138
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LandingDistance"/> flag is set in the
139
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
140
                /// </summary>
141
                /// <remarks><para>
142
                /// There is only one field for the landing distance in the multileader property grid.
143
                /// The value entered arrives in this property and the <see cref="Objects.MultiLeaderObjectContextData.LeaderRoot.LandingDistance"/>
144
                /// property. If two leader roots exist both receive the same value. I seems
145
                /// <see cref="MultiLeaderPropertyOverrideFlags.LandingDistance"/> flag is never set.
146
                /// </para>
147
                /// </remarks>
148
                [DxfCodeValue(41)]
149
                public double LandingDistance { get; set; }
6,255✔
150

151
                //  TODO Additional Line Type? see Entity.LineType.
152
                /// <summary>
153
                /// Gets or sets <see cref="LineType"/> of the leader lines of this <see cref="MultiLeader"/>
154
                /// (see <see cref="MultiLeaderStyle.LeaderLineType"/>).
155
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
156
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LeaderLineType"/> flag is set in the
157
                /// <see cref="PropertyOverrideFlags"/> property.
158
                /// </summary>
159
                /// <remarks>
160
                /// The setting for all leader lines can be overridden for each individual leader line by the
161
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.LineType"/> property when the
162
                /// <see cref="LeaderLinePropertOverrideFlags.LineType"/> flag is set in the
163
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
164
                /// </remarks>
165
                [DxfCodeValue(DxfReferenceType.Handle, 341)]
166
                public LineType LeaderLineType
167
                {
168
                        get { return this._leaderLineType; }
12✔
169
                        set
170
                        {
1,995✔
171
                                if (value == null)
1,995!
172
                                {
×
173
                                        throw new ArgumentNullException(nameof(value));
×
174
                                }
175

176
                                if (this.Document != null)
1,995!
177
                                {
1,995✔
178
                                        this._leaderLineType = updateCollection(value, this.Document.LineTypes);
1,995✔
179
                                }
1,995✔
180
                                else
181
                                {
×
182
                                        this._leaderLineType = value;
×
183
                                }
×
184
                        }
1,995✔
185
                }
186

187
                //  TODO Additional Line Weight? see Entity.LineWeight.
188
                /// <summary>
189
                /// Gets or sets a value specifying the line weight to be applied to all leader lines of this
190
                /// <see cref="MultiLeader"/> (see <see cref="MultiLeaderStyle.LeaderLineWeight"/>).
191
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
192
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LeaderLineWeight"/> flag is set in the
193
                /// <see cref="PropertyOverrideFlags"/> property.
194
                /// </summary>
195
                /// <remarks>
196
                /// The value for all leader lines can be overridden for each individual leader line by the
197
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.LineWeight"/> property when the
198
                /// <see cref="LeaderLinePropertOverrideFlags.LineWeight"/> flag is set in the
199
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
200
                /// </remarks>
201
                [DxfCodeValue(171)]
202
                public LineWeightType LeaderLineWeight { get; set; }
5,994✔
203

204
                /// <summary>
205
                /// Gets or sets color of the leader lines of this <see cref="MultiLeader"/>
206
                /// (see <see cref="MultiLeaderStyle.LineColor"/>).
207
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
208
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.LineColor"/> flag is set in the
209
                /// <see cref="PropertyOverrideFlags"/> property.
210
                /// </summary>
211
                /// <remarks>
212
                /// The value for all leader lines can be overridden for each individual leader line by the
213
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.LineColor"/> property when the
214
                /// <see cref="LeaderLinePropertOverrideFlags.LineColor"/> flag is set in the
215
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
216
                /// </remarks>
217
                [DxfCodeValue(91)]
218
                public Color LineColor { get; set; }
2,399✔
219

220
                /// <inheritdoc/>
221
                public override string ObjectName => DxfFileToken.EntityMultiLeader;
15,343✔
222

223
                /// <inheritdoc/>
224
                public override ObjectType ObjectType => ObjectType.UNLISTED;
5✔
225

226
                /// <summary>
227
                /// Gets or sets a value indicating the path type of this <see cref="MultiLeader"/>
228
                /// (see <see cref="MultiLeaderStyle.PathType"/>).
229
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
230
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.PathType"/> flag is set in the
231
                /// <see cref="PropertyOverrideFlags"/> property.
232
                /// </summary>
233
                [DxfCodeValue(170)]
234
                public MultiLeaderPathType PathType { get; set; }
6,003✔
235

236
                /// <summary>
237
                /// Gets or sets a value containing a list of flags indicating which multileader
238
                /// properties specified by the associated <see cref="MultiLeaderStyle"/>
239
                /// are to be overridden by properties specified by this <see cref="MultiLeader"/>
240
                /// or the attached <see cref="MultiLeaderObjectContextData"/>.
241
                /// </summary>
242
                [DxfCodeValue(90)]
243
                public MultiLeaderPropertyOverrideFlags PropertyOverrideFlags { get; set; }
6,003✔
244

245
                /// <summary>
246
                /// Gets or sets a scale factor (see <see cref="MultiLeaderStyle.ScaleFactor"/>).
247
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
248
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.ScaleFactor"/> flag is set (see
249
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property).
250
                /// The scale factor is applied by AutoCAD.
251
                /// </summary>
252
                /// <remarks>
253
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
254
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.ScaleFactor"/> is
255
                /// assumed to be relevant.
256
                /// </remarks>
257
                [DxfCodeValue(45)]
258
                public double ScaleFactor { get; set; }
5,999✔
259

260
                /// <summary>
261
                /// Gets a <see cref="MultiLeaderStyle"/> providing reusable style information
262
                /// for this <see cref="MultiLeader"/>.
263
                /// </summary>
264
                [DxfCodeValue(DxfReferenceType.Handle, 340)]
265
                public MultiLeaderStyle Style
266
                {
267
                        get { return this._style; }
1,197✔
268
                        set
269
                        {
5,415✔
270
                                if (value == null)
5,415!
271
                                {
×
272
                                        throw new ArgumentNullException(nameof(value));
×
273
                                }
274

275
                                if (this.Document != null)
5,415!
276
                                {
5,415✔
277
                                        this._style = updateCollection(value, this.Document.MLeaderStyles);
5,415✔
278
                                }
5,415✔
279
                                else
280
                                {
×
281
                                        this._style = value;
×
282
                                }
×
283
                        }
5,415✔
284
                }
285

286
                /// <inheritdoc/>
287
                public override string SubclassMarker => DxfSubclassMarker.MultiLeader;
153,242✔
288

289
                /// <summary>
290
                /// Text Align in IPE (meaning unknown)
291
                /// </summary>
292
                [DxfCodeValue(178)]
293
                public short TextAligninIPE { get; set; }
5,999✔
294

295
                //        TODO According to the OpenDesign_Specification_for_.dwg_files
296
                //        a list of arror head AND a list of block attributes can occur.
297
                //        If both list are empty it ist expected that two BL-fields should
298
                //        occur yielding count=0 for both lists. But when we read two
299
                //        BL-fields we get out of sync. If we read one BL-field everything
300
                //        works fine.
301
                //        We do not understand what a list of arroheads can be used for,
302
                //        and we do not know how to create such a list.
303
                //        The documentation for arrowheads list in OpenDesign_Specification_for_.dwg_files
304
                //        and the DXF Reference are contradicting.
305
                //        Decision:
306
                //                Ommit the Arrowheads property,
307
                //                try to keep the block attributes.
308
                /// <summary>
309
                /// Gets or sets the Text attachment direction for text or block contents.
310
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
311
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAttachmentDirection"/> flag is set in the
312
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
313
                /// </summary>
314
                /// <remarks>
315
                /// <para>
316
                /// This property defines whether the leaders attach to the left/right of the content block/text,
317
                /// or attach to the top/bottom.
318
                /// </para><para>
319
                /// The value for all leader lines can be overridden for each individual leader line by the
320
                /// <see cref="Objects.MultiLeaderObjectContextData.LeaderRoot.TextAttachmentDirection"/> property when the
321
                /// <see cref="MultiLeaderPropertyOverrideFlags.TextAttachmentDirection"/> flag is set in the
322
                /// <see cref="MultiLeaderObjectContextData.LeaderLine.OverrideFlags"/> property.
323
                /// </para>
324
                /// </remarks>
325
                /// <value>
326
                /// A <see cref="TextAttachmentDirectionType"/>.
327
                /// </value>
328
                [DxfCodeValue(271)]
329
                public TextAttachmentDirectionType TextAttachmentDirection { get; set; }
3,309✔
330

331
                /// <summary>
332
                /// Gets or sets a value indicating the text attachment point.
333
                /// </summary>
334
                /// <remarks><para>
335
                ///        The Open Design Specification for DWG files documents this property as <i>Justification</i>,
336
                /// the DXF reference as <i>Text Attachments point</i>.
337
                /// </para><para>
338
                /// This property is also exposed by the <see cref="MultiLeader"/> class
339
                /// (<see cref="MultiLeader.TextAttachmentPoint"/>).
340
                /// The <see cref="MultiLeaderObjectContextData.TextAttachmentPoint"/> property always has the same value
341
                /// and seems to have the respective value as <see cref="MultiLeaderObjectContextData.TextAlignment"/>.
342
                /// The <see cref="MultiLeaderObjectContextData.TextAttachmentPoint"/> property is to be used.
343
                /// </para>
344
                /// </remarks>
345
                [DxfCodeValue(179)]
346
                public TextAttachmentPointType TextAttachmentPoint { get; set; }
6,250✔
347

348
                /// <summary>
349
                /// Gets or sets the text bottom attachment type (see <see cref="MultiLeaderStyle.TextBottomAttachment"/>).
350
                /// This property override the value from <see cref="MultiLeaderStyle"/>
351
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextBottomAttachment"/> flag is set (see
352
                /// <see cref="PropertyOverrideFlags"/> property).
353
                /// </summary>
354
                /// <remarks>
355
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
356
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.TextBottomAttachment"/> is
357
                /// assumed to be used.
358
                /// </remarks>
359
                /// <value>
360
                /// A <see cref="TextAttachmentType"/> having the values
361
                ///         9 = Center,
362
                ///         10 = Underline and Center
363
                /// can be used ("vertical" attachment types).
364
                /// </value>
365
                [DxfCodeValue(272)]
366
                public TextAttachmentType TextBottomAttachment { get; set; }
3,053✔
367

368
                //  public IList<ArrowheadAssociation> Arrowheads { get; } = new List<ArrowheadAssociation>();
369
                /// <summary>
370
                /// Text Direction Negative
371
                /// </summary>
372
                [DxfCodeValue(294)]
373
                public bool TextDirectionNegative { get; set; }
5,999✔
374

375
                /// <summary>
376
                /// Gets or sets the text top attachment type (see <see cref="MultiLeaderStyle.TextTopAttachment"/>).
377
                /// This property override the value from <see cref="MultiLeaderStyle"/>
378
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextTopAttachment"/> flag is set (see
379
                /// <see cref="PropertyOverrideFlags"/> property).
380
                /// </summary>
381
                /// <remarks>
382
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
383
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.TextTopAttachment"/> is
384
                /// assumed to be used.
385
                /// </remarks>
386
                /// <value>
387
                /// A <see cref="TextAttachmentType"/> having the values
388
                ///         9 = Center,
389
                ///         10 = Underline and Center
390
                /// can be used ("vertical" attachment types).
391
                /// </value>
392
                [DxfCodeValue(273)]
393
                public TextAttachmentType TextTopAttachment { get; set; }
3,053✔
394

395
                private BlockRecord _arrowhead;
396

397
                private BlockRecord _blockContent;
398

399
                private MultiLeaderObjectContextData _contextData = new MultiLeaderObjectContextData();
5,610✔
400

401
                private LineType _leaderLineType = LineType.ByLayer;
5,610✔
402

403
                private MultiLeaderStyle _style = MultiLeaderStyle.Default;
5,610✔
404

405
                private TextStyle _textStyle = TextStyle.Default;
5,610✔
406

407
                #region Text Menu Properties
408

409
                /// <summary>
410
                /// Gets or sets the text alignement type.
411
                /// </summary>
412
                /// <remarks><para>
413
                /// The Open Design Specification for DWG documents this property as <i>Unknown</i>,
414
                /// DXF reference as <i>Text Aligment Type</i>.
415
                /// Available DWG and DXF sample documents saved by AutoCAD return always 0=Left.
416
                /// </para><para>
417
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
418
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.TextAlignment"/> is
419
                /// assumed to be used.
420
                /// </para>
421
                /// </remarks>
422
                [DxfCodeValue(175)]
423
                public TextAlignmentType TextAlignment { get; set; }
5,994✔
424

425
                //        TODO How to set this value?
426
                /// <summary>
427
                /// Gets or sets a value indicating the text angle.
428
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
429
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextAngle"/> flag is set (see
430
                /// <see cref="PropertyOverrideFlags"/> property).
431
                /// </summary>
432
                [DxfCodeValue(174)]
433
                public TextAngleType TextAngle { get; set; }
5,994✔
434

435
                /// <summary>
436
                /// Gets or sets the color for the display of the text label.
437
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
438
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextColor"/> flag is set (see
439
                /// <see cref="PropertyOverrideFlags"/> property).
440
                /// </summary>
441
                /// <remarks>
442
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
443
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.TextColor"/> is
444
                /// assumed to be used.
445
                /// </remarks>
446
                [DxfCodeValue(92)]
447
                public Color TextColor { get; set; }
2,399✔
448

449
                /// <summary>
450
                /// Gets or sets a value indicating that the text label is to be drawn with a frame.
451
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
452
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextFrame"/> flag is set (see
453
                /// <see cref="PropertyOverrideFlags"/> property).
454
                /// </summary>
455
                [DxfCodeValue(292)]
456
                public bool TextFrame { get; set; }
6,255✔
457

458
                /// <summary>
459
                /// Gets or sets the text left attachment type (see <see cref="MultiLeaderStyle.TextLeftAttachment"/>).
460
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
461
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextLeftAttachment"/> flag is set (see
462
                /// <see cref="PropertyOverrideFlags"/> property).
463
                /// </summary>
464
                /// <remarks>
465
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
466
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.TextLeftAttachment"/> is
467
                /// assumed to be used.
468
                /// </remarks>
469
                /// <value>
470
                /// A <see cref="TextAttachmentType"/> having the values 0-8 can be used
471
                /// ("horizontal" attachment types).
472
                /// </value>
473
                [DxfCodeValue(173)]
474
                public TextAttachmentType TextLeftAttachment { get; set; }
6,250✔
475

476
                /// <summary>
477
                /// Gets or sets the text right attachment type (see <see cref="MultiLeaderStyle.TextRightAttachment"/>).
478
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
479
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextRightAttachment"/> flag is set (see
480
                /// <see cref="PropertyOverrideFlags"/> property).
481
                /// </summary>
482
                /// <remarks>
483
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
484
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.TextRightAttachment"/> is
485
                /// assumed to be used.
486
                /// </remarks>
487
                /// <value>
488
                /// A <see cref="TextAttachmentType"/> having the values 0-8 can be used
489
                /// ("horizontal" attachment types).
490
                /// </value>
491
                [DxfCodeValue(95)]
492
                public TextAttachmentType TextRightAttachment { get; set; }
5,994✔
493

494
                /// <summary>
495
                /// Gets or sets the <see cref="TextStyle"/> to be used to display the text label of this
496
                /// <see cref="MultiLeader"/>.
497
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
498
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.TextStyle"/> flag is set in the
499
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property.
500
                /// </summary>
501
                /// <remarks>
502
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class
503
                /// (<see cref="MultiLeaderObjectContextData.TextStyle"/>).
504
                /// Values should be equal, the <see cref="MultiLeaderObjectContextData.TextStyle"/>
505
                /// is assumed to be used.
506
                /// </remarks>
507
                [DxfCodeValue(DxfReferenceType.Handle, 343)]
508
                public TextStyle TextStyle
509
                {
510
                        get { return this._textStyle; }
1,197✔
511
                        set
512
                        {
5,415✔
513
                                if (value == null)
5,415!
514
                                {
×
515
                                        throw new ArgumentNullException(nameof(value));
×
516
                                }
517

518
                                if (this.Document != null)
5,415!
519
                                {
5,415✔
520
                                        this._textStyle = updateCollection(value, this.Document.TextStyles);
5,415✔
521
                                }
5,415✔
522
                                else
523
                                {
×
524
                                        this._textStyle = value;
×
525
                                }
×
526
                        }
5,415✔
527
                }
528

529
                #endregion Text Menu Properties
530

531
                #region Block Content Properties
532

533
                /// <summary>
534
                /// Gets a <see cref="BlockRecord"/> containing elements
535
                /// to be drawn as content for the multileader.
536
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
537
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContent"/> flag is set (see
538
                /// <see cref="PropertyOverrideFlags"/> property).
539
                /// </summary>
540
                /// <remarks>
541
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
542
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.BlockContent"/> is
543
                /// assumed to be used.
544
                /// </remarks>
545
                [DxfCodeValue(DxfReferenceType.Handle, 344)]
546
                public BlockRecord BlockContent
547
                {
548
                        get { return this._blockContent; }
12✔
549
                        set
550
                        {
×
551
                                this._blockContent = updateCollection(value, this.Document?.BlockRecords);
×
552
                        }
×
553
                }
554

555
                /// <summary>
556
                /// Gets or sets the block-content color.
557
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
558
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentColor"/> flag is set (see
559
                /// <see cref="PropertyOverrideFlags"/> property).
560
                /// </summary>
561
                /// <remarks>
562
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
563
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.BlockContentColor"/> is
564
                /// assumed to be used.
565
                /// </remarks>
566
                [DxfCodeValue(93)]
567
                public Color BlockContentColor { get; set; }
2,399✔
568

569
                /// <summary>
570
                /// Gets or sets a value indicating whether the multileader connects to the content-block extents
571
                /// or to the content-block base point
572
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentConnection"/> flag is set in the
573
                /// <see cref="PropertyOverrideFlags"/> property.
574
                /// </summary>
575
                /// <remarks>
576
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
577
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.BlockContentConnection"/> is
578
                /// assumed to be used.
579
                /// </remarks>
580
                [DxfCodeValue(176)]
581
                public BlockContentConnectionType BlockContentConnection { get; set; }
5,994✔
582

583
                /// <summary>
584
                /// Gets or sets the rotation of the block content of the multileader.
585
                /// </summary>
586
                /// <remarks>
587
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
588
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.BlockContentRotation"/> is
589
                /// assumed to be used.
590
                /// </remarks>
591
                [DxfCodeValue(DxfReferenceType.IsAngle, 43)]
592
                public double BlockContentRotation { get; set; }
5,999✔
593

594
                /// <summary>
595
                /// Gets or sets the scale factor for block content.
596
                /// This property overrides the value from <see cref="MultiLeaderStyle"/>
597
                /// when the <see cref="MultiLeaderPropertyOverrideFlags.BlockContentScale"/> flag is set (see
598
                /// <see cref="MultiLeader.PropertyOverrideFlags"/> property).
599
                /// </summary>
600
                /// <remarks>
601
                /// This property is also exposed by the <see cref="MultiLeaderObjectContextData"/> class. Values
602
                /// should be equal, the value <see cref="MultiLeaderObjectContextData.BlockContentScale"/> is
603
                /// assumed to be used.
604
                /// </remarks>
605
                [DxfCodeValue(10, 20, 30)]
606
                public XYZ BlockContentScale { get; set; }
23,999✔
607

608
                #endregion Block Content Properties
609

610
                /// <inheritdoc/>
611
                public override void ApplyTransform(Transform transform)
612
                {
×
613
                }
×
614

615
                /// <inheritdoc/>
616
                public override CadObject Clone()
617
                {
3✔
618
                        MultiLeader clone = (MultiLeader)base.Clone();
3✔
619

620
                        clone._contextData = (MultiLeaderObjectContextData)this._contextData.Clone();
3✔
621

622
                        clone.BlockAttributes = new List<BlockAttribute>();
3✔
623
                        foreach (var att in this.BlockAttributes)
9!
624
                        {
×
625
                                clone.BlockAttributes.Add((BlockAttribute)att.Clone());
×
626
                        }
×
627

628
                        clone._style = (MultiLeaderStyle)this._style.Clone();
3✔
629
                        clone._textStyle = (TextStyle)this._textStyle.Clone();
3✔
630
                        clone._leaderLineType = (LineType)this._leaderLineType.Clone();
3✔
631
                        clone._arrowhead = (BlockRecord)this._arrowhead?.Clone();
3!
632
                        clone._blockContent = (BlockRecord)this._blockContent?.Clone();
3!
633

634
                        return clone;
3✔
635
                }
3✔
636

637
                /// <inheritdoc/>
638
                public override BoundingBox GetBoundingBox()
639
                {
1✔
640
                        return BoundingBox.Null;
1✔
641
                }
1✔
642

643
                internal override void AssignDocument(CadDocument doc)
644
                {
5,815✔
645
                        base.AssignDocument(doc);
5,815✔
646

647
                        this._style = updateCollection(this._style, doc.MLeaderStyles);
5,815✔
648
                        this._textStyle = updateCollection(this._textStyle, doc.TextStyles);
5,815✔
649
                        this._leaderLineType = updateCollection(this._leaderLineType, doc.LineTypes);
5,815✔
650
                        this._arrowhead = updateCollection(this._arrowhead, doc.BlockRecords);
5,815✔
651
                        this._blockContent = updateCollection(this._blockContent, doc.BlockRecords);
5,815✔
652

653
                        this.ContextData.AssignDocument(doc);
5,815✔
654

655
                        doc.LineTypes.OnRemove += this.tableOnRemove;
5,815✔
656
                        doc.TextStyles.OnRemove += this.tableOnRemove;
5,815✔
657
                        doc.MLeaderStyles.OnRemove += this.tableOnRemove;
5,815✔
658
                        doc.BlockRecords.OnRemove += this.tableOnRemove;
5,815✔
659
                }
5,815✔
660

661
                internal override void UnassignDocument()
662
                {
390✔
663
                        this.Document.LineTypes.OnRemove -= this.tableOnRemove;
390✔
664
                        this.Document.TextStyles.OnRemove -= this.tableOnRemove;
390✔
665
                        this.Document.MLeaderStyles.OnRemove -= this.tableOnRemove;
390✔
666
                        this.Document.BlockRecords.OnRemove -= this.tableOnRemove;
390✔
667

668
                        this.ContextData.UnassignDocument();
390✔
669

670
                        base.UnassignDocument();
390✔
671

672
                        this._leaderLineType = (LineType)this._leaderLineType.Clone();
390✔
673
                        this._textStyle = (TextStyle)this._textStyle.Clone();
390✔
674
                        this._style = (MultiLeaderStyle)this._style.Clone();
390✔
675
                        this._arrowhead = (BlockRecord)this._arrowhead?.Clone();
390!
676
                        this._blockContent = (BlockRecord)this._blockContent?.Clone();
390!
677
                }
390✔
678

679
                protected override void tableOnRemove(object sender, CollectionChangedEventArgs e)
NEW
680
                {
×
UNCOV
681
                        base.tableOnRemove(sender, e);
×
682

683
                        if (e.Item.Equals(this._style))
×
684
                        {
×
685
                                this._style = this.Document.MLeaderStyles[MultiLeaderStyle.DefaultName];
×
686
                        }
×
687
                        if (e.Item.Equals(this._leaderLineType))
×
688
                        {
×
689
                                this._leaderLineType = this.Document.LineTypes[LineType.ByLayerName];
×
690
                        }
×
691
                        if (e.Item.Equals(this._textStyle))
×
692
                        {
×
693
                                this._textStyle = this.Document.TextStyles[TextStyle.DefaultName];
×
694
                        }
×
695
                        if (e.Item == this._arrowhead)
×
696
                        {
×
697
                                this._arrowhead = null;
×
698
                        }
×
699
                        if (e.Item == this._blockContent)
×
700
                        {
×
701
                                this._blockContent = null;
×
702
                        }
×
703
                }
×
704
        }
705
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc