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

DomCR / ACadSharp / 21668989262

04 Feb 2026 11:04AM UTC coverage: 77.413% (+0.2%) from 77.238%
21668989262

push

github

web-flow
Merge pull request #963 from DomCR/issue-962_dynamic-parameter-rotation-translation

issue-962

8111 of 11339 branches covered (71.53%)

Branch coverage included in aggregate %.

273 of 301 new or added lines in 16 files covered. (90.7%)

11 existing lines in 2 files now uncovered.

29385 of 37097 relevant lines covered (79.21%)

148585.46 hits per line

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

98.33
/src/ACadSharp/IO/DWG/DwgStreamReaders/DwgObjectReader.Objects.cs
1
using ACadSharp.IO.Templates;
2
using ACadSharp.Objects;
3
using ACadSharp.Objects.Evaluations;
4

5
namespace ACadSharp.IO.DWG;
6

7
internal partial class DwgObjectReader : DwgSectionIO
8
{
9
        private void readBlock1PtParameter(CadBlock1PtParameterTemplate template)
10
        {
134✔
11
                this.readBlockParameter(template);
134✔
12

13
                //1010 1020 1030
14
                template.Block1PtParameter.Location = this._mergedReaders.Read3BitDouble();
134✔
15
                //170
16
                template.Block1PtParameter.Value170 = this._mergedReaders.ReadBitShort();
134✔
17
                //171
18
                template.Block1PtParameter.Value171 = this._mergedReaders.ReadBitShort();
134✔
19
                //93
20
                template.Block1PtParameter.Value93 = this._mergedReaders.ReadBitLong();
134✔
21
        }
134✔
22

23
        private void readBlock2PtParameter(CadBlock2PtParameterTemplate template)
24
        {
1✔
25
                this.readBlockParameter(template);
1✔
26

27
                //1010 1020 1030
28
                template.Block2PtParameter.FirstPoint = this._mergedReaders.Read3BitDouble();
1✔
29
                //1011 1021 1031
30
                template.Block2PtParameter.SecondPoint = this._mergedReaders.Read3BitDouble();
1✔
31

32
                //170 (always 4)
33
                for (int i = 0; i < 4; i++)
10✔
34
                {
4✔
35
                        //171 172 173 174
36
                        short n = this._mergedReaders.ReadBitShort();
4✔
37
                        for (int j = 0; j < n; j++)
12✔
38
                        {
2✔
39
                                //94 95 (I guess 96 97)
40
                                var d = this._mergedReaders.ReadBitLong();
2✔
41
                                //303 304
42
                                var e = this._mergedReaders.ReadVariableText();
2✔
43
                        }
2✔
44
                }
4✔
45

46
                for (int k = 0; k < 4; k++)
10✔
47
                {
4✔
48
                        //91 values
49
                        var f = this._mergedReaders.ReadBitLong();
4✔
50
                }
4✔
51

52
                var value177 = this._mergedReaders.ReadBitShort();
1✔
53
        }
1✔
54

55
        private void readBlockAction(CadBlockActionTemplate template)
56
        {
1✔
57
                this.readBlockElement(template);
1✔
58

59
                BlockAction blockAction = template.BlockAction;
1✔
60

61
                // 1010, 1020, 1030
62
                blockAction.ActionPoint = this._mergedReaders.Read3BitDouble();
1✔
63

64
                //71
65
                short entityCount = this._objectReader.ReadBitShort();
1✔
66
                for (int i = 0; i < entityCount; i++)
4✔
67
                {
1✔
68
                        ulong entityHandle = this.handleReference();
1✔
69
                        template.EntityHandles.Add(entityHandle);
1✔
70
                }
1✔
71

72
                // 70
73
                blockAction.Value70 = this._mergedReaders.ReadBitShort();
1✔
74
        }
1✔
75

76
        private void readBlockActionBasePt(CadBlockActionBasePtTemplate template)
77
        {
1✔
78
                this.readBlockAction(template);
1✔
79

80
                BlockActionBasePt blockActionBasePt = template.CadObject as BlockActionBasePt;
1✔
81

82
                blockActionBasePt.Value1011 = this._mergedReaders.Read3BitDouble();
1✔
83
                
84
                blockActionBasePt.Value92 = this._mergedReaders.ReadBitLong();
1✔
85
                blockActionBasePt.Value301 = this._mergedReaders.ReadVariableText();
1✔
86
                blockActionBasePt.Value93 = this._mergedReaders.ReadBitLong();
1✔
87
                blockActionBasePt.Value302 = this._mergedReaders.ReadVariableText();
1✔
88
                
89
                blockActionBasePt.Value280 = this._mergedReaders.ReadBit();
1✔
90
                blockActionBasePt.Value1012 = this._mergedReaders.Read3BitDouble();
1✔
91
        }
1✔
92

93
        private void readBlockElement(CadBlockElementTemplate template)
94
        {
271✔
95
                this.readEvaluationExpression(template);
271✔
96

97
                //300 name
98
                template.BlockElement.ElementName = this._mergedReaders.ReadVariableText();
271✔
99
                //98
100
                template.BlockElement.Value98 = this._mergedReaders.ReadBitLong();
271✔
101
                //99
102
                template.BlockElement.Value99 = this._mergedReaders.ReadBitLong();
271✔
103
                //1071
104
                template.BlockElement.Value1071 = this._mergedReaders.ReadBitLong();
271✔
105
        }
271✔
106

107
        private void readBlockGrip(CadBlockGripTemplate template)
108
        {
135✔
109
                this.readBlockElement(template);
135✔
110

111
                var blockGrip = template.CadObject as BlockGrip;
135✔
112

113
                blockGrip.Value91 = this._mergedReaders.ReadBitLong();
135✔
114
                blockGrip.Value92 = this._mergedReaders.ReadBitLong();
135✔
115
                blockGrip.Location = this._mergedReaders.Read3BitDouble();
135✔
116
                blockGrip.Value280 = this._mergedReaders.ReadBitAsShort();
135✔
117
                blockGrip.Value93 = this._mergedReaders.ReadBitLong();
135✔
118
        }
135✔
119

120
        private CadTemplate readBlockGripLocationComponent()
121
        {
804✔
122
                BlockGripExpression gripExpression = new BlockGripExpression();
804✔
123
                CadBlockGripExpressionTemplate template = new CadBlockGripExpressionTemplate(gripExpression);
804✔
124

125
                this.readEvaluationExpression(template);
804✔
126

127
                return template;
804✔
128
        }
804✔
129

130
        private void readBlockParameter(CadBlockParameterTemplate template)
131
        {
135✔
132
                this.readBlockElement(template);
135✔
133

134
                //280
135
                template.BlockParameter.Value280 = this._mergedReaders.ReadBit();
135✔
136
                //281
137
                template.BlockParameter.Value281 = this._mergedReaders.ReadBit();
135✔
138
        }
135✔
139

140
        private CadTemplate readBlockRepresentationData()
141
        {
275✔
142
                BlockRepresentationData representation = new BlockRepresentationData();
275✔
143
                CadBlockRepresentationDataTemplate template = new CadBlockRepresentationDataTemplate(representation);
275✔
144

145
                this.readCommonNonEntityData(template);
275✔
146

147
                representation.Value70 = this._mergedReaders.ReadBitShort();
275✔
148
                template.BlockHandle = this.handleReference();
275✔
149

150
                return template;
275✔
151
        }
275✔
152

153
        private CadTemplate readBlockRotateAction()
154
        {
1✔
155
                BlockRotationAction rotationAction = new();
1✔
156
                CadBlockRotationActionTemplate template = new(rotationAction);
1✔
157

158
                this.readBlockActionBasePt(template);
1✔
159

160
                rotationAction.Value94 = this._mergedReaders.ReadBitLong();
1✔
161
                rotationAction. Value303 = this._mergedReaders.ReadVariableText();
1✔
162

163
                return template;
1✔
164
        }
1✔
165

166
        private CadTemplate readBlockRotationParameter()
167
        {
1✔
168
                BlockRotationParameter blockRotationParameter = new();
1✔
169
                CadBlockRotationParameterTemplate template = new CadBlockRotationParameterTemplate(blockRotationParameter);
1✔
170

171
                this.readBlock2PtParameter(template);
1✔
172

173
                //1011 1021 1031
174
                blockRotationParameter.Point = this._mergedReaders.Read3BitDouble();
1✔
175
                //305
176
                blockRotationParameter.Name = this._mergedReaders.ReadVariableText();
1✔
177
                //306
178
                blockRotationParameter.Description = this._mergedReaders.ReadVariableText();
1✔
179
                //140
180
                blockRotationParameter.NameOffset = this._mergedReaders.ReadBitDouble();
1✔
181

182
                //307 missing text?
183

184
                blockRotationParameter.Value96 = this._mergedReaders.ReadBitLong();
1✔
185
                blockRotationParameter.Value141 = this._mergedReaders.ReadBitDouble();
1✔
186
                blockRotationParameter.Value142 = this._mergedReaders.ReadBitDouble();
1✔
187
                blockRotationParameter.Value143 = this._mergedReaders.ReadBitDouble();
1✔
188

189
                blockRotationParameter.Value175 = this._mergedReaders.ReadBitLong();
1✔
190

191
                return template;
1✔
192
        }
1✔
193

194
        private CadTemplate readBlockVisibilityParameter()
195
        {
134✔
196
                BlockVisibilityParameter blockVisibilityParameter = new BlockVisibilityParameter();
134✔
197
                CadBlockVisibilityParameterTemplate template = new CadBlockVisibilityParameterTemplate(blockVisibilityParameter);
134✔
198

199
                this.readBlock1PtParameter(template);
134✔
200

201
                //281
202
                blockVisibilityParameter.Value281 = this._mergedReaders.ReadBit();
134✔
203
                //301
204
                blockVisibilityParameter.Name = this._mergedReaders.ReadVariableText();
134✔
205
                //302
206
                blockVisibilityParameter.Description = this._mergedReaders.ReadVariableText();
134✔
207
                //missing bit??        91 should be an int
208
                blockVisibilityParameter.Value91 = this._mergedReaders.ReadBit();
134✔
209

210
                //DXF 93 Total entities count
211
                var totalEntitiesCount = this._objectReader.ReadBitLong();
134✔
212
                for (int i = 0; i < totalEntitiesCount; i++)
544✔
213
                {
138✔
214
                        //331
215
                        template.EntityHandles.Add(this.handleReference());
138✔
216
                }
138✔
217

218
                //DXF 92 states count
219
                var nstates = this._objectReader.ReadBitLong();
134✔
220
                for (int j = 0; j < nstates; j++)
1,340✔
221
                {
536✔
222
                        template.StateTemplates.Add(this.readState());
536✔
223
                }
536✔
224

225
                return template;
134✔
226
        }
134✔
227

228
        private void readEvaluationExpression(CadEvaluationExpressionTemplate template)
229
        {
1,075✔
230
                this.readCommonNonEntityData(template);
1,075✔
231

232
                //AcDbEvalExpr
233
                var unknown = this._objectReader.ReadBitLong();
1,075✔
234

235
                //98
236
                template.CadObject.Value98 = this._objectReader.ReadBitLong();
1,075✔
237
                //99
238
                template.CadObject.Value99 = this._objectReader.ReadBitLong();
1,075✔
239

240
                //Code value
241
                short code = this._mergedReaders.ReadBitShort();
1,075✔
242
                if (code > 0)
1,075✔
243
                {
804✔
244
                        var groupValue = GroupCodeValue.TransformValue(code);
804✔
245
                        switch (groupValue)
804!
246
                        {
247
                                case GroupCodeValueType.Double:
248
                                case GroupCodeValueType.ExtendedDataDouble:
249
                                        this._mergedReaders.ReadBitDouble();
804✔
250
                                        break;
804✔
251
                                default:
NEW
252
                                        throw new System.NotImplementedException($"[EvaluationExpression] Code not implemented {groupValue}");
×
253
                        }
254
                }
804✔
255

256
                //90
257
                template.CadObject.Id = this._objectReader.ReadBitLong();
1,075✔
258
        }
1,075✔
259

260
        private CadBlockVisibilityParameterTemplate.StateTemplate readState()
261
        {
536✔
262
                CadBlockVisibilityParameterTemplate.StateTemplate template = new CadBlockVisibilityParameterTemplate.StateTemplate();
536✔
263

264
                template.State.Name = this._textReader.ReadVariableText();
536✔
265

266
                //DXF 94 subset count 1
267
                int n1 = this._objectReader.ReadBitLong();
536✔
268
                for (int i = 0; i < n1; i++)
1,894✔
269
                {
411✔
270
                        //332
271
                        template.EntityHandles.Add(this.handleReference());
411✔
272
                }
411✔
273

274
                //DXF 95 subset count 2
275
                var n2 = this._objectReader.ReadBitLong();
536✔
276
                for (int i = 0; i < n2; i++)
4,264✔
277
                {
1,596✔
278
                        //333
279
                        template.ExpressionHandles.Add(this.handleReference());
1,596✔
280
                }
1,596✔
281

282
                return template;
536✔
283
        }
536✔
284
}
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