Skip to main content

step_io/generated/
author.rs

1// @generated by codegen. DO NOT EDIT.
2// Schema-faithful model + generic 2-pass read + topo write.
3
4//! The strict authoring layer — [`Ap242Author`], one validated
5//! constructor per AP242 entity.
6
7use super::model::*;
8
9/// An authoring-time rejection: the input cannot be part of a strict AP242
10/// model. These fire while an adapter is being developed; a correct adapter
11/// never triggers them.
12#[derive(Debug, Clone, PartialEq, Eq)]
13pub enum AuthorError {
14    /// The referenced entity kind is not legal in AP242.
15    NotAp242 { entity: &'static str },
16    /// The referenced id does not point at an existing entity.
17    DanglingRef { entity: &'static str },
18    /// The part set of a complex instance violates a schema rule.
19    InvalidComplex { reason: &'static str },
20    /// An aggregate attribute's element count is outside the schema's
21    /// cardinality bounds (e.g. `SET [1:?]` given an empty set).
22    Cardinality {
23        entity: &'static str,
24        attribute: &'static str,
25        got: usize,
26        min: usize,
27        max: Option<usize>,
28    },
29}
30
31impl std::fmt::Display for AuthorError {
32    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
33        match self {
34            AuthorError::NotAp242 { entity } => {
35                write!(f, "{entity} is not legal in AP242 output")
36            }
37            AuthorError::DanglingRef { entity } => {
38                write!(f, "dangling reference to {entity}")
39            }
40            AuthorError::InvalidComplex { reason } => {
41                write!(f, "invalid complex instance: {reason}")
42            }
43            AuthorError::Cardinality {
44                entity,
45                attribute,
46                got,
47                min,
48                max,
49            } => match max {
50                Some(max) => write!(
51                    f,
52                    "{entity}.{attribute}: {got} elements outside [{min}:{max}]"
53                ),
54                None => write!(f, "{entity}.{attribute}: {got} elements, minimum {min}"),
55            },
56        }
57    }
58}
59
60impl std::error::Error for AuthorError {}
61
62/// Strict AP242 authoring handle. Owns the model privately: entities enter
63/// only through the generated constructors, so everything inside is AP242 by
64/// construction. [`Ap242Author::finish`] emits the Part 21 text.
65#[derive(Default)]
66pub struct Ap242Author {
67    model: StepModel,
68}
69
70impl Ap242Author {
71    pub fn new() -> Self {
72        Self::default()
73    }
74
75    /// Emit the model as AP242 (edition 2 IS) Part 21 text. The header's
76    /// `FILE_SCHEMA` is stamped AP242 — the authoring layer's schema.
77    pub fn finish(mut self) -> String {
78        self.model.header.schema = super::schema::ap242e2_schema_id();
79        crate::emit::write(&self.model)
80    }
81
82    /// [`Ap242Author::finish`] with explicit Part 21 HEADER fields. The
83    /// header's `schema` is overwritten with AP242 regardless of input.
84    pub fn finish_with_header(mut self, header: &crate::header::FileHeader) -> String {
85        self.model.header = header.clone();
86        self.finish()
87    }
88
89    /// `ACTION` — strict AP242 constructor.
90    pub fn add_action(
91        &mut self,
92        name: String,
93        description: Option<String>,
94        chosen_method: ActionMethodRef,
95    ) -> Result<ActionId, AuthorError> {
96        check_action_method_ref(&self.model, &chosen_method)?;
97        Ok(ActionId(self.model.action_arena.push(Action {
98            name,
99            description,
100            chosen_method,
101        })))
102    }
103
104    /// `ACTION_ASSIGNMENT` — strict AP242 constructor.
105    pub fn add_action_assignment(
106        &mut self,
107        assigned_action: ActionRef,
108    ) -> Result<ActionAssignmentId, AuthorError> {
109        check_action_ref(&self.model, &assigned_action)?;
110        Ok(ActionAssignmentId(
111            self.model
112                .action_assignment_arena
113                .push(ActionAssignment { assigned_action }),
114        ))
115    }
116
117    /// `ACTION_DIRECTIVE` — strict AP242 constructor.
118    pub fn add_action_directive(
119        &mut self,
120        name: String,
121        description: Option<String>,
122        analysis: String,
123        comment: String,
124        requests: Vec<VersionedActionRequestRef>,
125    ) -> Result<ActionDirectiveId, AuthorError> {
126        {
127            let x = &requests;
128            if x.len() < 1 {
129                return Err(AuthorError::Cardinality {
130                    entity: "ACTION_DIRECTIVE",
131                    attribute: "requests",
132                    got: x.len(),
133                    min: 1,
134                    max: None,
135                });
136            }
137        }
138        for e0 in &requests {
139            check_versioned_action_request_ref(&self.model, e0)?;
140        }
141        Ok(ActionDirectiveId(self.model.action_directive_arena.push(
142            ActionDirective {
143                name,
144                description,
145                analysis,
146                comment,
147                requests,
148            },
149        )))
150    }
151
152    /// `ACTION_METHOD` — strict AP242 constructor.
153    pub fn add_action_method(
154        &mut self,
155        name: String,
156        description: Option<String>,
157        consequence: String,
158        purpose: String,
159    ) -> Result<ActionMethodId, AuthorError> {
160        Ok(ActionMethodId(self.model.action_method_arena.push(
161            ActionMethod {
162                name,
163                description,
164                consequence,
165                purpose,
166            },
167        )))
168    }
169
170    /// `ACTION_METHOD_RELATIONSHIP` — strict AP242 constructor.
171    pub fn add_action_method_relationship(
172        &mut self,
173        name: String,
174        description: Option<String>,
175        relating_method: ActionMethodRef,
176        related_method: ActionMethodRef,
177    ) -> Result<ActionMethodRelationshipId, AuthorError> {
178        check_action_method_ref(&self.model, &relating_method)?;
179        check_action_method_ref(&self.model, &related_method)?;
180        Ok(ActionMethodRelationshipId(
181            self.model
182                .action_method_relationship_arena
183                .push(ActionMethodRelationship {
184                    name,
185                    description,
186                    relating_method,
187                    related_method,
188                }),
189        ))
190    }
191
192    /// `ACTION_PROPERTY` — strict AP242 constructor.
193    pub fn add_action_property(
194        &mut self,
195        name: String,
196        description: String,
197        definition: CharacterizedActionDefinitionRef,
198    ) -> Result<ActionPropertyId, AuthorError> {
199        check_characterized_action_definition_ref(&self.model, &definition)?;
200        Ok(ActionPropertyId(self.model.action_property_arena.push(
201            ActionProperty {
202                name,
203                description,
204                definition,
205            },
206        )))
207    }
208
209    /// `ACTION_RELATIONSHIP` — strict AP242 constructor.
210    pub fn add_action_relationship(
211        &mut self,
212        name: String,
213        description: Option<String>,
214        relating_action: ActionRef,
215        related_action: ActionRef,
216    ) -> Result<ActionRelationshipId, AuthorError> {
217        check_action_ref(&self.model, &relating_action)?;
218        check_action_ref(&self.model, &related_action)?;
219        Ok(ActionRelationshipId(
220            self.model
221                .action_relationship_arena
222                .push(ActionRelationship {
223                    name,
224                    description,
225                    relating_action,
226                    related_action,
227                }),
228        ))
229    }
230
231    /// `ACTION_REQUEST_ASSIGNMENT` — strict AP242 constructor.
232    pub fn add_action_request_assignment(
233        &mut self,
234        assigned_action_request: VersionedActionRequestRef,
235    ) -> Result<ActionRequestAssignmentId, AuthorError> {
236        check_versioned_action_request_ref(&self.model, &assigned_action_request)?;
237        Ok(ActionRequestAssignmentId(
238            self.model
239                .action_request_assignment_arena
240                .push(ActionRequestAssignment {
241                    assigned_action_request,
242                }),
243        ))
244    }
245
246    /// `ACTION_REQUEST_SOLUTION` — strict AP242 constructor.
247    pub fn add_action_request_solution(
248        &mut self,
249        method: ActionMethodRef,
250        request: VersionedActionRequestRef,
251    ) -> Result<ActionRequestSolutionId, AuthorError> {
252        check_action_method_ref(&self.model, &method)?;
253        check_versioned_action_request_ref(&self.model, &request)?;
254        Ok(ActionRequestSolutionId(
255            self.model
256                .action_request_solution_arena
257                .push(ActionRequestSolution { method, request }),
258        ))
259    }
260
261    /// `ACTION_RESOURCE` — strict AP242 constructor.
262    pub fn add_action_resource(
263        &mut self,
264        name: String,
265        description: Option<String>,
266        usage: Vec<SupportedItemRef>,
267        kind: ActionResourceTypeRef,
268    ) -> Result<ActionResourceId, AuthorError> {
269        {
270            let x = &usage;
271            if x.len() < 1 {
272                return Err(AuthorError::Cardinality {
273                    entity: "ACTION_RESOURCE",
274                    attribute: "usage",
275                    got: x.len(),
276                    min: 1,
277                    max: None,
278                });
279            }
280        }
281        for e0 in &usage {
282            check_supported_item_ref(&self.model, e0)?;
283        }
284        check_action_resource_type_ref(&self.model, &kind)?;
285        Ok(ActionResourceId(self.model.action_resource_arena.push(
286            ActionResource {
287                name,
288                description,
289                usage,
290                kind,
291            },
292        )))
293    }
294
295    /// `ACTION_RESOURCE_RELATIONSHIP` — strict AP242 constructor.
296    pub fn add_action_resource_relationship(
297        &mut self,
298        name: String,
299        description: Option<String>,
300        relating_resource: ActionResourceRef,
301        related_resource: ActionResourceRef,
302    ) -> Result<ActionResourceRelationshipId, AuthorError> {
303        check_action_resource_ref(&self.model, &relating_resource)?;
304        check_action_resource_ref(&self.model, &related_resource)?;
305        Ok(ActionResourceRelationshipId(
306            self.model
307                .action_resource_relationship_arena
308                .push(ActionResourceRelationship {
309                    name,
310                    description,
311                    relating_resource,
312                    related_resource,
313                }),
314        ))
315    }
316
317    /// `ACTION_RESOURCE_REQUIREMENT` — strict AP242 constructor.
318    pub fn add_action_resource_requirement(
319        &mut self,
320        name: String,
321        description: String,
322        kind: ResourceRequirementTypeRef,
323        operations: Vec<CharacterizedActionDefinitionRef>,
324    ) -> Result<ActionResourceRequirementId, AuthorError> {
325        check_resource_requirement_type_ref(&self.model, &kind)?;
326        {
327            let x = &operations;
328            if x.len() < 1 {
329                return Err(AuthorError::Cardinality {
330                    entity: "ACTION_RESOURCE_REQUIREMENT",
331                    attribute: "operations",
332                    got: x.len(),
333                    min: 1,
334                    max: None,
335                });
336            }
337        }
338        for e0 in &operations {
339            check_characterized_action_definition_ref(&self.model, e0)?;
340        }
341        Ok(ActionResourceRequirementId(
342            self.model
343                .action_resource_requirement_arena
344                .push(ActionResourceRequirement {
345                    name,
346                    description,
347                    kind,
348                    operations,
349                }),
350        ))
351    }
352
353    /// `ACTION_RESOURCE_TYPE` — strict AP242 constructor.
354    pub fn add_action_resource_type(
355        &mut self,
356        name: String,
357    ) -> Result<ActionResourceTypeId, AuthorError> {
358        Ok(ActionResourceTypeId(
359            self.model
360                .action_resource_type_arena
361                .push(ActionResourceType { name }),
362        ))
363    }
364
365    /// `ADDRESS` — strict AP242 constructor.
366    pub fn add_address(
367        &mut self,
368        internal_location: Option<String>,
369        street_number: Option<String>,
370        street: Option<String>,
371        postal_box: Option<String>,
372        town: Option<String>,
373        region: Option<String>,
374        postal_code: Option<String>,
375        country: Option<String>,
376        facsimile_number: Option<String>,
377        telephone_number: Option<String>,
378        electronic_mail_address: Option<String>,
379        telex_number: Option<String>,
380    ) -> Result<AddressId, AuthorError> {
381        Ok(AddressId(self.model.address_arena.push(Address {
382            internal_location,
383            street_number,
384            street,
385            postal_box,
386            town,
387            region,
388            postal_code,
389            country,
390            facsimile_number,
391            telephone_number,
392            electronic_mail_address,
393            telex_number,
394        })))
395    }
396
397    /// `ADVANCED_BREP_SHAPE_REPRESENTATION` — strict AP242 constructor.
398    pub fn add_advanced_brep_shape_representation(
399        &mut self,
400        name: String,
401        items: Vec<RepresentationItemRef>,
402        context_of_items: RepresentationContextRef,
403    ) -> Result<AdvancedBrepShapeRepresentationId, AuthorError> {
404        {
405            let x = &items;
406            if x.len() < 1 {
407                return Err(AuthorError::Cardinality {
408                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
409                    attribute: "items",
410                    got: x.len(),
411                    min: 1,
412                    max: None,
413                });
414            }
415        }
416        for e0 in &items {
417            check_representation_item_ref(&self.model, e0)?;
418        }
419        check_representation_context_ref(&self.model, &context_of_items)?;
420        Ok(AdvancedBrepShapeRepresentationId(
421            self.model.advanced_brep_shape_representation_arena.push(
422                AdvancedBrepShapeRepresentation {
423                    name,
424                    items,
425                    context_of_items,
426                },
427            ),
428        ))
429    }
430
431    /// `ADVANCED_FACE` — strict AP242 constructor.
432    pub fn add_advanced_face(
433        &mut self,
434        name: String,
435        bounds: Vec<FaceBoundRef>,
436        face_geometry: SurfaceRef,
437        same_sense: bool,
438    ) -> Result<AdvancedFaceId, AuthorError> {
439        {
440            let x = &bounds;
441            if x.len() < 1 {
442                return Err(AuthorError::Cardinality {
443                    entity: "ADVANCED_FACE",
444                    attribute: "bounds",
445                    got: x.len(),
446                    min: 1,
447                    max: None,
448                });
449            }
450        }
451        for e0 in &bounds {
452            check_face_bound_ref(&self.model, e0)?;
453        }
454        check_surface_ref(&self.model, &face_geometry)?;
455        Ok(AdvancedFaceId(self.model.advanced_face_arena.push(
456            AdvancedFace {
457                name,
458                bounds,
459                face_geometry,
460                same_sense,
461            },
462        )))
463    }
464
465    /// `ALL_AROUND_SHAPE_ASPECT` — strict AP242 constructor.
466    pub fn add_all_around_shape_aspect(
467        &mut self,
468        name: String,
469        description: Option<String>,
470        of_shape: ProductDefinitionShapeRef,
471        product_definitional: Logical,
472    ) -> Result<AllAroundShapeAspectId, AuthorError> {
473        check_product_definition_shape_ref(&self.model, &of_shape)?;
474        Ok(AllAroundShapeAspectId(
475            self.model
476                .all_around_shape_aspect_arena
477                .push(AllAroundShapeAspect {
478                    name,
479                    description,
480                    of_shape,
481                    product_definitional,
482                }),
483        ))
484    }
485
486    /// `ANGULAR_LOCATION` — strict AP242 constructor.
487    pub fn add_angular_location(
488        &mut self,
489        name: String,
490        description: Option<String>,
491        relating_shape_aspect: ShapeAspectRef,
492        related_shape_aspect: ShapeAspectRef,
493        angle_selection: AngleRelator,
494    ) -> Result<AngularLocationId, AuthorError> {
495        check_shape_aspect_ref(&self.model, &relating_shape_aspect)?;
496        check_shape_aspect_ref(&self.model, &related_shape_aspect)?;
497        Ok(AngularLocationId(self.model.angular_location_arena.push(
498            AngularLocation {
499                name,
500                description,
501                relating_shape_aspect,
502                related_shape_aspect,
503                angle_selection,
504            },
505        )))
506    }
507
508    /// `ANGULAR_SIZE` — strict AP242 constructor.
509    pub fn add_angular_size(
510        &mut self,
511        applies_to: ShapeAspectRef,
512        name: String,
513        angle_selection: AngleRelator,
514    ) -> Result<AngularSizeId, AuthorError> {
515        check_shape_aspect_ref(&self.model, &applies_to)?;
516        Ok(AngularSizeId(self.model.angular_size_arena.push(
517            AngularSize {
518                applies_to,
519                name,
520                angle_selection,
521            },
522        )))
523    }
524
525    /// `ANGULARITY_TOLERANCE` — strict AP242 constructor.
526    pub fn add_angularity_tolerance(
527        &mut self,
528        name: String,
529        description: Option<String>,
530        magnitude: Option<LengthMeasureWithUnitRef>,
531        toleranced_shape_aspect: GeometricToleranceTargetRef,
532        datum_system: Vec<DatumSystemOrReferenceRef>,
533    ) -> Result<AngularityToleranceId, AuthorError> {
534        if let Some(x) = &magnitude {
535            check_length_measure_with_unit_ref(&self.model, x)?;
536        }
537        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
538        {
539            let x = &datum_system;
540            if x.len() < 1 {
541                return Err(AuthorError::Cardinality {
542                    entity: "ANGULARITY_TOLERANCE",
543                    attribute: "datum_system",
544                    got: x.len(),
545                    min: 1,
546                    max: None,
547                });
548            }
549        }
550        for e0 in &datum_system {
551            check_datum_system_or_reference_ref(&self.model, e0)?;
552        }
553        Ok(AngularityToleranceId(
554            self.model
555                .angularity_tolerance_arena
556                .push(AngularityTolerance {
557                    name,
558                    description,
559                    magnitude,
560                    toleranced_shape_aspect,
561                    datum_system,
562                }),
563        ))
564    }
565
566    /// `ANNOTATION_CURVE_OCCURRENCE` — strict AP242 constructor.
567    pub fn add_annotation_curve_occurrence(
568        &mut self,
569        name: String,
570        styles: Vec<PresentationStyleAssignmentRef>,
571        item: CurveOrCurveSetRef,
572    ) -> Result<AnnotationCurveOccurrenceId, AuthorError> {
573        for e0 in &styles {
574            check_presentation_style_assignment_ref(&self.model, e0)?;
575        }
576        check_curve_or_curve_set_ref(&self.model, &item)?;
577        Ok(AnnotationCurveOccurrenceId(
578            self.model
579                .annotation_curve_occurrence_arena
580                .push(AnnotationCurveOccurrence { name, styles, item }),
581        ))
582    }
583
584    /// `ANNOTATION_FILL_AREA_OCCURRENCE` — strict AP242 constructor.
585    pub fn add_annotation_fill_area_occurrence(
586        &mut self,
587        name: String,
588        styles: Vec<PresentationStyleAssignmentRef>,
589        item: StyledItemTargetRef,
590        fill_style_target: PointRef,
591    ) -> Result<AnnotationFillAreaOccurrenceId, AuthorError> {
592        for e0 in &styles {
593            check_presentation_style_assignment_ref(&self.model, e0)?;
594        }
595        check_styled_item_target_ref(&self.model, &item)?;
596        check_point_ref(&self.model, &fill_style_target)?;
597        Ok(AnnotationFillAreaOccurrenceId(
598            self.model
599                .annotation_fill_area_occurrence_arena
600                .push(AnnotationFillAreaOccurrence {
601                    name,
602                    styles,
603                    item,
604                    fill_style_target,
605                }),
606        ))
607    }
608
609    /// `ANNOTATION_OCCURRENCE` — strict AP242 constructor.
610    pub fn add_annotation_occurrence(
611        &mut self,
612        name: String,
613        styles: Vec<PresentationStyleAssignmentRef>,
614        item: StyledItemTargetRef,
615    ) -> Result<AnnotationOccurrenceId, AuthorError> {
616        for e0 in &styles {
617            check_presentation_style_assignment_ref(&self.model, e0)?;
618        }
619        check_styled_item_target_ref(&self.model, &item)?;
620        Ok(AnnotationOccurrenceId(
621            self.model
622                .annotation_occurrence_arena
623                .push(AnnotationOccurrence { name, styles, item }),
624        ))
625    }
626
627    /// `ANNOTATION_OCCURRENCE_ASSOCIATIVITY` — strict AP242 constructor.
628    pub fn add_annotation_occurrence_associativity(
629        &mut self,
630        name: String,
631        description: String,
632        relating_annotation_occurrence: AnnotationOccurrenceRef,
633        related_annotation_occurrence: AnnotationOccurrenceRef,
634    ) -> Result<AnnotationOccurrenceAssociativityId, AuthorError> {
635        check_annotation_occurrence_ref(&self.model, &relating_annotation_occurrence)?;
636        check_annotation_occurrence_ref(&self.model, &related_annotation_occurrence)?;
637        Ok(AnnotationOccurrenceAssociativityId(
638            self.model.annotation_occurrence_associativity_arena.push(
639                AnnotationOccurrenceAssociativity {
640                    name,
641                    description,
642                    relating_annotation_occurrence,
643                    related_annotation_occurrence,
644                },
645            ),
646        ))
647    }
648
649    /// `ANNOTATION_OCCURRENCE_RELATIONSHIP` — strict AP242 constructor.
650    pub fn add_annotation_occurrence_relationship(
651        &mut self,
652        name: String,
653        description: String,
654        relating_annotation_occurrence: AnnotationOccurrenceRef,
655        related_annotation_occurrence: AnnotationOccurrenceRef,
656    ) -> Result<AnnotationOccurrenceRelationshipId, AuthorError> {
657        check_annotation_occurrence_ref(&self.model, &relating_annotation_occurrence)?;
658        check_annotation_occurrence_ref(&self.model, &related_annotation_occurrence)?;
659        Ok(AnnotationOccurrenceRelationshipId(
660            self.model.annotation_occurrence_relationship_arena.push(
661                AnnotationOccurrenceRelationship {
662                    name,
663                    description,
664                    relating_annotation_occurrence,
665                    related_annotation_occurrence,
666                },
667            ),
668        ))
669    }
670
671    /// `ANNOTATION_PLACEHOLDER_OCCURRENCE` — strict AP242 constructor.
672    pub fn add_annotation_placeholder_occurrence(
673        &mut self,
674        name: String,
675        styles: Vec<PresentationStyleAssignmentRef>,
676        item: StyledItemTargetRef,
677        role: AnnotationPlaceholderOccurrenceRole,
678        line_spacing: f64,
679    ) -> Result<AnnotationPlaceholderOccurrenceId, AuthorError> {
680        for e0 in &styles {
681            check_presentation_style_assignment_ref(&self.model, e0)?;
682        }
683        check_styled_item_target_ref(&self.model, &item)?;
684        Ok(AnnotationPlaceholderOccurrenceId(
685            self.model.annotation_placeholder_occurrence_arena.push(
686                AnnotationPlaceholderOccurrence {
687                    name,
688                    styles,
689                    item,
690                    role,
691                    line_spacing,
692                },
693            ),
694        ))
695    }
696
697    /// `ANNOTATION_PLANE` — strict AP242 constructor.
698    pub fn add_annotation_plane(
699        &mut self,
700        name: String,
701        styles: Vec<PresentationStyleAssignmentRef>,
702        item: PlaneOrPlanarBoxRef,
703        elements: Option<Vec<AnnotationPlaneElementRef>>,
704    ) -> Result<AnnotationPlaneId, AuthorError> {
705        for e0 in &styles {
706            check_presentation_style_assignment_ref(&self.model, e0)?;
707        }
708        check_plane_or_planar_box_ref(&self.model, &item)?;
709        if let Some(x) = &elements {
710            if x.len() < 1 {
711                return Err(AuthorError::Cardinality {
712                    entity: "ANNOTATION_PLANE",
713                    attribute: "elements",
714                    got: x.len(),
715                    min: 1,
716                    max: None,
717                });
718            }
719        }
720        if let Some(x) = &elements {
721            for e0 in x {
722                check_annotation_plane_element_ref(&self.model, e0)?;
723            }
724        }
725        Ok(AnnotationPlaneId(self.model.annotation_plane_arena.push(
726            AnnotationPlane {
727                name,
728                styles,
729                item,
730                elements,
731            },
732        )))
733    }
734
735    /// `ANNOTATION_SYMBOL` — strict AP242 constructor.
736    pub fn add_annotation_symbol(
737        &mut self,
738        name: String,
739        mapping_source: RepresentationMapRef,
740        mapping_target: RepresentationItemRef,
741    ) -> Result<AnnotationSymbolId, AuthorError> {
742        check_representation_map_ref(&self.model, &mapping_source)?;
743        check_representation_item_ref(&self.model, &mapping_target)?;
744        Ok(AnnotationSymbolId(self.model.annotation_symbol_arena.push(
745            AnnotationSymbol {
746                name,
747                mapping_source,
748                mapping_target,
749            },
750        )))
751    }
752
753    /// `ANNOTATION_SYMBOL_OCCURRENCE` — strict AP242 constructor.
754    pub fn add_annotation_symbol_occurrence(
755        &mut self,
756        name: String,
757        styles: Vec<PresentationStyleAssignmentRef>,
758        item: AnnotationSymbolOccurrenceItemRef,
759    ) -> Result<AnnotationSymbolOccurrenceId, AuthorError> {
760        for e0 in &styles {
761            check_presentation_style_assignment_ref(&self.model, e0)?;
762        }
763        check_annotation_symbol_occurrence_item_ref(&self.model, &item)?;
764        Ok(AnnotationSymbolOccurrenceId(
765            self.model
766                .annotation_symbol_occurrence_arena
767                .push(AnnotationSymbolOccurrence { name, styles, item }),
768        ))
769    }
770
771    /// `ANNOTATION_TEXT` — strict AP242 constructor.
772    pub fn add_annotation_text(
773        &mut self,
774        name: String,
775        mapping_source: RepresentationMapRef,
776        mapping_target: Axis2PlacementRef,
777    ) -> Result<AnnotationTextId, AuthorError> {
778        check_representation_map_ref(&self.model, &mapping_source)?;
779        check_axis2_placement_ref(&self.model, &mapping_target)?;
780        Ok(AnnotationTextId(self.model.annotation_text_arena.push(
781            AnnotationText {
782                name,
783                mapping_source,
784                mapping_target,
785            },
786        )))
787    }
788
789    /// `ANNOTATION_TEXT_CHARACTER` — strict AP242 constructor.
790    pub fn add_annotation_text_character(
791        &mut self,
792        name: String,
793        mapping_source: RepresentationMapRef,
794        mapping_target: Axis2PlacementRef,
795        alignment: String,
796    ) -> Result<AnnotationTextCharacterId, AuthorError> {
797        check_representation_map_ref(&self.model, &mapping_source)?;
798        check_axis2_placement_ref(&self.model, &mapping_target)?;
799        Ok(AnnotationTextCharacterId(
800            self.model
801                .annotation_text_character_arena
802                .push(AnnotationTextCharacter {
803                    name,
804                    mapping_source,
805                    mapping_target,
806                    alignment,
807                }),
808        ))
809    }
810
811    /// `ANNOTATION_TEXT_OCCURRENCE` — strict AP242 constructor.
812    pub fn add_annotation_text_occurrence(
813        &mut self,
814        name: String,
815        styles: Vec<PresentationStyleAssignmentRef>,
816        item: AnnotationTextOccurrenceItemRef,
817    ) -> Result<AnnotationTextOccurrenceId, AuthorError> {
818        for e0 in &styles {
819            check_presentation_style_assignment_ref(&self.model, e0)?;
820        }
821        check_annotation_text_occurrence_item_ref(&self.model, &item)?;
822        Ok(AnnotationTextOccurrenceId(
823            self.model
824                .annotation_text_occurrence_arena
825                .push(AnnotationTextOccurrence { name, styles, item }),
826        ))
827    }
828
829    /// `APPLICATION_CONTEXT` — strict AP242 constructor.
830    pub fn add_application_context(
831        &mut self,
832        application: String,
833    ) -> Result<ApplicationContextId, AuthorError> {
834        Ok(ApplicationContextId(
835            self.model
836                .application_context_arena
837                .push(ApplicationContext { application }),
838        ))
839    }
840
841    /// `APPLICATION_CONTEXT_ELEMENT` — strict AP242 constructor.
842    pub fn add_application_context_element(
843        &mut self,
844        name: String,
845        frame_of_reference: ApplicationContextRef,
846    ) -> Result<ApplicationContextElementId, AuthorError> {
847        check_application_context_ref(&self.model, &frame_of_reference)?;
848        Ok(ApplicationContextElementId(
849            self.model
850                .application_context_element_arena
851                .push(ApplicationContextElement {
852                    name,
853                    frame_of_reference,
854                }),
855        ))
856    }
857
858    /// `APPLICATION_PROTOCOL_DEFINITION` — strict AP242 constructor.
859    pub fn add_application_protocol_definition(
860        &mut self,
861        status: String,
862        application_interpreted_model_schema_name: String,
863        application_protocol_year: i64,
864        application: ApplicationContextRef,
865    ) -> Result<ApplicationProtocolDefinitionId, AuthorError> {
866        check_application_context_ref(&self.model, &application)?;
867        Ok(ApplicationProtocolDefinitionId(
868            self.model
869                .application_protocol_definition_arena
870                .push(ApplicationProtocolDefinition {
871                    status,
872                    application_interpreted_model_schema_name,
873                    application_protocol_year,
874                    application,
875                }),
876        ))
877    }
878
879    /// `APPLIED_APPROVAL_ASSIGNMENT` — strict AP242 constructor.
880    pub fn add_applied_approval_assignment(
881        &mut self,
882        assigned_approval: ApprovalRef,
883        items: Vec<ApprovalItemRef>,
884    ) -> Result<AppliedApprovalAssignmentId, AuthorError> {
885        check_approval_ref(&self.model, &assigned_approval)?;
886        {
887            let x = &items;
888            if x.len() < 1 {
889                return Err(AuthorError::Cardinality {
890                    entity: "APPLIED_APPROVAL_ASSIGNMENT",
891                    attribute: "items",
892                    got: x.len(),
893                    min: 1,
894                    max: None,
895                });
896            }
897        }
898        for e0 in &items {
899            check_approval_item_ref(&self.model, e0)?;
900        }
901        Ok(AppliedApprovalAssignmentId(
902            self.model
903                .applied_approval_assignment_arena
904                .push(AppliedApprovalAssignment {
905                    assigned_approval,
906                    items,
907                }),
908        ))
909    }
910
911    /// `APPLIED_DATE_AND_TIME_ASSIGNMENT` — strict AP242 constructor.
912    pub fn add_applied_date_and_time_assignment(
913        &mut self,
914        assigned_date_and_time: DateAndTimeRef,
915        role: DateTimeRoleRef,
916        items: Vec<DateAndTimeItemRef>,
917    ) -> Result<AppliedDateAndTimeAssignmentId, AuthorError> {
918        check_date_and_time_ref(&self.model, &assigned_date_and_time)?;
919        check_date_time_role_ref(&self.model, &role)?;
920        {
921            let x = &items;
922            if x.len() < 1 {
923                return Err(AuthorError::Cardinality {
924                    entity: "APPLIED_DATE_AND_TIME_ASSIGNMENT",
925                    attribute: "items",
926                    got: x.len(),
927                    min: 1,
928                    max: None,
929                });
930            }
931        }
932        for e0 in &items {
933            check_date_and_time_item_ref(&self.model, e0)?;
934        }
935        Ok(AppliedDateAndTimeAssignmentId(
936            self.model
937                .applied_date_and_time_assignment_arena
938                .push(AppliedDateAndTimeAssignment {
939                    assigned_date_and_time,
940                    role,
941                    items,
942                }),
943        ))
944    }
945
946    /// `APPLIED_DOCUMENT_REFERENCE` — strict AP242 constructor.
947    pub fn add_applied_document_reference(
948        &mut self,
949        assigned_document: DocumentRef,
950        source: String,
951        items: Vec<DocumentReferenceItemRef>,
952    ) -> Result<AppliedDocumentReferenceId, AuthorError> {
953        check_document_ref(&self.model, &assigned_document)?;
954        {
955            let x = &items;
956            if x.len() < 1 {
957                return Err(AuthorError::Cardinality {
958                    entity: "APPLIED_DOCUMENT_REFERENCE",
959                    attribute: "items",
960                    got: x.len(),
961                    min: 1,
962                    max: None,
963                });
964            }
965        }
966        for e0 in &items {
967            check_document_reference_item_ref(&self.model, e0)?;
968        }
969        Ok(AppliedDocumentReferenceId(
970            self.model
971                .applied_document_reference_arena
972                .push(AppliedDocumentReference {
973                    assigned_document,
974                    source,
975                    items,
976                }),
977        ))
978    }
979
980    /// `APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT` — strict AP242 constructor.
981    pub fn add_applied_external_identification_assignment(
982        &mut self,
983        assigned_id: String,
984        role: IdentificationRoleRef,
985        source: ExternalSourceRef,
986        items: Vec<ExternalIdentificationItemRef>,
987    ) -> Result<AppliedExternalIdentificationAssignmentId, AuthorError> {
988        check_identification_role_ref(&self.model, &role)?;
989        check_external_source_ref(&self.model, &source)?;
990        {
991            let x = &items;
992            if x.len() < 1 {
993                return Err(AuthorError::Cardinality {
994                    entity: "APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT",
995                    attribute: "items",
996                    got: x.len(),
997                    min: 1,
998                    max: None,
999                });
1000            }
1001        }
1002        for e0 in &items {
1003            check_external_identification_item_ref(&self.model, e0)?;
1004        }
1005        Ok(AppliedExternalIdentificationAssignmentId(
1006            self.model
1007                .applied_external_identification_assignment_arena
1008                .push(AppliedExternalIdentificationAssignment {
1009                    assigned_id,
1010                    role,
1011                    source,
1012                    items,
1013                }),
1014        ))
1015    }
1016
1017    /// `APPLIED_GROUP_ASSIGNMENT` — strict AP242 constructor.
1018    pub fn add_applied_group_assignment(
1019        &mut self,
1020        assigned_group: GroupRef,
1021        items: Vec<GroupableItemRef>,
1022    ) -> Result<AppliedGroupAssignmentId, AuthorError> {
1023        check_group_ref(&self.model, &assigned_group)?;
1024        {
1025            let x = &items;
1026            if x.len() < 1 {
1027                return Err(AuthorError::Cardinality {
1028                    entity: "APPLIED_GROUP_ASSIGNMENT",
1029                    attribute: "items",
1030                    got: x.len(),
1031                    min: 1,
1032                    max: None,
1033                });
1034            }
1035        }
1036        for e0 in &items {
1037            check_groupable_item_ref(&self.model, e0)?;
1038        }
1039        Ok(AppliedGroupAssignmentId(
1040            self.model
1041                .applied_group_assignment_arena
1042                .push(AppliedGroupAssignment {
1043                    assigned_group,
1044                    items,
1045                }),
1046        ))
1047    }
1048
1049    /// `APPLIED_PERSON_AND_ORGANIZATION_ASSIGNMENT` — strict AP242 constructor.
1050    pub fn add_applied_person_and_organization_assignment(
1051        &mut self,
1052        assigned_person_and_organization: PersonAndOrganizationRef,
1053        role: PersonAndOrganizationRoleRef,
1054        items: Vec<PersonAndOrganizationItemRef>,
1055    ) -> Result<AppliedPersonAndOrganizationAssignmentId, AuthorError> {
1056        check_person_and_organization_ref(&self.model, &assigned_person_and_organization)?;
1057        check_person_and_organization_role_ref(&self.model, &role)?;
1058        {
1059            let x = &items;
1060            if x.len() < 1 {
1061                return Err(AuthorError::Cardinality {
1062                    entity: "APPLIED_PERSON_AND_ORGANIZATION_ASSIGNMENT",
1063                    attribute: "items",
1064                    got: x.len(),
1065                    min: 1,
1066                    max: None,
1067                });
1068            }
1069        }
1070        for e0 in &items {
1071            check_person_and_organization_item_ref(&self.model, e0)?;
1072        }
1073        Ok(AppliedPersonAndOrganizationAssignmentId(
1074            self.model
1075                .applied_person_and_organization_assignment_arena
1076                .push(AppliedPersonAndOrganizationAssignment {
1077                    assigned_person_and_organization,
1078                    role,
1079                    items,
1080                }),
1081        ))
1082    }
1083
1084    /// `APPLIED_PRESENTED_ITEM` — strict AP242 constructor.
1085    pub fn add_applied_presented_item(
1086        &mut self,
1087        items: Vec<PresentedItemSelectRef>,
1088    ) -> Result<AppliedPresentedItemId, AuthorError> {
1089        {
1090            let x = &items;
1091            if x.len() < 1 {
1092                return Err(AuthorError::Cardinality {
1093                    entity: "APPLIED_PRESENTED_ITEM",
1094                    attribute: "items",
1095                    got: x.len(),
1096                    min: 1,
1097                    max: None,
1098                });
1099            }
1100        }
1101        for e0 in &items {
1102            check_presented_item_select_ref(&self.model, e0)?;
1103        }
1104        Ok(AppliedPresentedItemId(
1105            self.model
1106                .applied_presented_item_arena
1107                .push(AppliedPresentedItem { items }),
1108        ))
1109    }
1110
1111    /// `APPLIED_SECURITY_CLASSIFICATION_ASSIGNMENT` — strict AP242 constructor.
1112    pub fn add_applied_security_classification_assignment(
1113        &mut self,
1114        assigned_security_classification: SecurityClassificationRef,
1115        items: Vec<SecurityClassificationItemRef>,
1116    ) -> Result<AppliedSecurityClassificationAssignmentId, AuthorError> {
1117        check_security_classification_ref(&self.model, &assigned_security_classification)?;
1118        {
1119            let x = &items;
1120            if x.len() < 1 {
1121                return Err(AuthorError::Cardinality {
1122                    entity: "APPLIED_SECURITY_CLASSIFICATION_ASSIGNMENT",
1123                    attribute: "items",
1124                    got: x.len(),
1125                    min: 1,
1126                    max: None,
1127                });
1128            }
1129        }
1130        for e0 in &items {
1131            check_security_classification_item_ref(&self.model, e0)?;
1132        }
1133        Ok(AppliedSecurityClassificationAssignmentId(
1134            self.model
1135                .applied_security_classification_assignment_arena
1136                .push(AppliedSecurityClassificationAssignment {
1137                    assigned_security_classification,
1138                    items,
1139                }),
1140        ))
1141    }
1142
1143    /// `APPROVAL` — strict AP242 constructor.
1144    pub fn add_approval(
1145        &mut self,
1146        status: ApprovalStatusRef,
1147        level: String,
1148    ) -> Result<ApprovalId, AuthorError> {
1149        check_approval_status_ref(&self.model, &status)?;
1150        Ok(ApprovalId(
1151            self.model.approval_arena.push(Approval { status, level }),
1152        ))
1153    }
1154
1155    /// `APPROVAL_ASSIGNMENT` — strict AP242 constructor.
1156    pub fn add_approval_assignment(
1157        &mut self,
1158        assigned_approval: ApprovalRef,
1159    ) -> Result<ApprovalAssignmentId, AuthorError> {
1160        check_approval_ref(&self.model, &assigned_approval)?;
1161        Ok(ApprovalAssignmentId(
1162            self.model
1163                .approval_assignment_arena
1164                .push(ApprovalAssignment { assigned_approval }),
1165        ))
1166    }
1167
1168    /// `APPROVAL_DATE_TIME` — strict AP242 constructor.
1169    pub fn add_approval_date_time(
1170        &mut self,
1171        date_time: DateTimeSelectRef,
1172        dated_approval: ApprovalRef,
1173    ) -> Result<ApprovalDateTimeId, AuthorError> {
1174        check_date_time_select_ref(&self.model, &date_time)?;
1175        check_approval_ref(&self.model, &dated_approval)?;
1176        Ok(ApprovalDateTimeId(
1177            self.model.approval_date_time_arena.push(ApprovalDateTime {
1178                date_time,
1179                dated_approval,
1180            }),
1181        ))
1182    }
1183
1184    /// `APPROVAL_PERSON_ORGANIZATION` — strict AP242 constructor.
1185    pub fn add_approval_person_organization(
1186        &mut self,
1187        person_organization: PersonOrganizationSelectRef,
1188        authorized_approval: ApprovalRef,
1189        role: ApprovalRoleRef,
1190    ) -> Result<ApprovalPersonOrganizationId, AuthorError> {
1191        check_person_organization_select_ref(&self.model, &person_organization)?;
1192        check_approval_ref(&self.model, &authorized_approval)?;
1193        check_approval_role_ref(&self.model, &role)?;
1194        Ok(ApprovalPersonOrganizationId(
1195            self.model
1196                .approval_person_organization_arena
1197                .push(ApprovalPersonOrganization {
1198                    person_organization,
1199                    authorized_approval,
1200                    role,
1201                }),
1202        ))
1203    }
1204
1205    /// `APPROVAL_ROLE` — strict AP242 constructor.
1206    pub fn add_approval_role(&mut self, role: String) -> Result<ApprovalRoleId, AuthorError> {
1207        Ok(ApprovalRoleId(
1208            self.model.approval_role_arena.push(ApprovalRole { role }),
1209        ))
1210    }
1211
1212    /// `APPROVAL_STATUS` — strict AP242 constructor.
1213    pub fn add_approval_status(&mut self, name: String) -> Result<ApprovalStatusId, AuthorError> {
1214        Ok(ApprovalStatusId(
1215            self.model
1216                .approval_status_arena
1217                .push(ApprovalStatus { name }),
1218        ))
1219    }
1220
1221    /// `AREA_IN_SET` — strict AP242 constructor.
1222    pub fn add_area_in_set(
1223        &mut self,
1224        area: PresentationAreaRef,
1225        in_set: PresentationSetRef,
1226    ) -> Result<AreaInSetId, AuthorError> {
1227        check_presentation_area_ref(&self.model, &area)?;
1228        check_presentation_set_ref(&self.model, &in_set)?;
1229        Ok(AreaInSetId(
1230            self.model
1231                .area_in_set_arena
1232                .push(AreaInSet { area, in_set }),
1233        ))
1234    }
1235
1236    /// `AREA_UNIT` — strict AP242 constructor.
1237    pub fn add_area_unit(
1238        &mut self,
1239        elements: Vec<DerivedUnitElementRef>,
1240    ) -> Result<AreaUnitId, AuthorError> {
1241        {
1242            let x = &elements;
1243            if x.len() < 1 {
1244                return Err(AuthorError::Cardinality {
1245                    entity: "AREA_UNIT",
1246                    attribute: "elements",
1247                    got: x.len(),
1248                    min: 1,
1249                    max: None,
1250                });
1251            }
1252        }
1253        for e0 in &elements {
1254            check_derived_unit_element_ref(&self.model, e0)?;
1255        }
1256        Ok(AreaUnitId(
1257            self.model.area_unit_arena.push(AreaUnit { elements }),
1258        ))
1259    }
1260
1261    /// `ASCRIBABLE_STATE` — strict AP242 constructor.
1262    pub fn add_ascribable_state(
1263        &mut self,
1264        name: String,
1265        description: Option<String>,
1266        pertaining_state_type: StateTypeRef,
1267        ascribed_state_observed: StateObservedRef,
1268    ) -> Result<AscribableStateId, AuthorError> {
1269        check_state_type_ref(&self.model, &pertaining_state_type)?;
1270        check_state_observed_ref(&self.model, &ascribed_state_observed)?;
1271        Ok(AscribableStateId(self.model.ascribable_state_arena.push(
1272            AscribableState {
1273                name,
1274                description,
1275                pertaining_state_type,
1276                ascribed_state_observed,
1277            },
1278        )))
1279    }
1280
1281    /// `ASCRIBABLE_STATE_RELATIONSHIP` — strict AP242 constructor.
1282    pub fn add_ascribable_state_relationship(
1283        &mut self,
1284        name: String,
1285        description: Option<String>,
1286        relating_ascribable_state: AscribableStateRef,
1287        related_ascribable_state: AscribableStateRef,
1288    ) -> Result<AscribableStateRelationshipId, AuthorError> {
1289        check_ascribable_state_ref(&self.model, &relating_ascribable_state)?;
1290        check_ascribable_state_ref(&self.model, &related_ascribable_state)?;
1291        Ok(AscribableStateRelationshipId(
1292            self.model
1293                .ascribable_state_relationship_arena
1294                .push(AscribableStateRelationship {
1295                    name,
1296                    description,
1297                    relating_ascribable_state,
1298                    related_ascribable_state,
1299                }),
1300        ))
1301    }
1302
1303    /// `ASSEMBLY_COMPONENT_USAGE` — strict AP242 constructor.
1304    pub fn add_assembly_component_usage(
1305        &mut self,
1306        id: String,
1307        name: String,
1308        description: Option<String>,
1309        relating_product_definition: ProductDefinitionOrReferenceRef,
1310        related_product_definition: ProductDefinitionOrReferenceRef,
1311        reference_designator: Option<String>,
1312    ) -> Result<AssemblyComponentUsageId, AuthorError> {
1313        check_product_definition_or_reference_ref(&self.model, &relating_product_definition)?;
1314        check_product_definition_or_reference_ref(&self.model, &related_product_definition)?;
1315        Ok(AssemblyComponentUsageId(
1316            self.model
1317                .assembly_component_usage_arena
1318                .push(AssemblyComponentUsage {
1319                    id,
1320                    name,
1321                    description,
1322                    relating_product_definition,
1323                    related_product_definition,
1324                    reference_designator,
1325                }),
1326        ))
1327    }
1328
1329    /// `AXIS1_PLACEMENT` — strict AP242 constructor.
1330    pub fn add_axis1_placement(
1331        &mut self,
1332        name: String,
1333        location: CartesianPointRef,
1334        axis: Option<DirectionRef>,
1335    ) -> Result<Axis1PlacementId, AuthorError> {
1336        check_cartesian_point_ref(&self.model, &location)?;
1337        if let Some(x) = &axis {
1338            check_direction_ref(&self.model, x)?;
1339        }
1340        Ok(Axis1PlacementId(self.model.axis1_placement_arena.push(
1341            Axis1Placement {
1342                name,
1343                location,
1344                axis,
1345            },
1346        )))
1347    }
1348
1349    /// `AXIS2_PLACEMENT_2D` — strict AP242 constructor.
1350    pub fn add_axis2_placement2d(
1351        &mut self,
1352        name: String,
1353        location: CartesianPointRef,
1354        ref_direction: Option<DirectionRef>,
1355    ) -> Result<Axis2Placement2dId, AuthorError> {
1356        check_cartesian_point_ref(&self.model, &location)?;
1357        if let Some(x) = &ref_direction {
1358            check_direction_ref(&self.model, x)?;
1359        }
1360        Ok(Axis2Placement2dId(self.model.axis2_placement2d_arena.push(
1361            Axis2Placement2d {
1362                name,
1363                location,
1364                ref_direction,
1365            },
1366        )))
1367    }
1368
1369    /// `AXIS2_PLACEMENT_3D` — strict AP242 constructor.
1370    pub fn add_axis2_placement3d(
1371        &mut self,
1372        name: String,
1373        location: CartesianPointRef,
1374        axis: Option<DirectionRef>,
1375        ref_direction: Option<DirectionRef>,
1376    ) -> Result<Axis2Placement3dId, AuthorError> {
1377        check_cartesian_point_ref(&self.model, &location)?;
1378        if let Some(x) = &axis {
1379            check_direction_ref(&self.model, x)?;
1380        }
1381        if let Some(x) = &ref_direction {
1382            check_direction_ref(&self.model, x)?;
1383        }
1384        Ok(Axis2Placement3dId(self.model.axis2_placement3d_arena.push(
1385            Axis2Placement3d {
1386                name,
1387                location,
1388                axis,
1389                ref_direction,
1390            },
1391        )))
1392    }
1393
1394    /// `B_SPLINE_CURVE` — strict AP242 constructor.
1395    pub fn add_b_spline_curve(
1396        &mut self,
1397        name: String,
1398        degree: i64,
1399        control_points_list: Vec<CartesianPointRef>,
1400        curve_form: BSplineCurveForm,
1401        closed_curve: Logical,
1402        self_intersect: Logical,
1403    ) -> Result<BSplineCurveId, AuthorError> {
1404        {
1405            let x = &control_points_list;
1406            if x.len() < 2 {
1407                return Err(AuthorError::Cardinality {
1408                    entity: "B_SPLINE_CURVE",
1409                    attribute: "control_points_list",
1410                    got: x.len(),
1411                    min: 2,
1412                    max: None,
1413                });
1414            }
1415        }
1416        for e0 in &control_points_list {
1417            check_cartesian_point_ref(&self.model, e0)?;
1418        }
1419        Ok(BSplineCurveId(self.model.b_spline_curve_arena.push(
1420            BSplineCurve {
1421                name,
1422                degree,
1423                control_points_list,
1424                curve_form,
1425                closed_curve,
1426                self_intersect,
1427            },
1428        )))
1429    }
1430
1431    /// `B_SPLINE_CURVE_WITH_KNOTS` — strict AP242 constructor.
1432    pub fn add_b_spline_curve_with_knots(
1433        &mut self,
1434        name: String,
1435        degree: i64,
1436        control_points_list: Vec<CartesianPointRef>,
1437        curve_form: BSplineCurveForm,
1438        closed_curve: Logical,
1439        self_intersect: Logical,
1440        knot_multiplicities: Vec<i64>,
1441        knots: Vec<f64>,
1442        knot_spec: KnotType,
1443    ) -> Result<BSplineCurveWithKnotsId, AuthorError> {
1444        {
1445            let x = &control_points_list;
1446            if x.len() < 2 {
1447                return Err(AuthorError::Cardinality {
1448                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
1449                    attribute: "control_points_list",
1450                    got: x.len(),
1451                    min: 2,
1452                    max: None,
1453                });
1454            }
1455        }
1456        for e0 in &control_points_list {
1457            check_cartesian_point_ref(&self.model, e0)?;
1458        }
1459        {
1460            let x = &knot_multiplicities;
1461            if x.len() < 2 {
1462                return Err(AuthorError::Cardinality {
1463                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
1464                    attribute: "knot_multiplicities",
1465                    got: x.len(),
1466                    min: 2,
1467                    max: None,
1468                });
1469            }
1470        }
1471        {
1472            let x = &knots;
1473            if x.len() < 2 {
1474                return Err(AuthorError::Cardinality {
1475                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
1476                    attribute: "knots",
1477                    got: x.len(),
1478                    min: 2,
1479                    max: None,
1480                });
1481            }
1482        }
1483        Ok(BSplineCurveWithKnotsId(
1484            self.model
1485                .b_spline_curve_with_knots_arena
1486                .push(BSplineCurveWithKnots {
1487                    name,
1488                    degree,
1489                    control_points_list,
1490                    curve_form,
1491                    closed_curve,
1492                    self_intersect,
1493                    knot_multiplicities,
1494                    knots,
1495                    knot_spec,
1496                }),
1497        ))
1498    }
1499
1500    /// `B_SPLINE_SURFACE` — strict AP242 constructor.
1501    pub fn add_b_spline_surface(
1502        &mut self,
1503        name: String,
1504        u_degree: i64,
1505        v_degree: i64,
1506        control_points_list: Vec<Vec<CartesianPointRef>>,
1507        surface_form: BSplineSurfaceForm,
1508        u_closed: Logical,
1509        v_closed: Logical,
1510        self_intersect: Logical,
1511    ) -> Result<BSplineSurfaceId, AuthorError> {
1512        {
1513            let x = &control_points_list;
1514            if x.len() < 2 {
1515                return Err(AuthorError::Cardinality {
1516                    entity: "B_SPLINE_SURFACE",
1517                    attribute: "control_points_list",
1518                    got: x.len(),
1519                    min: 2,
1520                    max: None,
1521                });
1522            }
1523        }
1524        for e0 in &control_points_list {
1525            for e1 in e0 {
1526                check_cartesian_point_ref(&self.model, e1)?;
1527            }
1528        }
1529        Ok(BSplineSurfaceId(self.model.b_spline_surface_arena.push(
1530            BSplineSurface {
1531                name,
1532                u_degree,
1533                v_degree,
1534                control_points_list,
1535                surface_form,
1536                u_closed,
1537                v_closed,
1538                self_intersect,
1539            },
1540        )))
1541    }
1542
1543    /// `B_SPLINE_SURFACE_WITH_KNOTS` — strict AP242 constructor.
1544    pub fn add_b_spline_surface_with_knots(
1545        &mut self,
1546        name: String,
1547        u_degree: i64,
1548        v_degree: i64,
1549        control_points_list: Vec<Vec<CartesianPointRef>>,
1550        surface_form: BSplineSurfaceForm,
1551        u_closed: Logical,
1552        v_closed: Logical,
1553        self_intersect: Logical,
1554        u_multiplicities: Vec<i64>,
1555        v_multiplicities: Vec<i64>,
1556        u_knots: Vec<f64>,
1557        v_knots: Vec<f64>,
1558        knot_spec: KnotType,
1559    ) -> Result<BSplineSurfaceWithKnotsId, AuthorError> {
1560        {
1561            let x = &control_points_list;
1562            if x.len() < 2 {
1563                return Err(AuthorError::Cardinality {
1564                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
1565                    attribute: "control_points_list",
1566                    got: x.len(),
1567                    min: 2,
1568                    max: None,
1569                });
1570            }
1571        }
1572        for e0 in &control_points_list {
1573            for e1 in e0 {
1574                check_cartesian_point_ref(&self.model, e1)?;
1575            }
1576        }
1577        {
1578            let x = &u_multiplicities;
1579            if x.len() < 2 {
1580                return Err(AuthorError::Cardinality {
1581                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
1582                    attribute: "u_multiplicities",
1583                    got: x.len(),
1584                    min: 2,
1585                    max: None,
1586                });
1587            }
1588        }
1589        {
1590            let x = &v_multiplicities;
1591            if x.len() < 2 {
1592                return Err(AuthorError::Cardinality {
1593                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
1594                    attribute: "v_multiplicities",
1595                    got: x.len(),
1596                    min: 2,
1597                    max: None,
1598                });
1599            }
1600        }
1601        {
1602            let x = &u_knots;
1603            if x.len() < 2 {
1604                return Err(AuthorError::Cardinality {
1605                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
1606                    attribute: "u_knots",
1607                    got: x.len(),
1608                    min: 2,
1609                    max: None,
1610                });
1611            }
1612        }
1613        {
1614            let x = &v_knots;
1615            if x.len() < 2 {
1616                return Err(AuthorError::Cardinality {
1617                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
1618                    attribute: "v_knots",
1619                    got: x.len(),
1620                    min: 2,
1621                    max: None,
1622                });
1623            }
1624        }
1625        Ok(BSplineSurfaceWithKnotsId(
1626            self.model
1627                .b_spline_surface_with_knots_arena
1628                .push(BSplineSurfaceWithKnots {
1629                    name,
1630                    u_degree,
1631                    v_degree,
1632                    control_points_list,
1633                    surface_form,
1634                    u_closed,
1635                    v_closed,
1636                    self_intersect,
1637                    u_multiplicities,
1638                    v_multiplicities,
1639                    u_knots,
1640                    v_knots,
1641                    knot_spec,
1642                }),
1643        ))
1644    }
1645
1646    /// `BEZIER_CURVE` — strict AP242 constructor.
1647    pub fn add_bezier_curve(
1648        &mut self,
1649        name: String,
1650        degree: i64,
1651        control_points_list: Vec<CartesianPointRef>,
1652        curve_form: BSplineCurveForm,
1653        closed_curve: Logical,
1654        self_intersect: Logical,
1655    ) -> Result<BezierCurveId, AuthorError> {
1656        {
1657            let x = &control_points_list;
1658            if x.len() < 2 {
1659                return Err(AuthorError::Cardinality {
1660                    entity: "BEZIER_CURVE",
1661                    attribute: "control_points_list",
1662                    got: x.len(),
1663                    min: 2,
1664                    max: None,
1665                });
1666            }
1667        }
1668        for e0 in &control_points_list {
1669            check_cartesian_point_ref(&self.model, e0)?;
1670        }
1671        Ok(BezierCurveId(self.model.bezier_curve_arena.push(
1672            BezierCurve {
1673                name,
1674                degree,
1675                control_points_list,
1676                curve_form,
1677                closed_curve,
1678                self_intersect,
1679            },
1680        )))
1681    }
1682
1683    /// `BEZIER_SURFACE` — strict AP242 constructor.
1684    pub fn add_bezier_surface(
1685        &mut self,
1686        name: String,
1687        u_degree: i64,
1688        v_degree: i64,
1689        control_points_list: Vec<Vec<CartesianPointRef>>,
1690        surface_form: BSplineSurfaceForm,
1691        u_closed: Logical,
1692        v_closed: Logical,
1693        self_intersect: Logical,
1694    ) -> Result<BezierSurfaceId, AuthorError> {
1695        {
1696            let x = &control_points_list;
1697            if x.len() < 2 {
1698                return Err(AuthorError::Cardinality {
1699                    entity: "BEZIER_SURFACE",
1700                    attribute: "control_points_list",
1701                    got: x.len(),
1702                    min: 2,
1703                    max: None,
1704                });
1705            }
1706        }
1707        for e0 in &control_points_list {
1708            for e1 in e0 {
1709                check_cartesian_point_ref(&self.model, e1)?;
1710            }
1711        }
1712        Ok(BezierSurfaceId(self.model.bezier_surface_arena.push(
1713            BezierSurface {
1714                name,
1715                u_degree,
1716                v_degree,
1717                control_points_list,
1718                surface_form,
1719                u_closed,
1720                v_closed,
1721                self_intersect,
1722            },
1723        )))
1724    }
1725
1726    /// `BOUNDED_CURVE` — strict AP242 constructor.
1727    pub fn add_bounded_curve(&mut self, name: String) -> Result<BoundedCurveId, AuthorError> {
1728        Ok(BoundedCurveId(
1729            self.model.bounded_curve_arena.push(BoundedCurve { name }),
1730        ))
1731    }
1732
1733    /// `BOUNDED_PCURVE` — strict AP242 constructor.
1734    pub fn add_bounded_pcurve(
1735        &mut self,
1736        name: String,
1737        basis_surface: SurfaceRef,
1738        reference_to_curve: DefinitionalRepresentationRef,
1739    ) -> Result<BoundedPcurveId, AuthorError> {
1740        check_surface_ref(&self.model, &basis_surface)?;
1741        check_definitional_representation_ref(&self.model, &reference_to_curve)?;
1742        Ok(BoundedPcurveId(self.model.bounded_pcurve_arena.push(
1743            BoundedPcurve {
1744                name,
1745                basis_surface,
1746                reference_to_curve,
1747            },
1748        )))
1749    }
1750
1751    /// `BOUNDED_SURFACE` — strict AP242 constructor.
1752    pub fn add_bounded_surface(&mut self, name: String) -> Result<BoundedSurfaceId, AuthorError> {
1753        Ok(BoundedSurfaceId(
1754            self.model
1755                .bounded_surface_arena
1756                .push(BoundedSurface { name }),
1757        ))
1758    }
1759
1760    /// `BOUNDED_SURFACE_CURVE` — strict AP242 constructor.
1761    pub fn add_bounded_surface_curve(
1762        &mut self,
1763        name: String,
1764        curve_3d: CurveRef,
1765        associated_geometry: Vec<PcurveOrSurfaceRef>,
1766        master_representation: PreferredSurfaceCurveRepresentation,
1767    ) -> Result<BoundedSurfaceCurveId, AuthorError> {
1768        check_curve_ref(&self.model, &curve_3d)?;
1769        {
1770            let x = &associated_geometry;
1771            if x.len() < 1 || x.len() > 2 {
1772                return Err(AuthorError::Cardinality {
1773                    entity: "BOUNDED_SURFACE_CURVE",
1774                    attribute: "associated_geometry",
1775                    got: x.len(),
1776                    min: 1,
1777                    max: Some(2),
1778                });
1779            }
1780        }
1781        for e0 in &associated_geometry {
1782            check_pcurve_or_surface_ref(&self.model, e0)?;
1783        }
1784        Ok(BoundedSurfaceCurveId(
1785            self.model
1786                .bounded_surface_curve_arena
1787                .push(BoundedSurfaceCurve {
1788                    name,
1789                    curve_3d,
1790                    associated_geometry,
1791                    master_representation,
1792                }),
1793        ))
1794    }
1795
1796    /// `BREP_WITH_VOIDS` — strict AP242 constructor.
1797    pub fn add_brep_with_voids(
1798        &mut self,
1799        name: String,
1800        outer: ClosedShellRef,
1801        voids: Vec<OrientedClosedShellRef>,
1802    ) -> Result<BrepWithVoidsId, AuthorError> {
1803        check_closed_shell_ref(&self.model, &outer)?;
1804        {
1805            let x = &voids;
1806            if x.len() < 1 {
1807                return Err(AuthorError::Cardinality {
1808                    entity: "BREP_WITH_VOIDS",
1809                    attribute: "voids",
1810                    got: x.len(),
1811                    min: 1,
1812                    max: None,
1813                });
1814            }
1815        }
1816        for e0 in &voids {
1817            check_oriented_closed_shell_ref(&self.model, e0)?;
1818        }
1819        Ok(BrepWithVoidsId(
1820            self.model
1821                .brep_with_voids_arena
1822                .push(BrepWithVoids { name, outer, voids }),
1823        ))
1824    }
1825
1826    /// `CALENDAR_DATE` — strict AP242 constructor.
1827    pub fn add_calendar_date(
1828        &mut self,
1829        year_component: i64,
1830        day_component: i64,
1831        month_component: i64,
1832    ) -> Result<CalendarDateId, AuthorError> {
1833        Ok(CalendarDateId(self.model.calendar_date_arena.push(
1834            CalendarDate {
1835                year_component,
1836                day_component,
1837                month_component,
1838            },
1839        )))
1840    }
1841
1842    /// `CAMERA_IMAGE` — strict AP242 constructor.
1843    pub fn add_camera_image(
1844        &mut self,
1845        name: String,
1846        mapping_source: RepresentationMapRef,
1847        mapping_target: RepresentationItemRef,
1848    ) -> Result<CameraImageId, AuthorError> {
1849        check_representation_map_ref(&self.model, &mapping_source)?;
1850        check_representation_item_ref(&self.model, &mapping_target)?;
1851        Ok(CameraImageId(self.model.camera_image_arena.push(
1852            CameraImage {
1853                name,
1854                mapping_source,
1855                mapping_target,
1856            },
1857        )))
1858    }
1859
1860    /// `CAMERA_IMAGE_3D_WITH_SCALE` — strict AP242 constructor.
1861    pub fn add_camera_image3d_with_scale(
1862        &mut self,
1863        name: String,
1864        mapping_source: RepresentationMapRef,
1865        mapping_target: RepresentationItemRef,
1866    ) -> Result<CameraImage3dWithScaleId, AuthorError> {
1867        check_representation_map_ref(&self.model, &mapping_source)?;
1868        check_representation_item_ref(&self.model, &mapping_target)?;
1869        Ok(CameraImage3dWithScaleId(
1870            self.model
1871                .camera_image3d_with_scale_arena
1872                .push(CameraImage3dWithScale {
1873                    name,
1874                    mapping_source,
1875                    mapping_target,
1876                }),
1877        ))
1878    }
1879
1880    /// `CAMERA_MODEL` — strict AP242 constructor.
1881    pub fn add_camera_model(&mut self, name: String) -> Result<CameraModelId, AuthorError> {
1882        Ok(CameraModelId(
1883            self.model.camera_model_arena.push(CameraModel { name }),
1884        ))
1885    }
1886
1887    /// `CAMERA_MODEL_D3` — strict AP242 constructor.
1888    pub fn add_camera_model_d3(
1889        &mut self,
1890        name: String,
1891        view_reference_system: Axis2Placement3dRef,
1892        perspective_of_volume: ViewVolumeRef,
1893    ) -> Result<CameraModelD3Id, AuthorError> {
1894        check_axis2_placement3d_ref(&self.model, &view_reference_system)?;
1895        check_view_volume_ref(&self.model, &perspective_of_volume)?;
1896        Ok(CameraModelD3Id(self.model.camera_model_d3_arena.push(
1897            CameraModelD3 {
1898                name,
1899                view_reference_system,
1900                perspective_of_volume,
1901            },
1902        )))
1903    }
1904
1905    /// `CAMERA_MODEL_D3_MULTI_CLIPPING` — strict AP242 constructor.
1906    pub fn add_camera_model_d3_multi_clipping(
1907        &mut self,
1908        name: String,
1909        view_reference_system: Axis2Placement3dRef,
1910        perspective_of_volume: ViewVolumeRef,
1911        shape_clipping: Vec<CameraModelD3MultiClippingIntersectionSelectRef>,
1912    ) -> Result<CameraModelD3MultiClippingId, AuthorError> {
1913        check_axis2_placement3d_ref(&self.model, &view_reference_system)?;
1914        check_view_volume_ref(&self.model, &perspective_of_volume)?;
1915        {
1916            let x = &shape_clipping;
1917            if x.len() < 1 {
1918                return Err(AuthorError::Cardinality {
1919                    entity: "CAMERA_MODEL_D3_MULTI_CLIPPING",
1920                    attribute: "shape_clipping",
1921                    got: x.len(),
1922                    min: 1,
1923                    max: None,
1924                });
1925            }
1926        }
1927        for e0 in &shape_clipping {
1928            check_camera_model_d3_multi_clipping_intersection_select_ref(&self.model, e0)?;
1929        }
1930        Ok(CameraModelD3MultiClippingId(
1931            self.model
1932                .camera_model_d3_multi_clipping_arena
1933                .push(CameraModelD3MultiClipping {
1934                    name,
1935                    view_reference_system,
1936                    perspective_of_volume,
1937                    shape_clipping,
1938                }),
1939        ))
1940    }
1941
1942    /// `CAMERA_MODEL_D3_WITH_HLHSR` — strict AP242 constructor.
1943    pub fn add_camera_model_d3_with_hlhsr(
1944        &mut self,
1945        name: String,
1946        view_reference_system: Axis2Placement3dRef,
1947        perspective_of_volume: ViewVolumeRef,
1948        hidden_line_surface_removal: bool,
1949    ) -> Result<CameraModelD3WithHlhsrId, AuthorError> {
1950        check_axis2_placement3d_ref(&self.model, &view_reference_system)?;
1951        check_view_volume_ref(&self.model, &perspective_of_volume)?;
1952        Ok(CameraModelD3WithHlhsrId(
1953            self.model
1954                .camera_model_d3_with_hlhsr_arena
1955                .push(CameraModelD3WithHlhsr {
1956                    name,
1957                    view_reference_system,
1958                    perspective_of_volume,
1959                    hidden_line_surface_removal,
1960                }),
1961        ))
1962    }
1963
1964    /// `CAMERA_USAGE` — strict AP242 constructor.
1965    pub fn add_camera_usage(
1966        &mut self,
1967        mapping_origin: RepresentationItemRef,
1968        mapped_representation: RepresentationRef,
1969    ) -> Result<CameraUsageId, AuthorError> {
1970        check_representation_item_ref(&self.model, &mapping_origin)?;
1971        check_representation_ref(&self.model, &mapped_representation)?;
1972        Ok(CameraUsageId(self.model.camera_usage_arena.push(
1973            CameraUsage {
1974                mapping_origin,
1975                mapped_representation,
1976            },
1977        )))
1978    }
1979
1980    /// `CARTESIAN_POINT` — strict AP242 constructor.
1981    pub fn add_cartesian_point(
1982        &mut self,
1983        name: String,
1984        coordinates: Vec<f64>,
1985    ) -> Result<CartesianPointId, AuthorError> {
1986        {
1987            let x = &coordinates;
1988            if x.len() < 1 || x.len() > 3 {
1989                return Err(AuthorError::Cardinality {
1990                    entity: "CARTESIAN_POINT",
1991                    attribute: "coordinates",
1992                    got: x.len(),
1993                    min: 1,
1994                    max: Some(3),
1995                });
1996            }
1997        }
1998        Ok(CartesianPointId(
1999            self.model
2000                .cartesian_point_arena
2001                .push(CartesianPoint { name, coordinates }),
2002        ))
2003    }
2004
2005    /// `CC_DESIGN_APPROVAL` — strict AP242 constructor.
2006    pub fn add_cc_design_approval(
2007        &mut self,
2008        assigned_approval: ApprovalRef,
2009        items: Vec<ApprovedItemRef>,
2010    ) -> Result<CcDesignApprovalId, AuthorError> {
2011        check_approval_ref(&self.model, &assigned_approval)?;
2012        {
2013            let x = &items;
2014            if x.len() < 1 {
2015                return Err(AuthorError::Cardinality {
2016                    entity: "CC_DESIGN_APPROVAL",
2017                    attribute: "items",
2018                    got: x.len(),
2019                    min: 1,
2020                    max: None,
2021                });
2022            }
2023        }
2024        for e0 in &items {
2025            check_approved_item_ref(&self.model, e0)?;
2026        }
2027        Ok(CcDesignApprovalId(
2028            self.model.cc_design_approval_arena.push(CcDesignApproval {
2029                assigned_approval,
2030                items,
2031            }),
2032        ))
2033    }
2034
2035    /// `CC_DESIGN_DATE_AND_TIME_ASSIGNMENT` — strict AP242 constructor.
2036    pub fn add_cc_design_date_and_time_assignment(
2037        &mut self,
2038        assigned_date_and_time: DateAndTimeRef,
2039        role: DateTimeRoleRef,
2040        items: Vec<DateTimeItemRef>,
2041    ) -> Result<CcDesignDateAndTimeAssignmentId, AuthorError> {
2042        check_date_and_time_ref(&self.model, &assigned_date_and_time)?;
2043        check_date_time_role_ref(&self.model, &role)?;
2044        {
2045            let x = &items;
2046            if x.len() < 1 {
2047                return Err(AuthorError::Cardinality {
2048                    entity: "CC_DESIGN_DATE_AND_TIME_ASSIGNMENT",
2049                    attribute: "items",
2050                    got: x.len(),
2051                    min: 1,
2052                    max: None,
2053                });
2054            }
2055        }
2056        for e0 in &items {
2057            check_date_time_item_ref(&self.model, e0)?;
2058        }
2059        Ok(CcDesignDateAndTimeAssignmentId(
2060            self.model.cc_design_date_and_time_assignment_arena.push(
2061                CcDesignDateAndTimeAssignment {
2062                    assigned_date_and_time,
2063                    role,
2064                    items,
2065                },
2066            ),
2067        ))
2068    }
2069
2070    /// `CC_DESIGN_PERSON_AND_ORGANIZATION_ASSIGNMENT` — strict AP242 constructor.
2071    pub fn add_cc_design_person_and_organization_assignment(
2072        &mut self,
2073        assigned_person_and_organization: PersonAndOrganizationRef,
2074        role: PersonAndOrganizationRoleRef,
2075        items: Vec<CcPersonOrganizationItemRef>,
2076    ) -> Result<CcDesignPersonAndOrganizationAssignmentId, AuthorError> {
2077        check_person_and_organization_ref(&self.model, &assigned_person_and_organization)?;
2078        check_person_and_organization_role_ref(&self.model, &role)?;
2079        {
2080            let x = &items;
2081            if x.len() < 1 {
2082                return Err(AuthorError::Cardinality {
2083                    entity: "CC_DESIGN_PERSON_AND_ORGANIZATION_ASSIGNMENT",
2084                    attribute: "items",
2085                    got: x.len(),
2086                    min: 1,
2087                    max: None,
2088                });
2089            }
2090        }
2091        for e0 in &items {
2092            check_cc_person_organization_item_ref(&self.model, e0)?;
2093        }
2094        Ok(CcDesignPersonAndOrganizationAssignmentId(
2095            self.model
2096                .cc_design_person_and_organization_assignment_arena
2097                .push(CcDesignPersonAndOrganizationAssignment {
2098                    assigned_person_and_organization,
2099                    role,
2100                    items,
2101                }),
2102        ))
2103    }
2104
2105    /// `CC_DESIGN_SECURITY_CLASSIFICATION` — strict AP242 constructor.
2106    pub fn add_cc_design_security_classification(
2107        &mut self,
2108        assigned_security_classification: SecurityClassificationRef,
2109        items: Vec<CcClassifiedItemRef>,
2110    ) -> Result<CcDesignSecurityClassificationId, AuthorError> {
2111        check_security_classification_ref(&self.model, &assigned_security_classification)?;
2112        {
2113            let x = &items;
2114            if x.len() < 1 {
2115                return Err(AuthorError::Cardinality {
2116                    entity: "CC_DESIGN_SECURITY_CLASSIFICATION",
2117                    attribute: "items",
2118                    got: x.len(),
2119                    min: 1,
2120                    max: None,
2121                });
2122            }
2123        }
2124        for e0 in &items {
2125            check_cc_classified_item_ref(&self.model, e0)?;
2126        }
2127        Ok(CcDesignSecurityClassificationId(
2128            self.model.cc_design_security_classification_arena.push(
2129                CcDesignSecurityClassification {
2130                    assigned_security_classification,
2131                    items,
2132                },
2133            ),
2134        ))
2135    }
2136
2137    /// `CENTRE_OF_SYMMETRY` — strict AP242 constructor.
2138    pub fn add_centre_of_symmetry(
2139        &mut self,
2140        name: String,
2141        description: Option<String>,
2142        of_shape: ProductDefinitionShapeRef,
2143        product_definitional: Logical,
2144    ) -> Result<CentreOfSymmetryId, AuthorError> {
2145        check_product_definition_shape_ref(&self.model, &of_shape)?;
2146        Ok(CentreOfSymmetryId(
2147            self.model.centre_of_symmetry_arena.push(CentreOfSymmetry {
2148                name,
2149                description,
2150                of_shape,
2151                product_definitional,
2152            }),
2153        ))
2154    }
2155
2156    /// `CERTIFICATION` — strict AP242 constructor.
2157    pub fn add_certification(
2158        &mut self,
2159        name: String,
2160        purpose: String,
2161        kind: CertificationTypeRef,
2162    ) -> Result<CertificationId, AuthorError> {
2163        check_certification_type_ref(&self.model, &kind)?;
2164        Ok(CertificationId(self.model.certification_arena.push(
2165            Certification {
2166                name,
2167                purpose,
2168                kind,
2169            },
2170        )))
2171    }
2172
2173    /// `CERTIFICATION_TYPE` — strict AP242 constructor.
2174    pub fn add_certification_type(
2175        &mut self,
2176        description: String,
2177    ) -> Result<CertificationTypeId, AuthorError> {
2178        Ok(CertificationTypeId(
2179            self.model
2180                .certification_type_arena
2181                .push(CertificationType { description }),
2182        ))
2183    }
2184
2185    /// `CHANGE` — strict AP242 constructor.
2186    pub fn add_change(
2187        &mut self,
2188        assigned_action: ActionRef,
2189        items: Vec<WorkItemRef>,
2190    ) -> Result<ChangeId, AuthorError> {
2191        check_action_ref(&self.model, &assigned_action)?;
2192        {
2193            let x = &items;
2194            if x.len() < 1 {
2195                return Err(AuthorError::Cardinality {
2196                    entity: "CHANGE",
2197                    attribute: "items",
2198                    got: x.len(),
2199                    min: 1,
2200                    max: None,
2201                });
2202            }
2203        }
2204        for e0 in &items {
2205            check_work_item_ref(&self.model, e0)?;
2206        }
2207        Ok(ChangeId(self.model.change_arena.push(Change {
2208            assigned_action,
2209            items,
2210        })))
2211    }
2212
2213    /// `CHANGE_REQUEST` — strict AP242 constructor.
2214    pub fn add_change_request(
2215        &mut self,
2216        assigned_action_request: VersionedActionRequestRef,
2217        items: Vec<ChangeRequestItemRef>,
2218    ) -> Result<ChangeRequestId, AuthorError> {
2219        check_versioned_action_request_ref(&self.model, &assigned_action_request)?;
2220        {
2221            let x = &items;
2222            if x.len() < 1 {
2223                return Err(AuthorError::Cardinality {
2224                    entity: "CHANGE_REQUEST",
2225                    attribute: "items",
2226                    got: x.len(),
2227                    min: 1,
2228                    max: None,
2229                });
2230            }
2231        }
2232        for e0 in &items {
2233            check_change_request_item_ref(&self.model, e0)?;
2234        }
2235        Ok(ChangeRequestId(self.model.change_request_arena.push(
2236            ChangeRequest {
2237                assigned_action_request,
2238                items,
2239            },
2240        )))
2241    }
2242
2243    /// `CHARACTER_GLYPH_STYLE_OUTLINE` — strict AP242 constructor.
2244    pub fn add_character_glyph_style_outline(
2245        &mut self,
2246        outline_style: CurveStyleRef,
2247    ) -> Result<CharacterGlyphStyleOutlineId, AuthorError> {
2248        check_curve_style_ref(&self.model, &outline_style)?;
2249        Ok(CharacterGlyphStyleOutlineId(
2250            self.model
2251                .character_glyph_style_outline_arena
2252                .push(CharacterGlyphStyleOutline { outline_style }),
2253        ))
2254    }
2255
2256    /// `CHARACTER_GLYPH_STYLE_STROKE` — strict AP242 constructor.
2257    pub fn add_character_glyph_style_stroke(
2258        &mut self,
2259        stroke_style: CurveStyleRef,
2260    ) -> Result<CharacterGlyphStyleStrokeId, AuthorError> {
2261        check_curve_style_ref(&self.model, &stroke_style)?;
2262        Ok(CharacterGlyphStyleStrokeId(
2263            self.model
2264                .character_glyph_style_stroke_arena
2265                .push(CharacterGlyphStyleStroke { stroke_style }),
2266        ))
2267    }
2268
2269    /// `CHARACTERIZED_ITEM_WITHIN_REPRESENTATION` — strict AP242 constructor.
2270    pub fn add_characterized_item_within_representation(
2271        &mut self,
2272        name: String,
2273        description: Option<String>,
2274        item: RepresentationItemRef,
2275        rep: RepresentationRef,
2276    ) -> Result<CharacterizedItemWithinRepresentationId, AuthorError> {
2277        check_representation_item_ref(&self.model, &item)?;
2278        check_representation_ref(&self.model, &rep)?;
2279        Ok(CharacterizedItemWithinRepresentationId(
2280            self.model
2281                .characterized_item_within_representation_arena
2282                .push(CharacterizedItemWithinRepresentation {
2283                    name,
2284                    description,
2285                    item,
2286                    rep,
2287                }),
2288        ))
2289    }
2290
2291    /// `CHARACTERIZED_OBJECT` — strict AP242 constructor.
2292    pub fn add_characterized_object(
2293        &mut self,
2294        name: Option<String>,
2295        description: Option<String>,
2296    ) -> Result<CharacterizedObjectId, AuthorError> {
2297        Ok(CharacterizedObjectId(
2298            self.model
2299                .characterized_object_arena
2300                .push(CharacterizedObject { name, description }),
2301        ))
2302    }
2303
2304    /// `CHARACTERIZED_REPRESENTATION` — strict AP242 constructor.
2305    pub fn add_characterized_representation(
2306        &mut self,
2307        items: Vec<RepresentationItemRef>,
2308        context_of_items: RepresentationContextRef,
2309    ) -> Result<CharacterizedRepresentationId, AuthorError> {
2310        {
2311            let x = &items;
2312            if x.len() < 1 {
2313                return Err(AuthorError::Cardinality {
2314                    entity: "CHARACTERIZED_REPRESENTATION",
2315                    attribute: "items",
2316                    got: x.len(),
2317                    min: 1,
2318                    max: None,
2319                });
2320            }
2321        }
2322        for e0 in &items {
2323            check_representation_item_ref(&self.model, e0)?;
2324        }
2325        check_representation_context_ref(&self.model, &context_of_items)?;
2326        Ok(CharacterizedRepresentationId(
2327            self.model
2328                .characterized_representation_arena
2329                .push(CharacterizedRepresentation {
2330                    items,
2331                    context_of_items,
2332                }),
2333        ))
2334    }
2335
2336    /// `CIRCLE` — strict AP242 constructor.
2337    pub fn add_circle(
2338        &mut self,
2339        name: String,
2340        position: Axis2PlacementRef,
2341        radius: f64,
2342    ) -> Result<CircleId, AuthorError> {
2343        check_axis2_placement_ref(&self.model, &position)?;
2344        Ok(CircleId(self.model.circle_arena.push(Circle {
2345            name,
2346            position,
2347            radius,
2348        })))
2349    }
2350
2351    /// `CIRCULAR_RUNOUT_TOLERANCE` — strict AP242 constructor.
2352    pub fn add_circular_runout_tolerance(
2353        &mut self,
2354        name: String,
2355        description: Option<String>,
2356        magnitude: Option<LengthMeasureWithUnitRef>,
2357        toleranced_shape_aspect: GeometricToleranceTargetRef,
2358        datum_system: Vec<DatumSystemOrReferenceRef>,
2359    ) -> Result<CircularRunoutToleranceId, AuthorError> {
2360        if let Some(x) = &magnitude {
2361            check_length_measure_with_unit_ref(&self.model, x)?;
2362        }
2363        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
2364        {
2365            let x = &datum_system;
2366            if x.len() < 1 {
2367                return Err(AuthorError::Cardinality {
2368                    entity: "CIRCULAR_RUNOUT_TOLERANCE",
2369                    attribute: "datum_system",
2370                    got: x.len(),
2371                    min: 1,
2372                    max: None,
2373                });
2374            }
2375        }
2376        for e0 in &datum_system {
2377            check_datum_system_or_reference_ref(&self.model, e0)?;
2378        }
2379        Ok(CircularRunoutToleranceId(
2380            self.model
2381                .circular_runout_tolerance_arena
2382                .push(CircularRunoutTolerance {
2383                    name,
2384                    description,
2385                    magnitude,
2386                    toleranced_shape_aspect,
2387                    datum_system,
2388                }),
2389        ))
2390    }
2391
2392    /// `CLOSED_SHELL` — strict AP242 constructor.
2393    pub fn add_closed_shell(
2394        &mut self,
2395        name: String,
2396        cfs_faces: Vec<FaceRef>,
2397    ) -> Result<ClosedShellId, AuthorError> {
2398        {
2399            let x = &cfs_faces;
2400            if x.len() < 1 {
2401                return Err(AuthorError::Cardinality {
2402                    entity: "CLOSED_SHELL",
2403                    attribute: "cfs_faces",
2404                    got: x.len(),
2405                    min: 1,
2406                    max: None,
2407                });
2408            }
2409        }
2410        for e0 in &cfs_faces {
2411            check_face_ref(&self.model, e0)?;
2412        }
2413        Ok(ClosedShellId(
2414            self.model
2415                .closed_shell_arena
2416                .push(ClosedShell { name, cfs_faces }),
2417        ))
2418    }
2419
2420    /// `COAXIALITY_TOLERANCE` — strict AP242 constructor.
2421    pub fn add_coaxiality_tolerance(
2422        &mut self,
2423        name: String,
2424        description: Option<String>,
2425        magnitude: Option<LengthMeasureWithUnitRef>,
2426        toleranced_shape_aspect: GeometricToleranceTargetRef,
2427        datum_system: Vec<DatumSystemOrReferenceRef>,
2428    ) -> Result<CoaxialityToleranceId, AuthorError> {
2429        if let Some(x) = &magnitude {
2430            check_length_measure_with_unit_ref(&self.model, x)?;
2431        }
2432        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
2433        {
2434            let x = &datum_system;
2435            if x.len() < 1 {
2436                return Err(AuthorError::Cardinality {
2437                    entity: "COAXIALITY_TOLERANCE",
2438                    attribute: "datum_system",
2439                    got: x.len(),
2440                    min: 1,
2441                    max: None,
2442                });
2443            }
2444        }
2445        for e0 in &datum_system {
2446            check_datum_system_or_reference_ref(&self.model, e0)?;
2447        }
2448        Ok(CoaxialityToleranceId(
2449            self.model
2450                .coaxiality_tolerance_arena
2451                .push(CoaxialityTolerance {
2452                    name,
2453                    description,
2454                    magnitude,
2455                    toleranced_shape_aspect,
2456                    datum_system,
2457                }),
2458        ))
2459    }
2460
2461    /// `COLOUR` — strict AP242 constructor.
2462    pub fn add_colour(&mut self) -> Result<ColourId, AuthorError> {
2463        Ok(ColourId(self.model.colour_arena.push(Colour {})))
2464    }
2465
2466    /// `COLOUR_RGB` — strict AP242 constructor.
2467    pub fn add_colour_rgb(
2468        &mut self,
2469        name: String,
2470        red: f64,
2471        green: f64,
2472        blue: f64,
2473    ) -> Result<ColourRgbId, AuthorError> {
2474        Ok(ColourRgbId(self.model.colour_rgb_arena.push(ColourRgb {
2475            name,
2476            red,
2477            green,
2478            blue,
2479        })))
2480    }
2481
2482    /// `COLOUR_SPECIFICATION` — strict AP242 constructor.
2483    pub fn add_colour_specification(
2484        &mut self,
2485        name: String,
2486    ) -> Result<ColourSpecificationId, AuthorError> {
2487        Ok(ColourSpecificationId(
2488            self.model
2489                .colour_specification_arena
2490                .push(ColourSpecification { name }),
2491        ))
2492    }
2493
2494    /// `COMMON_DATUM` — strict AP242 constructor.
2495    pub fn add_common_datum(
2496        &mut self,
2497        name: String,
2498        description: Option<String>,
2499        of_shape: ProductDefinitionShapeRef,
2500        product_definitional: Logical,
2501        identification: String,
2502    ) -> Result<CommonDatumId, AuthorError> {
2503        check_product_definition_shape_ref(&self.model, &of_shape)?;
2504        Ok(CommonDatumId(self.model.common_datum_arena.push(
2505            CommonDatum {
2506                name,
2507                description,
2508                of_shape,
2509                product_definitional,
2510                identification,
2511            },
2512        )))
2513    }
2514
2515    /// `COMPLEX_TRIANGULATED_FACE` — strict AP242 constructor.
2516    pub fn add_complex_triangulated_face(
2517        &mut self,
2518        name: String,
2519        coordinates: CoordinatesListRef,
2520        pnmax: i64,
2521        normals: Vec<Vec<f64>>,
2522        geometric_link: Option<FaceOrSurfaceRef>,
2523        pnindex: Vec<i64>,
2524        triangle_strips: Vec<Vec<i64>>,
2525        triangle_fans: Vec<Vec<i64>>,
2526    ) -> Result<ComplexTriangulatedFaceId, AuthorError> {
2527        check_coordinates_list_ref(&self.model, &coordinates)?;
2528        if let Some(x) = &geometric_link {
2529            check_face_or_surface_ref(&self.model, x)?;
2530        }
2531        Ok(ComplexTriangulatedFaceId(
2532            self.model
2533                .complex_triangulated_face_arena
2534                .push(ComplexTriangulatedFace {
2535                    name,
2536                    coordinates,
2537                    pnmax,
2538                    normals,
2539                    geometric_link,
2540                    pnindex,
2541                    triangle_strips,
2542                    triangle_fans,
2543                }),
2544        ))
2545    }
2546
2547    /// `COMPLEX_TRIANGULATED_SURFACE_SET` — strict AP242 constructor.
2548    pub fn add_complex_triangulated_surface_set(
2549        &mut self,
2550        name: String,
2551        coordinates: CoordinatesListRef,
2552        pnmax: i64,
2553        normals: Vec<Vec<f64>>,
2554        pnindex: Vec<i64>,
2555        triangle_strips: Vec<Vec<i64>>,
2556        triangle_fans: Vec<Vec<i64>>,
2557    ) -> Result<ComplexTriangulatedSurfaceSetId, AuthorError> {
2558        check_coordinates_list_ref(&self.model, &coordinates)?;
2559        Ok(ComplexTriangulatedSurfaceSetId(
2560            self.model
2561                .complex_triangulated_surface_set_arena
2562                .push(ComplexTriangulatedSurfaceSet {
2563                    name,
2564                    coordinates,
2565                    pnmax,
2566                    normals,
2567                    pnindex,
2568                    triangle_strips,
2569                    triangle_fans,
2570                }),
2571        ))
2572    }
2573
2574    /// `COMPOSITE_CURVE` — strict AP242 constructor.
2575    pub fn add_composite_curve(
2576        &mut self,
2577        name: String,
2578        segments: Vec<CompositeCurveSegmentRef>,
2579        self_intersect: Logical,
2580    ) -> Result<CompositeCurveId, AuthorError> {
2581        {
2582            let x = &segments;
2583            if x.len() < 1 {
2584                return Err(AuthorError::Cardinality {
2585                    entity: "COMPOSITE_CURVE",
2586                    attribute: "segments",
2587                    got: x.len(),
2588                    min: 1,
2589                    max: None,
2590                });
2591            }
2592        }
2593        for e0 in &segments {
2594            check_composite_curve_segment_ref(&self.model, e0)?;
2595        }
2596        Ok(CompositeCurveId(self.model.composite_curve_arena.push(
2597            CompositeCurve {
2598                name,
2599                segments,
2600                self_intersect,
2601            },
2602        )))
2603    }
2604
2605    /// `COMPOSITE_CURVE_SEGMENT` — strict AP242 constructor.
2606    pub fn add_composite_curve_segment(
2607        &mut self,
2608        transition: TransitionCode,
2609        same_sense: bool,
2610        parent_curve: CurveRef,
2611    ) -> Result<CompositeCurveSegmentId, AuthorError> {
2612        check_curve_ref(&self.model, &parent_curve)?;
2613        Ok(CompositeCurveSegmentId(
2614            self.model
2615                .composite_curve_segment_arena
2616                .push(CompositeCurveSegment {
2617                    transition,
2618                    same_sense,
2619                    parent_curve,
2620                }),
2621        ))
2622    }
2623
2624    /// `COMPOSITE_GROUP_SHAPE_ASPECT` — strict AP242 constructor.
2625    pub fn add_composite_group_shape_aspect(
2626        &mut self,
2627        name: String,
2628        description: Option<String>,
2629        of_shape: ProductDefinitionShapeRef,
2630        product_definitional: Logical,
2631    ) -> Result<CompositeGroupShapeAspectId, AuthorError> {
2632        check_product_definition_shape_ref(&self.model, &of_shape)?;
2633        Ok(CompositeGroupShapeAspectId(
2634            self.model
2635                .composite_group_shape_aspect_arena
2636                .push(CompositeGroupShapeAspect {
2637                    name,
2638                    description,
2639                    of_shape,
2640                    product_definitional,
2641                }),
2642        ))
2643    }
2644
2645    /// `COMPOSITE_SHAPE_ASPECT` — strict AP242 constructor.
2646    pub fn add_composite_shape_aspect(
2647        &mut self,
2648        name: String,
2649        description: Option<String>,
2650        of_shape: ProductDefinitionShapeRef,
2651        product_definitional: Logical,
2652    ) -> Result<CompositeShapeAspectId, AuthorError> {
2653        check_product_definition_shape_ref(&self.model, &of_shape)?;
2654        Ok(CompositeShapeAspectId(
2655            self.model
2656                .composite_shape_aspect_arena
2657                .push(CompositeShapeAspect {
2658                    name,
2659                    description,
2660                    of_shape,
2661                    product_definitional,
2662                }),
2663        ))
2664    }
2665
2666    /// `COMPOSITE_TEXT` — strict AP242 constructor.
2667    pub fn add_composite_text(
2668        &mut self,
2669        name: String,
2670        collected_text: Vec<TextOrCharacterRef>,
2671    ) -> Result<CompositeTextId, AuthorError> {
2672        {
2673            let x = &collected_text;
2674            if x.len() < 2 {
2675                return Err(AuthorError::Cardinality {
2676                    entity: "COMPOSITE_TEXT",
2677                    attribute: "collected_text",
2678                    got: x.len(),
2679                    min: 2,
2680                    max: None,
2681                });
2682            }
2683        }
2684        for e0 in &collected_text {
2685            check_text_or_character_ref(&self.model, e0)?;
2686        }
2687        Ok(CompositeTextId(self.model.composite_text_arena.push(
2688            CompositeText {
2689                name,
2690                collected_text,
2691            },
2692        )))
2693    }
2694
2695    /// `COMPOUND_REPRESENTATION_ITEM` — strict AP242 constructor.
2696    pub fn add_compound_representation_item(
2697        &mut self,
2698        name: String,
2699        item_element: CompoundItemDefinitionRef,
2700    ) -> Result<CompoundRepresentationItemId, AuthorError> {
2701        check_compound_item_definition_ref(&self.model, &item_element)?;
2702        Ok(CompoundRepresentationItemId(
2703            self.model
2704                .compound_representation_item_arena
2705                .push(CompoundRepresentationItem { name, item_element }),
2706        ))
2707    }
2708
2709    /// `CONCENTRICITY_TOLERANCE` — strict AP242 constructor.
2710    pub fn add_concentricity_tolerance(
2711        &mut self,
2712        name: String,
2713        description: Option<String>,
2714        magnitude: Option<LengthMeasureWithUnitRef>,
2715        toleranced_shape_aspect: GeometricToleranceTargetRef,
2716        datum_system: Vec<DatumSystemOrReferenceRef>,
2717    ) -> Result<ConcentricityToleranceId, AuthorError> {
2718        if let Some(x) = &magnitude {
2719            check_length_measure_with_unit_ref(&self.model, x)?;
2720        }
2721        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
2722        {
2723            let x = &datum_system;
2724            if x.len() < 1 {
2725                return Err(AuthorError::Cardinality {
2726                    entity: "CONCENTRICITY_TOLERANCE",
2727                    attribute: "datum_system",
2728                    got: x.len(),
2729                    min: 1,
2730                    max: None,
2731                });
2732            }
2733        }
2734        for e0 in &datum_system {
2735            check_datum_system_or_reference_ref(&self.model, e0)?;
2736        }
2737        Ok(ConcentricityToleranceId(
2738            self.model
2739                .concentricity_tolerance_arena
2740                .push(ConcentricityTolerance {
2741                    name,
2742                    description,
2743                    magnitude,
2744                    toleranced_shape_aspect,
2745                    datum_system,
2746                }),
2747        ))
2748    }
2749
2750    /// `CONFIGURATION_DESIGN` — strict AP242 constructor.
2751    pub fn add_configuration_design(
2752        &mut self,
2753        configuration: ConfigurationItemRef,
2754        design: ConfigurationDesignItemRef,
2755    ) -> Result<ConfigurationDesignId, AuthorError> {
2756        check_configuration_item_ref(&self.model, &configuration)?;
2757        check_configuration_design_item_ref(&self.model, &design)?;
2758        Ok(ConfigurationDesignId(
2759            self.model
2760                .configuration_design_arena
2761                .push(ConfigurationDesign {
2762                    configuration,
2763                    design,
2764                }),
2765        ))
2766    }
2767
2768    /// `CONFIGURATION_EFFECTIVITY` — strict AP242 constructor.
2769    pub fn add_configuration_effectivity(
2770        &mut self,
2771        id: String,
2772        usage: ProductDefinitionRelationshipRef,
2773        configuration: ConfigurationDesignRef,
2774    ) -> Result<ConfigurationEffectivityId, AuthorError> {
2775        check_product_definition_relationship_ref(&self.model, &usage)?;
2776        check_configuration_design_ref(&self.model, &configuration)?;
2777        Ok(ConfigurationEffectivityId(
2778            self.model
2779                .configuration_effectivity_arena
2780                .push(ConfigurationEffectivity {
2781                    id,
2782                    usage,
2783                    configuration,
2784                }),
2785        ))
2786    }
2787
2788    /// `CONFIGURATION_ITEM` — strict AP242 constructor.
2789    pub fn add_configuration_item(
2790        &mut self,
2791        id: String,
2792        name: String,
2793        description: Option<String>,
2794        item_concept: ProductConceptRef,
2795        purpose: Option<String>,
2796    ) -> Result<ConfigurationItemId, AuthorError> {
2797        check_product_concept_ref(&self.model, &item_concept)?;
2798        Ok(ConfigurationItemId(
2799            self.model.configuration_item_arena.push(ConfigurationItem {
2800                id,
2801                name,
2802                description,
2803                item_concept,
2804                purpose,
2805            }),
2806        ))
2807    }
2808
2809    /// `CONIC` — strict AP242 constructor.
2810    pub fn add_conic(
2811        &mut self,
2812        name: String,
2813        position: Axis2PlacementRef,
2814    ) -> Result<ConicId, AuthorError> {
2815        check_axis2_placement_ref(&self.model, &position)?;
2816        Ok(ConicId(
2817            self.model.conic_arena.push(Conic { name, position }),
2818        ))
2819    }
2820
2821    /// `CONICAL_SURFACE` — strict AP242 constructor.
2822    pub fn add_conical_surface(
2823        &mut self,
2824        name: String,
2825        position: Axis2Placement3dRef,
2826        radius: f64,
2827        semi_angle: f64,
2828    ) -> Result<ConicalSurfaceId, AuthorError> {
2829        check_axis2_placement3d_ref(&self.model, &position)?;
2830        Ok(ConicalSurfaceId(self.model.conical_surface_arena.push(
2831            ConicalSurface {
2832                name,
2833                position,
2834                radius,
2835                semi_angle,
2836            },
2837        )))
2838    }
2839
2840    /// `CONNECTED_FACE_SET` — strict AP242 constructor.
2841    pub fn add_connected_face_set(
2842        &mut self,
2843        name: String,
2844        cfs_faces: Option<Vec<FaceRef>>,
2845    ) -> Result<ConnectedFaceSetId, AuthorError> {
2846        if let Some(x) = &cfs_faces {
2847            if x.len() < 1 {
2848                return Err(AuthorError::Cardinality {
2849                    entity: "CONNECTED_FACE_SET",
2850                    attribute: "cfs_faces",
2851                    got: x.len(),
2852                    min: 1,
2853                    max: None,
2854                });
2855            }
2856        }
2857        if let Some(x) = &cfs_faces {
2858            for e0 in x {
2859                check_face_ref(&self.model, e0)?;
2860            }
2861        }
2862        Ok(ConnectedFaceSetId(
2863            self.model
2864                .connected_face_set_arena
2865                .push(ConnectedFaceSet { name, cfs_faces }),
2866        ))
2867    }
2868
2869    /// `CONSTRUCTIVE_GEOMETRY_REPRESENTATION` — strict AP242 constructor.
2870    pub fn add_constructive_geometry_representation(
2871        &mut self,
2872        name: String,
2873        items: Vec<RepresentationItemRef>,
2874        context_of_items: RepresentationContextRef,
2875    ) -> Result<ConstructiveGeometryRepresentationId, AuthorError> {
2876        {
2877            let x = &items;
2878            if x.len() < 1 {
2879                return Err(AuthorError::Cardinality {
2880                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
2881                    attribute: "items",
2882                    got: x.len(),
2883                    min: 1,
2884                    max: None,
2885                });
2886            }
2887        }
2888        for e0 in &items {
2889            check_representation_item_ref(&self.model, e0)?;
2890        }
2891        check_representation_context_ref(&self.model, &context_of_items)?;
2892        Ok(ConstructiveGeometryRepresentationId(
2893            self.model.constructive_geometry_representation_arena.push(
2894                ConstructiveGeometryRepresentation {
2895                    name,
2896                    items,
2897                    context_of_items,
2898                },
2899            ),
2900        ))
2901    }
2902
2903    /// `CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP` — strict AP242 constructor.
2904    pub fn add_constructive_geometry_representation_relationship(
2905        &mut self,
2906        name: String,
2907        description: Option<String>,
2908        rep_1: ConstructiveGeometryRepresentationOrShapeRepresentationRef,
2909        rep_2: RepresentationOrRepresentationReferenceRef,
2910    ) -> Result<ConstructiveGeometryRepresentationRelationshipId, AuthorError> {
2911        check_constructive_geometry_representation_or_shape_representation_ref(
2912            &self.model,
2913            &rep_1,
2914        )?;
2915        check_representation_or_representation_reference_ref(&self.model, &rep_2)?;
2916        Ok(ConstructiveGeometryRepresentationRelationshipId(
2917            self.model
2918                .constructive_geometry_representation_relationship_arena
2919                .push(ConstructiveGeometryRepresentationRelationship {
2920                    name,
2921                    description,
2922                    rep_1,
2923                    rep_2,
2924                }),
2925        ))
2926    }
2927
2928    /// `CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM` — strict AP242 constructor.
2929    pub fn add_context_dependent_over_riding_styled_item(
2930        &mut self,
2931        name: String,
2932        styles: Vec<PresentationStyleAssignmentRef>,
2933        item: StyledItemTargetRef,
2934        over_ridden_style: StyledItemRef,
2935        style_context: Vec<StyleContextSelectRef>,
2936    ) -> Result<ContextDependentOverRidingStyledItemId, AuthorError> {
2937        for e0 in &styles {
2938            check_presentation_style_assignment_ref(&self.model, e0)?;
2939        }
2940        check_styled_item_target_ref(&self.model, &item)?;
2941        check_styled_item_ref(&self.model, &over_ridden_style)?;
2942        {
2943            let x = &style_context;
2944            if x.len() < 1 {
2945                return Err(AuthorError::Cardinality {
2946                    entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
2947                    attribute: "style_context",
2948                    got: x.len(),
2949                    min: 1,
2950                    max: None,
2951                });
2952            }
2953        }
2954        for e0 in &style_context {
2955            check_style_context_select_ref(&self.model, e0)?;
2956        }
2957        Ok(ContextDependentOverRidingStyledItemId(
2958            self.model
2959                .context_dependent_over_riding_styled_item_arena
2960                .push(ContextDependentOverRidingStyledItem {
2961                    name,
2962                    styles,
2963                    item,
2964                    over_ridden_style,
2965                    style_context,
2966                }),
2967        ))
2968    }
2969
2970    /// `CONTEXT_DEPENDENT_SHAPE_REPRESENTATION` — strict AP242 constructor.
2971    pub fn add_context_dependent_shape_representation(
2972        &mut self,
2973        representation_relation: ShapeRepresentationRelationshipRef,
2974        represented_product_relation: ProductDefinitionShapeRef,
2975    ) -> Result<ContextDependentShapeRepresentationId, AuthorError> {
2976        check_shape_representation_relationship_ref(&self.model, &representation_relation)?;
2977        check_product_definition_shape_ref(&self.model, &represented_product_relation)?;
2978        Ok(ContextDependentShapeRepresentationId(
2979            self.model
2980                .context_dependent_shape_representation_arena
2981                .push(ContextDependentShapeRepresentation {
2982                    representation_relation,
2983                    represented_product_relation,
2984                }),
2985        ))
2986    }
2987
2988    /// `CONTEXT_DEPENDENT_UNIT` — strict AP242 constructor.
2989    pub fn add_context_dependent_unit(
2990        &mut self,
2991        dimensions: DimensionalExponentsRef,
2992        name: String,
2993    ) -> Result<ContextDependentUnitId, AuthorError> {
2994        check_dimensional_exponents_ref(&self.model, &dimensions)?;
2995        Ok(ContextDependentUnitId(
2996            self.model
2997                .context_dependent_unit_arena
2998                .push(ContextDependentUnit { dimensions, name }),
2999        ))
3000    }
3001
3002    /// `CONTINUOUS_SHAPE_ASPECT` — strict AP242 constructor.
3003    pub fn add_continuous_shape_aspect(
3004        &mut self,
3005        name: String,
3006        description: Option<String>,
3007        of_shape: ProductDefinitionShapeRef,
3008        product_definitional: Logical,
3009    ) -> Result<ContinuousShapeAspectId, AuthorError> {
3010        check_product_definition_shape_ref(&self.model, &of_shape)?;
3011        Ok(ContinuousShapeAspectId(
3012            self.model
3013                .continuous_shape_aspect_arena
3014                .push(ContinuousShapeAspect {
3015                    name,
3016                    description,
3017                    of_shape,
3018                    product_definitional,
3019                }),
3020        ))
3021    }
3022
3023    /// `CONTRACT` — strict AP242 constructor.
3024    pub fn add_contract(
3025        &mut self,
3026        name: String,
3027        purpose: String,
3028        kind: ContractTypeRef,
3029    ) -> Result<ContractId, AuthorError> {
3030        check_contract_type_ref(&self.model, &kind)?;
3031        Ok(ContractId(self.model.contract_arena.push(Contract {
3032            name,
3033            purpose,
3034            kind,
3035        })))
3036    }
3037
3038    /// `CONTRACT_TYPE` — strict AP242 constructor.
3039    pub fn add_contract_type(
3040        &mut self,
3041        description: String,
3042    ) -> Result<ContractTypeId, AuthorError> {
3043        Ok(ContractTypeId(
3044            self.model
3045                .contract_type_arena
3046                .push(ContractType { description }),
3047        ))
3048    }
3049
3050    /// `CONVERSION_BASED_UNIT` — strict AP242 constructor.
3051    pub fn add_conversion_based_unit(
3052        &mut self,
3053        dimensions: DimensionalExponentsRef,
3054        name: String,
3055        conversion_factor: MeasureWithUnitRef,
3056    ) -> Result<ConversionBasedUnitId, AuthorError> {
3057        check_dimensional_exponents_ref(&self.model, &dimensions)?;
3058        check_measure_with_unit_ref(&self.model, &conversion_factor)?;
3059        Ok(ConversionBasedUnitId(
3060            self.model
3061                .conversion_based_unit_arena
3062                .push(ConversionBasedUnit {
3063                    dimensions,
3064                    name,
3065                    conversion_factor,
3066                }),
3067        ))
3068    }
3069
3070    /// `COORDINATED_UNIVERSAL_TIME_OFFSET` — strict AP242 constructor.
3071    pub fn add_coordinated_universal_time_offset(
3072        &mut self,
3073        hour_offset: i64,
3074        minute_offset: Option<i64>,
3075        sense: AheadOrBehind,
3076    ) -> Result<CoordinatedUniversalTimeOffsetId, AuthorError> {
3077        Ok(CoordinatedUniversalTimeOffsetId(
3078            self.model.coordinated_universal_time_offset_arena.push(
3079                CoordinatedUniversalTimeOffset {
3080                    hour_offset,
3081                    minute_offset,
3082                    sense,
3083                },
3084            ),
3085        ))
3086    }
3087
3088    /// `COORDINATES_LIST` — strict AP242 constructor.
3089    pub fn add_coordinates_list(
3090        &mut self,
3091        name: String,
3092        npoints: i64,
3093        position_coords: Vec<Vec<f64>>,
3094    ) -> Result<CoordinatesListId, AuthorError> {
3095        {
3096            let x = &position_coords;
3097            if x.len() < 1 {
3098                return Err(AuthorError::Cardinality {
3099                    entity: "COORDINATES_LIST",
3100                    attribute: "position_coords",
3101                    got: x.len(),
3102                    min: 1,
3103                    max: None,
3104                });
3105            }
3106        }
3107        Ok(CoordinatesListId(self.model.coordinates_list_arena.push(
3108            CoordinatesList {
3109                name,
3110                npoints,
3111                position_coords,
3112            },
3113        )))
3114    }
3115
3116    /// `CURVE` — strict AP242 constructor.
3117    pub fn add_curve(&mut self, name: String) -> Result<CurveId, AuthorError> {
3118        Ok(CurveId(self.model.curve_arena.push(Curve { name })))
3119    }
3120
3121    /// `CURVE_STYLE` — strict AP242 constructor.
3122    pub fn add_curve_style(
3123        &mut self,
3124        name: String,
3125        curve_font: Option<CurveFontOrScaledCurveFontSelectRef>,
3126        curve_width: Option<SizeSelectRef>,
3127        curve_colour: Option<ColourRef>,
3128    ) -> Result<CurveStyleId, AuthorError> {
3129        if let Some(x) = &curve_font {
3130            check_curve_font_or_scaled_curve_font_select_ref(&self.model, x)?;
3131        }
3132        if let Some(x) = &curve_width {
3133            check_size_select_ref(&self.model, x)?;
3134        }
3135        if let Some(x) = &curve_colour {
3136            check_colour_ref(&self.model, x)?;
3137        }
3138        Ok(CurveStyleId(self.model.curve_style_arena.push(
3139            CurveStyle {
3140                name,
3141                curve_font,
3142                curve_width,
3143                curve_colour,
3144            },
3145        )))
3146    }
3147
3148    /// `CURVE_STYLE_FONT` — strict AP242 constructor.
3149    pub fn add_curve_style_font(
3150        &mut self,
3151        name: String,
3152        pattern_list: Vec<CurveStyleFontPatternRef>,
3153    ) -> Result<CurveStyleFontId, AuthorError> {
3154        {
3155            let x = &pattern_list;
3156            if x.len() < 1 {
3157                return Err(AuthorError::Cardinality {
3158                    entity: "CURVE_STYLE_FONT",
3159                    attribute: "pattern_list",
3160                    got: x.len(),
3161                    min: 1,
3162                    max: None,
3163                });
3164            }
3165        }
3166        for e0 in &pattern_list {
3167            check_curve_style_font_pattern_ref(&self.model, e0)?;
3168        }
3169        Ok(CurveStyleFontId(
3170            self.model
3171                .curve_style_font_arena
3172                .push(CurveStyleFont { name, pattern_list }),
3173        ))
3174    }
3175
3176    /// `CURVE_STYLE_FONT_AND_SCALING` — strict AP242 constructor.
3177    pub fn add_curve_style_font_and_scaling(
3178        &mut self,
3179        name: String,
3180        curve_font: CurveStyleFontSelectRef,
3181        curve_font_scaling: f64,
3182    ) -> Result<CurveStyleFontAndScalingId, AuthorError> {
3183        check_curve_style_font_select_ref(&self.model, &curve_font)?;
3184        Ok(CurveStyleFontAndScalingId(
3185            self.model
3186                .curve_style_font_and_scaling_arena
3187                .push(CurveStyleFontAndScaling {
3188                    name,
3189                    curve_font,
3190                    curve_font_scaling,
3191                }),
3192        ))
3193    }
3194
3195    /// `CURVE_STYLE_FONT_PATTERN` — strict AP242 constructor.
3196    pub fn add_curve_style_font_pattern(
3197        &mut self,
3198        visible_segment_length: f64,
3199        invisible_segment_length: f64,
3200    ) -> Result<CurveStyleFontPatternId, AuthorError> {
3201        Ok(CurveStyleFontPatternId(
3202            self.model
3203                .curve_style_font_pattern_arena
3204                .push(CurveStyleFontPattern {
3205                    visible_segment_length,
3206                    invisible_segment_length,
3207                }),
3208        ))
3209    }
3210
3211    /// `CURVE_STYLE_RENDERING` — strict AP242 constructor.
3212    pub fn add_curve_style_rendering(
3213        &mut self,
3214        rendering_method: ShadingCurveMethod,
3215        rendering_properties: SurfaceRenderingPropertiesRef,
3216    ) -> Result<CurveStyleRenderingId, AuthorError> {
3217        check_surface_rendering_properties_ref(&self.model, &rendering_properties)?;
3218        Ok(CurveStyleRenderingId(
3219            self.model
3220                .curve_style_rendering_arena
3221                .push(CurveStyleRendering {
3222                    rendering_method,
3223                    rendering_properties,
3224                }),
3225        ))
3226    }
3227
3228    /// `CYLINDRICAL_SURFACE` — strict AP242 constructor.
3229    pub fn add_cylindrical_surface(
3230        &mut self,
3231        name: String,
3232        position: Axis2Placement3dRef,
3233        radius: f64,
3234    ) -> Result<CylindricalSurfaceId, AuthorError> {
3235        check_axis2_placement3d_ref(&self.model, &position)?;
3236        Ok(CylindricalSurfaceId(
3237            self.model
3238                .cylindrical_surface_arena
3239                .push(CylindricalSurface {
3240                    name,
3241                    position,
3242                    radius,
3243                }),
3244        ))
3245    }
3246
3247    /// `CYLINDRICITY_TOLERANCE` — strict AP242 constructor.
3248    pub fn add_cylindricity_tolerance(
3249        &mut self,
3250        name: String,
3251        description: Option<String>,
3252        magnitude: Option<LengthMeasureWithUnitRef>,
3253        toleranced_shape_aspect: GeometricToleranceTargetRef,
3254    ) -> Result<CylindricityToleranceId, AuthorError> {
3255        if let Some(x) = &magnitude {
3256            check_length_measure_with_unit_ref(&self.model, x)?;
3257        }
3258        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
3259        Ok(CylindricityToleranceId(
3260            self.model
3261                .cylindricity_tolerance_arena
3262                .push(CylindricityTolerance {
3263                    name,
3264                    description,
3265                    magnitude,
3266                    toleranced_shape_aspect,
3267                }),
3268        ))
3269    }
3270
3271    /// `DATE` — strict AP242 constructor.
3272    pub fn add_date(&mut self, year_component: i64) -> Result<DateId, AuthorError> {
3273        Ok(DateId(self.model.date_arena.push(Date { year_component })))
3274    }
3275
3276    /// `DATE_AND_TIME` — strict AP242 constructor.
3277    pub fn add_date_and_time(
3278        &mut self,
3279        date_component: DateRef,
3280        time_component: LocalTimeRef,
3281    ) -> Result<DateAndTimeId, AuthorError> {
3282        check_date_ref(&self.model, &date_component)?;
3283        check_local_time_ref(&self.model, &time_component)?;
3284        Ok(DateAndTimeId(self.model.date_and_time_arena.push(
3285            DateAndTime {
3286                date_component,
3287                time_component,
3288            },
3289        )))
3290    }
3291
3292    /// `DATE_AND_TIME_ASSIGNMENT` — strict AP242 constructor.
3293    pub fn add_date_and_time_assignment(
3294        &mut self,
3295        assigned_date_and_time: DateAndTimeRef,
3296        role: DateTimeRoleRef,
3297    ) -> Result<DateAndTimeAssignmentId, AuthorError> {
3298        check_date_and_time_ref(&self.model, &assigned_date_and_time)?;
3299        check_date_time_role_ref(&self.model, &role)?;
3300        Ok(DateAndTimeAssignmentId(
3301            self.model
3302                .date_and_time_assignment_arena
3303                .push(DateAndTimeAssignment {
3304                    assigned_date_and_time,
3305                    role,
3306                }),
3307        ))
3308    }
3309
3310    /// `DATE_ROLE` — strict AP242 constructor.
3311    pub fn add_date_role(&mut self, name: String) -> Result<DateRoleId, AuthorError> {
3312        Ok(DateRoleId(
3313            self.model.date_role_arena.push(DateRole { name }),
3314        ))
3315    }
3316
3317    /// `DATE_TIME_ROLE` — strict AP242 constructor.
3318    pub fn add_date_time_role(&mut self, name: String) -> Result<DateTimeRoleId, AuthorError> {
3319        Ok(DateTimeRoleId(
3320            self.model.date_time_role_arena.push(DateTimeRole { name }),
3321        ))
3322    }
3323
3324    /// `DATUM` — strict AP242 constructor.
3325    pub fn add_datum(
3326        &mut self,
3327        name: String,
3328        description: Option<String>,
3329        of_shape: ProductDefinitionShapeRef,
3330        product_definitional: Logical,
3331        identification: String,
3332    ) -> Result<DatumId, AuthorError> {
3333        check_product_definition_shape_ref(&self.model, &of_shape)?;
3334        Ok(DatumId(self.model.datum_arena.push(Datum {
3335            name,
3336            description,
3337            of_shape,
3338            product_definitional,
3339            identification,
3340        })))
3341    }
3342
3343    /// `DATUM_FEATURE` — strict AP242 constructor.
3344    pub fn add_datum_feature(
3345        &mut self,
3346        name: String,
3347        description: Option<String>,
3348        of_shape: ProductDefinitionShapeRef,
3349        product_definitional: Logical,
3350    ) -> Result<DatumFeatureId, AuthorError> {
3351        check_product_definition_shape_ref(&self.model, &of_shape)?;
3352        Ok(DatumFeatureId(self.model.datum_feature_arena.push(
3353            DatumFeature {
3354                name,
3355                description,
3356                of_shape,
3357                product_definitional,
3358            },
3359        )))
3360    }
3361
3362    /// `DATUM_REFERENCE` — strict AP242 constructor.
3363    pub fn add_datum_reference(
3364        &mut self,
3365        precedence: i64,
3366        referenced_datum: DatumRef,
3367    ) -> Result<DatumReferenceId, AuthorError> {
3368        check_datum_ref(&self.model, &referenced_datum)?;
3369        Ok(DatumReferenceId(self.model.datum_reference_arena.push(
3370            DatumReference {
3371                precedence,
3372                referenced_datum,
3373            },
3374        )))
3375    }
3376
3377    /// `DATUM_REFERENCE_COMPARTMENT` — strict AP242 constructor.
3378    pub fn add_datum_reference_compartment(
3379        &mut self,
3380        name: String,
3381        description: Option<String>,
3382        of_shape: ProductDefinitionShapeRef,
3383        product_definitional: Logical,
3384        base: DatumOrCommonDatumRef,
3385        modifiers: Option<Vec<DatumReferenceModifierRef>>,
3386    ) -> Result<DatumReferenceCompartmentId, AuthorError> {
3387        check_product_definition_shape_ref(&self.model, &of_shape)?;
3388        check_datum_or_common_datum_ref(&self.model, &base)?;
3389        if let Some(x) = &modifiers {
3390            if x.len() < 1 {
3391                return Err(AuthorError::Cardinality {
3392                    entity: "DATUM_REFERENCE_COMPARTMENT",
3393                    attribute: "modifiers",
3394                    got: x.len(),
3395                    min: 1,
3396                    max: None,
3397                });
3398            }
3399        }
3400        if let Some(x) = &modifiers {
3401            for e0 in x {
3402                check_datum_reference_modifier_ref(&self.model, e0)?;
3403            }
3404        }
3405        Ok(DatumReferenceCompartmentId(
3406            self.model
3407                .datum_reference_compartment_arena
3408                .push(DatumReferenceCompartment {
3409                    name,
3410                    description,
3411                    of_shape,
3412                    product_definitional,
3413                    base,
3414                    modifiers,
3415                }),
3416        ))
3417    }
3418
3419    /// `DATUM_REFERENCE_ELEMENT` — strict AP242 constructor.
3420    pub fn add_datum_reference_element(
3421        &mut self,
3422        name: String,
3423        description: Option<String>,
3424        of_shape: ProductDefinitionShapeRef,
3425        product_definitional: Logical,
3426        base: DatumOrCommonDatumRef,
3427        modifiers: Option<Vec<DatumReferenceModifierRef>>,
3428    ) -> Result<DatumReferenceElementId, AuthorError> {
3429        check_product_definition_shape_ref(&self.model, &of_shape)?;
3430        check_datum_or_common_datum_ref(&self.model, &base)?;
3431        if let Some(x) = &modifiers {
3432            if x.len() < 1 {
3433                return Err(AuthorError::Cardinality {
3434                    entity: "DATUM_REFERENCE_ELEMENT",
3435                    attribute: "modifiers",
3436                    got: x.len(),
3437                    min: 1,
3438                    max: None,
3439                });
3440            }
3441        }
3442        if let Some(x) = &modifiers {
3443            for e0 in x {
3444                check_datum_reference_modifier_ref(&self.model, e0)?;
3445            }
3446        }
3447        Ok(DatumReferenceElementId(
3448            self.model
3449                .datum_reference_element_arena
3450                .push(DatumReferenceElement {
3451                    name,
3452                    description,
3453                    of_shape,
3454                    product_definitional,
3455                    base,
3456                    modifiers,
3457                }),
3458        ))
3459    }
3460
3461    /// `DATUM_REFERENCE_MODIFIER_WITH_VALUE` — strict AP242 constructor.
3462    pub fn add_datum_reference_modifier_with_value(
3463        &mut self,
3464        modifier_type: DatumReferenceModifierType,
3465        modifier_value: LengthMeasureWithUnitRef,
3466    ) -> Result<DatumReferenceModifierWithValueId, AuthorError> {
3467        check_length_measure_with_unit_ref(&self.model, &modifier_value)?;
3468        Ok(DatumReferenceModifierWithValueId(
3469            self.model.datum_reference_modifier_with_value_arena.push(
3470                DatumReferenceModifierWithValue {
3471                    modifier_type,
3472                    modifier_value,
3473                },
3474            ),
3475        ))
3476    }
3477
3478    /// `DATUM_SYSTEM` — strict AP242 constructor.
3479    pub fn add_datum_system(
3480        &mut self,
3481        name: String,
3482        description: Option<String>,
3483        of_shape: ProductDefinitionShapeRef,
3484        product_definitional: Logical,
3485        constituents: Vec<DatumReferenceCompartmentRef>,
3486    ) -> Result<DatumSystemId, AuthorError> {
3487        check_product_definition_shape_ref(&self.model, &of_shape)?;
3488        {
3489            let x = &constituents;
3490            if x.len() < 1 || x.len() > 3 {
3491                return Err(AuthorError::Cardinality {
3492                    entity: "DATUM_SYSTEM",
3493                    attribute: "constituents",
3494                    got: x.len(),
3495                    min: 1,
3496                    max: Some(3),
3497                });
3498            }
3499        }
3500        for e0 in &constituents {
3501            check_datum_reference_compartment_ref(&self.model, e0)?;
3502        }
3503        Ok(DatumSystemId(self.model.datum_system_arena.push(
3504            DatumSystem {
3505                name,
3506                description,
3507                of_shape,
3508                product_definitional,
3509                constituents,
3510            },
3511        )))
3512    }
3513
3514    /// `DATUM_TARGET` — strict AP242 constructor.
3515    pub fn add_datum_target(
3516        &mut self,
3517        name: String,
3518        description: Option<String>,
3519        of_shape: ProductDefinitionShapeRef,
3520        product_definitional: Logical,
3521        target_id: String,
3522    ) -> Result<DatumTargetId, AuthorError> {
3523        check_product_definition_shape_ref(&self.model, &of_shape)?;
3524        Ok(DatumTargetId(self.model.datum_target_arena.push(
3525            DatumTarget {
3526                name,
3527                description,
3528                of_shape,
3529                product_definitional,
3530                target_id,
3531            },
3532        )))
3533    }
3534
3535    /// `DEFAULT_MODEL_GEOMETRIC_VIEW` — strict AP242 constructor.
3536    pub fn add_default_model_geometric_view(
3537        &mut self,
3538        name: String,
3539        description: Option<String>,
3540        item: RepresentationItemRef,
3541        rep: RepresentationRef,
3542        name_1: String,
3543        description_1: Option<String>,
3544        of_shape: ProductDefinitionShapeRef,
3545    ) -> Result<DefaultModelGeometricViewId, AuthorError> {
3546        check_representation_item_ref(&self.model, &item)?;
3547        check_representation_ref(&self.model, &rep)?;
3548        check_product_definition_shape_ref(&self.model, &of_shape)?;
3549        Ok(DefaultModelGeometricViewId(
3550            self.model
3551                .default_model_geometric_view_arena
3552                .push(DefaultModelGeometricView {
3553                    name,
3554                    description,
3555                    item,
3556                    rep,
3557                    name_1,
3558                    description_1,
3559                    of_shape,
3560                }),
3561        ))
3562    }
3563
3564    /// `DEFINED_CHARACTER_GLYPH` — strict AP242 constructor.
3565    pub fn add_defined_character_glyph(
3566        &mut self,
3567        name: String,
3568        definition: DefinedGlyphSelectRef,
3569        placement: Axis2PlacementRef,
3570    ) -> Result<DefinedCharacterGlyphId, AuthorError> {
3571        check_defined_glyph_select_ref(&self.model, &definition)?;
3572        check_axis2_placement_ref(&self.model, &placement)?;
3573        Ok(DefinedCharacterGlyphId(
3574            self.model
3575                .defined_character_glyph_arena
3576                .push(DefinedCharacterGlyph {
3577                    name,
3578                    definition,
3579                    placement,
3580                }),
3581        ))
3582    }
3583
3584    /// `DEFINED_SYMBOL` — strict AP242 constructor.
3585    pub fn add_defined_symbol(
3586        &mut self,
3587        name: String,
3588        definition: DefinedSymbolSelectRef,
3589        target: SymbolTargetRef,
3590    ) -> Result<DefinedSymbolId, AuthorError> {
3591        check_defined_symbol_select_ref(&self.model, &definition)?;
3592        check_symbol_target_ref(&self.model, &target)?;
3593        Ok(DefinedSymbolId(self.model.defined_symbol_arena.push(
3594            DefinedSymbol {
3595                name,
3596                definition,
3597                target,
3598            },
3599        )))
3600    }
3601
3602    /// `DEFINITIONAL_REPRESENTATION` — strict AP242 constructor.
3603    pub fn add_definitional_representation(
3604        &mut self,
3605        name: String,
3606        items: Vec<RepresentationItemRef>,
3607        context_of_items: RepresentationContextRef,
3608    ) -> Result<DefinitionalRepresentationId, AuthorError> {
3609        {
3610            let x = &items;
3611            if x.len() < 1 {
3612                return Err(AuthorError::Cardinality {
3613                    entity: "DEFINITIONAL_REPRESENTATION",
3614                    attribute: "items",
3615                    got: x.len(),
3616                    min: 1,
3617                    max: None,
3618                });
3619            }
3620        }
3621        for e0 in &items {
3622            check_representation_item_ref(&self.model, e0)?;
3623        }
3624        check_representation_context_ref(&self.model, &context_of_items)?;
3625        Ok(DefinitionalRepresentationId(
3626            self.model
3627                .definitional_representation_arena
3628                .push(DefinitionalRepresentation {
3629                    name,
3630                    items,
3631                    context_of_items,
3632                }),
3633        ))
3634    }
3635
3636    /// `DEFINITIONAL_REPRESENTATION_RELATIONSHIP` — strict AP242 constructor.
3637    pub fn add_definitional_representation_relationship(
3638        &mut self,
3639        name: String,
3640        description: Option<String>,
3641        rep_1: RepresentationOrRepresentationReferenceRef,
3642        rep_2: RepresentationOrRepresentationReferenceRef,
3643    ) -> Result<DefinitionalRepresentationRelationshipId, AuthorError> {
3644        check_representation_or_representation_reference_ref(&self.model, &rep_1)?;
3645        check_representation_or_representation_reference_ref(&self.model, &rep_2)?;
3646        Ok(DefinitionalRepresentationRelationshipId(
3647            self.model
3648                .definitional_representation_relationship_arena
3649                .push(DefinitionalRepresentationRelationship {
3650                    name,
3651                    description,
3652                    rep_1,
3653                    rep_2,
3654                }),
3655        ))
3656    }
3657
3658    /// `DEFINITIONAL_REPRESENTATION_RELATIONSHIP_WITH_SAME_CONTEXT` — strict AP242 constructor.
3659    pub fn add_definitional_representation_relationship_with_same_context(
3660        &mut self,
3661        name: String,
3662        description: Option<String>,
3663        rep_1: RepresentationOrRepresentationReferenceRef,
3664        rep_2: RepresentationOrRepresentationReferenceRef,
3665    ) -> Result<DefinitionalRepresentationRelationshipWithSameContextId, AuthorError> {
3666        check_representation_or_representation_reference_ref(&self.model, &rep_1)?;
3667        check_representation_or_representation_reference_ref(&self.model, &rep_2)?;
3668        Ok(DefinitionalRepresentationRelationshipWithSameContextId(
3669            self.model
3670                .definitional_representation_relationship_with_same_context_arena
3671                .push(DefinitionalRepresentationRelationshipWithSameContext {
3672                    name,
3673                    description,
3674                    rep_1,
3675                    rep_2,
3676                }),
3677        ))
3678    }
3679
3680    /// `DEGENERATE_TOROIDAL_SURFACE` — strict AP242 constructor.
3681    pub fn add_degenerate_toroidal_surface(
3682        &mut self,
3683        name: String,
3684        position: Axis2Placement3dRef,
3685        major_radius: f64,
3686        minor_radius: f64,
3687        select_outer: bool,
3688    ) -> Result<DegenerateToroidalSurfaceId, AuthorError> {
3689        check_axis2_placement3d_ref(&self.model, &position)?;
3690        Ok(DegenerateToroidalSurfaceId(
3691            self.model
3692                .degenerate_toroidal_surface_arena
3693                .push(DegenerateToroidalSurface {
3694                    name,
3695                    position,
3696                    major_radius,
3697                    minor_radius,
3698                    select_outer,
3699                }),
3700        ))
3701    }
3702
3703    /// `DERIVED_SHAPE_ASPECT` — strict AP242 constructor.
3704    pub fn add_derived_shape_aspect(
3705        &mut self,
3706        name: String,
3707        description: Option<String>,
3708        of_shape: ProductDefinitionShapeRef,
3709        product_definitional: Logical,
3710    ) -> Result<DerivedShapeAspectId, AuthorError> {
3711        check_product_definition_shape_ref(&self.model, &of_shape)?;
3712        Ok(DerivedShapeAspectId(
3713            self.model
3714                .derived_shape_aspect_arena
3715                .push(DerivedShapeAspect {
3716                    name,
3717                    description,
3718                    of_shape,
3719                    product_definitional,
3720                }),
3721        ))
3722    }
3723
3724    /// `DERIVED_UNIT` — strict AP242 constructor.
3725    pub fn add_derived_unit(
3726        &mut self,
3727        elements: Vec<DerivedUnitElementRef>,
3728    ) -> Result<DerivedUnitId, AuthorError> {
3729        {
3730            let x = &elements;
3731            if x.len() < 1 {
3732                return Err(AuthorError::Cardinality {
3733                    entity: "DERIVED_UNIT",
3734                    attribute: "elements",
3735                    got: x.len(),
3736                    min: 1,
3737                    max: None,
3738                });
3739            }
3740        }
3741        for e0 in &elements {
3742            check_derived_unit_element_ref(&self.model, e0)?;
3743        }
3744        Ok(DerivedUnitId(
3745            self.model.derived_unit_arena.push(DerivedUnit { elements }),
3746        ))
3747    }
3748
3749    /// `DERIVED_UNIT_ELEMENT` — strict AP242 constructor.
3750    pub fn add_derived_unit_element(
3751        &mut self,
3752        unit: NamedUnitRef,
3753        exponent: f64,
3754    ) -> Result<DerivedUnitElementId, AuthorError> {
3755        check_named_unit_ref(&self.model, &unit)?;
3756        Ok(DerivedUnitElementId(
3757            self.model
3758                .derived_unit_element_arena
3759                .push(DerivedUnitElement { unit, exponent }),
3760        ))
3761    }
3762
3763    /// `DESCRIPTION_ATTRIBUTE` — strict AP242 constructor.
3764    pub fn add_description_attribute(
3765        &mut self,
3766        attribute_value: String,
3767        described_item: DescriptionAttributeSelectRef,
3768    ) -> Result<DescriptionAttributeId, AuthorError> {
3769        check_description_attribute_select_ref(&self.model, &described_item)?;
3770        Ok(DescriptionAttributeId(
3771            self.model
3772                .description_attribute_arena
3773                .push(DescriptionAttribute {
3774                    attribute_value,
3775                    described_item,
3776                }),
3777        ))
3778    }
3779
3780    /// `DESCRIPTIVE_REPRESENTATION_ITEM` — strict AP242 constructor.
3781    pub fn add_descriptive_representation_item(
3782        &mut self,
3783        name: String,
3784        description: String,
3785    ) -> Result<DescriptiveRepresentationItemId, AuthorError> {
3786        Ok(DescriptiveRepresentationItemId(
3787            self.model
3788                .descriptive_representation_item_arena
3789                .push(DescriptiveRepresentationItem { name, description }),
3790        ))
3791    }
3792
3793    /// `DESIGN_CONTEXT` — strict AP242 constructor.
3794    pub fn add_design_context(
3795        &mut self,
3796        name: String,
3797        frame_of_reference: ApplicationContextRef,
3798        life_cycle_stage: String,
3799    ) -> Result<DesignContextId, AuthorError> {
3800        check_application_context_ref(&self.model, &frame_of_reference)?;
3801        Ok(DesignContextId(self.model.design_context_arena.push(
3802            DesignContext {
3803                name,
3804                frame_of_reference,
3805                life_cycle_stage,
3806            },
3807        )))
3808    }
3809
3810    /// `DIMENSIONAL_CHARACTERISTIC_REPRESENTATION` — strict AP242 constructor.
3811    pub fn add_dimensional_characteristic_representation(
3812        &mut self,
3813        dimension: DimensionalCharacteristicRef,
3814        representation: ShapeDimensionRepresentationRef,
3815    ) -> Result<DimensionalCharacteristicRepresentationId, AuthorError> {
3816        check_dimensional_characteristic_ref(&self.model, &dimension)?;
3817        check_shape_dimension_representation_ref(&self.model, &representation)?;
3818        Ok(DimensionalCharacteristicRepresentationId(
3819            self.model
3820                .dimensional_characteristic_representation_arena
3821                .push(DimensionalCharacteristicRepresentation {
3822                    dimension,
3823                    representation,
3824                }),
3825        ))
3826    }
3827
3828    /// `DIMENSIONAL_EXPONENTS` — strict AP242 constructor.
3829    pub fn add_dimensional_exponents(
3830        &mut self,
3831        length_exponent: f64,
3832        mass_exponent: f64,
3833        time_exponent: f64,
3834        electric_current_exponent: f64,
3835        thermodynamic_temperature_exponent: f64,
3836        amount_of_substance_exponent: f64,
3837        luminous_intensity_exponent: f64,
3838    ) -> Result<DimensionalExponentsId, AuthorError> {
3839        Ok(DimensionalExponentsId(
3840            self.model
3841                .dimensional_exponents_arena
3842                .push(DimensionalExponents {
3843                    length_exponent,
3844                    mass_exponent,
3845                    time_exponent,
3846                    electric_current_exponent,
3847                    thermodynamic_temperature_exponent,
3848                    amount_of_substance_exponent,
3849                    luminous_intensity_exponent,
3850                }),
3851        ))
3852    }
3853
3854    /// `DIMENSIONAL_LOCATION` — strict AP242 constructor.
3855    pub fn add_dimensional_location(
3856        &mut self,
3857        name: String,
3858        description: Option<String>,
3859        relating_shape_aspect: ShapeAspectRef,
3860        related_shape_aspect: ShapeAspectRef,
3861    ) -> Result<DimensionalLocationId, AuthorError> {
3862        check_shape_aspect_ref(&self.model, &relating_shape_aspect)?;
3863        check_shape_aspect_ref(&self.model, &related_shape_aspect)?;
3864        Ok(DimensionalLocationId(
3865            self.model
3866                .dimensional_location_arena
3867                .push(DimensionalLocation {
3868                    name,
3869                    description,
3870                    relating_shape_aspect,
3871                    related_shape_aspect,
3872                }),
3873        ))
3874    }
3875
3876    /// `DIMENSIONAL_LOCATION_WITH_PATH` — strict AP242 constructor.
3877    pub fn add_dimensional_location_with_path(
3878        &mut self,
3879        name: String,
3880        description: Option<String>,
3881        relating_shape_aspect: ShapeAspectRef,
3882        related_shape_aspect: ShapeAspectRef,
3883        path: ShapeAspectRef,
3884    ) -> Result<DimensionalLocationWithPathId, AuthorError> {
3885        check_shape_aspect_ref(&self.model, &relating_shape_aspect)?;
3886        check_shape_aspect_ref(&self.model, &related_shape_aspect)?;
3887        check_shape_aspect_ref(&self.model, &path)?;
3888        Ok(DimensionalLocationWithPathId(
3889            self.model
3890                .dimensional_location_with_path_arena
3891                .push(DimensionalLocationWithPath {
3892                    name,
3893                    description,
3894                    relating_shape_aspect,
3895                    related_shape_aspect,
3896                    path,
3897                }),
3898        ))
3899    }
3900
3901    /// `DIMENSIONAL_SIZE` — strict AP242 constructor.
3902    pub fn add_dimensional_size(
3903        &mut self,
3904        applies_to: ShapeAspectRef,
3905        name: String,
3906    ) -> Result<DimensionalSizeId, AuthorError> {
3907        check_shape_aspect_ref(&self.model, &applies_to)?;
3908        Ok(DimensionalSizeId(
3909            self.model
3910                .dimensional_size_arena
3911                .push(DimensionalSize { applies_to, name }),
3912        ))
3913    }
3914
3915    /// `DIMENSIONAL_SIZE_WITH_DATUM_FEATURE` — strict AP242 constructor.
3916    pub fn add_dimensional_size_with_datum_feature(
3917        &mut self,
3918        name: String,
3919        description: Option<String>,
3920        of_shape: ProductDefinitionShapeRef,
3921        product_definitional: Logical,
3922        applies_to: ShapeAspectRef,
3923        name_1: String,
3924    ) -> Result<DimensionalSizeWithDatumFeatureId, AuthorError> {
3925        check_product_definition_shape_ref(&self.model, &of_shape)?;
3926        check_shape_aspect_ref(&self.model, &applies_to)?;
3927        Ok(DimensionalSizeWithDatumFeatureId(
3928            self.model.dimensional_size_with_datum_feature_arena.push(
3929                DimensionalSizeWithDatumFeature {
3930                    name,
3931                    description,
3932                    of_shape,
3933                    product_definitional,
3934                    applies_to,
3935                    name_1,
3936                },
3937            ),
3938        ))
3939    }
3940
3941    /// `DIMENSIONAL_SIZE_WITH_PATH` — strict AP242 constructor.
3942    pub fn add_dimensional_size_with_path(
3943        &mut self,
3944        applies_to: ShapeAspectRef,
3945        name: String,
3946        path: ShapeAspectRef,
3947    ) -> Result<DimensionalSizeWithPathId, AuthorError> {
3948        check_shape_aspect_ref(&self.model, &applies_to)?;
3949        check_shape_aspect_ref(&self.model, &path)?;
3950        Ok(DimensionalSizeWithPathId(
3951            self.model
3952                .dimensional_size_with_path_arena
3953                .push(DimensionalSizeWithPath {
3954                    applies_to,
3955                    name,
3956                    path,
3957                }),
3958        ))
3959    }
3960
3961    /// `DIRECTED_DIMENSIONAL_LOCATION` — strict AP242 constructor.
3962    pub fn add_directed_dimensional_location(
3963        &mut self,
3964        name: String,
3965        description: Option<String>,
3966        relating_shape_aspect: ShapeAspectRef,
3967        related_shape_aspect: ShapeAspectRef,
3968    ) -> Result<DirectedDimensionalLocationId, AuthorError> {
3969        check_shape_aspect_ref(&self.model, &relating_shape_aspect)?;
3970        check_shape_aspect_ref(&self.model, &related_shape_aspect)?;
3971        Ok(DirectedDimensionalLocationId(
3972            self.model
3973                .directed_dimensional_location_arena
3974                .push(DirectedDimensionalLocation {
3975                    name,
3976                    description,
3977                    relating_shape_aspect,
3978                    related_shape_aspect,
3979                }),
3980        ))
3981    }
3982
3983    /// `DIRECTION` — strict AP242 constructor.
3984    pub fn add_direction(
3985        &mut self,
3986        name: String,
3987        direction_ratios: Vec<f64>,
3988    ) -> Result<DirectionId, AuthorError> {
3989        {
3990            let x = &direction_ratios;
3991            if x.len() < 2 || x.len() > 3 {
3992                return Err(AuthorError::Cardinality {
3993                    entity: "DIRECTION",
3994                    attribute: "direction_ratios",
3995                    got: x.len(),
3996                    min: 2,
3997                    max: Some(3),
3998                });
3999            }
4000        }
4001        Ok(DirectionId(self.model.direction_arena.push(Direction {
4002            name,
4003            direction_ratios,
4004        })))
4005    }
4006
4007    /// `DOCUMENT` — strict AP242 constructor.
4008    pub fn add_document(
4009        &mut self,
4010        id: String,
4011        name: String,
4012        description: Option<String>,
4013        kind: DocumentTypeRef,
4014    ) -> Result<DocumentId, AuthorError> {
4015        check_document_type_ref(&self.model, &kind)?;
4016        Ok(DocumentId(self.model.document_arena.push(Document {
4017            id,
4018            name,
4019            description,
4020            kind,
4021        })))
4022    }
4023
4024    /// `DOCUMENT_FILE` — strict AP242 constructor.
4025    pub fn add_document_file(
4026        &mut self,
4027        id: String,
4028        name: String,
4029        description: Option<String>,
4030        kind: DocumentTypeRef,
4031        name_1: String,
4032        description_1: Option<String>,
4033    ) -> Result<DocumentFileId, AuthorError> {
4034        check_document_type_ref(&self.model, &kind)?;
4035        Ok(DocumentFileId(self.model.document_file_arena.push(
4036            DocumentFile {
4037                id,
4038                name,
4039                description,
4040                kind,
4041                name_1,
4042                description_1,
4043            },
4044        )))
4045    }
4046
4047    /// `DOCUMENT_PRODUCT_ASSOCIATION` — strict AP242 constructor.
4048    pub fn add_document_product_association(
4049        &mut self,
4050        name: String,
4051        description: Option<String>,
4052        relating_document: DocumentRef,
4053        related_product: ProductOrFormationOrDefinitionRef,
4054    ) -> Result<DocumentProductAssociationId, AuthorError> {
4055        check_document_ref(&self.model, &relating_document)?;
4056        check_product_or_formation_or_definition_ref(&self.model, &related_product)?;
4057        Ok(DocumentProductAssociationId(
4058            self.model
4059                .document_product_association_arena
4060                .push(DocumentProductAssociation {
4061                    name,
4062                    description,
4063                    relating_document,
4064                    related_product,
4065                }),
4066        ))
4067    }
4068
4069    /// `DOCUMENT_PRODUCT_EQUIVALENCE` — strict AP242 constructor.
4070    pub fn add_document_product_equivalence(
4071        &mut self,
4072        name: String,
4073        description: Option<String>,
4074        relating_document: DocumentRef,
4075        related_product: ProductOrFormationOrDefinitionRef,
4076    ) -> Result<DocumentProductEquivalenceId, AuthorError> {
4077        check_document_ref(&self.model, &relating_document)?;
4078        check_product_or_formation_or_definition_ref(&self.model, &related_product)?;
4079        Ok(DocumentProductEquivalenceId(
4080            self.model
4081                .document_product_equivalence_arena
4082                .push(DocumentProductEquivalence {
4083                    name,
4084                    description,
4085                    relating_document,
4086                    related_product,
4087                }),
4088        ))
4089    }
4090
4091    /// `DOCUMENT_REFERENCE` — strict AP242 constructor.
4092    pub fn add_document_reference(
4093        &mut self,
4094        assigned_document: DocumentRef,
4095        source: String,
4096    ) -> Result<DocumentReferenceId, AuthorError> {
4097        check_document_ref(&self.model, &assigned_document)?;
4098        Ok(DocumentReferenceId(
4099            self.model.document_reference_arena.push(DocumentReference {
4100                assigned_document,
4101                source,
4102            }),
4103        ))
4104    }
4105
4106    /// `DOCUMENT_REPRESENTATION_TYPE` — strict AP242 constructor.
4107    pub fn add_document_representation_type(
4108        &mut self,
4109        name: String,
4110        represented_document: DocumentRef,
4111    ) -> Result<DocumentRepresentationTypeId, AuthorError> {
4112        check_document_ref(&self.model, &represented_document)?;
4113        Ok(DocumentRepresentationTypeId(
4114            self.model
4115                .document_representation_type_arena
4116                .push(DocumentRepresentationType {
4117                    name,
4118                    represented_document,
4119                }),
4120        ))
4121    }
4122
4123    /// `DOCUMENT_TYPE` — strict AP242 constructor.
4124    pub fn add_document_type(
4125        &mut self,
4126        product_data_type: String,
4127    ) -> Result<DocumentTypeId, AuthorError> {
4128        Ok(DocumentTypeId(
4129            self.model
4130                .document_type_arena
4131                .push(DocumentType { product_data_type }),
4132        ))
4133    }
4134
4135    /// `DRAUGHTING_ANNOTATION_OCCURRENCE` — strict AP242 constructor.
4136    pub fn add_draughting_annotation_occurrence(
4137        &mut self,
4138        name: String,
4139        styles: Vec<PresentationStyleAssignmentRef>,
4140        item: StyledItemTargetRef,
4141    ) -> Result<DraughtingAnnotationOccurrenceId, AuthorError> {
4142        for e0 in &styles {
4143            check_presentation_style_assignment_ref(&self.model, e0)?;
4144        }
4145        check_styled_item_target_ref(&self.model, &item)?;
4146        Ok(DraughtingAnnotationOccurrenceId(
4147            self.model
4148                .draughting_annotation_occurrence_arena
4149                .push(DraughtingAnnotationOccurrence { name, styles, item }),
4150        ))
4151    }
4152
4153    /// `DRAUGHTING_CALLOUT` — strict AP242 constructor.
4154    pub fn add_draughting_callout(
4155        &mut self,
4156        name: String,
4157        contents: Vec<DraughtingCalloutElementRef>,
4158    ) -> Result<DraughtingCalloutId, AuthorError> {
4159        {
4160            let x = &contents;
4161            if x.len() < 1 {
4162                return Err(AuthorError::Cardinality {
4163                    entity: "DRAUGHTING_CALLOUT",
4164                    attribute: "contents",
4165                    got: x.len(),
4166                    min: 1,
4167                    max: None,
4168                });
4169            }
4170        }
4171        for e0 in &contents {
4172            check_draughting_callout_element_ref(&self.model, e0)?;
4173        }
4174        Ok(DraughtingCalloutId(
4175            self.model
4176                .draughting_callout_arena
4177                .push(DraughtingCallout { name, contents }),
4178        ))
4179    }
4180
4181    /// `DRAUGHTING_CALLOUT_RELATIONSHIP` — strict AP242 constructor.
4182    pub fn add_draughting_callout_relationship(
4183        &mut self,
4184        name: String,
4185        description: String,
4186        relating_draughting_callout: DraughtingCalloutRef,
4187        related_draughting_callout: DraughtingCalloutRef,
4188    ) -> Result<DraughtingCalloutRelationshipId, AuthorError> {
4189        check_draughting_callout_ref(&self.model, &relating_draughting_callout)?;
4190        check_draughting_callout_ref(&self.model, &related_draughting_callout)?;
4191        Ok(DraughtingCalloutRelationshipId(
4192            self.model
4193                .draughting_callout_relationship_arena
4194                .push(DraughtingCalloutRelationship {
4195                    name,
4196                    description,
4197                    relating_draughting_callout,
4198                    related_draughting_callout,
4199                }),
4200        ))
4201    }
4202
4203    /// `DRAUGHTING_MODEL` — strict AP242 constructor.
4204    pub fn add_draughting_model(
4205        &mut self,
4206        name: String,
4207        items: Vec<RepresentationItemRef>,
4208        context_of_items: RepresentationContextRef,
4209    ) -> Result<DraughtingModelId, AuthorError> {
4210        {
4211            let x = &items;
4212            if x.len() < 1 {
4213                return Err(AuthorError::Cardinality {
4214                    entity: "DRAUGHTING_MODEL",
4215                    attribute: "items",
4216                    got: x.len(),
4217                    min: 1,
4218                    max: None,
4219                });
4220            }
4221        }
4222        for e0 in &items {
4223            check_representation_item_ref(&self.model, e0)?;
4224        }
4225        check_representation_context_ref(&self.model, &context_of_items)?;
4226        Ok(DraughtingModelId(self.model.draughting_model_arena.push(
4227            DraughtingModel {
4228                name,
4229                items,
4230                context_of_items,
4231            },
4232        )))
4233    }
4234
4235    /// `DRAUGHTING_MODEL_ITEM_ASSOCIATION` — strict AP242 constructor.
4236    pub fn add_draughting_model_item_association(
4237        &mut self,
4238        name: String,
4239        description: Option<String>,
4240        definition: DraughtingModelItemDefinitionRef,
4241        used_representation: AnnotationRepresentationSelectRef,
4242        identified_item: DraughtingModelItemAssociationSelectRef,
4243    ) -> Result<DraughtingModelItemAssociationId, AuthorError> {
4244        check_draughting_model_item_definition_ref(&self.model, &definition)?;
4245        check_annotation_representation_select_ref(&self.model, &used_representation)?;
4246        check_draughting_model_item_association_select_ref(&self.model, &identified_item)?;
4247        Ok(DraughtingModelItemAssociationId(
4248            self.model.draughting_model_item_association_arena.push(
4249                DraughtingModelItemAssociation {
4250                    name,
4251                    description,
4252                    definition,
4253                    used_representation,
4254                    identified_item,
4255                },
4256            ),
4257        ))
4258    }
4259
4260    /// `DRAUGHTING_MODEL_ITEM_ASSOCIATION_WITH_PLACEHOLDER` — strict AP242 constructor.
4261    pub fn add_draughting_model_item_association_with_placeholder(
4262        &mut self,
4263        name: String,
4264        description: Option<String>,
4265        definition: DraughtingModelItemDefinitionRef,
4266        used_representation: AnnotationRepresentationSelectRef,
4267        identified_item: DraughtingModelItemAssociationSelectRef,
4268        annotation_placeholder: AnnotationPlaceholderOccurrenceRef,
4269    ) -> Result<DraughtingModelItemAssociationWithPlaceholderId, AuthorError> {
4270        check_draughting_model_item_definition_ref(&self.model, &definition)?;
4271        check_annotation_representation_select_ref(&self.model, &used_representation)?;
4272        check_draughting_model_item_association_select_ref(&self.model, &identified_item)?;
4273        check_annotation_placeholder_occurrence_ref(&self.model, &annotation_placeholder)?;
4274        Ok(DraughtingModelItemAssociationWithPlaceholderId(
4275            self.model
4276                .draughting_model_item_association_with_placeholder_arena
4277                .push(DraughtingModelItemAssociationWithPlaceholder {
4278                    name,
4279                    description,
4280                    definition,
4281                    used_representation,
4282                    identified_item,
4283                    annotation_placeholder,
4284                }),
4285        ))
4286    }
4287
4288    /// `DRAUGHTING_PRE_DEFINED_COLOUR` — strict AP242 constructor.
4289    pub fn add_draughting_pre_defined_colour(
4290        &mut self,
4291        name: String,
4292    ) -> Result<DraughtingPreDefinedColourId, AuthorError> {
4293        Ok(DraughtingPreDefinedColourId(
4294            self.model
4295                .draughting_pre_defined_colour_arena
4296                .push(DraughtingPreDefinedColour { name }),
4297        ))
4298    }
4299
4300    /// `DRAUGHTING_PRE_DEFINED_CURVE_FONT` — strict AP242 constructor.
4301    pub fn add_draughting_pre_defined_curve_font(
4302        &mut self,
4303        name: String,
4304    ) -> Result<DraughtingPreDefinedCurveFontId, AuthorError> {
4305        Ok(DraughtingPreDefinedCurveFontId(
4306            self.model
4307                .draughting_pre_defined_curve_font_arena
4308                .push(DraughtingPreDefinedCurveFont { name }),
4309        ))
4310    }
4311
4312    /// `DRAUGHTING_PRE_DEFINED_TEXT_FONT` — strict AP242 constructor.
4313    pub fn add_draughting_pre_defined_text_font(
4314        &mut self,
4315        name: String,
4316    ) -> Result<DraughtingPreDefinedTextFontId, AuthorError> {
4317        Ok(DraughtingPreDefinedTextFontId(
4318            self.model
4319                .draughting_pre_defined_text_font_arena
4320                .push(DraughtingPreDefinedTextFont { name }),
4321        ))
4322    }
4323
4324    /// `EDGE` — strict AP242 constructor.
4325    pub fn add_edge(
4326        &mut self,
4327        name: String,
4328        edge_start: Option<VertexRef>,
4329        edge_end: Option<VertexRef>,
4330    ) -> Result<EdgeId, AuthorError> {
4331        if let Some(x) = &edge_start {
4332            check_vertex_ref(&self.model, x)?;
4333        }
4334        if let Some(x) = &edge_end {
4335            check_vertex_ref(&self.model, x)?;
4336        }
4337        Ok(EdgeId(self.model.edge_arena.push(Edge {
4338            name,
4339            edge_start,
4340            edge_end,
4341        })))
4342    }
4343
4344    /// `EDGE_CURVE` — strict AP242 constructor.
4345    pub fn add_edge_curve(
4346        &mut self,
4347        name: String,
4348        edge_start: VertexRef,
4349        edge_end: VertexRef,
4350        edge_geometry: CurveRef,
4351        same_sense: bool,
4352    ) -> Result<EdgeCurveId, AuthorError> {
4353        check_vertex_ref(&self.model, &edge_start)?;
4354        check_vertex_ref(&self.model, &edge_end)?;
4355        check_curve_ref(&self.model, &edge_geometry)?;
4356        Ok(EdgeCurveId(self.model.edge_curve_arena.push(EdgeCurve {
4357            name,
4358            edge_start,
4359            edge_end,
4360            edge_geometry,
4361            same_sense,
4362        })))
4363    }
4364
4365    /// `EDGE_LOOP` — strict AP242 constructor.
4366    pub fn add_edge_loop(
4367        &mut self,
4368        name: String,
4369        edge_list: Vec<OrientedEdgeRef>,
4370    ) -> Result<EdgeLoopId, AuthorError> {
4371        {
4372            let x = &edge_list;
4373            if x.len() < 1 {
4374                return Err(AuthorError::Cardinality {
4375                    entity: "EDGE_LOOP",
4376                    attribute: "edge_list",
4377                    got: x.len(),
4378                    min: 1,
4379                    max: None,
4380                });
4381            }
4382        }
4383        for e0 in &edge_list {
4384            check_oriented_edge_ref(&self.model, e0)?;
4385        }
4386        Ok(EdgeLoopId(
4387            self.model
4388                .edge_loop_arena
4389                .push(EdgeLoop { name, edge_list }),
4390        ))
4391    }
4392
4393    /// `EFFECTIVITY` — strict AP242 constructor.
4394    pub fn add_effectivity(&mut self, id: String) -> Result<EffectivityId, AuthorError> {
4395        Ok(EffectivityId(
4396            self.model.effectivity_arena.push(Effectivity { id }),
4397        ))
4398    }
4399
4400    /// `ELEMENTARY_SURFACE` — strict AP242 constructor.
4401    pub fn add_elementary_surface(
4402        &mut self,
4403        name: String,
4404        position: Axis2Placement3dRef,
4405    ) -> Result<ElementarySurfaceId, AuthorError> {
4406        check_axis2_placement3d_ref(&self.model, &position)?;
4407        Ok(ElementarySurfaceId(
4408            self.model
4409                .elementary_surface_arena
4410                .push(ElementarySurface { name, position }),
4411        ))
4412    }
4413
4414    /// `ELLIPSE` — strict AP242 constructor.
4415    pub fn add_ellipse(
4416        &mut self,
4417        name: String,
4418        position: Axis2PlacementRef,
4419        semi_axis_1: f64,
4420        semi_axis_2: f64,
4421    ) -> Result<EllipseId, AuthorError> {
4422        check_axis2_placement_ref(&self.model, &position)?;
4423        Ok(EllipseId(self.model.ellipse_arena.push(Ellipse {
4424            name,
4425            position,
4426            semi_axis_1,
4427            semi_axis_2,
4428        })))
4429    }
4430
4431    /// `EXPRESSION` — strict AP242 constructor.
4432    pub fn add_expression(&mut self) -> Result<ExpressionId, AuthorError> {
4433        Ok(ExpressionId(
4434            self.model.expression_arena.push(Expression {}),
4435        ))
4436    }
4437
4438    /// `EXTERNAL_IDENTIFICATION_ASSIGNMENT` — strict AP242 constructor.
4439    pub fn add_external_identification_assignment(
4440        &mut self,
4441        assigned_id: String,
4442        role: IdentificationRoleRef,
4443        source: ExternalSourceRef,
4444    ) -> Result<ExternalIdentificationAssignmentId, AuthorError> {
4445        check_identification_role_ref(&self.model, &role)?;
4446        check_external_source_ref(&self.model, &source)?;
4447        Ok(ExternalIdentificationAssignmentId(
4448            self.model.external_identification_assignment_arena.push(
4449                ExternalIdentificationAssignment {
4450                    assigned_id,
4451                    role,
4452                    source,
4453                },
4454            ),
4455        ))
4456    }
4457
4458    /// `EXTERNAL_SOURCE` — strict AP242 constructor.
4459    pub fn add_external_source(
4460        &mut self,
4461        source_id: StringSelectValue,
4462    ) -> Result<ExternalSourceId, AuthorError> {
4463        Ok(ExternalSourceId(
4464            self.model
4465                .external_source_arena
4466                .push(ExternalSource { source_id }),
4467        ))
4468    }
4469
4470    /// `EXTERNALLY_DEFINED_CHARACTER_GLYPH` — strict AP242 constructor.
4471    pub fn add_externally_defined_character_glyph(
4472        &mut self,
4473        item_id: StringSelectValue,
4474        source: ExternalSourceRef,
4475    ) -> Result<ExternallyDefinedCharacterGlyphId, AuthorError> {
4476        check_external_source_ref(&self.model, &source)?;
4477        Ok(ExternallyDefinedCharacterGlyphId(
4478            self.model
4479                .externally_defined_character_glyph_arena
4480                .push(ExternallyDefinedCharacterGlyph { item_id, source }),
4481        ))
4482    }
4483
4484    /// `EXTERNALLY_DEFINED_CURVE_FONT` — strict AP242 constructor.
4485    pub fn add_externally_defined_curve_font(
4486        &mut self,
4487        item_id: StringSelectValue,
4488        source: ExternalSourceRef,
4489    ) -> Result<ExternallyDefinedCurveFontId, AuthorError> {
4490        check_external_source_ref(&self.model, &source)?;
4491        Ok(ExternallyDefinedCurveFontId(
4492            self.model
4493                .externally_defined_curve_font_arena
4494                .push(ExternallyDefinedCurveFont { item_id, source }),
4495        ))
4496    }
4497
4498    /// `EXTERNALLY_DEFINED_HATCH_STYLE` — strict AP242 constructor.
4499    pub fn add_externally_defined_hatch_style(
4500        &mut self,
4501        item_id: StringSelectValue,
4502        source: ExternalSourceRef,
4503        name: String,
4504    ) -> Result<ExternallyDefinedHatchStyleId, AuthorError> {
4505        check_external_source_ref(&self.model, &source)?;
4506        Ok(ExternallyDefinedHatchStyleId(
4507            self.model
4508                .externally_defined_hatch_style_arena
4509                .push(ExternallyDefinedHatchStyle {
4510                    item_id,
4511                    source,
4512                    name,
4513                }),
4514        ))
4515    }
4516
4517    /// `EXTERNALLY_DEFINED_ITEM` — strict AP242 constructor.
4518    pub fn add_externally_defined_item(
4519        &mut self,
4520        item_id: StringSelectValue,
4521        source: ExternalSourceRef,
4522    ) -> Result<ExternallyDefinedItemId, AuthorError> {
4523        check_external_source_ref(&self.model, &source)?;
4524        Ok(ExternallyDefinedItemId(
4525            self.model
4526                .externally_defined_item_arena
4527                .push(ExternallyDefinedItem { item_id, source }),
4528        ))
4529    }
4530
4531    /// `EXTERNALLY_DEFINED_STYLE` — strict AP242 constructor.
4532    pub fn add_externally_defined_style(
4533        &mut self,
4534        item_id: StringSelectValue,
4535        source: ExternalSourceRef,
4536    ) -> Result<ExternallyDefinedStyleId, AuthorError> {
4537        check_external_source_ref(&self.model, &source)?;
4538        Ok(ExternallyDefinedStyleId(
4539            self.model
4540                .externally_defined_style_arena
4541                .push(ExternallyDefinedStyle { item_id, source }),
4542        ))
4543    }
4544
4545    /// `EXTERNALLY_DEFINED_SYMBOL` — strict AP242 constructor.
4546    pub fn add_externally_defined_symbol(
4547        &mut self,
4548        item_id: StringSelectValue,
4549        source: ExternalSourceRef,
4550    ) -> Result<ExternallyDefinedSymbolId, AuthorError> {
4551        check_external_source_ref(&self.model, &source)?;
4552        Ok(ExternallyDefinedSymbolId(
4553            self.model
4554                .externally_defined_symbol_arena
4555                .push(ExternallyDefinedSymbol { item_id, source }),
4556        ))
4557    }
4558
4559    /// `EXTERNALLY_DEFINED_TEXT_FONT` — strict AP242 constructor.
4560    pub fn add_externally_defined_text_font(
4561        &mut self,
4562        item_id: StringSelectValue,
4563        source: ExternalSourceRef,
4564    ) -> Result<ExternallyDefinedTextFontId, AuthorError> {
4565        check_external_source_ref(&self.model, &source)?;
4566        Ok(ExternallyDefinedTextFontId(
4567            self.model
4568                .externally_defined_text_font_arena
4569                .push(ExternallyDefinedTextFont { item_id, source }),
4570        ))
4571    }
4572
4573    /// `EXTERNALLY_DEFINED_TILE` — strict AP242 constructor.
4574    pub fn add_externally_defined_tile(
4575        &mut self,
4576        item_id: StringSelectValue,
4577        source: ExternalSourceRef,
4578    ) -> Result<ExternallyDefinedTileId, AuthorError> {
4579        check_external_source_ref(&self.model, &source)?;
4580        Ok(ExternallyDefinedTileId(
4581            self.model
4582                .externally_defined_tile_arena
4583                .push(ExternallyDefinedTile { item_id, source }),
4584        ))
4585    }
4586
4587    /// `EXTERNALLY_DEFINED_TILE_STYLE` — strict AP242 constructor.
4588    pub fn add_externally_defined_tile_style(
4589        &mut self,
4590        item_id: StringSelectValue,
4591        source: ExternalSourceRef,
4592        name: String,
4593    ) -> Result<ExternallyDefinedTileStyleId, AuthorError> {
4594        check_external_source_ref(&self.model, &source)?;
4595        Ok(ExternallyDefinedTileStyleId(
4596            self.model
4597                .externally_defined_tile_style_arena
4598                .push(ExternallyDefinedTileStyle {
4599                    item_id,
4600                    source,
4601                    name,
4602                }),
4603        ))
4604    }
4605
4606    /// `FACE` — strict AP242 constructor.
4607    pub fn add_face(
4608        &mut self,
4609        name: String,
4610        bounds: Vec<FaceBoundRef>,
4611    ) -> Result<FaceId, AuthorError> {
4612        {
4613            let x = &bounds;
4614            if x.len() < 1 {
4615                return Err(AuthorError::Cardinality {
4616                    entity: "FACE",
4617                    attribute: "bounds",
4618                    got: x.len(),
4619                    min: 1,
4620                    max: None,
4621                });
4622            }
4623        }
4624        for e0 in &bounds {
4625            check_face_bound_ref(&self.model, e0)?;
4626        }
4627        Ok(FaceId(self.model.face_arena.push(Face { name, bounds })))
4628    }
4629
4630    /// `FACE_BOUND` — strict AP242 constructor.
4631    pub fn add_face_bound(
4632        &mut self,
4633        name: String,
4634        bound: LoopRef,
4635        orientation: bool,
4636    ) -> Result<FaceBoundId, AuthorError> {
4637        check_loop_ref(&self.model, &bound)?;
4638        Ok(FaceBoundId(self.model.face_bound_arena.push(FaceBound {
4639            name,
4640            bound,
4641            orientation,
4642        })))
4643    }
4644
4645    /// `FACE_OUTER_BOUND` — strict AP242 constructor.
4646    pub fn add_face_outer_bound(
4647        &mut self,
4648        name: String,
4649        bound: LoopRef,
4650        orientation: bool,
4651    ) -> Result<FaceOuterBoundId, AuthorError> {
4652        check_loop_ref(&self.model, &bound)?;
4653        Ok(FaceOuterBoundId(self.model.face_outer_bound_arena.push(
4654            FaceOuterBound {
4655                name,
4656                bound,
4657                orientation,
4658            },
4659        )))
4660    }
4661
4662    /// `FACE_SURFACE` — strict AP242 constructor.
4663    pub fn add_face_surface(
4664        &mut self,
4665        name: String,
4666        bounds: Vec<FaceBoundRef>,
4667        face_geometry: SurfaceRef,
4668        same_sense: bool,
4669    ) -> Result<FaceSurfaceId, AuthorError> {
4670        {
4671            let x = &bounds;
4672            if x.len() < 1 {
4673                return Err(AuthorError::Cardinality {
4674                    entity: "FACE_SURFACE",
4675                    attribute: "bounds",
4676                    got: x.len(),
4677                    min: 1,
4678                    max: None,
4679                });
4680            }
4681        }
4682        for e0 in &bounds {
4683            check_face_bound_ref(&self.model, e0)?;
4684        }
4685        check_surface_ref(&self.model, &face_geometry)?;
4686        Ok(FaceSurfaceId(self.model.face_surface_arena.push(
4687            FaceSurface {
4688                name,
4689                bounds,
4690                face_geometry,
4691                same_sense,
4692            },
4693        )))
4694    }
4695
4696    /// `FEATURE_FOR_DATUM_TARGET_RELATIONSHIP` — strict AP242 constructor.
4697    pub fn add_feature_for_datum_target_relationship(
4698        &mut self,
4699        name: String,
4700        description: Option<String>,
4701        relating_shape_aspect: ShapeAspectRef,
4702        related_shape_aspect: ShapeAspectRef,
4703    ) -> Result<FeatureForDatumTargetRelationshipId, AuthorError> {
4704        check_shape_aspect_ref(&self.model, &relating_shape_aspect)?;
4705        check_shape_aspect_ref(&self.model, &related_shape_aspect)?;
4706        Ok(FeatureForDatumTargetRelationshipId(
4707            self.model.feature_for_datum_target_relationship_arena.push(
4708                FeatureForDatumTargetRelationship {
4709                    name,
4710                    description,
4711                    relating_shape_aspect,
4712                    related_shape_aspect,
4713                },
4714            ),
4715        ))
4716    }
4717
4718    /// `FILL_AREA_STYLE` — strict AP242 constructor.
4719    pub fn add_fill_area_style(
4720        &mut self,
4721        name: String,
4722        fill_styles: Vec<FillStyleSelectRef>,
4723    ) -> Result<FillAreaStyleId, AuthorError> {
4724        {
4725            let x = &fill_styles;
4726            if x.len() < 1 {
4727                return Err(AuthorError::Cardinality {
4728                    entity: "FILL_AREA_STYLE",
4729                    attribute: "fill_styles",
4730                    got: x.len(),
4731                    min: 1,
4732                    max: None,
4733                });
4734            }
4735        }
4736        for e0 in &fill_styles {
4737            check_fill_style_select_ref(&self.model, e0)?;
4738        }
4739        Ok(FillAreaStyleId(
4740            self.model
4741                .fill_area_style_arena
4742                .push(FillAreaStyle { name, fill_styles }),
4743        ))
4744    }
4745
4746    /// `FILL_AREA_STYLE_COLOUR` — strict AP242 constructor.
4747    pub fn add_fill_area_style_colour(
4748        &mut self,
4749        name: String,
4750        fill_colour: ColourRef,
4751    ) -> Result<FillAreaStyleColourId, AuthorError> {
4752        check_colour_ref(&self.model, &fill_colour)?;
4753        Ok(FillAreaStyleColourId(
4754            self.model
4755                .fill_area_style_colour_arena
4756                .push(FillAreaStyleColour { name, fill_colour }),
4757        ))
4758    }
4759
4760    /// `FILL_AREA_STYLE_HATCHING` — strict AP242 constructor.
4761    pub fn add_fill_area_style_hatching(
4762        &mut self,
4763        name: String,
4764        hatch_line_appearance: CurveStyleRef,
4765        start_of_next_hatch_line: OneDirectionRepeatFactorRef,
4766        point_of_reference_hatch_line: CartesianPointRef,
4767        pattern_start: CartesianPointRef,
4768        hatch_line_angle: f64,
4769    ) -> Result<FillAreaStyleHatchingId, AuthorError> {
4770        check_curve_style_ref(&self.model, &hatch_line_appearance)?;
4771        check_one_direction_repeat_factor_ref(&self.model, &start_of_next_hatch_line)?;
4772        check_cartesian_point_ref(&self.model, &point_of_reference_hatch_line)?;
4773        check_cartesian_point_ref(&self.model, &pattern_start)?;
4774        Ok(FillAreaStyleHatchingId(
4775            self.model
4776                .fill_area_style_hatching_arena
4777                .push(FillAreaStyleHatching {
4778                    name,
4779                    hatch_line_appearance,
4780                    start_of_next_hatch_line,
4781                    point_of_reference_hatch_line,
4782                    pattern_start,
4783                    hatch_line_angle,
4784                }),
4785        ))
4786    }
4787
4788    /// `FILL_AREA_STYLE_TILE_COLOURED_REGION` — strict AP242 constructor.
4789    pub fn add_fill_area_style_tile_coloured_region(
4790        &mut self,
4791        name: String,
4792        closed_curve: CurveOrAnnotationCurveOccurrenceRef,
4793        region_colour: ColourRef,
4794    ) -> Result<FillAreaStyleTileColouredRegionId, AuthorError> {
4795        check_curve_or_annotation_curve_occurrence_ref(&self.model, &closed_curve)?;
4796        check_colour_ref(&self.model, &region_colour)?;
4797        Ok(FillAreaStyleTileColouredRegionId(
4798            self.model.fill_area_style_tile_coloured_region_arena.push(
4799                FillAreaStyleTileColouredRegion {
4800                    name,
4801                    closed_curve,
4802                    region_colour,
4803                },
4804            ),
4805        ))
4806    }
4807
4808    /// `FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE` — strict AP242 constructor.
4809    pub fn add_fill_area_style_tile_curve_with_style(
4810        &mut self,
4811        name: String,
4812        styled_curve: AnnotationCurveOccurrenceRef,
4813    ) -> Result<FillAreaStyleTileCurveWithStyleId, AuthorError> {
4814        check_annotation_curve_occurrence_ref(&self.model, &styled_curve)?;
4815        Ok(FillAreaStyleTileCurveWithStyleId(
4816            self.model
4817                .fill_area_style_tile_curve_with_style_arena
4818                .push(FillAreaStyleTileCurveWithStyle { name, styled_curve }),
4819        ))
4820    }
4821
4822    /// `FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE` — strict AP242 constructor.
4823    pub fn add_fill_area_style_tile_symbol_with_style(
4824        &mut self,
4825        name: String,
4826        symbol: AnnotationSymbolOccurrenceRef,
4827    ) -> Result<FillAreaStyleTileSymbolWithStyleId, AuthorError> {
4828        check_annotation_symbol_occurrence_ref(&self.model, &symbol)?;
4829        Ok(FillAreaStyleTileSymbolWithStyleId(
4830            self.model
4831                .fill_area_style_tile_symbol_with_style_arena
4832                .push(FillAreaStyleTileSymbolWithStyle { name, symbol }),
4833        ))
4834    }
4835
4836    /// `FILL_AREA_STYLE_TILES` — strict AP242 constructor.
4837    pub fn add_fill_area_style_tiles(
4838        &mut self,
4839        name: String,
4840        tiling_pattern: TwoDirectionRepeatFactorRef,
4841        tiles: Vec<FillAreaStyleTileShapeSelectRef>,
4842        tiling_scale: f64,
4843    ) -> Result<FillAreaStyleTilesId, AuthorError> {
4844        check_two_direction_repeat_factor_ref(&self.model, &tiling_pattern)?;
4845        {
4846            let x = &tiles;
4847            if x.len() < 1 {
4848                return Err(AuthorError::Cardinality {
4849                    entity: "FILL_AREA_STYLE_TILES",
4850                    attribute: "tiles",
4851                    got: x.len(),
4852                    min: 1,
4853                    max: None,
4854                });
4855            }
4856        }
4857        for e0 in &tiles {
4858            check_fill_area_style_tile_shape_select_ref(&self.model, e0)?;
4859        }
4860        Ok(FillAreaStyleTilesId(
4861            self.model
4862                .fill_area_style_tiles_arena
4863                .push(FillAreaStyleTiles {
4864                    name,
4865                    tiling_pattern,
4866                    tiles,
4867                    tiling_scale,
4868                }),
4869        ))
4870    }
4871
4872    /// `FLATNESS_TOLERANCE` — strict AP242 constructor.
4873    pub fn add_flatness_tolerance(
4874        &mut self,
4875        name: String,
4876        description: Option<String>,
4877        magnitude: Option<LengthMeasureWithUnitRef>,
4878        toleranced_shape_aspect: GeometricToleranceTargetRef,
4879    ) -> Result<FlatnessToleranceId, AuthorError> {
4880        if let Some(x) = &magnitude {
4881            check_length_measure_with_unit_ref(&self.model, x)?;
4882        }
4883        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
4884        Ok(FlatnessToleranceId(
4885            self.model.flatness_tolerance_arena.push(FlatnessTolerance {
4886                name,
4887                description,
4888                magnitude,
4889                toleranced_shape_aspect,
4890            }),
4891        ))
4892    }
4893
4894    /// `FOUNDED_ITEM` — strict AP242 constructor.
4895    pub fn add_founded_item(&mut self) -> Result<FoundedItemId, AuthorError> {
4896        Ok(FoundedItemId(
4897            self.model.founded_item_arena.push(FoundedItem {}),
4898        ))
4899    }
4900
4901    /// `FUNCTIONALLY_DEFINED_TRANSFORMATION` — strict AP242 constructor.
4902    pub fn add_functionally_defined_transformation(
4903        &mut self,
4904        name: String,
4905        description: Option<String>,
4906    ) -> Result<FunctionallyDefinedTransformationId, AuthorError> {
4907        Ok(FunctionallyDefinedTransformationId(
4908            self.model
4909                .functionally_defined_transformation_arena
4910                .push(FunctionallyDefinedTransformation { name, description }),
4911        ))
4912    }
4913
4914    /// `GENERAL_DATUM_REFERENCE` — strict AP242 constructor.
4915    pub fn add_general_datum_reference(
4916        &mut self,
4917        name: String,
4918        description: Option<String>,
4919        of_shape: ProductDefinitionShapeRef,
4920        product_definitional: Logical,
4921        base: DatumOrCommonDatumRef,
4922        modifiers: Option<Vec<DatumReferenceModifierRef>>,
4923    ) -> Result<GeneralDatumReferenceId, AuthorError> {
4924        check_product_definition_shape_ref(&self.model, &of_shape)?;
4925        check_datum_or_common_datum_ref(&self.model, &base)?;
4926        if let Some(x) = &modifiers {
4927            if x.len() < 1 {
4928                return Err(AuthorError::Cardinality {
4929                    entity: "GENERAL_DATUM_REFERENCE",
4930                    attribute: "modifiers",
4931                    got: x.len(),
4932                    min: 1,
4933                    max: None,
4934                });
4935            }
4936        }
4937        if let Some(x) = &modifiers {
4938            for e0 in x {
4939                check_datum_reference_modifier_ref(&self.model, e0)?;
4940            }
4941        }
4942        Ok(GeneralDatumReferenceId(
4943            self.model
4944                .general_datum_reference_arena
4945                .push(GeneralDatumReference {
4946                    name,
4947                    description,
4948                    of_shape,
4949                    product_definitional,
4950                    base,
4951                    modifiers,
4952                }),
4953        ))
4954    }
4955
4956    /// `GENERAL_PROPERTY` — strict AP242 constructor.
4957    pub fn add_general_property(
4958        &mut self,
4959        id: String,
4960        name: String,
4961        description: Option<String>,
4962    ) -> Result<GeneralPropertyId, AuthorError> {
4963        Ok(GeneralPropertyId(self.model.general_property_arena.push(
4964            GeneralProperty {
4965                id,
4966                name,
4967                description,
4968            },
4969        )))
4970    }
4971
4972    /// `GENERAL_PROPERTY_ASSOCIATION` — strict AP242 constructor.
4973    pub fn add_general_property_association(
4974        &mut self,
4975        name: String,
4976        description: Option<String>,
4977        base_definition: GeneralPropertyRef,
4978        derived_definition: DerivedPropertySelectRef,
4979    ) -> Result<GeneralPropertyAssociationId, AuthorError> {
4980        check_general_property_ref(&self.model, &base_definition)?;
4981        check_derived_property_select_ref(&self.model, &derived_definition)?;
4982        Ok(GeneralPropertyAssociationId(
4983            self.model
4984                .general_property_association_arena
4985                .push(GeneralPropertyAssociation {
4986                    name,
4987                    description,
4988                    base_definition,
4989                    derived_definition,
4990                }),
4991        ))
4992    }
4993
4994    /// `GENERIC_EXPRESSION` — strict AP242 constructor.
4995    pub fn add_generic_expression(&mut self) -> Result<GenericExpressionId, AuthorError> {
4996        Ok(GenericExpressionId(
4997            self.model
4998                .generic_expression_arena
4999                .push(GenericExpression {}),
5000        ))
5001    }
5002
5003    /// `GENERIC_LITERAL` — strict AP242 constructor.
5004    pub fn add_generic_literal(&mut self) -> Result<GenericLiteralId, AuthorError> {
5005        Ok(GenericLiteralId(
5006            self.model.generic_literal_arena.push(GenericLiteral {}),
5007        ))
5008    }
5009
5010    /// `GENERIC_PRODUCT_DEFINITION_REFERENCE` — strict AP242 constructor.
5011    pub fn add_generic_product_definition_reference(
5012        &mut self,
5013        source: ExternalSourceRef,
5014    ) -> Result<GenericProductDefinitionReferenceId, AuthorError> {
5015        check_external_source_ref(&self.model, &source)?;
5016        Ok(GenericProductDefinitionReferenceId(
5017            self.model
5018                .generic_product_definition_reference_arena
5019                .push(GenericProductDefinitionReference { source }),
5020        ))
5021    }
5022
5023    /// `GEOMETRIC_CURVE_SET` — strict AP242 constructor.
5024    pub fn add_geometric_curve_set(
5025        &mut self,
5026        name: String,
5027        elements: Vec<GeometricSetSelectRef>,
5028    ) -> Result<GeometricCurveSetId, AuthorError> {
5029        {
5030            let x = &elements;
5031            if x.len() < 1 {
5032                return Err(AuthorError::Cardinality {
5033                    entity: "GEOMETRIC_CURVE_SET",
5034                    attribute: "elements",
5035                    got: x.len(),
5036                    min: 1,
5037                    max: None,
5038                });
5039            }
5040        }
5041        for e0 in &elements {
5042            check_geometric_set_select_ref(&self.model, e0)?;
5043        }
5044        Ok(GeometricCurveSetId(
5045            self.model
5046                .geometric_curve_set_arena
5047                .push(GeometricCurveSet { name, elements }),
5048        ))
5049    }
5050
5051    /// `GEOMETRIC_ITEM_SPECIFIC_USAGE` — strict AP242 constructor.
5052    pub fn add_geometric_item_specific_usage(
5053        &mut self,
5054        name: String,
5055        description: Option<String>,
5056        definition: GeometricItemSpecificUsageSelectRef,
5057        used_representation: ShapeModelRef,
5058        identified_item: GeometricModelItemRef,
5059    ) -> Result<GeometricItemSpecificUsageId, AuthorError> {
5060        check_geometric_item_specific_usage_select_ref(&self.model, &definition)?;
5061        check_shape_model_ref(&self.model, &used_representation)?;
5062        check_geometric_model_item_ref(&self.model, &identified_item)?;
5063        Ok(GeometricItemSpecificUsageId(
5064            self.model
5065                .geometric_item_specific_usage_arena
5066                .push(GeometricItemSpecificUsage {
5067                    name,
5068                    description,
5069                    definition,
5070                    used_representation,
5071                    identified_item,
5072                }),
5073        ))
5074    }
5075
5076    /// `GEOMETRIC_REPRESENTATION_CONTEXT` — strict AP242 constructor.
5077    pub fn add_geometric_representation_context(
5078        &mut self,
5079        context_identifier: String,
5080        context_type: String,
5081        coordinate_space_dimension: i64,
5082    ) -> Result<GeometricRepresentationContextId, AuthorError> {
5083        Ok(GeometricRepresentationContextId(
5084            self.model.geometric_representation_context_arena.push(
5085                GeometricRepresentationContext {
5086                    context_identifier,
5087                    context_type,
5088                    coordinate_space_dimension,
5089                },
5090            ),
5091        ))
5092    }
5093
5094    /// `GEOMETRIC_REPRESENTATION_ITEM` — strict AP242 constructor.
5095    pub fn add_geometric_representation_item(
5096        &mut self,
5097        name: String,
5098    ) -> Result<GeometricRepresentationItemId, AuthorError> {
5099        Ok(GeometricRepresentationItemId(
5100            self.model
5101                .geometric_representation_item_arena
5102                .push(GeometricRepresentationItem { name }),
5103        ))
5104    }
5105
5106    /// `GEOMETRIC_SET` — strict AP242 constructor.
5107    pub fn add_geometric_set(
5108        &mut self,
5109        name: String,
5110        elements: Vec<GeometricSetSelectRef>,
5111    ) -> Result<GeometricSetId, AuthorError> {
5112        {
5113            let x = &elements;
5114            if x.len() < 1 {
5115                return Err(AuthorError::Cardinality {
5116                    entity: "GEOMETRIC_SET",
5117                    attribute: "elements",
5118                    got: x.len(),
5119                    min: 1,
5120                    max: None,
5121                });
5122            }
5123        }
5124        for e0 in &elements {
5125            check_geometric_set_select_ref(&self.model, e0)?;
5126        }
5127        Ok(GeometricSetId(
5128            self.model
5129                .geometric_set_arena
5130                .push(GeometricSet { name, elements }),
5131        ))
5132    }
5133
5134    /// `GEOMETRIC_TOLERANCE` — strict AP242 constructor.
5135    pub fn add_geometric_tolerance(
5136        &mut self,
5137        name: String,
5138        description: Option<String>,
5139        magnitude: Option<LengthMeasureWithUnitRef>,
5140        toleranced_shape_aspect: GeometricToleranceTargetRef,
5141    ) -> Result<GeometricToleranceId, AuthorError> {
5142        if let Some(x) = &magnitude {
5143            check_length_measure_with_unit_ref(&self.model, x)?;
5144        }
5145        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
5146        Ok(GeometricToleranceId(
5147            self.model
5148                .geometric_tolerance_arena
5149                .push(GeometricTolerance {
5150                    name,
5151                    description,
5152                    magnitude,
5153                    toleranced_shape_aspect,
5154                }),
5155        ))
5156    }
5157
5158    /// `GEOMETRIC_TOLERANCE_RELATIONSHIP` — strict AP242 constructor.
5159    pub fn add_geometric_tolerance_relationship(
5160        &mut self,
5161        name: String,
5162        description: String,
5163        relating_geometric_tolerance: GeometricToleranceRef,
5164        related_geometric_tolerance: GeometricToleranceRef,
5165    ) -> Result<GeometricToleranceRelationshipId, AuthorError> {
5166        check_geometric_tolerance_ref(&self.model, &relating_geometric_tolerance)?;
5167        check_geometric_tolerance_ref(&self.model, &related_geometric_tolerance)?;
5168        Ok(GeometricToleranceRelationshipId(
5169            self.model.geometric_tolerance_relationship_arena.push(
5170                GeometricToleranceRelationship {
5171                    name,
5172                    description,
5173                    relating_geometric_tolerance,
5174                    related_geometric_tolerance,
5175                },
5176            ),
5177        ))
5178    }
5179
5180    /// `GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE` — strict AP242 constructor.
5181    pub fn add_geometric_tolerance_with_datum_reference(
5182        &mut self,
5183        name: String,
5184        description: Option<String>,
5185        magnitude: Option<LengthMeasureWithUnitRef>,
5186        toleranced_shape_aspect: GeometricToleranceTargetRef,
5187        datum_system: Vec<DatumSystemOrReferenceRef>,
5188    ) -> Result<GeometricToleranceWithDatumReferenceId, AuthorError> {
5189        if let Some(x) = &magnitude {
5190            check_length_measure_with_unit_ref(&self.model, x)?;
5191        }
5192        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
5193        {
5194            let x = &datum_system;
5195            if x.len() < 1 {
5196                return Err(AuthorError::Cardinality {
5197                    entity: "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
5198                    attribute: "datum_system",
5199                    got: x.len(),
5200                    min: 1,
5201                    max: None,
5202                });
5203            }
5204        }
5205        for e0 in &datum_system {
5206            check_datum_system_or_reference_ref(&self.model, e0)?;
5207        }
5208        Ok(GeometricToleranceWithDatumReferenceId(
5209            self.model
5210                .geometric_tolerance_with_datum_reference_arena
5211                .push(GeometricToleranceWithDatumReference {
5212                    name,
5213                    description,
5214                    magnitude,
5215                    toleranced_shape_aspect,
5216                    datum_system,
5217                }),
5218        ))
5219    }
5220
5221    /// `GEOMETRIC_TOLERANCE_WITH_DEFINED_AREA_UNIT` — strict AP242 constructor.
5222    pub fn add_geometric_tolerance_with_defined_area_unit(
5223        &mut self,
5224        name: String,
5225        description: Option<String>,
5226        magnitude: Option<LengthMeasureWithUnitRef>,
5227        toleranced_shape_aspect: GeometricToleranceTargetRef,
5228        unit_size: LengthOrPlaneAngleMeasureWithUnitSelectRef,
5229        area_type: AreaUnitType,
5230        second_unit_size: Option<LengthOrPlaneAngleMeasureWithUnitSelectRef>,
5231    ) -> Result<GeometricToleranceWithDefinedAreaUnitId, AuthorError> {
5232        if let Some(x) = &magnitude {
5233            check_length_measure_with_unit_ref(&self.model, x)?;
5234        }
5235        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
5236        check_length_or_plane_angle_measure_with_unit_select_ref(&self.model, &unit_size)?;
5237        if let Some(x) = &second_unit_size {
5238            check_length_or_plane_angle_measure_with_unit_select_ref(&self.model, x)?;
5239        }
5240        Ok(GeometricToleranceWithDefinedAreaUnitId(
5241            self.model
5242                .geometric_tolerance_with_defined_area_unit_arena
5243                .push(GeometricToleranceWithDefinedAreaUnit {
5244                    name,
5245                    description,
5246                    magnitude,
5247                    toleranced_shape_aspect,
5248                    unit_size,
5249                    area_type,
5250                    second_unit_size,
5251                }),
5252        ))
5253    }
5254
5255    /// `GEOMETRIC_TOLERANCE_WITH_DEFINED_UNIT` — strict AP242 constructor.
5256    pub fn add_geometric_tolerance_with_defined_unit(
5257        &mut self,
5258        name: String,
5259        description: Option<String>,
5260        magnitude: Option<LengthMeasureWithUnitRef>,
5261        toleranced_shape_aspect: GeometricToleranceTargetRef,
5262        unit_size: LengthOrPlaneAngleMeasureWithUnitSelectRef,
5263    ) -> Result<GeometricToleranceWithDefinedUnitId, AuthorError> {
5264        if let Some(x) = &magnitude {
5265            check_length_measure_with_unit_ref(&self.model, x)?;
5266        }
5267        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
5268        check_length_or_plane_angle_measure_with_unit_select_ref(&self.model, &unit_size)?;
5269        Ok(GeometricToleranceWithDefinedUnitId(
5270            self.model.geometric_tolerance_with_defined_unit_arena.push(
5271                GeometricToleranceWithDefinedUnit {
5272                    name,
5273                    description,
5274                    magnitude,
5275                    toleranced_shape_aspect,
5276                    unit_size,
5277                },
5278            ),
5279        ))
5280    }
5281
5282    /// `GEOMETRIC_TOLERANCE_WITH_MAXIMUM_TOLERANCE` — strict AP242 constructor.
5283    pub fn add_geometric_tolerance_with_maximum_tolerance(
5284        &mut self,
5285        name: String,
5286        description: Option<String>,
5287        magnitude: Option<LengthMeasureWithUnitRef>,
5288        toleranced_shape_aspect: GeometricToleranceTargetRef,
5289        modifiers: Vec<GeometricToleranceModifier>,
5290        maximum_upper_tolerance: LengthMeasureWithUnitRef,
5291    ) -> Result<GeometricToleranceWithMaximumToleranceId, AuthorError> {
5292        if let Some(x) = &magnitude {
5293            check_length_measure_with_unit_ref(&self.model, x)?;
5294        }
5295        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
5296        {
5297            let x = &modifiers;
5298            if x.len() < 1 {
5299                return Err(AuthorError::Cardinality {
5300                    entity: "GEOMETRIC_TOLERANCE_WITH_MAXIMUM_TOLERANCE",
5301                    attribute: "modifiers",
5302                    got: x.len(),
5303                    min: 1,
5304                    max: None,
5305                });
5306            }
5307        }
5308        check_length_measure_with_unit_ref(&self.model, &maximum_upper_tolerance)?;
5309        Ok(GeometricToleranceWithMaximumToleranceId(
5310            self.model
5311                .geometric_tolerance_with_maximum_tolerance_arena
5312                .push(GeometricToleranceWithMaximumTolerance {
5313                    name,
5314                    description,
5315                    magnitude,
5316                    toleranced_shape_aspect,
5317                    modifiers,
5318                    maximum_upper_tolerance,
5319                }),
5320        ))
5321    }
5322
5323    /// `GEOMETRIC_TOLERANCE_WITH_MODIFIERS` — strict AP242 constructor.
5324    pub fn add_geometric_tolerance_with_modifiers(
5325        &mut self,
5326        name: String,
5327        description: Option<String>,
5328        magnitude: Option<LengthMeasureWithUnitRef>,
5329        toleranced_shape_aspect: GeometricToleranceTargetRef,
5330        modifiers: Vec<GeometricToleranceModifier>,
5331    ) -> Result<GeometricToleranceWithModifiersId, AuthorError> {
5332        if let Some(x) = &magnitude {
5333            check_length_measure_with_unit_ref(&self.model, x)?;
5334        }
5335        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
5336        {
5337            let x = &modifiers;
5338            if x.len() < 1 {
5339                return Err(AuthorError::Cardinality {
5340                    entity: "GEOMETRIC_TOLERANCE_WITH_MODIFIERS",
5341                    attribute: "modifiers",
5342                    got: x.len(),
5343                    min: 1,
5344                    max: None,
5345                });
5346            }
5347        }
5348        Ok(GeometricToleranceWithModifiersId(
5349            self.model.geometric_tolerance_with_modifiers_arena.push(
5350                GeometricToleranceWithModifiers {
5351                    name,
5352                    description,
5353                    magnitude,
5354                    toleranced_shape_aspect,
5355                    modifiers,
5356                },
5357            ),
5358        ))
5359    }
5360
5361    /// `GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION` — strict AP242 constructor.
5362    pub fn add_geometrically_bounded_surface_shape_representation(
5363        &mut self,
5364        name: String,
5365        items: Vec<RepresentationItemRef>,
5366        context_of_items: RepresentationContextRef,
5367    ) -> Result<GeometricallyBoundedSurfaceShapeRepresentationId, AuthorError> {
5368        {
5369            let x = &items;
5370            if x.len() < 1 {
5371                return Err(AuthorError::Cardinality {
5372                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
5373                    attribute: "items",
5374                    got: x.len(),
5375                    min: 1,
5376                    max: None,
5377                });
5378            }
5379        }
5380        for e0 in &items {
5381            check_representation_item_ref(&self.model, e0)?;
5382        }
5383        check_representation_context_ref(&self.model, &context_of_items)?;
5384        Ok(GeometricallyBoundedSurfaceShapeRepresentationId(
5385            self.model
5386                .geometrically_bounded_surface_shape_representation_arena
5387                .push(GeometricallyBoundedSurfaceShapeRepresentation {
5388                    name,
5389                    items,
5390                    context_of_items,
5391                }),
5392        ))
5393    }
5394
5395    /// `GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION` — strict AP242 constructor.
5396    pub fn add_geometrically_bounded_wireframe_shape_representation(
5397        &mut self,
5398        name: String,
5399        items: Vec<RepresentationItemRef>,
5400        context_of_items: RepresentationContextRef,
5401    ) -> Result<GeometricallyBoundedWireframeShapeRepresentationId, AuthorError> {
5402        {
5403            let x = &items;
5404            if x.len() < 1 {
5405                return Err(AuthorError::Cardinality {
5406                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
5407                    attribute: "items",
5408                    got: x.len(),
5409                    min: 1,
5410                    max: None,
5411                });
5412            }
5413        }
5414        for e0 in &items {
5415            check_representation_item_ref(&self.model, e0)?;
5416        }
5417        check_representation_context_ref(&self.model, &context_of_items)?;
5418        Ok(GeometricallyBoundedWireframeShapeRepresentationId(
5419            self.model
5420                .geometrically_bounded_wireframe_shape_representation_arena
5421                .push(GeometricallyBoundedWireframeShapeRepresentation {
5422                    name,
5423                    items,
5424                    context_of_items,
5425                }),
5426        ))
5427    }
5428
5429    /// `GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT` — strict AP242 constructor.
5430    pub fn add_global_uncertainty_assigned_context(
5431        &mut self,
5432        context_identifier: String,
5433        context_type: String,
5434        uncertainty: Vec<UncertaintyMeasureWithUnitRef>,
5435    ) -> Result<GlobalUncertaintyAssignedContextId, AuthorError> {
5436        {
5437            let x = &uncertainty;
5438            if x.len() < 1 {
5439                return Err(AuthorError::Cardinality {
5440                    entity: "GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT",
5441                    attribute: "uncertainty",
5442                    got: x.len(),
5443                    min: 1,
5444                    max: None,
5445                });
5446            }
5447        }
5448        for e0 in &uncertainty {
5449            check_uncertainty_measure_with_unit_ref(&self.model, e0)?;
5450        }
5451        Ok(GlobalUncertaintyAssignedContextId(
5452            self.model.global_uncertainty_assigned_context_arena.push(
5453                GlobalUncertaintyAssignedContext {
5454                    context_identifier,
5455                    context_type,
5456                    uncertainty,
5457                },
5458            ),
5459        ))
5460    }
5461
5462    /// `GLOBAL_UNIT_ASSIGNED_CONTEXT` — strict AP242 constructor.
5463    pub fn add_global_unit_assigned_context(
5464        &mut self,
5465        context_identifier: String,
5466        context_type: String,
5467        units: Vec<UnitRef>,
5468    ) -> Result<GlobalUnitAssignedContextId, AuthorError> {
5469        {
5470            let x = &units;
5471            if x.len() < 1 {
5472                return Err(AuthorError::Cardinality {
5473                    entity: "GLOBAL_UNIT_ASSIGNED_CONTEXT",
5474                    attribute: "units",
5475                    got: x.len(),
5476                    min: 1,
5477                    max: None,
5478                });
5479            }
5480        }
5481        for e0 in &units {
5482            check_unit_ref(&self.model, e0)?;
5483        }
5484        Ok(GlobalUnitAssignedContextId(
5485            self.model
5486                .global_unit_assigned_context_arena
5487                .push(GlobalUnitAssignedContext {
5488                    context_identifier,
5489                    context_type,
5490                    units,
5491                }),
5492        ))
5493    }
5494
5495    /// `GROUP` — strict AP242 constructor.
5496    pub fn add_group(
5497        &mut self,
5498        name: String,
5499        description: Option<String>,
5500    ) -> Result<GroupId, AuthorError> {
5501        Ok(GroupId(
5502            self.model.group_arena.push(Group { name, description }),
5503        ))
5504    }
5505
5506    /// `GROUP_ASSIGNMENT` — strict AP242 constructor.
5507    pub fn add_group_assignment(
5508        &mut self,
5509        assigned_group: GroupRef,
5510    ) -> Result<GroupAssignmentId, AuthorError> {
5511        check_group_ref(&self.model, &assigned_group)?;
5512        Ok(GroupAssignmentId(
5513            self.model
5514                .group_assignment_arena
5515                .push(GroupAssignment { assigned_group }),
5516        ))
5517    }
5518
5519    /// `HYPERBOLA` — strict AP242 constructor.
5520    pub fn add_hyperbola(
5521        &mut self,
5522        name: String,
5523        position: Axis2PlacementRef,
5524        semi_axis: f64,
5525        semi_imag_axis: f64,
5526    ) -> Result<HyperbolaId, AuthorError> {
5527        check_axis2_placement_ref(&self.model, &position)?;
5528        Ok(HyperbolaId(self.model.hyperbola_arena.push(Hyperbola {
5529            name,
5530            position,
5531            semi_axis,
5532            semi_imag_axis,
5533        })))
5534    }
5535
5536    /// `ID_ATTRIBUTE` — strict AP242 constructor.
5537    pub fn add_id_attribute(
5538        &mut self,
5539        attribute_value: String,
5540        identified_item: IdAttributeSelectRef,
5541    ) -> Result<IdAttributeId, AuthorError> {
5542        check_id_attribute_select_ref(&self.model, &identified_item)?;
5543        Ok(IdAttributeId(self.model.id_attribute_arena.push(
5544            IdAttribute {
5545                attribute_value,
5546                identified_item,
5547            },
5548        )))
5549    }
5550
5551    /// `IDENTIFICATION_ASSIGNMENT` — strict AP242 constructor.
5552    pub fn add_identification_assignment(
5553        &mut self,
5554        assigned_id: String,
5555        role: IdentificationRoleRef,
5556    ) -> Result<IdentificationAssignmentId, AuthorError> {
5557        check_identification_role_ref(&self.model, &role)?;
5558        Ok(IdentificationAssignmentId(
5559            self.model
5560                .identification_assignment_arena
5561                .push(IdentificationAssignment { assigned_id, role }),
5562        ))
5563    }
5564
5565    /// `IDENTIFICATION_ROLE` — strict AP242 constructor.
5566    pub fn add_identification_role(
5567        &mut self,
5568        name: String,
5569        description: Option<String>,
5570    ) -> Result<IdentificationRoleId, AuthorError> {
5571        Ok(IdentificationRoleId(
5572            self.model
5573                .identification_role_arena
5574                .push(IdentificationRole { name, description }),
5575        ))
5576    }
5577
5578    /// `INT_LITERAL` — strict AP242 constructor.
5579    pub fn add_int_literal(&mut self, the_value: i64) -> Result<IntLiteralId, AuthorError> {
5580        Ok(IntLiteralId(
5581            self.model.int_literal_arena.push(IntLiteral { the_value }),
5582        ))
5583    }
5584
5585    /// `INTEGER_REPRESENTATION_ITEM` — strict AP242 constructor.
5586    pub fn add_integer_representation_item(
5587        &mut self,
5588        name: String,
5589        the_value: i64,
5590    ) -> Result<IntegerRepresentationItemId, AuthorError> {
5591        Ok(IntegerRepresentationItemId(
5592            self.model
5593                .integer_representation_item_arena
5594                .push(IntegerRepresentationItem { name, the_value }),
5595        ))
5596    }
5597
5598    /// `INTERSECTION_CURVE` — strict AP242 constructor.
5599    pub fn add_intersection_curve(
5600        &mut self,
5601        name: String,
5602        curve_3d: CurveRef,
5603        associated_geometry: Vec<PcurveOrSurfaceRef>,
5604        master_representation: PreferredSurfaceCurveRepresentation,
5605    ) -> Result<IntersectionCurveId, AuthorError> {
5606        check_curve_ref(&self.model, &curve_3d)?;
5607        {
5608            let x = &associated_geometry;
5609            if x.len() < 1 || x.len() > 2 {
5610                return Err(AuthorError::Cardinality {
5611                    entity: "INTERSECTION_CURVE",
5612                    attribute: "associated_geometry",
5613                    got: x.len(),
5614                    min: 1,
5615                    max: Some(2),
5616                });
5617            }
5618        }
5619        for e0 in &associated_geometry {
5620            check_pcurve_or_surface_ref(&self.model, e0)?;
5621        }
5622        Ok(IntersectionCurveId(
5623            self.model.intersection_curve_arena.push(IntersectionCurve {
5624                name,
5625                curve_3d,
5626                associated_geometry,
5627                master_representation,
5628            }),
5629        ))
5630    }
5631
5632    /// `INVISIBILITY` — strict AP242 constructor.
5633    pub fn add_invisibility(
5634        &mut self,
5635        invisible_items: Vec<InvisibleItemRef>,
5636    ) -> Result<InvisibilityId, AuthorError> {
5637        {
5638            let x = &invisible_items;
5639            if x.len() < 1 {
5640                return Err(AuthorError::Cardinality {
5641                    entity: "INVISIBILITY",
5642                    attribute: "invisible_items",
5643                    got: x.len(),
5644                    min: 1,
5645                    max: None,
5646                });
5647            }
5648        }
5649        for e0 in &invisible_items {
5650            check_invisible_item_ref(&self.model, e0)?;
5651        }
5652        Ok(InvisibilityId(
5653            self.model
5654                .invisibility_arena
5655                .push(Invisibility { invisible_items }),
5656        ))
5657    }
5658
5659    /// `ITEM_DEFINED_TRANSFORMATION` — strict AP242 constructor.
5660    pub fn add_item_defined_transformation(
5661        &mut self,
5662        name: String,
5663        description: Option<String>,
5664        transform_item_1: RepresentationItemRef,
5665        transform_item_2: RepresentationItemRef,
5666    ) -> Result<ItemDefinedTransformationId, AuthorError> {
5667        check_representation_item_ref(&self.model, &transform_item_1)?;
5668        check_representation_item_ref(&self.model, &transform_item_2)?;
5669        Ok(ItemDefinedTransformationId(
5670            self.model
5671                .item_defined_transformation_arena
5672                .push(ItemDefinedTransformation {
5673                    name,
5674                    description,
5675                    transform_item_1,
5676                    transform_item_2,
5677                }),
5678        ))
5679    }
5680
5681    /// `ITEM_IDENTIFIED_REPRESENTATION_USAGE` — strict AP242 constructor.
5682    pub fn add_item_identified_representation_usage(
5683        &mut self,
5684        name: String,
5685        description: Option<String>,
5686        definition: ItemIdentifiedRepresentationUsageDefinitionRef,
5687        used_representation: RepresentationRef,
5688        identified_item: ItemIdentifiedRepresentationUsageSelectRef,
5689    ) -> Result<ItemIdentifiedRepresentationUsageId, AuthorError> {
5690        check_item_identified_representation_usage_definition_ref(&self.model, &definition)?;
5691        check_representation_ref(&self.model, &used_representation)?;
5692        check_item_identified_representation_usage_select_ref(&self.model, &identified_item)?;
5693        Ok(ItemIdentifiedRepresentationUsageId(
5694            self.model.item_identified_representation_usage_arena.push(
5695                ItemIdentifiedRepresentationUsage {
5696                    name,
5697                    description,
5698                    definition,
5699                    used_representation,
5700                    identified_item,
5701                },
5702            ),
5703        ))
5704    }
5705
5706    /// `LEADER_CURVE` — strict AP242 constructor.
5707    pub fn add_leader_curve(
5708        &mut self,
5709        name: String,
5710        styles: Vec<PresentationStyleAssignmentRef>,
5711        item: CurveOrCurveSetRef,
5712    ) -> Result<LeaderCurveId, AuthorError> {
5713        for e0 in &styles {
5714            check_presentation_style_assignment_ref(&self.model, e0)?;
5715        }
5716        check_curve_or_curve_set_ref(&self.model, &item)?;
5717        Ok(LeaderCurveId(
5718            self.model
5719                .leader_curve_arena
5720                .push(LeaderCurve { name, styles, item }),
5721        ))
5722    }
5723
5724    /// `LEADER_DIRECTED_CALLOUT` — strict AP242 constructor.
5725    pub fn add_leader_directed_callout(
5726        &mut self,
5727        name: String,
5728        contents: Vec<DraughtingCalloutElementRef>,
5729    ) -> Result<LeaderDirectedCalloutId, AuthorError> {
5730        {
5731            let x = &contents;
5732            if x.len() < 1 {
5733                return Err(AuthorError::Cardinality {
5734                    entity: "LEADER_DIRECTED_CALLOUT",
5735                    attribute: "contents",
5736                    got: x.len(),
5737                    min: 1,
5738                    max: None,
5739                });
5740            }
5741        }
5742        for e0 in &contents {
5743            check_draughting_callout_element_ref(&self.model, e0)?;
5744        }
5745        Ok(LeaderDirectedCalloutId(
5746            self.model
5747                .leader_directed_callout_arena
5748                .push(LeaderDirectedCallout { name, contents }),
5749        ))
5750    }
5751
5752    /// `LEADER_TERMINATOR` — strict AP242 constructor.
5753    pub fn add_leader_terminator(
5754        &mut self,
5755        name: String,
5756        styles: Vec<PresentationStyleAssignmentRef>,
5757        item: AnnotationSymbolOccurrenceItemRef,
5758        annotated_curve: AnnotationCurveOccurrenceRef,
5759    ) -> Result<LeaderTerminatorId, AuthorError> {
5760        for e0 in &styles {
5761            check_presentation_style_assignment_ref(&self.model, e0)?;
5762        }
5763        check_annotation_symbol_occurrence_item_ref(&self.model, &item)?;
5764        check_annotation_curve_occurrence_ref(&self.model, &annotated_curve)?;
5765        Ok(LeaderTerminatorId(self.model.leader_terminator_arena.push(
5766            LeaderTerminator {
5767                name,
5768                styles,
5769                item,
5770                annotated_curve,
5771            },
5772        )))
5773    }
5774
5775    /// `LENGTH_MEASURE_WITH_UNIT` — strict AP242 constructor.
5776    pub fn add_length_measure_with_unit(
5777        &mut self,
5778        value_component: MeasureValue,
5779        unit_component: UnitRef,
5780    ) -> Result<LengthMeasureWithUnitId, AuthorError> {
5781        check_unit_ref(&self.model, &unit_component)?;
5782        Ok(LengthMeasureWithUnitId(
5783            self.model
5784                .length_measure_with_unit_arena
5785                .push(LengthMeasureWithUnit {
5786                    value_component,
5787                    unit_component,
5788                }),
5789        ))
5790    }
5791
5792    /// `LENGTH_UNIT` — strict AP242 constructor.
5793    pub fn add_length_unit(
5794        &mut self,
5795        dimensions: DimensionalExponentsRef,
5796    ) -> Result<LengthUnitId, AuthorError> {
5797        check_dimensional_exponents_ref(&self.model, &dimensions)?;
5798        Ok(LengthUnitId(
5799            self.model.length_unit_arena.push(LengthUnit { dimensions }),
5800        ))
5801    }
5802
5803    /// `LIMITS_AND_FITS` — strict AP242 constructor.
5804    pub fn add_limits_and_fits(
5805        &mut self,
5806        form_variance: String,
5807        zone_variance: String,
5808        grade: String,
5809        source: String,
5810    ) -> Result<LimitsAndFitsId, AuthorError> {
5811        Ok(LimitsAndFitsId(self.model.limits_and_fits_arena.push(
5812            LimitsAndFits {
5813                form_variance,
5814                zone_variance,
5815                grade,
5816                source,
5817            },
5818        )))
5819    }
5820
5821    /// `LINE` — strict AP242 constructor.
5822    pub fn add_line(
5823        &mut self,
5824        name: String,
5825        pnt: CartesianPointRef,
5826        dir: VectorRef,
5827    ) -> Result<LineId, AuthorError> {
5828        check_cartesian_point_ref(&self.model, &pnt)?;
5829        check_vector_ref(&self.model, &dir)?;
5830        Ok(LineId(self.model.line_arena.push(Line { name, pnt, dir })))
5831    }
5832
5833    /// `LINE_PROFILE_TOLERANCE` — strict AP242 constructor.
5834    pub fn add_line_profile_tolerance(
5835        &mut self,
5836        name: String,
5837        description: Option<String>,
5838        magnitude: Option<LengthMeasureWithUnitRef>,
5839        toleranced_shape_aspect: GeometricToleranceTargetRef,
5840    ) -> Result<LineProfileToleranceId, AuthorError> {
5841        if let Some(x) = &magnitude {
5842            check_length_measure_with_unit_ref(&self.model, x)?;
5843        }
5844        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
5845        Ok(LineProfileToleranceId(
5846            self.model
5847                .line_profile_tolerance_arena
5848                .push(LineProfileTolerance {
5849                    name,
5850                    description,
5851                    magnitude,
5852                    toleranced_shape_aspect,
5853                }),
5854        ))
5855    }
5856
5857    /// `LITERAL_NUMBER` — strict AP242 constructor.
5858    pub fn add_literal_number(&mut self, the_value: f64) -> Result<LiteralNumberId, AuthorError> {
5859        Ok(LiteralNumberId(
5860            self.model
5861                .literal_number_arena
5862                .push(LiteralNumber { the_value }),
5863        ))
5864    }
5865
5866    /// `LOCAL_TIME` — strict AP242 constructor.
5867    pub fn add_local_time(
5868        &mut self,
5869        hour_component: i64,
5870        minute_component: Option<i64>,
5871        second_component: Option<f64>,
5872        zone: CoordinatedUniversalTimeOffsetRef,
5873    ) -> Result<LocalTimeId, AuthorError> {
5874        check_coordinated_universal_time_offset_ref(&self.model, &zone)?;
5875        Ok(LocalTimeId(self.model.local_time_arena.push(LocalTime {
5876            hour_component,
5877            minute_component,
5878            second_component,
5879            zone,
5880        })))
5881    }
5882
5883    /// `LOOP` — strict AP242 constructor.
5884    pub fn add_loop(&mut self, name: String) -> Result<LoopId, AuthorError> {
5885        Ok(LoopId(self.model.loop_arena.push(Loop { name })))
5886    }
5887
5888    /// `MAKE_FROM_USAGE_OPTION` — strict AP242 constructor.
5889    pub fn add_make_from_usage_option(
5890        &mut self,
5891        id: String,
5892        name: String,
5893        description: Option<String>,
5894        relating_product_definition: ProductDefinitionOrReferenceRef,
5895        related_product_definition: ProductDefinitionOrReferenceRef,
5896        ranking: i64,
5897        ranking_rationale: String,
5898        quantity: MeasureWithUnitRef,
5899    ) -> Result<MakeFromUsageOptionId, AuthorError> {
5900        check_product_definition_or_reference_ref(&self.model, &relating_product_definition)?;
5901        check_product_definition_or_reference_ref(&self.model, &related_product_definition)?;
5902        check_measure_with_unit_ref(&self.model, &quantity)?;
5903        Ok(MakeFromUsageOptionId(
5904            self.model
5905                .make_from_usage_option_arena
5906                .push(MakeFromUsageOption {
5907                    id,
5908                    name,
5909                    description,
5910                    relating_product_definition,
5911                    related_product_definition,
5912                    ranking,
5913                    ranking_rationale,
5914                    quantity,
5915                }),
5916        ))
5917    }
5918
5919    /// `MANIFOLD_SOLID_BREP` — strict AP242 constructor.
5920    pub fn add_manifold_solid_brep(
5921        &mut self,
5922        name: String,
5923        outer: ClosedShellRef,
5924    ) -> Result<ManifoldSolidBrepId, AuthorError> {
5925        check_closed_shell_ref(&self.model, &outer)?;
5926        Ok(ManifoldSolidBrepId(
5927            self.model
5928                .manifold_solid_brep_arena
5929                .push(ManifoldSolidBrep { name, outer }),
5930        ))
5931    }
5932
5933    /// `MANIFOLD_SURFACE_SHAPE_REPRESENTATION` — strict AP242 constructor.
5934    pub fn add_manifold_surface_shape_representation(
5935        &mut self,
5936        name: String,
5937        items: Vec<RepresentationItemRef>,
5938        context_of_items: RepresentationContextRef,
5939    ) -> Result<ManifoldSurfaceShapeRepresentationId, AuthorError> {
5940        {
5941            let x = &items;
5942            if x.len() < 1 {
5943                return Err(AuthorError::Cardinality {
5944                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
5945                    attribute: "items",
5946                    got: x.len(),
5947                    min: 1,
5948                    max: None,
5949                });
5950            }
5951        }
5952        for e0 in &items {
5953            check_representation_item_ref(&self.model, e0)?;
5954        }
5955        check_representation_context_ref(&self.model, &context_of_items)?;
5956        Ok(ManifoldSurfaceShapeRepresentationId(
5957            self.model.manifold_surface_shape_representation_arena.push(
5958                ManifoldSurfaceShapeRepresentation {
5959                    name,
5960                    items,
5961                    context_of_items,
5962                },
5963            ),
5964        ))
5965    }
5966
5967    /// `MAPPED_ITEM` — strict AP242 constructor.
5968    pub fn add_mapped_item(
5969        &mut self,
5970        name: String,
5971        mapping_source: RepresentationMapRef,
5972        mapping_target: RepresentationItemRef,
5973    ) -> Result<MappedItemId, AuthorError> {
5974        check_representation_map_ref(&self.model, &mapping_source)?;
5975        check_representation_item_ref(&self.model, &mapping_target)?;
5976        Ok(MappedItemId(self.model.mapped_item_arena.push(
5977            MappedItem {
5978                name,
5979                mapping_source,
5980                mapping_target,
5981            },
5982        )))
5983    }
5984
5985    /// `MASS_MEASURE_WITH_UNIT` — strict AP242 constructor.
5986    pub fn add_mass_measure_with_unit(
5987        &mut self,
5988        value_component: MeasureValue,
5989        unit_component: UnitRef,
5990    ) -> Result<MassMeasureWithUnitId, AuthorError> {
5991        check_unit_ref(&self.model, &unit_component)?;
5992        Ok(MassMeasureWithUnitId(
5993            self.model
5994                .mass_measure_with_unit_arena
5995                .push(MassMeasureWithUnit {
5996                    value_component,
5997                    unit_component,
5998                }),
5999        ))
6000    }
6001
6002    /// `MASS_UNIT` — strict AP242 constructor.
6003    pub fn add_mass_unit(
6004        &mut self,
6005        dimensions: DimensionalExponentsRef,
6006    ) -> Result<MassUnitId, AuthorError> {
6007        check_dimensional_exponents_ref(&self.model, &dimensions)?;
6008        Ok(MassUnitId(
6009            self.model.mass_unit_arena.push(MassUnit { dimensions }),
6010        ))
6011    }
6012
6013    /// `MEASURE_QUALIFICATION` — strict AP242 constructor.
6014    pub fn add_measure_qualification(
6015        &mut self,
6016        name: String,
6017        description: String,
6018        qualified_measure: MeasureWithUnitRef,
6019        qualifiers: Vec<ValueQualifierRef>,
6020    ) -> Result<MeasureQualificationId, AuthorError> {
6021        check_measure_with_unit_ref(&self.model, &qualified_measure)?;
6022        {
6023            let x = &qualifiers;
6024            if x.len() < 1 {
6025                return Err(AuthorError::Cardinality {
6026                    entity: "MEASURE_QUALIFICATION",
6027                    attribute: "qualifiers",
6028                    got: x.len(),
6029                    min: 1,
6030                    max: None,
6031                });
6032            }
6033        }
6034        for e0 in &qualifiers {
6035            check_value_qualifier_ref(&self.model, e0)?;
6036        }
6037        Ok(MeasureQualificationId(
6038            self.model
6039                .measure_qualification_arena
6040                .push(MeasureQualification {
6041                    name,
6042                    description,
6043                    qualified_measure,
6044                    qualifiers,
6045                }),
6046        ))
6047    }
6048
6049    /// `MEASURE_REPRESENTATION_ITEM` — strict AP242 constructor.
6050    pub fn add_measure_representation_item(
6051        &mut self,
6052        name: String,
6053        value_component: MeasureValue,
6054        unit_component: UnitRef,
6055    ) -> Result<MeasureRepresentationItemId, AuthorError> {
6056        check_unit_ref(&self.model, &unit_component)?;
6057        Ok(MeasureRepresentationItemId(
6058            self.model
6059                .measure_representation_item_arena
6060                .push(MeasureRepresentationItem {
6061                    name,
6062                    value_component,
6063                    unit_component,
6064                }),
6065        ))
6066    }
6067
6068    /// `MEASURE_WITH_UNIT` — strict AP242 constructor.
6069    pub fn add_measure_with_unit(
6070        &mut self,
6071        value_component: MeasureValue,
6072        unit_component: UnitRef,
6073    ) -> Result<MeasureWithUnitId, AuthorError> {
6074        check_unit_ref(&self.model, &unit_component)?;
6075        Ok(MeasureWithUnitId(self.model.measure_with_unit_arena.push(
6076            MeasureWithUnit {
6077                value_component,
6078                unit_component,
6079            },
6080        )))
6081    }
6082
6083    /// `MECHANICAL_CONTEXT` — strict AP242 constructor.
6084    pub fn add_mechanical_context(
6085        &mut self,
6086        name: String,
6087        frame_of_reference: ApplicationContextRef,
6088        discipline_type: String,
6089    ) -> Result<MechanicalContextId, AuthorError> {
6090        check_application_context_ref(&self.model, &frame_of_reference)?;
6091        Ok(MechanicalContextId(
6092            self.model.mechanical_context_arena.push(MechanicalContext {
6093                name,
6094                frame_of_reference,
6095                discipline_type,
6096            }),
6097        ))
6098    }
6099
6100    /// `MECHANICAL_DESIGN_AND_DRAUGHTING_RELATIONSHIP` — strict AP242 constructor.
6101    pub fn add_mechanical_design_and_draughting_relationship(
6102        &mut self,
6103        name: String,
6104        description: Option<String>,
6105        rep_1: MechanicalDesignAndDraughtingRelationshipSelectRef,
6106        rep_2: MechanicalDesignAndDraughtingRelationshipSelectRef,
6107    ) -> Result<MechanicalDesignAndDraughtingRelationshipId, AuthorError> {
6108        check_mechanical_design_and_draughting_relationship_select_ref(&self.model, &rep_1)?;
6109        check_mechanical_design_and_draughting_relationship_select_ref(&self.model, &rep_2)?;
6110        Ok(MechanicalDesignAndDraughtingRelationshipId(
6111            self.model
6112                .mechanical_design_and_draughting_relationship_arena
6113                .push(MechanicalDesignAndDraughtingRelationship {
6114                    name,
6115                    description,
6116                    rep_1,
6117                    rep_2,
6118                }),
6119        ))
6120    }
6121
6122    /// `MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION` — strict AP242 constructor.
6123    pub fn add_mechanical_design_geometric_presentation_representation(
6124        &mut self,
6125        name: String,
6126        items: Vec<RepresentationItemRef>,
6127        context_of_items: RepresentationContextRef,
6128    ) -> Result<MechanicalDesignGeometricPresentationRepresentationId, AuthorError> {
6129        {
6130            let x = &items;
6131            if x.len() < 1 {
6132                return Err(AuthorError::Cardinality {
6133                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
6134                    attribute: "items",
6135                    got: x.len(),
6136                    min: 1,
6137                    max: None,
6138                });
6139            }
6140        }
6141        for e0 in &items {
6142            check_representation_item_ref(&self.model, e0)?;
6143        }
6144        check_representation_context_ref(&self.model, &context_of_items)?;
6145        Ok(MechanicalDesignGeometricPresentationRepresentationId(
6146            self.model
6147                .mechanical_design_geometric_presentation_representation_arena
6148                .push(MechanicalDesignGeometricPresentationRepresentation {
6149                    name,
6150                    items,
6151                    context_of_items,
6152                }),
6153        ))
6154    }
6155
6156    /// `MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING` — strict AP242 constructor.
6157    pub fn add_mechanical_design_presentation_representation_with_draughting(
6158        &mut self,
6159        name: String,
6160        items: Vec<RepresentationItemRef>,
6161        context_of_items: RepresentationContextRef,
6162    ) -> Result<MechanicalDesignPresentationRepresentationWithDraughtingId, AuthorError> {
6163        {
6164            let x = &items;
6165            if x.len() < 1 {
6166                return Err(AuthorError::Cardinality {
6167                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
6168                    attribute: "items",
6169                    got: x.len(),
6170                    min: 1,
6171                    max: None,
6172                });
6173            }
6174        }
6175        for e0 in &items {
6176            check_representation_item_ref(&self.model, e0)?;
6177        }
6178        check_representation_context_ref(&self.model, &context_of_items)?;
6179        Ok(MechanicalDesignPresentationRepresentationWithDraughtingId(
6180            self.model
6181                .mechanical_design_presentation_representation_with_draughting_arena
6182                .push(MechanicalDesignPresentationRepresentationWithDraughting {
6183                    name,
6184                    items,
6185                    context_of_items,
6186                }),
6187        ))
6188    }
6189
6190    /// `MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION` — strict AP242 constructor.
6191    pub fn add_mechanical_design_shaded_presentation_representation(
6192        &mut self,
6193        name: String,
6194        items: Vec<RepresentationItemRef>,
6195        context_of_items: RepresentationContextRef,
6196    ) -> Result<MechanicalDesignShadedPresentationRepresentationId, AuthorError> {
6197        {
6198            let x = &items;
6199            if x.len() < 1 {
6200                return Err(AuthorError::Cardinality {
6201                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
6202                    attribute: "items",
6203                    got: x.len(),
6204                    min: 1,
6205                    max: None,
6206                });
6207            }
6208        }
6209        for e0 in &items {
6210            check_representation_item_ref(&self.model, e0)?;
6211        }
6212        check_representation_context_ref(&self.model, &context_of_items)?;
6213        Ok(MechanicalDesignShadedPresentationRepresentationId(
6214            self.model
6215                .mechanical_design_shaded_presentation_representation_arena
6216                .push(MechanicalDesignShadedPresentationRepresentation {
6217                    name,
6218                    items,
6219                    context_of_items,
6220                }),
6221        ))
6222    }
6223
6224    /// `MODEL_GEOMETRIC_VIEW` — strict AP242 constructor.
6225    pub fn add_model_geometric_view(
6226        &mut self,
6227        name: String,
6228        description: Option<String>,
6229        item: RepresentationItemRef,
6230        rep: RepresentationRef,
6231    ) -> Result<ModelGeometricViewId, AuthorError> {
6232        check_representation_item_ref(&self.model, &item)?;
6233        check_representation_ref(&self.model, &rep)?;
6234        Ok(ModelGeometricViewId(
6235            self.model
6236                .model_geometric_view_arena
6237                .push(ModelGeometricView {
6238                    name,
6239                    description,
6240                    item,
6241                    rep,
6242                }),
6243        ))
6244    }
6245
6246    /// `MODIFIED_GEOMETRIC_TOLERANCE` — strict AP242 constructor.
6247    pub fn add_modified_geometric_tolerance(
6248        &mut self,
6249        name: String,
6250        description: Option<String>,
6251        magnitude: Option<LengthMeasureWithUnitRef>,
6252        toleranced_shape_aspect: GeometricToleranceTargetRef,
6253        modifier: LimitCondition,
6254    ) -> Result<ModifiedGeometricToleranceId, AuthorError> {
6255        if let Some(x) = &magnitude {
6256            check_length_measure_with_unit_ref(&self.model, x)?;
6257        }
6258        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
6259        Ok(ModifiedGeometricToleranceId(
6260            self.model
6261                .modified_geometric_tolerance_arena
6262                .push(ModifiedGeometricTolerance {
6263                    name,
6264                    description,
6265                    magnitude,
6266                    toleranced_shape_aspect,
6267                    modifier,
6268                }),
6269        ))
6270    }
6271
6272    /// `NAME_ATTRIBUTE` — strict AP242 constructor.
6273    pub fn add_name_attribute(
6274        &mut self,
6275        attribute_value: String,
6276        named_item: NameAttributeSelectRef,
6277    ) -> Result<NameAttributeId, AuthorError> {
6278        check_name_attribute_select_ref(&self.model, &named_item)?;
6279        Ok(NameAttributeId(self.model.name_attribute_arena.push(
6280            NameAttribute {
6281                attribute_value,
6282                named_item,
6283            },
6284        )))
6285    }
6286
6287    /// `NAMED_UNIT` — strict AP242 constructor.
6288    pub fn add_named_unit(
6289        &mut self,
6290        dimensions: Option<DimensionalExponentsRef>,
6291    ) -> Result<NamedUnitId, AuthorError> {
6292        if let Some(x) = &dimensions {
6293            check_dimensional_exponents_ref(&self.model, x)?;
6294        }
6295        Ok(NamedUnitId(
6296            self.model.named_unit_arena.push(NamedUnit { dimensions }),
6297        ))
6298    }
6299
6300    /// `NEXT_ASSEMBLY_USAGE_OCCURRENCE` — strict AP242 constructor.
6301    pub fn add_next_assembly_usage_occurrence(
6302        &mut self,
6303        id: String,
6304        name: String,
6305        description: Option<String>,
6306        relating_product_definition: ProductDefinitionOrReferenceRef,
6307        related_product_definition: ProductDefinitionOrReferenceRef,
6308        reference_designator: Option<String>,
6309    ) -> Result<NextAssemblyUsageOccurrenceId, AuthorError> {
6310        check_product_definition_or_reference_ref(&self.model, &relating_product_definition)?;
6311        check_product_definition_or_reference_ref(&self.model, &related_product_definition)?;
6312        Ok(NextAssemblyUsageOccurrenceId(
6313            self.model
6314                .next_assembly_usage_occurrence_arena
6315                .push(NextAssemblyUsageOccurrence {
6316                    id,
6317                    name,
6318                    description,
6319                    relating_product_definition,
6320                    related_product_definition,
6321                    reference_designator,
6322                }),
6323        ))
6324    }
6325
6326    /// `NUMERIC_EXPRESSION` — strict AP242 constructor.
6327    pub fn add_numeric_expression(&mut self) -> Result<NumericExpressionId, AuthorError> {
6328        Ok(NumericExpressionId(
6329            self.model
6330                .numeric_expression_arena
6331                .push(NumericExpression {}),
6332        ))
6333    }
6334
6335    /// `OBJECT_ROLE` — strict AP242 constructor.
6336    pub fn add_object_role(
6337        &mut self,
6338        name: String,
6339        description: Option<String>,
6340    ) -> Result<ObjectRoleId, AuthorError> {
6341        Ok(ObjectRoleId(
6342            self.model
6343                .object_role_arena
6344                .push(ObjectRole { name, description }),
6345        ))
6346    }
6347
6348    /// `OFFSET_SURFACE` — strict AP242 constructor.
6349    pub fn add_offset_surface(
6350        &mut self,
6351        name: String,
6352        basis_surface: SurfaceRef,
6353        distance: f64,
6354        self_intersect: Logical,
6355    ) -> Result<OffsetSurfaceId, AuthorError> {
6356        check_surface_ref(&self.model, &basis_surface)?;
6357        Ok(OffsetSurfaceId(self.model.offset_surface_arena.push(
6358            OffsetSurface {
6359                name,
6360                basis_surface,
6361                distance,
6362                self_intersect,
6363            },
6364        )))
6365    }
6366
6367    /// `ONE_DIRECTION_REPEAT_FACTOR` — strict AP242 constructor.
6368    pub fn add_one_direction_repeat_factor(
6369        &mut self,
6370        name: String,
6371        repeat_factor: VectorRef,
6372    ) -> Result<OneDirectionRepeatFactorId, AuthorError> {
6373        check_vector_ref(&self.model, &repeat_factor)?;
6374        Ok(OneDirectionRepeatFactorId(
6375            self.model
6376                .one_direction_repeat_factor_arena
6377                .push(OneDirectionRepeatFactor {
6378                    name,
6379                    repeat_factor,
6380                }),
6381        ))
6382    }
6383
6384    /// `OPEN_SHELL` — strict AP242 constructor.
6385    pub fn add_open_shell(
6386        &mut self,
6387        name: String,
6388        cfs_faces: Vec<FaceRef>,
6389    ) -> Result<OpenShellId, AuthorError> {
6390        {
6391            let x = &cfs_faces;
6392            if x.len() < 1 {
6393                return Err(AuthorError::Cardinality {
6394                    entity: "OPEN_SHELL",
6395                    attribute: "cfs_faces",
6396                    got: x.len(),
6397                    min: 1,
6398                    max: None,
6399                });
6400            }
6401        }
6402        for e0 in &cfs_faces {
6403            check_face_ref(&self.model, e0)?;
6404        }
6405        Ok(OpenShellId(
6406            self.model
6407                .open_shell_arena
6408                .push(OpenShell { name, cfs_faces }),
6409        ))
6410    }
6411
6412    /// `ORGANIZATION` — strict AP242 constructor.
6413    pub fn add_organization(
6414        &mut self,
6415        id: Option<String>,
6416        name: String,
6417        description: Option<String>,
6418    ) -> Result<OrganizationId, AuthorError> {
6419        Ok(OrganizationId(self.model.organization_arena.push(
6420            Organization {
6421                id,
6422                name,
6423                description,
6424            },
6425        )))
6426    }
6427
6428    /// `ORGANIZATION_RELATIONSHIP` — strict AP242 constructor.
6429    pub fn add_organization_relationship(
6430        &mut self,
6431        name: String,
6432        description: Option<String>,
6433        relating_organization: OrganizationRef,
6434        related_organization: OrganizationRef,
6435    ) -> Result<OrganizationRelationshipId, AuthorError> {
6436        check_organization_ref(&self.model, &relating_organization)?;
6437        check_organization_ref(&self.model, &related_organization)?;
6438        Ok(OrganizationRelationshipId(
6439            self.model
6440                .organization_relationship_arena
6441                .push(OrganizationRelationship {
6442                    name,
6443                    description,
6444                    relating_organization,
6445                    related_organization,
6446                }),
6447        ))
6448    }
6449
6450    /// `ORGANIZATION_ROLE` — strict AP242 constructor.
6451    pub fn add_organization_role(
6452        &mut self,
6453        name: String,
6454    ) -> Result<OrganizationRoleId, AuthorError> {
6455        Ok(OrganizationRoleId(
6456            self.model
6457                .organization_role_arena
6458                .push(OrganizationRole { name }),
6459        ))
6460    }
6461
6462    /// `ORGANIZATION_TYPE` — strict AP242 constructor.
6463    pub fn add_organization_type(
6464        &mut self,
6465        id: String,
6466        name: String,
6467        description: Option<String>,
6468    ) -> Result<OrganizationTypeId, AuthorError> {
6469        Ok(OrganizationTypeId(self.model.organization_type_arena.push(
6470            OrganizationType {
6471                id,
6472                name,
6473                description,
6474            },
6475        )))
6476    }
6477
6478    /// `ORGANIZATION_TYPE_ROLE` — strict AP242 constructor.
6479    pub fn add_organization_type_role(
6480        &mut self,
6481        id: String,
6482        name: String,
6483        description: Option<String>,
6484    ) -> Result<OrganizationTypeRoleId, AuthorError> {
6485        Ok(OrganizationTypeRoleId(
6486            self.model
6487                .organization_type_role_arena
6488                .push(OrganizationTypeRole {
6489                    id,
6490                    name,
6491                    description,
6492                }),
6493        ))
6494    }
6495
6496    /// `ORGANIZATIONAL_ADDRESS` — strict AP242 constructor.
6497    pub fn add_organizational_address(
6498        &mut self,
6499        internal_location: Option<String>,
6500        street_number: Option<String>,
6501        street: Option<String>,
6502        postal_box: Option<String>,
6503        town: Option<String>,
6504        region: Option<String>,
6505        postal_code: Option<String>,
6506        country: Option<String>,
6507        facsimile_number: Option<String>,
6508        telephone_number: Option<String>,
6509        electronic_mail_address: Option<String>,
6510        telex_number: Option<String>,
6511        organizations: Vec<OrganizationRef>,
6512        description: Option<String>,
6513    ) -> Result<OrganizationalAddressId, AuthorError> {
6514        {
6515            let x = &organizations;
6516            if x.len() < 1 {
6517                return Err(AuthorError::Cardinality {
6518                    entity: "ORGANIZATIONAL_ADDRESS",
6519                    attribute: "organizations",
6520                    got: x.len(),
6521                    min: 1,
6522                    max: None,
6523                });
6524            }
6525        }
6526        for e0 in &organizations {
6527            check_organization_ref(&self.model, e0)?;
6528        }
6529        Ok(OrganizationalAddressId(
6530            self.model
6531                .organizational_address_arena
6532                .push(OrganizationalAddress {
6533                    internal_location,
6534                    street_number,
6535                    street,
6536                    postal_box,
6537                    town,
6538                    region,
6539                    postal_code,
6540                    country,
6541                    facsimile_number,
6542                    telephone_number,
6543                    electronic_mail_address,
6544                    telex_number,
6545                    organizations,
6546                    description,
6547                }),
6548        ))
6549    }
6550
6551    /// `ORGANIZATIONAL_PROJECT` — strict AP242 constructor.
6552    pub fn add_organizational_project(
6553        &mut self,
6554        name: String,
6555        description: Option<String>,
6556        responsible_organizations: Vec<OrganizationRef>,
6557    ) -> Result<OrganizationalProjectId, AuthorError> {
6558        {
6559            let x = &responsible_organizations;
6560            if x.len() < 1 {
6561                return Err(AuthorError::Cardinality {
6562                    entity: "ORGANIZATIONAL_PROJECT",
6563                    attribute: "responsible_organizations",
6564                    got: x.len(),
6565                    min: 1,
6566                    max: None,
6567                });
6568            }
6569        }
6570        for e0 in &responsible_organizations {
6571            check_organization_ref(&self.model, e0)?;
6572        }
6573        Ok(OrganizationalProjectId(
6574            self.model
6575                .organizational_project_arena
6576                .push(OrganizationalProject {
6577                    name,
6578                    description,
6579                    responsible_organizations,
6580                }),
6581        ))
6582    }
6583
6584    /// `ORGANIZATIONAL_PROJECT_RELATIONSHIP` — strict AP242 constructor.
6585    pub fn add_organizational_project_relationship(
6586        &mut self,
6587        name: String,
6588        description: Option<String>,
6589        relating_organizational_project: OrganizationalProjectRef,
6590        related_organizational_project: OrganizationalProjectRef,
6591    ) -> Result<OrganizationalProjectRelationshipId, AuthorError> {
6592        check_organizational_project_ref(&self.model, &relating_organizational_project)?;
6593        check_organizational_project_ref(&self.model, &related_organizational_project)?;
6594        Ok(OrganizationalProjectRelationshipId(
6595            self.model.organizational_project_relationship_arena.push(
6596                OrganizationalProjectRelationship {
6597                    name,
6598                    description,
6599                    relating_organizational_project,
6600                    related_organizational_project,
6601                },
6602            ),
6603        ))
6604    }
6605
6606    /// `ORGANIZATIONAL_PROJECT_ROLE` — strict AP242 constructor.
6607    pub fn add_organizational_project_role(
6608        &mut self,
6609        name: String,
6610        description: Option<String>,
6611    ) -> Result<OrganizationalProjectRoleId, AuthorError> {
6612        Ok(OrganizationalProjectRoleId(
6613            self.model
6614                .organizational_project_role_arena
6615                .push(OrganizationalProjectRole { name, description }),
6616        ))
6617    }
6618
6619    /// `ORIENTED_CLOSED_SHELL` — strict AP242 constructor.
6620    pub fn add_oriented_closed_shell(
6621        &mut self,
6622        name: String,
6623        closed_shell_element: ClosedShellRef,
6624        orientation: bool,
6625    ) -> Result<OrientedClosedShellId, AuthorError> {
6626        check_closed_shell_ref(&self.model, &closed_shell_element)?;
6627        Ok(OrientedClosedShellId(
6628            self.model
6629                .oriented_closed_shell_arena
6630                .push(OrientedClosedShell {
6631                    name,
6632                    closed_shell_element,
6633                    orientation,
6634                }),
6635        ))
6636    }
6637
6638    /// `ORIENTED_EDGE` — strict AP242 constructor.
6639    pub fn add_oriented_edge(
6640        &mut self,
6641        name: String,
6642        edge_element: EdgeRef,
6643        orientation: bool,
6644    ) -> Result<OrientedEdgeId, AuthorError> {
6645        check_edge_ref(&self.model, &edge_element)?;
6646        Ok(OrientedEdgeId(self.model.oriented_edge_arena.push(
6647            OrientedEdge {
6648                name,
6649                edge_element,
6650                orientation,
6651            },
6652        )))
6653    }
6654
6655    /// `OVER_RIDING_STYLED_ITEM` — strict AP242 constructor.
6656    pub fn add_over_riding_styled_item(
6657        &mut self,
6658        name: String,
6659        styles: Vec<PresentationStyleAssignmentRef>,
6660        item: StyledItemTargetRef,
6661        over_ridden_style: StyledItemRef,
6662    ) -> Result<OverRidingStyledItemId, AuthorError> {
6663        for e0 in &styles {
6664            check_presentation_style_assignment_ref(&self.model, e0)?;
6665        }
6666        check_styled_item_target_ref(&self.model, &item)?;
6667        check_styled_item_ref(&self.model, &over_ridden_style)?;
6668        Ok(OverRidingStyledItemId(
6669            self.model
6670                .over_riding_styled_item_arena
6671                .push(OverRidingStyledItem {
6672                    name,
6673                    styles,
6674                    item,
6675                    over_ridden_style,
6676                }),
6677        ))
6678    }
6679
6680    /// `PARALLELISM_TOLERANCE` — strict AP242 constructor.
6681    pub fn add_parallelism_tolerance(
6682        &mut self,
6683        name: String,
6684        description: Option<String>,
6685        magnitude: Option<LengthMeasureWithUnitRef>,
6686        toleranced_shape_aspect: GeometricToleranceTargetRef,
6687        datum_system: Vec<DatumSystemOrReferenceRef>,
6688    ) -> Result<ParallelismToleranceId, AuthorError> {
6689        if let Some(x) = &magnitude {
6690            check_length_measure_with_unit_ref(&self.model, x)?;
6691        }
6692        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
6693        {
6694            let x = &datum_system;
6695            if x.len() < 1 {
6696                return Err(AuthorError::Cardinality {
6697                    entity: "PARALLELISM_TOLERANCE",
6698                    attribute: "datum_system",
6699                    got: x.len(),
6700                    min: 1,
6701                    max: None,
6702                });
6703            }
6704        }
6705        for e0 in &datum_system {
6706            check_datum_system_or_reference_ref(&self.model, e0)?;
6707        }
6708        Ok(ParallelismToleranceId(
6709            self.model
6710                .parallelism_tolerance_arena
6711                .push(ParallelismTolerance {
6712                    name,
6713                    description,
6714                    magnitude,
6715                    toleranced_shape_aspect,
6716                    datum_system,
6717                }),
6718        ))
6719    }
6720
6721    /// `PARAMETRIC_REPRESENTATION_CONTEXT` — strict AP242 constructor.
6722    pub fn add_parametric_representation_context(
6723        &mut self,
6724        context_identifier: String,
6725        context_type: String,
6726    ) -> Result<ParametricRepresentationContextId, AuthorError> {
6727        Ok(ParametricRepresentationContextId(
6728            self.model.parametric_representation_context_arena.push(
6729                ParametricRepresentationContext {
6730                    context_identifier,
6731                    context_type,
6732                },
6733            ),
6734        ))
6735    }
6736
6737    /// `PATH` — strict AP242 constructor.
6738    pub fn add_path(
6739        &mut self,
6740        name: String,
6741        edge_list: Vec<OrientedEdgeRef>,
6742    ) -> Result<PathId, AuthorError> {
6743        {
6744            let x = &edge_list;
6745            if x.len() < 1 {
6746                return Err(AuthorError::Cardinality {
6747                    entity: "PATH",
6748                    attribute: "edge_list",
6749                    got: x.len(),
6750                    min: 1,
6751                    max: None,
6752                });
6753            }
6754        }
6755        for e0 in &edge_list {
6756            check_oriented_edge_ref(&self.model, e0)?;
6757        }
6758        Ok(PathId(self.model.path_arena.push(Path { name, edge_list })))
6759    }
6760
6761    /// `PCURVE` — strict AP242 constructor.
6762    pub fn add_pcurve(
6763        &mut self,
6764        name: String,
6765        basis_surface: SurfaceRef,
6766        reference_to_curve: DefinitionalRepresentationRef,
6767    ) -> Result<PcurveId, AuthorError> {
6768        check_surface_ref(&self.model, &basis_surface)?;
6769        check_definitional_representation_ref(&self.model, &reference_to_curve)?;
6770        Ok(PcurveId(self.model.pcurve_arena.push(Pcurve {
6771            name,
6772            basis_surface,
6773            reference_to_curve,
6774        })))
6775    }
6776
6777    /// `PERPENDICULARITY_TOLERANCE` — strict AP242 constructor.
6778    pub fn add_perpendicularity_tolerance(
6779        &mut self,
6780        name: String,
6781        description: Option<String>,
6782        magnitude: Option<LengthMeasureWithUnitRef>,
6783        toleranced_shape_aspect: GeometricToleranceTargetRef,
6784        datum_system: Vec<DatumSystemOrReferenceRef>,
6785    ) -> Result<PerpendicularityToleranceId, AuthorError> {
6786        if let Some(x) = &magnitude {
6787            check_length_measure_with_unit_ref(&self.model, x)?;
6788        }
6789        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
6790        {
6791            let x = &datum_system;
6792            if x.len() < 1 {
6793                return Err(AuthorError::Cardinality {
6794                    entity: "PERPENDICULARITY_TOLERANCE",
6795                    attribute: "datum_system",
6796                    got: x.len(),
6797                    min: 1,
6798                    max: None,
6799                });
6800            }
6801        }
6802        for e0 in &datum_system {
6803            check_datum_system_or_reference_ref(&self.model, e0)?;
6804        }
6805        Ok(PerpendicularityToleranceId(
6806            self.model
6807                .perpendicularity_tolerance_arena
6808                .push(PerpendicularityTolerance {
6809                    name,
6810                    description,
6811                    magnitude,
6812                    toleranced_shape_aspect,
6813                    datum_system,
6814                }),
6815        ))
6816    }
6817
6818    /// `PERSON` — strict AP242 constructor.
6819    pub fn add_person(
6820        &mut self,
6821        id: String,
6822        last_name: Option<String>,
6823        first_name: Option<String>,
6824        middle_names: Option<Vec<String>>,
6825        prefix_titles: Option<Vec<String>>,
6826        suffix_titles: Option<Vec<String>>,
6827    ) -> Result<PersonId, AuthorError> {
6828        if let Some(x) = &middle_names {
6829            if x.len() < 1 {
6830                return Err(AuthorError::Cardinality {
6831                    entity: "PERSON",
6832                    attribute: "middle_names",
6833                    got: x.len(),
6834                    min: 1,
6835                    max: None,
6836                });
6837            }
6838        }
6839        if let Some(x) = &prefix_titles {
6840            if x.len() < 1 {
6841                return Err(AuthorError::Cardinality {
6842                    entity: "PERSON",
6843                    attribute: "prefix_titles",
6844                    got: x.len(),
6845                    min: 1,
6846                    max: None,
6847                });
6848            }
6849        }
6850        if let Some(x) = &suffix_titles {
6851            if x.len() < 1 {
6852                return Err(AuthorError::Cardinality {
6853                    entity: "PERSON",
6854                    attribute: "suffix_titles",
6855                    got: x.len(),
6856                    min: 1,
6857                    max: None,
6858                });
6859            }
6860        }
6861        Ok(PersonId(self.model.person_arena.push(Person {
6862            id,
6863            last_name,
6864            first_name,
6865            middle_names,
6866            prefix_titles,
6867            suffix_titles,
6868        })))
6869    }
6870
6871    /// `PERSON_AND_ORGANIZATION` — strict AP242 constructor.
6872    pub fn add_person_and_organization(
6873        &mut self,
6874        the_person: PersonRef,
6875        the_organization: OrganizationRef,
6876    ) -> Result<PersonAndOrganizationId, AuthorError> {
6877        check_person_ref(&self.model, &the_person)?;
6878        check_organization_ref(&self.model, &the_organization)?;
6879        Ok(PersonAndOrganizationId(
6880            self.model
6881                .person_and_organization_arena
6882                .push(PersonAndOrganization {
6883                    the_person,
6884                    the_organization,
6885                }),
6886        ))
6887    }
6888
6889    /// `PERSON_AND_ORGANIZATION_ADDRESS` — strict AP242 constructor.
6890    pub fn add_person_and_organization_address(
6891        &mut self,
6892        internal_location: Option<String>,
6893        street_number: Option<String>,
6894        street: Option<String>,
6895        postal_box: Option<String>,
6896        town: Option<String>,
6897        region: Option<String>,
6898        postal_code: Option<String>,
6899        country: Option<String>,
6900        facsimile_number: Option<String>,
6901        telephone_number: Option<String>,
6902        electronic_mail_address: Option<String>,
6903        telex_number: Option<String>,
6904        organizations: Vec<OrganizationRef>,
6905        description: Option<String>,
6906        people: Vec<PersonRef>,
6907        description_1: Option<String>,
6908    ) -> Result<PersonAndOrganizationAddressId, AuthorError> {
6909        {
6910            let x = &organizations;
6911            if x.len() < 1 {
6912                return Err(AuthorError::Cardinality {
6913                    entity: "PERSON_AND_ORGANIZATION_ADDRESS",
6914                    attribute: "organizations",
6915                    got: x.len(),
6916                    min: 1,
6917                    max: None,
6918                });
6919            }
6920        }
6921        for e0 in &organizations {
6922            check_organization_ref(&self.model, e0)?;
6923        }
6924        {
6925            let x = &people;
6926            if x.len() < 1 {
6927                return Err(AuthorError::Cardinality {
6928                    entity: "PERSON_AND_ORGANIZATION_ADDRESS",
6929                    attribute: "people",
6930                    got: x.len(),
6931                    min: 1,
6932                    max: None,
6933                });
6934            }
6935        }
6936        for e0 in &people {
6937            check_person_ref(&self.model, e0)?;
6938        }
6939        Ok(PersonAndOrganizationAddressId(
6940            self.model
6941                .person_and_organization_address_arena
6942                .push(PersonAndOrganizationAddress {
6943                    internal_location,
6944                    street_number,
6945                    street,
6946                    postal_box,
6947                    town,
6948                    region,
6949                    postal_code,
6950                    country,
6951                    facsimile_number,
6952                    telephone_number,
6953                    electronic_mail_address,
6954                    telex_number,
6955                    organizations,
6956                    description,
6957                    people,
6958                    description_1,
6959                }),
6960        ))
6961    }
6962
6963    /// `PERSON_AND_ORGANIZATION_ASSIGNMENT` — strict AP242 constructor.
6964    pub fn add_person_and_organization_assignment(
6965        &mut self,
6966        assigned_person_and_organization: PersonAndOrganizationRef,
6967        role: PersonAndOrganizationRoleRef,
6968    ) -> Result<PersonAndOrganizationAssignmentId, AuthorError> {
6969        check_person_and_organization_ref(&self.model, &assigned_person_and_organization)?;
6970        check_person_and_organization_role_ref(&self.model, &role)?;
6971        Ok(PersonAndOrganizationAssignmentId(
6972            self.model.person_and_organization_assignment_arena.push(
6973                PersonAndOrganizationAssignment {
6974                    assigned_person_and_organization,
6975                    role,
6976                },
6977            ),
6978        ))
6979    }
6980
6981    /// `PERSON_AND_ORGANIZATION_ROLE` — strict AP242 constructor.
6982    pub fn add_person_and_organization_role(
6983        &mut self,
6984        name: String,
6985    ) -> Result<PersonAndOrganizationRoleId, AuthorError> {
6986        Ok(PersonAndOrganizationRoleId(
6987            self.model
6988                .person_and_organization_role_arena
6989                .push(PersonAndOrganizationRole { name }),
6990        ))
6991    }
6992
6993    /// `PERSONAL_ADDRESS` — strict AP242 constructor.
6994    pub fn add_personal_address(
6995        &mut self,
6996        internal_location: Option<String>,
6997        street_number: Option<String>,
6998        street: Option<String>,
6999        postal_box: Option<String>,
7000        town: Option<String>,
7001        region: Option<String>,
7002        postal_code: Option<String>,
7003        country: Option<String>,
7004        facsimile_number: Option<String>,
7005        telephone_number: Option<String>,
7006        electronic_mail_address: Option<String>,
7007        telex_number: Option<String>,
7008        people: Vec<PersonRef>,
7009        description: Option<String>,
7010    ) -> Result<PersonalAddressId, AuthorError> {
7011        {
7012            let x = &people;
7013            if x.len() < 1 {
7014                return Err(AuthorError::Cardinality {
7015                    entity: "PERSONAL_ADDRESS",
7016                    attribute: "people",
7017                    got: x.len(),
7018                    min: 1,
7019                    max: None,
7020                });
7021            }
7022        }
7023        for e0 in &people {
7024            check_person_ref(&self.model, e0)?;
7025        }
7026        Ok(PersonalAddressId(self.model.personal_address_arena.push(
7027            PersonalAddress {
7028                internal_location,
7029                street_number,
7030                street,
7031                postal_box,
7032                town,
7033                region,
7034                postal_code,
7035                country,
7036                facsimile_number,
7037                telephone_number,
7038                electronic_mail_address,
7039                telex_number,
7040                people,
7041                description,
7042            },
7043        )))
7044    }
7045
7046    /// `PLACED_DATUM_TARGET_FEATURE` — strict AP242 constructor.
7047    pub fn add_placed_datum_target_feature(
7048        &mut self,
7049        name: String,
7050        description: Option<String>,
7051        of_shape: ProductDefinitionShapeRef,
7052        product_definitional: Logical,
7053        target_id: String,
7054    ) -> Result<PlacedDatumTargetFeatureId, AuthorError> {
7055        check_product_definition_shape_ref(&self.model, &of_shape)?;
7056        Ok(PlacedDatumTargetFeatureId(
7057            self.model
7058                .placed_datum_target_feature_arena
7059                .push(PlacedDatumTargetFeature {
7060                    name,
7061                    description,
7062                    of_shape,
7063                    product_definitional,
7064                    target_id,
7065                }),
7066        ))
7067    }
7068
7069    /// `PLACEMENT` — strict AP242 constructor.
7070    pub fn add_placement(
7071        &mut self,
7072        name: String,
7073        location: CartesianPointRef,
7074    ) -> Result<PlacementId, AuthorError> {
7075        check_cartesian_point_ref(&self.model, &location)?;
7076        Ok(PlacementId(
7077            self.model
7078                .placement_arena
7079                .push(Placement { name, location }),
7080        ))
7081    }
7082
7083    /// `PLANAR_BOX` — strict AP242 constructor.
7084    pub fn add_planar_box(
7085        &mut self,
7086        name: String,
7087        size_in_x: f64,
7088        size_in_y: f64,
7089        placement: Axis2PlacementRef,
7090    ) -> Result<PlanarBoxId, AuthorError> {
7091        check_axis2_placement_ref(&self.model, &placement)?;
7092        Ok(PlanarBoxId(self.model.planar_box_arena.push(PlanarBox {
7093            name,
7094            size_in_x,
7095            size_in_y,
7096            placement,
7097        })))
7098    }
7099
7100    /// `PLANAR_EXTENT` — strict AP242 constructor.
7101    pub fn add_planar_extent(
7102        &mut self,
7103        name: String,
7104        size_in_x: f64,
7105        size_in_y: f64,
7106    ) -> Result<PlanarExtentId, AuthorError> {
7107        Ok(PlanarExtentId(self.model.planar_extent_arena.push(
7108            PlanarExtent {
7109                name,
7110                size_in_x,
7111                size_in_y,
7112            },
7113        )))
7114    }
7115
7116    /// `PLANE` — strict AP242 constructor.
7117    pub fn add_plane(
7118        &mut self,
7119        name: String,
7120        position: Axis2Placement3dRef,
7121    ) -> Result<PlaneId, AuthorError> {
7122        check_axis2_placement3d_ref(&self.model, &position)?;
7123        Ok(PlaneId(
7124            self.model.plane_arena.push(Plane { name, position }),
7125        ))
7126    }
7127
7128    /// `PLANE_ANGLE_MEASURE_WITH_UNIT` — strict AP242 constructor.
7129    pub fn add_plane_angle_measure_with_unit(
7130        &mut self,
7131        value_component: MeasureValue,
7132        unit_component: UnitRef,
7133    ) -> Result<PlaneAngleMeasureWithUnitId, AuthorError> {
7134        check_unit_ref(&self.model, &unit_component)?;
7135        Ok(PlaneAngleMeasureWithUnitId(
7136            self.model
7137                .plane_angle_measure_with_unit_arena
7138                .push(PlaneAngleMeasureWithUnit {
7139                    value_component,
7140                    unit_component,
7141                }),
7142        ))
7143    }
7144
7145    /// `PLANE_ANGLE_UNIT` — strict AP242 constructor.
7146    pub fn add_plane_angle_unit(
7147        &mut self,
7148        dimensions: DimensionalExponentsRef,
7149    ) -> Result<PlaneAngleUnitId, AuthorError> {
7150        check_dimensional_exponents_ref(&self.model, &dimensions)?;
7151        Ok(PlaneAngleUnitId(
7152            self.model
7153                .plane_angle_unit_arena
7154                .push(PlaneAngleUnit { dimensions }),
7155        ))
7156    }
7157
7158    /// `PLUS_MINUS_TOLERANCE` — strict AP242 constructor.
7159    pub fn add_plus_minus_tolerance(
7160        &mut self,
7161        range: ToleranceMethodDefinitionRef,
7162        toleranced_dimension: DimensionalCharacteristicRef,
7163    ) -> Result<PlusMinusToleranceId, AuthorError> {
7164        check_tolerance_method_definition_ref(&self.model, &range)?;
7165        check_dimensional_characteristic_ref(&self.model, &toleranced_dimension)?;
7166        Ok(PlusMinusToleranceId(
7167            self.model
7168                .plus_minus_tolerance_arena
7169                .push(PlusMinusTolerance {
7170                    range,
7171                    toleranced_dimension,
7172                }),
7173        ))
7174    }
7175
7176    /// `POINT` — strict AP242 constructor.
7177    pub fn add_point(&mut self, name: String) -> Result<PointId, AuthorError> {
7178        Ok(PointId(self.model.point_arena.push(Point { name })))
7179    }
7180
7181    /// `POINT_STYLE` — strict AP242 constructor.
7182    pub fn add_point_style(
7183        &mut self,
7184        name: String,
7185        marker: Option<MarkerSelectRef>,
7186        marker_size: Option<SizeSelectRef>,
7187        marker_colour: Option<ColourRef>,
7188    ) -> Result<PointStyleId, AuthorError> {
7189        if let Some(x) = &marker {
7190            check_marker_select_ref(&self.model, x)?;
7191        }
7192        if let Some(x) = &marker_size {
7193            check_size_select_ref(&self.model, x)?;
7194        }
7195        if let Some(x) = &marker_colour {
7196            check_colour_ref(&self.model, x)?;
7197        }
7198        Ok(PointStyleId(self.model.point_style_arena.push(
7199            PointStyle {
7200                name,
7201                marker,
7202                marker_size,
7203                marker_colour,
7204            },
7205        )))
7206    }
7207
7208    /// `POLY_LOOP` — strict AP242 constructor.
7209    pub fn add_poly_loop(
7210        &mut self,
7211        name: String,
7212        polygon: Vec<CartesianPointRef>,
7213    ) -> Result<PolyLoopId, AuthorError> {
7214        {
7215            let x = &polygon;
7216            if x.len() < 3 {
7217                return Err(AuthorError::Cardinality {
7218                    entity: "POLY_LOOP",
7219                    attribute: "polygon",
7220                    got: x.len(),
7221                    min: 3,
7222                    max: None,
7223                });
7224            }
7225        }
7226        for e0 in &polygon {
7227            check_cartesian_point_ref(&self.model, e0)?;
7228        }
7229        Ok(PolyLoopId(
7230            self.model.poly_loop_arena.push(PolyLoop { name, polygon }),
7231        ))
7232    }
7233
7234    /// `POLYLINE` — strict AP242 constructor.
7235    pub fn add_polyline(
7236        &mut self,
7237        name: String,
7238        points: Vec<CartesianPointRef>,
7239    ) -> Result<PolylineId, AuthorError> {
7240        {
7241            let x = &points;
7242            if x.len() < 2 {
7243                return Err(AuthorError::Cardinality {
7244                    entity: "POLYLINE",
7245                    attribute: "points",
7246                    got: x.len(),
7247                    min: 2,
7248                    max: None,
7249                });
7250            }
7251        }
7252        for e0 in &points {
7253            check_cartesian_point_ref(&self.model, e0)?;
7254        }
7255        Ok(PolylineId(
7256            self.model.polyline_arena.push(Polyline { name, points }),
7257        ))
7258    }
7259
7260    /// `POSITION_TOLERANCE` — strict AP242 constructor.
7261    pub fn add_position_tolerance(
7262        &mut self,
7263        name: String,
7264        description: Option<String>,
7265        magnitude: Option<LengthMeasureWithUnitRef>,
7266        toleranced_shape_aspect: GeometricToleranceTargetRef,
7267    ) -> Result<PositionToleranceId, AuthorError> {
7268        if let Some(x) = &magnitude {
7269            check_length_measure_with_unit_ref(&self.model, x)?;
7270        }
7271        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
7272        Ok(PositionToleranceId(
7273            self.model.position_tolerance_arena.push(PositionTolerance {
7274                name,
7275                description,
7276                magnitude,
7277                toleranced_shape_aspect,
7278            }),
7279        ))
7280    }
7281
7282    /// `PRE_DEFINED_CHARACTER_GLYPH` — strict AP242 constructor.
7283    pub fn add_pre_defined_character_glyph(
7284        &mut self,
7285        name: String,
7286    ) -> Result<PreDefinedCharacterGlyphId, AuthorError> {
7287        Ok(PreDefinedCharacterGlyphId(
7288            self.model
7289                .pre_defined_character_glyph_arena
7290                .push(PreDefinedCharacterGlyph { name }),
7291        ))
7292    }
7293
7294    /// `PRE_DEFINED_COLOUR` — strict AP242 constructor.
7295    pub fn add_pre_defined_colour(
7296        &mut self,
7297        name: String,
7298    ) -> Result<PreDefinedColourId, AuthorError> {
7299        Ok(PreDefinedColourId(
7300            self.model
7301                .pre_defined_colour_arena
7302                .push(PreDefinedColour { name }),
7303        ))
7304    }
7305
7306    /// `PRE_DEFINED_CURVE_FONT` — strict AP242 constructor.
7307    pub fn add_pre_defined_curve_font(
7308        &mut self,
7309        name: String,
7310    ) -> Result<PreDefinedCurveFontId, AuthorError> {
7311        Ok(PreDefinedCurveFontId(
7312            self.model
7313                .pre_defined_curve_font_arena
7314                .push(PreDefinedCurveFont { name }),
7315        ))
7316    }
7317
7318    /// `PRE_DEFINED_ITEM` — strict AP242 constructor.
7319    pub fn add_pre_defined_item(&mut self, name: String) -> Result<PreDefinedItemId, AuthorError> {
7320        Ok(PreDefinedItemId(
7321            self.model
7322                .pre_defined_item_arena
7323                .push(PreDefinedItem { name }),
7324        ))
7325    }
7326
7327    /// `PRE_DEFINED_MARKER` — strict AP242 constructor.
7328    pub fn add_pre_defined_marker(
7329        &mut self,
7330        name: String,
7331    ) -> Result<PreDefinedMarkerId, AuthorError> {
7332        Ok(PreDefinedMarkerId(
7333            self.model
7334                .pre_defined_marker_arena
7335                .push(PreDefinedMarker { name }),
7336        ))
7337    }
7338
7339    /// `PRE_DEFINED_POINT_MARKER_SYMBOL` — strict AP242 constructor.
7340    pub fn add_pre_defined_point_marker_symbol(
7341        &mut self,
7342        name: String,
7343    ) -> Result<PreDefinedPointMarkerSymbolId, AuthorError> {
7344        Ok(PreDefinedPointMarkerSymbolId(
7345            self.model
7346                .pre_defined_point_marker_symbol_arena
7347                .push(PreDefinedPointMarkerSymbol { name }),
7348        ))
7349    }
7350
7351    /// `PRE_DEFINED_SURFACE_SIDE_STYLE` — strict AP242 constructor.
7352    pub fn add_pre_defined_surface_side_style(
7353        &mut self,
7354        name: String,
7355    ) -> Result<PreDefinedSurfaceSideStyleId, AuthorError> {
7356        Ok(PreDefinedSurfaceSideStyleId(
7357            self.model
7358                .pre_defined_surface_side_style_arena
7359                .push(PreDefinedSurfaceSideStyle { name }),
7360        ))
7361    }
7362
7363    /// `PRE_DEFINED_SYMBOL` — strict AP242 constructor.
7364    pub fn add_pre_defined_symbol(
7365        &mut self,
7366        name: String,
7367    ) -> Result<PreDefinedSymbolId, AuthorError> {
7368        Ok(PreDefinedSymbolId(
7369            self.model
7370                .pre_defined_symbol_arena
7371                .push(PreDefinedSymbol { name }),
7372        ))
7373    }
7374
7375    /// `PRE_DEFINED_TERMINATOR_SYMBOL` — strict AP242 constructor.
7376    pub fn add_pre_defined_terminator_symbol(
7377        &mut self,
7378        name: String,
7379    ) -> Result<PreDefinedTerminatorSymbolId, AuthorError> {
7380        Ok(PreDefinedTerminatorSymbolId(
7381            self.model
7382                .pre_defined_terminator_symbol_arena
7383                .push(PreDefinedTerminatorSymbol { name }),
7384        ))
7385    }
7386
7387    /// `PRE_DEFINED_TEXT_FONT` — strict AP242 constructor.
7388    pub fn add_pre_defined_text_font(
7389        &mut self,
7390        name: String,
7391    ) -> Result<PreDefinedTextFontId, AuthorError> {
7392        Ok(PreDefinedTextFontId(
7393            self.model
7394                .pre_defined_text_font_arena
7395                .push(PreDefinedTextFont { name }),
7396        ))
7397    }
7398
7399    /// `PRE_DEFINED_TILE` — strict AP242 constructor.
7400    pub fn add_pre_defined_tile(&mut self, name: String) -> Result<PreDefinedTileId, AuthorError> {
7401        Ok(PreDefinedTileId(
7402            self.model
7403                .pre_defined_tile_arena
7404                .push(PreDefinedTile { name }),
7405        ))
7406    }
7407
7408    /// `PRECISION_QUALIFIER` — strict AP242 constructor.
7409    pub fn add_precision_qualifier(
7410        &mut self,
7411        precision_value: i64,
7412    ) -> Result<PrecisionQualifierId, AuthorError> {
7413        Ok(PrecisionQualifierId(
7414            self.model
7415                .precision_qualifier_arena
7416                .push(PrecisionQualifier { precision_value }),
7417        ))
7418    }
7419
7420    /// `PRESENTATION_AREA` — strict AP242 constructor.
7421    pub fn add_presentation_area(
7422        &mut self,
7423        name: String,
7424        items: Vec<RepresentationItemRef>,
7425        context_of_items: RepresentationContextRef,
7426    ) -> Result<PresentationAreaId, AuthorError> {
7427        {
7428            let x = &items;
7429            if x.len() < 1 {
7430                return Err(AuthorError::Cardinality {
7431                    entity: "PRESENTATION_AREA",
7432                    attribute: "items",
7433                    got: x.len(),
7434                    min: 1,
7435                    max: None,
7436                });
7437            }
7438        }
7439        for e0 in &items {
7440            check_representation_item_ref(&self.model, e0)?;
7441        }
7442        check_representation_context_ref(&self.model, &context_of_items)?;
7443        Ok(PresentationAreaId(self.model.presentation_area_arena.push(
7444            PresentationArea {
7445                name,
7446                items,
7447                context_of_items,
7448            },
7449        )))
7450    }
7451
7452    /// `PRESENTATION_LAYER_ASSIGNMENT` — strict AP242 constructor.
7453    pub fn add_presentation_layer_assignment(
7454        &mut self,
7455        name: String,
7456        description: String,
7457        assigned_items: Vec<LayeredItemRef>,
7458    ) -> Result<PresentationLayerAssignmentId, AuthorError> {
7459        {
7460            let x = &assigned_items;
7461            if x.len() < 1 {
7462                return Err(AuthorError::Cardinality {
7463                    entity: "PRESENTATION_LAYER_ASSIGNMENT",
7464                    attribute: "assigned_items",
7465                    got: x.len(),
7466                    min: 1,
7467                    max: None,
7468                });
7469            }
7470        }
7471        for e0 in &assigned_items {
7472            check_layered_item_ref(&self.model, e0)?;
7473        }
7474        Ok(PresentationLayerAssignmentId(
7475            self.model
7476                .presentation_layer_assignment_arena
7477                .push(PresentationLayerAssignment {
7478                    name,
7479                    description,
7480                    assigned_items,
7481                }),
7482        ))
7483    }
7484
7485    /// `PRESENTATION_REPRESENTATION` — strict AP242 constructor.
7486    pub fn add_presentation_representation(
7487        &mut self,
7488        name: String,
7489        items: Vec<RepresentationItemRef>,
7490        context_of_items: RepresentationContextRef,
7491    ) -> Result<PresentationRepresentationId, AuthorError> {
7492        {
7493            let x = &items;
7494            if x.len() < 1 {
7495                return Err(AuthorError::Cardinality {
7496                    entity: "PRESENTATION_REPRESENTATION",
7497                    attribute: "items",
7498                    got: x.len(),
7499                    min: 1,
7500                    max: None,
7501                });
7502            }
7503        }
7504        for e0 in &items {
7505            check_representation_item_ref(&self.model, e0)?;
7506        }
7507        check_representation_context_ref(&self.model, &context_of_items)?;
7508        Ok(PresentationRepresentationId(
7509            self.model
7510                .presentation_representation_arena
7511                .push(PresentationRepresentation {
7512                    name,
7513                    items,
7514                    context_of_items,
7515                }),
7516        ))
7517    }
7518
7519    /// `PRESENTATION_SET` — strict AP242 constructor.
7520    pub fn add_presentation_set(&mut self) -> Result<PresentationSetId, AuthorError> {
7521        Ok(PresentationSetId(
7522            self.model.presentation_set_arena.push(PresentationSet {}),
7523        ))
7524    }
7525
7526    /// `PRESENTATION_SIZE` — strict AP242 constructor.
7527    pub fn add_presentation_size(
7528        &mut self,
7529        unit: PresentationSizeAssignmentSelectRef,
7530        size: PlanarBoxRef,
7531    ) -> Result<PresentationSizeId, AuthorError> {
7532        check_presentation_size_assignment_select_ref(&self.model, &unit)?;
7533        check_planar_box_ref(&self.model, &size)?;
7534        Ok(PresentationSizeId(
7535            self.model
7536                .presentation_size_arena
7537                .push(PresentationSize { unit, size }),
7538        ))
7539    }
7540
7541    /// `PRESENTATION_STYLE_ASSIGNMENT` — strict AP242 constructor.
7542    pub fn add_presentation_style_assignment(
7543        &mut self,
7544        styles: Vec<PresentationStyleSelectRef>,
7545    ) -> Result<PresentationStyleAssignmentId, AuthorError> {
7546        {
7547            let x = &styles;
7548            if x.len() < 1 {
7549                return Err(AuthorError::Cardinality {
7550                    entity: "PRESENTATION_STYLE_ASSIGNMENT",
7551                    attribute: "styles",
7552                    got: x.len(),
7553                    min: 1,
7554                    max: None,
7555                });
7556            }
7557        }
7558        for e0 in &styles {
7559            check_presentation_style_select_ref(&self.model, e0)?;
7560        }
7561        Ok(PresentationStyleAssignmentId(
7562            self.model
7563                .presentation_style_assignment_arena
7564                .push(PresentationStyleAssignment { styles }),
7565        ))
7566    }
7567
7568    /// `PRESENTATION_STYLE_BY_CONTEXT` — strict AP242 constructor.
7569    pub fn add_presentation_style_by_context(
7570        &mut self,
7571        styles: Vec<PresentationStyleSelectRef>,
7572        style_context: StyleContextSelectRef,
7573    ) -> Result<PresentationStyleByContextId, AuthorError> {
7574        {
7575            let x = &styles;
7576            if x.len() < 1 {
7577                return Err(AuthorError::Cardinality {
7578                    entity: "PRESENTATION_STYLE_BY_CONTEXT",
7579                    attribute: "styles",
7580                    got: x.len(),
7581                    min: 1,
7582                    max: None,
7583                });
7584            }
7585        }
7586        for e0 in &styles {
7587            check_presentation_style_select_ref(&self.model, e0)?;
7588        }
7589        check_style_context_select_ref(&self.model, &style_context)?;
7590        Ok(PresentationStyleByContextId(
7591            self.model
7592                .presentation_style_by_context_arena
7593                .push(PresentationStyleByContext {
7594                    styles,
7595                    style_context,
7596                }),
7597        ))
7598    }
7599
7600    /// `PRESENTATION_VIEW` — strict AP242 constructor.
7601    pub fn add_presentation_view(
7602        &mut self,
7603        name: String,
7604        items: Vec<RepresentationItemRef>,
7605        context_of_items: RepresentationContextRef,
7606    ) -> Result<PresentationViewId, AuthorError> {
7607        {
7608            let x = &items;
7609            if x.len() < 1 {
7610                return Err(AuthorError::Cardinality {
7611                    entity: "PRESENTATION_VIEW",
7612                    attribute: "items",
7613                    got: x.len(),
7614                    min: 1,
7615                    max: None,
7616                });
7617            }
7618        }
7619        for e0 in &items {
7620            check_representation_item_ref(&self.model, e0)?;
7621        }
7622        check_representation_context_ref(&self.model, &context_of_items)?;
7623        Ok(PresentationViewId(self.model.presentation_view_arena.push(
7624            PresentationView {
7625                name,
7626                items,
7627                context_of_items,
7628            },
7629        )))
7630    }
7631
7632    /// `PRESENTED_ITEM` — strict AP242 constructor.
7633    pub fn add_presented_item(&mut self) -> Result<PresentedItemId, AuthorError> {
7634        Ok(PresentedItemId(
7635            self.model.presented_item_arena.push(PresentedItem {}),
7636        ))
7637    }
7638
7639    /// `PRESENTED_ITEM_REPRESENTATION` — strict AP242 constructor.
7640    pub fn add_presented_item_representation(
7641        &mut self,
7642        presentation: PresentationRepresentationSelectRef,
7643        item: PresentedItemRef,
7644    ) -> Result<PresentedItemRepresentationId, AuthorError> {
7645        check_presentation_representation_select_ref(&self.model, &presentation)?;
7646        check_presented_item_ref(&self.model, &item)?;
7647        Ok(PresentedItemRepresentationId(
7648            self.model
7649                .presented_item_representation_arena
7650                .push(PresentedItemRepresentation { presentation, item }),
7651        ))
7652    }
7653
7654    /// `PRODUCT` — strict AP242 constructor.
7655    pub fn add_product(
7656        &mut self,
7657        id: String,
7658        name: String,
7659        description: Option<String>,
7660        frame_of_reference: Vec<ProductContextRef>,
7661    ) -> Result<ProductId, AuthorError> {
7662        {
7663            let x = &frame_of_reference;
7664            if x.len() < 1 {
7665                return Err(AuthorError::Cardinality {
7666                    entity: "PRODUCT",
7667                    attribute: "frame_of_reference",
7668                    got: x.len(),
7669                    min: 1,
7670                    max: None,
7671                });
7672            }
7673        }
7674        for e0 in &frame_of_reference {
7675            check_product_context_ref(&self.model, e0)?;
7676        }
7677        Ok(ProductId(self.model.product_arena.push(Product {
7678            id,
7679            name,
7680            description,
7681            frame_of_reference,
7682        })))
7683    }
7684
7685    /// `PRODUCT_CATEGORY` — strict AP242 constructor.
7686    pub fn add_product_category(
7687        &mut self,
7688        name: String,
7689        description: Option<String>,
7690    ) -> Result<ProductCategoryId, AuthorError> {
7691        Ok(ProductCategoryId(
7692            self.model
7693                .product_category_arena
7694                .push(ProductCategory { name, description }),
7695        ))
7696    }
7697
7698    /// `PRODUCT_CATEGORY_RELATIONSHIP` — strict AP242 constructor.
7699    pub fn add_product_category_relationship(
7700        &mut self,
7701        name: String,
7702        description: Option<String>,
7703        category: ProductCategoryRef,
7704        sub_category: ProductCategoryRef,
7705    ) -> Result<ProductCategoryRelationshipId, AuthorError> {
7706        check_product_category_ref(&self.model, &category)?;
7707        check_product_category_ref(&self.model, &sub_category)?;
7708        Ok(ProductCategoryRelationshipId(
7709            self.model
7710                .product_category_relationship_arena
7711                .push(ProductCategoryRelationship {
7712                    name,
7713                    description,
7714                    category,
7715                    sub_category,
7716                }),
7717        ))
7718    }
7719
7720    /// `PRODUCT_CONCEPT` — strict AP242 constructor.
7721    pub fn add_product_concept(
7722        &mut self,
7723        id: String,
7724        name: String,
7725        description: Option<String>,
7726        market_context: ProductConceptContextRef,
7727    ) -> Result<ProductConceptId, AuthorError> {
7728        check_product_concept_context_ref(&self.model, &market_context)?;
7729        Ok(ProductConceptId(self.model.product_concept_arena.push(
7730            ProductConcept {
7731                id,
7732                name,
7733                description,
7734                market_context,
7735            },
7736        )))
7737    }
7738
7739    /// `PRODUCT_CONCEPT_CONTEXT` — strict AP242 constructor.
7740    pub fn add_product_concept_context(
7741        &mut self,
7742        name: String,
7743        frame_of_reference: ApplicationContextRef,
7744        market_segment_type: String,
7745    ) -> Result<ProductConceptContextId, AuthorError> {
7746        check_application_context_ref(&self.model, &frame_of_reference)?;
7747        Ok(ProductConceptContextId(
7748            self.model
7749                .product_concept_context_arena
7750                .push(ProductConceptContext {
7751                    name,
7752                    frame_of_reference,
7753                    market_segment_type,
7754                }),
7755        ))
7756    }
7757
7758    /// `PRODUCT_CONCEPT_FEATURE` — strict AP242 constructor.
7759    pub fn add_product_concept_feature(
7760        &mut self,
7761        id: String,
7762        name: String,
7763        description: Option<String>,
7764    ) -> Result<ProductConceptFeatureId, AuthorError> {
7765        Ok(ProductConceptFeatureId(
7766            self.model
7767                .product_concept_feature_arena
7768                .push(ProductConceptFeature {
7769                    id,
7770                    name,
7771                    description,
7772                }),
7773        ))
7774    }
7775
7776    /// `PRODUCT_CONCEPT_FEATURE_CATEGORY` — strict AP242 constructor.
7777    pub fn add_product_concept_feature_category(
7778        &mut self,
7779        name: String,
7780        description: Option<String>,
7781    ) -> Result<ProductConceptFeatureCategoryId, AuthorError> {
7782        Ok(ProductConceptFeatureCategoryId(
7783            self.model
7784                .product_concept_feature_category_arena
7785                .push(ProductConceptFeatureCategory { name, description }),
7786        ))
7787    }
7788
7789    /// `PRODUCT_CONTEXT` — strict AP242 constructor.
7790    pub fn add_product_context(
7791        &mut self,
7792        name: String,
7793        frame_of_reference: ApplicationContextRef,
7794        discipline_type: String,
7795    ) -> Result<ProductContextId, AuthorError> {
7796        check_application_context_ref(&self.model, &frame_of_reference)?;
7797        Ok(ProductContextId(self.model.product_context_arena.push(
7798            ProductContext {
7799                name,
7800                frame_of_reference,
7801                discipline_type,
7802            },
7803        )))
7804    }
7805
7806    /// `PRODUCT_DEFINITION` — strict AP242 constructor.
7807    pub fn add_product_definition(
7808        &mut self,
7809        id: String,
7810        description: Option<String>,
7811        formation: ProductDefinitionFormationRef,
7812        frame_of_reference: ProductDefinitionContextRef,
7813    ) -> Result<ProductDefinitionId, AuthorError> {
7814        check_product_definition_formation_ref(&self.model, &formation)?;
7815        check_product_definition_context_ref(&self.model, &frame_of_reference)?;
7816        Ok(ProductDefinitionId(
7817            self.model.product_definition_arena.push(ProductDefinition {
7818                id,
7819                description,
7820                formation,
7821                frame_of_reference,
7822            }),
7823        ))
7824    }
7825
7826    /// `PRODUCT_DEFINITION_CONTEXT` — strict AP242 constructor.
7827    pub fn add_product_definition_context(
7828        &mut self,
7829        name: String,
7830        frame_of_reference: ApplicationContextRef,
7831        life_cycle_stage: String,
7832    ) -> Result<ProductDefinitionContextId, AuthorError> {
7833        check_application_context_ref(&self.model, &frame_of_reference)?;
7834        Ok(ProductDefinitionContextId(
7835            self.model
7836                .product_definition_context_arena
7837                .push(ProductDefinitionContext {
7838                    name,
7839                    frame_of_reference,
7840                    life_cycle_stage,
7841                }),
7842        ))
7843    }
7844
7845    /// `PRODUCT_DEFINITION_CONTEXT_ASSOCIATION` — strict AP242 constructor.
7846    pub fn add_product_definition_context_association(
7847        &mut self,
7848        definition: ProductDefinitionRef,
7849        frame_of_reference: ProductDefinitionContextRef,
7850        role: ProductDefinitionContextRoleRef,
7851    ) -> Result<ProductDefinitionContextAssociationId, AuthorError> {
7852        check_product_definition_ref(&self.model, &definition)?;
7853        check_product_definition_context_ref(&self.model, &frame_of_reference)?;
7854        check_product_definition_context_role_ref(&self.model, &role)?;
7855        Ok(ProductDefinitionContextAssociationId(
7856            self.model
7857                .product_definition_context_association_arena
7858                .push(ProductDefinitionContextAssociation {
7859                    definition,
7860                    frame_of_reference,
7861                    role,
7862                }),
7863        ))
7864    }
7865
7866    /// `PRODUCT_DEFINITION_CONTEXT_ROLE` — strict AP242 constructor.
7867    pub fn add_product_definition_context_role(
7868        &mut self,
7869        name: String,
7870        description: Option<String>,
7871    ) -> Result<ProductDefinitionContextRoleId, AuthorError> {
7872        Ok(ProductDefinitionContextRoleId(
7873            self.model
7874                .product_definition_context_role_arena
7875                .push(ProductDefinitionContextRole { name, description }),
7876        ))
7877    }
7878
7879    /// `PRODUCT_DEFINITION_EFFECTIVITY` — strict AP242 constructor.
7880    pub fn add_product_definition_effectivity(
7881        &mut self,
7882        id: String,
7883        usage: ProductDefinitionRelationshipRef,
7884    ) -> Result<ProductDefinitionEffectivityId, AuthorError> {
7885        check_product_definition_relationship_ref(&self.model, &usage)?;
7886        Ok(ProductDefinitionEffectivityId(
7887            self.model
7888                .product_definition_effectivity_arena
7889                .push(ProductDefinitionEffectivity { id, usage }),
7890        ))
7891    }
7892
7893    /// `PRODUCT_DEFINITION_FORMATION` — strict AP242 constructor.
7894    pub fn add_product_definition_formation(
7895        &mut self,
7896        id: String,
7897        description: Option<String>,
7898        of_product: ProductRef,
7899    ) -> Result<ProductDefinitionFormationId, AuthorError> {
7900        check_product_ref(&self.model, &of_product)?;
7901        Ok(ProductDefinitionFormationId(
7902            self.model
7903                .product_definition_formation_arena
7904                .push(ProductDefinitionFormation {
7905                    id,
7906                    description,
7907                    of_product,
7908                }),
7909        ))
7910    }
7911
7912    /// `PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE` — strict AP242 constructor.
7913    pub fn add_product_definition_formation_with_specified_source(
7914        &mut self,
7915        id: String,
7916        description: Option<String>,
7917        of_product: ProductRef,
7918        make_or_buy: Source,
7919    ) -> Result<ProductDefinitionFormationWithSpecifiedSourceId, AuthorError> {
7920        check_product_ref(&self.model, &of_product)?;
7921        Ok(ProductDefinitionFormationWithSpecifiedSourceId(
7922            self.model
7923                .product_definition_formation_with_specified_source_arena
7924                .push(ProductDefinitionFormationWithSpecifiedSource {
7925                    id,
7926                    description,
7927                    of_product,
7928                    make_or_buy,
7929                }),
7930        ))
7931    }
7932
7933    /// `PRODUCT_DEFINITION_OCCURRENCE` — strict AP242 constructor.
7934    pub fn add_product_definition_occurrence(
7935        &mut self,
7936        id: String,
7937        name: Option<String>,
7938        description: Option<String>,
7939        definition: Option<ProductDefinitionOrReferenceRef>,
7940        quantity: Option<MeasureWithUnitRef>,
7941    ) -> Result<ProductDefinitionOccurrenceId, AuthorError> {
7942        if let Some(x) = &definition {
7943            check_product_definition_or_reference_ref(&self.model, x)?;
7944        }
7945        if let Some(x) = &quantity {
7946            check_measure_with_unit_ref(&self.model, x)?;
7947        }
7948        Ok(ProductDefinitionOccurrenceId(
7949            self.model
7950                .product_definition_occurrence_arena
7951                .push(ProductDefinitionOccurrence {
7952                    id,
7953                    name,
7954                    description,
7955                    definition,
7956                    quantity,
7957                }),
7958        ))
7959    }
7960
7961    /// `PRODUCT_DEFINITION_RELATIONSHIP` — strict AP242 constructor.
7962    pub fn add_product_definition_relationship(
7963        &mut self,
7964        id: String,
7965        name: String,
7966        description: Option<String>,
7967        relating_product_definition: ProductDefinitionOrReferenceRef,
7968        related_product_definition: ProductDefinitionOrReferenceRef,
7969    ) -> Result<ProductDefinitionRelationshipId, AuthorError> {
7970        check_product_definition_or_reference_ref(&self.model, &relating_product_definition)?;
7971        check_product_definition_or_reference_ref(&self.model, &related_product_definition)?;
7972        Ok(ProductDefinitionRelationshipId(
7973            self.model
7974                .product_definition_relationship_arena
7975                .push(ProductDefinitionRelationship {
7976                    id,
7977                    name,
7978                    description,
7979                    relating_product_definition,
7980                    related_product_definition,
7981                }),
7982        ))
7983    }
7984
7985    /// `PRODUCT_DEFINITION_RELATIONSHIP_RELATIONSHIP` — strict AP242 constructor.
7986    pub fn add_product_definition_relationship_relationship(
7987        &mut self,
7988        id: String,
7989        name: String,
7990        description: Option<String>,
7991        relating: ProductDefinitionRelationshipRef,
7992        related: ProductDefinitionRelationshipRef,
7993    ) -> Result<ProductDefinitionRelationshipRelationshipId, AuthorError> {
7994        check_product_definition_relationship_ref(&self.model, &relating)?;
7995        check_product_definition_relationship_ref(&self.model, &related)?;
7996        Ok(ProductDefinitionRelationshipRelationshipId(
7997            self.model
7998                .product_definition_relationship_relationship_arena
7999                .push(ProductDefinitionRelationshipRelationship {
8000                    id,
8001                    name,
8002                    description,
8003                    relating,
8004                    related,
8005                }),
8006        ))
8007    }
8008
8009    /// `PRODUCT_DEFINITION_SHAPE` — strict AP242 constructor.
8010    pub fn add_product_definition_shape(
8011        &mut self,
8012        name: String,
8013        description: Option<String>,
8014        definition: CharacterizedDefinitionRef,
8015    ) -> Result<ProductDefinitionShapeId, AuthorError> {
8016        check_characterized_definition_ref(&self.model, &definition)?;
8017        Ok(ProductDefinitionShapeId(
8018            self.model
8019                .product_definition_shape_arena
8020                .push(ProductDefinitionShape {
8021                    name,
8022                    description,
8023                    definition,
8024                }),
8025        ))
8026    }
8027
8028    /// `PRODUCT_DEFINITION_SUBSTITUTE` — strict AP242 constructor.
8029    pub fn add_product_definition_substitute(
8030        &mut self,
8031        description: Option<String>,
8032        context_relationship: ProductDefinitionRelationshipRef,
8033        substitute_definition: ProductDefinitionRef,
8034    ) -> Result<ProductDefinitionSubstituteId, AuthorError> {
8035        check_product_definition_relationship_ref(&self.model, &context_relationship)?;
8036        check_product_definition_ref(&self.model, &substitute_definition)?;
8037        Ok(ProductDefinitionSubstituteId(
8038            self.model
8039                .product_definition_substitute_arena
8040                .push(ProductDefinitionSubstitute {
8041                    description,
8042                    context_relationship,
8043                    substitute_definition,
8044                }),
8045        ))
8046    }
8047
8048    /// `PRODUCT_DEFINITION_USAGE` — strict AP242 constructor.
8049    pub fn add_product_definition_usage(
8050        &mut self,
8051        id: String,
8052        name: String,
8053        description: Option<String>,
8054        relating_product_definition: ProductDefinitionOrReferenceRef,
8055        related_product_definition: ProductDefinitionOrReferenceRef,
8056    ) -> Result<ProductDefinitionUsageId, AuthorError> {
8057        check_product_definition_or_reference_ref(&self.model, &relating_product_definition)?;
8058        check_product_definition_or_reference_ref(&self.model, &related_product_definition)?;
8059        Ok(ProductDefinitionUsageId(
8060            self.model
8061                .product_definition_usage_arena
8062                .push(ProductDefinitionUsage {
8063                    id,
8064                    name,
8065                    description,
8066                    relating_product_definition,
8067                    related_product_definition,
8068                }),
8069        ))
8070    }
8071
8072    /// `PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS` — strict AP242 constructor.
8073    pub fn add_product_definition_with_associated_documents(
8074        &mut self,
8075        id: String,
8076        description: Option<String>,
8077        formation: ProductDefinitionFormationRef,
8078        frame_of_reference: ProductDefinitionContextRef,
8079        documentation_ids: Vec<DocumentRef>,
8080    ) -> Result<ProductDefinitionWithAssociatedDocumentsId, AuthorError> {
8081        check_product_definition_formation_ref(&self.model, &formation)?;
8082        check_product_definition_context_ref(&self.model, &frame_of_reference)?;
8083        {
8084            let x = &documentation_ids;
8085            if x.len() < 1 {
8086                return Err(AuthorError::Cardinality {
8087                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
8088                    attribute: "documentation_ids",
8089                    got: x.len(),
8090                    min: 1,
8091                    max: None,
8092                });
8093            }
8094        }
8095        for e0 in &documentation_ids {
8096            check_document_ref(&self.model, e0)?;
8097        }
8098        Ok(ProductDefinitionWithAssociatedDocumentsId(
8099            self.model
8100                .product_definition_with_associated_documents_arena
8101                .push(ProductDefinitionWithAssociatedDocuments {
8102                    id,
8103                    description,
8104                    formation,
8105                    frame_of_reference,
8106                    documentation_ids,
8107                }),
8108        ))
8109    }
8110
8111    /// `PRODUCT_RELATED_PRODUCT_CATEGORY` — strict AP242 constructor.
8112    pub fn add_product_related_product_category(
8113        &mut self,
8114        name: String,
8115        description: Option<String>,
8116        products: Vec<ProductRef>,
8117    ) -> Result<ProductRelatedProductCategoryId, AuthorError> {
8118        {
8119            let x = &products;
8120            if x.len() < 1 {
8121                return Err(AuthorError::Cardinality {
8122                    entity: "PRODUCT_RELATED_PRODUCT_CATEGORY",
8123                    attribute: "products",
8124                    got: x.len(),
8125                    min: 1,
8126                    max: None,
8127                });
8128            }
8129        }
8130        for e0 in &products {
8131            check_product_ref(&self.model, e0)?;
8132        }
8133        Ok(ProductRelatedProductCategoryId(
8134            self.model
8135                .product_related_product_category_arena
8136                .push(ProductRelatedProductCategory {
8137                    name,
8138                    description,
8139                    products,
8140                }),
8141        ))
8142    }
8143
8144    /// `PROJECTED_ZONE_DEFINITION` — strict AP242 constructor.
8145    pub fn add_projected_zone_definition(
8146        &mut self,
8147        zone: ToleranceZoneRef,
8148        boundaries: Vec<ShapeAspectRef>,
8149        projection_end: ShapeAspectRef,
8150        projected_length: LengthMeasureWithUnitRef,
8151    ) -> Result<ProjectedZoneDefinitionId, AuthorError> {
8152        check_tolerance_zone_ref(&self.model, &zone)?;
8153        for e0 in &boundaries {
8154            check_shape_aspect_ref(&self.model, e0)?;
8155        }
8156        check_shape_aspect_ref(&self.model, &projection_end)?;
8157        check_length_measure_with_unit_ref(&self.model, &projected_length)?;
8158        Ok(ProjectedZoneDefinitionId(
8159            self.model
8160                .projected_zone_definition_arena
8161                .push(ProjectedZoneDefinition {
8162                    zone,
8163                    boundaries,
8164                    projection_end,
8165                    projected_length,
8166                }),
8167        ))
8168    }
8169
8170    /// `PROPERTY_DEFINITION` — strict AP242 constructor.
8171    pub fn add_property_definition(
8172        &mut self,
8173        name: String,
8174        description: Option<String>,
8175        definition: CharacterizedDefinitionRef,
8176    ) -> Result<PropertyDefinitionId, AuthorError> {
8177        check_characterized_definition_ref(&self.model, &definition)?;
8178        Ok(PropertyDefinitionId(
8179            self.model
8180                .property_definition_arena
8181                .push(PropertyDefinition {
8182                    name,
8183                    description,
8184                    definition,
8185                }),
8186        ))
8187    }
8188
8189    /// `PROPERTY_DEFINITION_RELATIONSHIP` — strict AP242 constructor.
8190    pub fn add_property_definition_relationship(
8191        &mut self,
8192        name: String,
8193        description: String,
8194        relating_property_definition: PropertyDefinitionRef,
8195        related_property_definition: PropertyDefinitionRef,
8196    ) -> Result<PropertyDefinitionRelationshipId, AuthorError> {
8197        check_property_definition_ref(&self.model, &relating_property_definition)?;
8198        check_property_definition_ref(&self.model, &related_property_definition)?;
8199        Ok(PropertyDefinitionRelationshipId(
8200            self.model.property_definition_relationship_arena.push(
8201                PropertyDefinitionRelationship {
8202                    name,
8203                    description,
8204                    relating_property_definition,
8205                    related_property_definition,
8206                },
8207            ),
8208        ))
8209    }
8210
8211    /// `PROPERTY_DEFINITION_REPRESENTATION` — strict AP242 constructor.
8212    pub fn add_property_definition_representation(
8213        &mut self,
8214        definition: RepresentedDefinitionRef,
8215        used_representation: RepresentationRef,
8216    ) -> Result<PropertyDefinitionRepresentationId, AuthorError> {
8217        check_represented_definition_ref(&self.model, &definition)?;
8218        check_representation_ref(&self.model, &used_representation)?;
8219        Ok(PropertyDefinitionRepresentationId(
8220            self.model.property_definition_representation_arena.push(
8221                PropertyDefinitionRepresentation {
8222                    definition,
8223                    used_representation,
8224                },
8225            ),
8226        ))
8227    }
8228
8229    /// `QUALIFIED_REPRESENTATION_ITEM` — strict AP242 constructor.
8230    pub fn add_qualified_representation_item(
8231        &mut self,
8232        name: String,
8233        qualifiers: Vec<ValueQualifierRef>,
8234    ) -> Result<QualifiedRepresentationItemId, AuthorError> {
8235        {
8236            let x = &qualifiers;
8237            if x.len() < 1 {
8238                return Err(AuthorError::Cardinality {
8239                    entity: "QUALIFIED_REPRESENTATION_ITEM",
8240                    attribute: "qualifiers",
8241                    got: x.len(),
8242                    min: 1,
8243                    max: None,
8244                });
8245            }
8246        }
8247        for e0 in &qualifiers {
8248            check_value_qualifier_ref(&self.model, e0)?;
8249        }
8250        Ok(QualifiedRepresentationItemId(
8251            self.model
8252                .qualified_representation_item_arena
8253                .push(QualifiedRepresentationItem { name, qualifiers }),
8254        ))
8255    }
8256
8257    /// `QUASI_UNIFORM_CURVE` — strict AP242 constructor.
8258    pub fn add_quasi_uniform_curve(
8259        &mut self,
8260        name: String,
8261        degree: i64,
8262        control_points_list: Vec<CartesianPointRef>,
8263        curve_form: BSplineCurveForm,
8264        closed_curve: Logical,
8265        self_intersect: Logical,
8266    ) -> Result<QuasiUniformCurveId, AuthorError> {
8267        {
8268            let x = &control_points_list;
8269            if x.len() < 2 {
8270                return Err(AuthorError::Cardinality {
8271                    entity: "QUASI_UNIFORM_CURVE",
8272                    attribute: "control_points_list",
8273                    got: x.len(),
8274                    min: 2,
8275                    max: None,
8276                });
8277            }
8278        }
8279        for e0 in &control_points_list {
8280            check_cartesian_point_ref(&self.model, e0)?;
8281        }
8282        Ok(QuasiUniformCurveId(
8283            self.model
8284                .quasi_uniform_curve_arena
8285                .push(QuasiUniformCurve {
8286                    name,
8287                    degree,
8288                    control_points_list,
8289                    curve_form,
8290                    closed_curve,
8291                    self_intersect,
8292                }),
8293        ))
8294    }
8295
8296    /// `QUASI_UNIFORM_SURFACE` — strict AP242 constructor.
8297    pub fn add_quasi_uniform_surface(
8298        &mut self,
8299        name: String,
8300        u_degree: i64,
8301        v_degree: i64,
8302        control_points_list: Vec<Vec<CartesianPointRef>>,
8303        surface_form: BSplineSurfaceForm,
8304        u_closed: Logical,
8305        v_closed: Logical,
8306        self_intersect: Logical,
8307    ) -> Result<QuasiUniformSurfaceId, AuthorError> {
8308        {
8309            let x = &control_points_list;
8310            if x.len() < 2 {
8311                return Err(AuthorError::Cardinality {
8312                    entity: "QUASI_UNIFORM_SURFACE",
8313                    attribute: "control_points_list",
8314                    got: x.len(),
8315                    min: 2,
8316                    max: None,
8317                });
8318            }
8319        }
8320        for e0 in &control_points_list {
8321            for e1 in e0 {
8322                check_cartesian_point_ref(&self.model, e1)?;
8323            }
8324        }
8325        Ok(QuasiUniformSurfaceId(
8326            self.model
8327                .quasi_uniform_surface_arena
8328                .push(QuasiUniformSurface {
8329                    name,
8330                    u_degree,
8331                    v_degree,
8332                    control_points_list,
8333                    surface_form,
8334                    u_closed,
8335                    v_closed,
8336                    self_intersect,
8337                }),
8338        ))
8339    }
8340
8341    /// `RATIO_MEASURE_WITH_UNIT` — strict AP242 constructor.
8342    pub fn add_ratio_measure_with_unit(
8343        &mut self,
8344        value_component: MeasureValue,
8345        unit_component: UnitRef,
8346    ) -> Result<RatioMeasureWithUnitId, AuthorError> {
8347        check_unit_ref(&self.model, &unit_component)?;
8348        Ok(RatioMeasureWithUnitId(
8349            self.model
8350                .ratio_measure_with_unit_arena
8351                .push(RatioMeasureWithUnit {
8352                    value_component,
8353                    unit_component,
8354                }),
8355        ))
8356    }
8357
8358    /// `RATIO_UNIT` — strict AP242 constructor.
8359    pub fn add_ratio_unit(
8360        &mut self,
8361        dimensions: DimensionalExponentsRef,
8362    ) -> Result<RatioUnitId, AuthorError> {
8363        check_dimensional_exponents_ref(&self.model, &dimensions)?;
8364        Ok(RatioUnitId(
8365            self.model.ratio_unit_arena.push(RatioUnit { dimensions }),
8366        ))
8367    }
8368
8369    /// `RATIONAL_B_SPLINE_CURVE` — strict AP242 constructor.
8370    pub fn add_rational_b_spline_curve(
8371        &mut self,
8372        name: String,
8373        degree: i64,
8374        control_points_list: Vec<CartesianPointRef>,
8375        curve_form: BSplineCurveForm,
8376        closed_curve: Logical,
8377        self_intersect: Logical,
8378        weights_data: Vec<f64>,
8379    ) -> Result<RationalBSplineCurveId, AuthorError> {
8380        {
8381            let x = &control_points_list;
8382            if x.len() < 2 {
8383                return Err(AuthorError::Cardinality {
8384                    entity: "RATIONAL_B_SPLINE_CURVE",
8385                    attribute: "control_points_list",
8386                    got: x.len(),
8387                    min: 2,
8388                    max: None,
8389                });
8390            }
8391        }
8392        for e0 in &control_points_list {
8393            check_cartesian_point_ref(&self.model, e0)?;
8394        }
8395        {
8396            let x = &weights_data;
8397            if x.len() < 2 {
8398                return Err(AuthorError::Cardinality {
8399                    entity: "RATIONAL_B_SPLINE_CURVE",
8400                    attribute: "weights_data",
8401                    got: x.len(),
8402                    min: 2,
8403                    max: None,
8404                });
8405            }
8406        }
8407        Ok(RationalBSplineCurveId(
8408            self.model
8409                .rational_b_spline_curve_arena
8410                .push(RationalBSplineCurve {
8411                    name,
8412                    degree,
8413                    control_points_list,
8414                    curve_form,
8415                    closed_curve,
8416                    self_intersect,
8417                    weights_data,
8418                }),
8419        ))
8420    }
8421
8422    /// `RATIONAL_B_SPLINE_SURFACE` — strict AP242 constructor.
8423    pub fn add_rational_b_spline_surface(
8424        &mut self,
8425        name: String,
8426        u_degree: i64,
8427        v_degree: i64,
8428        control_points_list: Vec<Vec<CartesianPointRef>>,
8429        surface_form: BSplineSurfaceForm,
8430        u_closed: Logical,
8431        v_closed: Logical,
8432        self_intersect: Logical,
8433        weights_data: Vec<Vec<f64>>,
8434    ) -> Result<RationalBSplineSurfaceId, AuthorError> {
8435        {
8436            let x = &control_points_list;
8437            if x.len() < 2 {
8438                return Err(AuthorError::Cardinality {
8439                    entity: "RATIONAL_B_SPLINE_SURFACE",
8440                    attribute: "control_points_list",
8441                    got: x.len(),
8442                    min: 2,
8443                    max: None,
8444                });
8445            }
8446        }
8447        for e0 in &control_points_list {
8448            for e1 in e0 {
8449                check_cartesian_point_ref(&self.model, e1)?;
8450            }
8451        }
8452        {
8453            let x = &weights_data;
8454            if x.len() < 2 {
8455                return Err(AuthorError::Cardinality {
8456                    entity: "RATIONAL_B_SPLINE_SURFACE",
8457                    attribute: "weights_data",
8458                    got: x.len(),
8459                    min: 2,
8460                    max: None,
8461                });
8462            }
8463        }
8464        Ok(RationalBSplineSurfaceId(
8465            self.model
8466                .rational_b_spline_surface_arena
8467                .push(RationalBSplineSurface {
8468                    name,
8469                    u_degree,
8470                    v_degree,
8471                    control_points_list,
8472                    surface_form,
8473                    u_closed,
8474                    v_closed,
8475                    self_intersect,
8476                    weights_data,
8477                }),
8478        ))
8479    }
8480
8481    /// `REAL_LITERAL` — strict AP242 constructor.
8482    pub fn add_real_literal(&mut self, the_value: f64) -> Result<RealLiteralId, AuthorError> {
8483        Ok(RealLiteralId(
8484            self.model
8485                .real_literal_arena
8486                .push(RealLiteral { the_value }),
8487        ))
8488    }
8489
8490    /// `REAL_REPRESENTATION_ITEM` — strict AP242 constructor.
8491    pub fn add_real_representation_item(
8492        &mut self,
8493        name: String,
8494        the_value: f64,
8495    ) -> Result<RealRepresentationItemId, AuthorError> {
8496        Ok(RealRepresentationItemId(
8497            self.model
8498                .real_representation_item_arena
8499                .push(RealRepresentationItem { name, the_value }),
8500        ))
8501    }
8502
8503    /// `REPOSITIONED_TESSELLATED_ITEM` — strict AP242 constructor.
8504    pub fn add_repositioned_tessellated_item(
8505        &mut self,
8506        name: String,
8507        location: Axis2Placement3dRef,
8508    ) -> Result<RepositionedTessellatedItemId, AuthorError> {
8509        check_axis2_placement3d_ref(&self.model, &location)?;
8510        Ok(RepositionedTessellatedItemId(
8511            self.model
8512                .repositioned_tessellated_item_arena
8513                .push(RepositionedTessellatedItem { name, location }),
8514        ))
8515    }
8516
8517    /// `REPRESENTATION` — strict AP242 constructor.
8518    pub fn add_representation(
8519        &mut self,
8520        name: String,
8521        items: Vec<RepresentationItemRef>,
8522        context_of_items: RepresentationContextRef,
8523    ) -> Result<RepresentationId, AuthorError> {
8524        {
8525            let x = &items;
8526            if x.len() < 1 {
8527                return Err(AuthorError::Cardinality {
8528                    entity: "REPRESENTATION",
8529                    attribute: "items",
8530                    got: x.len(),
8531                    min: 1,
8532                    max: None,
8533                });
8534            }
8535        }
8536        for e0 in &items {
8537            check_representation_item_ref(&self.model, e0)?;
8538        }
8539        check_representation_context_ref(&self.model, &context_of_items)?;
8540        Ok(RepresentationId(self.model.representation_arena.push(
8541            Representation {
8542                name,
8543                items,
8544                context_of_items,
8545            },
8546        )))
8547    }
8548
8549    /// `REPRESENTATION_CONTEXT` — strict AP242 constructor.
8550    pub fn add_representation_context(
8551        &mut self,
8552        context_identifier: String,
8553        context_type: String,
8554    ) -> Result<RepresentationContextId, AuthorError> {
8555        Ok(RepresentationContextId(
8556            self.model
8557                .representation_context_arena
8558                .push(RepresentationContext {
8559                    context_identifier,
8560                    context_type,
8561                }),
8562        ))
8563    }
8564
8565    /// `REPRESENTATION_CONTEXT_REFERENCE` — strict AP242 constructor.
8566    pub fn add_representation_context_reference(
8567        &mut self,
8568        context_identifier: String,
8569    ) -> Result<RepresentationContextReferenceId, AuthorError> {
8570        Ok(RepresentationContextReferenceId(
8571            self.model
8572                .representation_context_reference_arena
8573                .push(RepresentationContextReference { context_identifier }),
8574        ))
8575    }
8576
8577    /// `REPRESENTATION_ITEM` — strict AP242 constructor.
8578    pub fn add_representation_item(
8579        &mut self,
8580        name: String,
8581    ) -> Result<RepresentationItemId, AuthorError> {
8582        Ok(RepresentationItemId(
8583            self.model
8584                .representation_item_arena
8585                .push(RepresentationItem { name }),
8586        ))
8587    }
8588
8589    /// `REPRESENTATION_MAP` — strict AP242 constructor.
8590    pub fn add_representation_map(
8591        &mut self,
8592        mapping_origin: RepresentationItemRef,
8593        mapped_representation: RepresentationRef,
8594    ) -> Result<RepresentationMapId, AuthorError> {
8595        check_representation_item_ref(&self.model, &mapping_origin)?;
8596        check_representation_ref(&self.model, &mapped_representation)?;
8597        Ok(RepresentationMapId(
8598            self.model.representation_map_arena.push(RepresentationMap {
8599                mapping_origin,
8600                mapped_representation,
8601            }),
8602        ))
8603    }
8604
8605    /// `REPRESENTATION_REFERENCE` — strict AP242 constructor.
8606    pub fn add_representation_reference(
8607        &mut self,
8608        id: String,
8609        context_of_items: RepresentationContextReferenceRef,
8610    ) -> Result<RepresentationReferenceId, AuthorError> {
8611        check_representation_context_reference_ref(&self.model, &context_of_items)?;
8612        Ok(RepresentationReferenceId(
8613            self.model
8614                .representation_reference_arena
8615                .push(RepresentationReference {
8616                    id,
8617                    context_of_items,
8618                }),
8619        ))
8620    }
8621
8622    /// `REPRESENTATION_RELATIONSHIP` — strict AP242 constructor.
8623    pub fn add_representation_relationship(
8624        &mut self,
8625        name: String,
8626        description: Option<String>,
8627        rep_1: RepresentationOrRepresentationReferenceRef,
8628        rep_2: RepresentationOrRepresentationReferenceRef,
8629    ) -> Result<RepresentationRelationshipId, AuthorError> {
8630        check_representation_or_representation_reference_ref(&self.model, &rep_1)?;
8631        check_representation_or_representation_reference_ref(&self.model, &rep_2)?;
8632        Ok(RepresentationRelationshipId(
8633            self.model
8634                .representation_relationship_arena
8635                .push(RepresentationRelationship {
8636                    name,
8637                    description,
8638                    rep_1,
8639                    rep_2,
8640                }),
8641        ))
8642    }
8643
8644    /// `REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION` — strict AP242 constructor.
8645    pub fn add_representation_relationship_with_transformation(
8646        &mut self,
8647        name: String,
8648        description: Option<String>,
8649        rep_1: RepresentationOrRepresentationReferenceRef,
8650        rep_2: RepresentationOrRepresentationReferenceRef,
8651        transformation_operator: TransformationRef,
8652    ) -> Result<RepresentationRelationshipWithTransformationId, AuthorError> {
8653        check_representation_or_representation_reference_ref(&self.model, &rep_1)?;
8654        check_representation_or_representation_reference_ref(&self.model, &rep_2)?;
8655        check_transformation_ref(&self.model, &transformation_operator)?;
8656        Ok(RepresentationRelationshipWithTransformationId(
8657            self.model
8658                .representation_relationship_with_transformation_arena
8659                .push(RepresentationRelationshipWithTransformation {
8660                    name,
8661                    description,
8662                    rep_1,
8663                    rep_2,
8664                    transformation_operator,
8665                }),
8666        ))
8667    }
8668
8669    /// `RESOURCE_PROPERTY` — strict AP242 constructor.
8670    pub fn add_resource_property(
8671        &mut self,
8672        name: String,
8673        description: String,
8674        resource: CharacterizedResourceDefinitionRef,
8675    ) -> Result<ResourcePropertyId, AuthorError> {
8676        check_characterized_resource_definition_ref(&self.model, &resource)?;
8677        Ok(ResourcePropertyId(self.model.resource_property_arena.push(
8678            ResourceProperty {
8679                name,
8680                description,
8681                resource,
8682            },
8683        )))
8684    }
8685
8686    /// `RESOURCE_REQUIREMENT_TYPE` — strict AP242 constructor.
8687    pub fn add_resource_requirement_type(
8688        &mut self,
8689        name: String,
8690        description: String,
8691    ) -> Result<ResourceRequirementTypeId, AuthorError> {
8692        Ok(ResourceRequirementTypeId(
8693            self.model
8694                .resource_requirement_type_arena
8695                .push(ResourceRequirementType { name, description }),
8696        ))
8697    }
8698
8699    /// `ROLE_ASSOCIATION` — strict AP242 constructor.
8700    pub fn add_role_association(
8701        &mut self,
8702        role: ObjectRoleRef,
8703        item_with_role: RoleSelectRef,
8704    ) -> Result<RoleAssociationId, AuthorError> {
8705        check_object_role_ref(&self.model, &role)?;
8706        check_role_select_ref(&self.model, &item_with_role)?;
8707        Ok(RoleAssociationId(self.model.role_association_arena.push(
8708            RoleAssociation {
8709                role,
8710                item_with_role,
8711            },
8712        )))
8713    }
8714
8715    /// `ROUNDNESS_TOLERANCE` — strict AP242 constructor.
8716    pub fn add_roundness_tolerance(
8717        &mut self,
8718        name: String,
8719        description: Option<String>,
8720        magnitude: Option<LengthMeasureWithUnitRef>,
8721        toleranced_shape_aspect: GeometricToleranceTargetRef,
8722    ) -> Result<RoundnessToleranceId, AuthorError> {
8723        if let Some(x) = &magnitude {
8724            check_length_measure_with_unit_ref(&self.model, x)?;
8725        }
8726        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
8727        Ok(RoundnessToleranceId(
8728            self.model
8729                .roundness_tolerance_arena
8730                .push(RoundnessTolerance {
8731                    name,
8732                    description,
8733                    magnitude,
8734                    toleranced_shape_aspect,
8735                }),
8736        ))
8737    }
8738
8739    /// `SEAM_CURVE` — strict AP242 constructor.
8740    pub fn add_seam_curve(
8741        &mut self,
8742        name: String,
8743        curve_3d: CurveRef,
8744        associated_geometry: Vec<PcurveOrSurfaceRef>,
8745        master_representation: PreferredSurfaceCurveRepresentation,
8746    ) -> Result<SeamCurveId, AuthorError> {
8747        check_curve_ref(&self.model, &curve_3d)?;
8748        {
8749            let x = &associated_geometry;
8750            if x.len() < 1 || x.len() > 2 {
8751                return Err(AuthorError::Cardinality {
8752                    entity: "SEAM_CURVE",
8753                    attribute: "associated_geometry",
8754                    got: x.len(),
8755                    min: 1,
8756                    max: Some(2),
8757                });
8758            }
8759        }
8760        for e0 in &associated_geometry {
8761            check_pcurve_or_surface_ref(&self.model, e0)?;
8762        }
8763        Ok(SeamCurveId(self.model.seam_curve_arena.push(SeamCurve {
8764            name,
8765            curve_3d,
8766            associated_geometry,
8767            master_representation,
8768        })))
8769    }
8770
8771    /// `SECURITY_CLASSIFICATION` — strict AP242 constructor.
8772    pub fn add_security_classification(
8773        &mut self,
8774        name: String,
8775        purpose: String,
8776        security_level: SecurityClassificationLevelRef,
8777    ) -> Result<SecurityClassificationId, AuthorError> {
8778        check_security_classification_level_ref(&self.model, &security_level)?;
8779        Ok(SecurityClassificationId(
8780            self.model
8781                .security_classification_arena
8782                .push(SecurityClassification {
8783                    name,
8784                    purpose,
8785                    security_level,
8786                }),
8787        ))
8788    }
8789
8790    /// `SECURITY_CLASSIFICATION_ASSIGNMENT` — strict AP242 constructor.
8791    pub fn add_security_classification_assignment(
8792        &mut self,
8793        assigned_security_classification: SecurityClassificationRef,
8794    ) -> Result<SecurityClassificationAssignmentId, AuthorError> {
8795        check_security_classification_ref(&self.model, &assigned_security_classification)?;
8796        Ok(SecurityClassificationAssignmentId(
8797            self.model.security_classification_assignment_arena.push(
8798                SecurityClassificationAssignment {
8799                    assigned_security_classification,
8800                },
8801            ),
8802        ))
8803    }
8804
8805    /// `SECURITY_CLASSIFICATION_LEVEL` — strict AP242 constructor.
8806    pub fn add_security_classification_level(
8807        &mut self,
8808        name: String,
8809    ) -> Result<SecurityClassificationLevelId, AuthorError> {
8810        Ok(SecurityClassificationLevelId(
8811            self.model
8812                .security_classification_level_arena
8813                .push(SecurityClassificationLevel { name }),
8814        ))
8815    }
8816
8817    /// `SHAPE_ASPECT` — strict AP242 constructor.
8818    pub fn add_shape_aspect(
8819        &mut self,
8820        name: String,
8821        description: Option<String>,
8822        of_shape: ProductDefinitionShapeRef,
8823        product_definitional: Option<Logical>,
8824    ) -> Result<ShapeAspectId, AuthorError> {
8825        check_product_definition_shape_ref(&self.model, &of_shape)?;
8826        Ok(ShapeAspectId(self.model.shape_aspect_arena.push(
8827            ShapeAspect {
8828                name,
8829                description,
8830                of_shape,
8831                product_definitional,
8832            },
8833        )))
8834    }
8835
8836    /// `SHAPE_ASPECT_ASSOCIATIVITY` — strict AP242 constructor.
8837    pub fn add_shape_aspect_associativity(
8838        &mut self,
8839        name: String,
8840        description: Option<String>,
8841        relating_shape_aspect: ShapeAspectRef,
8842        related_shape_aspect: ShapeAspectRef,
8843    ) -> Result<ShapeAspectAssociativityId, AuthorError> {
8844        check_shape_aspect_ref(&self.model, &relating_shape_aspect)?;
8845        check_shape_aspect_ref(&self.model, &related_shape_aspect)?;
8846        Ok(ShapeAspectAssociativityId(
8847            self.model
8848                .shape_aspect_associativity_arena
8849                .push(ShapeAspectAssociativity {
8850                    name,
8851                    description,
8852                    relating_shape_aspect,
8853                    related_shape_aspect,
8854                }),
8855        ))
8856    }
8857
8858    /// `SHAPE_ASPECT_DERIVING_RELATIONSHIP` — strict AP242 constructor.
8859    pub fn add_shape_aspect_deriving_relationship(
8860        &mut self,
8861        name: String,
8862        description: Option<String>,
8863        relating_shape_aspect: ShapeAspectRef,
8864        related_shape_aspect: ShapeAspectRef,
8865    ) -> Result<ShapeAspectDerivingRelationshipId, AuthorError> {
8866        check_shape_aspect_ref(&self.model, &relating_shape_aspect)?;
8867        check_shape_aspect_ref(&self.model, &related_shape_aspect)?;
8868        Ok(ShapeAspectDerivingRelationshipId(
8869            self.model.shape_aspect_deriving_relationship_arena.push(
8870                ShapeAspectDerivingRelationship {
8871                    name,
8872                    description,
8873                    relating_shape_aspect,
8874                    related_shape_aspect,
8875                },
8876            ),
8877        ))
8878    }
8879
8880    /// `SHAPE_ASPECT_RELATIONSHIP` — strict AP242 constructor.
8881    pub fn add_shape_aspect_relationship(
8882        &mut self,
8883        name: String,
8884        description: Option<String>,
8885        relating_shape_aspect: ShapeAspectRef,
8886        related_shape_aspect: ShapeAspectRef,
8887    ) -> Result<ShapeAspectRelationshipId, AuthorError> {
8888        check_shape_aspect_ref(&self.model, &relating_shape_aspect)?;
8889        check_shape_aspect_ref(&self.model, &related_shape_aspect)?;
8890        Ok(ShapeAspectRelationshipId(
8891            self.model
8892                .shape_aspect_relationship_arena
8893                .push(ShapeAspectRelationship {
8894                    name,
8895                    description,
8896                    relating_shape_aspect,
8897                    related_shape_aspect,
8898                }),
8899        ))
8900    }
8901
8902    /// `SHAPE_DEFINITION_REPRESENTATION` — strict AP242 constructor.
8903    pub fn add_shape_definition_representation(
8904        &mut self,
8905        definition: RepresentedDefinitionRef,
8906        used_representation: RepresentationRef,
8907    ) -> Result<ShapeDefinitionRepresentationId, AuthorError> {
8908        check_represented_definition_ref(&self.model, &definition)?;
8909        check_representation_ref(&self.model, &used_representation)?;
8910        Ok(ShapeDefinitionRepresentationId(
8911            self.model
8912                .shape_definition_representation_arena
8913                .push(ShapeDefinitionRepresentation {
8914                    definition,
8915                    used_representation,
8916                }),
8917        ))
8918    }
8919
8920    /// `SHAPE_DIMENSION_REPRESENTATION` — strict AP242 constructor.
8921    pub fn add_shape_dimension_representation(
8922        &mut self,
8923        name: String,
8924        items: Vec<RepresentationItemRef>,
8925        context_of_items: RepresentationContextRef,
8926    ) -> Result<ShapeDimensionRepresentationId, AuthorError> {
8927        {
8928            let x = &items;
8929            if x.len() < 1 {
8930                return Err(AuthorError::Cardinality {
8931                    entity: "SHAPE_DIMENSION_REPRESENTATION",
8932                    attribute: "items",
8933                    got: x.len(),
8934                    min: 1,
8935                    max: None,
8936                });
8937            }
8938        }
8939        for e0 in &items {
8940            check_representation_item_ref(&self.model, e0)?;
8941        }
8942        check_representation_context_ref(&self.model, &context_of_items)?;
8943        Ok(ShapeDimensionRepresentationId(
8944            self.model
8945                .shape_dimension_representation_arena
8946                .push(ShapeDimensionRepresentation {
8947                    name,
8948                    items,
8949                    context_of_items,
8950                }),
8951        ))
8952    }
8953
8954    /// `SHAPE_REPRESENTATION` — strict AP242 constructor.
8955    pub fn add_shape_representation(
8956        &mut self,
8957        name: String,
8958        items: Vec<RepresentationItemRef>,
8959        context_of_items: RepresentationContextRef,
8960    ) -> Result<ShapeRepresentationId, AuthorError> {
8961        {
8962            let x = &items;
8963            if x.len() < 1 {
8964                return Err(AuthorError::Cardinality {
8965                    entity: "SHAPE_REPRESENTATION",
8966                    attribute: "items",
8967                    got: x.len(),
8968                    min: 1,
8969                    max: None,
8970                });
8971            }
8972        }
8973        for e0 in &items {
8974            check_representation_item_ref(&self.model, e0)?;
8975        }
8976        check_representation_context_ref(&self.model, &context_of_items)?;
8977        Ok(ShapeRepresentationId(
8978            self.model
8979                .shape_representation_arena
8980                .push(ShapeRepresentation {
8981                    name,
8982                    items,
8983                    context_of_items,
8984                }),
8985        ))
8986    }
8987
8988    /// `SHAPE_REPRESENTATION_RELATIONSHIP` — strict AP242 constructor.
8989    pub fn add_shape_representation_relationship(
8990        &mut self,
8991        name: String,
8992        description: Option<String>,
8993        rep_1: RepresentationOrRepresentationReferenceRef,
8994        rep_2: RepresentationOrRepresentationReferenceRef,
8995    ) -> Result<ShapeRepresentationRelationshipId, AuthorError> {
8996        check_representation_or_representation_reference_ref(&self.model, &rep_1)?;
8997        check_representation_or_representation_reference_ref(&self.model, &rep_2)?;
8998        Ok(ShapeRepresentationRelationshipId(
8999            self.model.shape_representation_relationship_arena.push(
9000                ShapeRepresentationRelationship {
9001                    name,
9002                    description,
9003                    rep_1,
9004                    rep_2,
9005                },
9006            ),
9007        ))
9008    }
9009
9010    /// `SHAPE_REPRESENTATION_WITH_PARAMETERS` — strict AP242 constructor.
9011    pub fn add_shape_representation_with_parameters(
9012        &mut self,
9013        name: String,
9014        items: Vec<RepresentationItemRef>,
9015        context_of_items: RepresentationContextRef,
9016    ) -> Result<ShapeRepresentationWithParametersId, AuthorError> {
9017        {
9018            let x = &items;
9019            if x.len() < 1 {
9020                return Err(AuthorError::Cardinality {
9021                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
9022                    attribute: "items",
9023                    got: x.len(),
9024                    min: 1,
9025                    max: None,
9026                });
9027            }
9028        }
9029        for e0 in &items {
9030            check_representation_item_ref(&self.model, e0)?;
9031        }
9032        check_representation_context_ref(&self.model, &context_of_items)?;
9033        Ok(ShapeRepresentationWithParametersId(
9034            self.model.shape_representation_with_parameters_arena.push(
9035                ShapeRepresentationWithParameters {
9036                    name,
9037                    items,
9038                    context_of_items,
9039                },
9040            ),
9041        ))
9042    }
9043
9044    /// `SHELL_BASED_SURFACE_MODEL` — strict AP242 constructor.
9045    pub fn add_shell_based_surface_model(
9046        &mut self,
9047        name: String,
9048        sbsm_boundary: Vec<ShellRef>,
9049    ) -> Result<ShellBasedSurfaceModelId, AuthorError> {
9050        {
9051            let x = &sbsm_boundary;
9052            if x.len() < 1 {
9053                return Err(AuthorError::Cardinality {
9054                    entity: "SHELL_BASED_SURFACE_MODEL",
9055                    attribute: "sbsm_boundary",
9056                    got: x.len(),
9057                    min: 1,
9058                    max: None,
9059                });
9060            }
9061        }
9062        for e0 in &sbsm_boundary {
9063            check_shell_ref(&self.model, e0)?;
9064        }
9065        Ok(ShellBasedSurfaceModelId(
9066            self.model
9067                .shell_based_surface_model_arena
9068                .push(ShellBasedSurfaceModel {
9069                    name,
9070                    sbsm_boundary,
9071                }),
9072        ))
9073    }
9074
9075    /// `SI_UNIT` — strict AP242 constructor.
9076    pub fn add_si_unit(
9077        &mut self,
9078        prefix: Option<SiPrefix>,
9079        name: SiUnitName,
9080    ) -> Result<SiUnitId, AuthorError> {
9081        Ok(SiUnitId(
9082            self.model.si_unit_arena.push(SiUnit { prefix, name }),
9083        ))
9084    }
9085
9086    /// `SIMPLE_GENERIC_EXPRESSION` — strict AP242 constructor.
9087    pub fn add_simple_generic_expression(
9088        &mut self,
9089    ) -> Result<SimpleGenericExpressionId, AuthorError> {
9090        Ok(SimpleGenericExpressionId(
9091            self.model
9092                .simple_generic_expression_arena
9093                .push(SimpleGenericExpression {}),
9094        ))
9095    }
9096
9097    /// `SIMPLE_NUMERIC_EXPRESSION` — strict AP242 constructor.
9098    pub fn add_simple_numeric_expression(
9099        &mut self,
9100    ) -> Result<SimpleNumericExpressionId, AuthorError> {
9101        Ok(SimpleNumericExpressionId(
9102            self.model
9103                .simple_numeric_expression_arena
9104                .push(SimpleNumericExpression {}),
9105        ))
9106    }
9107
9108    /// `SOLID_ANGLE_UNIT` — strict AP242 constructor.
9109    pub fn add_solid_angle_unit(
9110        &mut self,
9111        dimensions: DimensionalExponentsRef,
9112    ) -> Result<SolidAngleUnitId, AuthorError> {
9113        check_dimensional_exponents_ref(&self.model, &dimensions)?;
9114        Ok(SolidAngleUnitId(
9115            self.model
9116                .solid_angle_unit_arena
9117                .push(SolidAngleUnit { dimensions }),
9118        ))
9119    }
9120
9121    /// `SOLID_MODEL` — strict AP242 constructor.
9122    pub fn add_solid_model(&mut self, name: String) -> Result<SolidModelId, AuthorError> {
9123        Ok(SolidModelId(
9124            self.model.solid_model_arena.push(SolidModel { name }),
9125        ))
9126    }
9127
9128    /// `SPHERICAL_SURFACE` — strict AP242 constructor.
9129    pub fn add_spherical_surface(
9130        &mut self,
9131        name: String,
9132        position: Axis2Placement3dRef,
9133        radius: f64,
9134    ) -> Result<SphericalSurfaceId, AuthorError> {
9135        check_axis2_placement3d_ref(&self.model, &position)?;
9136        Ok(SphericalSurfaceId(self.model.spherical_surface_arena.push(
9137            SphericalSurface {
9138                name,
9139                position,
9140                radius,
9141            },
9142        )))
9143    }
9144
9145    /// `START_REQUEST` — strict AP242 constructor.
9146    pub fn add_start_request(
9147        &mut self,
9148        assigned_action_request: VersionedActionRequestRef,
9149        items: Vec<StartRequestItemRef>,
9150    ) -> Result<StartRequestId, AuthorError> {
9151        check_versioned_action_request_ref(&self.model, &assigned_action_request)?;
9152        {
9153            let x = &items;
9154            if x.len() < 1 {
9155                return Err(AuthorError::Cardinality {
9156                    entity: "START_REQUEST",
9157                    attribute: "items",
9158                    got: x.len(),
9159                    min: 1,
9160                    max: None,
9161                });
9162            }
9163        }
9164        for e0 in &items {
9165            check_start_request_item_ref(&self.model, e0)?;
9166        }
9167        Ok(StartRequestId(self.model.start_request_arena.push(
9168            StartRequest {
9169                assigned_action_request,
9170                items,
9171            },
9172        )))
9173    }
9174
9175    /// `START_WORK` — strict AP242 constructor.
9176    pub fn add_start_work(
9177        &mut self,
9178        assigned_action: ActionRef,
9179        items: Vec<WorkItemRef>,
9180    ) -> Result<StartWorkId, AuthorError> {
9181        check_action_ref(&self.model, &assigned_action)?;
9182        {
9183            let x = &items;
9184            if x.len() < 1 {
9185                return Err(AuthorError::Cardinality {
9186                    entity: "START_WORK",
9187                    attribute: "items",
9188                    got: x.len(),
9189                    min: 1,
9190                    max: None,
9191                });
9192            }
9193        }
9194        for e0 in &items {
9195            check_work_item_ref(&self.model, e0)?;
9196        }
9197        Ok(StartWorkId(self.model.start_work_arena.push(StartWork {
9198            assigned_action,
9199            items,
9200        })))
9201    }
9202
9203    /// `STATE_OBSERVED` — strict AP242 constructor.
9204    pub fn add_state_observed(
9205        &mut self,
9206        name: String,
9207        description: Option<String>,
9208    ) -> Result<StateObservedId, AuthorError> {
9209        Ok(StateObservedId(
9210            self.model
9211                .state_observed_arena
9212                .push(StateObserved { name, description }),
9213        ))
9214    }
9215
9216    /// `STATE_TYPE` — strict AP242 constructor.
9217    pub fn add_state_type(
9218        &mut self,
9219        name: String,
9220        description: Option<String>,
9221    ) -> Result<StateTypeId, AuthorError> {
9222        Ok(StateTypeId(
9223            self.model
9224                .state_type_arena
9225                .push(StateType { name, description }),
9226        ))
9227    }
9228
9229    /// `STRAIGHTNESS_TOLERANCE` — strict AP242 constructor.
9230    pub fn add_straightness_tolerance(
9231        &mut self,
9232        name: String,
9233        description: Option<String>,
9234        magnitude: Option<LengthMeasureWithUnitRef>,
9235        toleranced_shape_aspect: GeometricToleranceTargetRef,
9236    ) -> Result<StraightnessToleranceId, AuthorError> {
9237        if let Some(x) = &magnitude {
9238            check_length_measure_with_unit_ref(&self.model, x)?;
9239        }
9240        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
9241        Ok(StraightnessToleranceId(
9242            self.model
9243                .straightness_tolerance_arena
9244                .push(StraightnessTolerance {
9245                    name,
9246                    description,
9247                    magnitude,
9248                    toleranced_shape_aspect,
9249                }),
9250        ))
9251    }
9252
9253    /// `STYLED_ITEM` — strict AP242 constructor.
9254    pub fn add_styled_item(
9255        &mut self,
9256        name: String,
9257        styles: Vec<PresentationStyleAssignmentRef>,
9258        item: StyledItemTargetRef,
9259    ) -> Result<StyledItemId, AuthorError> {
9260        for e0 in &styles {
9261            check_presentation_style_assignment_ref(&self.model, e0)?;
9262        }
9263        check_styled_item_target_ref(&self.model, &item)?;
9264        Ok(StyledItemId(
9265            self.model
9266                .styled_item_arena
9267                .push(StyledItem { name, styles, item }),
9268        ))
9269    }
9270
9271    /// `SURFACE` — strict AP242 constructor.
9272    pub fn add_surface(&mut self, name: String) -> Result<SurfaceId, AuthorError> {
9273        Ok(SurfaceId(self.model.surface_arena.push(Surface { name })))
9274    }
9275
9276    /// `SURFACE_CURVE` — strict AP242 constructor.
9277    pub fn add_surface_curve(
9278        &mut self,
9279        name: String,
9280        curve_3d: CurveRef,
9281        associated_geometry: Vec<PcurveOrSurfaceRef>,
9282        master_representation: PreferredSurfaceCurveRepresentation,
9283    ) -> Result<SurfaceCurveId, AuthorError> {
9284        check_curve_ref(&self.model, &curve_3d)?;
9285        {
9286            let x = &associated_geometry;
9287            if x.len() < 1 || x.len() > 2 {
9288                return Err(AuthorError::Cardinality {
9289                    entity: "SURFACE_CURVE",
9290                    attribute: "associated_geometry",
9291                    got: x.len(),
9292                    min: 1,
9293                    max: Some(2),
9294                });
9295            }
9296        }
9297        for e0 in &associated_geometry {
9298            check_pcurve_or_surface_ref(&self.model, e0)?;
9299        }
9300        Ok(SurfaceCurveId(self.model.surface_curve_arena.push(
9301            SurfaceCurve {
9302                name,
9303                curve_3d,
9304                associated_geometry,
9305                master_representation,
9306            },
9307        )))
9308    }
9309
9310    /// `SURFACE_OF_LINEAR_EXTRUSION` — strict AP242 constructor.
9311    pub fn add_surface_of_linear_extrusion(
9312        &mut self,
9313        name: String,
9314        swept_curve: CurveRef,
9315        extrusion_axis: VectorRef,
9316    ) -> Result<SurfaceOfLinearExtrusionId, AuthorError> {
9317        check_curve_ref(&self.model, &swept_curve)?;
9318        check_vector_ref(&self.model, &extrusion_axis)?;
9319        Ok(SurfaceOfLinearExtrusionId(
9320            self.model
9321                .surface_of_linear_extrusion_arena
9322                .push(SurfaceOfLinearExtrusion {
9323                    name,
9324                    swept_curve,
9325                    extrusion_axis,
9326                }),
9327        ))
9328    }
9329
9330    /// `SURFACE_OF_REVOLUTION` — strict AP242 constructor.
9331    pub fn add_surface_of_revolution(
9332        &mut self,
9333        name: String,
9334        swept_curve: CurveRef,
9335        axis_position: Axis1PlacementRef,
9336    ) -> Result<SurfaceOfRevolutionId, AuthorError> {
9337        check_curve_ref(&self.model, &swept_curve)?;
9338        check_axis1_placement_ref(&self.model, &axis_position)?;
9339        Ok(SurfaceOfRevolutionId(
9340            self.model
9341                .surface_of_revolution_arena
9342                .push(SurfaceOfRevolution {
9343                    name,
9344                    swept_curve,
9345                    axis_position,
9346                }),
9347        ))
9348    }
9349
9350    /// `SURFACE_PROFILE_TOLERANCE` — strict AP242 constructor.
9351    pub fn add_surface_profile_tolerance(
9352        &mut self,
9353        name: String,
9354        description: Option<String>,
9355        magnitude: Option<LengthMeasureWithUnitRef>,
9356        toleranced_shape_aspect: GeometricToleranceTargetRef,
9357    ) -> Result<SurfaceProfileToleranceId, AuthorError> {
9358        if let Some(x) = &magnitude {
9359            check_length_measure_with_unit_ref(&self.model, x)?;
9360        }
9361        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
9362        Ok(SurfaceProfileToleranceId(
9363            self.model
9364                .surface_profile_tolerance_arena
9365                .push(SurfaceProfileTolerance {
9366                    name,
9367                    description,
9368                    magnitude,
9369                    toleranced_shape_aspect,
9370                }),
9371        ))
9372    }
9373
9374    /// `SURFACE_RENDERING_PROPERTIES` — strict AP242 constructor.
9375    pub fn add_surface_rendering_properties(
9376        &mut self,
9377        rendered_colour: ColourRef,
9378    ) -> Result<SurfaceRenderingPropertiesId, AuthorError> {
9379        check_colour_ref(&self.model, &rendered_colour)?;
9380        Ok(SurfaceRenderingPropertiesId(
9381            self.model
9382                .surface_rendering_properties_arena
9383                .push(SurfaceRenderingProperties { rendered_colour }),
9384        ))
9385    }
9386
9387    /// `SURFACE_SIDE_STYLE` — strict AP242 constructor.
9388    pub fn add_surface_side_style(
9389        &mut self,
9390        name: String,
9391        styles: Vec<SurfaceStyleElementSelectRef>,
9392    ) -> Result<SurfaceSideStyleId, AuthorError> {
9393        {
9394            let x = &styles;
9395            if x.len() < 1 || x.len() > 7 {
9396                return Err(AuthorError::Cardinality {
9397                    entity: "SURFACE_SIDE_STYLE",
9398                    attribute: "styles",
9399                    got: x.len(),
9400                    min: 1,
9401                    max: Some(7),
9402                });
9403            }
9404        }
9405        for e0 in &styles {
9406            check_surface_style_element_select_ref(&self.model, e0)?;
9407        }
9408        Ok(SurfaceSideStyleId(
9409            self.model
9410                .surface_side_style_arena
9411                .push(SurfaceSideStyle { name, styles }),
9412        ))
9413    }
9414
9415    /// `SURFACE_STYLE_BOUNDARY` — strict AP242 constructor.
9416    pub fn add_surface_style_boundary(
9417        &mut self,
9418        style_of_boundary: CurveOrRenderRef,
9419    ) -> Result<SurfaceStyleBoundaryId, AuthorError> {
9420        check_curve_or_render_ref(&self.model, &style_of_boundary)?;
9421        Ok(SurfaceStyleBoundaryId(
9422            self.model
9423                .surface_style_boundary_arena
9424                .push(SurfaceStyleBoundary { style_of_boundary }),
9425        ))
9426    }
9427
9428    /// `SURFACE_STYLE_CONTROL_GRID` — strict AP242 constructor.
9429    pub fn add_surface_style_control_grid(
9430        &mut self,
9431        style_of_control_grid: CurveOrRenderRef,
9432    ) -> Result<SurfaceStyleControlGridId, AuthorError> {
9433        check_curve_or_render_ref(&self.model, &style_of_control_grid)?;
9434        Ok(SurfaceStyleControlGridId(
9435            self.model
9436                .surface_style_control_grid_arena
9437                .push(SurfaceStyleControlGrid {
9438                    style_of_control_grid,
9439                }),
9440        ))
9441    }
9442
9443    /// `SURFACE_STYLE_FILL_AREA` — strict AP242 constructor.
9444    pub fn add_surface_style_fill_area(
9445        &mut self,
9446        fill_area: FillAreaStyleRef,
9447    ) -> Result<SurfaceStyleFillAreaId, AuthorError> {
9448        check_fill_area_style_ref(&self.model, &fill_area)?;
9449        Ok(SurfaceStyleFillAreaId(
9450            self.model
9451                .surface_style_fill_area_arena
9452                .push(SurfaceStyleFillArea { fill_area }),
9453        ))
9454    }
9455
9456    /// `SURFACE_STYLE_PARAMETER_LINE` — strict AP242 constructor.
9457    pub fn add_surface_style_parameter_line(
9458        &mut self,
9459        style_of_parameter_lines: CurveOrRenderRef,
9460        direction_counts: Vec<IntMeasureValue>,
9461    ) -> Result<SurfaceStyleParameterLineId, AuthorError> {
9462        check_curve_or_render_ref(&self.model, &style_of_parameter_lines)?;
9463        {
9464            let x = &direction_counts;
9465            if x.len() < 1 || x.len() > 2 {
9466                return Err(AuthorError::Cardinality {
9467                    entity: "SURFACE_STYLE_PARAMETER_LINE",
9468                    attribute: "direction_counts",
9469                    got: x.len(),
9470                    min: 1,
9471                    max: Some(2),
9472                });
9473            }
9474        }
9475        Ok(SurfaceStyleParameterLineId(
9476            self.model
9477                .surface_style_parameter_line_arena
9478                .push(SurfaceStyleParameterLine {
9479                    style_of_parameter_lines,
9480                    direction_counts,
9481                }),
9482        ))
9483    }
9484
9485    /// `SURFACE_STYLE_REFLECTANCE_AMBIENT` — strict AP242 constructor.
9486    pub fn add_surface_style_reflectance_ambient(
9487        &mut self,
9488        ambient_reflectance: f64,
9489    ) -> Result<SurfaceStyleReflectanceAmbientId, AuthorError> {
9490        Ok(SurfaceStyleReflectanceAmbientId(
9491            self.model.surface_style_reflectance_ambient_arena.push(
9492                SurfaceStyleReflectanceAmbient {
9493                    ambient_reflectance,
9494                },
9495            ),
9496        ))
9497    }
9498
9499    /// `SURFACE_STYLE_RENDERING` — strict AP242 constructor.
9500    pub fn add_surface_style_rendering(
9501        &mut self,
9502        rendering_method: ShadingSurfaceMethod,
9503        surface_colour: ColourRef,
9504    ) -> Result<SurfaceStyleRenderingId, AuthorError> {
9505        check_colour_ref(&self.model, &surface_colour)?;
9506        Ok(SurfaceStyleRenderingId(
9507            self.model
9508                .surface_style_rendering_arena
9509                .push(SurfaceStyleRendering {
9510                    rendering_method,
9511                    surface_colour,
9512                }),
9513        ))
9514    }
9515
9516    /// `SURFACE_STYLE_RENDERING_WITH_PROPERTIES` — strict AP242 constructor.
9517    pub fn add_surface_style_rendering_with_properties(
9518        &mut self,
9519        rendering_method: ShadingSurfaceMethod,
9520        surface_colour: ColourRef,
9521        properties: Vec<RenderingPropertiesSelectRef>,
9522    ) -> Result<SurfaceStyleRenderingWithPropertiesId, AuthorError> {
9523        check_colour_ref(&self.model, &surface_colour)?;
9524        {
9525            let x = &properties;
9526            if x.len() < 1 || x.len() > 2 {
9527                return Err(AuthorError::Cardinality {
9528                    entity: "SURFACE_STYLE_RENDERING_WITH_PROPERTIES",
9529                    attribute: "properties",
9530                    got: x.len(),
9531                    min: 1,
9532                    max: Some(2),
9533                });
9534            }
9535        }
9536        for e0 in &properties {
9537            check_rendering_properties_select_ref(&self.model, e0)?;
9538        }
9539        Ok(SurfaceStyleRenderingWithPropertiesId(
9540            self.model
9541                .surface_style_rendering_with_properties_arena
9542                .push(SurfaceStyleRenderingWithProperties {
9543                    rendering_method,
9544                    surface_colour,
9545                    properties,
9546                }),
9547        ))
9548    }
9549
9550    /// `SURFACE_STYLE_SEGMENTATION_CURVE` — strict AP242 constructor.
9551    pub fn add_surface_style_segmentation_curve(
9552        &mut self,
9553        style_of_segmentation_curve: CurveOrRenderRef,
9554    ) -> Result<SurfaceStyleSegmentationCurveId, AuthorError> {
9555        check_curve_or_render_ref(&self.model, &style_of_segmentation_curve)?;
9556        Ok(SurfaceStyleSegmentationCurveId(
9557            self.model
9558                .surface_style_segmentation_curve_arena
9559                .push(SurfaceStyleSegmentationCurve {
9560                    style_of_segmentation_curve,
9561                }),
9562        ))
9563    }
9564
9565    /// `SURFACE_STYLE_SILHOUETTE` — strict AP242 constructor.
9566    pub fn add_surface_style_silhouette(
9567        &mut self,
9568        style_of_silhouette: CurveOrRenderRef,
9569    ) -> Result<SurfaceStyleSilhouetteId, AuthorError> {
9570        check_curve_or_render_ref(&self.model, &style_of_silhouette)?;
9571        Ok(SurfaceStyleSilhouetteId(
9572            self.model
9573                .surface_style_silhouette_arena
9574                .push(SurfaceStyleSilhouette {
9575                    style_of_silhouette,
9576                }),
9577        ))
9578    }
9579
9580    /// `SURFACE_STYLE_TRANSPARENT` — strict AP242 constructor.
9581    pub fn add_surface_style_transparent(
9582        &mut self,
9583        transparency: f64,
9584    ) -> Result<SurfaceStyleTransparentId, AuthorError> {
9585        Ok(SurfaceStyleTransparentId(
9586            self.model
9587                .surface_style_transparent_arena
9588                .push(SurfaceStyleTransparent { transparency }),
9589        ))
9590    }
9591
9592    /// `SURFACE_STYLE_USAGE` — strict AP242 constructor.
9593    pub fn add_surface_style_usage(
9594        &mut self,
9595        side: SurfaceSide,
9596        style: SurfaceSideStyleSelectRef,
9597    ) -> Result<SurfaceStyleUsageId, AuthorError> {
9598        check_surface_side_style_select_ref(&self.model, &style)?;
9599        Ok(SurfaceStyleUsageId(
9600            self.model
9601                .surface_style_usage_arena
9602                .push(SurfaceStyleUsage { side, style }),
9603        ))
9604    }
9605
9606    /// `SWEPT_SURFACE` — strict AP242 constructor.
9607    pub fn add_swept_surface(
9608        &mut self,
9609        name: String,
9610        swept_curve: CurveRef,
9611    ) -> Result<SweptSurfaceId, AuthorError> {
9612        check_curve_ref(&self.model, &swept_curve)?;
9613        Ok(SweptSurfaceId(
9614            self.model
9615                .swept_surface_arena
9616                .push(SweptSurface { name, swept_curve }),
9617        ))
9618    }
9619
9620    /// `SYMBOL_COLOUR` — strict AP242 constructor.
9621    pub fn add_symbol_colour(
9622        &mut self,
9623        colour_of_symbol: ColourRef,
9624    ) -> Result<SymbolColourId, AuthorError> {
9625        check_colour_ref(&self.model, &colour_of_symbol)?;
9626        Ok(SymbolColourId(
9627            self.model
9628                .symbol_colour_arena
9629                .push(SymbolColour { colour_of_symbol }),
9630        ))
9631    }
9632
9633    /// `SYMBOL_REPRESENTATION` — strict AP242 constructor.
9634    pub fn add_symbol_representation(
9635        &mut self,
9636        name: String,
9637        items: Vec<RepresentationItemRef>,
9638        context_of_items: RepresentationContextRef,
9639    ) -> Result<SymbolRepresentationId, AuthorError> {
9640        {
9641            let x = &items;
9642            if x.len() < 1 {
9643                return Err(AuthorError::Cardinality {
9644                    entity: "SYMBOL_REPRESENTATION",
9645                    attribute: "items",
9646                    got: x.len(),
9647                    min: 1,
9648                    max: None,
9649                });
9650            }
9651        }
9652        for e0 in &items {
9653            check_representation_item_ref(&self.model, e0)?;
9654        }
9655        check_representation_context_ref(&self.model, &context_of_items)?;
9656        Ok(SymbolRepresentationId(
9657            self.model
9658                .symbol_representation_arena
9659                .push(SymbolRepresentation {
9660                    name,
9661                    items,
9662                    context_of_items,
9663                }),
9664        ))
9665    }
9666
9667    /// `SYMBOL_STYLE` — strict AP242 constructor.
9668    pub fn add_symbol_style(
9669        &mut self,
9670        name: String,
9671        style_of_symbol: SymbolStyleSelectRef,
9672    ) -> Result<SymbolStyleId, AuthorError> {
9673        check_symbol_style_select_ref(&self.model, &style_of_symbol)?;
9674        Ok(SymbolStyleId(self.model.symbol_style_arena.push(
9675            SymbolStyle {
9676                name,
9677                style_of_symbol,
9678            },
9679        )))
9680    }
9681
9682    /// `SYMBOL_TARGET` — strict AP242 constructor.
9683    pub fn add_symbol_target(
9684        &mut self,
9685        name: String,
9686        placement: Axis2PlacementRef,
9687        x_scale: f64,
9688        y_scale: f64,
9689    ) -> Result<SymbolTargetId, AuthorError> {
9690        check_axis2_placement_ref(&self.model, &placement)?;
9691        Ok(SymbolTargetId(self.model.symbol_target_arena.push(
9692            SymbolTarget {
9693                name,
9694                placement,
9695                x_scale,
9696                y_scale,
9697            },
9698        )))
9699    }
9700
9701    /// `SYMMETRY_TOLERANCE` — strict AP242 constructor.
9702    pub fn add_symmetry_tolerance(
9703        &mut self,
9704        name: String,
9705        description: Option<String>,
9706        magnitude: Option<LengthMeasureWithUnitRef>,
9707        toleranced_shape_aspect: GeometricToleranceTargetRef,
9708        datum_system: Vec<DatumSystemOrReferenceRef>,
9709    ) -> Result<SymmetryToleranceId, AuthorError> {
9710        if let Some(x) = &magnitude {
9711            check_length_measure_with_unit_ref(&self.model, x)?;
9712        }
9713        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
9714        {
9715            let x = &datum_system;
9716            if x.len() < 1 {
9717                return Err(AuthorError::Cardinality {
9718                    entity: "SYMMETRY_TOLERANCE",
9719                    attribute: "datum_system",
9720                    got: x.len(),
9721                    min: 1,
9722                    max: None,
9723                });
9724            }
9725        }
9726        for e0 in &datum_system {
9727            check_datum_system_or_reference_ref(&self.model, e0)?;
9728        }
9729        Ok(SymmetryToleranceId(
9730            self.model.symmetry_tolerance_arena.push(SymmetryTolerance {
9731                name,
9732                description,
9733                magnitude,
9734                toleranced_shape_aspect,
9735                datum_system,
9736            }),
9737        ))
9738    }
9739
9740    /// `TERMINATOR_SYMBOL` — strict AP242 constructor.
9741    pub fn add_terminator_symbol(
9742        &mut self,
9743        name: String,
9744        styles: Vec<PresentationStyleAssignmentRef>,
9745        item: AnnotationSymbolOccurrenceItemRef,
9746        annotated_curve: AnnotationCurveOccurrenceRef,
9747    ) -> Result<TerminatorSymbolId, AuthorError> {
9748        for e0 in &styles {
9749            check_presentation_style_assignment_ref(&self.model, e0)?;
9750        }
9751        check_annotation_symbol_occurrence_item_ref(&self.model, &item)?;
9752        check_annotation_curve_occurrence_ref(&self.model, &annotated_curve)?;
9753        Ok(TerminatorSymbolId(self.model.terminator_symbol_arena.push(
9754            TerminatorSymbol {
9755                name,
9756                styles,
9757                item,
9758                annotated_curve,
9759            },
9760        )))
9761    }
9762
9763    /// `TESSELLATED_ANNOTATION_OCCURRENCE` — strict AP242 constructor.
9764    pub fn add_tessellated_annotation_occurrence(
9765        &mut self,
9766        name: String,
9767        styles: Vec<PresentationStyleAssignmentRef>,
9768        item: StyledItemTargetRef,
9769    ) -> Result<TessellatedAnnotationOccurrenceId, AuthorError> {
9770        for e0 in &styles {
9771            check_presentation_style_assignment_ref(&self.model, e0)?;
9772        }
9773        check_styled_item_target_ref(&self.model, &item)?;
9774        Ok(TessellatedAnnotationOccurrenceId(
9775            self.model
9776                .tessellated_annotation_occurrence_arena
9777                .push(TessellatedAnnotationOccurrence { name, styles, item }),
9778        ))
9779    }
9780
9781    /// `TESSELLATED_CURVE_SET` — strict AP242 constructor.
9782    pub fn add_tessellated_curve_set(
9783        &mut self,
9784        name: String,
9785        coordinates: CoordinatesListRef,
9786        line_strips: Vec<Vec<i64>>,
9787    ) -> Result<TessellatedCurveSetId, AuthorError> {
9788        check_coordinates_list_ref(&self.model, &coordinates)?;
9789        {
9790            let x = &line_strips;
9791            if x.len() < 1 {
9792                return Err(AuthorError::Cardinality {
9793                    entity: "TESSELLATED_CURVE_SET",
9794                    attribute: "line_strips",
9795                    got: x.len(),
9796                    min: 1,
9797                    max: None,
9798                });
9799            }
9800        }
9801        Ok(TessellatedCurveSetId(
9802            self.model
9803                .tessellated_curve_set_arena
9804                .push(TessellatedCurveSet {
9805                    name,
9806                    coordinates,
9807                    line_strips,
9808                }),
9809        ))
9810    }
9811
9812    /// `TESSELLATED_FACE` — strict AP242 constructor.
9813    pub fn add_tessellated_face(
9814        &mut self,
9815        name: String,
9816        coordinates: CoordinatesListRef,
9817        pnmax: i64,
9818        normals: Vec<Vec<f64>>,
9819        geometric_link: Option<FaceOrSurfaceRef>,
9820    ) -> Result<TessellatedFaceId, AuthorError> {
9821        check_coordinates_list_ref(&self.model, &coordinates)?;
9822        if let Some(x) = &geometric_link {
9823            check_face_or_surface_ref(&self.model, x)?;
9824        }
9825        Ok(TessellatedFaceId(self.model.tessellated_face_arena.push(
9826            TessellatedFace {
9827                name,
9828                coordinates,
9829                pnmax,
9830                normals,
9831                geometric_link,
9832            },
9833        )))
9834    }
9835
9836    /// `TESSELLATED_GEOMETRIC_SET` — strict AP242 constructor.
9837    pub fn add_tessellated_geometric_set(
9838        &mut self,
9839        name: String,
9840        children: Vec<TessellatedItemRef>,
9841    ) -> Result<TessellatedGeometricSetId, AuthorError> {
9842        {
9843            let x = &children;
9844            if x.len() < 1 {
9845                return Err(AuthorError::Cardinality {
9846                    entity: "TESSELLATED_GEOMETRIC_SET",
9847                    attribute: "children",
9848                    got: x.len(),
9849                    min: 1,
9850                    max: None,
9851                });
9852            }
9853        }
9854        for e0 in &children {
9855            check_tessellated_item_ref(&self.model, e0)?;
9856        }
9857        Ok(TessellatedGeometricSetId(
9858            self.model
9859                .tessellated_geometric_set_arena
9860                .push(TessellatedGeometricSet { name, children }),
9861        ))
9862    }
9863
9864    /// `TESSELLATED_ITEM` — strict AP242 constructor.
9865    pub fn add_tessellated_item(&mut self, name: String) -> Result<TessellatedItemId, AuthorError> {
9866        Ok(TessellatedItemId(
9867            self.model
9868                .tessellated_item_arena
9869                .push(TessellatedItem { name }),
9870        ))
9871    }
9872
9873    /// `TESSELLATED_SHAPE_REPRESENTATION` — strict AP242 constructor.
9874    pub fn add_tessellated_shape_representation(
9875        &mut self,
9876        name: String,
9877        items: Vec<RepresentationItemRef>,
9878        context_of_items: RepresentationContextRef,
9879    ) -> Result<TessellatedShapeRepresentationId, AuthorError> {
9880        {
9881            let x = &items;
9882            if x.len() < 1 {
9883                return Err(AuthorError::Cardinality {
9884                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
9885                    attribute: "items",
9886                    got: x.len(),
9887                    min: 1,
9888                    max: None,
9889                });
9890            }
9891        }
9892        for e0 in &items {
9893            check_representation_item_ref(&self.model, e0)?;
9894        }
9895        check_representation_context_ref(&self.model, &context_of_items)?;
9896        Ok(TessellatedShapeRepresentationId(
9897            self.model.tessellated_shape_representation_arena.push(
9898                TessellatedShapeRepresentation {
9899                    name,
9900                    items,
9901                    context_of_items,
9902                },
9903            ),
9904        ))
9905    }
9906
9907    /// `TESSELLATED_SHELL` — strict AP242 constructor.
9908    pub fn add_tessellated_shell(
9909        &mut self,
9910        name: String,
9911        items: Vec<TessellatedStructuredItemRef>,
9912        topological_link: Option<ConnectedFaceSetRef>,
9913    ) -> Result<TessellatedShellId, AuthorError> {
9914        {
9915            let x = &items;
9916            if x.len() < 1 {
9917                return Err(AuthorError::Cardinality {
9918                    entity: "TESSELLATED_SHELL",
9919                    attribute: "items",
9920                    got: x.len(),
9921                    min: 1,
9922                    max: None,
9923                });
9924            }
9925        }
9926        for e0 in &items {
9927            check_tessellated_structured_item_ref(&self.model, e0)?;
9928        }
9929        if let Some(x) = &topological_link {
9930            check_connected_face_set_ref(&self.model, x)?;
9931        }
9932        Ok(TessellatedShellId(self.model.tessellated_shell_arena.push(
9933            TessellatedShell {
9934                name,
9935                items,
9936                topological_link,
9937            },
9938        )))
9939    }
9940
9941    /// `TESSELLATED_SOLID` — strict AP242 constructor.
9942    pub fn add_tessellated_solid(
9943        &mut self,
9944        name: String,
9945        items: Vec<TessellatedStructuredItemRef>,
9946        geometric_link: Option<ManifoldSolidBrepRef>,
9947    ) -> Result<TessellatedSolidId, AuthorError> {
9948        {
9949            let x = &items;
9950            if x.len() < 1 {
9951                return Err(AuthorError::Cardinality {
9952                    entity: "TESSELLATED_SOLID",
9953                    attribute: "items",
9954                    got: x.len(),
9955                    min: 1,
9956                    max: None,
9957                });
9958            }
9959        }
9960        for e0 in &items {
9961            check_tessellated_structured_item_ref(&self.model, e0)?;
9962        }
9963        if let Some(x) = &geometric_link {
9964            check_manifold_solid_brep_ref(&self.model, x)?;
9965        }
9966        Ok(TessellatedSolidId(self.model.tessellated_solid_arena.push(
9967            TessellatedSolid {
9968                name,
9969                items,
9970                geometric_link,
9971            },
9972        )))
9973    }
9974
9975    /// `TESSELLATED_STRUCTURED_ITEM` — strict AP242 constructor.
9976    pub fn add_tessellated_structured_item(
9977        &mut self,
9978        name: String,
9979    ) -> Result<TessellatedStructuredItemId, AuthorError> {
9980        Ok(TessellatedStructuredItemId(
9981            self.model
9982                .tessellated_structured_item_arena
9983                .push(TessellatedStructuredItem { name }),
9984        ))
9985    }
9986
9987    /// `TESSELLATED_SURFACE_SET` — strict AP242 constructor.
9988    pub fn add_tessellated_surface_set(
9989        &mut self,
9990        name: String,
9991        coordinates: CoordinatesListRef,
9992        pnmax: i64,
9993        normals: Vec<Vec<f64>>,
9994    ) -> Result<TessellatedSurfaceSetId, AuthorError> {
9995        check_coordinates_list_ref(&self.model, &coordinates)?;
9996        Ok(TessellatedSurfaceSetId(
9997            self.model
9998                .tessellated_surface_set_arena
9999                .push(TessellatedSurfaceSet {
10000                    name,
10001                    coordinates,
10002                    pnmax,
10003                    normals,
10004                }),
10005        ))
10006    }
10007
10008    /// `TEXT_FONT` — strict AP242 constructor.
10009    pub fn add_text_font(
10010        &mut self,
10011        id: String,
10012        name: String,
10013        description: String,
10014    ) -> Result<TextFontId, AuthorError> {
10015        Ok(TextFontId(self.model.text_font_arena.push(TextFont {
10016            id,
10017            name,
10018            description,
10019        })))
10020    }
10021
10022    /// `TEXT_LITERAL` — strict AP242 constructor.
10023    pub fn add_text_literal(
10024        &mut self,
10025        name: String,
10026        literal: String,
10027        placement: Axis2PlacementRef,
10028        alignment: String,
10029        path: TextPath,
10030        font: FontSelectRef,
10031    ) -> Result<TextLiteralId, AuthorError> {
10032        check_axis2_placement_ref(&self.model, &placement)?;
10033        check_font_select_ref(&self.model, &font)?;
10034        Ok(TextLiteralId(self.model.text_literal_arena.push(
10035            TextLiteral {
10036                name,
10037                literal,
10038                placement,
10039                alignment,
10040                path,
10041                font,
10042            },
10043        )))
10044    }
10045
10046    /// `TEXT_STYLE` — strict AP242 constructor.
10047    pub fn add_text_style(
10048        &mut self,
10049        name: String,
10050        character_appearance: CharacterStyleSelectRef,
10051    ) -> Result<TextStyleId, AuthorError> {
10052        check_character_style_select_ref(&self.model, &character_appearance)?;
10053        Ok(TextStyleId(self.model.text_style_arena.push(TextStyle {
10054            name,
10055            character_appearance,
10056        })))
10057    }
10058
10059    /// `TEXT_STYLE_FOR_DEFINED_FONT` — strict AP242 constructor.
10060    pub fn add_text_style_for_defined_font(
10061        &mut self,
10062        text_colour: ColourRef,
10063    ) -> Result<TextStyleForDefinedFontId, AuthorError> {
10064        check_colour_ref(&self.model, &text_colour)?;
10065        Ok(TextStyleForDefinedFontId(
10066            self.model
10067                .text_style_for_defined_font_arena
10068                .push(TextStyleForDefinedFont { text_colour }),
10069        ))
10070    }
10071
10072    /// `TEXT_STYLE_WITH_BOX_CHARACTERISTICS` — strict AP242 constructor.
10073    pub fn add_text_style_with_box_characteristics(
10074        &mut self,
10075        name: String,
10076        character_appearance: CharacterStyleSelectRef,
10077        characteristics: Vec<MeasureValue>,
10078    ) -> Result<TextStyleWithBoxCharacteristicsId, AuthorError> {
10079        check_character_style_select_ref(&self.model, &character_appearance)?;
10080        {
10081            let x = &characteristics;
10082            if x.len() < 1 || x.len() > 4 {
10083                return Err(AuthorError::Cardinality {
10084                    entity: "TEXT_STYLE_WITH_BOX_CHARACTERISTICS",
10085                    attribute: "characteristics",
10086                    got: x.len(),
10087                    min: 1,
10088                    max: Some(4),
10089                });
10090            }
10091        }
10092        Ok(TextStyleWithBoxCharacteristicsId(
10093            self.model.text_style_with_box_characteristics_arena.push(
10094                TextStyleWithBoxCharacteristics {
10095                    name,
10096                    character_appearance,
10097                    characteristics,
10098                },
10099            ),
10100        ))
10101    }
10102
10103    /// `TEXTURE_STYLE_SPECIFICATION` — strict AP242 constructor.
10104    pub fn add_texture_style_specification(
10105        &mut self,
10106    ) -> Result<TextureStyleSpecificationId, AuthorError> {
10107        Ok(TextureStyleSpecificationId(
10108            self.model
10109                .texture_style_specification_arena
10110                .push(TextureStyleSpecification {}),
10111        ))
10112    }
10113
10114    /// `TEXTURE_STYLE_TESSELLATION_SPECIFICATION` — strict AP242 constructor.
10115    pub fn add_texture_style_tessellation_specification(
10116        &mut self,
10117    ) -> Result<TextureStyleTessellationSpecificationId, AuthorError> {
10118        Ok(TextureStyleTessellationSpecificationId(
10119            self.model
10120                .texture_style_tessellation_specification_arena
10121                .push(TextureStyleTessellationSpecification {}),
10122        ))
10123    }
10124
10125    /// `TIME_UNIT` — strict AP242 constructor.
10126    pub fn add_time_unit(
10127        &mut self,
10128        dimensions: DimensionalExponentsRef,
10129    ) -> Result<TimeUnitId, AuthorError> {
10130        check_dimensional_exponents_ref(&self.model, &dimensions)?;
10131        Ok(TimeUnitId(
10132            self.model.time_unit_arena.push(TimeUnit { dimensions }),
10133        ))
10134    }
10135
10136    /// `TOLERANCE_VALUE` — strict AP242 constructor.
10137    pub fn add_tolerance_value(
10138        &mut self,
10139        lower_bound: MeasureWithUnitRef,
10140        upper_bound: MeasureWithUnitRef,
10141    ) -> Result<ToleranceValueId, AuthorError> {
10142        check_measure_with_unit_ref(&self.model, &lower_bound)?;
10143        check_measure_with_unit_ref(&self.model, &upper_bound)?;
10144        Ok(ToleranceValueId(self.model.tolerance_value_arena.push(
10145            ToleranceValue {
10146                lower_bound,
10147                upper_bound,
10148            },
10149        )))
10150    }
10151
10152    /// `TOLERANCE_ZONE` — strict AP242 constructor.
10153    pub fn add_tolerance_zone(
10154        &mut self,
10155        name: String,
10156        description: Option<String>,
10157        of_shape: ProductDefinitionShapeRef,
10158        product_definitional: Logical,
10159        defining_tolerance: Vec<ToleranceZoneTargetRef>,
10160        form: ToleranceZoneFormRef,
10161    ) -> Result<ToleranceZoneId, AuthorError> {
10162        check_product_definition_shape_ref(&self.model, &of_shape)?;
10163        {
10164            let x = &defining_tolerance;
10165            if x.len() < 1 {
10166                return Err(AuthorError::Cardinality {
10167                    entity: "TOLERANCE_ZONE",
10168                    attribute: "defining_tolerance",
10169                    got: x.len(),
10170                    min: 1,
10171                    max: None,
10172                });
10173            }
10174        }
10175        for e0 in &defining_tolerance {
10176            check_tolerance_zone_target_ref(&self.model, e0)?;
10177        }
10178        check_tolerance_zone_form_ref(&self.model, &form)?;
10179        Ok(ToleranceZoneId(self.model.tolerance_zone_arena.push(
10180            ToleranceZone {
10181                name,
10182                description,
10183                of_shape,
10184                product_definitional,
10185                defining_tolerance,
10186                form,
10187            },
10188        )))
10189    }
10190
10191    /// `TOLERANCE_ZONE_DEFINITION` — strict AP242 constructor.
10192    pub fn add_tolerance_zone_definition(
10193        &mut self,
10194        zone: ToleranceZoneRef,
10195        boundaries: Vec<ShapeAspectRef>,
10196    ) -> Result<ToleranceZoneDefinitionId, AuthorError> {
10197        check_tolerance_zone_ref(&self.model, &zone)?;
10198        for e0 in &boundaries {
10199            check_shape_aspect_ref(&self.model, e0)?;
10200        }
10201        Ok(ToleranceZoneDefinitionId(
10202            self.model
10203                .tolerance_zone_definition_arena
10204                .push(ToleranceZoneDefinition { zone, boundaries }),
10205        ))
10206    }
10207
10208    /// `TOLERANCE_ZONE_FORM` — strict AP242 constructor.
10209    pub fn add_tolerance_zone_form(
10210        &mut self,
10211        name: String,
10212    ) -> Result<ToleranceZoneFormId, AuthorError> {
10213        Ok(ToleranceZoneFormId(
10214            self.model
10215                .tolerance_zone_form_arena
10216                .push(ToleranceZoneForm { name }),
10217        ))
10218    }
10219
10220    /// `TOLERANCE_ZONE_WITH_DATUM` — strict AP242 constructor.
10221    pub fn add_tolerance_zone_with_datum(
10222        &mut self,
10223        name: String,
10224        description: Option<String>,
10225        of_shape: ProductDefinitionShapeRef,
10226        product_definitional: Logical,
10227        defining_tolerance: Vec<ToleranceZoneTargetRef>,
10228        form: ToleranceZoneFormRef,
10229        datum_reference: DatumSystemRef,
10230    ) -> Result<ToleranceZoneWithDatumId, AuthorError> {
10231        check_product_definition_shape_ref(&self.model, &of_shape)?;
10232        {
10233            let x = &defining_tolerance;
10234            if x.len() < 1 {
10235                return Err(AuthorError::Cardinality {
10236                    entity: "TOLERANCE_ZONE_WITH_DATUM",
10237                    attribute: "defining_tolerance",
10238                    got: x.len(),
10239                    min: 1,
10240                    max: None,
10241                });
10242            }
10243        }
10244        for e0 in &defining_tolerance {
10245            check_tolerance_zone_target_ref(&self.model, e0)?;
10246        }
10247        check_tolerance_zone_form_ref(&self.model, &form)?;
10248        check_datum_system_ref(&self.model, &datum_reference)?;
10249        Ok(ToleranceZoneWithDatumId(
10250            self.model
10251                .tolerance_zone_with_datum_arena
10252                .push(ToleranceZoneWithDatum {
10253                    name,
10254                    description,
10255                    of_shape,
10256                    product_definitional,
10257                    defining_tolerance,
10258                    form,
10259                    datum_reference,
10260                }),
10261        ))
10262    }
10263
10264    /// `TOPOLOGICAL_REPRESENTATION_ITEM` — strict AP242 constructor.
10265    pub fn add_topological_representation_item(
10266        &mut self,
10267        name: String,
10268    ) -> Result<TopologicalRepresentationItemId, AuthorError> {
10269        Ok(TopologicalRepresentationItemId(
10270            self.model
10271                .topological_representation_item_arena
10272                .push(TopologicalRepresentationItem { name }),
10273        ))
10274    }
10275
10276    /// `TOROIDAL_SURFACE` — strict AP242 constructor.
10277    pub fn add_toroidal_surface(
10278        &mut self,
10279        name: String,
10280        position: Axis2Placement3dRef,
10281        major_radius: f64,
10282        minor_radius: f64,
10283    ) -> Result<ToroidalSurfaceId, AuthorError> {
10284        check_axis2_placement3d_ref(&self.model, &position)?;
10285        Ok(ToroidalSurfaceId(self.model.toroidal_surface_arena.push(
10286            ToroidalSurface {
10287                name,
10288                position,
10289                major_radius,
10290                minor_radius,
10291            },
10292        )))
10293    }
10294
10295    /// `TOTAL_RUNOUT_TOLERANCE` — strict AP242 constructor.
10296    pub fn add_total_runout_tolerance(
10297        &mut self,
10298        name: String,
10299        description: Option<String>,
10300        magnitude: Option<LengthMeasureWithUnitRef>,
10301        toleranced_shape_aspect: GeometricToleranceTargetRef,
10302        datum_system: Vec<DatumSystemOrReferenceRef>,
10303    ) -> Result<TotalRunoutToleranceId, AuthorError> {
10304        if let Some(x) = &magnitude {
10305            check_length_measure_with_unit_ref(&self.model, x)?;
10306        }
10307        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
10308        {
10309            let x = &datum_system;
10310            if x.len() < 1 {
10311                return Err(AuthorError::Cardinality {
10312                    entity: "TOTAL_RUNOUT_TOLERANCE",
10313                    attribute: "datum_system",
10314                    got: x.len(),
10315                    min: 1,
10316                    max: None,
10317                });
10318            }
10319        }
10320        for e0 in &datum_system {
10321            check_datum_system_or_reference_ref(&self.model, e0)?;
10322        }
10323        Ok(TotalRunoutToleranceId(
10324            self.model
10325                .total_runout_tolerance_arena
10326                .push(TotalRunoutTolerance {
10327                    name,
10328                    description,
10329                    magnitude,
10330                    toleranced_shape_aspect,
10331                    datum_system,
10332                }),
10333        ))
10334    }
10335
10336    /// `TRIMMED_CURVE` — strict AP242 constructor.
10337    pub fn add_trimmed_curve(
10338        &mut self,
10339        name: String,
10340        basis_curve: CurveRef,
10341        trim_1: Vec<TrimmingSelectRef>,
10342        trim_2: Vec<TrimmingSelectRef>,
10343        sense_agreement: bool,
10344        master_representation: TrimmingPreference,
10345    ) -> Result<TrimmedCurveId, AuthorError> {
10346        check_curve_ref(&self.model, &basis_curve)?;
10347        {
10348            let x = &trim_1;
10349            if x.len() < 1 || x.len() > 2 {
10350                return Err(AuthorError::Cardinality {
10351                    entity: "TRIMMED_CURVE",
10352                    attribute: "trim_1",
10353                    got: x.len(),
10354                    min: 1,
10355                    max: Some(2),
10356                });
10357            }
10358        }
10359        for e0 in &trim_1 {
10360            check_trimming_select_ref(&self.model, e0)?;
10361        }
10362        {
10363            let x = &trim_2;
10364            if x.len() < 1 || x.len() > 2 {
10365                return Err(AuthorError::Cardinality {
10366                    entity: "TRIMMED_CURVE",
10367                    attribute: "trim_2",
10368                    got: x.len(),
10369                    min: 1,
10370                    max: Some(2),
10371                });
10372            }
10373        }
10374        for e0 in &trim_2 {
10375            check_trimming_select_ref(&self.model, e0)?;
10376        }
10377        Ok(TrimmedCurveId(self.model.trimmed_curve_arena.push(
10378            TrimmedCurve {
10379                name,
10380                basis_curve,
10381                trim_1,
10382                trim_2,
10383                sense_agreement,
10384                master_representation,
10385            },
10386        )))
10387    }
10388
10389    /// `TWO_DIRECTION_REPEAT_FACTOR` — strict AP242 constructor.
10390    pub fn add_two_direction_repeat_factor(
10391        &mut self,
10392        name: String,
10393        repeat_factor: VectorRef,
10394        second_repeat_factor: VectorRef,
10395    ) -> Result<TwoDirectionRepeatFactorId, AuthorError> {
10396        check_vector_ref(&self.model, &repeat_factor)?;
10397        check_vector_ref(&self.model, &second_repeat_factor)?;
10398        Ok(TwoDirectionRepeatFactorId(
10399            self.model
10400                .two_direction_repeat_factor_arena
10401                .push(TwoDirectionRepeatFactor {
10402                    name,
10403                    repeat_factor,
10404                    second_repeat_factor,
10405                }),
10406        ))
10407    }
10408
10409    /// `TYPE_QUALIFIER` — strict AP242 constructor.
10410    pub fn add_type_qualifier(&mut self, name: String) -> Result<TypeQualifierId, AuthorError> {
10411        Ok(TypeQualifierId(
10412            self.model.type_qualifier_arena.push(TypeQualifier { name }),
10413        ))
10414    }
10415
10416    /// `UNCERTAINTY_MEASURE_WITH_UNIT` — strict AP242 constructor.
10417    pub fn add_uncertainty_measure_with_unit(
10418        &mut self,
10419        value_component: MeasureValue,
10420        unit_component: UnitRef,
10421        name: String,
10422        description: Option<String>,
10423    ) -> Result<UncertaintyMeasureWithUnitId, AuthorError> {
10424        check_unit_ref(&self.model, &unit_component)?;
10425        Ok(UncertaintyMeasureWithUnitId(
10426            self.model
10427                .uncertainty_measure_with_unit_arena
10428                .push(UncertaintyMeasureWithUnit {
10429                    value_component,
10430                    unit_component,
10431                    name,
10432                    description,
10433                }),
10434        ))
10435    }
10436
10437    /// `UNCERTAINTY_QUALIFIER` — strict AP242 constructor.
10438    pub fn add_uncertainty_qualifier(
10439        &mut self,
10440        measure_name: String,
10441        description: String,
10442    ) -> Result<UncertaintyQualifierId, AuthorError> {
10443        Ok(UncertaintyQualifierId(
10444            self.model
10445                .uncertainty_qualifier_arena
10446                .push(UncertaintyQualifier {
10447                    measure_name,
10448                    description,
10449                }),
10450        ))
10451    }
10452
10453    /// `UNEQUALLY_DISPOSED_GEOMETRIC_TOLERANCE` — strict AP242 constructor.
10454    pub fn add_unequally_disposed_geometric_tolerance(
10455        &mut self,
10456        name: String,
10457        description: Option<String>,
10458        magnitude: Option<LengthMeasureWithUnitRef>,
10459        toleranced_shape_aspect: GeometricToleranceTargetRef,
10460        displacement: LengthMeasureWithUnitRef,
10461    ) -> Result<UnequallyDisposedGeometricToleranceId, AuthorError> {
10462        if let Some(x) = &magnitude {
10463            check_length_measure_with_unit_ref(&self.model, x)?;
10464        }
10465        check_geometric_tolerance_target_ref(&self.model, &toleranced_shape_aspect)?;
10466        check_length_measure_with_unit_ref(&self.model, &displacement)?;
10467        Ok(UnequallyDisposedGeometricToleranceId(
10468            self.model
10469                .unequally_disposed_geometric_tolerance_arena
10470                .push(UnequallyDisposedGeometricTolerance {
10471                    name,
10472                    description,
10473                    magnitude,
10474                    toleranced_shape_aspect,
10475                    displacement,
10476                }),
10477        ))
10478    }
10479
10480    /// `UNIFORM_CURVE` — strict AP242 constructor.
10481    pub fn add_uniform_curve(
10482        &mut self,
10483        name: String,
10484        degree: i64,
10485        control_points_list: Vec<CartesianPointRef>,
10486        curve_form: BSplineCurveForm,
10487        closed_curve: Logical,
10488        self_intersect: Logical,
10489    ) -> Result<UniformCurveId, AuthorError> {
10490        {
10491            let x = &control_points_list;
10492            if x.len() < 2 {
10493                return Err(AuthorError::Cardinality {
10494                    entity: "UNIFORM_CURVE",
10495                    attribute: "control_points_list",
10496                    got: x.len(),
10497                    min: 2,
10498                    max: None,
10499                });
10500            }
10501        }
10502        for e0 in &control_points_list {
10503            check_cartesian_point_ref(&self.model, e0)?;
10504        }
10505        Ok(UniformCurveId(self.model.uniform_curve_arena.push(
10506            UniformCurve {
10507                name,
10508                degree,
10509                control_points_list,
10510                curve_form,
10511                closed_curve,
10512                self_intersect,
10513            },
10514        )))
10515    }
10516
10517    /// `UNIFORM_SURFACE` — strict AP242 constructor.
10518    pub fn add_uniform_surface(
10519        &mut self,
10520        name: String,
10521        u_degree: i64,
10522        v_degree: i64,
10523        control_points_list: Vec<Vec<CartesianPointRef>>,
10524        surface_form: BSplineSurfaceForm,
10525        u_closed: Logical,
10526        v_closed: Logical,
10527        self_intersect: Logical,
10528    ) -> Result<UniformSurfaceId, AuthorError> {
10529        {
10530            let x = &control_points_list;
10531            if x.len() < 2 {
10532                return Err(AuthorError::Cardinality {
10533                    entity: "UNIFORM_SURFACE",
10534                    attribute: "control_points_list",
10535                    got: x.len(),
10536                    min: 2,
10537                    max: None,
10538                });
10539            }
10540        }
10541        for e0 in &control_points_list {
10542            for e1 in e0 {
10543                check_cartesian_point_ref(&self.model, e1)?;
10544            }
10545        }
10546        Ok(UniformSurfaceId(self.model.uniform_surface_arena.push(
10547            UniformSurface {
10548                name,
10549                u_degree,
10550                v_degree,
10551                control_points_list,
10552                surface_form,
10553                u_closed,
10554                v_closed,
10555                self_intersect,
10556            },
10557        )))
10558    }
10559
10560    /// `VALUE_FORMAT_TYPE_QUALIFIER` — strict AP242 constructor.
10561    pub fn add_value_format_type_qualifier(
10562        &mut self,
10563        format_type: String,
10564    ) -> Result<ValueFormatTypeQualifierId, AuthorError> {
10565        Ok(ValueFormatTypeQualifierId(
10566            self.model
10567                .value_format_type_qualifier_arena
10568                .push(ValueFormatTypeQualifier { format_type }),
10569        ))
10570    }
10571
10572    /// `VALUE_REPRESENTATION_ITEM` — strict AP242 constructor.
10573    pub fn add_value_representation_item(
10574        &mut self,
10575        name: String,
10576        value_component: MeasureValue,
10577    ) -> Result<ValueRepresentationItemId, AuthorError> {
10578        Ok(ValueRepresentationItemId(
10579            self.model
10580                .value_representation_item_arena
10581                .push(ValueRepresentationItem {
10582                    name,
10583                    value_component,
10584                }),
10585        ))
10586    }
10587
10588    /// `VECTOR` — strict AP242 constructor.
10589    pub fn add_vector(
10590        &mut self,
10591        name: String,
10592        orientation: DirectionRef,
10593        magnitude: f64,
10594    ) -> Result<VectorId, AuthorError> {
10595        check_direction_ref(&self.model, &orientation)?;
10596        Ok(VectorId(self.model.vector_arena.push(Vector {
10597            name,
10598            orientation,
10599            magnitude,
10600        })))
10601    }
10602
10603    /// `VERSIONED_ACTION_REQUEST` — strict AP242 constructor.
10604    pub fn add_versioned_action_request(
10605        &mut self,
10606        id: String,
10607        version: Option<String>,
10608        purpose: String,
10609        description: Option<String>,
10610    ) -> Result<VersionedActionRequestId, AuthorError> {
10611        Ok(VersionedActionRequestId(
10612            self.model
10613                .versioned_action_request_arena
10614                .push(VersionedActionRequest {
10615                    id,
10616                    version,
10617                    purpose,
10618                    description,
10619                }),
10620        ))
10621    }
10622
10623    /// `VERTEX` — strict AP242 constructor.
10624    pub fn add_vertex(&mut self, name: String) -> Result<VertexId, AuthorError> {
10625        Ok(VertexId(self.model.vertex_arena.push(Vertex { name })))
10626    }
10627
10628    /// `VERTEX_LOOP` — strict AP242 constructor.
10629    pub fn add_vertex_loop(
10630        &mut self,
10631        name: String,
10632        loop_vertex: VertexRef,
10633    ) -> Result<VertexLoopId, AuthorError> {
10634        check_vertex_ref(&self.model, &loop_vertex)?;
10635        Ok(VertexLoopId(
10636            self.model
10637                .vertex_loop_arena
10638                .push(VertexLoop { name, loop_vertex }),
10639        ))
10640    }
10641
10642    /// `VERTEX_POINT` — strict AP242 constructor.
10643    pub fn add_vertex_point(
10644        &mut self,
10645        name: String,
10646        vertex_geometry: PointRef,
10647    ) -> Result<VertexPointId, AuthorError> {
10648        check_point_ref(&self.model, &vertex_geometry)?;
10649        Ok(VertexPointId(self.model.vertex_point_arena.push(
10650            VertexPoint {
10651                name,
10652                vertex_geometry,
10653            },
10654        )))
10655    }
10656
10657    /// `VERTEX_SHELL` — strict AP242 constructor.
10658    pub fn add_vertex_shell(
10659        &mut self,
10660        name: String,
10661        vertex_shell_extent: VertexLoopRef,
10662    ) -> Result<VertexShellId, AuthorError> {
10663        check_vertex_loop_ref(&self.model, &vertex_shell_extent)?;
10664        Ok(VertexShellId(self.model.vertex_shell_arena.push(
10665            VertexShell {
10666                name,
10667                vertex_shell_extent,
10668            },
10669        )))
10670    }
10671
10672    /// `VIEW_VOLUME` — strict AP242 constructor.
10673    pub fn add_view_volume(
10674        &mut self,
10675        projection_type: CentralOrParallel,
10676        projection_point: CartesianPointRef,
10677        view_plane_distance: f64,
10678        front_plane_distance: f64,
10679        front_plane_clipping: bool,
10680        back_plane_distance: f64,
10681        back_plane_clipping: bool,
10682        view_volume_sides_clipping: bool,
10683        view_window: PlanarBoxRef,
10684    ) -> Result<ViewVolumeId, AuthorError> {
10685        check_cartesian_point_ref(&self.model, &projection_point)?;
10686        check_planar_box_ref(&self.model, &view_window)?;
10687        Ok(ViewVolumeId(self.model.view_volume_arena.push(
10688            ViewVolume {
10689                projection_type,
10690                projection_point,
10691                view_plane_distance,
10692                front_plane_distance,
10693                front_plane_clipping,
10694                back_plane_distance,
10695                back_plane_clipping,
10696                view_volume_sides_clipping,
10697                view_window,
10698            },
10699        )))
10700    }
10701
10702    /// `VOLUME_UNIT` — strict AP242 constructor.
10703    pub fn add_volume_unit(
10704        &mut self,
10705        elements: Vec<DerivedUnitElementRef>,
10706    ) -> Result<VolumeUnitId, AuthorError> {
10707        {
10708            let x = &elements;
10709            if x.len() < 1 {
10710                return Err(AuthorError::Cardinality {
10711                    entity: "VOLUME_UNIT",
10712                    attribute: "elements",
10713                    got: x.len(),
10714                    min: 1,
10715                    max: None,
10716                });
10717            }
10718        }
10719        for e0 in &elements {
10720            check_derived_unit_element_ref(&self.model, e0)?;
10721        }
10722        Ok(VolumeUnitId(
10723            self.model.volume_unit_arena.push(VolumeUnit { elements }),
10724        ))
10725    }
10726
10727    /// `WIRE_SHELL` — strict AP242 constructor.
10728    pub fn add_wire_shell(
10729        &mut self,
10730        name: String,
10731        wire_shell_extent: Vec<LoopRef>,
10732    ) -> Result<WireShellId, AuthorError> {
10733        {
10734            let x = &wire_shell_extent;
10735            if x.len() < 1 {
10736                return Err(AuthorError::Cardinality {
10737                    entity: "WIRE_SHELL",
10738                    attribute: "wire_shell_extent",
10739                    got: x.len(),
10740                    min: 1,
10741                    max: None,
10742                });
10743            }
10744        }
10745        for e0 in &wire_shell_extent {
10746            check_loop_ref(&self.model, e0)?;
10747        }
10748        Ok(WireShellId(self.model.wire_shell_arena.push(WireShell {
10749            name,
10750            wire_shell_extent,
10751        })))
10752    }
10753
10754    /// `ANNOTATION_PLACEHOLDER_OCCURRENCE` — self-referencing variant: the closure receives the id
10755    /// this entity will get, so a field may reference the entity itself.
10756    /// Validation runs after insertion; on error the insertion is rolled back.
10757    pub fn add_annotation_placeholder_occurrence_cyclic(
10758        &mut self,
10759        build: impl FnOnce(AnnotationPlaceholderOccurrenceId) -> AnnotationPlaceholderOccurrence,
10760    ) -> Result<AnnotationPlaceholderOccurrenceId, AuthorError> {
10761        let id = AnnotationPlaceholderOccurrenceId(
10762            self.model
10763                .annotation_placeholder_occurrence_arena
10764                .items
10765                .len(),
10766        );
10767        self.model
10768            .annotation_placeholder_occurrence_arena
10769            .push(build(id));
10770        if let Err(e) = cyclic_check_annotation_placeholder_occurrence(&self.model, id.0) {
10771            self.model
10772                .annotation_placeholder_occurrence_arena
10773                .items
10774                .pop();
10775            return Err(e);
10776        }
10777        Ok(id)
10778    }
10779
10780    /// `ANNOTATION_PLANE` — self-referencing variant: the closure receives the id
10781    /// this entity will get, so a field may reference the entity itself.
10782    /// Validation runs after insertion; on error the insertion is rolled back.
10783    pub fn add_annotation_plane_cyclic(
10784        &mut self,
10785        build: impl FnOnce(AnnotationPlaneId) -> AnnotationPlane,
10786    ) -> Result<AnnotationPlaneId, AuthorError> {
10787        let id = AnnotationPlaneId(self.model.annotation_plane_arena.items.len());
10788        self.model.annotation_plane_arena.push(build(id));
10789        if let Err(e) = cyclic_check_annotation_plane(&self.model, id.0) {
10790            self.model.annotation_plane_arena.items.pop();
10791            return Err(e);
10792        }
10793        Ok(id)
10794    }
10795
10796    /// `ANNOTATION_SYMBOL` — self-referencing variant: the closure receives the id
10797    /// this entity will get, so a field may reference the entity itself.
10798    /// Validation runs after insertion; on error the insertion is rolled back.
10799    pub fn add_annotation_symbol_cyclic(
10800        &mut self,
10801        build: impl FnOnce(AnnotationSymbolId) -> AnnotationSymbol,
10802    ) -> Result<AnnotationSymbolId, AuthorError> {
10803        let id = AnnotationSymbolId(self.model.annotation_symbol_arena.items.len());
10804        self.model.annotation_symbol_arena.push(build(id));
10805        if let Err(e) = cyclic_check_annotation_symbol(&self.model, id.0) {
10806            self.model.annotation_symbol_arena.items.pop();
10807            return Err(e);
10808        }
10809        Ok(id)
10810    }
10811
10812    /// `APPLIED_APPROVAL_ASSIGNMENT` — self-referencing variant: the closure receives the id
10813    /// this entity will get, so a field may reference the entity itself.
10814    /// Validation runs after insertion; on error the insertion is rolled back.
10815    pub fn add_applied_approval_assignment_cyclic(
10816        &mut self,
10817        build: impl FnOnce(AppliedApprovalAssignmentId) -> AppliedApprovalAssignment,
10818    ) -> Result<AppliedApprovalAssignmentId, AuthorError> {
10819        let id =
10820            AppliedApprovalAssignmentId(self.model.applied_approval_assignment_arena.items.len());
10821        self.model.applied_approval_assignment_arena.push(build(id));
10822        if let Err(e) = cyclic_check_applied_approval_assignment(&self.model, id.0) {
10823            self.model.applied_approval_assignment_arena.items.pop();
10824            return Err(e);
10825        }
10826        Ok(id)
10827    }
10828
10829    /// `APPLIED_DATE_AND_TIME_ASSIGNMENT` — self-referencing variant: the closure receives the id
10830    /// this entity will get, so a field may reference the entity itself.
10831    /// Validation runs after insertion; on error the insertion is rolled back.
10832    pub fn add_applied_date_and_time_assignment_cyclic(
10833        &mut self,
10834        build: impl FnOnce(AppliedDateAndTimeAssignmentId) -> AppliedDateAndTimeAssignment,
10835    ) -> Result<AppliedDateAndTimeAssignmentId, AuthorError> {
10836        let id = AppliedDateAndTimeAssignmentId(
10837            self.model
10838                .applied_date_and_time_assignment_arena
10839                .items
10840                .len(),
10841        );
10842        self.model
10843            .applied_date_and_time_assignment_arena
10844            .push(build(id));
10845        if let Err(e) = cyclic_check_applied_date_and_time_assignment(&self.model, id.0) {
10846            self.model
10847                .applied_date_and_time_assignment_arena
10848                .items
10849                .pop();
10850            return Err(e);
10851        }
10852        Ok(id)
10853    }
10854
10855    /// `APPLIED_DOCUMENT_REFERENCE` — self-referencing variant: the closure receives the id
10856    /// this entity will get, so a field may reference the entity itself.
10857    /// Validation runs after insertion; on error the insertion is rolled back.
10858    pub fn add_applied_document_reference_cyclic(
10859        &mut self,
10860        build: impl FnOnce(AppliedDocumentReferenceId) -> AppliedDocumentReference,
10861    ) -> Result<AppliedDocumentReferenceId, AuthorError> {
10862        let id =
10863            AppliedDocumentReferenceId(self.model.applied_document_reference_arena.items.len());
10864        self.model.applied_document_reference_arena.push(build(id));
10865        if let Err(e) = cyclic_check_applied_document_reference(&self.model, id.0) {
10866            self.model.applied_document_reference_arena.items.pop();
10867            return Err(e);
10868        }
10869        Ok(id)
10870    }
10871
10872    /// `APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT` — self-referencing variant: the closure receives the id
10873    /// this entity will get, so a field may reference the entity itself.
10874    /// Validation runs after insertion; on error the insertion is rolled back.
10875    pub fn add_applied_external_identification_assignment_cyclic(
10876        &mut self,
10877        build: impl FnOnce(
10878            AppliedExternalIdentificationAssignmentId,
10879        ) -> AppliedExternalIdentificationAssignment,
10880    ) -> Result<AppliedExternalIdentificationAssignmentId, AuthorError> {
10881        let id = AppliedExternalIdentificationAssignmentId(
10882            self.model
10883                .applied_external_identification_assignment_arena
10884                .items
10885                .len(),
10886        );
10887        self.model
10888            .applied_external_identification_assignment_arena
10889            .push(build(id));
10890        if let Err(e) = cyclic_check_applied_external_identification_assignment(&self.model, id.0) {
10891            self.model
10892                .applied_external_identification_assignment_arena
10893                .items
10894                .pop();
10895            return Err(e);
10896        }
10897        Ok(id)
10898    }
10899
10900    /// `APPLIED_GROUP_ASSIGNMENT` — self-referencing variant: the closure receives the id
10901    /// this entity will get, so a field may reference the entity itself.
10902    /// Validation runs after insertion; on error the insertion is rolled back.
10903    pub fn add_applied_group_assignment_cyclic(
10904        &mut self,
10905        build: impl FnOnce(AppliedGroupAssignmentId) -> AppliedGroupAssignment,
10906    ) -> Result<AppliedGroupAssignmentId, AuthorError> {
10907        let id = AppliedGroupAssignmentId(self.model.applied_group_assignment_arena.items.len());
10908        self.model.applied_group_assignment_arena.push(build(id));
10909        if let Err(e) = cyclic_check_applied_group_assignment(&self.model, id.0) {
10910            self.model.applied_group_assignment_arena.items.pop();
10911            return Err(e);
10912        }
10913        Ok(id)
10914    }
10915
10916    /// `APPLIED_PERSON_AND_ORGANIZATION_ASSIGNMENT` — self-referencing variant: the closure receives the id
10917    /// this entity will get, so a field may reference the entity itself.
10918    /// Validation runs after insertion; on error the insertion is rolled back.
10919    pub fn add_applied_person_and_organization_assignment_cyclic(
10920        &mut self,
10921        build: impl FnOnce(
10922            AppliedPersonAndOrganizationAssignmentId,
10923        ) -> AppliedPersonAndOrganizationAssignment,
10924    ) -> Result<AppliedPersonAndOrganizationAssignmentId, AuthorError> {
10925        let id = AppliedPersonAndOrganizationAssignmentId(
10926            self.model
10927                .applied_person_and_organization_assignment_arena
10928                .items
10929                .len(),
10930        );
10931        self.model
10932            .applied_person_and_organization_assignment_arena
10933            .push(build(id));
10934        if let Err(e) = cyclic_check_applied_person_and_organization_assignment(&self.model, id.0) {
10935            self.model
10936                .applied_person_and_organization_assignment_arena
10937                .items
10938                .pop();
10939            return Err(e);
10940        }
10941        Ok(id)
10942    }
10943
10944    /// `BOUNDED_SURFACE_CURVE` — self-referencing variant: the closure receives the id
10945    /// this entity will get, so a field may reference the entity itself.
10946    /// Validation runs after insertion; on error the insertion is rolled back.
10947    pub fn add_bounded_surface_curve_cyclic(
10948        &mut self,
10949        build: impl FnOnce(BoundedSurfaceCurveId) -> BoundedSurfaceCurve,
10950    ) -> Result<BoundedSurfaceCurveId, AuthorError> {
10951        let id = BoundedSurfaceCurveId(self.model.bounded_surface_curve_arena.items.len());
10952        self.model.bounded_surface_curve_arena.push(build(id));
10953        if let Err(e) = cyclic_check_bounded_surface_curve(&self.model, id.0) {
10954            self.model.bounded_surface_curve_arena.items.pop();
10955            return Err(e);
10956        }
10957        Ok(id)
10958    }
10959
10960    /// `CAMERA_IMAGE` — self-referencing variant: the closure receives the id
10961    /// this entity will get, so a field may reference the entity itself.
10962    /// Validation runs after insertion; on error the insertion is rolled back.
10963    pub fn add_camera_image_cyclic(
10964        &mut self,
10965        build: impl FnOnce(CameraImageId) -> CameraImage,
10966    ) -> Result<CameraImageId, AuthorError> {
10967        let id = CameraImageId(self.model.camera_image_arena.items.len());
10968        self.model.camera_image_arena.push(build(id));
10969        if let Err(e) = cyclic_check_camera_image(&self.model, id.0) {
10970            self.model.camera_image_arena.items.pop();
10971            return Err(e);
10972        }
10973        Ok(id)
10974    }
10975
10976    /// `CAMERA_IMAGE_3D_WITH_SCALE` — self-referencing variant: the closure receives the id
10977    /// this entity will get, so a field may reference the entity itself.
10978    /// Validation runs after insertion; on error the insertion is rolled back.
10979    pub fn add_camera_image3d_with_scale_cyclic(
10980        &mut self,
10981        build: impl FnOnce(CameraImage3dWithScaleId) -> CameraImage3dWithScale,
10982    ) -> Result<CameraImage3dWithScaleId, AuthorError> {
10983        let id = CameraImage3dWithScaleId(self.model.camera_image3d_with_scale_arena.items.len());
10984        self.model.camera_image3d_with_scale_arena.push(build(id));
10985        if let Err(e) = cyclic_check_camera_image3d_with_scale(&self.model, id.0) {
10986            self.model.camera_image3d_with_scale_arena.items.pop();
10987            return Err(e);
10988        }
10989        Ok(id)
10990    }
10991
10992    /// `COMPOSITE_TEXT` — self-referencing variant: the closure receives the id
10993    /// this entity will get, so a field may reference the entity itself.
10994    /// Validation runs after insertion; on error the insertion is rolled back.
10995    pub fn add_composite_text_cyclic(
10996        &mut self,
10997        build: impl FnOnce(CompositeTextId) -> CompositeText,
10998    ) -> Result<CompositeTextId, AuthorError> {
10999        let id = CompositeTextId(self.model.composite_text_arena.items.len());
11000        self.model.composite_text_arena.push(build(id));
11001        if let Err(e) = cyclic_check_composite_text(&self.model, id.0) {
11002            self.model.composite_text_arena.items.pop();
11003            return Err(e);
11004        }
11005        Ok(id)
11006    }
11007
11008    /// `COMPOUND_REPRESENTATION_ITEM` — self-referencing variant: the closure receives the id
11009    /// this entity will get, so a field may reference the entity itself.
11010    /// Validation runs after insertion; on error the insertion is rolled back.
11011    pub fn add_compound_representation_item_cyclic(
11012        &mut self,
11013        build: impl FnOnce(CompoundRepresentationItemId) -> CompoundRepresentationItem,
11014    ) -> Result<CompoundRepresentationItemId, AuthorError> {
11015        let id =
11016            CompoundRepresentationItemId(self.model.compound_representation_item_arena.items.len());
11017        self.model
11018            .compound_representation_item_arena
11019            .push(build(id));
11020        if let Err(e) = cyclic_check_compound_representation_item(&self.model, id.0) {
11021            self.model.compound_representation_item_arena.items.pop();
11022            return Err(e);
11023        }
11024        Ok(id)
11025    }
11026
11027    /// `CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM` — self-referencing variant: the closure receives the id
11028    /// this entity will get, so a field may reference the entity itself.
11029    /// Validation runs after insertion; on error the insertion is rolled back.
11030    pub fn add_context_dependent_over_riding_styled_item_cyclic(
11031        &mut self,
11032        build: impl FnOnce(
11033            ContextDependentOverRidingStyledItemId,
11034        ) -> ContextDependentOverRidingStyledItem,
11035    ) -> Result<ContextDependentOverRidingStyledItemId, AuthorError> {
11036        let id = ContextDependentOverRidingStyledItemId(
11037            self.model
11038                .context_dependent_over_riding_styled_item_arena
11039                .items
11040                .len(),
11041        );
11042        self.model
11043            .context_dependent_over_riding_styled_item_arena
11044            .push(build(id));
11045        if let Err(e) = cyclic_check_context_dependent_over_riding_styled_item(&self.model, id.0) {
11046            self.model
11047                .context_dependent_over_riding_styled_item_arena
11048                .items
11049                .pop();
11050            return Err(e);
11051        }
11052        Ok(id)
11053    }
11054
11055    /// `DATUM_REFERENCE_ELEMENT` — self-referencing variant: the closure receives the id
11056    /// this entity will get, so a field may reference the entity itself.
11057    /// Validation runs after insertion; on error the insertion is rolled back.
11058    pub fn add_datum_reference_element_cyclic(
11059        &mut self,
11060        build: impl FnOnce(DatumReferenceElementId) -> DatumReferenceElement,
11061    ) -> Result<DatumReferenceElementId, AuthorError> {
11062        let id = DatumReferenceElementId(self.model.datum_reference_element_arena.items.len());
11063        self.model.datum_reference_element_arena.push(build(id));
11064        if let Err(e) = cyclic_check_datum_reference_element(&self.model, id.0) {
11065            self.model.datum_reference_element_arena.items.pop();
11066            return Err(e);
11067        }
11068        Ok(id)
11069    }
11070
11071    /// `DIMENSIONAL_SIZE_WITH_DATUM_FEATURE` — self-referencing variant: the closure receives the id
11072    /// this entity will get, so a field may reference the entity itself.
11073    /// Validation runs after insertion; on error the insertion is rolled back.
11074    pub fn add_dimensional_size_with_datum_feature_cyclic(
11075        &mut self,
11076        build: impl FnOnce(DimensionalSizeWithDatumFeatureId) -> DimensionalSizeWithDatumFeature,
11077    ) -> Result<DimensionalSizeWithDatumFeatureId, AuthorError> {
11078        let id = DimensionalSizeWithDatumFeatureId(
11079            self.model
11080                .dimensional_size_with_datum_feature_arena
11081                .items
11082                .len(),
11083        );
11084        self.model
11085            .dimensional_size_with_datum_feature_arena
11086            .push(build(id));
11087        if let Err(e) = cyclic_check_dimensional_size_with_datum_feature(&self.model, id.0) {
11088            self.model
11089                .dimensional_size_with_datum_feature_arena
11090                .items
11091                .pop();
11092            return Err(e);
11093        }
11094        Ok(id)
11095    }
11096
11097    /// `INTERSECTION_CURVE` — self-referencing variant: the closure receives the id
11098    /// this entity will get, so a field may reference the entity itself.
11099    /// Validation runs after insertion; on error the insertion is rolled back.
11100    pub fn add_intersection_curve_cyclic(
11101        &mut self,
11102        build: impl FnOnce(IntersectionCurveId) -> IntersectionCurve,
11103    ) -> Result<IntersectionCurveId, AuthorError> {
11104        let id = IntersectionCurveId(self.model.intersection_curve_arena.items.len());
11105        self.model.intersection_curve_arena.push(build(id));
11106        if let Err(e) = cyclic_check_intersection_curve(&self.model, id.0) {
11107            self.model.intersection_curve_arena.items.pop();
11108            return Err(e);
11109        }
11110        Ok(id)
11111    }
11112
11113    /// `MAPPED_ITEM` — self-referencing variant: the closure receives the id
11114    /// this entity will get, so a field may reference the entity itself.
11115    /// Validation runs after insertion; on error the insertion is rolled back.
11116    pub fn add_mapped_item_cyclic(
11117        &mut self,
11118        build: impl FnOnce(MappedItemId) -> MappedItem,
11119    ) -> Result<MappedItemId, AuthorError> {
11120        let id = MappedItemId(self.model.mapped_item_arena.items.len());
11121        self.model.mapped_item_arena.push(build(id));
11122        if let Err(e) = cyclic_check_mapped_item(&self.model, id.0) {
11123            self.model.mapped_item_arena.items.pop();
11124            return Err(e);
11125        }
11126        Ok(id)
11127    }
11128
11129    /// `OFFSET_SURFACE` — self-referencing variant: the closure receives the id
11130    /// this entity will get, so a field may reference the entity itself.
11131    /// Validation runs after insertion; on error the insertion is rolled back.
11132    pub fn add_offset_surface_cyclic(
11133        &mut self,
11134        build: impl FnOnce(OffsetSurfaceId) -> OffsetSurface,
11135    ) -> Result<OffsetSurfaceId, AuthorError> {
11136        let id = OffsetSurfaceId(self.model.offset_surface_arena.items.len());
11137        self.model.offset_surface_arena.push(build(id));
11138        if let Err(e) = cyclic_check_offset_surface(&self.model, id.0) {
11139            self.model.offset_surface_arena.items.pop();
11140            return Err(e);
11141        }
11142        Ok(id)
11143    }
11144
11145    /// `ORIENTED_CLOSED_SHELL` — self-referencing variant: the closure receives the id
11146    /// this entity will get, so a field may reference the entity itself.
11147    /// Validation runs after insertion; on error the insertion is rolled back.
11148    pub fn add_oriented_closed_shell_cyclic(
11149        &mut self,
11150        build: impl FnOnce(OrientedClosedShellId) -> OrientedClosedShell,
11151    ) -> Result<OrientedClosedShellId, AuthorError> {
11152        let id = OrientedClosedShellId(self.model.oriented_closed_shell_arena.items.len());
11153        self.model.oriented_closed_shell_arena.push(build(id));
11154        if let Err(e) = cyclic_check_oriented_closed_shell(&self.model, id.0) {
11155            self.model.oriented_closed_shell_arena.items.pop();
11156            return Err(e);
11157        }
11158        Ok(id)
11159    }
11160
11161    /// `ORIENTED_EDGE` — self-referencing variant: the closure receives the id
11162    /// this entity will get, so a field may reference the entity itself.
11163    /// Validation runs after insertion; on error the insertion is rolled back.
11164    pub fn add_oriented_edge_cyclic(
11165        &mut self,
11166        build: impl FnOnce(OrientedEdgeId) -> OrientedEdge,
11167    ) -> Result<OrientedEdgeId, AuthorError> {
11168        let id = OrientedEdgeId(self.model.oriented_edge_arena.items.len());
11169        self.model.oriented_edge_arena.push(build(id));
11170        if let Err(e) = cyclic_check_oriented_edge(&self.model, id.0) {
11171            self.model.oriented_edge_arena.items.pop();
11172            return Err(e);
11173        }
11174        Ok(id)
11175    }
11176
11177    /// `OVER_RIDING_STYLED_ITEM` — self-referencing variant: the closure receives the id
11178    /// this entity will get, so a field may reference the entity itself.
11179    /// Validation runs after insertion; on error the insertion is rolled back.
11180    pub fn add_over_riding_styled_item_cyclic(
11181        &mut self,
11182        build: impl FnOnce(OverRidingStyledItemId) -> OverRidingStyledItem,
11183    ) -> Result<OverRidingStyledItemId, AuthorError> {
11184        let id = OverRidingStyledItemId(self.model.over_riding_styled_item_arena.items.len());
11185        self.model.over_riding_styled_item_arena.push(build(id));
11186        if let Err(e) = cyclic_check_over_riding_styled_item(&self.model, id.0) {
11187            self.model.over_riding_styled_item_arena.items.pop();
11188            return Err(e);
11189        }
11190        Ok(id)
11191    }
11192
11193    /// `PRODUCT_DEFINITION_OCCURRENCE` — self-referencing variant: the closure receives the id
11194    /// this entity will get, so a field may reference the entity itself.
11195    /// Validation runs after insertion; on error the insertion is rolled back.
11196    pub fn add_product_definition_occurrence_cyclic(
11197        &mut self,
11198        build: impl FnOnce(ProductDefinitionOccurrenceId) -> ProductDefinitionOccurrence,
11199    ) -> Result<ProductDefinitionOccurrenceId, AuthorError> {
11200        let id = ProductDefinitionOccurrenceId(
11201            self.model.product_definition_occurrence_arena.items.len(),
11202        );
11203        self.model
11204            .product_definition_occurrence_arena
11205            .push(build(id));
11206        if let Err(e) = cyclic_check_product_definition_occurrence(&self.model, id.0) {
11207            self.model.product_definition_occurrence_arena.items.pop();
11208            return Err(e);
11209        }
11210        Ok(id)
11211    }
11212
11213    /// `PRODUCT_DEFINITION_SHAPE` — self-referencing variant: the closure receives the id
11214    /// this entity will get, so a field may reference the entity itself.
11215    /// Validation runs after insertion; on error the insertion is rolled back.
11216    pub fn add_product_definition_shape_cyclic(
11217        &mut self,
11218        build: impl FnOnce(ProductDefinitionShapeId) -> ProductDefinitionShape,
11219    ) -> Result<ProductDefinitionShapeId, AuthorError> {
11220        let id = ProductDefinitionShapeId(self.model.product_definition_shape_arena.items.len());
11221        self.model.product_definition_shape_arena.push(build(id));
11222        if let Err(e) = cyclic_check_product_definition_shape(&self.model, id.0) {
11223            self.model.product_definition_shape_arena.items.pop();
11224            return Err(e);
11225        }
11226        Ok(id)
11227    }
11228
11229    /// `SEAM_CURVE` — self-referencing variant: the closure receives the id
11230    /// this entity will get, so a field may reference the entity itself.
11231    /// Validation runs after insertion; on error the insertion is rolled back.
11232    pub fn add_seam_curve_cyclic(
11233        &mut self,
11234        build: impl FnOnce(SeamCurveId) -> SeamCurve,
11235    ) -> Result<SeamCurveId, AuthorError> {
11236        let id = SeamCurveId(self.model.seam_curve_arena.items.len());
11237        self.model.seam_curve_arena.push(build(id));
11238        if let Err(e) = cyclic_check_seam_curve(&self.model, id.0) {
11239            self.model.seam_curve_arena.items.pop();
11240            return Err(e);
11241        }
11242        Ok(id)
11243    }
11244
11245    /// `SURFACE_CURVE` — self-referencing variant: the closure receives the id
11246    /// this entity will get, so a field may reference the entity itself.
11247    /// Validation runs after insertion; on error the insertion is rolled back.
11248    pub fn add_surface_curve_cyclic(
11249        &mut self,
11250        build: impl FnOnce(SurfaceCurveId) -> SurfaceCurve,
11251    ) -> Result<SurfaceCurveId, AuthorError> {
11252        let id = SurfaceCurveId(self.model.surface_curve_arena.items.len());
11253        self.model.surface_curve_arena.push(build(id));
11254        if let Err(e) = cyclic_check_surface_curve(&self.model, id.0) {
11255            self.model.surface_curve_arena.items.pop();
11256            return Err(e);
11257        }
11258        Ok(id)
11259    }
11260
11261    /// `TESSELLATED_GEOMETRIC_SET` — self-referencing variant: the closure receives the id
11262    /// this entity will get, so a field may reference the entity itself.
11263    /// Validation runs after insertion; on error the insertion is rolled back.
11264    pub fn add_tessellated_geometric_set_cyclic(
11265        &mut self,
11266        build: impl FnOnce(TessellatedGeometricSetId) -> TessellatedGeometricSet,
11267    ) -> Result<TessellatedGeometricSetId, AuthorError> {
11268        let id = TessellatedGeometricSetId(self.model.tessellated_geometric_set_arena.items.len());
11269        self.model.tessellated_geometric_set_arena.push(build(id));
11270        if let Err(e) = cyclic_check_tessellated_geometric_set(&self.model, id.0) {
11271            self.model.tessellated_geometric_set_arena.items.pop();
11272            return Err(e);
11273        }
11274        Ok(id)
11275    }
11276
11277    /// `TRIMMED_CURVE` — self-referencing variant: the closure receives the id
11278    /// this entity will get, so a field may reference the entity itself.
11279    /// Validation runs after insertion; on error the insertion is rolled back.
11280    pub fn add_trimmed_curve_cyclic(
11281        &mut self,
11282        build: impl FnOnce(TrimmedCurveId) -> TrimmedCurve,
11283    ) -> Result<TrimmedCurveId, AuthorError> {
11284        let id = TrimmedCurveId(self.model.trimmed_curve_arena.items.len());
11285        self.model.trimmed_curve_arena.push(build(id));
11286        if let Err(e) = cyclic_check_trimmed_curve(&self.model, id.0) {
11287            self.model.trimmed_curve_arena.items.pop();
11288            return Err(e);
11289        }
11290        Ok(id)
11291    }
11292
11293    /// Complex (multi-part) instance — rule-based strict AP242 assembler.
11294    /// The part-name set is validated by the schema name-set rule (legality,
11295    /// supertype-chain completeness, connectivity, ONEOF exclusivity), then
11296    /// every reference field is checked; parts are stored in Part 21 order
11297    /// (alphabetical).
11298    pub fn add_complex(&mut self, mut parts: Vec<UnitPart>) -> Result<ComplexUnitId, AuthorError> {
11299        let names: Vec<&'static str> = parts.iter().map(part_name).collect();
11300        complex_rule(&names)?;
11301        for p in &parts {
11302            check_unit_part(&self.model, p)?;
11303        }
11304        parts.sort_by(|a, b| part_name(a).cmp(part_name(b)));
11305        Ok(ComplexUnitId(
11306            self.model.complex_unit_arena.push(ComplexUnit { parts }),
11307        ))
11308    }
11309}
11310
11311fn cyclic_check_annotation_placeholder_occurrence(
11312    model: &StepModel,
11313    id: usize,
11314) -> Result<(), AuthorError> {
11315    for e0 in &model.annotation_placeholder_occurrence_arena.items[id].styles {
11316        check_presentation_style_assignment_ref(model, e0)?;
11317    }
11318    check_styled_item_target_ref(
11319        model,
11320        &model.annotation_placeholder_occurrence_arena.items[id].item,
11321    )?;
11322    Ok(())
11323}
11324
11325fn cyclic_check_annotation_plane(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11326    for e0 in &model.annotation_plane_arena.items[id].styles {
11327        check_presentation_style_assignment_ref(model, e0)?;
11328    }
11329    check_plane_or_planar_box_ref(model, &model.annotation_plane_arena.items[id].item)?;
11330    if let Some(x) = &model.annotation_plane_arena.items[id].elements {
11331        for e0 in x {
11332            check_annotation_plane_element_ref(model, e0)?;
11333        }
11334    }
11335    Ok(())
11336}
11337
11338fn cyclic_check_annotation_symbol(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11339    check_representation_map_ref(
11340        model,
11341        &model.annotation_symbol_arena.items[id].mapping_source,
11342    )?;
11343    check_representation_item_ref(
11344        model,
11345        &model.annotation_symbol_arena.items[id].mapping_target,
11346    )?;
11347    Ok(())
11348}
11349
11350fn cyclic_check_applied_approval_assignment(
11351    model: &StepModel,
11352    id: usize,
11353) -> Result<(), AuthorError> {
11354    check_approval_ref(
11355        model,
11356        &model.applied_approval_assignment_arena.items[id].assigned_approval,
11357    )?;
11358    for e0 in &model.applied_approval_assignment_arena.items[id].items {
11359        check_approval_item_ref(model, e0)?;
11360    }
11361    Ok(())
11362}
11363
11364fn cyclic_check_applied_date_and_time_assignment(
11365    model: &StepModel,
11366    id: usize,
11367) -> Result<(), AuthorError> {
11368    check_date_and_time_ref(
11369        model,
11370        &model.applied_date_and_time_assignment_arena.items[id].assigned_date_and_time,
11371    )?;
11372    check_date_time_role_ref(
11373        model,
11374        &model.applied_date_and_time_assignment_arena.items[id].role,
11375    )?;
11376    for e0 in &model.applied_date_and_time_assignment_arena.items[id].items {
11377        check_date_and_time_item_ref(model, e0)?;
11378    }
11379    Ok(())
11380}
11381
11382fn cyclic_check_applied_document_reference(
11383    model: &StepModel,
11384    id: usize,
11385) -> Result<(), AuthorError> {
11386    check_document_ref(
11387        model,
11388        &model.applied_document_reference_arena.items[id].assigned_document,
11389    )?;
11390    for e0 in &model.applied_document_reference_arena.items[id].items {
11391        check_document_reference_item_ref(model, e0)?;
11392    }
11393    Ok(())
11394}
11395
11396fn cyclic_check_applied_external_identification_assignment(
11397    model: &StepModel,
11398    id: usize,
11399) -> Result<(), AuthorError> {
11400    check_identification_role_ref(
11401        model,
11402        &model.applied_external_identification_assignment_arena.items[id].role,
11403    )?;
11404    check_external_source_ref(
11405        model,
11406        &model.applied_external_identification_assignment_arena.items[id].source,
11407    )?;
11408    for e0 in &model.applied_external_identification_assignment_arena.items[id].items {
11409        check_external_identification_item_ref(model, e0)?;
11410    }
11411    Ok(())
11412}
11413
11414fn cyclic_check_applied_group_assignment(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11415    check_group_ref(
11416        model,
11417        &model.applied_group_assignment_arena.items[id].assigned_group,
11418    )?;
11419    for e0 in &model.applied_group_assignment_arena.items[id].items {
11420        check_groupable_item_ref(model, e0)?;
11421    }
11422    Ok(())
11423}
11424
11425fn cyclic_check_applied_person_and_organization_assignment(
11426    model: &StepModel,
11427    id: usize,
11428) -> Result<(), AuthorError> {
11429    check_person_and_organization_ref(
11430        model,
11431        &model.applied_person_and_organization_assignment_arena.items[id]
11432            .assigned_person_and_organization,
11433    )?;
11434    check_person_and_organization_role_ref(
11435        model,
11436        &model.applied_person_and_organization_assignment_arena.items[id].role,
11437    )?;
11438    for e0 in &model.applied_person_and_organization_assignment_arena.items[id].items {
11439        check_person_and_organization_item_ref(model, e0)?;
11440    }
11441    Ok(())
11442}
11443
11444fn cyclic_check_bounded_surface_curve(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11445    check_curve_ref(model, &model.bounded_surface_curve_arena.items[id].curve_3d)?;
11446    for e0 in &model.bounded_surface_curve_arena.items[id].associated_geometry {
11447        check_pcurve_or_surface_ref(model, e0)?;
11448    }
11449    Ok(())
11450}
11451
11452fn cyclic_check_camera_image(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11453    check_representation_map_ref(model, &model.camera_image_arena.items[id].mapping_source)?;
11454    check_representation_item_ref(model, &model.camera_image_arena.items[id].mapping_target)?;
11455    Ok(())
11456}
11457
11458fn cyclic_check_camera_image3d_with_scale(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11459    check_representation_map_ref(
11460        model,
11461        &model.camera_image3d_with_scale_arena.items[id].mapping_source,
11462    )?;
11463    check_representation_item_ref(
11464        model,
11465        &model.camera_image3d_with_scale_arena.items[id].mapping_target,
11466    )?;
11467    Ok(())
11468}
11469
11470fn cyclic_check_composite_text(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11471    for e0 in &model.composite_text_arena.items[id].collected_text {
11472        check_text_or_character_ref(model, e0)?;
11473    }
11474    Ok(())
11475}
11476
11477fn cyclic_check_compound_representation_item(
11478    model: &StepModel,
11479    id: usize,
11480) -> Result<(), AuthorError> {
11481    check_compound_item_definition_ref(
11482        model,
11483        &model.compound_representation_item_arena.items[id].item_element,
11484    )?;
11485    Ok(())
11486}
11487
11488fn cyclic_check_context_dependent_over_riding_styled_item(
11489    model: &StepModel,
11490    id: usize,
11491) -> Result<(), AuthorError> {
11492    for e0 in &model.context_dependent_over_riding_styled_item_arena.items[id].styles {
11493        check_presentation_style_assignment_ref(model, e0)?;
11494    }
11495    check_styled_item_target_ref(
11496        model,
11497        &model.context_dependent_over_riding_styled_item_arena.items[id].item,
11498    )?;
11499    check_styled_item_ref(
11500        model,
11501        &model.context_dependent_over_riding_styled_item_arena.items[id].over_ridden_style,
11502    )?;
11503    for e0 in &model.context_dependent_over_riding_styled_item_arena.items[id].style_context {
11504        check_style_context_select_ref(model, e0)?;
11505    }
11506    Ok(())
11507}
11508
11509fn cyclic_check_datum_reference_element(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11510    check_product_definition_shape_ref(
11511        model,
11512        &model.datum_reference_element_arena.items[id].of_shape,
11513    )?;
11514    check_datum_or_common_datum_ref(model, &model.datum_reference_element_arena.items[id].base)?;
11515    if let Some(x) = &model.datum_reference_element_arena.items[id].modifiers {
11516        for e0 in x {
11517            check_datum_reference_modifier_ref(model, e0)?;
11518        }
11519    }
11520    Ok(())
11521}
11522
11523fn cyclic_check_dimensional_size_with_datum_feature(
11524    model: &StepModel,
11525    id: usize,
11526) -> Result<(), AuthorError> {
11527    check_product_definition_shape_ref(
11528        model,
11529        &model.dimensional_size_with_datum_feature_arena.items[id].of_shape,
11530    )?;
11531    check_shape_aspect_ref(
11532        model,
11533        &model.dimensional_size_with_datum_feature_arena.items[id].applies_to,
11534    )?;
11535    Ok(())
11536}
11537
11538fn cyclic_check_intersection_curve(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11539    check_curve_ref(model, &model.intersection_curve_arena.items[id].curve_3d)?;
11540    for e0 in &model.intersection_curve_arena.items[id].associated_geometry {
11541        check_pcurve_or_surface_ref(model, e0)?;
11542    }
11543    Ok(())
11544}
11545
11546fn cyclic_check_mapped_item(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11547    check_representation_map_ref(model, &model.mapped_item_arena.items[id].mapping_source)?;
11548    check_representation_item_ref(model, &model.mapped_item_arena.items[id].mapping_target)?;
11549    Ok(())
11550}
11551
11552fn cyclic_check_offset_surface(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11553    check_surface_ref(model, &model.offset_surface_arena.items[id].basis_surface)?;
11554    Ok(())
11555}
11556
11557fn cyclic_check_oriented_closed_shell(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11558    check_closed_shell_ref(
11559        model,
11560        &model.oriented_closed_shell_arena.items[id].closed_shell_element,
11561    )?;
11562    Ok(())
11563}
11564
11565fn cyclic_check_oriented_edge(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11566    check_edge_ref(model, &model.oriented_edge_arena.items[id].edge_element)?;
11567    Ok(())
11568}
11569
11570fn cyclic_check_over_riding_styled_item(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11571    for e0 in &model.over_riding_styled_item_arena.items[id].styles {
11572        check_presentation_style_assignment_ref(model, e0)?;
11573    }
11574    check_styled_item_target_ref(model, &model.over_riding_styled_item_arena.items[id].item)?;
11575    check_styled_item_ref(
11576        model,
11577        &model.over_riding_styled_item_arena.items[id].over_ridden_style,
11578    )?;
11579    Ok(())
11580}
11581
11582fn cyclic_check_product_definition_occurrence(
11583    model: &StepModel,
11584    id: usize,
11585) -> Result<(), AuthorError> {
11586    if let Some(x) = &model.product_definition_occurrence_arena.items[id].definition {
11587        check_product_definition_or_reference_ref(model, x)?;
11588    }
11589    if let Some(x) = &model.product_definition_occurrence_arena.items[id].quantity {
11590        check_measure_with_unit_ref(model, x)?;
11591    }
11592    Ok(())
11593}
11594
11595fn cyclic_check_product_definition_shape(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11596    check_characterized_definition_ref(
11597        model,
11598        &model.product_definition_shape_arena.items[id].definition,
11599    )?;
11600    Ok(())
11601}
11602
11603fn cyclic_check_seam_curve(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11604    check_curve_ref(model, &model.seam_curve_arena.items[id].curve_3d)?;
11605    for e0 in &model.seam_curve_arena.items[id].associated_geometry {
11606        check_pcurve_or_surface_ref(model, e0)?;
11607    }
11608    Ok(())
11609}
11610
11611fn cyclic_check_surface_curve(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11612    check_curve_ref(model, &model.surface_curve_arena.items[id].curve_3d)?;
11613    for e0 in &model.surface_curve_arena.items[id].associated_geometry {
11614        check_pcurve_or_surface_ref(model, e0)?;
11615    }
11616    Ok(())
11617}
11618
11619fn cyclic_check_tessellated_geometric_set(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11620    for e0 in &model.tessellated_geometric_set_arena.items[id].children {
11621        check_tessellated_item_ref(model, e0)?;
11622    }
11623    Ok(())
11624}
11625
11626fn cyclic_check_trimmed_curve(model: &StepModel, id: usize) -> Result<(), AuthorError> {
11627    check_curve_ref(model, &model.trimmed_curve_arena.items[id].basis_curve)?;
11628    for e0 in &model.trimmed_curve_arena.items[id].trim_1 {
11629        check_trimming_select_ref(model, e0)?;
11630    }
11631    for e0 in &model.trimmed_curve_arena.items[id].trim_2 {
11632        check_trimming_select_ref(model, e0)?;
11633    }
11634    Ok(())
11635}
11636
11637fn part_name(p: &UnitPart) -> &'static str {
11638    match p {
11639        UnitPart::Action { .. } => "ACTION",
11640        UnitPart::ActionMethod { .. } => "ACTION_METHOD",
11641        UnitPart::ActionMethodRelationship { .. } => "ACTION_METHOD_RELATIONSHIP",
11642        UnitPart::ActionRelationship { .. } => "ACTION_RELATIONSHIP",
11643        UnitPart::ActionRequestAssignment { .. } => "ACTION_REQUEST_ASSIGNMENT",
11644        UnitPart::ActionResource { .. } => "ACTION_RESOURCE",
11645        UnitPart::ActionResourceRequirement { .. } => "ACTION_RESOURCE_REQUIREMENT",
11646        UnitPart::Address { .. } => "ADDRESS",
11647        UnitPart::AdvancedBrepShapeRepresentation => "ADVANCED_BREP_SHAPE_REPRESENTATION",
11648        UnitPart::AdvancedFace => "ADVANCED_FACE",
11649        UnitPart::AnnotationCurveOccurrence => "ANNOTATION_CURVE_OCCURRENCE",
11650        UnitPart::AnnotationFillAreaOccurrence { .. } => "ANNOTATION_FILL_AREA_OCCURRENCE",
11651        UnitPart::AnnotationOccurrence => "ANNOTATION_OCCURRENCE",
11652        UnitPart::AnnotationOccurrenceAssociativity => "ANNOTATION_OCCURRENCE_ASSOCIATIVITY",
11653        UnitPart::AnnotationOccurrenceRelationship { .. } => "ANNOTATION_OCCURRENCE_RELATIONSHIP",
11654        UnitPart::AnnotationPlaceholderOccurrence { .. } => "ANNOTATION_PLACEHOLDER_OCCURRENCE",
11655        UnitPart::AnnotationPlaceholderOccurrenceWithLeaderLine { .. } => {
11656            "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE"
11657        }
11658        UnitPart::AnnotationPlane { .. } => "ANNOTATION_PLANE",
11659        UnitPart::AnnotationSymbol => "ANNOTATION_SYMBOL",
11660        UnitPart::AnnotationSymbolOccurrence => "ANNOTATION_SYMBOL_OCCURRENCE",
11661        UnitPart::AnnotationText => "ANNOTATION_TEXT",
11662        UnitPart::AnnotationTextCharacter { .. } => "ANNOTATION_TEXT_CHARACTER",
11663        UnitPart::AnnotationTextOccurrence => "ANNOTATION_TEXT_OCCURRENCE",
11664        UnitPart::ApplicationContextElement { .. } => "APPLICATION_CONTEXT_ELEMENT",
11665        UnitPart::AppliedApprovalAssignment { .. } => "APPLIED_APPROVAL_ASSIGNMENT",
11666        UnitPart::AppliedDateAndTimeAssignment { .. } => "APPLIED_DATE_AND_TIME_ASSIGNMENT",
11667        UnitPart::AppliedDocumentReference { .. } => "APPLIED_DOCUMENT_REFERENCE",
11668        UnitPart::AppliedExternalIdentificationAssignment { .. } => {
11669            "APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT"
11670        }
11671        UnitPart::AppliedGroupAssignment { .. } => "APPLIED_GROUP_ASSIGNMENT",
11672        UnitPart::AppliedPersonAndOrganizationAssignment { .. } => {
11673            "APPLIED_PERSON_AND_ORGANIZATION_ASSIGNMENT"
11674        }
11675        UnitPart::AppliedPresentedItem { .. } => "APPLIED_PRESENTED_ITEM",
11676        UnitPart::AppliedSecurityClassificationAssignment { .. } => {
11677            "APPLIED_SECURITY_CLASSIFICATION_ASSIGNMENT"
11678        }
11679        UnitPart::ApprovalAssignment { .. } => "APPROVAL_ASSIGNMENT",
11680        UnitPart::AreaInSet { .. } => "AREA_IN_SET",
11681        UnitPart::AscribableStateRelationship { .. } => "ASCRIBABLE_STATE_RELATIONSHIP",
11682        UnitPart::AssemblyComponentUsage { .. } => "ASSEMBLY_COMPONENT_USAGE",
11683        UnitPart::BSplineCurve { .. } => "B_SPLINE_CURVE",
11684        UnitPart::BSplineCurveWithKnots { .. } => "B_SPLINE_CURVE_WITH_KNOTS",
11685        UnitPart::BSplineSurface { .. } => "B_SPLINE_SURFACE",
11686        UnitPart::BSplineSurfaceWithKnots { .. } => "B_SPLINE_SURFACE_WITH_KNOTS",
11687        UnitPart::BezierCurve => "BEZIER_CURVE",
11688        UnitPart::BezierSurface => "BEZIER_SURFACE",
11689        UnitPart::BoundedCurve => "BOUNDED_CURVE",
11690        UnitPart::BoundedPcurve => "BOUNDED_PCURVE",
11691        UnitPart::BoundedSurface => "BOUNDED_SURFACE",
11692        UnitPart::BoundedSurfaceCurve => "BOUNDED_SURFACE_CURVE",
11693        UnitPart::BrepWithVoids { .. } => "BREP_WITH_VOIDS",
11694        UnitPart::CameraImage => "CAMERA_IMAGE",
11695        UnitPart::CameraImage3dWithScale => "CAMERA_IMAGE_3D_WITH_SCALE",
11696        UnitPart::CameraModel => "CAMERA_MODEL",
11697        UnitPart::CameraModelD3 { .. } => "CAMERA_MODEL_D3",
11698        UnitPart::CameraModelD3MultiClipping { .. } => "CAMERA_MODEL_D3_MULTI_CLIPPING",
11699        UnitPart::CameraModelD3WithHlhsr { .. } => "CAMERA_MODEL_D3_WITH_HLHSR",
11700        UnitPart::CameraUsage => "CAMERA_USAGE",
11701        UnitPart::CcDesignApproval { .. } => "CC_DESIGN_APPROVAL",
11702        UnitPart::CcDesignDateAndTimeAssignment { .. } => "CC_DESIGN_DATE_AND_TIME_ASSIGNMENT",
11703        UnitPart::CcDesignPersonAndOrganizationAssignment { .. } => {
11704            "CC_DESIGN_PERSON_AND_ORGANIZATION_ASSIGNMENT"
11705        }
11706        UnitPart::CcDesignSecurityClassification { .. } => "CC_DESIGN_SECURITY_CLASSIFICATION",
11707        UnitPart::ChangeRequest { .. } => "CHANGE_REQUEST",
11708        UnitPart::CharacterGlyphStyleOutline { .. } => "CHARACTER_GLYPH_STYLE_OUTLINE",
11709        UnitPart::CharacterGlyphStyleStroke { .. } => "CHARACTER_GLYPH_STYLE_STROKE",
11710        UnitPart::CharacterizedItemWithinRepresentation { .. } => {
11711            "CHARACTERIZED_ITEM_WITHIN_REPRESENTATION"
11712        }
11713        UnitPart::CharacterizedObject { .. } => "CHARACTERIZED_OBJECT",
11714        UnitPart::CharacterizedRepresentation => "CHARACTERIZED_REPRESENTATION",
11715        UnitPart::CircularRunoutTolerance => "CIRCULAR_RUNOUT_TOLERANCE",
11716        UnitPart::ClosedShell => "CLOSED_SHELL",
11717        UnitPart::Colour => "COLOUR",
11718        UnitPart::ColourRgb { .. } => "COLOUR_RGB",
11719        UnitPart::ColourSpecification { .. } => "COLOUR_SPECIFICATION",
11720        UnitPart::CommonDatum => "COMMON_DATUM",
11721        UnitPart::CompositeCurve { .. } => "COMPOSITE_CURVE",
11722        UnitPart::CompositeCurveSegment { .. } => "COMPOSITE_CURVE_SEGMENT",
11723        UnitPart::CompositeGroupShapeAspect => "COMPOSITE_GROUP_SHAPE_ASPECT",
11724        UnitPart::CompositeShapeAspect => "COMPOSITE_SHAPE_ASPECT",
11725        UnitPart::CompositeText { .. } => "COMPOSITE_TEXT",
11726        UnitPart::CompoundRepresentationItem { .. } => "COMPOUND_REPRESENTATION_ITEM",
11727        UnitPart::ConfigurationEffectivity { .. } => "CONFIGURATION_EFFECTIVITY",
11728        UnitPart::ConfigurationItem { .. } => "CONFIGURATION_ITEM",
11729        UnitPart::ConnectedFaceSet { .. } => "CONNECTED_FACE_SET",
11730        UnitPart::ConstructiveGeometryRepresentationRelationship => {
11731            "CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP"
11732        }
11733        UnitPart::ContextDependentOverRidingStyledItem { .. } => {
11734            "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM"
11735        }
11736        UnitPart::ContextDependentUnit { .. } => "CONTEXT_DEPENDENT_UNIT",
11737        UnitPart::ConversionBasedUnit { .. } => "CONVERSION_BASED_UNIT",
11738        UnitPart::Curve => "CURVE",
11739        UnitPart::CurveStyle { .. } => "CURVE_STYLE",
11740        UnitPart::CurveStyleFont { .. } => "CURVE_STYLE_FONT",
11741        UnitPart::CurveStyleFontAndScaling { .. } => "CURVE_STYLE_FONT_AND_SCALING",
11742        UnitPart::CurveStyleFontPattern { .. } => "CURVE_STYLE_FONT_PATTERN",
11743        UnitPart::CylindricityTolerance => "CYLINDRICITY_TOLERANCE",
11744        UnitPart::Date { .. } => "DATE",
11745        UnitPart::DateAndTime { .. } => "DATE_AND_TIME",
11746        UnitPart::DateAndTimeAssignment { .. } => "DATE_AND_TIME_ASSIGNMENT",
11747        UnitPart::Datum { .. } => "DATUM",
11748        UnitPart::DatumFeature => "DATUM_FEATURE",
11749        UnitPart::DatumReference { .. } => "DATUM_REFERENCE",
11750        UnitPart::DatumSystem { .. } => "DATUM_SYSTEM",
11751        UnitPart::DatumTarget { .. } => "DATUM_TARGET",
11752        UnitPart::DefaultModelGeometricView => "DEFAULT_MODEL_GEOMETRIC_VIEW",
11753        UnitPart::DefinitionalRepresentation => "DEFINITIONAL_REPRESENTATION",
11754        UnitPart::DefinitionalRepresentationRelationship => {
11755            "DEFINITIONAL_REPRESENTATION_RELATIONSHIP"
11756        }
11757        UnitPart::DefinitionalRepresentationRelationshipWithSameContext => {
11758            "DEFINITIONAL_REPRESENTATION_RELATIONSHIP_WITH_SAME_CONTEXT"
11759        }
11760        UnitPart::DegenerateToroidalSurface { .. } => "DEGENERATE_TOROIDAL_SURFACE",
11761        UnitPart::DerivedUnit { .. } => "DERIVED_UNIT",
11762        UnitPart::DesignContext => "DESIGN_CONTEXT",
11763        UnitPart::DimensionalSize { .. } => "DIMENSIONAL_SIZE",
11764        UnitPart::Direction { .. } => "DIRECTION",
11765        UnitPart::Document { .. } => "DOCUMENT",
11766        UnitPart::DocumentFile => "DOCUMENT_FILE",
11767        UnitPart::DocumentProductAssociation { .. } => "DOCUMENT_PRODUCT_ASSOCIATION",
11768        UnitPart::DocumentProductEquivalence => "DOCUMENT_PRODUCT_EQUIVALENCE",
11769        UnitPart::DocumentReference { .. } => "DOCUMENT_REFERENCE",
11770        UnitPart::DraughtingAnnotationOccurrence => "DRAUGHTING_ANNOTATION_OCCURRENCE",
11771        UnitPart::DraughtingCallout { .. } => "DRAUGHTING_CALLOUT",
11772        UnitPart::DraughtingCalloutRelationship { .. } => "DRAUGHTING_CALLOUT_RELATIONSHIP",
11773        UnitPart::DraughtingModel => "DRAUGHTING_MODEL",
11774        UnitPart::DraughtingModelItemAssociation => "DRAUGHTING_MODEL_ITEM_ASSOCIATION",
11775        UnitPart::DraughtingModelItemAssociationWithPlaceholder { .. } => {
11776            "DRAUGHTING_MODEL_ITEM_ASSOCIATION_WITH_PLACEHOLDER"
11777        }
11778        UnitPart::DraughtingPreDefinedColour => "DRAUGHTING_PRE_DEFINED_COLOUR",
11779        UnitPart::DraughtingPreDefinedCurveFont => "DRAUGHTING_PRE_DEFINED_CURVE_FONT",
11780        UnitPart::DraughtingPreDefinedTextFont => "DRAUGHTING_PRE_DEFINED_TEXT_FONT",
11781        UnitPart::Edge { .. } => "EDGE",
11782        UnitPart::EdgeCurve { .. } => "EDGE_CURVE",
11783        UnitPart::EdgeLoop => "EDGE_LOOP",
11784        UnitPart::Effectivity { .. } => "EFFECTIVITY",
11785        UnitPart::ElementarySurface { .. } => "ELEMENTARY_SURFACE",
11786        UnitPart::Expression => "EXPRESSION",
11787        UnitPart::ExternalIdentificationAssignment { .. } => "EXTERNAL_IDENTIFICATION_ASSIGNMENT",
11788        UnitPart::ExternalSource { .. } => "EXTERNAL_SOURCE",
11789        UnitPart::ExternallyDefinedCharacterGlyph => "EXTERNALLY_DEFINED_CHARACTER_GLYPH",
11790        UnitPart::ExternallyDefinedCurveFont => "EXTERNALLY_DEFINED_CURVE_FONT",
11791        UnitPart::ExternallyDefinedHatchStyle => "EXTERNALLY_DEFINED_HATCH_STYLE",
11792        UnitPart::ExternallyDefinedItem { .. } => "EXTERNALLY_DEFINED_ITEM",
11793        UnitPart::ExternallyDefinedStyle => "EXTERNALLY_DEFINED_STYLE",
11794        UnitPart::ExternallyDefinedSymbol => "EXTERNALLY_DEFINED_SYMBOL",
11795        UnitPart::ExternallyDefinedTextFont => "EXTERNALLY_DEFINED_TEXT_FONT",
11796        UnitPart::ExternallyDefinedTile => "EXTERNALLY_DEFINED_TILE",
11797        UnitPart::ExternallyDefinedTileStyle => "EXTERNALLY_DEFINED_TILE_STYLE",
11798        UnitPart::Face { .. } => "FACE",
11799        UnitPart::FaceBound { .. } => "FACE_BOUND",
11800        UnitPart::FaceOuterBound => "FACE_OUTER_BOUND",
11801        UnitPart::FaceSurface { .. } => "FACE_SURFACE",
11802        UnitPart::FillAreaStyle { .. } => "FILL_AREA_STYLE",
11803        UnitPart::FillAreaStyleHatching { .. } => "FILL_AREA_STYLE_HATCHING",
11804        UnitPart::FillAreaStyleTileSymbolWithStyle { .. } => {
11805            "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE"
11806        }
11807        UnitPart::FillAreaStyleTiles { .. } => "FILL_AREA_STYLE_TILES",
11808        UnitPart::FlatnessTolerance => "FLATNESS_TOLERANCE",
11809        UnitPart::FoundedItem => "FOUNDED_ITEM",
11810        UnitPart::FunctionallyDefinedTransformation { .. } => "FUNCTIONALLY_DEFINED_TRANSFORMATION",
11811        UnitPart::GeneralDatumReference { .. } => "GENERAL_DATUM_REFERENCE",
11812        UnitPart::GeneralProperty { .. } => "GENERAL_PROPERTY",
11813        UnitPart::GenericExpression => "GENERIC_EXPRESSION",
11814        UnitPart::GenericLiteral => "GENERIC_LITERAL",
11815        UnitPart::GenericProductDefinitionReference { .. } => {
11816            "GENERIC_PRODUCT_DEFINITION_REFERENCE"
11817        }
11818        UnitPart::GeometricCurveSet => "GEOMETRIC_CURVE_SET",
11819        UnitPart::GeometricItemSpecificUsage => "GEOMETRIC_ITEM_SPECIFIC_USAGE",
11820        UnitPart::GeometricRepresentationContext { .. } => "GEOMETRIC_REPRESENTATION_CONTEXT",
11821        UnitPart::GeometricRepresentationItem => "GEOMETRIC_REPRESENTATION_ITEM",
11822        UnitPart::GeometricSet { .. } => "GEOMETRIC_SET",
11823        UnitPart::GeometricTolerance { .. } => "GEOMETRIC_TOLERANCE",
11824        UnitPart::GeometricToleranceWithDatumReference { .. } => {
11825            "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE"
11826        }
11827        UnitPart::GeometricToleranceWithDefinedAreaUnit { .. } => {
11828            "GEOMETRIC_TOLERANCE_WITH_DEFINED_AREA_UNIT"
11829        }
11830        UnitPart::GeometricToleranceWithDefinedUnit { .. } => {
11831            "GEOMETRIC_TOLERANCE_WITH_DEFINED_UNIT"
11832        }
11833        UnitPart::GeometricToleranceWithMaximumTolerance { .. } => {
11834            "GEOMETRIC_TOLERANCE_WITH_MAXIMUM_TOLERANCE"
11835        }
11836        UnitPart::GeometricToleranceWithModifiers { .. } => "GEOMETRIC_TOLERANCE_WITH_MODIFIERS",
11837        UnitPart::GeometricallyBoundedSurfaceShapeRepresentation => {
11838            "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION"
11839        }
11840        UnitPart::GeometricallyBoundedWireframeShapeRepresentation => {
11841            "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION"
11842        }
11843        UnitPart::GlobalUncertaintyAssignedContext { .. } => "GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT",
11844        UnitPart::GlobalUnitAssignedContext { .. } => "GLOBAL_UNIT_ASSIGNED_CONTEXT",
11845        UnitPart::Group { .. } => "GROUP",
11846        UnitPart::GroupAssignment { .. } => "GROUP_ASSIGNMENT",
11847        UnitPart::IdentificationAssignment { .. } => "IDENTIFICATION_ASSIGNMENT",
11848        UnitPart::IntLiteral => "INT_LITERAL",
11849        UnitPart::IntegerRepresentationItem => "INTEGER_REPRESENTATION_ITEM",
11850        UnitPart::IntersectionCurve => "INTERSECTION_CURVE",
11851        UnitPart::Invisibility { .. } => "INVISIBILITY",
11852        UnitPart::ItemDefinedTransformation { .. } => "ITEM_DEFINED_TRANSFORMATION",
11853        UnitPart::ItemIdentifiedRepresentationUsage { .. } => {
11854            "ITEM_IDENTIFIED_REPRESENTATION_USAGE"
11855        }
11856        UnitPart::LeaderCurve => "LEADER_CURVE",
11857        UnitPart::LeaderDirectedCallout => "LEADER_DIRECTED_CALLOUT",
11858        UnitPart::LeaderTerminator => "LEADER_TERMINATOR",
11859        UnitPart::LengthMeasureWithUnit => "LENGTH_MEASURE_WITH_UNIT",
11860        UnitPart::LengthUnit => "LENGTH_UNIT",
11861        UnitPart::LineProfileTolerance => "LINE_PROFILE_TOLERANCE",
11862        UnitPart::LiteralNumber { .. } => "LITERAL_NUMBER",
11863        UnitPart::Loop => "LOOP",
11864        UnitPart::ManifoldSolidBrep { .. } => "MANIFOLD_SOLID_BREP",
11865        UnitPart::ManifoldSurfaceShapeRepresentation => "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
11866        UnitPart::MappedItem { .. } => "MAPPED_ITEM",
11867        UnitPart::MassUnit => "MASS_UNIT",
11868        UnitPart::MeasureRepresentationItem => "MEASURE_REPRESENTATION_ITEM",
11869        UnitPart::MeasureWithUnit { .. } => "MEASURE_WITH_UNIT",
11870        UnitPart::MechanicalContext => "MECHANICAL_CONTEXT",
11871        UnitPart::MechanicalDesignAndDraughtingRelationship => {
11872            "MECHANICAL_DESIGN_AND_DRAUGHTING_RELATIONSHIP"
11873        }
11874        UnitPart::ModelGeometricView => "MODEL_GEOMETRIC_VIEW",
11875        UnitPart::ModifiedGeometricTolerance { .. } => "MODIFIED_GEOMETRIC_TOLERANCE",
11876        UnitPart::NamedUnit { .. } => "NAMED_UNIT",
11877        UnitPart::NextAssemblyUsageOccurrence => "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
11878        UnitPart::NumericExpression => "NUMERIC_EXPRESSION",
11879        UnitPart::OneDirectionRepeatFactor { .. } => "ONE_DIRECTION_REPEAT_FACTOR",
11880        UnitPart::OpenShell => "OPEN_SHELL",
11881        UnitPart::OrganizationalAddress { .. } => "ORGANIZATIONAL_ADDRESS",
11882        UnitPart::OrientedClosedShell { .. } => "ORIENTED_CLOSED_SHELL",
11883        UnitPart::OrientedEdge { .. } => "ORIENTED_EDGE",
11884        UnitPart::OverRidingStyledItem { .. } => "OVER_RIDING_STYLED_ITEM",
11885        UnitPart::ParallelismTolerance => "PARALLELISM_TOLERANCE",
11886        UnitPart::ParametricRepresentationContext => "PARAMETRIC_REPRESENTATION_CONTEXT",
11887        UnitPart::Path { .. } => "PATH",
11888        UnitPart::Pcurve { .. } => "PCURVE",
11889        UnitPart::PerpendicularityTolerance => "PERPENDICULARITY_TOLERANCE",
11890        UnitPart::PersonAndOrganizationAddress => "PERSON_AND_ORGANIZATION_ADDRESS",
11891        UnitPart::PersonAndOrganizationAssignment { .. } => "PERSON_AND_ORGANIZATION_ASSIGNMENT",
11892        UnitPart::PersonalAddress { .. } => "PERSONAL_ADDRESS",
11893        UnitPart::PlacedDatumTargetFeature => "PLACED_DATUM_TARGET_FEATURE",
11894        UnitPart::Placement { .. } => "PLACEMENT",
11895        UnitPart::PlanarBox { .. } => "PLANAR_BOX",
11896        UnitPart::PlanarExtent { .. } => "PLANAR_EXTENT",
11897        UnitPart::PlaneAngleMeasureWithUnit => "PLANE_ANGLE_MEASURE_WITH_UNIT",
11898        UnitPart::PlaneAngleUnit => "PLANE_ANGLE_UNIT",
11899        UnitPart::Point => "POINT",
11900        UnitPart::PointStyle { .. } => "POINT_STYLE",
11901        UnitPart::PolyLoop { .. } => "POLY_LOOP",
11902        UnitPart::PositionTolerance => "POSITION_TOLERANCE",
11903        UnitPart::PreDefinedCharacterGlyph => "PRE_DEFINED_CHARACTER_GLYPH",
11904        UnitPart::PreDefinedColour => "PRE_DEFINED_COLOUR",
11905        UnitPart::PreDefinedCurveFont => "PRE_DEFINED_CURVE_FONT",
11906        UnitPart::PreDefinedItem { .. } => "PRE_DEFINED_ITEM",
11907        UnitPart::PreDefinedMarker => "PRE_DEFINED_MARKER",
11908        UnitPart::PreDefinedPointMarkerSymbol => "PRE_DEFINED_POINT_MARKER_SYMBOL",
11909        UnitPart::PreDefinedPresentationStyle => "PRE_DEFINED_PRESENTATION_STYLE",
11910        UnitPart::PreDefinedSurfaceSideStyle => "PRE_DEFINED_SURFACE_SIDE_STYLE",
11911        UnitPart::PreDefinedSymbol => "PRE_DEFINED_SYMBOL",
11912        UnitPart::PreDefinedTerminatorSymbol => "PRE_DEFINED_TERMINATOR_SYMBOL",
11913        UnitPart::PreDefinedTextFont => "PRE_DEFINED_TEXT_FONT",
11914        UnitPart::PreDefinedTile => "PRE_DEFINED_TILE",
11915        UnitPart::PresentationArea => "PRESENTATION_AREA",
11916        UnitPart::PresentationRepresentation => "PRESENTATION_REPRESENTATION",
11917        UnitPart::PresentationSet => "PRESENTATION_SET",
11918        UnitPart::PresentationStyleAssignment { .. } => "PRESENTATION_STYLE_ASSIGNMENT",
11919        UnitPart::PresentationStyleByContext { .. } => "PRESENTATION_STYLE_BY_CONTEXT",
11920        UnitPart::PresentationView => "PRESENTATION_VIEW",
11921        UnitPart::PresentedItem => "PRESENTED_ITEM",
11922        UnitPart::Product { .. } => "PRODUCT",
11923        UnitPart::ProductCategory { .. } => "PRODUCT_CATEGORY",
11924        UnitPart::ProductConcept { .. } => "PRODUCT_CONCEPT",
11925        UnitPart::ProductConceptFeature { .. } => "PRODUCT_CONCEPT_FEATURE",
11926        UnitPart::ProductConceptFeatureCategory => "PRODUCT_CONCEPT_FEATURE_CATEGORY",
11927        UnitPart::ProductContext { .. } => "PRODUCT_CONTEXT",
11928        UnitPart::ProductDefinition { .. } => "PRODUCT_DEFINITION",
11929        UnitPart::ProductDefinitionContext { .. } => "PRODUCT_DEFINITION_CONTEXT",
11930        UnitPart::ProductDefinitionEffectivity { .. } => "PRODUCT_DEFINITION_EFFECTIVITY",
11931        UnitPart::ProductDefinitionFormation { .. } => "PRODUCT_DEFINITION_FORMATION",
11932        UnitPart::ProductDefinitionFormationWithSpecifiedSource { .. } => {
11933            "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE"
11934        }
11935        UnitPart::ProductDefinitionOccurrence { .. } => "PRODUCT_DEFINITION_OCCURRENCE",
11936        UnitPart::ProductDefinitionRelationship { .. } => "PRODUCT_DEFINITION_RELATIONSHIP",
11937        UnitPart::ProductDefinitionRelationshipRelationship { .. } => {
11938            "PRODUCT_DEFINITION_RELATIONSHIP_RELATIONSHIP"
11939        }
11940        UnitPart::ProductDefinitionShape => "PRODUCT_DEFINITION_SHAPE",
11941        UnitPart::ProductDefinitionUsage => "PRODUCT_DEFINITION_USAGE",
11942        UnitPart::ProductDefinitionWithAssociatedDocuments { .. } => {
11943            "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS"
11944        }
11945        UnitPart::ProductRelatedProductCategory { .. } => "PRODUCT_RELATED_PRODUCT_CATEGORY",
11946        UnitPart::ProjectedZoneDefinition { .. } => "PROJECTED_ZONE_DEFINITION",
11947        UnitPart::PropertyDefinition { .. } => "PROPERTY_DEFINITION",
11948        UnitPart::PropertyDefinitionRepresentation { .. } => "PROPERTY_DEFINITION_REPRESENTATION",
11949        UnitPart::QualifiedRepresentationItem { .. } => "QUALIFIED_REPRESENTATION_ITEM",
11950        UnitPart::QuasiUniformCurve => "QUASI_UNIFORM_CURVE",
11951        UnitPart::QuasiUniformSurface => "QUASI_UNIFORM_SURFACE",
11952        UnitPart::RatioMeasureWithUnit => "RATIO_MEASURE_WITH_UNIT",
11953        UnitPart::RatioUnit => "RATIO_UNIT",
11954        UnitPart::RationalBSplineCurve { .. } => "RATIONAL_B_SPLINE_CURVE",
11955        UnitPart::RationalBSplineSurface { .. } => "RATIONAL_B_SPLINE_SURFACE",
11956        UnitPart::RealLiteral => "REAL_LITERAL",
11957        UnitPart::RealRepresentationItem => "REAL_REPRESENTATION_ITEM",
11958        UnitPart::RepositionedTessellatedItem { .. } => "REPOSITIONED_TESSELLATED_ITEM",
11959        UnitPart::Representation { .. } => "REPRESENTATION",
11960        UnitPart::RepresentationContext { .. } => "REPRESENTATION_CONTEXT",
11961        UnitPart::RepresentationItem { .. } => "REPRESENTATION_ITEM",
11962        UnitPart::RepresentationMap { .. } => "REPRESENTATION_MAP",
11963        UnitPart::RepresentationReference { .. } => "REPRESENTATION_REFERENCE",
11964        UnitPart::RepresentationRelationship { .. } => "REPRESENTATION_RELATIONSHIP",
11965        UnitPart::RepresentationRelationshipWithTransformation { .. } => {
11966            "REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION"
11967        }
11968        UnitPart::RoundnessTolerance => "ROUNDNESS_TOLERANCE",
11969        UnitPart::SeamCurve => "SEAM_CURVE",
11970        UnitPart::SecurityClassificationAssignment { .. } => "SECURITY_CLASSIFICATION_ASSIGNMENT",
11971        UnitPart::ShapeAspect { .. } => "SHAPE_ASPECT",
11972        UnitPart::ShapeAspectRelationship { .. } => "SHAPE_ASPECT_RELATIONSHIP",
11973        UnitPart::ShapeDefinitionRepresentation => "SHAPE_DEFINITION_REPRESENTATION",
11974        UnitPart::ShapeDimensionRepresentation => "SHAPE_DIMENSION_REPRESENTATION",
11975        UnitPart::ShapeRepresentation => "SHAPE_REPRESENTATION",
11976        UnitPart::ShapeRepresentationRelationship => "SHAPE_REPRESENTATION_RELATIONSHIP",
11977        UnitPart::ShapeRepresentationWithParameters => "SHAPE_REPRESENTATION_WITH_PARAMETERS",
11978        UnitPart::ShellBasedSurfaceModel { .. } => "SHELL_BASED_SURFACE_MODEL",
11979        UnitPart::SiUnit { .. } => "SI_UNIT",
11980        UnitPart::SimpleGenericExpression => "SIMPLE_GENERIC_EXPRESSION",
11981        UnitPart::SimpleNumericExpression => "SIMPLE_NUMERIC_EXPRESSION",
11982        UnitPart::SolidAngleUnit => "SOLID_ANGLE_UNIT",
11983        UnitPart::SolidModel => "SOLID_MODEL",
11984        UnitPart::StartRequest { .. } => "START_REQUEST",
11985        UnitPart::StateObserved { .. } => "STATE_OBSERVED",
11986        UnitPart::StateType { .. } => "STATE_TYPE",
11987        UnitPart::StraightnessTolerance => "STRAIGHTNESS_TOLERANCE",
11988        UnitPart::StyledItem { .. } => "STYLED_ITEM",
11989        UnitPart::Surface => "SURFACE",
11990        UnitPart::SurfaceCurve { .. } => "SURFACE_CURVE",
11991        UnitPart::SurfaceProfileTolerance => "SURFACE_PROFILE_TOLERANCE",
11992        UnitPart::SurfaceSideStyle { .. } => "SURFACE_SIDE_STYLE",
11993        UnitPart::SurfaceStyleBoundary { .. } => "SURFACE_STYLE_BOUNDARY",
11994        UnitPart::SurfaceStyleControlGrid { .. } => "SURFACE_STYLE_CONTROL_GRID",
11995        UnitPart::SurfaceStyleFillArea { .. } => "SURFACE_STYLE_FILL_AREA",
11996        UnitPart::SurfaceStyleParameterLine { .. } => "SURFACE_STYLE_PARAMETER_LINE",
11997        UnitPart::SurfaceStyleReflectanceAmbient { .. } => "SURFACE_STYLE_REFLECTANCE_AMBIENT",
11998        UnitPart::SurfaceStyleRendering { .. } => "SURFACE_STYLE_RENDERING",
11999        UnitPart::SurfaceStyleRenderingWithProperties { .. } => {
12000            "SURFACE_STYLE_RENDERING_WITH_PROPERTIES"
12001        }
12002        UnitPart::SurfaceStyleSegmentationCurve { .. } => "SURFACE_STYLE_SEGMENTATION_CURVE",
12003        UnitPart::SurfaceStyleSilhouette { .. } => "SURFACE_STYLE_SILHOUETTE",
12004        UnitPart::SurfaceStyleUsage { .. } => "SURFACE_STYLE_USAGE",
12005        UnitPart::SymbolRepresentation => "SYMBOL_REPRESENTATION",
12006        UnitPart::SymbolStyle { .. } => "SYMBOL_STYLE",
12007        UnitPart::TerminatorSymbol { .. } => "TERMINATOR_SYMBOL",
12008        UnitPart::TessellatedGeometricSet { .. } => "TESSELLATED_GEOMETRIC_SET",
12009        UnitPart::TessellatedItem => "TESSELLATED_ITEM",
12010        UnitPart::TessellatedShapeRepresentation => "TESSELLATED_SHAPE_REPRESENTATION",
12011        UnitPart::TessellatedStructuredItem => "TESSELLATED_STRUCTURED_ITEM",
12012        UnitPart::TextLiteral { .. } => "TEXT_LITERAL",
12013        UnitPart::TextStyle { .. } => "TEXT_STYLE",
12014        UnitPart::TextStyleWithBoxCharacteristics { .. } => "TEXT_STYLE_WITH_BOX_CHARACTERISTICS",
12015        UnitPart::TextureStyleSpecification => "TEXTURE_STYLE_SPECIFICATION",
12016        UnitPart::TextureStyleTessellationSpecification => {
12017            "TEXTURE_STYLE_TESSELLATION_SPECIFICATION"
12018        }
12019        UnitPart::TimeUnit => "TIME_UNIT",
12020        UnitPart::ToleranceZone { .. } => "TOLERANCE_ZONE",
12021        UnitPart::ToleranceZoneDefinition { .. } => "TOLERANCE_ZONE_DEFINITION",
12022        UnitPart::ToleranceZoneWithDatum { .. } => "TOLERANCE_ZONE_WITH_DATUM",
12023        UnitPart::TopologicalRepresentationItem => "TOPOLOGICAL_REPRESENTATION_ITEM",
12024        UnitPart::ToroidalSurface { .. } => "TOROIDAL_SURFACE",
12025        UnitPart::TwoDirectionRepeatFactor { .. } => "TWO_DIRECTION_REPEAT_FACTOR",
12026        UnitPart::UnequallyDisposedGeometricTolerance { .. } => {
12027            "UNEQUALLY_DISPOSED_GEOMETRIC_TOLERANCE"
12028        }
12029        UnitPart::UniformCurve => "UNIFORM_CURVE",
12030        UnitPart::UniformSurface => "UNIFORM_SURFACE",
12031        UnitPart::ValueRepresentationItem { .. } => "VALUE_REPRESENTATION_ITEM",
12032        UnitPart::Vector { .. } => "VECTOR",
12033        UnitPart::Vertex => "VERTEX",
12034        UnitPart::VertexPoint { .. } => "VERTEX_POINT",
12035        UnitPart::ViewVolume { .. } => "VIEW_VOLUME",
12036    }
12037}
12038
12039/// `(part, AP242-legal, transitive supertypes)`, sorted by part name.
12040static PART_INFO: &[(&str, bool, &[&str])] = &[
12041    ("ACTION", true, &[]),
12042    ("ACTION_METHOD", true, &[]),
12043    ("ACTION_METHOD_RELATIONSHIP", true, &[]),
12044    ("ACTION_RELATIONSHIP", true, &[]),
12045    ("ACTION_REQUEST_ASSIGNMENT", true, &[]),
12046    ("ACTION_RESOURCE", true, &[]),
12047    ("ACTION_RESOURCE_REQUIREMENT", true, &[]),
12048    ("ADDRESS", true, &[]),
12049    (
12050        "ADVANCED_BREP_SHAPE_REPRESENTATION",
12051        true,
12052        &["REPRESENTATION", "SHAPE_REPRESENTATION"],
12053    ),
12054    (
12055        "ADVANCED_FACE",
12056        true,
12057        &[
12058            "FACE",
12059            "FACE_SURFACE",
12060            "GEOMETRIC_REPRESENTATION_ITEM",
12061            "REPRESENTATION_ITEM",
12062            "TOPOLOGICAL_REPRESENTATION_ITEM",
12063        ],
12064    ),
12065    (
12066        "ANNOTATION_CURVE_OCCURRENCE",
12067        true,
12068        &[
12069            "ANNOTATION_OCCURRENCE",
12070            "REPRESENTATION_ITEM",
12071            "STYLED_ITEM",
12072        ],
12073    ),
12074    (
12075        "ANNOTATION_FILL_AREA_OCCURRENCE",
12076        true,
12077        &[
12078            "ANNOTATION_OCCURRENCE",
12079            "REPRESENTATION_ITEM",
12080            "STYLED_ITEM",
12081        ],
12082    ),
12083    (
12084        "ANNOTATION_OCCURRENCE",
12085        true,
12086        &["REPRESENTATION_ITEM", "STYLED_ITEM"],
12087    ),
12088    (
12089        "ANNOTATION_OCCURRENCE_ASSOCIATIVITY",
12090        true,
12091        &["ANNOTATION_OCCURRENCE_RELATIONSHIP"],
12092    ),
12093    ("ANNOTATION_OCCURRENCE_RELATIONSHIP", true, &[]),
12094    (
12095        "ANNOTATION_PLACEHOLDER_OCCURRENCE",
12096        true,
12097        &[
12098            "ANNOTATION_OCCURRENCE",
12099            "GEOMETRIC_REPRESENTATION_ITEM",
12100            "REPRESENTATION_ITEM",
12101            "STYLED_ITEM",
12102        ],
12103    ),
12104    (
12105        "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
12106        false,
12107        &[
12108            "ANNOTATION_OCCURRENCE",
12109            "ANNOTATION_PLACEHOLDER_OCCURRENCE",
12110            "GEOMETRIC_REPRESENTATION_ITEM",
12111            "REPRESENTATION_ITEM",
12112            "STYLED_ITEM",
12113        ],
12114    ),
12115    (
12116        "ANNOTATION_PLANE",
12117        true,
12118        &[
12119            "ANNOTATION_OCCURRENCE",
12120            "GEOMETRIC_REPRESENTATION_ITEM",
12121            "REPRESENTATION_ITEM",
12122            "STYLED_ITEM",
12123        ],
12124    ),
12125    (
12126        "ANNOTATION_SYMBOL",
12127        true,
12128        &["MAPPED_ITEM", "REPRESENTATION_ITEM"],
12129    ),
12130    (
12131        "ANNOTATION_SYMBOL_OCCURRENCE",
12132        true,
12133        &[
12134            "ANNOTATION_OCCURRENCE",
12135            "REPRESENTATION_ITEM",
12136            "STYLED_ITEM",
12137        ],
12138    ),
12139    (
12140        "ANNOTATION_TEXT",
12141        true,
12142        &["MAPPED_ITEM", "REPRESENTATION_ITEM"],
12143    ),
12144    (
12145        "ANNOTATION_TEXT_CHARACTER",
12146        true,
12147        &["MAPPED_ITEM", "REPRESENTATION_ITEM"],
12148    ),
12149    (
12150        "ANNOTATION_TEXT_OCCURRENCE",
12151        true,
12152        &[
12153            "ANNOTATION_OCCURRENCE",
12154            "REPRESENTATION_ITEM",
12155            "STYLED_ITEM",
12156        ],
12157    ),
12158    ("APPLICATION_CONTEXT_ELEMENT", true, &[]),
12159    (
12160        "APPLIED_APPROVAL_ASSIGNMENT",
12161        true,
12162        &["APPROVAL_ASSIGNMENT"],
12163    ),
12164    (
12165        "APPLIED_DATE_AND_TIME_ASSIGNMENT",
12166        true,
12167        &["DATE_AND_TIME_ASSIGNMENT"],
12168    ),
12169    ("APPLIED_DOCUMENT_REFERENCE", true, &["DOCUMENT_REFERENCE"]),
12170    (
12171        "APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT",
12172        true,
12173        &[
12174            "EXTERNAL_IDENTIFICATION_ASSIGNMENT",
12175            "IDENTIFICATION_ASSIGNMENT",
12176        ],
12177    ),
12178    ("APPLIED_GROUP_ASSIGNMENT", true, &["GROUP_ASSIGNMENT"]),
12179    (
12180        "APPLIED_PERSON_AND_ORGANIZATION_ASSIGNMENT",
12181        true,
12182        &["PERSON_AND_ORGANIZATION_ASSIGNMENT"],
12183    ),
12184    ("APPLIED_PRESENTED_ITEM", true, &["PRESENTED_ITEM"]),
12185    (
12186        "APPLIED_SECURITY_CLASSIFICATION_ASSIGNMENT",
12187        true,
12188        &["SECURITY_CLASSIFICATION_ASSIGNMENT"],
12189    ),
12190    ("APPROVAL_ASSIGNMENT", true, &[]),
12191    ("AREA_IN_SET", true, &[]),
12192    ("ASCRIBABLE_STATE_RELATIONSHIP", true, &[]),
12193    (
12194        "ASSEMBLY_COMPONENT_USAGE",
12195        true,
12196        &[
12197            "PRODUCT_DEFINITION_RELATIONSHIP",
12198            "PRODUCT_DEFINITION_USAGE",
12199        ],
12200    ),
12201    (
12202        "BEZIER_CURVE",
12203        true,
12204        &[
12205            "BOUNDED_CURVE",
12206            "B_SPLINE_CURVE",
12207            "CURVE",
12208            "GEOMETRIC_REPRESENTATION_ITEM",
12209            "REPRESENTATION_ITEM",
12210        ],
12211    ),
12212    (
12213        "BEZIER_SURFACE",
12214        true,
12215        &[
12216            "BOUNDED_SURFACE",
12217            "B_SPLINE_SURFACE",
12218            "GEOMETRIC_REPRESENTATION_ITEM",
12219            "REPRESENTATION_ITEM",
12220            "SURFACE",
12221        ],
12222    ),
12223    (
12224        "BOUNDED_CURVE",
12225        true,
12226        &[
12227            "CURVE",
12228            "GEOMETRIC_REPRESENTATION_ITEM",
12229            "REPRESENTATION_ITEM",
12230        ],
12231    ),
12232    (
12233        "BOUNDED_PCURVE",
12234        true,
12235        &[
12236            "BOUNDED_CURVE",
12237            "CURVE",
12238            "GEOMETRIC_REPRESENTATION_ITEM",
12239            "PCURVE",
12240            "REPRESENTATION_ITEM",
12241        ],
12242    ),
12243    (
12244        "BOUNDED_SURFACE",
12245        true,
12246        &[
12247            "GEOMETRIC_REPRESENTATION_ITEM",
12248            "REPRESENTATION_ITEM",
12249            "SURFACE",
12250        ],
12251    ),
12252    (
12253        "BOUNDED_SURFACE_CURVE",
12254        true,
12255        &[
12256            "BOUNDED_CURVE",
12257            "CURVE",
12258            "GEOMETRIC_REPRESENTATION_ITEM",
12259            "REPRESENTATION_ITEM",
12260            "SURFACE_CURVE",
12261        ],
12262    ),
12263    (
12264        "BREP_WITH_VOIDS",
12265        true,
12266        &[
12267            "GEOMETRIC_REPRESENTATION_ITEM",
12268            "MANIFOLD_SOLID_BREP",
12269            "REPRESENTATION_ITEM",
12270            "SOLID_MODEL",
12271        ],
12272    ),
12273    (
12274        "B_SPLINE_CURVE",
12275        true,
12276        &[
12277            "BOUNDED_CURVE",
12278            "CURVE",
12279            "GEOMETRIC_REPRESENTATION_ITEM",
12280            "REPRESENTATION_ITEM",
12281        ],
12282    ),
12283    (
12284        "B_SPLINE_CURVE_WITH_KNOTS",
12285        true,
12286        &[
12287            "BOUNDED_CURVE",
12288            "B_SPLINE_CURVE",
12289            "CURVE",
12290            "GEOMETRIC_REPRESENTATION_ITEM",
12291            "REPRESENTATION_ITEM",
12292        ],
12293    ),
12294    (
12295        "B_SPLINE_SURFACE",
12296        true,
12297        &[
12298            "BOUNDED_SURFACE",
12299            "GEOMETRIC_REPRESENTATION_ITEM",
12300            "REPRESENTATION_ITEM",
12301            "SURFACE",
12302        ],
12303    ),
12304    (
12305        "B_SPLINE_SURFACE_WITH_KNOTS",
12306        true,
12307        &[
12308            "BOUNDED_SURFACE",
12309            "B_SPLINE_SURFACE",
12310            "GEOMETRIC_REPRESENTATION_ITEM",
12311            "REPRESENTATION_ITEM",
12312            "SURFACE",
12313        ],
12314    ),
12315    (
12316        "CAMERA_IMAGE",
12317        true,
12318        &["MAPPED_ITEM", "REPRESENTATION_ITEM"],
12319    ),
12320    (
12321        "CAMERA_IMAGE_3D_WITH_SCALE",
12322        true,
12323        &["CAMERA_IMAGE", "MAPPED_ITEM", "REPRESENTATION_ITEM"],
12324    ),
12325    (
12326        "CAMERA_MODEL",
12327        true,
12328        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
12329    ),
12330    (
12331        "CAMERA_MODEL_D3",
12332        true,
12333        &[
12334            "CAMERA_MODEL",
12335            "GEOMETRIC_REPRESENTATION_ITEM",
12336            "REPRESENTATION_ITEM",
12337        ],
12338    ),
12339    (
12340        "CAMERA_MODEL_D3_MULTI_CLIPPING",
12341        true,
12342        &[
12343            "CAMERA_MODEL",
12344            "CAMERA_MODEL_D3",
12345            "GEOMETRIC_REPRESENTATION_ITEM",
12346            "REPRESENTATION_ITEM",
12347        ],
12348    ),
12349    (
12350        "CAMERA_MODEL_D3_WITH_HLHSR",
12351        true,
12352        &[
12353            "CAMERA_MODEL",
12354            "CAMERA_MODEL_D3",
12355            "GEOMETRIC_REPRESENTATION_ITEM",
12356            "REPRESENTATION_ITEM",
12357        ],
12358    ),
12359    ("CAMERA_USAGE", true, &["REPRESENTATION_MAP"]),
12360    ("CC_DESIGN_APPROVAL", true, &["APPROVAL_ASSIGNMENT"]),
12361    (
12362        "CC_DESIGN_DATE_AND_TIME_ASSIGNMENT",
12363        true,
12364        &["DATE_AND_TIME_ASSIGNMENT"],
12365    ),
12366    (
12367        "CC_DESIGN_PERSON_AND_ORGANIZATION_ASSIGNMENT",
12368        true,
12369        &["PERSON_AND_ORGANIZATION_ASSIGNMENT"],
12370    ),
12371    (
12372        "CC_DESIGN_SECURITY_CLASSIFICATION",
12373        true,
12374        &["SECURITY_CLASSIFICATION_ASSIGNMENT"],
12375    ),
12376    ("CHANGE_REQUEST", true, &["ACTION_REQUEST_ASSIGNMENT"]),
12377    (
12378        "CHARACTERIZED_ITEM_WITHIN_REPRESENTATION",
12379        true,
12380        &["CHARACTERIZED_OBJECT"],
12381    ),
12382    ("CHARACTERIZED_OBJECT", true, &[]),
12383    (
12384        "CHARACTERIZED_REPRESENTATION",
12385        true,
12386        &["CHARACTERIZED_OBJECT", "REPRESENTATION"],
12387    ),
12388    ("CHARACTER_GLYPH_STYLE_OUTLINE", true, &["FOUNDED_ITEM"]),
12389    ("CHARACTER_GLYPH_STYLE_STROKE", true, &["FOUNDED_ITEM"]),
12390    (
12391        "CIRCULAR_RUNOUT_TOLERANCE",
12392        true,
12393        &[
12394            "GEOMETRIC_TOLERANCE",
12395            "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
12396        ],
12397    ),
12398    (
12399        "CLOSED_SHELL",
12400        true,
12401        &[
12402            "CONNECTED_FACE_SET",
12403            "REPRESENTATION_ITEM",
12404            "TOPOLOGICAL_REPRESENTATION_ITEM",
12405        ],
12406    ),
12407    ("COLOUR", true, &[]),
12408    ("COLOUR_RGB", true, &["COLOUR", "COLOUR_SPECIFICATION"]),
12409    ("COLOUR_SPECIFICATION", true, &["COLOUR"]),
12410    (
12411        "COMMON_DATUM",
12412        true,
12413        &["COMPOSITE_SHAPE_ASPECT", "DATUM", "SHAPE_ASPECT"],
12414    ),
12415    (
12416        "COMPOSITE_CURVE",
12417        true,
12418        &[
12419            "BOUNDED_CURVE",
12420            "CURVE",
12421            "GEOMETRIC_REPRESENTATION_ITEM",
12422            "REPRESENTATION_ITEM",
12423        ],
12424    ),
12425    ("COMPOSITE_CURVE_SEGMENT", true, &["FOUNDED_ITEM"]),
12426    (
12427        "COMPOSITE_GROUP_SHAPE_ASPECT",
12428        true,
12429        &["COMPOSITE_SHAPE_ASPECT", "SHAPE_ASPECT"],
12430    ),
12431    ("COMPOSITE_SHAPE_ASPECT", true, &["SHAPE_ASPECT"]),
12432    (
12433        "COMPOSITE_TEXT",
12434        true,
12435        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
12436    ),
12437    (
12438        "COMPOUND_REPRESENTATION_ITEM",
12439        true,
12440        &["REPRESENTATION_ITEM"],
12441    ),
12442    (
12443        "CONFIGURATION_EFFECTIVITY",
12444        true,
12445        &["EFFECTIVITY", "PRODUCT_DEFINITION_EFFECTIVITY"],
12446    ),
12447    ("CONFIGURATION_ITEM", true, &[]),
12448    (
12449        "CONNECTED_FACE_SET",
12450        true,
12451        &["REPRESENTATION_ITEM", "TOPOLOGICAL_REPRESENTATION_ITEM"],
12452    ),
12453    (
12454        "CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP",
12455        true,
12456        &["REPRESENTATION_RELATIONSHIP"],
12457    ),
12458    (
12459        "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
12460        true,
12461        &[
12462            "OVER_RIDING_STYLED_ITEM",
12463            "REPRESENTATION_ITEM",
12464            "STYLED_ITEM",
12465        ],
12466    ),
12467    ("CONTEXT_DEPENDENT_UNIT", true, &["NAMED_UNIT"]),
12468    ("CONVERSION_BASED_UNIT", true, &["NAMED_UNIT"]),
12469    (
12470        "CURVE",
12471        true,
12472        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
12473    ),
12474    ("CURVE_STYLE", true, &["FOUNDED_ITEM"]),
12475    ("CURVE_STYLE_FONT", true, &["FOUNDED_ITEM"]),
12476    ("CURVE_STYLE_FONT_AND_SCALING", true, &["FOUNDED_ITEM"]),
12477    ("CURVE_STYLE_FONT_PATTERN", true, &["FOUNDED_ITEM"]),
12478    ("CYLINDRICITY_TOLERANCE", true, &["GEOMETRIC_TOLERANCE"]),
12479    ("DATE", true, &[]),
12480    ("DATE_AND_TIME", true, &[]),
12481    ("DATE_AND_TIME_ASSIGNMENT", true, &[]),
12482    ("DATUM", true, &["SHAPE_ASPECT"]),
12483    ("DATUM_FEATURE", true, &["SHAPE_ASPECT"]),
12484    ("DATUM_REFERENCE", true, &[]),
12485    ("DATUM_SYSTEM", true, &["SHAPE_ASPECT"]),
12486    ("DATUM_TARGET", true, &["SHAPE_ASPECT"]),
12487    (
12488        "DEFAULT_MODEL_GEOMETRIC_VIEW",
12489        true,
12490        &[
12491            "CHARACTERIZED_ITEM_WITHIN_REPRESENTATION",
12492            "CHARACTERIZED_OBJECT",
12493            "MODEL_GEOMETRIC_VIEW",
12494            "SHAPE_ASPECT",
12495        ],
12496    ),
12497    ("DEFINITIONAL_REPRESENTATION", true, &["REPRESENTATION"]),
12498    (
12499        "DEFINITIONAL_REPRESENTATION_RELATIONSHIP",
12500        true,
12501        &["REPRESENTATION_RELATIONSHIP"],
12502    ),
12503    (
12504        "DEFINITIONAL_REPRESENTATION_RELATIONSHIP_WITH_SAME_CONTEXT",
12505        true,
12506        &[
12507            "DEFINITIONAL_REPRESENTATION_RELATIONSHIP",
12508            "REPRESENTATION_RELATIONSHIP",
12509        ],
12510    ),
12511    (
12512        "DEGENERATE_TOROIDAL_SURFACE",
12513        true,
12514        &[
12515            "ELEMENTARY_SURFACE",
12516            "GEOMETRIC_REPRESENTATION_ITEM",
12517            "REPRESENTATION_ITEM",
12518            "SURFACE",
12519            "TOROIDAL_SURFACE",
12520        ],
12521    ),
12522    ("DERIVED_UNIT", true, &[]),
12523    (
12524        "DESIGN_CONTEXT",
12525        true,
12526        &["APPLICATION_CONTEXT_ELEMENT", "PRODUCT_DEFINITION_CONTEXT"],
12527    ),
12528    ("DIMENSIONAL_SIZE", true, &[]),
12529    (
12530        "DIRECTION",
12531        true,
12532        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
12533    ),
12534    ("DOCUMENT", true, &[]),
12535    ("DOCUMENT_FILE", true, &["CHARACTERIZED_OBJECT", "DOCUMENT"]),
12536    ("DOCUMENT_PRODUCT_ASSOCIATION", true, &[]),
12537    (
12538        "DOCUMENT_PRODUCT_EQUIVALENCE",
12539        true,
12540        &["DOCUMENT_PRODUCT_ASSOCIATION"],
12541    ),
12542    ("DOCUMENT_REFERENCE", true, &[]),
12543    (
12544        "DRAUGHTING_ANNOTATION_OCCURRENCE",
12545        true,
12546        &[
12547            "ANNOTATION_OCCURRENCE",
12548            "REPRESENTATION_ITEM",
12549            "STYLED_ITEM",
12550        ],
12551    ),
12552    (
12553        "DRAUGHTING_CALLOUT",
12554        true,
12555        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
12556    ),
12557    ("DRAUGHTING_CALLOUT_RELATIONSHIP", true, &[]),
12558    ("DRAUGHTING_MODEL", true, &["REPRESENTATION"]),
12559    (
12560        "DRAUGHTING_MODEL_ITEM_ASSOCIATION",
12561        true,
12562        &["ITEM_IDENTIFIED_REPRESENTATION_USAGE"],
12563    ),
12564    (
12565        "DRAUGHTING_MODEL_ITEM_ASSOCIATION_WITH_PLACEHOLDER",
12566        true,
12567        &[
12568            "DRAUGHTING_MODEL_ITEM_ASSOCIATION",
12569            "ITEM_IDENTIFIED_REPRESENTATION_USAGE",
12570        ],
12571    ),
12572    (
12573        "DRAUGHTING_PRE_DEFINED_COLOUR",
12574        true,
12575        &["COLOUR", "PRE_DEFINED_COLOUR", "PRE_DEFINED_ITEM"],
12576    ),
12577    (
12578        "DRAUGHTING_PRE_DEFINED_CURVE_FONT",
12579        true,
12580        &["PRE_DEFINED_CURVE_FONT", "PRE_DEFINED_ITEM"],
12581    ),
12582    (
12583        "DRAUGHTING_PRE_DEFINED_TEXT_FONT",
12584        true,
12585        &["PRE_DEFINED_ITEM", "PRE_DEFINED_TEXT_FONT"],
12586    ),
12587    (
12588        "EDGE",
12589        true,
12590        &["REPRESENTATION_ITEM", "TOPOLOGICAL_REPRESENTATION_ITEM"],
12591    ),
12592    (
12593        "EDGE_CURVE",
12594        true,
12595        &[
12596            "EDGE",
12597            "GEOMETRIC_REPRESENTATION_ITEM",
12598            "REPRESENTATION_ITEM",
12599            "TOPOLOGICAL_REPRESENTATION_ITEM",
12600        ],
12601    ),
12602    (
12603        "EDGE_LOOP",
12604        true,
12605        &[
12606            "LOOP",
12607            "PATH",
12608            "REPRESENTATION_ITEM",
12609            "TOPOLOGICAL_REPRESENTATION_ITEM",
12610        ],
12611    ),
12612    ("EFFECTIVITY", true, &[]),
12613    (
12614        "ELEMENTARY_SURFACE",
12615        true,
12616        &[
12617            "GEOMETRIC_REPRESENTATION_ITEM",
12618            "REPRESENTATION_ITEM",
12619            "SURFACE",
12620        ],
12621    ),
12622    ("EXPRESSION", true, &["GENERIC_EXPRESSION"]),
12623    (
12624        "EXTERNALLY_DEFINED_CHARACTER_GLYPH",
12625        true,
12626        &["EXTERNALLY_DEFINED_ITEM"],
12627    ),
12628    (
12629        "EXTERNALLY_DEFINED_CURVE_FONT",
12630        true,
12631        &["EXTERNALLY_DEFINED_ITEM"],
12632    ),
12633    (
12634        "EXTERNALLY_DEFINED_HATCH_STYLE",
12635        true,
12636        &[
12637            "EXTERNALLY_DEFINED_ITEM",
12638            "GEOMETRIC_REPRESENTATION_ITEM",
12639            "REPRESENTATION_ITEM",
12640        ],
12641    ),
12642    ("EXTERNALLY_DEFINED_ITEM", true, &[]),
12643    (
12644        "EXTERNALLY_DEFINED_STYLE",
12645        true,
12646        &["EXTERNALLY_DEFINED_ITEM", "FOUNDED_ITEM"],
12647    ),
12648    (
12649        "EXTERNALLY_DEFINED_SYMBOL",
12650        true,
12651        &["EXTERNALLY_DEFINED_ITEM"],
12652    ),
12653    (
12654        "EXTERNALLY_DEFINED_TEXT_FONT",
12655        true,
12656        &["EXTERNALLY_DEFINED_ITEM"],
12657    ),
12658    (
12659        "EXTERNALLY_DEFINED_TILE",
12660        true,
12661        &["EXTERNALLY_DEFINED_ITEM"],
12662    ),
12663    (
12664        "EXTERNALLY_DEFINED_TILE_STYLE",
12665        true,
12666        &[
12667            "EXTERNALLY_DEFINED_ITEM",
12668            "GEOMETRIC_REPRESENTATION_ITEM",
12669            "REPRESENTATION_ITEM",
12670        ],
12671    ),
12672    (
12673        "EXTERNAL_IDENTIFICATION_ASSIGNMENT",
12674        true,
12675        &["IDENTIFICATION_ASSIGNMENT"],
12676    ),
12677    ("EXTERNAL_SOURCE", true, &[]),
12678    (
12679        "FACE",
12680        true,
12681        &["REPRESENTATION_ITEM", "TOPOLOGICAL_REPRESENTATION_ITEM"],
12682    ),
12683    (
12684        "FACE_BOUND",
12685        true,
12686        &["REPRESENTATION_ITEM", "TOPOLOGICAL_REPRESENTATION_ITEM"],
12687    ),
12688    (
12689        "FACE_OUTER_BOUND",
12690        true,
12691        &[
12692            "FACE_BOUND",
12693            "REPRESENTATION_ITEM",
12694            "TOPOLOGICAL_REPRESENTATION_ITEM",
12695        ],
12696    ),
12697    (
12698        "FACE_SURFACE",
12699        true,
12700        &[
12701            "FACE",
12702            "GEOMETRIC_REPRESENTATION_ITEM",
12703            "REPRESENTATION_ITEM",
12704            "TOPOLOGICAL_REPRESENTATION_ITEM",
12705        ],
12706    ),
12707    ("FILL_AREA_STYLE", true, &["FOUNDED_ITEM"]),
12708    (
12709        "FILL_AREA_STYLE_HATCHING",
12710        true,
12711        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
12712    ),
12713    (
12714        "FILL_AREA_STYLE_TILES",
12715        true,
12716        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
12717    ),
12718    (
12719        "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE",
12720        true,
12721        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
12722    ),
12723    ("FLATNESS_TOLERANCE", true, &["GEOMETRIC_TOLERANCE"]),
12724    ("FOUNDED_ITEM", true, &[]),
12725    ("FUNCTIONALLY_DEFINED_TRANSFORMATION", true, &[]),
12726    ("GENERAL_DATUM_REFERENCE", true, &["SHAPE_ASPECT"]),
12727    ("GENERAL_PROPERTY", true, &[]),
12728    ("GENERIC_EXPRESSION", true, &[]),
12729    (
12730        "GENERIC_LITERAL",
12731        true,
12732        &["GENERIC_EXPRESSION", "SIMPLE_GENERIC_EXPRESSION"],
12733    ),
12734    ("GENERIC_PRODUCT_DEFINITION_REFERENCE", true, &[]),
12735    (
12736        "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
12737        true,
12738        &["REPRESENTATION", "SHAPE_REPRESENTATION"],
12739    ),
12740    (
12741        "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
12742        true,
12743        &["REPRESENTATION", "SHAPE_REPRESENTATION"],
12744    ),
12745    (
12746        "GEOMETRIC_CURVE_SET",
12747        true,
12748        &[
12749            "GEOMETRIC_REPRESENTATION_ITEM",
12750            "GEOMETRIC_SET",
12751            "REPRESENTATION_ITEM",
12752        ],
12753    ),
12754    (
12755        "GEOMETRIC_ITEM_SPECIFIC_USAGE",
12756        true,
12757        &["ITEM_IDENTIFIED_REPRESENTATION_USAGE"],
12758    ),
12759    (
12760        "GEOMETRIC_REPRESENTATION_CONTEXT",
12761        true,
12762        &["REPRESENTATION_CONTEXT"],
12763    ),
12764    (
12765        "GEOMETRIC_REPRESENTATION_ITEM",
12766        true,
12767        &["REPRESENTATION_ITEM"],
12768    ),
12769    (
12770        "GEOMETRIC_SET",
12771        true,
12772        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
12773    ),
12774    ("GEOMETRIC_TOLERANCE", true, &[]),
12775    (
12776        "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
12777        true,
12778        &["GEOMETRIC_TOLERANCE"],
12779    ),
12780    (
12781        "GEOMETRIC_TOLERANCE_WITH_DEFINED_AREA_UNIT",
12782        true,
12783        &[
12784            "GEOMETRIC_TOLERANCE",
12785            "GEOMETRIC_TOLERANCE_WITH_DEFINED_UNIT",
12786        ],
12787    ),
12788    (
12789        "GEOMETRIC_TOLERANCE_WITH_DEFINED_UNIT",
12790        true,
12791        &["GEOMETRIC_TOLERANCE"],
12792    ),
12793    (
12794        "GEOMETRIC_TOLERANCE_WITH_MAXIMUM_TOLERANCE",
12795        true,
12796        &["GEOMETRIC_TOLERANCE", "GEOMETRIC_TOLERANCE_WITH_MODIFIERS"],
12797    ),
12798    (
12799        "GEOMETRIC_TOLERANCE_WITH_MODIFIERS",
12800        true,
12801        &["GEOMETRIC_TOLERANCE"],
12802    ),
12803    (
12804        "GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT",
12805        true,
12806        &["REPRESENTATION_CONTEXT"],
12807    ),
12808    (
12809        "GLOBAL_UNIT_ASSIGNED_CONTEXT",
12810        true,
12811        &["REPRESENTATION_CONTEXT"],
12812    ),
12813    ("GROUP", true, &[]),
12814    ("GROUP_ASSIGNMENT", true, &[]),
12815    ("IDENTIFICATION_ASSIGNMENT", true, &[]),
12816    (
12817        "INTEGER_REPRESENTATION_ITEM",
12818        true,
12819        &[
12820            "EXPRESSION",
12821            "GENERIC_EXPRESSION",
12822            "GENERIC_LITERAL",
12823            "INT_LITERAL",
12824            "LITERAL_NUMBER",
12825            "NUMERIC_EXPRESSION",
12826            "REPRESENTATION_ITEM",
12827            "SIMPLE_GENERIC_EXPRESSION",
12828            "SIMPLE_NUMERIC_EXPRESSION",
12829        ],
12830    ),
12831    (
12832        "INTERSECTION_CURVE",
12833        true,
12834        &[
12835            "CURVE",
12836            "GEOMETRIC_REPRESENTATION_ITEM",
12837            "REPRESENTATION_ITEM",
12838            "SURFACE_CURVE",
12839        ],
12840    ),
12841    (
12842        "INT_LITERAL",
12843        true,
12844        &[
12845            "EXPRESSION",
12846            "GENERIC_EXPRESSION",
12847            "GENERIC_LITERAL",
12848            "LITERAL_NUMBER",
12849            "NUMERIC_EXPRESSION",
12850            "SIMPLE_GENERIC_EXPRESSION",
12851            "SIMPLE_NUMERIC_EXPRESSION",
12852        ],
12853    ),
12854    ("INVISIBILITY", true, &[]),
12855    ("ITEM_DEFINED_TRANSFORMATION", true, &[]),
12856    ("ITEM_IDENTIFIED_REPRESENTATION_USAGE", true, &[]),
12857    (
12858        "LEADER_CURVE",
12859        true,
12860        &[
12861            "ANNOTATION_CURVE_OCCURRENCE",
12862            "ANNOTATION_OCCURRENCE",
12863            "REPRESENTATION_ITEM",
12864            "STYLED_ITEM",
12865        ],
12866    ),
12867    (
12868        "LEADER_DIRECTED_CALLOUT",
12869        true,
12870        &[
12871            "DRAUGHTING_CALLOUT",
12872            "GEOMETRIC_REPRESENTATION_ITEM",
12873            "REPRESENTATION_ITEM",
12874        ],
12875    ),
12876    (
12877        "LEADER_TERMINATOR",
12878        true,
12879        &[
12880            "ANNOTATION_OCCURRENCE",
12881            "ANNOTATION_SYMBOL_OCCURRENCE",
12882            "REPRESENTATION_ITEM",
12883            "STYLED_ITEM",
12884            "TERMINATOR_SYMBOL",
12885        ],
12886    ),
12887    ("LENGTH_MEASURE_WITH_UNIT", true, &["MEASURE_WITH_UNIT"]),
12888    ("LENGTH_UNIT", true, &["NAMED_UNIT"]),
12889    ("LINE_PROFILE_TOLERANCE", true, &["GEOMETRIC_TOLERANCE"]),
12890    (
12891        "LITERAL_NUMBER",
12892        true,
12893        &[
12894            "EXPRESSION",
12895            "GENERIC_EXPRESSION",
12896            "GENERIC_LITERAL",
12897            "NUMERIC_EXPRESSION",
12898            "SIMPLE_GENERIC_EXPRESSION",
12899            "SIMPLE_NUMERIC_EXPRESSION",
12900        ],
12901    ),
12902    (
12903        "LOOP",
12904        true,
12905        &["REPRESENTATION_ITEM", "TOPOLOGICAL_REPRESENTATION_ITEM"],
12906    ),
12907    (
12908        "MANIFOLD_SOLID_BREP",
12909        true,
12910        &[
12911            "GEOMETRIC_REPRESENTATION_ITEM",
12912            "REPRESENTATION_ITEM",
12913            "SOLID_MODEL",
12914        ],
12915    ),
12916    (
12917        "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
12918        true,
12919        &["REPRESENTATION", "SHAPE_REPRESENTATION"],
12920    ),
12921    ("MAPPED_ITEM", true, &["REPRESENTATION_ITEM"]),
12922    ("MASS_UNIT", true, &["NAMED_UNIT"]),
12923    (
12924        "MEASURE_REPRESENTATION_ITEM",
12925        true,
12926        &["MEASURE_WITH_UNIT", "REPRESENTATION_ITEM"],
12927    ),
12928    ("MEASURE_WITH_UNIT", true, &[]),
12929    (
12930        "MECHANICAL_CONTEXT",
12931        true,
12932        &["APPLICATION_CONTEXT_ELEMENT", "PRODUCT_CONTEXT"],
12933    ),
12934    (
12935        "MECHANICAL_DESIGN_AND_DRAUGHTING_RELATIONSHIP",
12936        true,
12937        &[
12938            "DEFINITIONAL_REPRESENTATION_RELATIONSHIP",
12939            "DEFINITIONAL_REPRESENTATION_RELATIONSHIP_WITH_SAME_CONTEXT",
12940            "REPRESENTATION_RELATIONSHIP",
12941        ],
12942    ),
12943    (
12944        "MODEL_GEOMETRIC_VIEW",
12945        true,
12946        &[
12947            "CHARACTERIZED_ITEM_WITHIN_REPRESENTATION",
12948            "CHARACTERIZED_OBJECT",
12949        ],
12950    ),
12951    (
12952        "MODIFIED_GEOMETRIC_TOLERANCE",
12953        true,
12954        &["GEOMETRIC_TOLERANCE"],
12955    ),
12956    ("NAMED_UNIT", true, &[]),
12957    (
12958        "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
12959        true,
12960        &[
12961            "ASSEMBLY_COMPONENT_USAGE",
12962            "PRODUCT_DEFINITION_RELATIONSHIP",
12963            "PRODUCT_DEFINITION_USAGE",
12964        ],
12965    ),
12966    (
12967        "NUMERIC_EXPRESSION",
12968        true,
12969        &["EXPRESSION", "GENERIC_EXPRESSION"],
12970    ),
12971    (
12972        "ONE_DIRECTION_REPEAT_FACTOR",
12973        true,
12974        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
12975    ),
12976    (
12977        "OPEN_SHELL",
12978        true,
12979        &[
12980            "CONNECTED_FACE_SET",
12981            "REPRESENTATION_ITEM",
12982            "TOPOLOGICAL_REPRESENTATION_ITEM",
12983        ],
12984    ),
12985    ("ORGANIZATIONAL_ADDRESS", true, &["ADDRESS"]),
12986    (
12987        "ORIENTED_CLOSED_SHELL",
12988        true,
12989        &[
12990            "CLOSED_SHELL",
12991            "CONNECTED_FACE_SET",
12992            "REPRESENTATION_ITEM",
12993            "TOPOLOGICAL_REPRESENTATION_ITEM",
12994        ],
12995    ),
12996    (
12997        "ORIENTED_EDGE",
12998        true,
12999        &[
13000            "EDGE",
13001            "REPRESENTATION_ITEM",
13002            "TOPOLOGICAL_REPRESENTATION_ITEM",
13003        ],
13004    ),
13005    (
13006        "OVER_RIDING_STYLED_ITEM",
13007        true,
13008        &["REPRESENTATION_ITEM", "STYLED_ITEM"],
13009    ),
13010    (
13011        "PARALLELISM_TOLERANCE",
13012        true,
13013        &[
13014            "GEOMETRIC_TOLERANCE",
13015            "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
13016        ],
13017    ),
13018    (
13019        "PARAMETRIC_REPRESENTATION_CONTEXT",
13020        true,
13021        &["REPRESENTATION_CONTEXT"],
13022    ),
13023    (
13024        "PATH",
13025        true,
13026        &["REPRESENTATION_ITEM", "TOPOLOGICAL_REPRESENTATION_ITEM"],
13027    ),
13028    (
13029        "PCURVE",
13030        true,
13031        &[
13032            "CURVE",
13033            "GEOMETRIC_REPRESENTATION_ITEM",
13034            "REPRESENTATION_ITEM",
13035        ],
13036    ),
13037    (
13038        "PERPENDICULARITY_TOLERANCE",
13039        true,
13040        &[
13041            "GEOMETRIC_TOLERANCE",
13042            "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
13043        ],
13044    ),
13045    ("PERSONAL_ADDRESS", true, &["ADDRESS"]),
13046    (
13047        "PERSON_AND_ORGANIZATION_ADDRESS",
13048        true,
13049        &["ADDRESS", "ORGANIZATIONAL_ADDRESS", "PERSONAL_ADDRESS"],
13050    ),
13051    ("PERSON_AND_ORGANIZATION_ASSIGNMENT", true, &[]),
13052    (
13053        "PLACED_DATUM_TARGET_FEATURE",
13054        true,
13055        &["DATUM_TARGET", "SHAPE_ASPECT"],
13056    ),
13057    (
13058        "PLACEMENT",
13059        true,
13060        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
13061    ),
13062    (
13063        "PLANAR_BOX",
13064        true,
13065        &[
13066            "GEOMETRIC_REPRESENTATION_ITEM",
13067            "PLANAR_EXTENT",
13068            "REPRESENTATION_ITEM",
13069        ],
13070    ),
13071    (
13072        "PLANAR_EXTENT",
13073        true,
13074        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
13075    ),
13076    (
13077        "PLANE_ANGLE_MEASURE_WITH_UNIT",
13078        true,
13079        &["MEASURE_WITH_UNIT"],
13080    ),
13081    ("PLANE_ANGLE_UNIT", true, &["NAMED_UNIT"]),
13082    (
13083        "POINT",
13084        true,
13085        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
13086    ),
13087    ("POINT_STYLE", true, &["FOUNDED_ITEM"]),
13088    (
13089        "POLY_LOOP",
13090        true,
13091        &[
13092            "GEOMETRIC_REPRESENTATION_ITEM",
13093            "LOOP",
13094            "REPRESENTATION_ITEM",
13095            "TOPOLOGICAL_REPRESENTATION_ITEM",
13096        ],
13097    ),
13098    ("POSITION_TOLERANCE", true, &["GEOMETRIC_TOLERANCE"]),
13099    (
13100        "PRESENTATION_AREA",
13101        true,
13102        &["PRESENTATION_REPRESENTATION", "REPRESENTATION"],
13103    ),
13104    ("PRESENTATION_REPRESENTATION", true, &["REPRESENTATION"]),
13105    ("PRESENTATION_SET", true, &[]),
13106    ("PRESENTATION_STYLE_ASSIGNMENT", true, &["FOUNDED_ITEM"]),
13107    (
13108        "PRESENTATION_STYLE_BY_CONTEXT",
13109        true,
13110        &["FOUNDED_ITEM", "PRESENTATION_STYLE_ASSIGNMENT"],
13111    ),
13112    (
13113        "PRESENTATION_VIEW",
13114        true,
13115        &["PRESENTATION_REPRESENTATION", "REPRESENTATION"],
13116    ),
13117    ("PRESENTED_ITEM", true, &[]),
13118    ("PRE_DEFINED_CHARACTER_GLYPH", true, &["PRE_DEFINED_ITEM"]),
13119    ("PRE_DEFINED_COLOUR", true, &["COLOUR", "PRE_DEFINED_ITEM"]),
13120    ("PRE_DEFINED_CURVE_FONT", true, &["PRE_DEFINED_ITEM"]),
13121    ("PRE_DEFINED_ITEM", true, &[]),
13122    ("PRE_DEFINED_MARKER", true, &["PRE_DEFINED_ITEM"]),
13123    (
13124        "PRE_DEFINED_POINT_MARKER_SYMBOL",
13125        true,
13126        &[
13127            "PRE_DEFINED_ITEM",
13128            "PRE_DEFINED_MARKER",
13129            "PRE_DEFINED_SYMBOL",
13130        ],
13131    ),
13132    (
13133        "PRE_DEFINED_PRESENTATION_STYLE",
13134        false,
13135        &["FOUNDED_ITEM", "PRE_DEFINED_ITEM"],
13136    ),
13137    (
13138        "PRE_DEFINED_SURFACE_SIDE_STYLE",
13139        true,
13140        &["PRE_DEFINED_ITEM"],
13141    ),
13142    ("PRE_DEFINED_SYMBOL", true, &["PRE_DEFINED_ITEM"]),
13143    (
13144        "PRE_DEFINED_TERMINATOR_SYMBOL",
13145        true,
13146        &["PRE_DEFINED_ITEM", "PRE_DEFINED_SYMBOL"],
13147    ),
13148    ("PRE_DEFINED_TEXT_FONT", true, &["PRE_DEFINED_ITEM"]),
13149    ("PRE_DEFINED_TILE", true, &["PRE_DEFINED_ITEM"]),
13150    ("PRODUCT", true, &[]),
13151    ("PRODUCT_CATEGORY", true, &[]),
13152    ("PRODUCT_CONCEPT", true, &[]),
13153    ("PRODUCT_CONCEPT_FEATURE", true, &[]),
13154    ("PRODUCT_CONCEPT_FEATURE_CATEGORY", true, &["GROUP"]),
13155    ("PRODUCT_CONTEXT", true, &["APPLICATION_CONTEXT_ELEMENT"]),
13156    ("PRODUCT_DEFINITION", true, &[]),
13157    (
13158        "PRODUCT_DEFINITION_CONTEXT",
13159        true,
13160        &["APPLICATION_CONTEXT_ELEMENT"],
13161    ),
13162    ("PRODUCT_DEFINITION_EFFECTIVITY", true, &["EFFECTIVITY"]),
13163    ("PRODUCT_DEFINITION_FORMATION", true, &[]),
13164    (
13165        "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
13166        true,
13167        &["PRODUCT_DEFINITION_FORMATION"],
13168    ),
13169    ("PRODUCT_DEFINITION_OCCURRENCE", true, &[]),
13170    ("PRODUCT_DEFINITION_RELATIONSHIP", true, &[]),
13171    ("PRODUCT_DEFINITION_RELATIONSHIP_RELATIONSHIP", true, &[]),
13172    ("PRODUCT_DEFINITION_SHAPE", true, &["PROPERTY_DEFINITION"]),
13173    (
13174        "PRODUCT_DEFINITION_USAGE",
13175        true,
13176        &["PRODUCT_DEFINITION_RELATIONSHIP"],
13177    ),
13178    (
13179        "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
13180        true,
13181        &["PRODUCT_DEFINITION"],
13182    ),
13183    (
13184        "PRODUCT_RELATED_PRODUCT_CATEGORY",
13185        true,
13186        &["PRODUCT_CATEGORY"],
13187    ),
13188    (
13189        "PROJECTED_ZONE_DEFINITION",
13190        true,
13191        &["TOLERANCE_ZONE_DEFINITION"],
13192    ),
13193    ("PROPERTY_DEFINITION", true, &[]),
13194    ("PROPERTY_DEFINITION_REPRESENTATION", true, &[]),
13195    (
13196        "QUALIFIED_REPRESENTATION_ITEM",
13197        true,
13198        &["REPRESENTATION_ITEM"],
13199    ),
13200    (
13201        "QUASI_UNIFORM_CURVE",
13202        true,
13203        &[
13204            "BOUNDED_CURVE",
13205            "B_SPLINE_CURVE",
13206            "CURVE",
13207            "GEOMETRIC_REPRESENTATION_ITEM",
13208            "REPRESENTATION_ITEM",
13209        ],
13210    ),
13211    (
13212        "QUASI_UNIFORM_SURFACE",
13213        true,
13214        &[
13215            "BOUNDED_SURFACE",
13216            "B_SPLINE_SURFACE",
13217            "GEOMETRIC_REPRESENTATION_ITEM",
13218            "REPRESENTATION_ITEM",
13219            "SURFACE",
13220        ],
13221    ),
13222    (
13223        "RATIONAL_B_SPLINE_CURVE",
13224        true,
13225        &[
13226            "BOUNDED_CURVE",
13227            "B_SPLINE_CURVE",
13228            "CURVE",
13229            "GEOMETRIC_REPRESENTATION_ITEM",
13230            "REPRESENTATION_ITEM",
13231        ],
13232    ),
13233    (
13234        "RATIONAL_B_SPLINE_SURFACE",
13235        true,
13236        &[
13237            "BOUNDED_SURFACE",
13238            "B_SPLINE_SURFACE",
13239            "GEOMETRIC_REPRESENTATION_ITEM",
13240            "REPRESENTATION_ITEM",
13241            "SURFACE",
13242        ],
13243    ),
13244    ("RATIO_MEASURE_WITH_UNIT", true, &["MEASURE_WITH_UNIT"]),
13245    ("RATIO_UNIT", true, &["NAMED_UNIT"]),
13246    (
13247        "REAL_LITERAL",
13248        true,
13249        &[
13250            "EXPRESSION",
13251            "GENERIC_EXPRESSION",
13252            "GENERIC_LITERAL",
13253            "LITERAL_NUMBER",
13254            "NUMERIC_EXPRESSION",
13255            "SIMPLE_GENERIC_EXPRESSION",
13256            "SIMPLE_NUMERIC_EXPRESSION",
13257        ],
13258    ),
13259    (
13260        "REAL_REPRESENTATION_ITEM",
13261        true,
13262        &[
13263            "EXPRESSION",
13264            "GENERIC_EXPRESSION",
13265            "GENERIC_LITERAL",
13266            "LITERAL_NUMBER",
13267            "NUMERIC_EXPRESSION",
13268            "REAL_LITERAL",
13269            "REPRESENTATION_ITEM",
13270            "SIMPLE_GENERIC_EXPRESSION",
13271            "SIMPLE_NUMERIC_EXPRESSION",
13272        ],
13273    ),
13274    (
13275        "REPOSITIONED_TESSELLATED_ITEM",
13276        true,
13277        &[
13278            "GEOMETRIC_REPRESENTATION_ITEM",
13279            "REPRESENTATION_ITEM",
13280            "TESSELLATED_ITEM",
13281        ],
13282    ),
13283    ("REPRESENTATION", true, &[]),
13284    ("REPRESENTATION_CONTEXT", true, &[]),
13285    ("REPRESENTATION_ITEM", true, &[]),
13286    ("REPRESENTATION_MAP", true, &[]),
13287    ("REPRESENTATION_REFERENCE", true, &[]),
13288    ("REPRESENTATION_RELATIONSHIP", true, &[]),
13289    (
13290        "REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION",
13291        true,
13292        &["REPRESENTATION_RELATIONSHIP"],
13293    ),
13294    ("ROUNDNESS_TOLERANCE", true, &["GEOMETRIC_TOLERANCE"]),
13295    (
13296        "SEAM_CURVE",
13297        true,
13298        &[
13299            "CURVE",
13300            "GEOMETRIC_REPRESENTATION_ITEM",
13301            "REPRESENTATION_ITEM",
13302            "SURFACE_CURVE",
13303        ],
13304    ),
13305    ("SECURITY_CLASSIFICATION_ASSIGNMENT", true, &[]),
13306    ("SHAPE_ASPECT", true, &[]),
13307    ("SHAPE_ASPECT_RELATIONSHIP", true, &[]),
13308    (
13309        "SHAPE_DEFINITION_REPRESENTATION",
13310        true,
13311        &["PROPERTY_DEFINITION_REPRESENTATION"],
13312    ),
13313    (
13314        "SHAPE_DIMENSION_REPRESENTATION",
13315        true,
13316        &["REPRESENTATION", "SHAPE_REPRESENTATION"],
13317    ),
13318    ("SHAPE_REPRESENTATION", true, &["REPRESENTATION"]),
13319    (
13320        "SHAPE_REPRESENTATION_RELATIONSHIP",
13321        true,
13322        &["REPRESENTATION_RELATIONSHIP"],
13323    ),
13324    (
13325        "SHAPE_REPRESENTATION_WITH_PARAMETERS",
13326        true,
13327        &["REPRESENTATION", "SHAPE_REPRESENTATION"],
13328    ),
13329    (
13330        "SHELL_BASED_SURFACE_MODEL",
13331        true,
13332        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
13333    ),
13334    ("SIMPLE_GENERIC_EXPRESSION", true, &["GENERIC_EXPRESSION"]),
13335    (
13336        "SIMPLE_NUMERIC_EXPRESSION",
13337        true,
13338        &[
13339            "EXPRESSION",
13340            "GENERIC_EXPRESSION",
13341            "NUMERIC_EXPRESSION",
13342            "SIMPLE_GENERIC_EXPRESSION",
13343        ],
13344    ),
13345    ("SI_UNIT", true, &["NAMED_UNIT"]),
13346    ("SOLID_ANGLE_UNIT", true, &["NAMED_UNIT"]),
13347    (
13348        "SOLID_MODEL",
13349        true,
13350        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
13351    ),
13352    ("START_REQUEST", true, &["ACTION_REQUEST_ASSIGNMENT"]),
13353    ("STATE_OBSERVED", true, &[]),
13354    ("STATE_TYPE", true, &[]),
13355    ("STRAIGHTNESS_TOLERANCE", true, &["GEOMETRIC_TOLERANCE"]),
13356    ("STYLED_ITEM", true, &["REPRESENTATION_ITEM"]),
13357    (
13358        "SURFACE",
13359        true,
13360        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
13361    ),
13362    (
13363        "SURFACE_CURVE",
13364        true,
13365        &[
13366            "CURVE",
13367            "GEOMETRIC_REPRESENTATION_ITEM",
13368            "REPRESENTATION_ITEM",
13369        ],
13370    ),
13371    ("SURFACE_PROFILE_TOLERANCE", true, &["GEOMETRIC_TOLERANCE"]),
13372    ("SURFACE_SIDE_STYLE", true, &["FOUNDED_ITEM"]),
13373    ("SURFACE_STYLE_BOUNDARY", true, &["FOUNDED_ITEM"]),
13374    ("SURFACE_STYLE_CONTROL_GRID", true, &["FOUNDED_ITEM"]),
13375    ("SURFACE_STYLE_FILL_AREA", true, &["FOUNDED_ITEM"]),
13376    ("SURFACE_STYLE_PARAMETER_LINE", true, &["FOUNDED_ITEM"]),
13377    ("SURFACE_STYLE_REFLECTANCE_AMBIENT", true, &[]),
13378    ("SURFACE_STYLE_RENDERING", true, &[]),
13379    (
13380        "SURFACE_STYLE_RENDERING_WITH_PROPERTIES",
13381        true,
13382        &["SURFACE_STYLE_RENDERING"],
13383    ),
13384    ("SURFACE_STYLE_SEGMENTATION_CURVE", true, &["FOUNDED_ITEM"]),
13385    ("SURFACE_STYLE_SILHOUETTE", true, &["FOUNDED_ITEM"]),
13386    ("SURFACE_STYLE_USAGE", true, &["FOUNDED_ITEM"]),
13387    ("SYMBOL_REPRESENTATION", true, &["REPRESENTATION"]),
13388    ("SYMBOL_STYLE", true, &["FOUNDED_ITEM"]),
13389    (
13390        "TERMINATOR_SYMBOL",
13391        true,
13392        &[
13393            "ANNOTATION_OCCURRENCE",
13394            "ANNOTATION_SYMBOL_OCCURRENCE",
13395            "REPRESENTATION_ITEM",
13396            "STYLED_ITEM",
13397        ],
13398    ),
13399    (
13400        "TESSELLATED_GEOMETRIC_SET",
13401        true,
13402        &[
13403            "GEOMETRIC_REPRESENTATION_ITEM",
13404            "REPRESENTATION_ITEM",
13405            "TESSELLATED_ITEM",
13406        ],
13407    ),
13408    (
13409        "TESSELLATED_ITEM",
13410        true,
13411        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
13412    ),
13413    (
13414        "TESSELLATED_SHAPE_REPRESENTATION",
13415        true,
13416        &["REPRESENTATION", "SHAPE_REPRESENTATION"],
13417    ),
13418    (
13419        "TESSELLATED_STRUCTURED_ITEM",
13420        true,
13421        &[
13422            "GEOMETRIC_REPRESENTATION_ITEM",
13423            "REPRESENTATION_ITEM",
13424            "TESSELLATED_ITEM",
13425        ],
13426    ),
13427    ("TEXTURE_STYLE_SPECIFICATION", true, &["FOUNDED_ITEM"]),
13428    (
13429        "TEXTURE_STYLE_TESSELLATION_SPECIFICATION",
13430        true,
13431        &["FOUNDED_ITEM", "TEXTURE_STYLE_SPECIFICATION"],
13432    ),
13433    (
13434        "TEXT_LITERAL",
13435        true,
13436        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
13437    ),
13438    ("TEXT_STYLE", true, &["FOUNDED_ITEM"]),
13439    (
13440        "TEXT_STYLE_WITH_BOX_CHARACTERISTICS",
13441        true,
13442        &["FOUNDED_ITEM", "TEXT_STYLE"],
13443    ),
13444    ("TIME_UNIT", true, &["NAMED_UNIT"]),
13445    ("TOLERANCE_ZONE", true, &["SHAPE_ASPECT"]),
13446    ("TOLERANCE_ZONE_DEFINITION", true, &[]),
13447    (
13448        "TOLERANCE_ZONE_WITH_DATUM",
13449        true,
13450        &["SHAPE_ASPECT", "TOLERANCE_ZONE"],
13451    ),
13452    (
13453        "TOPOLOGICAL_REPRESENTATION_ITEM",
13454        true,
13455        &["REPRESENTATION_ITEM"],
13456    ),
13457    (
13458        "TOROIDAL_SURFACE",
13459        true,
13460        &[
13461            "ELEMENTARY_SURFACE",
13462            "GEOMETRIC_REPRESENTATION_ITEM",
13463            "REPRESENTATION_ITEM",
13464            "SURFACE",
13465        ],
13466    ),
13467    (
13468        "TWO_DIRECTION_REPEAT_FACTOR",
13469        true,
13470        &[
13471            "GEOMETRIC_REPRESENTATION_ITEM",
13472            "ONE_DIRECTION_REPEAT_FACTOR",
13473            "REPRESENTATION_ITEM",
13474        ],
13475    ),
13476    (
13477        "UNEQUALLY_DISPOSED_GEOMETRIC_TOLERANCE",
13478        true,
13479        &["GEOMETRIC_TOLERANCE"],
13480    ),
13481    (
13482        "UNIFORM_CURVE",
13483        true,
13484        &[
13485            "BOUNDED_CURVE",
13486            "B_SPLINE_CURVE",
13487            "CURVE",
13488            "GEOMETRIC_REPRESENTATION_ITEM",
13489            "REPRESENTATION_ITEM",
13490        ],
13491    ),
13492    (
13493        "UNIFORM_SURFACE",
13494        true,
13495        &[
13496            "BOUNDED_SURFACE",
13497            "B_SPLINE_SURFACE",
13498            "GEOMETRIC_REPRESENTATION_ITEM",
13499            "REPRESENTATION_ITEM",
13500            "SURFACE",
13501        ],
13502    ),
13503    ("VALUE_REPRESENTATION_ITEM", true, &["REPRESENTATION_ITEM"]),
13504    (
13505        "VECTOR",
13506        true,
13507        &["GEOMETRIC_REPRESENTATION_ITEM", "REPRESENTATION_ITEM"],
13508    ),
13509    (
13510        "VERTEX",
13511        true,
13512        &["REPRESENTATION_ITEM", "TOPOLOGICAL_REPRESENTATION_ITEM"],
13513    ),
13514    (
13515        "VERTEX_POINT",
13516        true,
13517        &[
13518            "GEOMETRIC_REPRESENTATION_ITEM",
13519            "REPRESENTATION_ITEM",
13520            "TOPOLOGICAL_REPRESENTATION_ITEM",
13521            "VERTEX",
13522        ],
13523    ),
13524    ("VIEW_VOLUME", true, &["FOUNDED_ITEM"]),
13525];
13526
13527/// ONEOF exclusivity groups: a part bag may intersect at most one
13528/// branch per group.
13529static ONEOF_GROUPS: &[&[&[&str]]] = &[
13530    &[
13531        &["ANNOTATION_CURVE_OCCURRENCE"],
13532        &["ANNOTATION_FILL_AREA_OCCURRENCE"],
13533        &["ANNOTATION_TEXT_OCCURRENCE"],
13534        &["ANNOTATION_SYMBOL_OCCURRENCE"],
13535    ],
13536    &[
13537        &["ANNOTATION_CURVE_OCCURRENCE"],
13538        &["ANNOTATION_FILL_AREA_OCCURRENCE"],
13539        &["ANNOTATION_PLANE"],
13540        &["ANNOTATION_SYMBOL_OCCURRENCE"],
13541        &["ANNOTATION_TEXT_OCCURRENCE"],
13542    ],
13543    &[&["PRODUCT_CONTEXT"], &["PRODUCT_DEFINITION_CONTEXT"]],
13544    &[
13545        &["UNIFORM_CURVE"],
13546        &["B_SPLINE_CURVE_WITH_KNOTS"],
13547        &["QUASI_UNIFORM_CURVE"],
13548        &["BEZIER_CURVE"],
13549    ],
13550    &[
13551        &["B_SPLINE_SURFACE_WITH_KNOTS"],
13552        &["UNIFORM_SURFACE"],
13553        &["QUASI_UNIFORM_SURFACE"],
13554        &["BEZIER_SURFACE"],
13555    ],
13556    &[
13557        &["B_SPLINE_CURVE"],
13558        &["BOUNDED_PCURVE"],
13559        &["BOUNDED_SURFACE_CURVE"],
13560        &["COMPOSITE_CURVE"],
13561    ],
13562    &[&["COMMON_DATUM"], &["COMPOSITE_GROUP_SHAPE_ASPECT"]],
13563    &[&["CLOSED_SHELL"], &["OPEN_SHELL"]],
13564    &[&["PCURVE"], &["SURFACE_CURVE"]],
13565    &[&["EDGE_CURVE"], &["ORIENTED_EDGE"]],
13566    &[
13567        &["CHARACTER_GLYPH_STYLE_OUTLINE"],
13568        &["CHARACTER_GLYPH_STYLE_STROKE"],
13569        &["COMPOSITE_CURVE_SEGMENT"],
13570        &["CURVE_STYLE"],
13571        &["CURVE_STYLE_FONT"],
13572        &["CURVE_STYLE_FONT_AND_SCALING"],
13573        &["CURVE_STYLE_FONT_PATTERN"],
13574        &["EXTERNALLY_DEFINED_STYLE"],
13575        &["FILL_AREA_STYLE"],
13576        &["POINT_STYLE"],
13577        &["PRESENTATION_STYLE_ASSIGNMENT"],
13578        &["SURFACE_SIDE_STYLE"],
13579        &["SURFACE_STYLE_BOUNDARY"],
13580        &["SURFACE_STYLE_CONTROL_GRID"],
13581        &["SURFACE_STYLE_FILL_AREA"],
13582        &["SURFACE_STYLE_PARAMETER_LINE"],
13583        &["SURFACE_STYLE_SEGMENTATION_CURVE"],
13584        &["SURFACE_STYLE_SILHOUETTE"],
13585        &["SURFACE_STYLE_USAGE"],
13586        &["SYMBOL_STYLE"],
13587        &["TEXT_STYLE"],
13588        &["VIEW_VOLUME"],
13589    ],
13590    &[
13591        &["CHARACTER_GLYPH_STYLE_OUTLINE"],
13592        &["CHARACTER_GLYPH_STYLE_STROKE"],
13593        &["CURVE_STYLE"],
13594        &["CURVE_STYLE_FONT"],
13595        &["CURVE_STYLE_FONT_AND_SCALING"],
13596        &["CURVE_STYLE_FONT_PATTERN"],
13597        &["EXTERNALLY_DEFINED_STYLE"],
13598        &["FILL_AREA_STYLE"],
13599        &["POINT_STYLE"],
13600        &["PRESENTATION_STYLE_ASSIGNMENT"],
13601        &["SURFACE_SIDE_STYLE"],
13602        &["SURFACE_STYLE_BOUNDARY"],
13603        &["SURFACE_STYLE_CONTROL_GRID"],
13604        &["SURFACE_STYLE_FILL_AREA"],
13605        &["SURFACE_STYLE_PARAMETER_LINE"],
13606        &["SURFACE_STYLE_SEGMENTATION_CURVE"],
13607        &["SURFACE_STYLE_SILHOUETTE"],
13608        &["SURFACE_STYLE_USAGE"],
13609        &["SYMBOL_STYLE"],
13610        &["TEXT_STYLE"],
13611    ],
13612    &[
13613        &["POINT"],
13614        &["DIRECTION"],
13615        &["VECTOR"],
13616        &["PLACEMENT"],
13617        &["CURVE"],
13618        &["SURFACE"],
13619        &["EDGE_CURVE"],
13620        &["FACE_SURFACE"],
13621        &["POLY_LOOP"],
13622        &["VERTEX_POINT"],
13623        &["SOLID_MODEL"],
13624        &["SHELL_BASED_SURFACE_MODEL"],
13625        &["GEOMETRIC_SET"],
13626        &["TESSELLATED_ITEM"],
13627    ],
13628    &[&["CURVE"], &["POINT"], &["TEXT_LITERAL"]],
13629    &[&["CAMERA_MODEL"], &["CURVE"], &["DIRECTION"]],
13630    &[
13631        &["CURVE"],
13632        &["EXTERNALLY_DEFINED_HATCH_STYLE"],
13633        &["EXTERNALLY_DEFINED_TILE_STYLE"],
13634        &["FILL_AREA_STYLE_HATCHING"],
13635        &["FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE"],
13636        &["FILL_AREA_STYLE_TILES"],
13637        &["ONE_DIRECTION_REPEAT_FACTOR"],
13638        &["POINT"],
13639        &["VECTOR"],
13640    ],
13641    &[&["CURVE"], &["PLANAR_EXTENT"]],
13642    &[
13643        &["GEOMETRIC_TOLERANCE_WITH_MODIFIERS"],
13644        &["MODIFIED_GEOMETRIC_TOLERANCE"],
13645    ],
13646    &[
13647        &["CYLINDRICITY_TOLERANCE"],
13648        &["FLATNESS_TOLERANCE"],
13649        &["LINE_PROFILE_TOLERANCE"],
13650        &["POSITION_TOLERANCE"],
13651        &["ROUNDNESS_TOLERANCE"],
13652        &["STRAIGHTNESS_TOLERANCE"],
13653        &["SURFACE_PROFILE_TOLERANCE"],
13654    ],
13655    &[
13656        &["CIRCULAR_RUNOUT_TOLERANCE"],
13657        &["PARALLELISM_TOLERANCE"],
13658        &["PERPENDICULARITY_TOLERANCE"],
13659    ],
13660    &[&["INT_LITERAL"], &["REAL_LITERAL"]],
13661    &[&["EDGE_LOOP"], &["POLY_LOOP"]],
13662    &[
13663        &["LENGTH_MEASURE_WITH_UNIT"],
13664        &["PLANE_ANGLE_MEASURE_WITH_UNIT"],
13665        &["RATIO_MEASURE_WITH_UNIT"],
13666    ],
13667    &[
13668        &["SI_UNIT"],
13669        &["CONVERSION_BASED_UNIT"],
13670        &["CONTEXT_DEPENDENT_UNIT"],
13671    ],
13672    &[
13673        &["LENGTH_UNIT"],
13674        &["MASS_UNIT"],
13675        &["TIME_UNIT"],
13676        &["PLANE_ANGLE_UNIT"],
13677        &["SOLID_ANGLE_UNIT"],
13678        &["RATIO_UNIT"],
13679    ],
13680    &[&["PRESENTATION_AREA"], &["PRESENTATION_VIEW"]],
13681    &[
13682        &["COMPOUND_REPRESENTATION_ITEM"],
13683        &["MAPPED_ITEM"],
13684        &["VALUE_REPRESENTATION_ITEM"],
13685    ],
13686    &[
13687        &["INTEGER_REPRESENTATION_ITEM"],
13688        &["REAL_REPRESENTATION_ITEM"],
13689    ],
13690    &[&["MAPPED_ITEM"], &["STYLED_ITEM"]],
13691    &[
13692        &["DATUM"],
13693        &["DATUM_FEATURE"],
13694        &["DATUM_TARGET"],
13695        &["DATUM_SYSTEM"],
13696        &["GENERAL_DATUM_REFERENCE"],
13697    ],
13698    &[&["ELEMENTARY_SURFACE"], &["BOUNDED_SURFACE"]],
13699    &[&["INTERSECTION_CURVE"], &["SEAM_CURVE"]],
13700    &[
13701        &["TESSELLATED_GEOMETRIC_SET"],
13702        &["TESSELLATED_STRUCTURED_ITEM"],
13703    ],
13704    &[
13705        &["VERTEX"],
13706        &["EDGE"],
13707        &["FACE_BOUND"],
13708        &["FACE"],
13709        &["CONNECTED_FACE_SET"],
13710        &["LOOP", "PATH"],
13711    ],
13712];
13713
13714/// Name-set validity of a complex part bag: every part known and
13715/// AP242-legal, no duplicates, supertype chains complete (each part's
13716/// transitive supertypes all present — Part 21 external mapping), the set
13717/// connected through those chains (one inheritance graph, no disjoint
13718/// clusters), and no ONEOF group drawn from two branches. Reference fields
13719/// are checked separately by [`Ap242Author::add_complex`].
13720pub(crate) fn complex_rule(names: &[&'static str]) -> Result<(), AuthorError> {
13721    if names.is_empty() {
13722        return Err(AuthorError::InvalidComplex {
13723            reason: "empty part list",
13724        });
13725    }
13726    let mut ancestor_sets: Vec<&'static [&'static str]> = Vec::with_capacity(names.len());
13727    for n in names {
13728        let Ok(ix) = PART_INFO.binary_search_by_key(n, |e| e.0) else {
13729            return Err(AuthorError::NotAp242 { entity: n });
13730        };
13731        let (_, is_legal, ancestors) = PART_INFO[ix];
13732        if !is_legal {
13733            return Err(AuthorError::NotAp242 { entity: n });
13734        }
13735        ancestor_sets.push(ancestors);
13736    }
13737    let mut sorted = names.to_vec();
13738    sorted.sort_unstable();
13739    if sorted.windows(2).any(|w| w[0] == w[1]) {
13740        return Err(AuthorError::InvalidComplex {
13741            reason: "duplicate part",
13742        });
13743    }
13744    for ancestors in &ancestor_sets {
13745        for a in *ancestors {
13746            if sorted.binary_search(a).is_err() {
13747                return Err(AuthorError::InvalidComplex {
13748                    reason: "missing supertype part",
13749                });
13750            }
13751        }
13752    }
13753    // Connectivity: merge each part with its (all present) supertypes; more
13754    // than one component left means unrelated hierarchies were mixed.
13755    let mut comp: Vec<usize> = (0..names.len()).collect();
13756    for (i, ancestors) in ancestor_sets.iter().enumerate() {
13757        for a in *ancestors {
13758            let j = names.iter().position(|n| n == a).unwrap();
13759            let (ci, cj) = (comp[i], comp[j]);
13760            if ci != cj {
13761                for c in comp.iter_mut() {
13762                    if *c == cj {
13763                        *c = ci;
13764                    }
13765                }
13766            }
13767        }
13768    }
13769    if comp.iter().any(|&c| c != comp[0]) {
13770        return Err(AuthorError::InvalidComplex {
13771            reason: "disjoint parts",
13772        });
13773    }
13774    for group in ONEOF_GROUPS {
13775        let mut hit = 0;
13776        for branch in *group {
13777            if branch.iter().any(|b| names.contains(b)) {
13778                hit += 1;
13779                if hit >= 2 {
13780                    return Err(AuthorError::InvalidComplex {
13781                        reason: "oneof conflict",
13782                    });
13783                }
13784            }
13785        }
13786    }
13787    Ok(())
13788}
13789
13790fn check_unit_part(model: &StepModel, p: &UnitPart) -> Result<(), AuthorError> {
13791    match p {
13792        UnitPart::Action { chosen_method, .. } => {
13793            check_action_method_ref(model, chosen_method)?;
13794        }
13795        UnitPart::ActionMethodRelationship {
13796            relating_method,
13797            related_method,
13798            ..
13799        } => {
13800            check_action_method_ref(model, relating_method)?;
13801            check_action_method_ref(model, related_method)?;
13802        }
13803        UnitPart::ActionRelationship {
13804            relating_action,
13805            related_action,
13806            ..
13807        } => {
13808            check_action_ref(model, relating_action)?;
13809            check_action_ref(model, related_action)?;
13810        }
13811        UnitPart::ActionRequestAssignment {
13812            assigned_action_request,
13813            ..
13814        } => {
13815            check_versioned_action_request_ref(model, assigned_action_request)?;
13816        }
13817        UnitPart::ActionResource { usage, kind, .. } => {
13818            {
13819                let x = usage;
13820                if x.len() < 1 {
13821                    return Err(AuthorError::Cardinality {
13822                        entity: "ACTION_RESOURCE",
13823                        attribute: "usage",
13824                        got: x.len(),
13825                        min: 1,
13826                        max: None,
13827                    });
13828                }
13829            }
13830            for e0 in usage {
13831                check_supported_item_ref(model, e0)?;
13832            }
13833            check_action_resource_type_ref(model, kind)?;
13834        }
13835        UnitPart::ActionResourceRequirement {
13836            kind, operations, ..
13837        } => {
13838            check_resource_requirement_type_ref(model, kind)?;
13839            {
13840                let x = operations;
13841                if x.len() < 1 {
13842                    return Err(AuthorError::Cardinality {
13843                        entity: "ACTION_RESOURCE_REQUIREMENT",
13844                        attribute: "operations",
13845                        got: x.len(),
13846                        min: 1,
13847                        max: None,
13848                    });
13849                }
13850            }
13851            for e0 in operations {
13852                check_characterized_action_definition_ref(model, e0)?;
13853            }
13854        }
13855        UnitPart::AnnotationFillAreaOccurrence {
13856            fill_style_target, ..
13857        } => {
13858            check_point_ref(model, fill_style_target)?;
13859        }
13860        UnitPart::AnnotationOccurrenceRelationship {
13861            relating_annotation_occurrence,
13862            related_annotation_occurrence,
13863            ..
13864        } => {
13865            check_annotation_occurrence_ref(model, relating_annotation_occurrence)?;
13866            check_annotation_occurrence_ref(model, related_annotation_occurrence)?;
13867        }
13868        UnitPart::AnnotationPlaceholderOccurrenceWithLeaderLine { leader_line, .. } => {
13869            {
13870                let x = leader_line;
13871                if x.len() < 1 {
13872                    return Err(AuthorError::Cardinality {
13873                        entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
13874                        attribute: "leader_line",
13875                        got: x.len(),
13876                        min: 1,
13877                        max: None,
13878                    });
13879                }
13880            }
13881            for e0 in leader_line {
13882                check_annotation_placeholder_leader_line_ref(model, e0)?;
13883            }
13884        }
13885        UnitPart::AnnotationPlane { elements, .. } => {
13886            if let Some(x) = elements {
13887                if x.len() < 1 {
13888                    return Err(AuthorError::Cardinality {
13889                        entity: "ANNOTATION_PLANE",
13890                        attribute: "elements",
13891                        got: x.len(),
13892                        min: 1,
13893                        max: None,
13894                    });
13895                }
13896            }
13897            if let Some(x) = elements {
13898                for e0 in x {
13899                    check_annotation_plane_element_ref(model, e0)?;
13900                }
13901            }
13902        }
13903        UnitPart::ApplicationContextElement {
13904            frame_of_reference, ..
13905        } => {
13906            check_application_context_ref(model, frame_of_reference)?;
13907        }
13908        UnitPart::AppliedApprovalAssignment { items, .. } => {
13909            {
13910                let x = items;
13911                if x.len() < 1 {
13912                    return Err(AuthorError::Cardinality {
13913                        entity: "APPLIED_APPROVAL_ASSIGNMENT",
13914                        attribute: "items",
13915                        got: x.len(),
13916                        min: 1,
13917                        max: None,
13918                    });
13919                }
13920            }
13921            for e0 in items {
13922                check_approval_item_ref(model, e0)?;
13923            }
13924        }
13925        UnitPart::AppliedDateAndTimeAssignment { items, .. } => {
13926            {
13927                let x = items;
13928                if x.len() < 1 {
13929                    return Err(AuthorError::Cardinality {
13930                        entity: "APPLIED_DATE_AND_TIME_ASSIGNMENT",
13931                        attribute: "items",
13932                        got: x.len(),
13933                        min: 1,
13934                        max: None,
13935                    });
13936                }
13937            }
13938            for e0 in items {
13939                check_date_and_time_item_ref(model, e0)?;
13940            }
13941        }
13942        UnitPart::AppliedDocumentReference { items, .. } => {
13943            {
13944                let x = items;
13945                if x.len() < 1 {
13946                    return Err(AuthorError::Cardinality {
13947                        entity: "APPLIED_DOCUMENT_REFERENCE",
13948                        attribute: "items",
13949                        got: x.len(),
13950                        min: 1,
13951                        max: None,
13952                    });
13953                }
13954            }
13955            for e0 in items {
13956                check_document_reference_item_ref(model, e0)?;
13957            }
13958        }
13959        UnitPart::AppliedExternalIdentificationAssignment { items, .. } => {
13960            {
13961                let x = items;
13962                if x.len() < 1 {
13963                    return Err(AuthorError::Cardinality {
13964                        entity: "APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT",
13965                        attribute: "items",
13966                        got: x.len(),
13967                        min: 1,
13968                        max: None,
13969                    });
13970                }
13971            }
13972            for e0 in items {
13973                check_external_identification_item_ref(model, e0)?;
13974            }
13975        }
13976        UnitPart::AppliedGroupAssignment { items, .. } => {
13977            {
13978                let x = items;
13979                if x.len() < 1 {
13980                    return Err(AuthorError::Cardinality {
13981                        entity: "APPLIED_GROUP_ASSIGNMENT",
13982                        attribute: "items",
13983                        got: x.len(),
13984                        min: 1,
13985                        max: None,
13986                    });
13987                }
13988            }
13989            for e0 in items {
13990                check_groupable_item_ref(model, e0)?;
13991            }
13992        }
13993        UnitPart::AppliedPersonAndOrganizationAssignment { items, .. } => {
13994            {
13995                let x = items;
13996                if x.len() < 1 {
13997                    return Err(AuthorError::Cardinality {
13998                        entity: "APPLIED_PERSON_AND_ORGANIZATION_ASSIGNMENT",
13999                        attribute: "items",
14000                        got: x.len(),
14001                        min: 1,
14002                        max: None,
14003                    });
14004                }
14005            }
14006            for e0 in items {
14007                check_person_and_organization_item_ref(model, e0)?;
14008            }
14009        }
14010        UnitPart::AppliedPresentedItem { items, .. } => {
14011            {
14012                let x = items;
14013                if x.len() < 1 {
14014                    return Err(AuthorError::Cardinality {
14015                        entity: "APPLIED_PRESENTED_ITEM",
14016                        attribute: "items",
14017                        got: x.len(),
14018                        min: 1,
14019                        max: None,
14020                    });
14021                }
14022            }
14023            for e0 in items {
14024                check_presented_item_select_ref(model, e0)?;
14025            }
14026        }
14027        UnitPart::AppliedSecurityClassificationAssignment { items, .. } => {
14028            {
14029                let x = items;
14030                if x.len() < 1 {
14031                    return Err(AuthorError::Cardinality {
14032                        entity: "APPLIED_SECURITY_CLASSIFICATION_ASSIGNMENT",
14033                        attribute: "items",
14034                        got: x.len(),
14035                        min: 1,
14036                        max: None,
14037                    });
14038                }
14039            }
14040            for e0 in items {
14041                check_security_classification_item_ref(model, e0)?;
14042            }
14043        }
14044        UnitPart::ApprovalAssignment {
14045            assigned_approval, ..
14046        } => {
14047            check_approval_ref(model, assigned_approval)?;
14048        }
14049        UnitPart::AreaInSet { area, in_set, .. } => {
14050            check_presentation_area_ref(model, area)?;
14051            check_presentation_set_ref(model, in_set)?;
14052        }
14053        UnitPart::AscribableStateRelationship {
14054            relating_ascribable_state,
14055            related_ascribable_state,
14056            ..
14057        } => {
14058            check_ascribable_state_ref(model, relating_ascribable_state)?;
14059            check_ascribable_state_ref(model, related_ascribable_state)?;
14060        }
14061        UnitPart::BSplineCurve {
14062            control_points_list,
14063            ..
14064        } => {
14065            {
14066                let x = control_points_list;
14067                if x.len() < 2 {
14068                    return Err(AuthorError::Cardinality {
14069                        entity: "B_SPLINE_CURVE",
14070                        attribute: "control_points_list",
14071                        got: x.len(),
14072                        min: 2,
14073                        max: None,
14074                    });
14075                }
14076            }
14077            for e0 in control_points_list {
14078                check_cartesian_point_ref(model, e0)?;
14079            }
14080        }
14081        UnitPart::BSplineCurveWithKnots {
14082            knot_multiplicities,
14083            knots,
14084            ..
14085        } => {
14086            {
14087                let x = knot_multiplicities;
14088                if x.len() < 2 {
14089                    return Err(AuthorError::Cardinality {
14090                        entity: "B_SPLINE_CURVE_WITH_KNOTS",
14091                        attribute: "knot_multiplicities",
14092                        got: x.len(),
14093                        min: 2,
14094                        max: None,
14095                    });
14096                }
14097            }
14098            {
14099                let x = knots;
14100                if x.len() < 2 {
14101                    return Err(AuthorError::Cardinality {
14102                        entity: "B_SPLINE_CURVE_WITH_KNOTS",
14103                        attribute: "knots",
14104                        got: x.len(),
14105                        min: 2,
14106                        max: None,
14107                    });
14108                }
14109            }
14110        }
14111        UnitPart::BSplineSurface {
14112            control_points_list,
14113            ..
14114        } => {
14115            {
14116                let x = control_points_list;
14117                if x.len() < 2 {
14118                    return Err(AuthorError::Cardinality {
14119                        entity: "B_SPLINE_SURFACE",
14120                        attribute: "control_points_list",
14121                        got: x.len(),
14122                        min: 2,
14123                        max: None,
14124                    });
14125                }
14126            }
14127            for e0 in control_points_list {
14128                for e1 in e0 {
14129                    check_cartesian_point_ref(model, e1)?;
14130                }
14131            }
14132        }
14133        UnitPart::BSplineSurfaceWithKnots {
14134            u_multiplicities,
14135            v_multiplicities,
14136            u_knots,
14137            v_knots,
14138            ..
14139        } => {
14140            {
14141                let x = u_multiplicities;
14142                if x.len() < 2 {
14143                    return Err(AuthorError::Cardinality {
14144                        entity: "B_SPLINE_SURFACE_WITH_KNOTS",
14145                        attribute: "u_multiplicities",
14146                        got: x.len(),
14147                        min: 2,
14148                        max: None,
14149                    });
14150                }
14151            }
14152            {
14153                let x = v_multiplicities;
14154                if x.len() < 2 {
14155                    return Err(AuthorError::Cardinality {
14156                        entity: "B_SPLINE_SURFACE_WITH_KNOTS",
14157                        attribute: "v_multiplicities",
14158                        got: x.len(),
14159                        min: 2,
14160                        max: None,
14161                    });
14162                }
14163            }
14164            {
14165                let x = u_knots;
14166                if x.len() < 2 {
14167                    return Err(AuthorError::Cardinality {
14168                        entity: "B_SPLINE_SURFACE_WITH_KNOTS",
14169                        attribute: "u_knots",
14170                        got: x.len(),
14171                        min: 2,
14172                        max: None,
14173                    });
14174                }
14175            }
14176            {
14177                let x = v_knots;
14178                if x.len() < 2 {
14179                    return Err(AuthorError::Cardinality {
14180                        entity: "B_SPLINE_SURFACE_WITH_KNOTS",
14181                        attribute: "v_knots",
14182                        got: x.len(),
14183                        min: 2,
14184                        max: None,
14185                    });
14186                }
14187            }
14188        }
14189        UnitPart::BrepWithVoids { voids, .. } => {
14190            {
14191                let x = voids;
14192                if x.len() < 1 {
14193                    return Err(AuthorError::Cardinality {
14194                        entity: "BREP_WITH_VOIDS",
14195                        attribute: "voids",
14196                        got: x.len(),
14197                        min: 1,
14198                        max: None,
14199                    });
14200                }
14201            }
14202            for e0 in voids {
14203                check_oriented_closed_shell_ref(model, e0)?;
14204            }
14205        }
14206        UnitPart::CameraModelD3 {
14207            view_reference_system,
14208            perspective_of_volume,
14209            ..
14210        } => {
14211            check_axis2_placement3d_ref(model, view_reference_system)?;
14212            check_view_volume_ref(model, perspective_of_volume)?;
14213        }
14214        UnitPart::CameraModelD3MultiClipping { shape_clipping, .. } => {
14215            {
14216                let x = shape_clipping;
14217                if x.len() < 1 {
14218                    return Err(AuthorError::Cardinality {
14219                        entity: "CAMERA_MODEL_D3_MULTI_CLIPPING",
14220                        attribute: "shape_clipping",
14221                        got: x.len(),
14222                        min: 1,
14223                        max: None,
14224                    });
14225                }
14226            }
14227            for e0 in shape_clipping {
14228                check_camera_model_d3_multi_clipping_intersection_select_ref(model, e0)?;
14229            }
14230        }
14231        UnitPart::CcDesignApproval { items, .. } => {
14232            {
14233                let x = items;
14234                if x.len() < 1 {
14235                    return Err(AuthorError::Cardinality {
14236                        entity: "CC_DESIGN_APPROVAL",
14237                        attribute: "items",
14238                        got: x.len(),
14239                        min: 1,
14240                        max: None,
14241                    });
14242                }
14243            }
14244            for e0 in items {
14245                check_approved_item_ref(model, e0)?;
14246            }
14247        }
14248        UnitPart::CcDesignDateAndTimeAssignment { items, .. } => {
14249            {
14250                let x = items;
14251                if x.len() < 1 {
14252                    return Err(AuthorError::Cardinality {
14253                        entity: "CC_DESIGN_DATE_AND_TIME_ASSIGNMENT",
14254                        attribute: "items",
14255                        got: x.len(),
14256                        min: 1,
14257                        max: None,
14258                    });
14259                }
14260            }
14261            for e0 in items {
14262                check_date_time_item_ref(model, e0)?;
14263            }
14264        }
14265        UnitPart::CcDesignPersonAndOrganizationAssignment { items, .. } => {
14266            {
14267                let x = items;
14268                if x.len() < 1 {
14269                    return Err(AuthorError::Cardinality {
14270                        entity: "CC_DESIGN_PERSON_AND_ORGANIZATION_ASSIGNMENT",
14271                        attribute: "items",
14272                        got: x.len(),
14273                        min: 1,
14274                        max: None,
14275                    });
14276                }
14277            }
14278            for e0 in items {
14279                check_cc_person_organization_item_ref(model, e0)?;
14280            }
14281        }
14282        UnitPart::CcDesignSecurityClassification { items, .. } => {
14283            {
14284                let x = items;
14285                if x.len() < 1 {
14286                    return Err(AuthorError::Cardinality {
14287                        entity: "CC_DESIGN_SECURITY_CLASSIFICATION",
14288                        attribute: "items",
14289                        got: x.len(),
14290                        min: 1,
14291                        max: None,
14292                    });
14293                }
14294            }
14295            for e0 in items {
14296                check_cc_classified_item_ref(model, e0)?;
14297            }
14298        }
14299        UnitPart::ChangeRequest { items, .. } => {
14300            {
14301                let x = items;
14302                if x.len() < 1 {
14303                    return Err(AuthorError::Cardinality {
14304                        entity: "CHANGE_REQUEST",
14305                        attribute: "items",
14306                        got: x.len(),
14307                        min: 1,
14308                        max: None,
14309                    });
14310                }
14311            }
14312            for e0 in items {
14313                check_change_request_item_ref(model, e0)?;
14314            }
14315        }
14316        UnitPart::CharacterGlyphStyleOutline { outline_style, .. } => {
14317            check_curve_style_ref(model, outline_style)?;
14318        }
14319        UnitPart::CharacterGlyphStyleStroke { stroke_style, .. } => {
14320            check_curve_style_ref(model, stroke_style)?;
14321        }
14322        UnitPart::CharacterizedItemWithinRepresentation { item, rep, .. } => {
14323            check_representation_item_ref(model, item)?;
14324            check_representation_ref(model, rep)?;
14325        }
14326        UnitPart::CompositeCurve { segments, .. } => {
14327            {
14328                let x = segments;
14329                if x.len() < 1 {
14330                    return Err(AuthorError::Cardinality {
14331                        entity: "COMPOSITE_CURVE",
14332                        attribute: "segments",
14333                        got: x.len(),
14334                        min: 1,
14335                        max: None,
14336                    });
14337                }
14338            }
14339            for e0 in segments {
14340                check_composite_curve_segment_ref(model, e0)?;
14341            }
14342        }
14343        UnitPart::CompositeCurveSegment { parent_curve, .. } => {
14344            check_curve_ref(model, parent_curve)?;
14345        }
14346        UnitPart::CompositeText { collected_text, .. } => {
14347            {
14348                let x = collected_text;
14349                if x.len() < 2 {
14350                    return Err(AuthorError::Cardinality {
14351                        entity: "COMPOSITE_TEXT",
14352                        attribute: "collected_text",
14353                        got: x.len(),
14354                        min: 2,
14355                        max: None,
14356                    });
14357                }
14358            }
14359            for e0 in collected_text {
14360                check_text_or_character_ref(model, e0)?;
14361            }
14362        }
14363        UnitPart::CompoundRepresentationItem { item_element, .. } => {
14364            check_compound_item_definition_ref(model, item_element)?;
14365        }
14366        UnitPart::ConfigurationEffectivity { configuration, .. } => {
14367            check_configuration_design_ref(model, configuration)?;
14368        }
14369        UnitPart::ConfigurationItem { item_concept, .. } => {
14370            check_product_concept_ref(model, item_concept)?;
14371        }
14372        UnitPart::ConnectedFaceSet { cfs_faces, .. } => {
14373            if let Some(x) = cfs_faces {
14374                if x.len() < 1 {
14375                    return Err(AuthorError::Cardinality {
14376                        entity: "CONNECTED_FACE_SET",
14377                        attribute: "cfs_faces",
14378                        got: x.len(),
14379                        min: 1,
14380                        max: None,
14381                    });
14382                }
14383            }
14384            if let Some(x) = cfs_faces {
14385                for e0 in x {
14386                    check_face_ref(model, e0)?;
14387                }
14388            }
14389        }
14390        UnitPart::ContextDependentOverRidingStyledItem { style_context, .. } => {
14391            {
14392                let x = style_context;
14393                if x.len() < 1 {
14394                    return Err(AuthorError::Cardinality {
14395                        entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
14396                        attribute: "style_context",
14397                        got: x.len(),
14398                        min: 1,
14399                        max: None,
14400                    });
14401                }
14402            }
14403            for e0 in style_context {
14404                check_style_context_select_ref(model, e0)?;
14405            }
14406        }
14407        UnitPart::ConversionBasedUnit {
14408            conversion_factor, ..
14409        } => {
14410            check_measure_with_unit_ref(model, conversion_factor)?;
14411        }
14412        UnitPart::CurveStyle {
14413            curve_font,
14414            curve_width,
14415            curve_colour,
14416            ..
14417        } => {
14418            if let Some(x) = curve_font {
14419                check_curve_font_or_scaled_curve_font_select_ref(model, x)?;
14420            }
14421            if let Some(x) = curve_width {
14422                check_size_select_ref(model, x)?;
14423            }
14424            if let Some(x) = curve_colour {
14425                check_colour_ref(model, x)?;
14426            }
14427        }
14428        UnitPart::CurveStyleFont { pattern_list, .. } => {
14429            {
14430                let x = pattern_list;
14431                if x.len() < 1 {
14432                    return Err(AuthorError::Cardinality {
14433                        entity: "CURVE_STYLE_FONT",
14434                        attribute: "pattern_list",
14435                        got: x.len(),
14436                        min: 1,
14437                        max: None,
14438                    });
14439                }
14440            }
14441            for e0 in pattern_list {
14442                check_curve_style_font_pattern_ref(model, e0)?;
14443            }
14444        }
14445        UnitPart::CurveStyleFontAndScaling { curve_font, .. } => {
14446            check_curve_style_font_select_ref(model, curve_font)?;
14447        }
14448        UnitPart::DateAndTime {
14449            date_component,
14450            time_component,
14451            ..
14452        } => {
14453            check_date_ref(model, date_component)?;
14454            check_local_time_ref(model, time_component)?;
14455        }
14456        UnitPart::DateAndTimeAssignment {
14457            assigned_date_and_time,
14458            role,
14459            ..
14460        } => {
14461            check_date_and_time_ref(model, assigned_date_and_time)?;
14462            check_date_time_role_ref(model, role)?;
14463        }
14464        UnitPart::DatumReference {
14465            referenced_datum, ..
14466        } => {
14467            check_datum_ref(model, referenced_datum)?;
14468        }
14469        UnitPart::DatumSystem { constituents, .. } => {
14470            {
14471                let x = constituents;
14472                if x.len() < 1 || x.len() > 3 {
14473                    return Err(AuthorError::Cardinality {
14474                        entity: "DATUM_SYSTEM",
14475                        attribute: "constituents",
14476                        got: x.len(),
14477                        min: 1,
14478                        max: Some(3),
14479                    });
14480                }
14481            }
14482            for e0 in constituents {
14483                check_datum_reference_compartment_ref(model, e0)?;
14484            }
14485        }
14486        UnitPart::DerivedUnit { elements, .. } => {
14487            {
14488                let x = elements;
14489                if x.len() < 1 {
14490                    return Err(AuthorError::Cardinality {
14491                        entity: "DERIVED_UNIT",
14492                        attribute: "elements",
14493                        got: x.len(),
14494                        min: 1,
14495                        max: None,
14496                    });
14497                }
14498            }
14499            for e0 in elements {
14500                check_derived_unit_element_ref(model, e0)?;
14501            }
14502        }
14503        UnitPart::DimensionalSize { applies_to, .. } => {
14504            check_shape_aspect_ref(model, applies_to)?;
14505        }
14506        UnitPart::Direction {
14507            direction_ratios, ..
14508        } => {
14509            let x = direction_ratios;
14510            if x.len() < 2 || x.len() > 3 {
14511                return Err(AuthorError::Cardinality {
14512                    entity: "DIRECTION",
14513                    attribute: "direction_ratios",
14514                    got: x.len(),
14515                    min: 2,
14516                    max: Some(3),
14517                });
14518            }
14519        }
14520        UnitPart::Document { kind, .. } => {
14521            check_document_type_ref(model, kind)?;
14522        }
14523        UnitPart::DocumentProductAssociation {
14524            relating_document,
14525            related_product,
14526            ..
14527        } => {
14528            check_document_ref(model, relating_document)?;
14529            check_product_or_formation_or_definition_ref(model, related_product)?;
14530        }
14531        UnitPart::DocumentReference {
14532            assigned_document, ..
14533        } => {
14534            check_document_ref(model, assigned_document)?;
14535        }
14536        UnitPart::DraughtingCallout { contents, .. } => {
14537            {
14538                let x = contents;
14539                if x.len() < 1 {
14540                    return Err(AuthorError::Cardinality {
14541                        entity: "DRAUGHTING_CALLOUT",
14542                        attribute: "contents",
14543                        got: x.len(),
14544                        min: 1,
14545                        max: None,
14546                    });
14547                }
14548            }
14549            for e0 in contents {
14550                check_draughting_callout_element_ref(model, e0)?;
14551            }
14552        }
14553        UnitPart::DraughtingCalloutRelationship {
14554            relating_draughting_callout,
14555            related_draughting_callout,
14556            ..
14557        } => {
14558            check_draughting_callout_ref(model, relating_draughting_callout)?;
14559            check_draughting_callout_ref(model, related_draughting_callout)?;
14560        }
14561        UnitPart::DraughtingModelItemAssociationWithPlaceholder {
14562            annotation_placeholder,
14563            ..
14564        } => {
14565            check_annotation_placeholder_occurrence_ref(model, annotation_placeholder)?;
14566        }
14567        UnitPart::Edge {
14568            edge_start,
14569            edge_end,
14570            ..
14571        } => {
14572            if let Some(x) = edge_start {
14573                check_vertex_ref(model, x)?;
14574            }
14575            if let Some(x) = edge_end {
14576                check_vertex_ref(model, x)?;
14577            }
14578        }
14579        UnitPart::EdgeCurve { edge_geometry, .. } => {
14580            check_curve_ref(model, edge_geometry)?;
14581        }
14582        UnitPart::ElementarySurface { position, .. } => {
14583            check_axis2_placement3d_ref(model, position)?;
14584        }
14585        UnitPart::ExternalIdentificationAssignment { source, .. } => {
14586            check_external_source_ref(model, source)?;
14587        }
14588        UnitPart::ExternallyDefinedItem { source, .. } => {
14589            check_external_source_ref(model, source)?;
14590        }
14591        UnitPart::Face { bounds, .. } => {
14592            {
14593                let x = bounds;
14594                if x.len() < 1 {
14595                    return Err(AuthorError::Cardinality {
14596                        entity: "FACE",
14597                        attribute: "bounds",
14598                        got: x.len(),
14599                        min: 1,
14600                        max: None,
14601                    });
14602                }
14603            }
14604            for e0 in bounds {
14605                check_face_bound_ref(model, e0)?;
14606            }
14607        }
14608        UnitPart::FaceBound { bound, .. } => {
14609            check_loop_ref(model, bound)?;
14610        }
14611        UnitPart::FaceSurface { face_geometry, .. } => {
14612            check_surface_ref(model, face_geometry)?;
14613        }
14614        UnitPart::FillAreaStyle { fill_styles, .. } => {
14615            {
14616                let x = fill_styles;
14617                if x.len() < 1 {
14618                    return Err(AuthorError::Cardinality {
14619                        entity: "FILL_AREA_STYLE",
14620                        attribute: "fill_styles",
14621                        got: x.len(),
14622                        min: 1,
14623                        max: None,
14624                    });
14625                }
14626            }
14627            for e0 in fill_styles {
14628                check_fill_style_select_ref(model, e0)?;
14629            }
14630        }
14631        UnitPart::FillAreaStyleHatching {
14632            hatch_line_appearance,
14633            start_of_next_hatch_line,
14634            point_of_reference_hatch_line,
14635            pattern_start,
14636            ..
14637        } => {
14638            check_curve_style_ref(model, hatch_line_appearance)?;
14639            check_one_direction_repeat_factor_ref(model, start_of_next_hatch_line)?;
14640            check_cartesian_point_ref(model, point_of_reference_hatch_line)?;
14641            check_cartesian_point_ref(model, pattern_start)?;
14642        }
14643        UnitPart::FillAreaStyleTileSymbolWithStyle { symbol, .. } => {
14644            check_annotation_symbol_occurrence_ref(model, symbol)?;
14645        }
14646        UnitPart::FillAreaStyleTiles {
14647            tiling_pattern,
14648            tiles,
14649            ..
14650        } => {
14651            check_two_direction_repeat_factor_ref(model, tiling_pattern)?;
14652            {
14653                let x = tiles;
14654                if x.len() < 1 {
14655                    return Err(AuthorError::Cardinality {
14656                        entity: "FILL_AREA_STYLE_TILES",
14657                        attribute: "tiles",
14658                        got: x.len(),
14659                        min: 1,
14660                        max: None,
14661                    });
14662                }
14663            }
14664            for e0 in tiles {
14665                check_fill_area_style_tile_shape_select_ref(model, e0)?;
14666            }
14667        }
14668        UnitPart::GeneralDatumReference {
14669            base, modifiers, ..
14670        } => {
14671            check_datum_or_common_datum_ref(model, base)?;
14672            if let Some(x) = modifiers {
14673                if x.len() < 1 {
14674                    return Err(AuthorError::Cardinality {
14675                        entity: "GENERAL_DATUM_REFERENCE",
14676                        attribute: "modifiers",
14677                        got: x.len(),
14678                        min: 1,
14679                        max: None,
14680                    });
14681                }
14682            }
14683            if let Some(x) = modifiers {
14684                for e0 in x {
14685                    check_datum_reference_modifier_ref(model, e0)?;
14686                }
14687            }
14688        }
14689        UnitPart::GenericProductDefinitionReference { source, .. } => {
14690            check_external_source_ref(model, source)?;
14691        }
14692        UnitPart::GeometricSet { elements, .. } => {
14693            {
14694                let x = elements;
14695                if x.len() < 1 {
14696                    return Err(AuthorError::Cardinality {
14697                        entity: "GEOMETRIC_SET",
14698                        attribute: "elements",
14699                        got: x.len(),
14700                        min: 1,
14701                        max: None,
14702                    });
14703                }
14704            }
14705            for e0 in elements {
14706                check_geometric_set_select_ref(model, e0)?;
14707            }
14708        }
14709        UnitPart::GeometricTolerance {
14710            magnitude,
14711            toleranced_shape_aspect,
14712            ..
14713        } => {
14714            if let Some(x) = magnitude {
14715                check_length_measure_with_unit_ref(model, x)?;
14716            }
14717            check_geometric_tolerance_target_ref(model, toleranced_shape_aspect)?;
14718        }
14719        UnitPart::GeometricToleranceWithDatumReference { datum_system, .. } => {
14720            {
14721                let x = datum_system;
14722                if x.len() < 1 {
14723                    return Err(AuthorError::Cardinality {
14724                        entity: "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
14725                        attribute: "datum_system",
14726                        got: x.len(),
14727                        min: 1,
14728                        max: None,
14729                    });
14730                }
14731            }
14732            for e0 in datum_system {
14733                check_datum_system_or_reference_ref(model, e0)?;
14734            }
14735        }
14736        UnitPart::GeometricToleranceWithDefinedAreaUnit {
14737            second_unit_size, ..
14738        } => {
14739            if let Some(x) = second_unit_size {
14740                check_length_or_plane_angle_measure_with_unit_select_ref(model, x)?;
14741            }
14742        }
14743        UnitPart::GeometricToleranceWithDefinedUnit { unit_size, .. } => {
14744            check_length_or_plane_angle_measure_with_unit_select_ref(model, unit_size)?;
14745        }
14746        UnitPart::GeometricToleranceWithMaximumTolerance {
14747            maximum_upper_tolerance,
14748            ..
14749        } => {
14750            check_length_measure_with_unit_ref(model, maximum_upper_tolerance)?;
14751        }
14752        UnitPart::GeometricToleranceWithModifiers { modifiers, .. } => {
14753            let x = modifiers;
14754            if x.len() < 1 {
14755                return Err(AuthorError::Cardinality {
14756                    entity: "GEOMETRIC_TOLERANCE_WITH_MODIFIERS",
14757                    attribute: "modifiers",
14758                    got: x.len(),
14759                    min: 1,
14760                    max: None,
14761                });
14762            }
14763        }
14764        UnitPart::GlobalUncertaintyAssignedContext { uncertainty, .. } => {
14765            {
14766                let x = uncertainty;
14767                if x.len() < 1 {
14768                    return Err(AuthorError::Cardinality {
14769                        entity: "GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT",
14770                        attribute: "uncertainty",
14771                        got: x.len(),
14772                        min: 1,
14773                        max: None,
14774                    });
14775                }
14776            }
14777            for e0 in uncertainty {
14778                check_uncertainty_measure_with_unit_ref(model, e0)?;
14779            }
14780        }
14781        UnitPart::GlobalUnitAssignedContext { units, .. } => {
14782            {
14783                let x = units;
14784                if x.len() < 1 {
14785                    return Err(AuthorError::Cardinality {
14786                        entity: "GLOBAL_UNIT_ASSIGNED_CONTEXT",
14787                        attribute: "units",
14788                        got: x.len(),
14789                        min: 1,
14790                        max: None,
14791                    });
14792                }
14793            }
14794            for e0 in units {
14795                check_unit_ref(model, e0)?;
14796            }
14797        }
14798        UnitPart::GroupAssignment { assigned_group, .. } => {
14799            check_group_ref(model, assigned_group)?;
14800        }
14801        UnitPart::IdentificationAssignment { role, .. } => {
14802            check_identification_role_ref(model, role)?;
14803        }
14804        UnitPart::Invisibility {
14805            invisible_items, ..
14806        } => {
14807            {
14808                let x = invisible_items;
14809                if x.len() < 1 {
14810                    return Err(AuthorError::Cardinality {
14811                        entity: "INVISIBILITY",
14812                        attribute: "invisible_items",
14813                        got: x.len(),
14814                        min: 1,
14815                        max: None,
14816                    });
14817                }
14818            }
14819            for e0 in invisible_items {
14820                check_invisible_item_ref(model, e0)?;
14821            }
14822        }
14823        UnitPart::ItemDefinedTransformation {
14824            transform_item_1,
14825            transform_item_2,
14826            ..
14827        } => {
14828            check_representation_item_ref(model, transform_item_1)?;
14829            check_representation_item_ref(model, transform_item_2)?;
14830        }
14831        UnitPart::ItemIdentifiedRepresentationUsage {
14832            definition,
14833            used_representation,
14834            identified_item,
14835            ..
14836        } => {
14837            check_item_identified_representation_usage_definition_ref(model, definition)?;
14838            check_representation_ref(model, used_representation)?;
14839            check_item_identified_representation_usage_select_ref(model, identified_item)?;
14840        }
14841        UnitPart::ManifoldSolidBrep { outer, .. } => {
14842            check_closed_shell_ref(model, outer)?;
14843        }
14844        UnitPart::MappedItem {
14845            mapping_source,
14846            mapping_target,
14847            ..
14848        } => {
14849            check_representation_map_ref(model, mapping_source)?;
14850            check_representation_item_ref(model, mapping_target)?;
14851        }
14852        UnitPart::MeasureWithUnit { unit_component, .. } => {
14853            check_unit_ref(model, unit_component)?;
14854        }
14855        UnitPart::NamedUnit { dimensions, .. } => {
14856            if let Some(x) = dimensions {
14857                check_dimensional_exponents_ref(model, x)?;
14858            }
14859        }
14860        UnitPart::OneDirectionRepeatFactor { repeat_factor, .. } => {
14861            check_vector_ref(model, repeat_factor)?;
14862        }
14863        UnitPart::OrganizationalAddress { organizations, .. } => {
14864            {
14865                let x = organizations;
14866                if x.len() < 1 {
14867                    return Err(AuthorError::Cardinality {
14868                        entity: "ORGANIZATIONAL_ADDRESS",
14869                        attribute: "organizations",
14870                        got: x.len(),
14871                        min: 1,
14872                        max: None,
14873                    });
14874                }
14875            }
14876            for e0 in organizations {
14877                check_organization_ref(model, e0)?;
14878            }
14879        }
14880        UnitPart::OrientedClosedShell {
14881            closed_shell_element,
14882            ..
14883        } => {
14884            check_closed_shell_ref(model, closed_shell_element)?;
14885        }
14886        UnitPart::OrientedEdge { edge_element, .. } => {
14887            check_edge_ref(model, edge_element)?;
14888        }
14889        UnitPart::OverRidingStyledItem {
14890            over_ridden_style, ..
14891        } => {
14892            check_styled_item_ref(model, over_ridden_style)?;
14893        }
14894        UnitPart::Path { edge_list, .. } => {
14895            {
14896                let x = edge_list;
14897                if x.len() < 1 {
14898                    return Err(AuthorError::Cardinality {
14899                        entity: "PATH",
14900                        attribute: "edge_list",
14901                        got: x.len(),
14902                        min: 1,
14903                        max: None,
14904                    });
14905                }
14906            }
14907            for e0 in edge_list {
14908                check_oriented_edge_ref(model, e0)?;
14909            }
14910        }
14911        UnitPart::Pcurve {
14912            basis_surface,
14913            reference_to_curve,
14914            ..
14915        } => {
14916            check_surface_ref(model, basis_surface)?;
14917            check_definitional_representation_ref(model, reference_to_curve)?;
14918        }
14919        UnitPart::PersonAndOrganizationAssignment {
14920            assigned_person_and_organization,
14921            role,
14922            ..
14923        } => {
14924            check_person_and_organization_ref(model, assigned_person_and_organization)?;
14925            check_person_and_organization_role_ref(model, role)?;
14926        }
14927        UnitPart::PersonalAddress { people, .. } => {
14928            {
14929                let x = people;
14930                if x.len() < 1 {
14931                    return Err(AuthorError::Cardinality {
14932                        entity: "PERSONAL_ADDRESS",
14933                        attribute: "people",
14934                        got: x.len(),
14935                        min: 1,
14936                        max: None,
14937                    });
14938                }
14939            }
14940            for e0 in people {
14941                check_person_ref(model, e0)?;
14942            }
14943        }
14944        UnitPart::Placement { location, .. } => {
14945            check_cartesian_point_ref(model, location)?;
14946        }
14947        UnitPart::PlanarBox { placement, .. } => {
14948            check_axis2_placement_ref(model, placement)?;
14949        }
14950        UnitPart::PointStyle {
14951            marker,
14952            marker_size,
14953            marker_colour,
14954            ..
14955        } => {
14956            if let Some(x) = marker {
14957                check_marker_select_ref(model, x)?;
14958            }
14959            if let Some(x) = marker_size {
14960                check_size_select_ref(model, x)?;
14961            }
14962            if let Some(x) = marker_colour {
14963                check_colour_ref(model, x)?;
14964            }
14965        }
14966        UnitPart::PolyLoop { polygon, .. } => {
14967            {
14968                let x = polygon;
14969                if x.len() < 3 {
14970                    return Err(AuthorError::Cardinality {
14971                        entity: "POLY_LOOP",
14972                        attribute: "polygon",
14973                        got: x.len(),
14974                        min: 3,
14975                        max: None,
14976                    });
14977                }
14978            }
14979            for e0 in polygon {
14980                check_cartesian_point_ref(model, e0)?;
14981            }
14982        }
14983        UnitPart::PresentationStyleAssignment { styles, .. } => {
14984            {
14985                let x = styles;
14986                if x.len() < 1 {
14987                    return Err(AuthorError::Cardinality {
14988                        entity: "PRESENTATION_STYLE_ASSIGNMENT",
14989                        attribute: "styles",
14990                        got: x.len(),
14991                        min: 1,
14992                        max: None,
14993                    });
14994                }
14995            }
14996            for e0 in styles {
14997                check_presentation_style_select_ref(model, e0)?;
14998            }
14999        }
15000        UnitPart::PresentationStyleByContext { style_context, .. } => {
15001            check_style_context_select_ref(model, style_context)?;
15002        }
15003        UnitPart::Product {
15004            frame_of_reference, ..
15005        } => {
15006            {
15007                let x = frame_of_reference;
15008                if x.len() < 1 {
15009                    return Err(AuthorError::Cardinality {
15010                        entity: "PRODUCT",
15011                        attribute: "frame_of_reference",
15012                        got: x.len(),
15013                        min: 1,
15014                        max: None,
15015                    });
15016                }
15017            }
15018            for e0 in frame_of_reference {
15019                check_product_context_ref(model, e0)?;
15020            }
15021        }
15022        UnitPart::ProductConcept { market_context, .. } => {
15023            check_product_concept_context_ref(model, market_context)?;
15024        }
15025        UnitPart::ProductDefinition {
15026            formation,
15027            frame_of_reference,
15028            ..
15029        } => {
15030            check_product_definition_formation_ref(model, formation)?;
15031            check_product_definition_context_ref(model, frame_of_reference)?;
15032        }
15033        UnitPart::ProductDefinitionEffectivity { usage, .. } => {
15034            check_product_definition_relationship_ref(model, usage)?;
15035        }
15036        UnitPart::ProductDefinitionFormation { of_product, .. } => {
15037            check_product_ref(model, of_product)?;
15038        }
15039        UnitPart::ProductDefinitionOccurrence {
15040            definition,
15041            quantity,
15042            ..
15043        } => {
15044            if let Some(x) = definition {
15045                check_product_definition_or_reference_ref(model, x)?;
15046            }
15047            if let Some(x) = quantity {
15048                check_measure_with_unit_ref(model, x)?;
15049            }
15050        }
15051        UnitPart::ProductDefinitionRelationship {
15052            relating_product_definition,
15053            related_product_definition,
15054            ..
15055        } => {
15056            check_product_definition_or_reference_ref(model, relating_product_definition)?;
15057            check_product_definition_or_reference_ref(model, related_product_definition)?;
15058        }
15059        UnitPart::ProductDefinitionRelationshipRelationship {
15060            relating, related, ..
15061        } => {
15062            check_product_definition_relationship_ref(model, relating)?;
15063            check_product_definition_relationship_ref(model, related)?;
15064        }
15065        UnitPart::ProductDefinitionWithAssociatedDocuments {
15066            documentation_ids, ..
15067        } => {
15068            {
15069                let x = documentation_ids;
15070                if x.len() < 1 {
15071                    return Err(AuthorError::Cardinality {
15072                        entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
15073                        attribute: "documentation_ids",
15074                        got: x.len(),
15075                        min: 1,
15076                        max: None,
15077                    });
15078                }
15079            }
15080            for e0 in documentation_ids {
15081                check_document_ref(model, e0)?;
15082            }
15083        }
15084        UnitPart::ProductRelatedProductCategory { products, .. } => {
15085            {
15086                let x = products;
15087                if x.len() < 1 {
15088                    return Err(AuthorError::Cardinality {
15089                        entity: "PRODUCT_RELATED_PRODUCT_CATEGORY",
15090                        attribute: "products",
15091                        got: x.len(),
15092                        min: 1,
15093                        max: None,
15094                    });
15095                }
15096            }
15097            for e0 in products {
15098                check_product_ref(model, e0)?;
15099            }
15100        }
15101        UnitPart::ProjectedZoneDefinition {
15102            projection_end,
15103            projected_length,
15104            ..
15105        } => {
15106            check_shape_aspect_ref(model, projection_end)?;
15107            check_length_measure_with_unit_ref(model, projected_length)?;
15108        }
15109        UnitPart::PropertyDefinition { definition, .. } => {
15110            check_characterized_definition_ref(model, definition)?;
15111        }
15112        UnitPart::PropertyDefinitionRepresentation {
15113            definition,
15114            used_representation,
15115            ..
15116        } => {
15117            check_represented_definition_ref(model, definition)?;
15118            check_representation_ref(model, used_representation)?;
15119        }
15120        UnitPart::QualifiedRepresentationItem { qualifiers, .. } => {
15121            {
15122                let x = qualifiers;
15123                if x.len() < 1 {
15124                    return Err(AuthorError::Cardinality {
15125                        entity: "QUALIFIED_REPRESENTATION_ITEM",
15126                        attribute: "qualifiers",
15127                        got: x.len(),
15128                        min: 1,
15129                        max: None,
15130                    });
15131                }
15132            }
15133            for e0 in qualifiers {
15134                check_value_qualifier_ref(model, e0)?;
15135            }
15136        }
15137        UnitPart::RationalBSplineCurve { weights_data, .. } => {
15138            let x = weights_data;
15139            if x.len() < 2 {
15140                return Err(AuthorError::Cardinality {
15141                    entity: "RATIONAL_B_SPLINE_CURVE",
15142                    attribute: "weights_data",
15143                    got: x.len(),
15144                    min: 2,
15145                    max: None,
15146                });
15147            }
15148        }
15149        UnitPart::RationalBSplineSurface { weights_data, .. } => {
15150            let x = weights_data;
15151            if x.len() < 2 {
15152                return Err(AuthorError::Cardinality {
15153                    entity: "RATIONAL_B_SPLINE_SURFACE",
15154                    attribute: "weights_data",
15155                    got: x.len(),
15156                    min: 2,
15157                    max: None,
15158                });
15159            }
15160        }
15161        UnitPart::RepositionedTessellatedItem { location, .. } => {
15162            check_axis2_placement3d_ref(model, location)?;
15163        }
15164        UnitPart::Representation {
15165            items,
15166            context_of_items,
15167            ..
15168        } => {
15169            {
15170                let x = items;
15171                if x.len() < 1 {
15172                    return Err(AuthorError::Cardinality {
15173                        entity: "REPRESENTATION",
15174                        attribute: "items",
15175                        got: x.len(),
15176                        min: 1,
15177                        max: None,
15178                    });
15179                }
15180            }
15181            for e0 in items {
15182                check_representation_item_ref(model, e0)?;
15183            }
15184            check_representation_context_ref(model, context_of_items)?;
15185        }
15186        UnitPart::RepresentationMap {
15187            mapping_origin,
15188            mapped_representation,
15189            ..
15190        } => {
15191            check_representation_item_ref(model, mapping_origin)?;
15192            check_representation_ref(model, mapped_representation)?;
15193        }
15194        UnitPart::RepresentationReference {
15195            context_of_items, ..
15196        } => {
15197            check_representation_context_reference_ref(model, context_of_items)?;
15198        }
15199        UnitPart::RepresentationRelationship { rep_1, rep_2, .. } => {
15200            check_representation_or_representation_reference_ref(model, rep_1)?;
15201            check_representation_or_representation_reference_ref(model, rep_2)?;
15202        }
15203        UnitPart::RepresentationRelationshipWithTransformation {
15204            transformation_operator,
15205            ..
15206        } => {
15207            check_transformation_ref(model, transformation_operator)?;
15208        }
15209        UnitPart::SecurityClassificationAssignment {
15210            assigned_security_classification,
15211            ..
15212        } => {
15213            check_security_classification_ref(model, assigned_security_classification)?;
15214        }
15215        UnitPart::ShapeAspect { of_shape, .. } => {
15216            check_product_definition_shape_ref(model, of_shape)?;
15217        }
15218        UnitPart::ShapeAspectRelationship {
15219            relating_shape_aspect,
15220            related_shape_aspect,
15221            ..
15222        } => {
15223            check_shape_aspect_ref(model, relating_shape_aspect)?;
15224            check_shape_aspect_ref(model, related_shape_aspect)?;
15225        }
15226        UnitPart::ShellBasedSurfaceModel { sbsm_boundary, .. } => {
15227            {
15228                let x = sbsm_boundary;
15229                if x.len() < 1 {
15230                    return Err(AuthorError::Cardinality {
15231                        entity: "SHELL_BASED_SURFACE_MODEL",
15232                        attribute: "sbsm_boundary",
15233                        got: x.len(),
15234                        min: 1,
15235                        max: None,
15236                    });
15237                }
15238            }
15239            for e0 in sbsm_boundary {
15240                check_shell_ref(model, e0)?;
15241            }
15242        }
15243        UnitPart::StartRequest { items, .. } => {
15244            {
15245                let x = items;
15246                if x.len() < 1 {
15247                    return Err(AuthorError::Cardinality {
15248                        entity: "START_REQUEST",
15249                        attribute: "items",
15250                        got: x.len(),
15251                        min: 1,
15252                        max: None,
15253                    });
15254                }
15255            }
15256            for e0 in items {
15257                check_start_request_item_ref(model, e0)?;
15258            }
15259        }
15260        UnitPart::StyledItem { styles, item, .. } => {
15261            for e0 in styles {
15262                check_presentation_style_assignment_ref(model, e0)?;
15263            }
15264            check_styled_item_target_ref(model, item)?;
15265        }
15266        UnitPart::SurfaceCurve {
15267            curve_3d,
15268            associated_geometry,
15269            ..
15270        } => {
15271            check_curve_ref(model, curve_3d)?;
15272            {
15273                let x = associated_geometry;
15274                if x.len() < 1 || x.len() > 2 {
15275                    return Err(AuthorError::Cardinality {
15276                        entity: "SURFACE_CURVE",
15277                        attribute: "associated_geometry",
15278                        got: x.len(),
15279                        min: 1,
15280                        max: Some(2),
15281                    });
15282                }
15283            }
15284            for e0 in associated_geometry {
15285                check_pcurve_or_surface_ref(model, e0)?;
15286            }
15287        }
15288        UnitPart::SurfaceSideStyle { styles, .. } => {
15289            {
15290                let x = styles;
15291                if x.len() < 1 || x.len() > 7 {
15292                    return Err(AuthorError::Cardinality {
15293                        entity: "SURFACE_SIDE_STYLE",
15294                        attribute: "styles",
15295                        got: x.len(),
15296                        min: 1,
15297                        max: Some(7),
15298                    });
15299                }
15300            }
15301            for e0 in styles {
15302                check_surface_style_element_select_ref(model, e0)?;
15303            }
15304        }
15305        UnitPart::SurfaceStyleBoundary {
15306            style_of_boundary, ..
15307        } => {
15308            check_curve_or_render_ref(model, style_of_boundary)?;
15309        }
15310        UnitPart::SurfaceStyleControlGrid {
15311            style_of_control_grid,
15312            ..
15313        } => {
15314            check_curve_or_render_ref(model, style_of_control_grid)?;
15315        }
15316        UnitPart::SurfaceStyleFillArea { fill_area, .. } => {
15317            check_fill_area_style_ref(model, fill_area)?;
15318        }
15319        UnitPart::SurfaceStyleParameterLine {
15320            style_of_parameter_lines,
15321            direction_counts,
15322            ..
15323        } => {
15324            check_curve_or_render_ref(model, style_of_parameter_lines)?;
15325            {
15326                let x = direction_counts;
15327                if x.len() < 1 || x.len() > 2 {
15328                    return Err(AuthorError::Cardinality {
15329                        entity: "SURFACE_STYLE_PARAMETER_LINE",
15330                        attribute: "direction_counts",
15331                        got: x.len(),
15332                        min: 1,
15333                        max: Some(2),
15334                    });
15335                }
15336            }
15337        }
15338        UnitPart::SurfaceStyleRendering { surface_colour, .. } => {
15339            check_colour_ref(model, surface_colour)?;
15340        }
15341        UnitPart::SurfaceStyleRenderingWithProperties { properties, .. } => {
15342            {
15343                let x = properties;
15344                if x.len() < 1 || x.len() > 2 {
15345                    return Err(AuthorError::Cardinality {
15346                        entity: "SURFACE_STYLE_RENDERING_WITH_PROPERTIES",
15347                        attribute: "properties",
15348                        got: x.len(),
15349                        min: 1,
15350                        max: Some(2),
15351                    });
15352                }
15353            }
15354            for e0 in properties {
15355                check_rendering_properties_select_ref(model, e0)?;
15356            }
15357        }
15358        UnitPart::SurfaceStyleSegmentationCurve {
15359            style_of_segmentation_curve,
15360            ..
15361        } => {
15362            check_curve_or_render_ref(model, style_of_segmentation_curve)?;
15363        }
15364        UnitPart::SurfaceStyleSilhouette {
15365            style_of_silhouette,
15366            ..
15367        } => {
15368            check_curve_or_render_ref(model, style_of_silhouette)?;
15369        }
15370        UnitPart::SurfaceStyleUsage { style, .. } => {
15371            check_surface_side_style_select_ref(model, style)?;
15372        }
15373        UnitPart::SymbolStyle {
15374            style_of_symbol, ..
15375        } => {
15376            check_symbol_style_select_ref(model, style_of_symbol)?;
15377        }
15378        UnitPart::TerminatorSymbol {
15379            annotated_curve, ..
15380        } => {
15381            check_annotation_curve_occurrence_ref(model, annotated_curve)?;
15382        }
15383        UnitPart::TessellatedGeometricSet { children, .. } => {
15384            {
15385                let x = children;
15386                if x.len() < 1 {
15387                    return Err(AuthorError::Cardinality {
15388                        entity: "TESSELLATED_GEOMETRIC_SET",
15389                        attribute: "children",
15390                        got: x.len(),
15391                        min: 1,
15392                        max: None,
15393                    });
15394                }
15395            }
15396            for e0 in children {
15397                check_tessellated_item_ref(model, e0)?;
15398            }
15399        }
15400        UnitPart::TextLiteral {
15401            placement, font, ..
15402        } => {
15403            check_axis2_placement_ref(model, placement)?;
15404            check_font_select_ref(model, font)?;
15405        }
15406        UnitPart::TextStyle {
15407            character_appearance,
15408            ..
15409        } => {
15410            check_character_style_select_ref(model, character_appearance)?;
15411        }
15412        UnitPart::TextStyleWithBoxCharacteristics {
15413            characteristics, ..
15414        } => {
15415            let x = characteristics;
15416            if x.len() < 1 || x.len() > 4 {
15417                return Err(AuthorError::Cardinality {
15418                    entity: "TEXT_STYLE_WITH_BOX_CHARACTERISTICS",
15419                    attribute: "characteristics",
15420                    got: x.len(),
15421                    min: 1,
15422                    max: Some(4),
15423                });
15424            }
15425        }
15426        UnitPart::ToleranceZone {
15427            defining_tolerance,
15428            form,
15429            ..
15430        } => {
15431            {
15432                let x = defining_tolerance;
15433                if x.len() < 1 {
15434                    return Err(AuthorError::Cardinality {
15435                        entity: "TOLERANCE_ZONE",
15436                        attribute: "defining_tolerance",
15437                        got: x.len(),
15438                        min: 1,
15439                        max: None,
15440                    });
15441                }
15442            }
15443            for e0 in defining_tolerance {
15444                check_tolerance_zone_target_ref(model, e0)?;
15445            }
15446            check_tolerance_zone_form_ref(model, form)?;
15447        }
15448        UnitPart::ToleranceZoneDefinition {
15449            zone, boundaries, ..
15450        } => {
15451            check_tolerance_zone_ref(model, zone)?;
15452            for e0 in boundaries {
15453                check_shape_aspect_ref(model, e0)?;
15454            }
15455        }
15456        UnitPart::ToleranceZoneWithDatum {
15457            datum_reference, ..
15458        } => {
15459            check_datum_system_ref(model, datum_reference)?;
15460        }
15461        UnitPart::TwoDirectionRepeatFactor {
15462            second_repeat_factor,
15463            ..
15464        } => {
15465            check_vector_ref(model, second_repeat_factor)?;
15466        }
15467        UnitPart::UnequallyDisposedGeometricTolerance { displacement, .. } => {
15468            check_length_measure_with_unit_ref(model, displacement)?;
15469        }
15470        UnitPart::Vector { orientation, .. } => {
15471            check_direction_ref(model, orientation)?;
15472        }
15473        UnitPart::VertexPoint {
15474            vertex_geometry, ..
15475        } => {
15476            check_point_ref(model, vertex_geometry)?;
15477        }
15478        UnitPart::ViewVolume {
15479            projection_point,
15480            view_window,
15481            ..
15482        } => {
15483            check_cartesian_point_ref(model, projection_point)?;
15484            check_planar_box_ref(model, view_window)?;
15485        }
15486        _ => {}
15487    }
15488    Ok(())
15489}
15490
15491fn check_action_ref(model: &StepModel, r: &ActionRef) -> Result<(), AuthorError> {
15492    match r {
15493        ActionRef::Action(i) => {
15494            if i.0 >= model.action_arena.items.len() {
15495                return Err(AuthorError::DanglingRef { entity: "ACTION" });
15496            }
15497        }
15498        ActionRef::Complex(i) => {
15499            if i.0 >= model.complex_unit_arena.items.len() {
15500                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
15501            }
15502        }
15503    }
15504    Ok(())
15505}
15506fn check_action_method_ref(model: &StepModel, r: &ActionMethodRef) -> Result<(), AuthorError> {
15507    match r {
15508        ActionMethodRef::ActionMethod(i) => {
15509            if i.0 >= model.action_method_arena.items.len() {
15510                return Err(AuthorError::DanglingRef {
15511                    entity: "ACTION_METHOD",
15512                });
15513            }
15514        }
15515        ActionMethodRef::Complex(i) => {
15516            if i.0 >= model.complex_unit_arena.items.len() {
15517                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
15518            }
15519        }
15520    }
15521    Ok(())
15522}
15523fn check_action_resource_ref(model: &StepModel, r: &ActionResourceRef) -> Result<(), AuthorError> {
15524    match r {
15525        ActionResourceRef::ActionResource(i) => {
15526            if i.0 >= model.action_resource_arena.items.len() {
15527                return Err(AuthorError::DanglingRef {
15528                    entity: "ACTION_RESOURCE",
15529                });
15530            }
15531        }
15532        ActionResourceRef::Complex(i) => {
15533            if i.0 >= model.complex_unit_arena.items.len() {
15534                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
15535            }
15536        }
15537    }
15538    Ok(())
15539}
15540fn check_action_resource_type_ref(
15541    model: &StepModel,
15542    r: &ActionResourceTypeRef,
15543) -> Result<(), AuthorError> {
15544    match r {
15545        ActionResourceTypeRef::ActionResourceType(i) => {
15546            if i.0 >= model.action_resource_type_arena.items.len() {
15547                return Err(AuthorError::DanglingRef {
15548                    entity: "ACTION_RESOURCE_TYPE",
15549                });
15550            }
15551        }
15552    }
15553    Ok(())
15554}
15555fn check_annotation_curve_occurrence_ref(
15556    model: &StepModel,
15557    r: &AnnotationCurveOccurrenceRef,
15558) -> Result<(), AuthorError> {
15559    match r {
15560        AnnotationCurveOccurrenceRef::AnnotationCurveOccurrence(i) => {
15561            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
15562                return Err(AuthorError::DanglingRef {
15563                    entity: "ANNOTATION_CURVE_OCCURRENCE",
15564                });
15565            }
15566        }
15567        AnnotationCurveOccurrenceRef::LeaderCurve(i) => {
15568            if i.0 >= model.leader_curve_arena.items.len() {
15569                return Err(AuthorError::DanglingRef {
15570                    entity: "LEADER_CURVE",
15571                });
15572            }
15573        }
15574        AnnotationCurveOccurrenceRef::Complex(i) => {
15575            if i.0 >= model.complex_unit_arena.items.len() {
15576                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
15577            }
15578        }
15579    }
15580    Ok(())
15581}
15582fn check_annotation_occurrence_ref(
15583    model: &StepModel,
15584    r: &AnnotationOccurrenceRef,
15585) -> Result<(), AuthorError> {
15586    match r {
15587        AnnotationOccurrenceRef::AnnotationCurveOccurrence(i) => {
15588            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
15589                return Err(AuthorError::DanglingRef {
15590                    entity: "ANNOTATION_CURVE_OCCURRENCE",
15591                });
15592            }
15593        }
15594        AnnotationOccurrenceRef::AnnotationFillAreaOccurrence(i) => {
15595            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
15596                return Err(AuthorError::DanglingRef {
15597                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
15598                });
15599            }
15600        }
15601        AnnotationOccurrenceRef::AnnotationOccurrence(i) => {
15602            if i.0 >= model.annotation_occurrence_arena.items.len() {
15603                return Err(AuthorError::DanglingRef {
15604                    entity: "ANNOTATION_OCCURRENCE",
15605                });
15606            }
15607        }
15608        AnnotationOccurrenceRef::AnnotationPlaceholderOccurrence(i) => {
15609            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
15610                return Err(AuthorError::DanglingRef {
15611                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
15612                });
15613            }
15614        }
15615        AnnotationOccurrenceRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
15616            return Err(AuthorError::NotAp242 {
15617                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
15618            });
15619        }
15620        AnnotationOccurrenceRef::AnnotationPlane(i) => {
15621            if i.0 >= model.annotation_plane_arena.items.len() {
15622                return Err(AuthorError::DanglingRef {
15623                    entity: "ANNOTATION_PLANE",
15624                });
15625            }
15626        }
15627        AnnotationOccurrenceRef::AnnotationSymbolOccurrence(i) => {
15628            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
15629                return Err(AuthorError::DanglingRef {
15630                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
15631                });
15632            }
15633        }
15634        AnnotationOccurrenceRef::AnnotationTextOccurrence(i) => {
15635            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
15636                return Err(AuthorError::DanglingRef {
15637                    entity: "ANNOTATION_TEXT_OCCURRENCE",
15638                });
15639            }
15640        }
15641        AnnotationOccurrenceRef::DraughtingAnnotationOccurrence(i) => {
15642            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
15643                return Err(AuthorError::DanglingRef {
15644                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
15645                });
15646            }
15647        }
15648        AnnotationOccurrenceRef::LeaderCurve(i) => {
15649            if i.0 >= model.leader_curve_arena.items.len() {
15650                return Err(AuthorError::DanglingRef {
15651                    entity: "LEADER_CURVE",
15652                });
15653            }
15654        }
15655        AnnotationOccurrenceRef::LeaderTerminator(i) => {
15656            if i.0 >= model.leader_terminator_arena.items.len() {
15657                return Err(AuthorError::DanglingRef {
15658                    entity: "LEADER_TERMINATOR",
15659                });
15660            }
15661        }
15662        AnnotationOccurrenceRef::TerminatorSymbol(i) => {
15663            if i.0 >= model.terminator_symbol_arena.items.len() {
15664                return Err(AuthorError::DanglingRef {
15665                    entity: "TERMINATOR_SYMBOL",
15666                });
15667            }
15668        }
15669        AnnotationOccurrenceRef::TessellatedAnnotationOccurrence(i) => {
15670            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
15671                return Err(AuthorError::DanglingRef {
15672                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
15673                });
15674            }
15675        }
15676        AnnotationOccurrenceRef::Complex(i) => {
15677            if i.0 >= model.complex_unit_arena.items.len() {
15678                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
15679            }
15680        }
15681    }
15682    Ok(())
15683}
15684fn check_annotation_placeholder_leader_line_ref(
15685    model: &StepModel,
15686    r: &AnnotationPlaceholderLeaderLineRef,
15687) -> Result<(), AuthorError> {
15688    match r {
15689        AnnotationPlaceholderLeaderLineRef::AnnotationPlaceholderLeaderLine(_) => {
15690            return Err(AuthorError::NotAp242 {
15691                entity: "ANNOTATION_PLACEHOLDER_LEADER_LINE",
15692            });
15693        }
15694        AnnotationPlaceholderLeaderLineRef::AnnotationToAnnotationLeaderLine(_) => {
15695            return Err(AuthorError::NotAp242 {
15696                entity: "ANNOTATION_TO_ANNOTATION_LEADER_LINE",
15697            });
15698        }
15699        AnnotationPlaceholderLeaderLineRef::AnnotationToModelLeaderLine(_) => {
15700            return Err(AuthorError::NotAp242 {
15701                entity: "ANNOTATION_TO_MODEL_LEADER_LINE",
15702            });
15703        }
15704        AnnotationPlaceholderLeaderLineRef::AuxiliaryLeaderLine(_) => {
15705            return Err(AuthorError::NotAp242 {
15706                entity: "AUXILIARY_LEADER_LINE",
15707            });
15708        }
15709    }
15710    Ok(())
15711}
15712fn check_annotation_placeholder_occurrence_ref(
15713    model: &StepModel,
15714    r: &AnnotationPlaceholderOccurrenceRef,
15715) -> Result<(), AuthorError> {
15716    match r {
15717        AnnotationPlaceholderOccurrenceRef::AnnotationPlaceholderOccurrence(i) => {
15718            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
15719                return Err(AuthorError::DanglingRef {
15720                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
15721                });
15722            }
15723        }
15724        AnnotationPlaceholderOccurrenceRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
15725            return Err(AuthorError::NotAp242 {
15726                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
15727            });
15728        }
15729        AnnotationPlaceholderOccurrenceRef::Complex(i) => {
15730            if i.0 >= model.complex_unit_arena.items.len() {
15731                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
15732            }
15733        }
15734    }
15735    Ok(())
15736}
15737fn check_annotation_plane_element_ref(
15738    model: &StepModel,
15739    r: &AnnotationPlaneElementRef,
15740) -> Result<(), AuthorError> {
15741    match r {
15742        AnnotationPlaneElementRef::AnnotationCurveOccurrence(i) => {
15743            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
15744                return Err(AuthorError::DanglingRef {
15745                    entity: "ANNOTATION_CURVE_OCCURRENCE",
15746                });
15747            }
15748        }
15749        AnnotationPlaneElementRef::AnnotationFillAreaOccurrence(i) => {
15750            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
15751                return Err(AuthorError::DanglingRef {
15752                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
15753                });
15754            }
15755        }
15756        AnnotationPlaneElementRef::AnnotationOccurrence(i) => {
15757            if i.0 >= model.annotation_occurrence_arena.items.len() {
15758                return Err(AuthorError::DanglingRef {
15759                    entity: "ANNOTATION_OCCURRENCE",
15760                });
15761            }
15762        }
15763        AnnotationPlaneElementRef::AnnotationPlaceholderOccurrence(i) => {
15764            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
15765                return Err(AuthorError::DanglingRef {
15766                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
15767                });
15768            }
15769        }
15770        AnnotationPlaneElementRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
15771            return Err(AuthorError::NotAp242 {
15772                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
15773            });
15774        }
15775        AnnotationPlaneElementRef::AnnotationPlane(i) => {
15776            if i.0 >= model.annotation_plane_arena.items.len() {
15777                return Err(AuthorError::DanglingRef {
15778                    entity: "ANNOTATION_PLANE",
15779                });
15780            }
15781        }
15782        AnnotationPlaneElementRef::AnnotationSymbolOccurrence(i) => {
15783            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
15784                return Err(AuthorError::DanglingRef {
15785                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
15786                });
15787            }
15788        }
15789        AnnotationPlaneElementRef::AnnotationTextOccurrence(i) => {
15790            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
15791                return Err(AuthorError::DanglingRef {
15792                    entity: "ANNOTATION_TEXT_OCCURRENCE",
15793                });
15794            }
15795        }
15796        AnnotationPlaneElementRef::ContextDependentOverRidingStyledItem(i) => {
15797            if i.0
15798                >= model
15799                    .context_dependent_over_riding_styled_item_arena
15800                    .items
15801                    .len()
15802            {
15803                return Err(AuthorError::DanglingRef {
15804                    entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
15805                });
15806            }
15807        }
15808        AnnotationPlaneElementRef::DraughtingAnnotationOccurrence(i) => {
15809            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
15810                return Err(AuthorError::DanglingRef {
15811                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
15812                });
15813            }
15814        }
15815        AnnotationPlaneElementRef::DraughtingCallout(i) => {
15816            if i.0 >= model.draughting_callout_arena.items.len() {
15817                return Err(AuthorError::DanglingRef {
15818                    entity: "DRAUGHTING_CALLOUT",
15819                });
15820            }
15821        }
15822        AnnotationPlaneElementRef::LeaderCurve(i) => {
15823            if i.0 >= model.leader_curve_arena.items.len() {
15824                return Err(AuthorError::DanglingRef {
15825                    entity: "LEADER_CURVE",
15826                });
15827            }
15828        }
15829        AnnotationPlaneElementRef::LeaderDirectedCallout(i) => {
15830            if i.0 >= model.leader_directed_callout_arena.items.len() {
15831                return Err(AuthorError::DanglingRef {
15832                    entity: "LEADER_DIRECTED_CALLOUT",
15833                });
15834            }
15835        }
15836        AnnotationPlaneElementRef::LeaderTerminator(i) => {
15837            if i.0 >= model.leader_terminator_arena.items.len() {
15838                return Err(AuthorError::DanglingRef {
15839                    entity: "LEADER_TERMINATOR",
15840                });
15841            }
15842        }
15843        AnnotationPlaneElementRef::OverRidingStyledItem(i) => {
15844            if i.0 >= model.over_riding_styled_item_arena.items.len() {
15845                return Err(AuthorError::DanglingRef {
15846                    entity: "OVER_RIDING_STYLED_ITEM",
15847                });
15848            }
15849        }
15850        AnnotationPlaneElementRef::StyledItem(i) => {
15851            if i.0 >= model.styled_item_arena.items.len() {
15852                return Err(AuthorError::DanglingRef {
15853                    entity: "STYLED_ITEM",
15854                });
15855            }
15856        }
15857        AnnotationPlaneElementRef::TerminatorSymbol(i) => {
15858            if i.0 >= model.terminator_symbol_arena.items.len() {
15859                return Err(AuthorError::DanglingRef {
15860                    entity: "TERMINATOR_SYMBOL",
15861                });
15862            }
15863        }
15864        AnnotationPlaneElementRef::TessellatedAnnotationOccurrence(i) => {
15865            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
15866                return Err(AuthorError::DanglingRef {
15867                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
15868                });
15869            }
15870        }
15871        AnnotationPlaneElementRef::Complex(i) => {
15872            if i.0 >= model.complex_unit_arena.items.len() {
15873                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
15874            }
15875        }
15876    }
15877    Ok(())
15878}
15879fn check_annotation_representation_select_ref(
15880    model: &StepModel,
15881    r: &AnnotationRepresentationSelectRef,
15882) -> Result<(), AuthorError> {
15883    match r {
15884        AnnotationRepresentationSelectRef::DraughtingModel(i) => {
15885            if i.0 >= model.draughting_model_arena.items.len() {
15886                return Err(AuthorError::DanglingRef {
15887                    entity: "DRAUGHTING_MODEL",
15888                });
15889            }
15890        }
15891        AnnotationRepresentationSelectRef::PresentationArea(i) => {
15892            if i.0 >= model.presentation_area_arena.items.len() {
15893                return Err(AuthorError::DanglingRef {
15894                    entity: "PRESENTATION_AREA",
15895                });
15896            }
15897        }
15898        AnnotationRepresentationSelectRef::PresentationView(i) => {
15899            if i.0 >= model.presentation_view_arena.items.len() {
15900                return Err(AuthorError::DanglingRef {
15901                    entity: "PRESENTATION_VIEW",
15902                });
15903            }
15904        }
15905        AnnotationRepresentationSelectRef::SymbolRepresentation(i) => {
15906            if i.0 >= model.symbol_representation_arena.items.len() {
15907                return Err(AuthorError::DanglingRef {
15908                    entity: "SYMBOL_REPRESENTATION",
15909                });
15910            }
15911        }
15912        AnnotationRepresentationSelectRef::Complex(i) => {
15913            if i.0 >= model.complex_unit_arena.items.len() {
15914                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
15915            }
15916        }
15917    }
15918    Ok(())
15919}
15920fn check_annotation_symbol_occurrence_ref(
15921    model: &StepModel,
15922    r: &AnnotationSymbolOccurrenceRef,
15923) -> Result<(), AuthorError> {
15924    match r {
15925        AnnotationSymbolOccurrenceRef::AnnotationSymbolOccurrence(i) => {
15926            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
15927                return Err(AuthorError::DanglingRef {
15928                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
15929                });
15930            }
15931        }
15932        AnnotationSymbolOccurrenceRef::LeaderTerminator(i) => {
15933            if i.0 >= model.leader_terminator_arena.items.len() {
15934                return Err(AuthorError::DanglingRef {
15935                    entity: "LEADER_TERMINATOR",
15936                });
15937            }
15938        }
15939        AnnotationSymbolOccurrenceRef::TerminatorSymbol(i) => {
15940            if i.0 >= model.terminator_symbol_arena.items.len() {
15941                return Err(AuthorError::DanglingRef {
15942                    entity: "TERMINATOR_SYMBOL",
15943                });
15944            }
15945        }
15946        AnnotationSymbolOccurrenceRef::Complex(i) => {
15947            if i.0 >= model.complex_unit_arena.items.len() {
15948                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
15949            }
15950        }
15951    }
15952    Ok(())
15953}
15954fn check_annotation_symbol_occurrence_item_ref(
15955    model: &StepModel,
15956    r: &AnnotationSymbolOccurrenceItemRef,
15957) -> Result<(), AuthorError> {
15958    match r {
15959        AnnotationSymbolOccurrenceItemRef::AnnotationSymbol(i) => {
15960            if i.0 >= model.annotation_symbol_arena.items.len() {
15961                return Err(AuthorError::DanglingRef {
15962                    entity: "ANNOTATION_SYMBOL",
15963                });
15964            }
15965        }
15966        AnnotationSymbolOccurrenceItemRef::DefinedSymbol(i) => {
15967            if i.0 >= model.defined_symbol_arena.items.len() {
15968                return Err(AuthorError::DanglingRef {
15969                    entity: "DEFINED_SYMBOL",
15970                });
15971            }
15972        }
15973        AnnotationSymbolOccurrenceItemRef::Complex(i) => {
15974            if i.0 >= model.complex_unit_arena.items.len() {
15975                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
15976            }
15977        }
15978    }
15979    Ok(())
15980}
15981fn check_annotation_text_occurrence_item_ref(
15982    model: &StepModel,
15983    r: &AnnotationTextOccurrenceItemRef,
15984) -> Result<(), AuthorError> {
15985    match r {
15986        AnnotationTextOccurrenceItemRef::AnnotationText(i) => {
15987            if i.0 >= model.annotation_text_arena.items.len() {
15988                return Err(AuthorError::DanglingRef {
15989                    entity: "ANNOTATION_TEXT",
15990                });
15991            }
15992        }
15993        AnnotationTextOccurrenceItemRef::AnnotationTextCharacter(i) => {
15994            if i.0 >= model.annotation_text_character_arena.items.len() {
15995                return Err(AuthorError::DanglingRef {
15996                    entity: "ANNOTATION_TEXT_CHARACTER",
15997                });
15998            }
15999        }
16000        AnnotationTextOccurrenceItemRef::CompositeText(i) => {
16001            if i.0 >= model.composite_text_arena.items.len() {
16002                return Err(AuthorError::DanglingRef {
16003                    entity: "COMPOSITE_TEXT",
16004                });
16005            }
16006        }
16007        AnnotationTextOccurrenceItemRef::DefinedCharacterGlyph(i) => {
16008            if i.0 >= model.defined_character_glyph_arena.items.len() {
16009                return Err(AuthorError::DanglingRef {
16010                    entity: "DEFINED_CHARACTER_GLYPH",
16011                });
16012            }
16013        }
16014        AnnotationTextOccurrenceItemRef::TextLiteral(i) => {
16015            if i.0 >= model.text_literal_arena.items.len() {
16016                return Err(AuthorError::DanglingRef {
16017                    entity: "TEXT_LITERAL",
16018                });
16019            }
16020        }
16021        AnnotationTextOccurrenceItemRef::Complex(i) => {
16022            if i.0 >= model.complex_unit_arena.items.len() {
16023                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
16024            }
16025        }
16026    }
16027    Ok(())
16028}
16029fn check_annotation_to_model_leader_line_ref(
16030    model: &StepModel,
16031    r: &AnnotationToModelLeaderLineRef,
16032) -> Result<(), AuthorError> {
16033    match r {
16034        AnnotationToModelLeaderLineRef::AnnotationToModelLeaderLine(_) => {
16035            return Err(AuthorError::NotAp242 {
16036                entity: "ANNOTATION_TO_MODEL_LEADER_LINE",
16037            });
16038        }
16039    }
16040    Ok(())
16041}
16042fn check_application_context_ref(
16043    model: &StepModel,
16044    r: &ApplicationContextRef,
16045) -> Result<(), AuthorError> {
16046    match r {
16047        ApplicationContextRef::ApplicationContext(i) => {
16048            if i.0 >= model.application_context_arena.items.len() {
16049                return Err(AuthorError::DanglingRef {
16050                    entity: "APPLICATION_CONTEXT",
16051                });
16052            }
16053        }
16054    }
16055    Ok(())
16056}
16057fn check_approval_ref(model: &StepModel, r: &ApprovalRef) -> Result<(), AuthorError> {
16058    match r {
16059        ApprovalRef::Approval(i) => {
16060            if i.0 >= model.approval_arena.items.len() {
16061                return Err(AuthorError::DanglingRef { entity: "APPROVAL" });
16062            }
16063        }
16064    }
16065    Ok(())
16066}
16067fn check_approval_item_ref(model: &StepModel, r: &ApprovalItemRef) -> Result<(), AuthorError> {
16068    match r {
16069        ApprovalItemRef::Action(i) => {
16070            if i.0 >= model.action_arena.items.len() {
16071                return Err(AuthorError::DanglingRef { entity: "ACTION" });
16072            }
16073        }
16074        ApprovalItemRef::ActionDirective(i) => {
16075            if i.0 >= model.action_directive_arena.items.len() {
16076                return Err(AuthorError::DanglingRef {
16077                    entity: "ACTION_DIRECTIVE",
16078                });
16079            }
16080        }
16081        ApprovalItemRef::ActionMethod(i) => {
16082            if i.0 >= model.action_method_arena.items.len() {
16083                return Err(AuthorError::DanglingRef {
16084                    entity: "ACTION_METHOD",
16085                });
16086            }
16087        }
16088        ApprovalItemRef::ActionMethodRelationship(i) => {
16089            if i.0 >= model.action_method_relationship_arena.items.len() {
16090                return Err(AuthorError::DanglingRef {
16091                    entity: "ACTION_METHOD_RELATIONSHIP",
16092                });
16093            }
16094        }
16095        ApprovalItemRef::ActionProperty(i) => {
16096            if i.0 >= model.action_property_arena.items.len() {
16097                return Err(AuthorError::DanglingRef {
16098                    entity: "ACTION_PROPERTY",
16099                });
16100            }
16101        }
16102        ApprovalItemRef::ActionRequestSolution(i) => {
16103            if i.0 >= model.action_request_solution_arena.items.len() {
16104                return Err(AuthorError::DanglingRef {
16105                    entity: "ACTION_REQUEST_SOLUTION",
16106                });
16107            }
16108        }
16109        ApprovalItemRef::AdvancedBrepShapeRepresentation(i) => {
16110            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
16111                return Err(AuthorError::DanglingRef {
16112                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
16113                });
16114            }
16115        }
16116        ApprovalItemRef::AdvancedFace(i) => {
16117            if i.0 >= model.advanced_face_arena.items.len() {
16118                return Err(AuthorError::DanglingRef {
16119                    entity: "ADVANCED_FACE",
16120                });
16121            }
16122        }
16123        ApprovalItemRef::AngularLocation(i) => {
16124            if i.0 >= model.angular_location_arena.items.len() {
16125                return Err(AuthorError::DanglingRef {
16126                    entity: "ANGULAR_LOCATION",
16127                });
16128            }
16129        }
16130        ApprovalItemRef::AnnotationCurveOccurrence(i) => {
16131            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
16132                return Err(AuthorError::DanglingRef {
16133                    entity: "ANNOTATION_CURVE_OCCURRENCE",
16134                });
16135            }
16136        }
16137        ApprovalItemRef::AnnotationFillAreaOccurrence(i) => {
16138            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
16139                return Err(AuthorError::DanglingRef {
16140                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
16141                });
16142            }
16143        }
16144        ApprovalItemRef::AnnotationOccurrence(i) => {
16145            if i.0 >= model.annotation_occurrence_arena.items.len() {
16146                return Err(AuthorError::DanglingRef {
16147                    entity: "ANNOTATION_OCCURRENCE",
16148                });
16149            }
16150        }
16151        ApprovalItemRef::AnnotationPlaceholderLeaderLine(_) => {
16152            return Err(AuthorError::NotAp242 {
16153                entity: "ANNOTATION_PLACEHOLDER_LEADER_LINE",
16154            });
16155        }
16156        ApprovalItemRef::AnnotationPlaceholderOccurrence(i) => {
16157            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
16158                return Err(AuthorError::DanglingRef {
16159                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
16160                });
16161            }
16162        }
16163        ApprovalItemRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
16164            return Err(AuthorError::NotAp242 {
16165                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
16166            });
16167        }
16168        ApprovalItemRef::AnnotationPlane(i) => {
16169            if i.0 >= model.annotation_plane_arena.items.len() {
16170                return Err(AuthorError::DanglingRef {
16171                    entity: "ANNOTATION_PLANE",
16172                });
16173            }
16174        }
16175        ApprovalItemRef::AnnotationSymbol(i) => {
16176            if i.0 >= model.annotation_symbol_arena.items.len() {
16177                return Err(AuthorError::DanglingRef {
16178                    entity: "ANNOTATION_SYMBOL",
16179                });
16180            }
16181        }
16182        ApprovalItemRef::AnnotationSymbolOccurrence(i) => {
16183            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
16184                return Err(AuthorError::DanglingRef {
16185                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
16186                });
16187            }
16188        }
16189        ApprovalItemRef::AnnotationText(i) => {
16190            if i.0 >= model.annotation_text_arena.items.len() {
16191                return Err(AuthorError::DanglingRef {
16192                    entity: "ANNOTATION_TEXT",
16193                });
16194            }
16195        }
16196        ApprovalItemRef::AnnotationTextCharacter(i) => {
16197            if i.0 >= model.annotation_text_character_arena.items.len() {
16198                return Err(AuthorError::DanglingRef {
16199                    entity: "ANNOTATION_TEXT_CHARACTER",
16200                });
16201            }
16202        }
16203        ApprovalItemRef::AnnotationTextOccurrence(i) => {
16204            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
16205                return Err(AuthorError::DanglingRef {
16206                    entity: "ANNOTATION_TEXT_OCCURRENCE",
16207                });
16208            }
16209        }
16210        ApprovalItemRef::AnnotationToAnnotationLeaderLine(_) => {
16211            return Err(AuthorError::NotAp242 {
16212                entity: "ANNOTATION_TO_ANNOTATION_LEADER_LINE",
16213            });
16214        }
16215        ApprovalItemRef::AnnotationToModelLeaderLine(_) => {
16216            return Err(AuthorError::NotAp242 {
16217                entity: "ANNOTATION_TO_MODEL_LEADER_LINE",
16218            });
16219        }
16220        ApprovalItemRef::ApllPoint(_) => {
16221            return Err(AuthorError::NotAp242 {
16222                entity: "APLL_POINT",
16223            });
16224        }
16225        ApprovalItemRef::ApllPointWithSurface(_) => {
16226            return Err(AuthorError::NotAp242 {
16227                entity: "APLL_POINT_WITH_SURFACE",
16228            });
16229        }
16230        ApprovalItemRef::AppliedApprovalAssignment(i) => {
16231            if i.0 >= model.applied_approval_assignment_arena.items.len() {
16232                return Err(AuthorError::DanglingRef {
16233                    entity: "APPLIED_APPROVAL_ASSIGNMENT",
16234                });
16235            }
16236        }
16237        ApprovalItemRef::AppliedDateAndTimeAssignment(i) => {
16238            if i.0 >= model.applied_date_and_time_assignment_arena.items.len() {
16239                return Err(AuthorError::DanglingRef {
16240                    entity: "APPLIED_DATE_AND_TIME_ASSIGNMENT",
16241                });
16242            }
16243        }
16244        ApprovalItemRef::AppliedDocumentReference(i) => {
16245            if i.0 >= model.applied_document_reference_arena.items.len() {
16246                return Err(AuthorError::DanglingRef {
16247                    entity: "APPLIED_DOCUMENT_REFERENCE",
16248                });
16249            }
16250        }
16251        ApprovalItemRef::AppliedExternalIdentificationAssignment(i) => {
16252            if i.0
16253                >= model
16254                    .applied_external_identification_assignment_arena
16255                    .items
16256                    .len()
16257            {
16258                return Err(AuthorError::DanglingRef {
16259                    entity: "APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT",
16260                });
16261            }
16262        }
16263        ApprovalItemRef::AppliedPersonAndOrganizationAssignment(i) => {
16264            if i.0
16265                >= model
16266                    .applied_person_and_organization_assignment_arena
16267                    .items
16268                    .len()
16269            {
16270                return Err(AuthorError::DanglingRef {
16271                    entity: "APPLIED_PERSON_AND_ORGANIZATION_ASSIGNMENT",
16272                });
16273            }
16274        }
16275        ApprovalItemRef::AssemblyComponentUsage(i) => {
16276            if i.0 >= model.assembly_component_usage_arena.items.len() {
16277                return Err(AuthorError::DanglingRef {
16278                    entity: "ASSEMBLY_COMPONENT_USAGE",
16279                });
16280            }
16281        }
16282        ApprovalItemRef::AuxiliaryLeaderLine(_) => {
16283            return Err(AuthorError::NotAp242 {
16284                entity: "AUXILIARY_LEADER_LINE",
16285            });
16286        }
16287        ApprovalItemRef::Axis1Placement(i) => {
16288            if i.0 >= model.axis1_placement_arena.items.len() {
16289                return Err(AuthorError::DanglingRef {
16290                    entity: "AXIS1_PLACEMENT",
16291                });
16292            }
16293        }
16294        ApprovalItemRef::Axis2Placement2d(i) => {
16295            if i.0 >= model.axis2_placement2d_arena.items.len() {
16296                return Err(AuthorError::DanglingRef {
16297                    entity: "AXIS2_PLACEMENT_2D",
16298                });
16299            }
16300        }
16301        ApprovalItemRef::Axis2Placement3d(i) => {
16302            if i.0 >= model.axis2_placement3d_arena.items.len() {
16303                return Err(AuthorError::DanglingRef {
16304                    entity: "AXIS2_PLACEMENT_3D",
16305                });
16306            }
16307        }
16308        ApprovalItemRef::BSplineCurve(i) => {
16309            if i.0 >= model.b_spline_curve_arena.items.len() {
16310                return Err(AuthorError::DanglingRef {
16311                    entity: "B_SPLINE_CURVE",
16312                });
16313            }
16314        }
16315        ApprovalItemRef::BSplineCurveWithKnots(i) => {
16316            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
16317                return Err(AuthorError::DanglingRef {
16318                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
16319                });
16320            }
16321        }
16322        ApprovalItemRef::BSplineSurface(i) => {
16323            if i.0 >= model.b_spline_surface_arena.items.len() {
16324                return Err(AuthorError::DanglingRef {
16325                    entity: "B_SPLINE_SURFACE",
16326                });
16327            }
16328        }
16329        ApprovalItemRef::BSplineSurfaceWithKnots(i) => {
16330            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
16331                return Err(AuthorError::DanglingRef {
16332                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
16333                });
16334            }
16335        }
16336        ApprovalItemRef::BezierCurve(i) => {
16337            if i.0 >= model.bezier_curve_arena.items.len() {
16338                return Err(AuthorError::DanglingRef {
16339                    entity: "BEZIER_CURVE",
16340                });
16341            }
16342        }
16343        ApprovalItemRef::BezierSurface(i) => {
16344            if i.0 >= model.bezier_surface_arena.items.len() {
16345                return Err(AuthorError::DanglingRef {
16346                    entity: "BEZIER_SURFACE",
16347                });
16348            }
16349        }
16350        ApprovalItemRef::BoundedCurve(i) => {
16351            if i.0 >= model.bounded_curve_arena.items.len() {
16352                return Err(AuthorError::DanglingRef {
16353                    entity: "BOUNDED_CURVE",
16354                });
16355            }
16356        }
16357        ApprovalItemRef::BoundedPcurve(i) => {
16358            if i.0 >= model.bounded_pcurve_arena.items.len() {
16359                return Err(AuthorError::DanglingRef {
16360                    entity: "BOUNDED_PCURVE",
16361                });
16362            }
16363        }
16364        ApprovalItemRef::BoundedSurface(i) => {
16365            if i.0 >= model.bounded_surface_arena.items.len() {
16366                return Err(AuthorError::DanglingRef {
16367                    entity: "BOUNDED_SURFACE",
16368                });
16369            }
16370        }
16371        ApprovalItemRef::BoundedSurfaceCurve(i) => {
16372            if i.0 >= model.bounded_surface_curve_arena.items.len() {
16373                return Err(AuthorError::DanglingRef {
16374                    entity: "BOUNDED_SURFACE_CURVE",
16375                });
16376            }
16377        }
16378        ApprovalItemRef::BrepWithVoids(i) => {
16379            if i.0 >= model.brep_with_voids_arena.items.len() {
16380                return Err(AuthorError::DanglingRef {
16381                    entity: "BREP_WITH_VOIDS",
16382                });
16383            }
16384        }
16385        ApprovalItemRef::CalendarDate(i) => {
16386            if i.0 >= model.calendar_date_arena.items.len() {
16387                return Err(AuthorError::DanglingRef {
16388                    entity: "CALENDAR_DATE",
16389                });
16390            }
16391        }
16392        ApprovalItemRef::CameraImage(i) => {
16393            if i.0 >= model.camera_image_arena.items.len() {
16394                return Err(AuthorError::DanglingRef {
16395                    entity: "CAMERA_IMAGE",
16396                });
16397            }
16398        }
16399        ApprovalItemRef::CameraImage3dWithScale(i) => {
16400            if i.0 >= model.camera_image3d_with_scale_arena.items.len() {
16401                return Err(AuthorError::DanglingRef {
16402                    entity: "CAMERA_IMAGE_3D_WITH_SCALE",
16403                });
16404            }
16405        }
16406        ApprovalItemRef::CameraModel(i) => {
16407            if i.0 >= model.camera_model_arena.items.len() {
16408                return Err(AuthorError::DanglingRef {
16409                    entity: "CAMERA_MODEL",
16410                });
16411            }
16412        }
16413        ApprovalItemRef::CameraModelD3(i) => {
16414            if i.0 >= model.camera_model_d3_arena.items.len() {
16415                return Err(AuthorError::DanglingRef {
16416                    entity: "CAMERA_MODEL_D3",
16417                });
16418            }
16419        }
16420        ApprovalItemRef::CameraModelD3MultiClipping(i) => {
16421            if i.0 >= model.camera_model_d3_multi_clipping_arena.items.len() {
16422                return Err(AuthorError::DanglingRef {
16423                    entity: "CAMERA_MODEL_D3_MULTI_CLIPPING",
16424                });
16425            }
16426        }
16427        ApprovalItemRef::CameraModelD3WithHlhsr(i) => {
16428            if i.0 >= model.camera_model_d3_with_hlhsr_arena.items.len() {
16429                return Err(AuthorError::DanglingRef {
16430                    entity: "CAMERA_MODEL_D3_WITH_HLHSR",
16431                });
16432            }
16433        }
16434        ApprovalItemRef::CartesianPoint(i) => {
16435            if i.0 >= model.cartesian_point_arena.items.len() {
16436                return Err(AuthorError::DanglingRef {
16437                    entity: "CARTESIAN_POINT",
16438                });
16439            }
16440        }
16441        ApprovalItemRef::CcDesignDateAndTimeAssignment(i) => {
16442            if i.0 >= model.cc_design_date_and_time_assignment_arena.items.len() {
16443                return Err(AuthorError::DanglingRef {
16444                    entity: "CC_DESIGN_DATE_AND_TIME_ASSIGNMENT",
16445                });
16446            }
16447        }
16448        ApprovalItemRef::Certification(i) => {
16449            if i.0 >= model.certification_arena.items.len() {
16450                return Err(AuthorError::DanglingRef {
16451                    entity: "CERTIFICATION",
16452                });
16453            }
16454        }
16455        ApprovalItemRef::CharacterizedRepresentation(i) => {
16456            if i.0 >= model.characterized_representation_arena.items.len() {
16457                return Err(AuthorError::DanglingRef {
16458                    entity: "CHARACTERIZED_REPRESENTATION",
16459                });
16460            }
16461        }
16462        ApprovalItemRef::Circle(i) => {
16463            if i.0 >= model.circle_arena.items.len() {
16464                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
16465            }
16466        }
16467        ApprovalItemRef::ClosedShell(i) => {
16468            if i.0 >= model.closed_shell_arena.items.len() {
16469                return Err(AuthorError::DanglingRef {
16470                    entity: "CLOSED_SHELL",
16471                });
16472            }
16473        }
16474        ApprovalItemRef::ComplexTriangulatedFace(i) => {
16475            if i.0 >= model.complex_triangulated_face_arena.items.len() {
16476                return Err(AuthorError::DanglingRef {
16477                    entity: "COMPLEX_TRIANGULATED_FACE",
16478                });
16479            }
16480        }
16481        ApprovalItemRef::ComplexTriangulatedSurfaceSet(i) => {
16482            if i.0 >= model.complex_triangulated_surface_set_arena.items.len() {
16483                return Err(AuthorError::DanglingRef {
16484                    entity: "COMPLEX_TRIANGULATED_SURFACE_SET",
16485                });
16486            }
16487        }
16488        ApprovalItemRef::CompositeCurve(i) => {
16489            if i.0 >= model.composite_curve_arena.items.len() {
16490                return Err(AuthorError::DanglingRef {
16491                    entity: "COMPOSITE_CURVE",
16492                });
16493            }
16494        }
16495        ApprovalItemRef::CompositeText(i) => {
16496            if i.0 >= model.composite_text_arena.items.len() {
16497                return Err(AuthorError::DanglingRef {
16498                    entity: "COMPOSITE_TEXT",
16499                });
16500            }
16501        }
16502        ApprovalItemRef::CompoundRepresentationItem(i) => {
16503            if i.0 >= model.compound_representation_item_arena.items.len() {
16504                return Err(AuthorError::DanglingRef {
16505                    entity: "COMPOUND_REPRESENTATION_ITEM",
16506                });
16507            }
16508        }
16509        ApprovalItemRef::ConfigurationDesign(i) => {
16510            if i.0 >= model.configuration_design_arena.items.len() {
16511                return Err(AuthorError::DanglingRef {
16512                    entity: "CONFIGURATION_DESIGN",
16513                });
16514            }
16515        }
16516        ApprovalItemRef::ConfigurationEffectivity(i) => {
16517            if i.0 >= model.configuration_effectivity_arena.items.len() {
16518                return Err(AuthorError::DanglingRef {
16519                    entity: "CONFIGURATION_EFFECTIVITY",
16520                });
16521            }
16522        }
16523        ApprovalItemRef::ConfigurationItem(i) => {
16524            if i.0 >= model.configuration_item_arena.items.len() {
16525                return Err(AuthorError::DanglingRef {
16526                    entity: "CONFIGURATION_ITEM",
16527                });
16528            }
16529        }
16530        ApprovalItemRef::Conic(i) => {
16531            if i.0 >= model.conic_arena.items.len() {
16532                return Err(AuthorError::DanglingRef { entity: "CONIC" });
16533            }
16534        }
16535        ApprovalItemRef::ConicalSurface(i) => {
16536            if i.0 >= model.conical_surface_arena.items.len() {
16537                return Err(AuthorError::DanglingRef {
16538                    entity: "CONICAL_SURFACE",
16539                });
16540            }
16541        }
16542        ApprovalItemRef::ConnectedFaceSet(i) => {
16543            if i.0 >= model.connected_face_set_arena.items.len() {
16544                return Err(AuthorError::DanglingRef {
16545                    entity: "CONNECTED_FACE_SET",
16546                });
16547            }
16548        }
16549        ApprovalItemRef::ConstructiveGeometryRepresentation(i) => {
16550            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
16551                return Err(AuthorError::DanglingRef {
16552                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
16553                });
16554            }
16555        }
16556        ApprovalItemRef::ConstructiveGeometryRepresentationRelationship(i) => {
16557            if i.0
16558                >= model
16559                    .constructive_geometry_representation_relationship_arena
16560                    .items
16561                    .len()
16562            {
16563                return Err(AuthorError::DanglingRef {
16564                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP",
16565                });
16566            }
16567        }
16568        ApprovalItemRef::ContextDependentOverRidingStyledItem(i) => {
16569            if i.0
16570                >= model
16571                    .context_dependent_over_riding_styled_item_arena
16572                    .items
16573                    .len()
16574            {
16575                return Err(AuthorError::DanglingRef {
16576                    entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
16577                });
16578            }
16579        }
16580        ApprovalItemRef::Contract(i) => {
16581            if i.0 >= model.contract_arena.items.len() {
16582                return Err(AuthorError::DanglingRef { entity: "CONTRACT" });
16583            }
16584        }
16585        ApprovalItemRef::CoordinatesList(i) => {
16586            if i.0 >= model.coordinates_list_arena.items.len() {
16587                return Err(AuthorError::DanglingRef {
16588                    entity: "COORDINATES_LIST",
16589                });
16590            }
16591        }
16592        ApprovalItemRef::Curve(i) => {
16593            if i.0 >= model.curve_arena.items.len() {
16594                return Err(AuthorError::DanglingRef { entity: "CURVE" });
16595            }
16596        }
16597        ApprovalItemRef::CylindricalSurface(i) => {
16598            if i.0 >= model.cylindrical_surface_arena.items.len() {
16599                return Err(AuthorError::DanglingRef {
16600                    entity: "CYLINDRICAL_SURFACE",
16601                });
16602            }
16603        }
16604        ApprovalItemRef::Date(i) => {
16605            if i.0 >= model.date_arena.items.len() {
16606                return Err(AuthorError::DanglingRef { entity: "DATE" });
16607            }
16608        }
16609        ApprovalItemRef::DateAndTimeAssignment(i) => {
16610            if i.0 >= model.date_and_time_assignment_arena.items.len() {
16611                return Err(AuthorError::DanglingRef {
16612                    entity: "DATE_AND_TIME_ASSIGNMENT",
16613                });
16614            }
16615        }
16616        ApprovalItemRef::DefinedCharacterGlyph(i) => {
16617            if i.0 >= model.defined_character_glyph_arena.items.len() {
16618                return Err(AuthorError::DanglingRef {
16619                    entity: "DEFINED_CHARACTER_GLYPH",
16620                });
16621            }
16622        }
16623        ApprovalItemRef::DefinedSymbol(i) => {
16624            if i.0 >= model.defined_symbol_arena.items.len() {
16625                return Err(AuthorError::DanglingRef {
16626                    entity: "DEFINED_SYMBOL",
16627                });
16628            }
16629        }
16630        ApprovalItemRef::DefinitionalRepresentation(i) => {
16631            if i.0 >= model.definitional_representation_arena.items.len() {
16632                return Err(AuthorError::DanglingRef {
16633                    entity: "DEFINITIONAL_REPRESENTATION",
16634                });
16635            }
16636        }
16637        ApprovalItemRef::DefinitionalRepresentationRelationship(i) => {
16638            if i.0
16639                >= model
16640                    .definitional_representation_relationship_arena
16641                    .items
16642                    .len()
16643            {
16644                return Err(AuthorError::DanglingRef {
16645                    entity: "DEFINITIONAL_REPRESENTATION_RELATIONSHIP",
16646                });
16647            }
16648        }
16649        ApprovalItemRef::DefinitionalRepresentationRelationshipWithSameContext(i) => {
16650            if i.0
16651                >= model
16652                    .definitional_representation_relationship_with_same_context_arena
16653                    .items
16654                    .len()
16655            {
16656                return Err(AuthorError::DanglingRef {
16657                    entity: "DEFINITIONAL_REPRESENTATION_RELATIONSHIP_WITH_SAME_CONTEXT",
16658                });
16659            }
16660        }
16661        ApprovalItemRef::DegenerateToroidalSurface(i) => {
16662            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
16663                return Err(AuthorError::DanglingRef {
16664                    entity: "DEGENERATE_TOROIDAL_SURFACE",
16665                });
16666            }
16667        }
16668        ApprovalItemRef::DescriptiveRepresentationItem(i) => {
16669            if i.0 >= model.descriptive_representation_item_arena.items.len() {
16670                return Err(AuthorError::DanglingRef {
16671                    entity: "DESCRIPTIVE_REPRESENTATION_ITEM",
16672                });
16673            }
16674        }
16675        ApprovalItemRef::DesignContext(i) => {
16676            if i.0 >= model.design_context_arena.items.len() {
16677                return Err(AuthorError::DanglingRef {
16678                    entity: "DESIGN_CONTEXT",
16679                });
16680            }
16681        }
16682        ApprovalItemRef::DimensionalLocation(i) => {
16683            if i.0 >= model.dimensional_location_arena.items.len() {
16684                return Err(AuthorError::DanglingRef {
16685                    entity: "DIMENSIONAL_LOCATION",
16686                });
16687            }
16688        }
16689        ApprovalItemRef::DimensionalLocationWithPath(i) => {
16690            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
16691                return Err(AuthorError::DanglingRef {
16692                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
16693                });
16694            }
16695        }
16696        ApprovalItemRef::DirectedDimensionalLocation(i) => {
16697            if i.0 >= model.directed_dimensional_location_arena.items.len() {
16698                return Err(AuthorError::DanglingRef {
16699                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
16700                });
16701            }
16702        }
16703        ApprovalItemRef::Direction(i) => {
16704            if i.0 >= model.direction_arena.items.len() {
16705                return Err(AuthorError::DanglingRef {
16706                    entity: "DIRECTION",
16707                });
16708            }
16709        }
16710        ApprovalItemRef::Document(i) => {
16711            if i.0 >= model.document_arena.items.len() {
16712                return Err(AuthorError::DanglingRef { entity: "DOCUMENT" });
16713            }
16714        }
16715        ApprovalItemRef::DocumentFile(i) => {
16716            if i.0 >= model.document_file_arena.items.len() {
16717                return Err(AuthorError::DanglingRef {
16718                    entity: "DOCUMENT_FILE",
16719                });
16720            }
16721        }
16722        ApprovalItemRef::DraughtingAnnotationOccurrence(i) => {
16723            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
16724                return Err(AuthorError::DanglingRef {
16725                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
16726                });
16727            }
16728        }
16729        ApprovalItemRef::DraughtingCallout(i) => {
16730            if i.0 >= model.draughting_callout_arena.items.len() {
16731                return Err(AuthorError::DanglingRef {
16732                    entity: "DRAUGHTING_CALLOUT",
16733                });
16734            }
16735        }
16736        ApprovalItemRef::DraughtingModel(i) => {
16737            if i.0 >= model.draughting_model_arena.items.len() {
16738                return Err(AuthorError::DanglingRef {
16739                    entity: "DRAUGHTING_MODEL",
16740                });
16741            }
16742        }
16743        ApprovalItemRef::Edge(i) => {
16744            if i.0 >= model.edge_arena.items.len() {
16745                return Err(AuthorError::DanglingRef { entity: "EDGE" });
16746            }
16747        }
16748        ApprovalItemRef::EdgeCurve(i) => {
16749            if i.0 >= model.edge_curve_arena.items.len() {
16750                return Err(AuthorError::DanglingRef {
16751                    entity: "EDGE_CURVE",
16752                });
16753            }
16754        }
16755        ApprovalItemRef::EdgeLoop(i) => {
16756            if i.0 >= model.edge_loop_arena.items.len() {
16757                return Err(AuthorError::DanglingRef {
16758                    entity: "EDGE_LOOP",
16759                });
16760            }
16761        }
16762        ApprovalItemRef::Effectivity(i) => {
16763            if i.0 >= model.effectivity_arena.items.len() {
16764                return Err(AuthorError::DanglingRef {
16765                    entity: "EFFECTIVITY",
16766                });
16767            }
16768        }
16769        ApprovalItemRef::ElementarySurface(i) => {
16770            if i.0 >= model.elementary_surface_arena.items.len() {
16771                return Err(AuthorError::DanglingRef {
16772                    entity: "ELEMENTARY_SURFACE",
16773                });
16774            }
16775        }
16776        ApprovalItemRef::Ellipse(i) => {
16777            if i.0 >= model.ellipse_arena.items.len() {
16778                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
16779            }
16780        }
16781        ApprovalItemRef::ExternallyDefinedHatchStyle(i) => {
16782            if i.0 >= model.externally_defined_hatch_style_arena.items.len() {
16783                return Err(AuthorError::DanglingRef {
16784                    entity: "EXTERNALLY_DEFINED_HATCH_STYLE",
16785                });
16786            }
16787        }
16788        ApprovalItemRef::ExternallyDefinedTileStyle(i) => {
16789            if i.0 >= model.externally_defined_tile_style_arena.items.len() {
16790                return Err(AuthorError::DanglingRef {
16791                    entity: "EXTERNALLY_DEFINED_TILE_STYLE",
16792                });
16793            }
16794        }
16795        ApprovalItemRef::Face(i) => {
16796            if i.0 >= model.face_arena.items.len() {
16797                return Err(AuthorError::DanglingRef { entity: "FACE" });
16798            }
16799        }
16800        ApprovalItemRef::FaceBound(i) => {
16801            if i.0 >= model.face_bound_arena.items.len() {
16802                return Err(AuthorError::DanglingRef {
16803                    entity: "FACE_BOUND",
16804                });
16805            }
16806        }
16807        ApprovalItemRef::FaceOuterBound(i) => {
16808            if i.0 >= model.face_outer_bound_arena.items.len() {
16809                return Err(AuthorError::DanglingRef {
16810                    entity: "FACE_OUTER_BOUND",
16811                });
16812            }
16813        }
16814        ApprovalItemRef::FaceSurface(i) => {
16815            if i.0 >= model.face_surface_arena.items.len() {
16816                return Err(AuthorError::DanglingRef {
16817                    entity: "FACE_SURFACE",
16818                });
16819            }
16820        }
16821        ApprovalItemRef::FeatureForDatumTargetRelationship(i) => {
16822            if i.0
16823                >= model
16824                    .feature_for_datum_target_relationship_arena
16825                    .items
16826                    .len()
16827            {
16828                return Err(AuthorError::DanglingRef {
16829                    entity: "FEATURE_FOR_DATUM_TARGET_RELATIONSHIP",
16830                });
16831            }
16832        }
16833        ApprovalItemRef::FillAreaStyleHatching(i) => {
16834            if i.0 >= model.fill_area_style_hatching_arena.items.len() {
16835                return Err(AuthorError::DanglingRef {
16836                    entity: "FILL_AREA_STYLE_HATCHING",
16837                });
16838            }
16839        }
16840        ApprovalItemRef::FillAreaStyleTileColouredRegion(i) => {
16841            if i.0 >= model.fill_area_style_tile_coloured_region_arena.items.len() {
16842                return Err(AuthorError::DanglingRef {
16843                    entity: "FILL_AREA_STYLE_TILE_COLOURED_REGION",
16844                });
16845            }
16846        }
16847        ApprovalItemRef::FillAreaStyleTileCurveWithStyle(i) => {
16848            if i.0
16849                >= model
16850                    .fill_area_style_tile_curve_with_style_arena
16851                    .items
16852                    .len()
16853            {
16854                return Err(AuthorError::DanglingRef {
16855                    entity: "FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE",
16856                });
16857            }
16858        }
16859        ApprovalItemRef::FillAreaStyleTileSymbolWithStyle(i) => {
16860            if i.0
16861                >= model
16862                    .fill_area_style_tile_symbol_with_style_arena
16863                    .items
16864                    .len()
16865            {
16866                return Err(AuthorError::DanglingRef {
16867                    entity: "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE",
16868                });
16869            }
16870        }
16871        ApprovalItemRef::FillAreaStyleTiles(i) => {
16872            if i.0 >= model.fill_area_style_tiles_arena.items.len() {
16873                return Err(AuthorError::DanglingRef {
16874                    entity: "FILL_AREA_STYLE_TILES",
16875                });
16876            }
16877        }
16878        ApprovalItemRef::GeneralProperty(i) => {
16879            if i.0 >= model.general_property_arena.items.len() {
16880                return Err(AuthorError::DanglingRef {
16881                    entity: "GENERAL_PROPERTY",
16882                });
16883            }
16884        }
16885        ApprovalItemRef::GeometricCurveSet(i) => {
16886            if i.0 >= model.geometric_curve_set_arena.items.len() {
16887                return Err(AuthorError::DanglingRef {
16888                    entity: "GEOMETRIC_CURVE_SET",
16889                });
16890            }
16891        }
16892        ApprovalItemRef::GeometricRepresentationItem(i) => {
16893            if i.0 >= model.geometric_representation_item_arena.items.len() {
16894                return Err(AuthorError::DanglingRef {
16895                    entity: "GEOMETRIC_REPRESENTATION_ITEM",
16896                });
16897            }
16898        }
16899        ApprovalItemRef::GeometricSet(i) => {
16900            if i.0 >= model.geometric_set_arena.items.len() {
16901                return Err(AuthorError::DanglingRef {
16902                    entity: "GEOMETRIC_SET",
16903                });
16904            }
16905        }
16906        ApprovalItemRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
16907            if i.0
16908                >= model
16909                    .geometrically_bounded_surface_shape_representation_arena
16910                    .items
16911                    .len()
16912            {
16913                return Err(AuthorError::DanglingRef {
16914                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
16915                });
16916            }
16917        }
16918        ApprovalItemRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
16919            if i.0
16920                >= model
16921                    .geometrically_bounded_wireframe_shape_representation_arena
16922                    .items
16923                    .len()
16924            {
16925                return Err(AuthorError::DanglingRef {
16926                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
16927                });
16928            }
16929        }
16930        ApprovalItemRef::Group(i) => {
16931            if i.0 >= model.group_arena.items.len() {
16932                return Err(AuthorError::DanglingRef { entity: "GROUP" });
16933            }
16934        }
16935        ApprovalItemRef::Hyperbola(i) => {
16936            if i.0 >= model.hyperbola_arena.items.len() {
16937                return Err(AuthorError::DanglingRef {
16938                    entity: "HYPERBOLA",
16939                });
16940            }
16941        }
16942        ApprovalItemRef::IntegerRepresentationItem(i) => {
16943            if i.0 >= model.integer_representation_item_arena.items.len() {
16944                return Err(AuthorError::DanglingRef {
16945                    entity: "INTEGER_REPRESENTATION_ITEM",
16946                });
16947            }
16948        }
16949        ApprovalItemRef::IntersectionCurve(i) => {
16950            if i.0 >= model.intersection_curve_arena.items.len() {
16951                return Err(AuthorError::DanglingRef {
16952                    entity: "INTERSECTION_CURVE",
16953                });
16954            }
16955        }
16956        ApprovalItemRef::LeaderCurve(i) => {
16957            if i.0 >= model.leader_curve_arena.items.len() {
16958                return Err(AuthorError::DanglingRef {
16959                    entity: "LEADER_CURVE",
16960                });
16961            }
16962        }
16963        ApprovalItemRef::LeaderDirectedCallout(i) => {
16964            if i.0 >= model.leader_directed_callout_arena.items.len() {
16965                return Err(AuthorError::DanglingRef {
16966                    entity: "LEADER_DIRECTED_CALLOUT",
16967                });
16968            }
16969        }
16970        ApprovalItemRef::LeaderTerminator(i) => {
16971            if i.0 >= model.leader_terminator_arena.items.len() {
16972                return Err(AuthorError::DanglingRef {
16973                    entity: "LEADER_TERMINATOR",
16974                });
16975            }
16976        }
16977        ApprovalItemRef::Line(i) => {
16978            if i.0 >= model.line_arena.items.len() {
16979                return Err(AuthorError::DanglingRef { entity: "LINE" });
16980            }
16981        }
16982        ApprovalItemRef::Loop(i) => {
16983            if i.0 >= model.loop_arena.items.len() {
16984                return Err(AuthorError::DanglingRef { entity: "LOOP" });
16985            }
16986        }
16987        ApprovalItemRef::MakeFromUsageOption(i) => {
16988            if i.0 >= model.make_from_usage_option_arena.items.len() {
16989                return Err(AuthorError::DanglingRef {
16990                    entity: "MAKE_FROM_USAGE_OPTION",
16991                });
16992            }
16993        }
16994        ApprovalItemRef::ManifoldSolidBrep(i) => {
16995            if i.0 >= model.manifold_solid_brep_arena.items.len() {
16996                return Err(AuthorError::DanglingRef {
16997                    entity: "MANIFOLD_SOLID_BREP",
16998                });
16999            }
17000        }
17001        ApprovalItemRef::ManifoldSurfaceShapeRepresentation(i) => {
17002            if i.0
17003                >= model
17004                    .manifold_surface_shape_representation_arena
17005                    .items
17006                    .len()
17007            {
17008                return Err(AuthorError::DanglingRef {
17009                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
17010                });
17011            }
17012        }
17013        ApprovalItemRef::MappedItem(i) => {
17014            if i.0 >= model.mapped_item_arena.items.len() {
17015                return Err(AuthorError::DanglingRef {
17016                    entity: "MAPPED_ITEM",
17017                });
17018            }
17019        }
17020        ApprovalItemRef::MeasureRepresentationItem(i) => {
17021            if i.0 >= model.measure_representation_item_arena.items.len() {
17022                return Err(AuthorError::DanglingRef {
17023                    entity: "MEASURE_REPRESENTATION_ITEM",
17024                });
17025            }
17026        }
17027        ApprovalItemRef::MechanicalDesignAndDraughtingRelationship(i) => {
17028            if i.0
17029                >= model
17030                    .mechanical_design_and_draughting_relationship_arena
17031                    .items
17032                    .len()
17033            {
17034                return Err(AuthorError::DanglingRef {
17035                    entity: "MECHANICAL_DESIGN_AND_DRAUGHTING_RELATIONSHIP",
17036                });
17037            }
17038        }
17039        ApprovalItemRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
17040            if i.0
17041                >= model
17042                    .mechanical_design_geometric_presentation_representation_arena
17043                    .items
17044                    .len()
17045            {
17046                return Err(AuthorError::DanglingRef {
17047                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
17048                });
17049            }
17050        }
17051        ApprovalItemRef::MechanicalDesignPresentationRepresentationWithDraughting(i) => {
17052            if i.0
17053                >= model
17054                    .mechanical_design_presentation_representation_with_draughting_arena
17055                    .items
17056                    .len()
17057            {
17058                return Err(AuthorError::DanglingRef {
17059                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
17060                });
17061            }
17062        }
17063        ApprovalItemRef::MechanicalDesignShadedPresentationRepresentation(i) => {
17064            if i.0
17065                >= model
17066                    .mechanical_design_shaded_presentation_representation_arena
17067                    .items
17068                    .len()
17069            {
17070                return Err(AuthorError::DanglingRef {
17071                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
17072                });
17073            }
17074        }
17075        ApprovalItemRef::NextAssemblyUsageOccurrence(i) => {
17076            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
17077                return Err(AuthorError::DanglingRef {
17078                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
17079                });
17080            }
17081        }
17082        ApprovalItemRef::OffsetSurface(i) => {
17083            if i.0 >= model.offset_surface_arena.items.len() {
17084                return Err(AuthorError::DanglingRef {
17085                    entity: "OFFSET_SURFACE",
17086                });
17087            }
17088        }
17089        ApprovalItemRef::OneDirectionRepeatFactor(i) => {
17090            if i.0 >= model.one_direction_repeat_factor_arena.items.len() {
17091                return Err(AuthorError::DanglingRef {
17092                    entity: "ONE_DIRECTION_REPEAT_FACTOR",
17093                });
17094            }
17095        }
17096        ApprovalItemRef::OpenShell(i) => {
17097            if i.0 >= model.open_shell_arena.items.len() {
17098                return Err(AuthorError::DanglingRef {
17099                    entity: "OPEN_SHELL",
17100                });
17101            }
17102        }
17103        ApprovalItemRef::Organization(i) => {
17104            if i.0 >= model.organization_arena.items.len() {
17105                return Err(AuthorError::DanglingRef {
17106                    entity: "ORGANIZATION",
17107                });
17108            }
17109        }
17110        ApprovalItemRef::OrganizationRelationship(i) => {
17111            if i.0 >= model.organization_relationship_arena.items.len() {
17112                return Err(AuthorError::DanglingRef {
17113                    entity: "ORGANIZATION_RELATIONSHIP",
17114                });
17115            }
17116        }
17117        ApprovalItemRef::OrganizationalAddress(i) => {
17118            if i.0 >= model.organizational_address_arena.items.len() {
17119                return Err(AuthorError::DanglingRef {
17120                    entity: "ORGANIZATIONAL_ADDRESS",
17121                });
17122            }
17123        }
17124        ApprovalItemRef::OrganizationalProject(i) => {
17125            if i.0 >= model.organizational_project_arena.items.len() {
17126                return Err(AuthorError::DanglingRef {
17127                    entity: "ORGANIZATIONAL_PROJECT",
17128                });
17129            }
17130        }
17131        ApprovalItemRef::OrientedClosedShell(i) => {
17132            if i.0 >= model.oriented_closed_shell_arena.items.len() {
17133                return Err(AuthorError::DanglingRef {
17134                    entity: "ORIENTED_CLOSED_SHELL",
17135                });
17136            }
17137        }
17138        ApprovalItemRef::OrientedEdge(i) => {
17139            if i.0 >= model.oriented_edge_arena.items.len() {
17140                return Err(AuthorError::DanglingRef {
17141                    entity: "ORIENTED_EDGE",
17142                });
17143            }
17144        }
17145        ApprovalItemRef::OverRidingStyledItem(i) => {
17146            if i.0 >= model.over_riding_styled_item_arena.items.len() {
17147                return Err(AuthorError::DanglingRef {
17148                    entity: "OVER_RIDING_STYLED_ITEM",
17149                });
17150            }
17151        }
17152        ApprovalItemRef::Path(i) => {
17153            if i.0 >= model.path_arena.items.len() {
17154                return Err(AuthorError::DanglingRef { entity: "PATH" });
17155            }
17156        }
17157        ApprovalItemRef::Pcurve(i) => {
17158            if i.0 >= model.pcurve_arena.items.len() {
17159                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
17160            }
17161        }
17162        ApprovalItemRef::PersonAndOrganization(i) => {
17163            if i.0 >= model.person_and_organization_arena.items.len() {
17164                return Err(AuthorError::DanglingRef {
17165                    entity: "PERSON_AND_ORGANIZATION",
17166                });
17167            }
17168        }
17169        ApprovalItemRef::PersonAndOrganizationAddress(i) => {
17170            if i.0 >= model.person_and_organization_address_arena.items.len() {
17171                return Err(AuthorError::DanglingRef {
17172                    entity: "PERSON_AND_ORGANIZATION_ADDRESS",
17173                });
17174            }
17175        }
17176        ApprovalItemRef::Placement(i) => {
17177            if i.0 >= model.placement_arena.items.len() {
17178                return Err(AuthorError::DanglingRef {
17179                    entity: "PLACEMENT",
17180                });
17181            }
17182        }
17183        ApprovalItemRef::PlanarBox(i) => {
17184            if i.0 >= model.planar_box_arena.items.len() {
17185                return Err(AuthorError::DanglingRef {
17186                    entity: "PLANAR_BOX",
17187                });
17188            }
17189        }
17190        ApprovalItemRef::PlanarExtent(i) => {
17191            if i.0 >= model.planar_extent_arena.items.len() {
17192                return Err(AuthorError::DanglingRef {
17193                    entity: "PLANAR_EXTENT",
17194                });
17195            }
17196        }
17197        ApprovalItemRef::Plane(i) => {
17198            if i.0 >= model.plane_arena.items.len() {
17199                return Err(AuthorError::DanglingRef { entity: "PLANE" });
17200            }
17201        }
17202        ApprovalItemRef::Point(i) => {
17203            if i.0 >= model.point_arena.items.len() {
17204                return Err(AuthorError::DanglingRef { entity: "POINT" });
17205            }
17206        }
17207        ApprovalItemRef::PolyLoop(i) => {
17208            if i.0 >= model.poly_loop_arena.items.len() {
17209                return Err(AuthorError::DanglingRef {
17210                    entity: "POLY_LOOP",
17211                });
17212            }
17213        }
17214        ApprovalItemRef::Polyline(i) => {
17215            if i.0 >= model.polyline_arena.items.len() {
17216                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
17217            }
17218        }
17219        ApprovalItemRef::PresentationArea(i) => {
17220            if i.0 >= model.presentation_area_arena.items.len() {
17221                return Err(AuthorError::DanglingRef {
17222                    entity: "PRESENTATION_AREA",
17223                });
17224            }
17225        }
17226        ApprovalItemRef::PresentationRepresentation(i) => {
17227            if i.0 >= model.presentation_representation_arena.items.len() {
17228                return Err(AuthorError::DanglingRef {
17229                    entity: "PRESENTATION_REPRESENTATION",
17230                });
17231            }
17232        }
17233        ApprovalItemRef::PresentationView(i) => {
17234            if i.0 >= model.presentation_view_arena.items.len() {
17235                return Err(AuthorError::DanglingRef {
17236                    entity: "PRESENTATION_VIEW",
17237                });
17238            }
17239        }
17240        ApprovalItemRef::Product(i) => {
17241            if i.0 >= model.product_arena.items.len() {
17242                return Err(AuthorError::DanglingRef { entity: "PRODUCT" });
17243            }
17244        }
17245        ApprovalItemRef::ProductConcept(i) => {
17246            if i.0 >= model.product_concept_arena.items.len() {
17247                return Err(AuthorError::DanglingRef {
17248                    entity: "PRODUCT_CONCEPT",
17249                });
17250            }
17251        }
17252        ApprovalItemRef::ProductConceptFeature(i) => {
17253            if i.0 >= model.product_concept_feature_arena.items.len() {
17254                return Err(AuthorError::DanglingRef {
17255                    entity: "PRODUCT_CONCEPT_FEATURE",
17256                });
17257            }
17258        }
17259        ApprovalItemRef::ProductConceptFeatureCategory(i) => {
17260            if i.0 >= model.product_concept_feature_category_arena.items.len() {
17261                return Err(AuthorError::DanglingRef {
17262                    entity: "PRODUCT_CONCEPT_FEATURE_CATEGORY",
17263                });
17264            }
17265        }
17266        ApprovalItemRef::ProductDefinition(i) => {
17267            if i.0 >= model.product_definition_arena.items.len() {
17268                return Err(AuthorError::DanglingRef {
17269                    entity: "PRODUCT_DEFINITION",
17270                });
17271            }
17272        }
17273        ApprovalItemRef::ProductDefinitionContext(i) => {
17274            if i.0 >= model.product_definition_context_arena.items.len() {
17275                return Err(AuthorError::DanglingRef {
17276                    entity: "PRODUCT_DEFINITION_CONTEXT",
17277                });
17278            }
17279        }
17280        ApprovalItemRef::ProductDefinitionEffectivity(i) => {
17281            if i.0 >= model.product_definition_effectivity_arena.items.len() {
17282                return Err(AuthorError::DanglingRef {
17283                    entity: "PRODUCT_DEFINITION_EFFECTIVITY",
17284                });
17285            }
17286        }
17287        ApprovalItemRef::ProductDefinitionFormation(i) => {
17288            if i.0 >= model.product_definition_formation_arena.items.len() {
17289                return Err(AuthorError::DanglingRef {
17290                    entity: "PRODUCT_DEFINITION_FORMATION",
17291                });
17292            }
17293        }
17294        ApprovalItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
17295            if i.0
17296                >= model
17297                    .product_definition_formation_with_specified_source_arena
17298                    .items
17299                    .len()
17300            {
17301                return Err(AuthorError::DanglingRef {
17302                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
17303                });
17304            }
17305        }
17306        ApprovalItemRef::ProductDefinitionRelationship(i) => {
17307            if i.0 >= model.product_definition_relationship_arena.items.len() {
17308                return Err(AuthorError::DanglingRef {
17309                    entity: "PRODUCT_DEFINITION_RELATIONSHIP",
17310                });
17311            }
17312        }
17313        ApprovalItemRef::ProductDefinitionShape(i) => {
17314            if i.0 >= model.product_definition_shape_arena.items.len() {
17315                return Err(AuthorError::DanglingRef {
17316                    entity: "PRODUCT_DEFINITION_SHAPE",
17317                });
17318            }
17319        }
17320        ApprovalItemRef::ProductDefinitionSubstitute(i) => {
17321            if i.0 >= model.product_definition_substitute_arena.items.len() {
17322                return Err(AuthorError::DanglingRef {
17323                    entity: "PRODUCT_DEFINITION_SUBSTITUTE",
17324                });
17325            }
17326        }
17327        ApprovalItemRef::ProductDefinitionUsage(i) => {
17328            if i.0 >= model.product_definition_usage_arena.items.len() {
17329                return Err(AuthorError::DanglingRef {
17330                    entity: "PRODUCT_DEFINITION_USAGE",
17331                });
17332            }
17333        }
17334        ApprovalItemRef::ProductDefinitionWithAssociatedDocuments(i) => {
17335            if i.0
17336                >= model
17337                    .product_definition_with_associated_documents_arena
17338                    .items
17339                    .len()
17340            {
17341                return Err(AuthorError::DanglingRef {
17342                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
17343                });
17344            }
17345        }
17346        ApprovalItemRef::PropertyDefinition(i) => {
17347            if i.0 >= model.property_definition_arena.items.len() {
17348                return Err(AuthorError::DanglingRef {
17349                    entity: "PROPERTY_DEFINITION",
17350                });
17351            }
17352        }
17353        ApprovalItemRef::PropertyDefinitionRepresentation(i) => {
17354            if i.0 >= model.property_definition_representation_arena.items.len() {
17355                return Err(AuthorError::DanglingRef {
17356                    entity: "PROPERTY_DEFINITION_REPRESENTATION",
17357                });
17358            }
17359        }
17360        ApprovalItemRef::QualifiedRepresentationItem(i) => {
17361            if i.0 >= model.qualified_representation_item_arena.items.len() {
17362                return Err(AuthorError::DanglingRef {
17363                    entity: "QUALIFIED_REPRESENTATION_ITEM",
17364                });
17365            }
17366        }
17367        ApprovalItemRef::QuasiUniformCurve(i) => {
17368            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
17369                return Err(AuthorError::DanglingRef {
17370                    entity: "QUASI_UNIFORM_CURVE",
17371                });
17372            }
17373        }
17374        ApprovalItemRef::QuasiUniformSurface(i) => {
17375            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
17376                return Err(AuthorError::DanglingRef {
17377                    entity: "QUASI_UNIFORM_SURFACE",
17378                });
17379            }
17380        }
17381        ApprovalItemRef::RationalBSplineCurve(i) => {
17382            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
17383                return Err(AuthorError::DanglingRef {
17384                    entity: "RATIONAL_B_SPLINE_CURVE",
17385                });
17386            }
17387        }
17388        ApprovalItemRef::RationalBSplineSurface(i) => {
17389            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
17390                return Err(AuthorError::DanglingRef {
17391                    entity: "RATIONAL_B_SPLINE_SURFACE",
17392                });
17393            }
17394        }
17395        ApprovalItemRef::RealRepresentationItem(i) => {
17396            if i.0 >= model.real_representation_item_arena.items.len() {
17397                return Err(AuthorError::DanglingRef {
17398                    entity: "REAL_REPRESENTATION_ITEM",
17399                });
17400            }
17401        }
17402        ApprovalItemRef::RepositionedTessellatedItem(i) => {
17403            if i.0 >= model.repositioned_tessellated_item_arena.items.len() {
17404                return Err(AuthorError::DanglingRef {
17405                    entity: "REPOSITIONED_TESSELLATED_ITEM",
17406                });
17407            }
17408        }
17409        ApprovalItemRef::Representation(i) => {
17410            if i.0 >= model.representation_arena.items.len() {
17411                return Err(AuthorError::DanglingRef {
17412                    entity: "REPRESENTATION",
17413                });
17414            }
17415        }
17416        ApprovalItemRef::RepresentationItem(i) => {
17417            if i.0 >= model.representation_item_arena.items.len() {
17418                return Err(AuthorError::DanglingRef {
17419                    entity: "REPRESENTATION_ITEM",
17420                });
17421            }
17422        }
17423        ApprovalItemRef::RepresentationRelationship(i) => {
17424            if i.0 >= model.representation_relationship_arena.items.len() {
17425                return Err(AuthorError::DanglingRef {
17426                    entity: "REPRESENTATION_RELATIONSHIP",
17427                });
17428            }
17429        }
17430        ApprovalItemRef::RepresentationRelationshipWithTransformation(i) => {
17431            if i.0
17432                >= model
17433                    .representation_relationship_with_transformation_arena
17434                    .items
17435                    .len()
17436            {
17437                return Err(AuthorError::DanglingRef {
17438                    entity: "REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION",
17439                });
17440            }
17441        }
17442        ApprovalItemRef::ResourceProperty(i) => {
17443            if i.0 >= model.resource_property_arena.items.len() {
17444                return Err(AuthorError::DanglingRef {
17445                    entity: "RESOURCE_PROPERTY",
17446                });
17447            }
17448        }
17449        ApprovalItemRef::SeamCurve(i) => {
17450            if i.0 >= model.seam_curve_arena.items.len() {
17451                return Err(AuthorError::DanglingRef {
17452                    entity: "SEAM_CURVE",
17453                });
17454            }
17455        }
17456        ApprovalItemRef::SecurityClassification(i) => {
17457            if i.0 >= model.security_classification_arena.items.len() {
17458                return Err(AuthorError::DanglingRef {
17459                    entity: "SECURITY_CLASSIFICATION",
17460                });
17461            }
17462        }
17463        ApprovalItemRef::ShapeAspectAssociativity(i) => {
17464            if i.0 >= model.shape_aspect_associativity_arena.items.len() {
17465                return Err(AuthorError::DanglingRef {
17466                    entity: "SHAPE_ASPECT_ASSOCIATIVITY",
17467                });
17468            }
17469        }
17470        ApprovalItemRef::ShapeAspectDerivingRelationship(i) => {
17471            if i.0 >= model.shape_aspect_deriving_relationship_arena.items.len() {
17472                return Err(AuthorError::DanglingRef {
17473                    entity: "SHAPE_ASPECT_DERIVING_RELATIONSHIP",
17474                });
17475            }
17476        }
17477        ApprovalItemRef::ShapeAspectRelationship(i) => {
17478            if i.0 >= model.shape_aspect_relationship_arena.items.len() {
17479                return Err(AuthorError::DanglingRef {
17480                    entity: "SHAPE_ASPECT_RELATIONSHIP",
17481                });
17482            }
17483        }
17484        ApprovalItemRef::ShapeDefinitionRepresentation(i) => {
17485            if i.0 >= model.shape_definition_representation_arena.items.len() {
17486                return Err(AuthorError::DanglingRef {
17487                    entity: "SHAPE_DEFINITION_REPRESENTATION",
17488                });
17489            }
17490        }
17491        ApprovalItemRef::ShapeDimensionRepresentation(i) => {
17492            if i.0 >= model.shape_dimension_representation_arena.items.len() {
17493                return Err(AuthorError::DanglingRef {
17494                    entity: "SHAPE_DIMENSION_REPRESENTATION",
17495                });
17496            }
17497        }
17498        ApprovalItemRef::ShapeRepresentation(i) => {
17499            if i.0 >= model.shape_representation_arena.items.len() {
17500                return Err(AuthorError::DanglingRef {
17501                    entity: "SHAPE_REPRESENTATION",
17502                });
17503            }
17504        }
17505        ApprovalItemRef::ShapeRepresentationRelationship(i) => {
17506            if i.0 >= model.shape_representation_relationship_arena.items.len() {
17507                return Err(AuthorError::DanglingRef {
17508                    entity: "SHAPE_REPRESENTATION_RELATIONSHIP",
17509                });
17510            }
17511        }
17512        ApprovalItemRef::ShapeRepresentationWithParameters(i) => {
17513            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
17514                return Err(AuthorError::DanglingRef {
17515                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
17516                });
17517            }
17518        }
17519        ApprovalItemRef::ShellBasedSurfaceModel(i) => {
17520            if i.0 >= model.shell_based_surface_model_arena.items.len() {
17521                return Err(AuthorError::DanglingRef {
17522                    entity: "SHELL_BASED_SURFACE_MODEL",
17523                });
17524            }
17525        }
17526        ApprovalItemRef::SolidModel(i) => {
17527            if i.0 >= model.solid_model_arena.items.len() {
17528                return Err(AuthorError::DanglingRef {
17529                    entity: "SOLID_MODEL",
17530                });
17531            }
17532        }
17533        ApprovalItemRef::SphericalSurface(i) => {
17534            if i.0 >= model.spherical_surface_arena.items.len() {
17535                return Err(AuthorError::DanglingRef {
17536                    entity: "SPHERICAL_SURFACE",
17537                });
17538            }
17539        }
17540        ApprovalItemRef::StyledItem(i) => {
17541            if i.0 >= model.styled_item_arena.items.len() {
17542                return Err(AuthorError::DanglingRef {
17543                    entity: "STYLED_ITEM",
17544                });
17545            }
17546        }
17547        ApprovalItemRef::Surface(i) => {
17548            if i.0 >= model.surface_arena.items.len() {
17549                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
17550            }
17551        }
17552        ApprovalItemRef::SurfaceCurve(i) => {
17553            if i.0 >= model.surface_curve_arena.items.len() {
17554                return Err(AuthorError::DanglingRef {
17555                    entity: "SURFACE_CURVE",
17556                });
17557            }
17558        }
17559        ApprovalItemRef::SurfaceOfLinearExtrusion(i) => {
17560            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
17561                return Err(AuthorError::DanglingRef {
17562                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
17563                });
17564            }
17565        }
17566        ApprovalItemRef::SurfaceOfRevolution(i) => {
17567            if i.0 >= model.surface_of_revolution_arena.items.len() {
17568                return Err(AuthorError::DanglingRef {
17569                    entity: "SURFACE_OF_REVOLUTION",
17570                });
17571            }
17572        }
17573        ApprovalItemRef::SweptSurface(i) => {
17574            if i.0 >= model.swept_surface_arena.items.len() {
17575                return Err(AuthorError::DanglingRef {
17576                    entity: "SWEPT_SURFACE",
17577                });
17578            }
17579        }
17580        ApprovalItemRef::SymbolRepresentation(i) => {
17581            if i.0 >= model.symbol_representation_arena.items.len() {
17582                return Err(AuthorError::DanglingRef {
17583                    entity: "SYMBOL_REPRESENTATION",
17584                });
17585            }
17586        }
17587        ApprovalItemRef::SymbolTarget(i) => {
17588            if i.0 >= model.symbol_target_arena.items.len() {
17589                return Err(AuthorError::DanglingRef {
17590                    entity: "SYMBOL_TARGET",
17591                });
17592            }
17593        }
17594        ApprovalItemRef::TerminatorSymbol(i) => {
17595            if i.0 >= model.terminator_symbol_arena.items.len() {
17596                return Err(AuthorError::DanglingRef {
17597                    entity: "TERMINATOR_SYMBOL",
17598                });
17599            }
17600        }
17601        ApprovalItemRef::TessellatedAnnotationOccurrence(i) => {
17602            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
17603                return Err(AuthorError::DanglingRef {
17604                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
17605                });
17606            }
17607        }
17608        ApprovalItemRef::TessellatedCurveSet(i) => {
17609            if i.0 >= model.tessellated_curve_set_arena.items.len() {
17610                return Err(AuthorError::DanglingRef {
17611                    entity: "TESSELLATED_CURVE_SET",
17612                });
17613            }
17614        }
17615        ApprovalItemRef::TessellatedFace(i) => {
17616            if i.0 >= model.tessellated_face_arena.items.len() {
17617                return Err(AuthorError::DanglingRef {
17618                    entity: "TESSELLATED_FACE",
17619                });
17620            }
17621        }
17622        ApprovalItemRef::TessellatedGeometricSet(i) => {
17623            if i.0 >= model.tessellated_geometric_set_arena.items.len() {
17624                return Err(AuthorError::DanglingRef {
17625                    entity: "TESSELLATED_GEOMETRIC_SET",
17626                });
17627            }
17628        }
17629        ApprovalItemRef::TessellatedItem(i) => {
17630            if i.0 >= model.tessellated_item_arena.items.len() {
17631                return Err(AuthorError::DanglingRef {
17632                    entity: "TESSELLATED_ITEM",
17633                });
17634            }
17635        }
17636        ApprovalItemRef::TessellatedShapeRepresentation(i) => {
17637            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
17638                return Err(AuthorError::DanglingRef {
17639                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
17640                });
17641            }
17642        }
17643        ApprovalItemRef::TessellatedShell(i) => {
17644            if i.0 >= model.tessellated_shell_arena.items.len() {
17645                return Err(AuthorError::DanglingRef {
17646                    entity: "TESSELLATED_SHELL",
17647                });
17648            }
17649        }
17650        ApprovalItemRef::TessellatedSolid(i) => {
17651            if i.0 >= model.tessellated_solid_arena.items.len() {
17652                return Err(AuthorError::DanglingRef {
17653                    entity: "TESSELLATED_SOLID",
17654                });
17655            }
17656        }
17657        ApprovalItemRef::TessellatedStructuredItem(i) => {
17658            if i.0 >= model.tessellated_structured_item_arena.items.len() {
17659                return Err(AuthorError::DanglingRef {
17660                    entity: "TESSELLATED_STRUCTURED_ITEM",
17661                });
17662            }
17663        }
17664        ApprovalItemRef::TessellatedSurfaceSet(i) => {
17665            if i.0 >= model.tessellated_surface_set_arena.items.len() {
17666                return Err(AuthorError::DanglingRef {
17667                    entity: "TESSELLATED_SURFACE_SET",
17668                });
17669            }
17670        }
17671        ApprovalItemRef::TextLiteral(i) => {
17672            if i.0 >= model.text_literal_arena.items.len() {
17673                return Err(AuthorError::DanglingRef {
17674                    entity: "TEXT_LITERAL",
17675                });
17676            }
17677        }
17678        ApprovalItemRef::TopologicalRepresentationItem(i) => {
17679            if i.0 >= model.topological_representation_item_arena.items.len() {
17680                return Err(AuthorError::DanglingRef {
17681                    entity: "TOPOLOGICAL_REPRESENTATION_ITEM",
17682                });
17683            }
17684        }
17685        ApprovalItemRef::ToroidalSurface(i) => {
17686            if i.0 >= model.toroidal_surface_arena.items.len() {
17687                return Err(AuthorError::DanglingRef {
17688                    entity: "TOROIDAL_SURFACE",
17689                });
17690            }
17691        }
17692        ApprovalItemRef::TrimmedCurve(i) => {
17693            if i.0 >= model.trimmed_curve_arena.items.len() {
17694                return Err(AuthorError::DanglingRef {
17695                    entity: "TRIMMED_CURVE",
17696                });
17697            }
17698        }
17699        ApprovalItemRef::TwoDirectionRepeatFactor(i) => {
17700            if i.0 >= model.two_direction_repeat_factor_arena.items.len() {
17701                return Err(AuthorError::DanglingRef {
17702                    entity: "TWO_DIRECTION_REPEAT_FACTOR",
17703                });
17704            }
17705        }
17706        ApprovalItemRef::UniformCurve(i) => {
17707            if i.0 >= model.uniform_curve_arena.items.len() {
17708                return Err(AuthorError::DanglingRef {
17709                    entity: "UNIFORM_CURVE",
17710                });
17711            }
17712        }
17713        ApprovalItemRef::UniformSurface(i) => {
17714            if i.0 >= model.uniform_surface_arena.items.len() {
17715                return Err(AuthorError::DanglingRef {
17716                    entity: "UNIFORM_SURFACE",
17717                });
17718            }
17719        }
17720        ApprovalItemRef::ValueRepresentationItem(i) => {
17721            if i.0 >= model.value_representation_item_arena.items.len() {
17722                return Err(AuthorError::DanglingRef {
17723                    entity: "VALUE_REPRESENTATION_ITEM",
17724                });
17725            }
17726        }
17727        ApprovalItemRef::Vector(i) => {
17728            if i.0 >= model.vector_arena.items.len() {
17729                return Err(AuthorError::DanglingRef { entity: "VECTOR" });
17730            }
17731        }
17732        ApprovalItemRef::VersionedActionRequest(i) => {
17733            if i.0 >= model.versioned_action_request_arena.items.len() {
17734                return Err(AuthorError::DanglingRef {
17735                    entity: "VERSIONED_ACTION_REQUEST",
17736                });
17737            }
17738        }
17739        ApprovalItemRef::Vertex(i) => {
17740            if i.0 >= model.vertex_arena.items.len() {
17741                return Err(AuthorError::DanglingRef { entity: "VERTEX" });
17742            }
17743        }
17744        ApprovalItemRef::VertexLoop(i) => {
17745            if i.0 >= model.vertex_loop_arena.items.len() {
17746                return Err(AuthorError::DanglingRef {
17747                    entity: "VERTEX_LOOP",
17748                });
17749            }
17750        }
17751        ApprovalItemRef::VertexPoint(i) => {
17752            if i.0 >= model.vertex_point_arena.items.len() {
17753                return Err(AuthorError::DanglingRef {
17754                    entity: "VERTEX_POINT",
17755                });
17756            }
17757        }
17758        ApprovalItemRef::VertexShell(i) => {
17759            if i.0 >= model.vertex_shell_arena.items.len() {
17760                return Err(AuthorError::DanglingRef {
17761                    entity: "VERTEX_SHELL",
17762                });
17763            }
17764        }
17765        ApprovalItemRef::WireShell(i) => {
17766            if i.0 >= model.wire_shell_arena.items.len() {
17767                return Err(AuthorError::DanglingRef {
17768                    entity: "WIRE_SHELL",
17769                });
17770            }
17771        }
17772        ApprovalItemRef::Complex(i) => {
17773            if i.0 >= model.complex_unit_arena.items.len() {
17774                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
17775            }
17776        }
17777    }
17778    Ok(())
17779}
17780fn check_approval_role_ref(model: &StepModel, r: &ApprovalRoleRef) -> Result<(), AuthorError> {
17781    match r {
17782        ApprovalRoleRef::ApprovalRole(i) => {
17783            if i.0 >= model.approval_role_arena.items.len() {
17784                return Err(AuthorError::DanglingRef {
17785                    entity: "APPROVAL_ROLE",
17786                });
17787            }
17788        }
17789    }
17790    Ok(())
17791}
17792fn check_approval_status_ref(model: &StepModel, r: &ApprovalStatusRef) -> Result<(), AuthorError> {
17793    match r {
17794        ApprovalStatusRef::ApprovalStatus(i) => {
17795            if i.0 >= model.approval_status_arena.items.len() {
17796                return Err(AuthorError::DanglingRef {
17797                    entity: "APPROVAL_STATUS",
17798                });
17799            }
17800        }
17801    }
17802    Ok(())
17803}
17804fn check_approved_item_ref(model: &StepModel, r: &ApprovedItemRef) -> Result<(), AuthorError> {
17805    match r {
17806        ApprovedItemRef::Certification(i) => {
17807            if i.0 >= model.certification_arena.items.len() {
17808                return Err(AuthorError::DanglingRef {
17809                    entity: "CERTIFICATION",
17810                });
17811            }
17812        }
17813        ApprovedItemRef::Change(i) => {
17814            if i.0 >= model.change_arena.items.len() {
17815                return Err(AuthorError::DanglingRef { entity: "CHANGE" });
17816            }
17817        }
17818        ApprovedItemRef::ChangeRequest(i) => {
17819            if i.0 >= model.change_request_arena.items.len() {
17820                return Err(AuthorError::DanglingRef {
17821                    entity: "CHANGE_REQUEST",
17822                });
17823            }
17824        }
17825        ApprovedItemRef::ConfigurationEffectivity(i) => {
17826            if i.0 >= model.configuration_effectivity_arena.items.len() {
17827                return Err(AuthorError::DanglingRef {
17828                    entity: "CONFIGURATION_EFFECTIVITY",
17829                });
17830            }
17831        }
17832        ApprovedItemRef::ConfigurationItem(i) => {
17833            if i.0 >= model.configuration_item_arena.items.len() {
17834                return Err(AuthorError::DanglingRef {
17835                    entity: "CONFIGURATION_ITEM",
17836                });
17837            }
17838        }
17839        ApprovedItemRef::Contract(i) => {
17840            if i.0 >= model.contract_arena.items.len() {
17841                return Err(AuthorError::DanglingRef { entity: "CONTRACT" });
17842            }
17843        }
17844        ApprovedItemRef::Product(i) => {
17845            if i.0 >= model.product_arena.items.len() {
17846                return Err(AuthorError::DanglingRef { entity: "PRODUCT" });
17847            }
17848        }
17849        ApprovedItemRef::ProductDefinition(i) => {
17850            if i.0 >= model.product_definition_arena.items.len() {
17851                return Err(AuthorError::DanglingRef {
17852                    entity: "PRODUCT_DEFINITION",
17853                });
17854            }
17855        }
17856        ApprovedItemRef::ProductDefinitionFormation(i) => {
17857            if i.0 >= model.product_definition_formation_arena.items.len() {
17858                return Err(AuthorError::DanglingRef {
17859                    entity: "PRODUCT_DEFINITION_FORMATION",
17860                });
17861            }
17862        }
17863        ApprovedItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
17864            if i.0
17865                >= model
17866                    .product_definition_formation_with_specified_source_arena
17867                    .items
17868                    .len()
17869            {
17870                return Err(AuthorError::DanglingRef {
17871                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
17872                });
17873            }
17874        }
17875        ApprovedItemRef::ProductDefinitionWithAssociatedDocuments(i) => {
17876            if i.0
17877                >= model
17878                    .product_definition_with_associated_documents_arena
17879                    .items
17880                    .len()
17881            {
17882                return Err(AuthorError::DanglingRef {
17883                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
17884                });
17885            }
17886        }
17887        ApprovedItemRef::SecurityClassification(i) => {
17888            if i.0 >= model.security_classification_arena.items.len() {
17889                return Err(AuthorError::DanglingRef {
17890                    entity: "SECURITY_CLASSIFICATION",
17891                });
17892            }
17893        }
17894        ApprovedItemRef::StartRequest(i) => {
17895            if i.0 >= model.start_request_arena.items.len() {
17896                return Err(AuthorError::DanglingRef {
17897                    entity: "START_REQUEST",
17898                });
17899            }
17900        }
17901        ApprovedItemRef::StartWork(i) => {
17902            if i.0 >= model.start_work_arena.items.len() {
17903                return Err(AuthorError::DanglingRef {
17904                    entity: "START_WORK",
17905                });
17906            }
17907        }
17908        ApprovedItemRef::Complex(i) => {
17909            if i.0 >= model.complex_unit_arena.items.len() {
17910                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
17911            }
17912        }
17913    }
17914    Ok(())
17915}
17916fn check_ascribable_state_ref(
17917    model: &StepModel,
17918    r: &AscribableStateRef,
17919) -> Result<(), AuthorError> {
17920    match r {
17921        AscribableStateRef::AscribableState(i) => {
17922            if i.0 >= model.ascribable_state_arena.items.len() {
17923                return Err(AuthorError::DanglingRef {
17924                    entity: "ASCRIBABLE_STATE",
17925                });
17926            }
17927        }
17928    }
17929    Ok(())
17930}
17931fn check_axis1_placement_ref(model: &StepModel, r: &Axis1PlacementRef) -> Result<(), AuthorError> {
17932    match r {
17933        Axis1PlacementRef::Axis1Placement(i) => {
17934            if i.0 >= model.axis1_placement_arena.items.len() {
17935                return Err(AuthorError::DanglingRef {
17936                    entity: "AXIS1_PLACEMENT",
17937                });
17938            }
17939        }
17940    }
17941    Ok(())
17942}
17943fn check_axis2_placement_ref(model: &StepModel, r: &Axis2PlacementRef) -> Result<(), AuthorError> {
17944    match r {
17945        Axis2PlacementRef::Axis2Placement2d(i) => {
17946            if i.0 >= model.axis2_placement2d_arena.items.len() {
17947                return Err(AuthorError::DanglingRef {
17948                    entity: "AXIS2_PLACEMENT_2D",
17949                });
17950            }
17951        }
17952        Axis2PlacementRef::Axis2Placement3d(i) => {
17953            if i.0 >= model.axis2_placement3d_arena.items.len() {
17954                return Err(AuthorError::DanglingRef {
17955                    entity: "AXIS2_PLACEMENT_3D",
17956                });
17957            }
17958        }
17959    }
17960    Ok(())
17961}
17962fn check_axis2_placement3d_ref(
17963    model: &StepModel,
17964    r: &Axis2Placement3dRef,
17965) -> Result<(), AuthorError> {
17966    match r {
17967        Axis2Placement3dRef::Axis2Placement3d(i) => {
17968            if i.0 >= model.axis2_placement3d_arena.items.len() {
17969                return Err(AuthorError::DanglingRef {
17970                    entity: "AXIS2_PLACEMENT_3D",
17971                });
17972            }
17973        }
17974    }
17975    Ok(())
17976}
17977fn check_camera_model_d3_multi_clipping_intersection_select_ref(
17978    model: &StepModel,
17979    r: &CameraModelD3MultiClippingIntersectionSelectRef,
17980) -> Result<(), AuthorError> {
17981    match r {
17982        CameraModelD3MultiClippingIntersectionSelectRef::Plane(i) => {
17983            if i.0 >= model.plane_arena.items.len() {
17984                return Err(AuthorError::DanglingRef { entity: "PLANE" });
17985            }
17986        }
17987    }
17988    Ok(())
17989}
17990fn check_cartesian_point_ref(model: &StepModel, r: &CartesianPointRef) -> Result<(), AuthorError> {
17991    match r {
17992        CartesianPointRef::ApllPoint(_) => {
17993            return Err(AuthorError::NotAp242 {
17994                entity: "APLL_POINT",
17995            });
17996        }
17997        CartesianPointRef::ApllPointWithSurface(_) => {
17998            return Err(AuthorError::NotAp242 {
17999                entity: "APLL_POINT_WITH_SURFACE",
18000            });
18001        }
18002        CartesianPointRef::CartesianPoint(i) => {
18003            if i.0 >= model.cartesian_point_arena.items.len() {
18004                return Err(AuthorError::DanglingRef {
18005                    entity: "CARTESIAN_POINT",
18006                });
18007            }
18008        }
18009    }
18010    Ok(())
18011}
18012fn check_cc_classified_item_ref(
18013    model: &StepModel,
18014    r: &CcClassifiedItemRef,
18015) -> Result<(), AuthorError> {
18016    match r {
18017        CcClassifiedItemRef::AssemblyComponentUsage(i) => {
18018            if i.0 >= model.assembly_component_usage_arena.items.len() {
18019                return Err(AuthorError::DanglingRef {
18020                    entity: "ASSEMBLY_COMPONENT_USAGE",
18021                });
18022            }
18023        }
18024        CcClassifiedItemRef::NextAssemblyUsageOccurrence(i) => {
18025            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
18026                return Err(AuthorError::DanglingRef {
18027                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
18028                });
18029            }
18030        }
18031        CcClassifiedItemRef::ProductDefinitionFormation(i) => {
18032            if i.0 >= model.product_definition_formation_arena.items.len() {
18033                return Err(AuthorError::DanglingRef {
18034                    entity: "PRODUCT_DEFINITION_FORMATION",
18035                });
18036            }
18037        }
18038        CcClassifiedItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
18039            if i.0
18040                >= model
18041                    .product_definition_formation_with_specified_source_arena
18042                    .items
18043                    .len()
18044            {
18045                return Err(AuthorError::DanglingRef {
18046                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
18047                });
18048            }
18049        }
18050        CcClassifiedItemRef::Complex(i) => {
18051            if i.0 >= model.complex_unit_arena.items.len() {
18052                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
18053            }
18054        }
18055    }
18056    Ok(())
18057}
18058fn check_cc_person_organization_item_ref(
18059    model: &StepModel,
18060    r: &CcPersonOrganizationItemRef,
18061) -> Result<(), AuthorError> {
18062    match r {
18063        CcPersonOrganizationItemRef::Change(i) => {
18064            if i.0 >= model.change_arena.items.len() {
18065                return Err(AuthorError::DanglingRef { entity: "CHANGE" });
18066            }
18067        }
18068        CcPersonOrganizationItemRef::ChangeRequest(i) => {
18069            if i.0 >= model.change_request_arena.items.len() {
18070                return Err(AuthorError::DanglingRef {
18071                    entity: "CHANGE_REQUEST",
18072                });
18073            }
18074        }
18075        CcPersonOrganizationItemRef::ConfigurationItem(i) => {
18076            if i.0 >= model.configuration_item_arena.items.len() {
18077                return Err(AuthorError::DanglingRef {
18078                    entity: "CONFIGURATION_ITEM",
18079                });
18080            }
18081        }
18082        CcPersonOrganizationItemRef::Contract(i) => {
18083            if i.0 >= model.contract_arena.items.len() {
18084                return Err(AuthorError::DanglingRef { entity: "CONTRACT" });
18085            }
18086        }
18087        CcPersonOrganizationItemRef::Product(i) => {
18088            if i.0 >= model.product_arena.items.len() {
18089                return Err(AuthorError::DanglingRef { entity: "PRODUCT" });
18090            }
18091        }
18092        CcPersonOrganizationItemRef::ProductDefinition(i) => {
18093            if i.0 >= model.product_definition_arena.items.len() {
18094                return Err(AuthorError::DanglingRef {
18095                    entity: "PRODUCT_DEFINITION",
18096                });
18097            }
18098        }
18099        CcPersonOrganizationItemRef::ProductDefinitionFormation(i) => {
18100            if i.0 >= model.product_definition_formation_arena.items.len() {
18101                return Err(AuthorError::DanglingRef {
18102                    entity: "PRODUCT_DEFINITION_FORMATION",
18103                });
18104            }
18105        }
18106        CcPersonOrganizationItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
18107            if i.0
18108                >= model
18109                    .product_definition_formation_with_specified_source_arena
18110                    .items
18111                    .len()
18112            {
18113                return Err(AuthorError::DanglingRef {
18114                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
18115                });
18116            }
18117        }
18118        CcPersonOrganizationItemRef::ProductDefinitionWithAssociatedDocuments(i) => {
18119            if i.0
18120                >= model
18121                    .product_definition_with_associated_documents_arena
18122                    .items
18123                    .len()
18124            {
18125                return Err(AuthorError::DanglingRef {
18126                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
18127                });
18128            }
18129        }
18130        CcPersonOrganizationItemRef::SecurityClassification(i) => {
18131            if i.0 >= model.security_classification_arena.items.len() {
18132                return Err(AuthorError::DanglingRef {
18133                    entity: "SECURITY_CLASSIFICATION",
18134                });
18135            }
18136        }
18137        CcPersonOrganizationItemRef::StartRequest(i) => {
18138            if i.0 >= model.start_request_arena.items.len() {
18139                return Err(AuthorError::DanglingRef {
18140                    entity: "START_REQUEST",
18141                });
18142            }
18143        }
18144        CcPersonOrganizationItemRef::StartWork(i) => {
18145            if i.0 >= model.start_work_arena.items.len() {
18146                return Err(AuthorError::DanglingRef {
18147                    entity: "START_WORK",
18148                });
18149            }
18150        }
18151        CcPersonOrganizationItemRef::Complex(i) => {
18152            if i.0 >= model.complex_unit_arena.items.len() {
18153                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
18154            }
18155        }
18156    }
18157    Ok(())
18158}
18159fn check_certification_type_ref(
18160    model: &StepModel,
18161    r: &CertificationTypeRef,
18162) -> Result<(), AuthorError> {
18163    match r {
18164        CertificationTypeRef::CertificationType(i) => {
18165            if i.0 >= model.certification_type_arena.items.len() {
18166                return Err(AuthorError::DanglingRef {
18167                    entity: "CERTIFICATION_TYPE",
18168                });
18169            }
18170        }
18171    }
18172    Ok(())
18173}
18174fn check_change_request_item_ref(
18175    model: &StepModel,
18176    r: &ChangeRequestItemRef,
18177) -> Result<(), AuthorError> {
18178    match r {
18179        ChangeRequestItemRef::ProductDefinitionFormation(i) => {
18180            if i.0 >= model.product_definition_formation_arena.items.len() {
18181                return Err(AuthorError::DanglingRef {
18182                    entity: "PRODUCT_DEFINITION_FORMATION",
18183                });
18184            }
18185        }
18186        ChangeRequestItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
18187            if i.0
18188                >= model
18189                    .product_definition_formation_with_specified_source_arena
18190                    .items
18191                    .len()
18192            {
18193                return Err(AuthorError::DanglingRef {
18194                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
18195                });
18196            }
18197        }
18198        ChangeRequestItemRef::Complex(i) => {
18199            if i.0 >= model.complex_unit_arena.items.len() {
18200                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
18201            }
18202        }
18203    }
18204    Ok(())
18205}
18206fn check_character_style_select_ref(
18207    model: &StepModel,
18208    r: &CharacterStyleSelectRef,
18209) -> Result<(), AuthorError> {
18210    match r {
18211        CharacterStyleSelectRef::CharacterGlyphStyleOutline(i) => {
18212            if i.0 >= model.character_glyph_style_outline_arena.items.len() {
18213                return Err(AuthorError::DanglingRef {
18214                    entity: "CHARACTER_GLYPH_STYLE_OUTLINE",
18215                });
18216            }
18217        }
18218        CharacterStyleSelectRef::CharacterGlyphStyleStroke(i) => {
18219            if i.0 >= model.character_glyph_style_stroke_arena.items.len() {
18220                return Err(AuthorError::DanglingRef {
18221                    entity: "CHARACTER_GLYPH_STYLE_STROKE",
18222                });
18223            }
18224        }
18225        CharacterStyleSelectRef::TextStyleForDefinedFont(i) => {
18226            if i.0 >= model.text_style_for_defined_font_arena.items.len() {
18227                return Err(AuthorError::DanglingRef {
18228                    entity: "TEXT_STYLE_FOR_DEFINED_FONT",
18229                });
18230            }
18231        }
18232        CharacterStyleSelectRef::Complex(i) => {
18233            if i.0 >= model.complex_unit_arena.items.len() {
18234                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
18235            }
18236        }
18237    }
18238    Ok(())
18239}
18240fn check_characterized_action_definition_ref(
18241    model: &StepModel,
18242    r: &CharacterizedActionDefinitionRef,
18243) -> Result<(), AuthorError> {
18244    match r {
18245        CharacterizedActionDefinitionRef::Action(i) => {
18246            if i.0 >= model.action_arena.items.len() {
18247                return Err(AuthorError::DanglingRef { entity: "ACTION" });
18248            }
18249        }
18250        CharacterizedActionDefinitionRef::ActionMethod(i) => {
18251            if i.0 >= model.action_method_arena.items.len() {
18252                return Err(AuthorError::DanglingRef {
18253                    entity: "ACTION_METHOD",
18254                });
18255            }
18256        }
18257        CharacterizedActionDefinitionRef::ActionMethodRelationship(i) => {
18258            if i.0 >= model.action_method_relationship_arena.items.len() {
18259                return Err(AuthorError::DanglingRef {
18260                    entity: "ACTION_METHOD_RELATIONSHIP",
18261                });
18262            }
18263        }
18264        CharacterizedActionDefinitionRef::ActionRelationship(i) => {
18265            if i.0 >= model.action_relationship_arena.items.len() {
18266                return Err(AuthorError::DanglingRef {
18267                    entity: "ACTION_RELATIONSHIP",
18268                });
18269            }
18270        }
18271        CharacterizedActionDefinitionRef::Complex(i) => {
18272            if i.0 >= model.complex_unit_arena.items.len() {
18273                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
18274            }
18275        }
18276    }
18277    Ok(())
18278}
18279fn check_characterized_definition_ref(
18280    model: &StepModel,
18281    r: &CharacterizedDefinitionRef,
18282) -> Result<(), AuthorError> {
18283    match r {
18284        CharacterizedDefinitionRef::AllAroundShapeAspect(i) => {
18285            if i.0 >= model.all_around_shape_aspect_arena.items.len() {
18286                return Err(AuthorError::DanglingRef {
18287                    entity: "ALL_AROUND_SHAPE_ASPECT",
18288                });
18289            }
18290        }
18291        CharacterizedDefinitionRef::AngularLocation(i) => {
18292            if i.0 >= model.angular_location_arena.items.len() {
18293                return Err(AuthorError::DanglingRef {
18294                    entity: "ANGULAR_LOCATION",
18295                });
18296            }
18297        }
18298        CharacterizedDefinitionRef::AngularSize(i) => {
18299            if i.0 >= model.angular_size_arena.items.len() {
18300                return Err(AuthorError::DanglingRef {
18301                    entity: "ANGULAR_SIZE",
18302                });
18303            }
18304        }
18305        CharacterizedDefinitionRef::AngularityTolerance(i) => {
18306            if i.0 >= model.angularity_tolerance_arena.items.len() {
18307                return Err(AuthorError::DanglingRef {
18308                    entity: "ANGULARITY_TOLERANCE",
18309                });
18310            }
18311        }
18312        CharacterizedDefinitionRef::AssemblyComponentUsage(i) => {
18313            if i.0 >= model.assembly_component_usage_arena.items.len() {
18314                return Err(AuthorError::DanglingRef {
18315                    entity: "ASSEMBLY_COMPONENT_USAGE",
18316                });
18317            }
18318        }
18319        CharacterizedDefinitionRef::CentreOfSymmetry(i) => {
18320            if i.0 >= model.centre_of_symmetry_arena.items.len() {
18321                return Err(AuthorError::DanglingRef {
18322                    entity: "CENTRE_OF_SYMMETRY",
18323                });
18324            }
18325        }
18326        CharacterizedDefinitionRef::CharacterizedItemWithinRepresentation(i) => {
18327            if i.0
18328                >= model
18329                    .characterized_item_within_representation_arena
18330                    .items
18331                    .len()
18332            {
18333                return Err(AuthorError::DanglingRef {
18334                    entity: "CHARACTERIZED_ITEM_WITHIN_REPRESENTATION",
18335                });
18336            }
18337        }
18338        CharacterizedDefinitionRef::CharacterizedObject(i) => {
18339            if i.0 >= model.characterized_object_arena.items.len() {
18340                return Err(AuthorError::DanglingRef {
18341                    entity: "CHARACTERIZED_OBJECT",
18342                });
18343            }
18344        }
18345        CharacterizedDefinitionRef::CharacterizedRepresentation(i) => {
18346            if i.0 >= model.characterized_representation_arena.items.len() {
18347                return Err(AuthorError::DanglingRef {
18348                    entity: "CHARACTERIZED_REPRESENTATION",
18349                });
18350            }
18351        }
18352        CharacterizedDefinitionRef::CircularRunoutTolerance(i) => {
18353            if i.0 >= model.circular_runout_tolerance_arena.items.len() {
18354                return Err(AuthorError::DanglingRef {
18355                    entity: "CIRCULAR_RUNOUT_TOLERANCE",
18356                });
18357            }
18358        }
18359        CharacterizedDefinitionRef::CoaxialityTolerance(i) => {
18360            if i.0 >= model.coaxiality_tolerance_arena.items.len() {
18361                return Err(AuthorError::DanglingRef {
18362                    entity: "COAXIALITY_TOLERANCE",
18363                });
18364            }
18365        }
18366        CharacterizedDefinitionRef::CommonDatum(i) => {
18367            if i.0 >= model.common_datum_arena.items.len() {
18368                return Err(AuthorError::DanglingRef {
18369                    entity: "COMMON_DATUM",
18370                });
18371            }
18372        }
18373        CharacterizedDefinitionRef::CompositeGroupShapeAspect(i) => {
18374            if i.0 >= model.composite_group_shape_aspect_arena.items.len() {
18375                return Err(AuthorError::DanglingRef {
18376                    entity: "COMPOSITE_GROUP_SHAPE_ASPECT",
18377                });
18378            }
18379        }
18380        CharacterizedDefinitionRef::CompositeShapeAspect(i) => {
18381            if i.0 >= model.composite_shape_aspect_arena.items.len() {
18382                return Err(AuthorError::DanglingRef {
18383                    entity: "COMPOSITE_SHAPE_ASPECT",
18384                });
18385            }
18386        }
18387        CharacterizedDefinitionRef::ConcentricityTolerance(i) => {
18388            if i.0 >= model.concentricity_tolerance_arena.items.len() {
18389                return Err(AuthorError::DanglingRef {
18390                    entity: "CONCENTRICITY_TOLERANCE",
18391                });
18392            }
18393        }
18394        CharacterizedDefinitionRef::ContinuousShapeAspect(i) => {
18395            if i.0 >= model.continuous_shape_aspect_arena.items.len() {
18396                return Err(AuthorError::DanglingRef {
18397                    entity: "CONTINUOUS_SHAPE_ASPECT",
18398                });
18399            }
18400        }
18401        CharacterizedDefinitionRef::CylindricityTolerance(i) => {
18402            if i.0 >= model.cylindricity_tolerance_arena.items.len() {
18403                return Err(AuthorError::DanglingRef {
18404                    entity: "CYLINDRICITY_TOLERANCE",
18405                });
18406            }
18407        }
18408        CharacterizedDefinitionRef::Datum(i) => {
18409            if i.0 >= model.datum_arena.items.len() {
18410                return Err(AuthorError::DanglingRef { entity: "DATUM" });
18411            }
18412        }
18413        CharacterizedDefinitionRef::DatumFeature(i) => {
18414            if i.0 >= model.datum_feature_arena.items.len() {
18415                return Err(AuthorError::DanglingRef {
18416                    entity: "DATUM_FEATURE",
18417                });
18418            }
18419        }
18420        CharacterizedDefinitionRef::DatumReferenceCompartment(i) => {
18421            if i.0 >= model.datum_reference_compartment_arena.items.len() {
18422                return Err(AuthorError::DanglingRef {
18423                    entity: "DATUM_REFERENCE_COMPARTMENT",
18424                });
18425            }
18426        }
18427        CharacterizedDefinitionRef::DatumReferenceElement(i) => {
18428            if i.0 >= model.datum_reference_element_arena.items.len() {
18429                return Err(AuthorError::DanglingRef {
18430                    entity: "DATUM_REFERENCE_ELEMENT",
18431                });
18432            }
18433        }
18434        CharacterizedDefinitionRef::DatumSystem(i) => {
18435            if i.0 >= model.datum_system_arena.items.len() {
18436                return Err(AuthorError::DanglingRef {
18437                    entity: "DATUM_SYSTEM",
18438                });
18439            }
18440        }
18441        CharacterizedDefinitionRef::DatumTarget(i) => {
18442            if i.0 >= model.datum_target_arena.items.len() {
18443                return Err(AuthorError::DanglingRef {
18444                    entity: "DATUM_TARGET",
18445                });
18446            }
18447        }
18448        CharacterizedDefinitionRef::DefaultModelGeometricView(i) => {
18449            if i.0 >= model.default_model_geometric_view_arena.items.len() {
18450                return Err(AuthorError::DanglingRef {
18451                    entity: "DEFAULT_MODEL_GEOMETRIC_VIEW",
18452                });
18453            }
18454        }
18455        CharacterizedDefinitionRef::DerivedShapeAspect(i) => {
18456            if i.0 >= model.derived_shape_aspect_arena.items.len() {
18457                return Err(AuthorError::DanglingRef {
18458                    entity: "DERIVED_SHAPE_ASPECT",
18459                });
18460            }
18461        }
18462        CharacterizedDefinitionRef::DimensionalLocation(i) => {
18463            if i.0 >= model.dimensional_location_arena.items.len() {
18464                return Err(AuthorError::DanglingRef {
18465                    entity: "DIMENSIONAL_LOCATION",
18466                });
18467            }
18468        }
18469        CharacterizedDefinitionRef::DimensionalLocationWithPath(i) => {
18470            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
18471                return Err(AuthorError::DanglingRef {
18472                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
18473                });
18474            }
18475        }
18476        CharacterizedDefinitionRef::DimensionalSize(i) => {
18477            if i.0 >= model.dimensional_size_arena.items.len() {
18478                return Err(AuthorError::DanglingRef {
18479                    entity: "DIMENSIONAL_SIZE",
18480                });
18481            }
18482        }
18483        CharacterizedDefinitionRef::DimensionalSizeWithDatumFeature(i) => {
18484            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
18485                return Err(AuthorError::DanglingRef {
18486                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
18487                });
18488            }
18489        }
18490        CharacterizedDefinitionRef::DimensionalSizeWithPath(i) => {
18491            if i.0 >= model.dimensional_size_with_path_arena.items.len() {
18492                return Err(AuthorError::DanglingRef {
18493                    entity: "DIMENSIONAL_SIZE_WITH_PATH",
18494                });
18495            }
18496        }
18497        CharacterizedDefinitionRef::DirectedDimensionalLocation(i) => {
18498            if i.0 >= model.directed_dimensional_location_arena.items.len() {
18499                return Err(AuthorError::DanglingRef {
18500                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
18501                });
18502            }
18503        }
18504        CharacterizedDefinitionRef::DocumentFile(i) => {
18505            if i.0 >= model.document_file_arena.items.len() {
18506                return Err(AuthorError::DanglingRef {
18507                    entity: "DOCUMENT_FILE",
18508                });
18509            }
18510        }
18511        CharacterizedDefinitionRef::DraughtingModelItemAssociation(i) => {
18512            if i.0 >= model.draughting_model_item_association_arena.items.len() {
18513                return Err(AuthorError::DanglingRef {
18514                    entity: "DRAUGHTING_MODEL_ITEM_ASSOCIATION",
18515                });
18516            }
18517        }
18518        CharacterizedDefinitionRef::DraughtingModelItemAssociationWithPlaceholder(i) => {
18519            if i.0
18520                >= model
18521                    .draughting_model_item_association_with_placeholder_arena
18522                    .items
18523                    .len()
18524            {
18525                return Err(AuthorError::DanglingRef {
18526                    entity: "DRAUGHTING_MODEL_ITEM_ASSOCIATION_WITH_PLACEHOLDER",
18527                });
18528            }
18529        }
18530        CharacterizedDefinitionRef::FeatureForDatumTargetRelationship(i) => {
18531            if i.0
18532                >= model
18533                    .feature_for_datum_target_relationship_arena
18534                    .items
18535                    .len()
18536            {
18537                return Err(AuthorError::DanglingRef {
18538                    entity: "FEATURE_FOR_DATUM_TARGET_RELATIONSHIP",
18539                });
18540            }
18541        }
18542        CharacterizedDefinitionRef::FlatnessTolerance(i) => {
18543            if i.0 >= model.flatness_tolerance_arena.items.len() {
18544                return Err(AuthorError::DanglingRef {
18545                    entity: "FLATNESS_TOLERANCE",
18546                });
18547            }
18548        }
18549        CharacterizedDefinitionRef::GeneralDatumReference(i) => {
18550            if i.0 >= model.general_datum_reference_arena.items.len() {
18551                return Err(AuthorError::DanglingRef {
18552                    entity: "GENERAL_DATUM_REFERENCE",
18553                });
18554            }
18555        }
18556        CharacterizedDefinitionRef::GeometricItemSpecificUsage(i) => {
18557            if i.0 >= model.geometric_item_specific_usage_arena.items.len() {
18558                return Err(AuthorError::DanglingRef {
18559                    entity: "GEOMETRIC_ITEM_SPECIFIC_USAGE",
18560                });
18561            }
18562        }
18563        CharacterizedDefinitionRef::GeometricTolerance(i) => {
18564            if i.0 >= model.geometric_tolerance_arena.items.len() {
18565                return Err(AuthorError::DanglingRef {
18566                    entity: "GEOMETRIC_TOLERANCE",
18567                });
18568            }
18569        }
18570        CharacterizedDefinitionRef::GeometricToleranceWithDatumReference(i) => {
18571            if i.0
18572                >= model
18573                    .geometric_tolerance_with_datum_reference_arena
18574                    .items
18575                    .len()
18576            {
18577                return Err(AuthorError::DanglingRef {
18578                    entity: "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
18579                });
18580            }
18581        }
18582        CharacterizedDefinitionRef::GeometricToleranceWithDefinedAreaUnit(i) => {
18583            if i.0
18584                >= model
18585                    .geometric_tolerance_with_defined_area_unit_arena
18586                    .items
18587                    .len()
18588            {
18589                return Err(AuthorError::DanglingRef {
18590                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_AREA_UNIT",
18591                });
18592            }
18593        }
18594        CharacterizedDefinitionRef::GeometricToleranceWithDefinedUnit(i) => {
18595            if i.0
18596                >= model
18597                    .geometric_tolerance_with_defined_unit_arena
18598                    .items
18599                    .len()
18600            {
18601                return Err(AuthorError::DanglingRef {
18602                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_UNIT",
18603                });
18604            }
18605        }
18606        CharacterizedDefinitionRef::GeometricToleranceWithMaximumTolerance(i) => {
18607            if i.0
18608                >= model
18609                    .geometric_tolerance_with_maximum_tolerance_arena
18610                    .items
18611                    .len()
18612            {
18613                return Err(AuthorError::DanglingRef {
18614                    entity: "GEOMETRIC_TOLERANCE_WITH_MAXIMUM_TOLERANCE",
18615                });
18616            }
18617        }
18618        CharacterizedDefinitionRef::GeometricToleranceWithModifiers(i) => {
18619            if i.0 >= model.geometric_tolerance_with_modifiers_arena.items.len() {
18620                return Err(AuthorError::DanglingRef {
18621                    entity: "GEOMETRIC_TOLERANCE_WITH_MODIFIERS",
18622                });
18623            }
18624        }
18625        CharacterizedDefinitionRef::ItemIdentifiedRepresentationUsage(i) => {
18626            if i.0 >= model.item_identified_representation_usage_arena.items.len() {
18627                return Err(AuthorError::DanglingRef {
18628                    entity: "ITEM_IDENTIFIED_REPRESENTATION_USAGE",
18629                });
18630            }
18631        }
18632        CharacterizedDefinitionRef::LineProfileTolerance(i) => {
18633            if i.0 >= model.line_profile_tolerance_arena.items.len() {
18634                return Err(AuthorError::DanglingRef {
18635                    entity: "LINE_PROFILE_TOLERANCE",
18636                });
18637            }
18638        }
18639        CharacterizedDefinitionRef::MakeFromUsageOption(i) => {
18640            if i.0 >= model.make_from_usage_option_arena.items.len() {
18641                return Err(AuthorError::DanglingRef {
18642                    entity: "MAKE_FROM_USAGE_OPTION",
18643                });
18644            }
18645        }
18646        CharacterizedDefinitionRef::ModelGeometricView(i) => {
18647            if i.0 >= model.model_geometric_view_arena.items.len() {
18648                return Err(AuthorError::DanglingRef {
18649                    entity: "MODEL_GEOMETRIC_VIEW",
18650                });
18651            }
18652        }
18653        CharacterizedDefinitionRef::ModifiedGeometricTolerance(i) => {
18654            if i.0 >= model.modified_geometric_tolerance_arena.items.len() {
18655                return Err(AuthorError::DanglingRef {
18656                    entity: "MODIFIED_GEOMETRIC_TOLERANCE",
18657                });
18658            }
18659        }
18660        CharacterizedDefinitionRef::NextAssemblyUsageOccurrence(i) => {
18661            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
18662                return Err(AuthorError::DanglingRef {
18663                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
18664                });
18665            }
18666        }
18667        CharacterizedDefinitionRef::ParallelismTolerance(i) => {
18668            if i.0 >= model.parallelism_tolerance_arena.items.len() {
18669                return Err(AuthorError::DanglingRef {
18670                    entity: "PARALLELISM_TOLERANCE",
18671                });
18672            }
18673        }
18674        CharacterizedDefinitionRef::PerpendicularityTolerance(i) => {
18675            if i.0 >= model.perpendicularity_tolerance_arena.items.len() {
18676                return Err(AuthorError::DanglingRef {
18677                    entity: "PERPENDICULARITY_TOLERANCE",
18678                });
18679            }
18680        }
18681        CharacterizedDefinitionRef::PlacedDatumTargetFeature(i) => {
18682            if i.0 >= model.placed_datum_target_feature_arena.items.len() {
18683                return Err(AuthorError::DanglingRef {
18684                    entity: "PLACED_DATUM_TARGET_FEATURE",
18685                });
18686            }
18687        }
18688        CharacterizedDefinitionRef::PositionTolerance(i) => {
18689            if i.0 >= model.position_tolerance_arena.items.len() {
18690                return Err(AuthorError::DanglingRef {
18691                    entity: "POSITION_TOLERANCE",
18692                });
18693            }
18694        }
18695        CharacterizedDefinitionRef::ProductDefinition(i) => {
18696            if i.0 >= model.product_definition_arena.items.len() {
18697                return Err(AuthorError::DanglingRef {
18698                    entity: "PRODUCT_DEFINITION",
18699                });
18700            }
18701        }
18702        CharacterizedDefinitionRef::ProductDefinitionOccurrence(i) => {
18703            if i.0 >= model.product_definition_occurrence_arena.items.len() {
18704                return Err(AuthorError::DanglingRef {
18705                    entity: "PRODUCT_DEFINITION_OCCURRENCE",
18706                });
18707            }
18708        }
18709        CharacterizedDefinitionRef::ProductDefinitionRelationship(i) => {
18710            if i.0 >= model.product_definition_relationship_arena.items.len() {
18711                return Err(AuthorError::DanglingRef {
18712                    entity: "PRODUCT_DEFINITION_RELATIONSHIP",
18713                });
18714            }
18715        }
18716        CharacterizedDefinitionRef::ProductDefinitionRelationshipRelationship(i) => {
18717            if i.0
18718                >= model
18719                    .product_definition_relationship_relationship_arena
18720                    .items
18721                    .len()
18722            {
18723                return Err(AuthorError::DanglingRef {
18724                    entity: "PRODUCT_DEFINITION_RELATIONSHIP_RELATIONSHIP",
18725                });
18726            }
18727        }
18728        CharacterizedDefinitionRef::ProductDefinitionShape(i) => {
18729            if i.0 >= model.product_definition_shape_arena.items.len() {
18730                return Err(AuthorError::DanglingRef {
18731                    entity: "PRODUCT_DEFINITION_SHAPE",
18732                });
18733            }
18734        }
18735        CharacterizedDefinitionRef::ProductDefinitionUsage(i) => {
18736            if i.0 >= model.product_definition_usage_arena.items.len() {
18737                return Err(AuthorError::DanglingRef {
18738                    entity: "PRODUCT_DEFINITION_USAGE",
18739                });
18740            }
18741        }
18742        CharacterizedDefinitionRef::ProductDefinitionWithAssociatedDocuments(i) => {
18743            if i.0
18744                >= model
18745                    .product_definition_with_associated_documents_arena
18746                    .items
18747                    .len()
18748            {
18749                return Err(AuthorError::DanglingRef {
18750                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
18751                });
18752            }
18753        }
18754        CharacterizedDefinitionRef::RoundnessTolerance(i) => {
18755            if i.0 >= model.roundness_tolerance_arena.items.len() {
18756                return Err(AuthorError::DanglingRef {
18757                    entity: "ROUNDNESS_TOLERANCE",
18758                });
18759            }
18760        }
18761        CharacterizedDefinitionRef::ShapeAspect(i) => {
18762            if i.0 >= model.shape_aspect_arena.items.len() {
18763                return Err(AuthorError::DanglingRef {
18764                    entity: "SHAPE_ASPECT",
18765                });
18766            }
18767        }
18768        CharacterizedDefinitionRef::ShapeAspectAssociativity(i) => {
18769            if i.0 >= model.shape_aspect_associativity_arena.items.len() {
18770                return Err(AuthorError::DanglingRef {
18771                    entity: "SHAPE_ASPECT_ASSOCIATIVITY",
18772                });
18773            }
18774        }
18775        CharacterizedDefinitionRef::ShapeAspectDerivingRelationship(i) => {
18776            if i.0 >= model.shape_aspect_deriving_relationship_arena.items.len() {
18777                return Err(AuthorError::DanglingRef {
18778                    entity: "SHAPE_ASPECT_DERIVING_RELATIONSHIP",
18779                });
18780            }
18781        }
18782        CharacterizedDefinitionRef::ShapeAspectRelationship(i) => {
18783            if i.0 >= model.shape_aspect_relationship_arena.items.len() {
18784                return Err(AuthorError::DanglingRef {
18785                    entity: "SHAPE_ASPECT_RELATIONSHIP",
18786                });
18787            }
18788        }
18789        CharacterizedDefinitionRef::StraightnessTolerance(i) => {
18790            if i.0 >= model.straightness_tolerance_arena.items.len() {
18791                return Err(AuthorError::DanglingRef {
18792                    entity: "STRAIGHTNESS_TOLERANCE",
18793                });
18794            }
18795        }
18796        CharacterizedDefinitionRef::SurfaceProfileTolerance(i) => {
18797            if i.0 >= model.surface_profile_tolerance_arena.items.len() {
18798                return Err(AuthorError::DanglingRef {
18799                    entity: "SURFACE_PROFILE_TOLERANCE",
18800                });
18801            }
18802        }
18803        CharacterizedDefinitionRef::SymmetryTolerance(i) => {
18804            if i.0 >= model.symmetry_tolerance_arena.items.len() {
18805                return Err(AuthorError::DanglingRef {
18806                    entity: "SYMMETRY_TOLERANCE",
18807                });
18808            }
18809        }
18810        CharacterizedDefinitionRef::ToleranceZone(i) => {
18811            if i.0 >= model.tolerance_zone_arena.items.len() {
18812                return Err(AuthorError::DanglingRef {
18813                    entity: "TOLERANCE_ZONE",
18814                });
18815            }
18816        }
18817        CharacterizedDefinitionRef::ToleranceZoneWithDatum(i) => {
18818            if i.0 >= model.tolerance_zone_with_datum_arena.items.len() {
18819                return Err(AuthorError::DanglingRef {
18820                    entity: "TOLERANCE_ZONE_WITH_DATUM",
18821                });
18822            }
18823        }
18824        CharacterizedDefinitionRef::TotalRunoutTolerance(i) => {
18825            if i.0 >= model.total_runout_tolerance_arena.items.len() {
18826                return Err(AuthorError::DanglingRef {
18827                    entity: "TOTAL_RUNOUT_TOLERANCE",
18828                });
18829            }
18830        }
18831        CharacterizedDefinitionRef::UnequallyDisposedGeometricTolerance(i) => {
18832            if i.0
18833                >= model
18834                    .unequally_disposed_geometric_tolerance_arena
18835                    .items
18836                    .len()
18837            {
18838                return Err(AuthorError::DanglingRef {
18839                    entity: "UNEQUALLY_DISPOSED_GEOMETRIC_TOLERANCE",
18840                });
18841            }
18842        }
18843        CharacterizedDefinitionRef::Complex(i) => {
18844            if i.0 >= model.complex_unit_arena.items.len() {
18845                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
18846            }
18847        }
18848    }
18849    Ok(())
18850}
18851fn check_characterized_resource_definition_ref(
18852    model: &StepModel,
18853    r: &CharacterizedResourceDefinitionRef,
18854) -> Result<(), AuthorError> {
18855    match r {
18856        CharacterizedResourceDefinitionRef::ActionResource(i) => {
18857            if i.0 >= model.action_resource_arena.items.len() {
18858                return Err(AuthorError::DanglingRef {
18859                    entity: "ACTION_RESOURCE",
18860                });
18861            }
18862        }
18863        CharacterizedResourceDefinitionRef::ActionResourceRelationship(i) => {
18864            if i.0 >= model.action_resource_relationship_arena.items.len() {
18865                return Err(AuthorError::DanglingRef {
18866                    entity: "ACTION_RESOURCE_RELATIONSHIP",
18867                });
18868            }
18869        }
18870        CharacterizedResourceDefinitionRef::ActionResourceRequirement(i) => {
18871            if i.0 >= model.action_resource_requirement_arena.items.len() {
18872                return Err(AuthorError::DanglingRef {
18873                    entity: "ACTION_RESOURCE_REQUIREMENT",
18874                });
18875            }
18876        }
18877        CharacterizedResourceDefinitionRef::Complex(i) => {
18878            if i.0 >= model.complex_unit_arena.items.len() {
18879                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
18880            }
18881        }
18882    }
18883    Ok(())
18884}
18885fn check_closed_shell_ref(model: &StepModel, r: &ClosedShellRef) -> Result<(), AuthorError> {
18886    match r {
18887        ClosedShellRef::ClosedShell(i) => {
18888            if i.0 >= model.closed_shell_arena.items.len() {
18889                return Err(AuthorError::DanglingRef {
18890                    entity: "CLOSED_SHELL",
18891                });
18892            }
18893        }
18894        ClosedShellRef::OrientedClosedShell(i) => {
18895            if i.0 >= model.oriented_closed_shell_arena.items.len() {
18896                return Err(AuthorError::DanglingRef {
18897                    entity: "ORIENTED_CLOSED_SHELL",
18898                });
18899            }
18900        }
18901        ClosedShellRef::Complex(i) => {
18902            if i.0 >= model.complex_unit_arena.items.len() {
18903                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
18904            }
18905        }
18906    }
18907    Ok(())
18908}
18909fn check_colour_ref(model: &StepModel, r: &ColourRef) -> Result<(), AuthorError> {
18910    match r {
18911        ColourRef::Colour(i) => {
18912            if i.0 >= model.colour_arena.items.len() {
18913                return Err(AuthorError::DanglingRef { entity: "COLOUR" });
18914            }
18915        }
18916        ColourRef::ColourRgb(i) => {
18917            if i.0 >= model.colour_rgb_arena.items.len() {
18918                return Err(AuthorError::DanglingRef {
18919                    entity: "COLOUR_RGB",
18920                });
18921            }
18922        }
18923        ColourRef::ColourSpecification(i) => {
18924            if i.0 >= model.colour_specification_arena.items.len() {
18925                return Err(AuthorError::DanglingRef {
18926                    entity: "COLOUR_SPECIFICATION",
18927                });
18928            }
18929        }
18930        ColourRef::DraughtingPreDefinedColour(i) => {
18931            if i.0 >= model.draughting_pre_defined_colour_arena.items.len() {
18932                return Err(AuthorError::DanglingRef {
18933                    entity: "DRAUGHTING_PRE_DEFINED_COLOUR",
18934                });
18935            }
18936        }
18937        ColourRef::PreDefinedColour(i) => {
18938            if i.0 >= model.pre_defined_colour_arena.items.len() {
18939                return Err(AuthorError::DanglingRef {
18940                    entity: "PRE_DEFINED_COLOUR",
18941                });
18942            }
18943        }
18944        ColourRef::Complex(i) => {
18945            if i.0 >= model.complex_unit_arena.items.len() {
18946                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
18947            }
18948        }
18949    }
18950    Ok(())
18951}
18952fn check_composite_curve_segment_ref(
18953    model: &StepModel,
18954    r: &CompositeCurveSegmentRef,
18955) -> Result<(), AuthorError> {
18956    match r {
18957        CompositeCurveSegmentRef::CompositeCurveSegment(i) => {
18958            if i.0 >= model.composite_curve_segment_arena.items.len() {
18959                return Err(AuthorError::DanglingRef {
18960                    entity: "COMPOSITE_CURVE_SEGMENT",
18961                });
18962            }
18963        }
18964        CompositeCurveSegmentRef::Complex(i) => {
18965            if i.0 >= model.complex_unit_arena.items.len() {
18966                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
18967            }
18968        }
18969    }
18970    Ok(())
18971}
18972fn check_compound_item_definition_ref(
18973    model: &StepModel,
18974    r: &CompoundItemDefinitionRef,
18975) -> Result<(), AuthorError> {
18976    match r {
18977        CompoundItemDefinitionRef::AdvancedFace(i) => {
18978            if i.0 >= model.advanced_face_arena.items.len() {
18979                return Err(AuthorError::DanglingRef {
18980                    entity: "ADVANCED_FACE",
18981                });
18982            }
18983        }
18984        CompoundItemDefinitionRef::AnnotationCurveOccurrence(i) => {
18985            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
18986                return Err(AuthorError::DanglingRef {
18987                    entity: "ANNOTATION_CURVE_OCCURRENCE",
18988                });
18989            }
18990        }
18991        CompoundItemDefinitionRef::AnnotationFillAreaOccurrence(i) => {
18992            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
18993                return Err(AuthorError::DanglingRef {
18994                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
18995                });
18996            }
18997        }
18998        CompoundItemDefinitionRef::AnnotationOccurrence(i) => {
18999            if i.0 >= model.annotation_occurrence_arena.items.len() {
19000                return Err(AuthorError::DanglingRef {
19001                    entity: "ANNOTATION_OCCURRENCE",
19002                });
19003            }
19004        }
19005        CompoundItemDefinitionRef::AnnotationPlaceholderLeaderLine(_) => {
19006            return Err(AuthorError::NotAp242 {
19007                entity: "ANNOTATION_PLACEHOLDER_LEADER_LINE",
19008            });
19009        }
19010        CompoundItemDefinitionRef::AnnotationPlaceholderOccurrence(i) => {
19011            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
19012                return Err(AuthorError::DanglingRef {
19013                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
19014                });
19015            }
19016        }
19017        CompoundItemDefinitionRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
19018            return Err(AuthorError::NotAp242 {
19019                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
19020            });
19021        }
19022        CompoundItemDefinitionRef::AnnotationPlane(i) => {
19023            if i.0 >= model.annotation_plane_arena.items.len() {
19024                return Err(AuthorError::DanglingRef {
19025                    entity: "ANNOTATION_PLANE",
19026                });
19027            }
19028        }
19029        CompoundItemDefinitionRef::AnnotationSymbol(i) => {
19030            if i.0 >= model.annotation_symbol_arena.items.len() {
19031                return Err(AuthorError::DanglingRef {
19032                    entity: "ANNOTATION_SYMBOL",
19033                });
19034            }
19035        }
19036        CompoundItemDefinitionRef::AnnotationSymbolOccurrence(i) => {
19037            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
19038                return Err(AuthorError::DanglingRef {
19039                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
19040                });
19041            }
19042        }
19043        CompoundItemDefinitionRef::AnnotationText(i) => {
19044            if i.0 >= model.annotation_text_arena.items.len() {
19045                return Err(AuthorError::DanglingRef {
19046                    entity: "ANNOTATION_TEXT",
19047                });
19048            }
19049        }
19050        CompoundItemDefinitionRef::AnnotationTextCharacter(i) => {
19051            if i.0 >= model.annotation_text_character_arena.items.len() {
19052                return Err(AuthorError::DanglingRef {
19053                    entity: "ANNOTATION_TEXT_CHARACTER",
19054                });
19055            }
19056        }
19057        CompoundItemDefinitionRef::AnnotationTextOccurrence(i) => {
19058            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
19059                return Err(AuthorError::DanglingRef {
19060                    entity: "ANNOTATION_TEXT_OCCURRENCE",
19061                });
19062            }
19063        }
19064        CompoundItemDefinitionRef::AnnotationToAnnotationLeaderLine(_) => {
19065            return Err(AuthorError::NotAp242 {
19066                entity: "ANNOTATION_TO_ANNOTATION_LEADER_LINE",
19067            });
19068        }
19069        CompoundItemDefinitionRef::AnnotationToModelLeaderLine(_) => {
19070            return Err(AuthorError::NotAp242 {
19071                entity: "ANNOTATION_TO_MODEL_LEADER_LINE",
19072            });
19073        }
19074        CompoundItemDefinitionRef::ApllPoint(_) => {
19075            return Err(AuthorError::NotAp242 {
19076                entity: "APLL_POINT",
19077            });
19078        }
19079        CompoundItemDefinitionRef::ApllPointWithSurface(_) => {
19080            return Err(AuthorError::NotAp242 {
19081                entity: "APLL_POINT_WITH_SURFACE",
19082            });
19083        }
19084        CompoundItemDefinitionRef::AuxiliaryLeaderLine(_) => {
19085            return Err(AuthorError::NotAp242 {
19086                entity: "AUXILIARY_LEADER_LINE",
19087            });
19088        }
19089        CompoundItemDefinitionRef::Axis1Placement(i) => {
19090            if i.0 >= model.axis1_placement_arena.items.len() {
19091                return Err(AuthorError::DanglingRef {
19092                    entity: "AXIS1_PLACEMENT",
19093                });
19094            }
19095        }
19096        CompoundItemDefinitionRef::Axis2Placement2d(i) => {
19097            if i.0 >= model.axis2_placement2d_arena.items.len() {
19098                return Err(AuthorError::DanglingRef {
19099                    entity: "AXIS2_PLACEMENT_2D",
19100                });
19101            }
19102        }
19103        CompoundItemDefinitionRef::Axis2Placement3d(i) => {
19104            if i.0 >= model.axis2_placement3d_arena.items.len() {
19105                return Err(AuthorError::DanglingRef {
19106                    entity: "AXIS2_PLACEMENT_3D",
19107                });
19108            }
19109        }
19110        CompoundItemDefinitionRef::BSplineCurve(i) => {
19111            if i.0 >= model.b_spline_curve_arena.items.len() {
19112                return Err(AuthorError::DanglingRef {
19113                    entity: "B_SPLINE_CURVE",
19114                });
19115            }
19116        }
19117        CompoundItemDefinitionRef::BSplineCurveWithKnots(i) => {
19118            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
19119                return Err(AuthorError::DanglingRef {
19120                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
19121                });
19122            }
19123        }
19124        CompoundItemDefinitionRef::BSplineSurface(i) => {
19125            if i.0 >= model.b_spline_surface_arena.items.len() {
19126                return Err(AuthorError::DanglingRef {
19127                    entity: "B_SPLINE_SURFACE",
19128                });
19129            }
19130        }
19131        CompoundItemDefinitionRef::BSplineSurfaceWithKnots(i) => {
19132            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
19133                return Err(AuthorError::DanglingRef {
19134                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
19135                });
19136            }
19137        }
19138        CompoundItemDefinitionRef::BezierCurve(i) => {
19139            if i.0 >= model.bezier_curve_arena.items.len() {
19140                return Err(AuthorError::DanglingRef {
19141                    entity: "BEZIER_CURVE",
19142                });
19143            }
19144        }
19145        CompoundItemDefinitionRef::BezierSurface(i) => {
19146            if i.0 >= model.bezier_surface_arena.items.len() {
19147                return Err(AuthorError::DanglingRef {
19148                    entity: "BEZIER_SURFACE",
19149                });
19150            }
19151        }
19152        CompoundItemDefinitionRef::BoundedCurve(i) => {
19153            if i.0 >= model.bounded_curve_arena.items.len() {
19154                return Err(AuthorError::DanglingRef {
19155                    entity: "BOUNDED_CURVE",
19156                });
19157            }
19158        }
19159        CompoundItemDefinitionRef::BoundedPcurve(i) => {
19160            if i.0 >= model.bounded_pcurve_arena.items.len() {
19161                return Err(AuthorError::DanglingRef {
19162                    entity: "BOUNDED_PCURVE",
19163                });
19164            }
19165        }
19166        CompoundItemDefinitionRef::BoundedSurface(i) => {
19167            if i.0 >= model.bounded_surface_arena.items.len() {
19168                return Err(AuthorError::DanglingRef {
19169                    entity: "BOUNDED_SURFACE",
19170                });
19171            }
19172        }
19173        CompoundItemDefinitionRef::BoundedSurfaceCurve(i) => {
19174            if i.0 >= model.bounded_surface_curve_arena.items.len() {
19175                return Err(AuthorError::DanglingRef {
19176                    entity: "BOUNDED_SURFACE_CURVE",
19177                });
19178            }
19179        }
19180        CompoundItemDefinitionRef::BrepWithVoids(i) => {
19181            if i.0 >= model.brep_with_voids_arena.items.len() {
19182                return Err(AuthorError::DanglingRef {
19183                    entity: "BREP_WITH_VOIDS",
19184                });
19185            }
19186        }
19187        CompoundItemDefinitionRef::CameraImage(i) => {
19188            if i.0 >= model.camera_image_arena.items.len() {
19189                return Err(AuthorError::DanglingRef {
19190                    entity: "CAMERA_IMAGE",
19191                });
19192            }
19193        }
19194        CompoundItemDefinitionRef::CameraImage3dWithScale(i) => {
19195            if i.0 >= model.camera_image3d_with_scale_arena.items.len() {
19196                return Err(AuthorError::DanglingRef {
19197                    entity: "CAMERA_IMAGE_3D_WITH_SCALE",
19198                });
19199            }
19200        }
19201        CompoundItemDefinitionRef::CameraModel(i) => {
19202            if i.0 >= model.camera_model_arena.items.len() {
19203                return Err(AuthorError::DanglingRef {
19204                    entity: "CAMERA_MODEL",
19205                });
19206            }
19207        }
19208        CompoundItemDefinitionRef::CameraModelD3(i) => {
19209            if i.0 >= model.camera_model_d3_arena.items.len() {
19210                return Err(AuthorError::DanglingRef {
19211                    entity: "CAMERA_MODEL_D3",
19212                });
19213            }
19214        }
19215        CompoundItemDefinitionRef::CameraModelD3MultiClipping(i) => {
19216            if i.0 >= model.camera_model_d3_multi_clipping_arena.items.len() {
19217                return Err(AuthorError::DanglingRef {
19218                    entity: "CAMERA_MODEL_D3_MULTI_CLIPPING",
19219                });
19220            }
19221        }
19222        CompoundItemDefinitionRef::CameraModelD3WithHlhsr(i) => {
19223            if i.0 >= model.camera_model_d3_with_hlhsr_arena.items.len() {
19224                return Err(AuthorError::DanglingRef {
19225                    entity: "CAMERA_MODEL_D3_WITH_HLHSR",
19226                });
19227            }
19228        }
19229        CompoundItemDefinitionRef::CartesianPoint(i) => {
19230            if i.0 >= model.cartesian_point_arena.items.len() {
19231                return Err(AuthorError::DanglingRef {
19232                    entity: "CARTESIAN_POINT",
19233                });
19234            }
19235        }
19236        CompoundItemDefinitionRef::Circle(i) => {
19237            if i.0 >= model.circle_arena.items.len() {
19238                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
19239            }
19240        }
19241        CompoundItemDefinitionRef::ClosedShell(i) => {
19242            if i.0 >= model.closed_shell_arena.items.len() {
19243                return Err(AuthorError::DanglingRef {
19244                    entity: "CLOSED_SHELL",
19245                });
19246            }
19247        }
19248        CompoundItemDefinitionRef::ComplexTriangulatedFace(i) => {
19249            if i.0 >= model.complex_triangulated_face_arena.items.len() {
19250                return Err(AuthorError::DanglingRef {
19251                    entity: "COMPLEX_TRIANGULATED_FACE",
19252                });
19253            }
19254        }
19255        CompoundItemDefinitionRef::ComplexTriangulatedSurfaceSet(i) => {
19256            if i.0 >= model.complex_triangulated_surface_set_arena.items.len() {
19257                return Err(AuthorError::DanglingRef {
19258                    entity: "COMPLEX_TRIANGULATED_SURFACE_SET",
19259                });
19260            }
19261        }
19262        CompoundItemDefinitionRef::CompositeCurve(i) => {
19263            if i.0 >= model.composite_curve_arena.items.len() {
19264                return Err(AuthorError::DanglingRef {
19265                    entity: "COMPOSITE_CURVE",
19266                });
19267            }
19268        }
19269        CompoundItemDefinitionRef::CompositeText(i) => {
19270            if i.0 >= model.composite_text_arena.items.len() {
19271                return Err(AuthorError::DanglingRef {
19272                    entity: "COMPOSITE_TEXT",
19273                });
19274            }
19275        }
19276        CompoundItemDefinitionRef::CompoundRepresentationItem(i) => {
19277            if i.0 >= model.compound_representation_item_arena.items.len() {
19278                return Err(AuthorError::DanglingRef {
19279                    entity: "COMPOUND_REPRESENTATION_ITEM",
19280                });
19281            }
19282        }
19283        CompoundItemDefinitionRef::Conic(i) => {
19284            if i.0 >= model.conic_arena.items.len() {
19285                return Err(AuthorError::DanglingRef { entity: "CONIC" });
19286            }
19287        }
19288        CompoundItemDefinitionRef::ConicalSurface(i) => {
19289            if i.0 >= model.conical_surface_arena.items.len() {
19290                return Err(AuthorError::DanglingRef {
19291                    entity: "CONICAL_SURFACE",
19292                });
19293            }
19294        }
19295        CompoundItemDefinitionRef::ConnectedFaceSet(i) => {
19296            if i.0 >= model.connected_face_set_arena.items.len() {
19297                return Err(AuthorError::DanglingRef {
19298                    entity: "CONNECTED_FACE_SET",
19299                });
19300            }
19301        }
19302        CompoundItemDefinitionRef::ContextDependentOverRidingStyledItem(i) => {
19303            if i.0
19304                >= model
19305                    .context_dependent_over_riding_styled_item_arena
19306                    .items
19307                    .len()
19308            {
19309                return Err(AuthorError::DanglingRef {
19310                    entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
19311                });
19312            }
19313        }
19314        CompoundItemDefinitionRef::CoordinatesList(i) => {
19315            if i.0 >= model.coordinates_list_arena.items.len() {
19316                return Err(AuthorError::DanglingRef {
19317                    entity: "COORDINATES_LIST",
19318                });
19319            }
19320        }
19321        CompoundItemDefinitionRef::Curve(i) => {
19322            if i.0 >= model.curve_arena.items.len() {
19323                return Err(AuthorError::DanglingRef { entity: "CURVE" });
19324            }
19325        }
19326        CompoundItemDefinitionRef::CylindricalSurface(i) => {
19327            if i.0 >= model.cylindrical_surface_arena.items.len() {
19328                return Err(AuthorError::DanglingRef {
19329                    entity: "CYLINDRICAL_SURFACE",
19330                });
19331            }
19332        }
19333        CompoundItemDefinitionRef::DefinedCharacterGlyph(i) => {
19334            if i.0 >= model.defined_character_glyph_arena.items.len() {
19335                return Err(AuthorError::DanglingRef {
19336                    entity: "DEFINED_CHARACTER_GLYPH",
19337                });
19338            }
19339        }
19340        CompoundItemDefinitionRef::DefinedSymbol(i) => {
19341            if i.0 >= model.defined_symbol_arena.items.len() {
19342                return Err(AuthorError::DanglingRef {
19343                    entity: "DEFINED_SYMBOL",
19344                });
19345            }
19346        }
19347        CompoundItemDefinitionRef::DegenerateToroidalSurface(i) => {
19348            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
19349                return Err(AuthorError::DanglingRef {
19350                    entity: "DEGENERATE_TOROIDAL_SURFACE",
19351                });
19352            }
19353        }
19354        CompoundItemDefinitionRef::DescriptiveRepresentationItem(i) => {
19355            if i.0 >= model.descriptive_representation_item_arena.items.len() {
19356                return Err(AuthorError::DanglingRef {
19357                    entity: "DESCRIPTIVE_REPRESENTATION_ITEM",
19358                });
19359            }
19360        }
19361        CompoundItemDefinitionRef::Direction(i) => {
19362            if i.0 >= model.direction_arena.items.len() {
19363                return Err(AuthorError::DanglingRef {
19364                    entity: "DIRECTION",
19365                });
19366            }
19367        }
19368        CompoundItemDefinitionRef::DraughtingAnnotationOccurrence(i) => {
19369            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
19370                return Err(AuthorError::DanglingRef {
19371                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
19372                });
19373            }
19374        }
19375        CompoundItemDefinitionRef::DraughtingCallout(i) => {
19376            if i.0 >= model.draughting_callout_arena.items.len() {
19377                return Err(AuthorError::DanglingRef {
19378                    entity: "DRAUGHTING_CALLOUT",
19379                });
19380            }
19381        }
19382        CompoundItemDefinitionRef::Edge(i) => {
19383            if i.0 >= model.edge_arena.items.len() {
19384                return Err(AuthorError::DanglingRef { entity: "EDGE" });
19385            }
19386        }
19387        CompoundItemDefinitionRef::EdgeCurve(i) => {
19388            if i.0 >= model.edge_curve_arena.items.len() {
19389                return Err(AuthorError::DanglingRef {
19390                    entity: "EDGE_CURVE",
19391                });
19392            }
19393        }
19394        CompoundItemDefinitionRef::EdgeLoop(i) => {
19395            if i.0 >= model.edge_loop_arena.items.len() {
19396                return Err(AuthorError::DanglingRef {
19397                    entity: "EDGE_LOOP",
19398                });
19399            }
19400        }
19401        CompoundItemDefinitionRef::ElementarySurface(i) => {
19402            if i.0 >= model.elementary_surface_arena.items.len() {
19403                return Err(AuthorError::DanglingRef {
19404                    entity: "ELEMENTARY_SURFACE",
19405                });
19406            }
19407        }
19408        CompoundItemDefinitionRef::Ellipse(i) => {
19409            if i.0 >= model.ellipse_arena.items.len() {
19410                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
19411            }
19412        }
19413        CompoundItemDefinitionRef::ExternallyDefinedHatchStyle(i) => {
19414            if i.0 >= model.externally_defined_hatch_style_arena.items.len() {
19415                return Err(AuthorError::DanglingRef {
19416                    entity: "EXTERNALLY_DEFINED_HATCH_STYLE",
19417                });
19418            }
19419        }
19420        CompoundItemDefinitionRef::ExternallyDefinedTileStyle(i) => {
19421            if i.0 >= model.externally_defined_tile_style_arena.items.len() {
19422                return Err(AuthorError::DanglingRef {
19423                    entity: "EXTERNALLY_DEFINED_TILE_STYLE",
19424                });
19425            }
19426        }
19427        CompoundItemDefinitionRef::Face(i) => {
19428            if i.0 >= model.face_arena.items.len() {
19429                return Err(AuthorError::DanglingRef { entity: "FACE" });
19430            }
19431        }
19432        CompoundItemDefinitionRef::FaceBound(i) => {
19433            if i.0 >= model.face_bound_arena.items.len() {
19434                return Err(AuthorError::DanglingRef {
19435                    entity: "FACE_BOUND",
19436                });
19437            }
19438        }
19439        CompoundItemDefinitionRef::FaceOuterBound(i) => {
19440            if i.0 >= model.face_outer_bound_arena.items.len() {
19441                return Err(AuthorError::DanglingRef {
19442                    entity: "FACE_OUTER_BOUND",
19443                });
19444            }
19445        }
19446        CompoundItemDefinitionRef::FaceSurface(i) => {
19447            if i.0 >= model.face_surface_arena.items.len() {
19448                return Err(AuthorError::DanglingRef {
19449                    entity: "FACE_SURFACE",
19450                });
19451            }
19452        }
19453        CompoundItemDefinitionRef::FillAreaStyleHatching(i) => {
19454            if i.0 >= model.fill_area_style_hatching_arena.items.len() {
19455                return Err(AuthorError::DanglingRef {
19456                    entity: "FILL_AREA_STYLE_HATCHING",
19457                });
19458            }
19459        }
19460        CompoundItemDefinitionRef::FillAreaStyleTileColouredRegion(i) => {
19461            if i.0 >= model.fill_area_style_tile_coloured_region_arena.items.len() {
19462                return Err(AuthorError::DanglingRef {
19463                    entity: "FILL_AREA_STYLE_TILE_COLOURED_REGION",
19464                });
19465            }
19466        }
19467        CompoundItemDefinitionRef::FillAreaStyleTileCurveWithStyle(i) => {
19468            if i.0
19469                >= model
19470                    .fill_area_style_tile_curve_with_style_arena
19471                    .items
19472                    .len()
19473            {
19474                return Err(AuthorError::DanglingRef {
19475                    entity: "FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE",
19476                });
19477            }
19478        }
19479        CompoundItemDefinitionRef::FillAreaStyleTileSymbolWithStyle(i) => {
19480            if i.0
19481                >= model
19482                    .fill_area_style_tile_symbol_with_style_arena
19483                    .items
19484                    .len()
19485            {
19486                return Err(AuthorError::DanglingRef {
19487                    entity: "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE",
19488                });
19489            }
19490        }
19491        CompoundItemDefinitionRef::FillAreaStyleTiles(i) => {
19492            if i.0 >= model.fill_area_style_tiles_arena.items.len() {
19493                return Err(AuthorError::DanglingRef {
19494                    entity: "FILL_AREA_STYLE_TILES",
19495                });
19496            }
19497        }
19498        CompoundItemDefinitionRef::GeometricCurveSet(i) => {
19499            if i.0 >= model.geometric_curve_set_arena.items.len() {
19500                return Err(AuthorError::DanglingRef {
19501                    entity: "GEOMETRIC_CURVE_SET",
19502                });
19503            }
19504        }
19505        CompoundItemDefinitionRef::GeometricRepresentationItem(i) => {
19506            if i.0 >= model.geometric_representation_item_arena.items.len() {
19507                return Err(AuthorError::DanglingRef {
19508                    entity: "GEOMETRIC_REPRESENTATION_ITEM",
19509                });
19510            }
19511        }
19512        CompoundItemDefinitionRef::GeometricSet(i) => {
19513            if i.0 >= model.geometric_set_arena.items.len() {
19514                return Err(AuthorError::DanglingRef {
19515                    entity: "GEOMETRIC_SET",
19516                });
19517            }
19518        }
19519        CompoundItemDefinitionRef::Hyperbola(i) => {
19520            if i.0 >= model.hyperbola_arena.items.len() {
19521                return Err(AuthorError::DanglingRef {
19522                    entity: "HYPERBOLA",
19523                });
19524            }
19525        }
19526        CompoundItemDefinitionRef::IntegerRepresentationItem(i) => {
19527            if i.0 >= model.integer_representation_item_arena.items.len() {
19528                return Err(AuthorError::DanglingRef {
19529                    entity: "INTEGER_REPRESENTATION_ITEM",
19530                });
19531            }
19532        }
19533        CompoundItemDefinitionRef::IntersectionCurve(i) => {
19534            if i.0 >= model.intersection_curve_arena.items.len() {
19535                return Err(AuthorError::DanglingRef {
19536                    entity: "INTERSECTION_CURVE",
19537                });
19538            }
19539        }
19540        CompoundItemDefinitionRef::LeaderCurve(i) => {
19541            if i.0 >= model.leader_curve_arena.items.len() {
19542                return Err(AuthorError::DanglingRef {
19543                    entity: "LEADER_CURVE",
19544                });
19545            }
19546        }
19547        CompoundItemDefinitionRef::LeaderDirectedCallout(i) => {
19548            if i.0 >= model.leader_directed_callout_arena.items.len() {
19549                return Err(AuthorError::DanglingRef {
19550                    entity: "LEADER_DIRECTED_CALLOUT",
19551                });
19552            }
19553        }
19554        CompoundItemDefinitionRef::LeaderTerminator(i) => {
19555            if i.0 >= model.leader_terminator_arena.items.len() {
19556                return Err(AuthorError::DanglingRef {
19557                    entity: "LEADER_TERMINATOR",
19558                });
19559            }
19560        }
19561        CompoundItemDefinitionRef::Line(i) => {
19562            if i.0 >= model.line_arena.items.len() {
19563                return Err(AuthorError::DanglingRef { entity: "LINE" });
19564            }
19565        }
19566        CompoundItemDefinitionRef::Loop(i) => {
19567            if i.0 >= model.loop_arena.items.len() {
19568                return Err(AuthorError::DanglingRef { entity: "LOOP" });
19569            }
19570        }
19571        CompoundItemDefinitionRef::ManifoldSolidBrep(i) => {
19572            if i.0 >= model.manifold_solid_brep_arena.items.len() {
19573                return Err(AuthorError::DanglingRef {
19574                    entity: "MANIFOLD_SOLID_BREP",
19575                });
19576            }
19577        }
19578        CompoundItemDefinitionRef::MappedItem(i) => {
19579            if i.0 >= model.mapped_item_arena.items.len() {
19580                return Err(AuthorError::DanglingRef {
19581                    entity: "MAPPED_ITEM",
19582                });
19583            }
19584        }
19585        CompoundItemDefinitionRef::MeasureRepresentationItem(i) => {
19586            if i.0 >= model.measure_representation_item_arena.items.len() {
19587                return Err(AuthorError::DanglingRef {
19588                    entity: "MEASURE_REPRESENTATION_ITEM",
19589                });
19590            }
19591        }
19592        CompoundItemDefinitionRef::OffsetSurface(i) => {
19593            if i.0 >= model.offset_surface_arena.items.len() {
19594                return Err(AuthorError::DanglingRef {
19595                    entity: "OFFSET_SURFACE",
19596                });
19597            }
19598        }
19599        CompoundItemDefinitionRef::OneDirectionRepeatFactor(i) => {
19600            if i.0 >= model.one_direction_repeat_factor_arena.items.len() {
19601                return Err(AuthorError::DanglingRef {
19602                    entity: "ONE_DIRECTION_REPEAT_FACTOR",
19603                });
19604            }
19605        }
19606        CompoundItemDefinitionRef::OpenShell(i) => {
19607            if i.0 >= model.open_shell_arena.items.len() {
19608                return Err(AuthorError::DanglingRef {
19609                    entity: "OPEN_SHELL",
19610                });
19611            }
19612        }
19613        CompoundItemDefinitionRef::OrientedClosedShell(i) => {
19614            if i.0 >= model.oriented_closed_shell_arena.items.len() {
19615                return Err(AuthorError::DanglingRef {
19616                    entity: "ORIENTED_CLOSED_SHELL",
19617                });
19618            }
19619        }
19620        CompoundItemDefinitionRef::OrientedEdge(i) => {
19621            if i.0 >= model.oriented_edge_arena.items.len() {
19622                return Err(AuthorError::DanglingRef {
19623                    entity: "ORIENTED_EDGE",
19624                });
19625            }
19626        }
19627        CompoundItemDefinitionRef::OverRidingStyledItem(i) => {
19628            if i.0 >= model.over_riding_styled_item_arena.items.len() {
19629                return Err(AuthorError::DanglingRef {
19630                    entity: "OVER_RIDING_STYLED_ITEM",
19631                });
19632            }
19633        }
19634        CompoundItemDefinitionRef::Path(i) => {
19635            if i.0 >= model.path_arena.items.len() {
19636                return Err(AuthorError::DanglingRef { entity: "PATH" });
19637            }
19638        }
19639        CompoundItemDefinitionRef::Pcurve(i) => {
19640            if i.0 >= model.pcurve_arena.items.len() {
19641                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
19642            }
19643        }
19644        CompoundItemDefinitionRef::Placement(i) => {
19645            if i.0 >= model.placement_arena.items.len() {
19646                return Err(AuthorError::DanglingRef {
19647                    entity: "PLACEMENT",
19648                });
19649            }
19650        }
19651        CompoundItemDefinitionRef::PlanarBox(i) => {
19652            if i.0 >= model.planar_box_arena.items.len() {
19653                return Err(AuthorError::DanglingRef {
19654                    entity: "PLANAR_BOX",
19655                });
19656            }
19657        }
19658        CompoundItemDefinitionRef::PlanarExtent(i) => {
19659            if i.0 >= model.planar_extent_arena.items.len() {
19660                return Err(AuthorError::DanglingRef {
19661                    entity: "PLANAR_EXTENT",
19662                });
19663            }
19664        }
19665        CompoundItemDefinitionRef::Plane(i) => {
19666            if i.0 >= model.plane_arena.items.len() {
19667                return Err(AuthorError::DanglingRef { entity: "PLANE" });
19668            }
19669        }
19670        CompoundItemDefinitionRef::Point(i) => {
19671            if i.0 >= model.point_arena.items.len() {
19672                return Err(AuthorError::DanglingRef { entity: "POINT" });
19673            }
19674        }
19675        CompoundItemDefinitionRef::PolyLoop(i) => {
19676            if i.0 >= model.poly_loop_arena.items.len() {
19677                return Err(AuthorError::DanglingRef {
19678                    entity: "POLY_LOOP",
19679                });
19680            }
19681        }
19682        CompoundItemDefinitionRef::Polyline(i) => {
19683            if i.0 >= model.polyline_arena.items.len() {
19684                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
19685            }
19686        }
19687        CompoundItemDefinitionRef::QualifiedRepresentationItem(i) => {
19688            if i.0 >= model.qualified_representation_item_arena.items.len() {
19689                return Err(AuthorError::DanglingRef {
19690                    entity: "QUALIFIED_REPRESENTATION_ITEM",
19691                });
19692            }
19693        }
19694        CompoundItemDefinitionRef::QuasiUniformCurve(i) => {
19695            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
19696                return Err(AuthorError::DanglingRef {
19697                    entity: "QUASI_UNIFORM_CURVE",
19698                });
19699            }
19700        }
19701        CompoundItemDefinitionRef::QuasiUniformSurface(i) => {
19702            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
19703                return Err(AuthorError::DanglingRef {
19704                    entity: "QUASI_UNIFORM_SURFACE",
19705                });
19706            }
19707        }
19708        CompoundItemDefinitionRef::RationalBSplineCurve(i) => {
19709            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
19710                return Err(AuthorError::DanglingRef {
19711                    entity: "RATIONAL_B_SPLINE_CURVE",
19712                });
19713            }
19714        }
19715        CompoundItemDefinitionRef::RationalBSplineSurface(i) => {
19716            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
19717                return Err(AuthorError::DanglingRef {
19718                    entity: "RATIONAL_B_SPLINE_SURFACE",
19719                });
19720            }
19721        }
19722        CompoundItemDefinitionRef::RealRepresentationItem(i) => {
19723            if i.0 >= model.real_representation_item_arena.items.len() {
19724                return Err(AuthorError::DanglingRef {
19725                    entity: "REAL_REPRESENTATION_ITEM",
19726                });
19727            }
19728        }
19729        CompoundItemDefinitionRef::RepositionedTessellatedItem(i) => {
19730            if i.0 >= model.repositioned_tessellated_item_arena.items.len() {
19731                return Err(AuthorError::DanglingRef {
19732                    entity: "REPOSITIONED_TESSELLATED_ITEM",
19733                });
19734            }
19735        }
19736        CompoundItemDefinitionRef::RepresentationItem(i) => {
19737            if i.0 >= model.representation_item_arena.items.len() {
19738                return Err(AuthorError::DanglingRef {
19739                    entity: "REPRESENTATION_ITEM",
19740                });
19741            }
19742        }
19743        CompoundItemDefinitionRef::SeamCurve(i) => {
19744            if i.0 >= model.seam_curve_arena.items.len() {
19745                return Err(AuthorError::DanglingRef {
19746                    entity: "SEAM_CURVE",
19747                });
19748            }
19749        }
19750        CompoundItemDefinitionRef::ShellBasedSurfaceModel(i) => {
19751            if i.0 >= model.shell_based_surface_model_arena.items.len() {
19752                return Err(AuthorError::DanglingRef {
19753                    entity: "SHELL_BASED_SURFACE_MODEL",
19754                });
19755            }
19756        }
19757        CompoundItemDefinitionRef::SolidModel(i) => {
19758            if i.0 >= model.solid_model_arena.items.len() {
19759                return Err(AuthorError::DanglingRef {
19760                    entity: "SOLID_MODEL",
19761                });
19762            }
19763        }
19764        CompoundItemDefinitionRef::SphericalSurface(i) => {
19765            if i.0 >= model.spherical_surface_arena.items.len() {
19766                return Err(AuthorError::DanglingRef {
19767                    entity: "SPHERICAL_SURFACE",
19768                });
19769            }
19770        }
19771        CompoundItemDefinitionRef::StyledItem(i) => {
19772            if i.0 >= model.styled_item_arena.items.len() {
19773                return Err(AuthorError::DanglingRef {
19774                    entity: "STYLED_ITEM",
19775                });
19776            }
19777        }
19778        CompoundItemDefinitionRef::Surface(i) => {
19779            if i.0 >= model.surface_arena.items.len() {
19780                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
19781            }
19782        }
19783        CompoundItemDefinitionRef::SurfaceCurve(i) => {
19784            if i.0 >= model.surface_curve_arena.items.len() {
19785                return Err(AuthorError::DanglingRef {
19786                    entity: "SURFACE_CURVE",
19787                });
19788            }
19789        }
19790        CompoundItemDefinitionRef::SurfaceOfLinearExtrusion(i) => {
19791            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
19792                return Err(AuthorError::DanglingRef {
19793                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
19794                });
19795            }
19796        }
19797        CompoundItemDefinitionRef::SurfaceOfRevolution(i) => {
19798            if i.0 >= model.surface_of_revolution_arena.items.len() {
19799                return Err(AuthorError::DanglingRef {
19800                    entity: "SURFACE_OF_REVOLUTION",
19801                });
19802            }
19803        }
19804        CompoundItemDefinitionRef::SweptSurface(i) => {
19805            if i.0 >= model.swept_surface_arena.items.len() {
19806                return Err(AuthorError::DanglingRef {
19807                    entity: "SWEPT_SURFACE",
19808                });
19809            }
19810        }
19811        CompoundItemDefinitionRef::SymbolTarget(i) => {
19812            if i.0 >= model.symbol_target_arena.items.len() {
19813                return Err(AuthorError::DanglingRef {
19814                    entity: "SYMBOL_TARGET",
19815                });
19816            }
19817        }
19818        CompoundItemDefinitionRef::TerminatorSymbol(i) => {
19819            if i.0 >= model.terminator_symbol_arena.items.len() {
19820                return Err(AuthorError::DanglingRef {
19821                    entity: "TERMINATOR_SYMBOL",
19822                });
19823            }
19824        }
19825        CompoundItemDefinitionRef::TessellatedAnnotationOccurrence(i) => {
19826            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
19827                return Err(AuthorError::DanglingRef {
19828                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
19829                });
19830            }
19831        }
19832        CompoundItemDefinitionRef::TessellatedCurveSet(i) => {
19833            if i.0 >= model.tessellated_curve_set_arena.items.len() {
19834                return Err(AuthorError::DanglingRef {
19835                    entity: "TESSELLATED_CURVE_SET",
19836                });
19837            }
19838        }
19839        CompoundItemDefinitionRef::TessellatedFace(i) => {
19840            if i.0 >= model.tessellated_face_arena.items.len() {
19841                return Err(AuthorError::DanglingRef {
19842                    entity: "TESSELLATED_FACE",
19843                });
19844            }
19845        }
19846        CompoundItemDefinitionRef::TessellatedGeometricSet(i) => {
19847            if i.0 >= model.tessellated_geometric_set_arena.items.len() {
19848                return Err(AuthorError::DanglingRef {
19849                    entity: "TESSELLATED_GEOMETRIC_SET",
19850                });
19851            }
19852        }
19853        CompoundItemDefinitionRef::TessellatedItem(i) => {
19854            if i.0 >= model.tessellated_item_arena.items.len() {
19855                return Err(AuthorError::DanglingRef {
19856                    entity: "TESSELLATED_ITEM",
19857                });
19858            }
19859        }
19860        CompoundItemDefinitionRef::TessellatedShell(i) => {
19861            if i.0 >= model.tessellated_shell_arena.items.len() {
19862                return Err(AuthorError::DanglingRef {
19863                    entity: "TESSELLATED_SHELL",
19864                });
19865            }
19866        }
19867        CompoundItemDefinitionRef::TessellatedSolid(i) => {
19868            if i.0 >= model.tessellated_solid_arena.items.len() {
19869                return Err(AuthorError::DanglingRef {
19870                    entity: "TESSELLATED_SOLID",
19871                });
19872            }
19873        }
19874        CompoundItemDefinitionRef::TessellatedStructuredItem(i) => {
19875            if i.0 >= model.tessellated_structured_item_arena.items.len() {
19876                return Err(AuthorError::DanglingRef {
19877                    entity: "TESSELLATED_STRUCTURED_ITEM",
19878                });
19879            }
19880        }
19881        CompoundItemDefinitionRef::TessellatedSurfaceSet(i) => {
19882            if i.0 >= model.tessellated_surface_set_arena.items.len() {
19883                return Err(AuthorError::DanglingRef {
19884                    entity: "TESSELLATED_SURFACE_SET",
19885                });
19886            }
19887        }
19888        CompoundItemDefinitionRef::TextLiteral(i) => {
19889            if i.0 >= model.text_literal_arena.items.len() {
19890                return Err(AuthorError::DanglingRef {
19891                    entity: "TEXT_LITERAL",
19892                });
19893            }
19894        }
19895        CompoundItemDefinitionRef::TopologicalRepresentationItem(i) => {
19896            if i.0 >= model.topological_representation_item_arena.items.len() {
19897                return Err(AuthorError::DanglingRef {
19898                    entity: "TOPOLOGICAL_REPRESENTATION_ITEM",
19899                });
19900            }
19901        }
19902        CompoundItemDefinitionRef::ToroidalSurface(i) => {
19903            if i.0 >= model.toroidal_surface_arena.items.len() {
19904                return Err(AuthorError::DanglingRef {
19905                    entity: "TOROIDAL_SURFACE",
19906                });
19907            }
19908        }
19909        CompoundItemDefinitionRef::TrimmedCurve(i) => {
19910            if i.0 >= model.trimmed_curve_arena.items.len() {
19911                return Err(AuthorError::DanglingRef {
19912                    entity: "TRIMMED_CURVE",
19913                });
19914            }
19915        }
19916        CompoundItemDefinitionRef::TwoDirectionRepeatFactor(i) => {
19917            if i.0 >= model.two_direction_repeat_factor_arena.items.len() {
19918                return Err(AuthorError::DanglingRef {
19919                    entity: "TWO_DIRECTION_REPEAT_FACTOR",
19920                });
19921            }
19922        }
19923        CompoundItemDefinitionRef::UniformCurve(i) => {
19924            if i.0 >= model.uniform_curve_arena.items.len() {
19925                return Err(AuthorError::DanglingRef {
19926                    entity: "UNIFORM_CURVE",
19927                });
19928            }
19929        }
19930        CompoundItemDefinitionRef::UniformSurface(i) => {
19931            if i.0 >= model.uniform_surface_arena.items.len() {
19932                return Err(AuthorError::DanglingRef {
19933                    entity: "UNIFORM_SURFACE",
19934                });
19935            }
19936        }
19937        CompoundItemDefinitionRef::ValueRepresentationItem(i) => {
19938            if i.0 >= model.value_representation_item_arena.items.len() {
19939                return Err(AuthorError::DanglingRef {
19940                    entity: "VALUE_REPRESENTATION_ITEM",
19941                });
19942            }
19943        }
19944        CompoundItemDefinitionRef::Vector(i) => {
19945            if i.0 >= model.vector_arena.items.len() {
19946                return Err(AuthorError::DanglingRef { entity: "VECTOR" });
19947            }
19948        }
19949        CompoundItemDefinitionRef::Vertex(i) => {
19950            if i.0 >= model.vertex_arena.items.len() {
19951                return Err(AuthorError::DanglingRef { entity: "VERTEX" });
19952            }
19953        }
19954        CompoundItemDefinitionRef::VertexLoop(i) => {
19955            if i.0 >= model.vertex_loop_arena.items.len() {
19956                return Err(AuthorError::DanglingRef {
19957                    entity: "VERTEX_LOOP",
19958                });
19959            }
19960        }
19961        CompoundItemDefinitionRef::VertexPoint(i) => {
19962            if i.0 >= model.vertex_point_arena.items.len() {
19963                return Err(AuthorError::DanglingRef {
19964                    entity: "VERTEX_POINT",
19965                });
19966            }
19967        }
19968        CompoundItemDefinitionRef::VertexShell(i) => {
19969            if i.0 >= model.vertex_shell_arena.items.len() {
19970                return Err(AuthorError::DanglingRef {
19971                    entity: "VERTEX_SHELL",
19972                });
19973            }
19974        }
19975        CompoundItemDefinitionRef::WireShell(i) => {
19976            if i.0 >= model.wire_shell_arena.items.len() {
19977                return Err(AuthorError::DanglingRef {
19978                    entity: "WIRE_SHELL",
19979                });
19980            }
19981        }
19982        CompoundItemDefinitionRef::ListRepresentationItem(v) => {
19983            for e in v {
19984                check_representation_item_ref(model, e)?;
19985            }
19986        }
19987        CompoundItemDefinitionRef::SetRepresentationItem(v) => {
19988            for e in v {
19989                check_representation_item_ref(model, e)?;
19990            }
19991        }
19992        CompoundItemDefinitionRef::Complex(i) => {
19993            if i.0 >= model.complex_unit_arena.items.len() {
19994                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
19995            }
19996        }
19997    }
19998    Ok(())
19999}
20000fn check_configuration_design_ref(
20001    model: &StepModel,
20002    r: &ConfigurationDesignRef,
20003) -> Result<(), AuthorError> {
20004    match r {
20005        ConfigurationDesignRef::ConfigurationDesign(i) => {
20006            if i.0 >= model.configuration_design_arena.items.len() {
20007                return Err(AuthorError::DanglingRef {
20008                    entity: "CONFIGURATION_DESIGN",
20009                });
20010            }
20011        }
20012    }
20013    Ok(())
20014}
20015fn check_configuration_design_item_ref(
20016    model: &StepModel,
20017    r: &ConfigurationDesignItemRef,
20018) -> Result<(), AuthorError> {
20019    match r {
20020        ConfigurationDesignItemRef::ProductDefinition(i) => {
20021            if i.0 >= model.product_definition_arena.items.len() {
20022                return Err(AuthorError::DanglingRef {
20023                    entity: "PRODUCT_DEFINITION",
20024                });
20025            }
20026        }
20027        ConfigurationDesignItemRef::ProductDefinitionFormation(i) => {
20028            if i.0 >= model.product_definition_formation_arena.items.len() {
20029                return Err(AuthorError::DanglingRef {
20030                    entity: "PRODUCT_DEFINITION_FORMATION",
20031                });
20032            }
20033        }
20034        ConfigurationDesignItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
20035            if i.0
20036                >= model
20037                    .product_definition_formation_with_specified_source_arena
20038                    .items
20039                    .len()
20040            {
20041                return Err(AuthorError::DanglingRef {
20042                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
20043                });
20044            }
20045        }
20046        ConfigurationDesignItemRef::ProductDefinitionOccurrence(i) => {
20047            if i.0 >= model.product_definition_occurrence_arena.items.len() {
20048                return Err(AuthorError::DanglingRef {
20049                    entity: "PRODUCT_DEFINITION_OCCURRENCE",
20050                });
20051            }
20052        }
20053        ConfigurationDesignItemRef::ProductDefinitionWithAssociatedDocuments(i) => {
20054            if i.0
20055                >= model
20056                    .product_definition_with_associated_documents_arena
20057                    .items
20058                    .len()
20059            {
20060                return Err(AuthorError::DanglingRef {
20061                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
20062                });
20063            }
20064        }
20065        ConfigurationDesignItemRef::Complex(i) => {
20066            if i.0 >= model.complex_unit_arena.items.len() {
20067                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20068            }
20069        }
20070    }
20071    Ok(())
20072}
20073fn check_configuration_item_ref(
20074    model: &StepModel,
20075    r: &ConfigurationItemRef,
20076) -> Result<(), AuthorError> {
20077    match r {
20078        ConfigurationItemRef::ConfigurationItem(i) => {
20079            if i.0 >= model.configuration_item_arena.items.len() {
20080                return Err(AuthorError::DanglingRef {
20081                    entity: "CONFIGURATION_ITEM",
20082                });
20083            }
20084        }
20085        ConfigurationItemRef::Complex(i) => {
20086            if i.0 >= model.complex_unit_arena.items.len() {
20087                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20088            }
20089        }
20090    }
20091    Ok(())
20092}
20093fn check_connected_face_set_ref(
20094    model: &StepModel,
20095    r: &ConnectedFaceSetRef,
20096) -> Result<(), AuthorError> {
20097    match r {
20098        ConnectedFaceSetRef::ClosedShell(i) => {
20099            if i.0 >= model.closed_shell_arena.items.len() {
20100                return Err(AuthorError::DanglingRef {
20101                    entity: "CLOSED_SHELL",
20102                });
20103            }
20104        }
20105        ConnectedFaceSetRef::ConnectedFaceSet(i) => {
20106            if i.0 >= model.connected_face_set_arena.items.len() {
20107                return Err(AuthorError::DanglingRef {
20108                    entity: "CONNECTED_FACE_SET",
20109                });
20110            }
20111        }
20112        ConnectedFaceSetRef::OpenShell(i) => {
20113            if i.0 >= model.open_shell_arena.items.len() {
20114                return Err(AuthorError::DanglingRef {
20115                    entity: "OPEN_SHELL",
20116                });
20117            }
20118        }
20119        ConnectedFaceSetRef::OrientedClosedShell(i) => {
20120            if i.0 >= model.oriented_closed_shell_arena.items.len() {
20121                return Err(AuthorError::DanglingRef {
20122                    entity: "ORIENTED_CLOSED_SHELL",
20123                });
20124            }
20125        }
20126        ConnectedFaceSetRef::Complex(i) => {
20127            if i.0 >= model.complex_unit_arena.items.len() {
20128                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20129            }
20130        }
20131    }
20132    Ok(())
20133}
20134fn check_constructive_geometry_representation_or_shape_representation_ref(
20135    model: &StepModel,
20136    r: &ConstructiveGeometryRepresentationOrShapeRepresentationRef,
20137) -> Result<(), AuthorError> {
20138    match r {
20139        ConstructiveGeometryRepresentationOrShapeRepresentationRef::AdvancedBrepShapeRepresentation(i) => { if i.0 >= model.advanced_brep_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ADVANCED_BREP_SHAPE_REPRESENTATION" }); } }
20140        ConstructiveGeometryRepresentationOrShapeRepresentationRef::ConstructiveGeometryRepresentation(i) => { if i.0 >= model.constructive_geometry_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION" }); } }
20141        ConstructiveGeometryRepresentationOrShapeRepresentationRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => { if i.0 >= model.geometrically_bounded_surface_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION" }); } }
20142        ConstructiveGeometryRepresentationOrShapeRepresentationRef::GeometricallyBoundedWireframeShapeRepresentation(i) => { if i.0 >= model.geometrically_bounded_wireframe_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION" }); } }
20143        ConstructiveGeometryRepresentationOrShapeRepresentationRef::ManifoldSurfaceShapeRepresentation(i) => { if i.0 >= model.manifold_surface_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION" }); } }
20144        ConstructiveGeometryRepresentationOrShapeRepresentationRef::ShapeDimensionRepresentation(i) => { if i.0 >= model.shape_dimension_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SHAPE_DIMENSION_REPRESENTATION" }); } }
20145        ConstructiveGeometryRepresentationOrShapeRepresentationRef::ShapeRepresentation(i) => { if i.0 >= model.shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SHAPE_REPRESENTATION" }); } }
20146        ConstructiveGeometryRepresentationOrShapeRepresentationRef::ShapeRepresentationWithParameters(i) => { if i.0 >= model.shape_representation_with_parameters_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS" }); } }
20147        ConstructiveGeometryRepresentationOrShapeRepresentationRef::TessellatedShapeRepresentation(i) => { if i.0 >= model.tessellated_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TESSELLATED_SHAPE_REPRESENTATION" }); } }
20148        ConstructiveGeometryRepresentationOrShapeRepresentationRef::Complex(i) => { if i.0 >= model.complex_unit_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "COMPLEX" }); } }
20149    }
20150    Ok(())
20151}
20152fn check_contract_type_ref(model: &StepModel, r: &ContractTypeRef) -> Result<(), AuthorError> {
20153    match r {
20154        ContractTypeRef::ContractType(i) => {
20155            if i.0 >= model.contract_type_arena.items.len() {
20156                return Err(AuthorError::DanglingRef {
20157                    entity: "CONTRACT_TYPE",
20158                });
20159            }
20160        }
20161    }
20162    Ok(())
20163}
20164fn check_coordinated_universal_time_offset_ref(
20165    model: &StepModel,
20166    r: &CoordinatedUniversalTimeOffsetRef,
20167) -> Result<(), AuthorError> {
20168    match r {
20169        CoordinatedUniversalTimeOffsetRef::CoordinatedUniversalTimeOffset(i) => {
20170            if i.0 >= model.coordinated_universal_time_offset_arena.items.len() {
20171                return Err(AuthorError::DanglingRef {
20172                    entity: "COORDINATED_UNIVERSAL_TIME_OFFSET",
20173                });
20174            }
20175        }
20176    }
20177    Ok(())
20178}
20179fn check_coordinates_list_ref(
20180    model: &StepModel,
20181    r: &CoordinatesListRef,
20182) -> Result<(), AuthorError> {
20183    match r {
20184        CoordinatesListRef::CoordinatesList(i) => {
20185            if i.0 >= model.coordinates_list_arena.items.len() {
20186                return Err(AuthorError::DanglingRef {
20187                    entity: "COORDINATES_LIST",
20188                });
20189            }
20190        }
20191    }
20192    Ok(())
20193}
20194fn check_curve_ref(model: &StepModel, r: &CurveRef) -> Result<(), AuthorError> {
20195    match r {
20196        CurveRef::BSplineCurve(i) => {
20197            if i.0 >= model.b_spline_curve_arena.items.len() {
20198                return Err(AuthorError::DanglingRef {
20199                    entity: "B_SPLINE_CURVE",
20200                });
20201            }
20202        }
20203        CurveRef::BSplineCurveWithKnots(i) => {
20204            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
20205                return Err(AuthorError::DanglingRef {
20206                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
20207                });
20208            }
20209        }
20210        CurveRef::BezierCurve(i) => {
20211            if i.0 >= model.bezier_curve_arena.items.len() {
20212                return Err(AuthorError::DanglingRef {
20213                    entity: "BEZIER_CURVE",
20214                });
20215            }
20216        }
20217        CurveRef::BoundedCurve(i) => {
20218            if i.0 >= model.bounded_curve_arena.items.len() {
20219                return Err(AuthorError::DanglingRef {
20220                    entity: "BOUNDED_CURVE",
20221                });
20222            }
20223        }
20224        CurveRef::BoundedPcurve(i) => {
20225            if i.0 >= model.bounded_pcurve_arena.items.len() {
20226                return Err(AuthorError::DanglingRef {
20227                    entity: "BOUNDED_PCURVE",
20228                });
20229            }
20230        }
20231        CurveRef::BoundedSurfaceCurve(i) => {
20232            if i.0 >= model.bounded_surface_curve_arena.items.len() {
20233                return Err(AuthorError::DanglingRef {
20234                    entity: "BOUNDED_SURFACE_CURVE",
20235                });
20236            }
20237        }
20238        CurveRef::Circle(i) => {
20239            if i.0 >= model.circle_arena.items.len() {
20240                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
20241            }
20242        }
20243        CurveRef::CompositeCurve(i) => {
20244            if i.0 >= model.composite_curve_arena.items.len() {
20245                return Err(AuthorError::DanglingRef {
20246                    entity: "COMPOSITE_CURVE",
20247                });
20248            }
20249        }
20250        CurveRef::Conic(i) => {
20251            if i.0 >= model.conic_arena.items.len() {
20252                return Err(AuthorError::DanglingRef { entity: "CONIC" });
20253            }
20254        }
20255        CurveRef::Curve(i) => {
20256            if i.0 >= model.curve_arena.items.len() {
20257                return Err(AuthorError::DanglingRef { entity: "CURVE" });
20258            }
20259        }
20260        CurveRef::Ellipse(i) => {
20261            if i.0 >= model.ellipse_arena.items.len() {
20262                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
20263            }
20264        }
20265        CurveRef::Hyperbola(i) => {
20266            if i.0 >= model.hyperbola_arena.items.len() {
20267                return Err(AuthorError::DanglingRef {
20268                    entity: "HYPERBOLA",
20269                });
20270            }
20271        }
20272        CurveRef::IntersectionCurve(i) => {
20273            if i.0 >= model.intersection_curve_arena.items.len() {
20274                return Err(AuthorError::DanglingRef {
20275                    entity: "INTERSECTION_CURVE",
20276                });
20277            }
20278        }
20279        CurveRef::Line(i) => {
20280            if i.0 >= model.line_arena.items.len() {
20281                return Err(AuthorError::DanglingRef { entity: "LINE" });
20282            }
20283        }
20284        CurveRef::Pcurve(i) => {
20285            if i.0 >= model.pcurve_arena.items.len() {
20286                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
20287            }
20288        }
20289        CurveRef::Polyline(i) => {
20290            if i.0 >= model.polyline_arena.items.len() {
20291                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
20292            }
20293        }
20294        CurveRef::QuasiUniformCurve(i) => {
20295            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
20296                return Err(AuthorError::DanglingRef {
20297                    entity: "QUASI_UNIFORM_CURVE",
20298                });
20299            }
20300        }
20301        CurveRef::RationalBSplineCurve(i) => {
20302            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
20303                return Err(AuthorError::DanglingRef {
20304                    entity: "RATIONAL_B_SPLINE_CURVE",
20305                });
20306            }
20307        }
20308        CurveRef::SeamCurve(i) => {
20309            if i.0 >= model.seam_curve_arena.items.len() {
20310                return Err(AuthorError::DanglingRef {
20311                    entity: "SEAM_CURVE",
20312                });
20313            }
20314        }
20315        CurveRef::SurfaceCurve(i) => {
20316            if i.0 >= model.surface_curve_arena.items.len() {
20317                return Err(AuthorError::DanglingRef {
20318                    entity: "SURFACE_CURVE",
20319                });
20320            }
20321        }
20322        CurveRef::TrimmedCurve(i) => {
20323            if i.0 >= model.trimmed_curve_arena.items.len() {
20324                return Err(AuthorError::DanglingRef {
20325                    entity: "TRIMMED_CURVE",
20326                });
20327            }
20328        }
20329        CurveRef::UniformCurve(i) => {
20330            if i.0 >= model.uniform_curve_arena.items.len() {
20331                return Err(AuthorError::DanglingRef {
20332                    entity: "UNIFORM_CURVE",
20333                });
20334            }
20335        }
20336        CurveRef::Complex(i) => {
20337            if i.0 >= model.complex_unit_arena.items.len() {
20338                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20339            }
20340        }
20341    }
20342    Ok(())
20343}
20344fn check_curve_font_or_scaled_curve_font_select_ref(
20345    model: &StepModel,
20346    r: &CurveFontOrScaledCurveFontSelectRef,
20347) -> Result<(), AuthorError> {
20348    match r {
20349        CurveFontOrScaledCurveFontSelectRef::CurveStyleFont(i) => {
20350            if i.0 >= model.curve_style_font_arena.items.len() {
20351                return Err(AuthorError::DanglingRef {
20352                    entity: "CURVE_STYLE_FONT",
20353                });
20354            }
20355        }
20356        CurveFontOrScaledCurveFontSelectRef::CurveStyleFontAndScaling(i) => {
20357            if i.0 >= model.curve_style_font_and_scaling_arena.items.len() {
20358                return Err(AuthorError::DanglingRef {
20359                    entity: "CURVE_STYLE_FONT_AND_SCALING",
20360                });
20361            }
20362        }
20363        CurveFontOrScaledCurveFontSelectRef::DraughtingPreDefinedCurveFont(i) => {
20364            if i.0 >= model.draughting_pre_defined_curve_font_arena.items.len() {
20365                return Err(AuthorError::DanglingRef {
20366                    entity: "DRAUGHTING_PRE_DEFINED_CURVE_FONT",
20367                });
20368            }
20369        }
20370        CurveFontOrScaledCurveFontSelectRef::ExternallyDefinedCurveFont(i) => {
20371            if i.0 >= model.externally_defined_curve_font_arena.items.len() {
20372                return Err(AuthorError::DanglingRef {
20373                    entity: "EXTERNALLY_DEFINED_CURVE_FONT",
20374                });
20375            }
20376        }
20377        CurveFontOrScaledCurveFontSelectRef::PreDefinedCurveFont(i) => {
20378            if i.0 >= model.pre_defined_curve_font_arena.items.len() {
20379                return Err(AuthorError::DanglingRef {
20380                    entity: "PRE_DEFINED_CURVE_FONT",
20381                });
20382            }
20383        }
20384        CurveFontOrScaledCurveFontSelectRef::Complex(i) => {
20385            if i.0 >= model.complex_unit_arena.items.len() {
20386                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20387            }
20388        }
20389    }
20390    Ok(())
20391}
20392fn check_curve_or_annotation_curve_occurrence_ref(
20393    model: &StepModel,
20394    r: &CurveOrAnnotationCurveOccurrenceRef,
20395) -> Result<(), AuthorError> {
20396    match r {
20397        CurveOrAnnotationCurveOccurrenceRef::AnnotationCurveOccurrence(i) => {
20398            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
20399                return Err(AuthorError::DanglingRef {
20400                    entity: "ANNOTATION_CURVE_OCCURRENCE",
20401                });
20402            }
20403        }
20404        CurveOrAnnotationCurveOccurrenceRef::BSplineCurve(i) => {
20405            if i.0 >= model.b_spline_curve_arena.items.len() {
20406                return Err(AuthorError::DanglingRef {
20407                    entity: "B_SPLINE_CURVE",
20408                });
20409            }
20410        }
20411        CurveOrAnnotationCurveOccurrenceRef::BSplineCurveWithKnots(i) => {
20412            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
20413                return Err(AuthorError::DanglingRef {
20414                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
20415                });
20416            }
20417        }
20418        CurveOrAnnotationCurveOccurrenceRef::BezierCurve(i) => {
20419            if i.0 >= model.bezier_curve_arena.items.len() {
20420                return Err(AuthorError::DanglingRef {
20421                    entity: "BEZIER_CURVE",
20422                });
20423            }
20424        }
20425        CurveOrAnnotationCurveOccurrenceRef::BoundedCurve(i) => {
20426            if i.0 >= model.bounded_curve_arena.items.len() {
20427                return Err(AuthorError::DanglingRef {
20428                    entity: "BOUNDED_CURVE",
20429                });
20430            }
20431        }
20432        CurveOrAnnotationCurveOccurrenceRef::BoundedPcurve(i) => {
20433            if i.0 >= model.bounded_pcurve_arena.items.len() {
20434                return Err(AuthorError::DanglingRef {
20435                    entity: "BOUNDED_PCURVE",
20436                });
20437            }
20438        }
20439        CurveOrAnnotationCurveOccurrenceRef::BoundedSurfaceCurve(i) => {
20440            if i.0 >= model.bounded_surface_curve_arena.items.len() {
20441                return Err(AuthorError::DanglingRef {
20442                    entity: "BOUNDED_SURFACE_CURVE",
20443                });
20444            }
20445        }
20446        CurveOrAnnotationCurveOccurrenceRef::Circle(i) => {
20447            if i.0 >= model.circle_arena.items.len() {
20448                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
20449            }
20450        }
20451        CurveOrAnnotationCurveOccurrenceRef::CompositeCurve(i) => {
20452            if i.0 >= model.composite_curve_arena.items.len() {
20453                return Err(AuthorError::DanglingRef {
20454                    entity: "COMPOSITE_CURVE",
20455                });
20456            }
20457        }
20458        CurveOrAnnotationCurveOccurrenceRef::Conic(i) => {
20459            if i.0 >= model.conic_arena.items.len() {
20460                return Err(AuthorError::DanglingRef { entity: "CONIC" });
20461            }
20462        }
20463        CurveOrAnnotationCurveOccurrenceRef::Curve(i) => {
20464            if i.0 >= model.curve_arena.items.len() {
20465                return Err(AuthorError::DanglingRef { entity: "CURVE" });
20466            }
20467        }
20468        CurveOrAnnotationCurveOccurrenceRef::Ellipse(i) => {
20469            if i.0 >= model.ellipse_arena.items.len() {
20470                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
20471            }
20472        }
20473        CurveOrAnnotationCurveOccurrenceRef::Hyperbola(i) => {
20474            if i.0 >= model.hyperbola_arena.items.len() {
20475                return Err(AuthorError::DanglingRef {
20476                    entity: "HYPERBOLA",
20477                });
20478            }
20479        }
20480        CurveOrAnnotationCurveOccurrenceRef::IntersectionCurve(i) => {
20481            if i.0 >= model.intersection_curve_arena.items.len() {
20482                return Err(AuthorError::DanglingRef {
20483                    entity: "INTERSECTION_CURVE",
20484                });
20485            }
20486        }
20487        CurveOrAnnotationCurveOccurrenceRef::LeaderCurve(i) => {
20488            if i.0 >= model.leader_curve_arena.items.len() {
20489                return Err(AuthorError::DanglingRef {
20490                    entity: "LEADER_CURVE",
20491                });
20492            }
20493        }
20494        CurveOrAnnotationCurveOccurrenceRef::Line(i) => {
20495            if i.0 >= model.line_arena.items.len() {
20496                return Err(AuthorError::DanglingRef { entity: "LINE" });
20497            }
20498        }
20499        CurveOrAnnotationCurveOccurrenceRef::Pcurve(i) => {
20500            if i.0 >= model.pcurve_arena.items.len() {
20501                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
20502            }
20503        }
20504        CurveOrAnnotationCurveOccurrenceRef::Polyline(i) => {
20505            if i.0 >= model.polyline_arena.items.len() {
20506                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
20507            }
20508        }
20509        CurveOrAnnotationCurveOccurrenceRef::QuasiUniformCurve(i) => {
20510            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
20511                return Err(AuthorError::DanglingRef {
20512                    entity: "QUASI_UNIFORM_CURVE",
20513                });
20514            }
20515        }
20516        CurveOrAnnotationCurveOccurrenceRef::RationalBSplineCurve(i) => {
20517            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
20518                return Err(AuthorError::DanglingRef {
20519                    entity: "RATIONAL_B_SPLINE_CURVE",
20520                });
20521            }
20522        }
20523        CurveOrAnnotationCurveOccurrenceRef::SeamCurve(i) => {
20524            if i.0 >= model.seam_curve_arena.items.len() {
20525                return Err(AuthorError::DanglingRef {
20526                    entity: "SEAM_CURVE",
20527                });
20528            }
20529        }
20530        CurveOrAnnotationCurveOccurrenceRef::SurfaceCurve(i) => {
20531            if i.0 >= model.surface_curve_arena.items.len() {
20532                return Err(AuthorError::DanglingRef {
20533                    entity: "SURFACE_CURVE",
20534                });
20535            }
20536        }
20537        CurveOrAnnotationCurveOccurrenceRef::TrimmedCurve(i) => {
20538            if i.0 >= model.trimmed_curve_arena.items.len() {
20539                return Err(AuthorError::DanglingRef {
20540                    entity: "TRIMMED_CURVE",
20541                });
20542            }
20543        }
20544        CurveOrAnnotationCurveOccurrenceRef::UniformCurve(i) => {
20545            if i.0 >= model.uniform_curve_arena.items.len() {
20546                return Err(AuthorError::DanglingRef {
20547                    entity: "UNIFORM_CURVE",
20548                });
20549            }
20550        }
20551        CurveOrAnnotationCurveOccurrenceRef::Complex(i) => {
20552            if i.0 >= model.complex_unit_arena.items.len() {
20553                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20554            }
20555        }
20556    }
20557    Ok(())
20558}
20559fn check_curve_or_curve_set_ref(
20560    model: &StepModel,
20561    r: &CurveOrCurveSetRef,
20562) -> Result<(), AuthorError> {
20563    match r {
20564        CurveOrCurveSetRef::BSplineCurve(i) => {
20565            if i.0 >= model.b_spline_curve_arena.items.len() {
20566                return Err(AuthorError::DanglingRef {
20567                    entity: "B_SPLINE_CURVE",
20568                });
20569            }
20570        }
20571        CurveOrCurveSetRef::BSplineCurveWithKnots(i) => {
20572            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
20573                return Err(AuthorError::DanglingRef {
20574                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
20575                });
20576            }
20577        }
20578        CurveOrCurveSetRef::BezierCurve(i) => {
20579            if i.0 >= model.bezier_curve_arena.items.len() {
20580                return Err(AuthorError::DanglingRef {
20581                    entity: "BEZIER_CURVE",
20582                });
20583            }
20584        }
20585        CurveOrCurveSetRef::BoundedCurve(i) => {
20586            if i.0 >= model.bounded_curve_arena.items.len() {
20587                return Err(AuthorError::DanglingRef {
20588                    entity: "BOUNDED_CURVE",
20589                });
20590            }
20591        }
20592        CurveOrCurveSetRef::BoundedPcurve(i) => {
20593            if i.0 >= model.bounded_pcurve_arena.items.len() {
20594                return Err(AuthorError::DanglingRef {
20595                    entity: "BOUNDED_PCURVE",
20596                });
20597            }
20598        }
20599        CurveOrCurveSetRef::BoundedSurfaceCurve(i) => {
20600            if i.0 >= model.bounded_surface_curve_arena.items.len() {
20601                return Err(AuthorError::DanglingRef {
20602                    entity: "BOUNDED_SURFACE_CURVE",
20603                });
20604            }
20605        }
20606        CurveOrCurveSetRef::Circle(i) => {
20607            if i.0 >= model.circle_arena.items.len() {
20608                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
20609            }
20610        }
20611        CurveOrCurveSetRef::CompositeCurve(i) => {
20612            if i.0 >= model.composite_curve_arena.items.len() {
20613                return Err(AuthorError::DanglingRef {
20614                    entity: "COMPOSITE_CURVE",
20615                });
20616            }
20617        }
20618        CurveOrCurveSetRef::Conic(i) => {
20619            if i.0 >= model.conic_arena.items.len() {
20620                return Err(AuthorError::DanglingRef { entity: "CONIC" });
20621            }
20622        }
20623        CurveOrCurveSetRef::Curve(i) => {
20624            if i.0 >= model.curve_arena.items.len() {
20625                return Err(AuthorError::DanglingRef { entity: "CURVE" });
20626            }
20627        }
20628        CurveOrCurveSetRef::Ellipse(i) => {
20629            if i.0 >= model.ellipse_arena.items.len() {
20630                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
20631            }
20632        }
20633        CurveOrCurveSetRef::GeometricCurveSet(i) => {
20634            if i.0 >= model.geometric_curve_set_arena.items.len() {
20635                return Err(AuthorError::DanglingRef {
20636                    entity: "GEOMETRIC_CURVE_SET",
20637                });
20638            }
20639        }
20640        CurveOrCurveSetRef::Hyperbola(i) => {
20641            if i.0 >= model.hyperbola_arena.items.len() {
20642                return Err(AuthorError::DanglingRef {
20643                    entity: "HYPERBOLA",
20644                });
20645            }
20646        }
20647        CurveOrCurveSetRef::IntersectionCurve(i) => {
20648            if i.0 >= model.intersection_curve_arena.items.len() {
20649                return Err(AuthorError::DanglingRef {
20650                    entity: "INTERSECTION_CURVE",
20651                });
20652            }
20653        }
20654        CurveOrCurveSetRef::Line(i) => {
20655            if i.0 >= model.line_arena.items.len() {
20656                return Err(AuthorError::DanglingRef { entity: "LINE" });
20657            }
20658        }
20659        CurveOrCurveSetRef::Pcurve(i) => {
20660            if i.0 >= model.pcurve_arena.items.len() {
20661                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
20662            }
20663        }
20664        CurveOrCurveSetRef::Polyline(i) => {
20665            if i.0 >= model.polyline_arena.items.len() {
20666                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
20667            }
20668        }
20669        CurveOrCurveSetRef::QuasiUniformCurve(i) => {
20670            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
20671                return Err(AuthorError::DanglingRef {
20672                    entity: "QUASI_UNIFORM_CURVE",
20673                });
20674            }
20675        }
20676        CurveOrCurveSetRef::RationalBSplineCurve(i) => {
20677            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
20678                return Err(AuthorError::DanglingRef {
20679                    entity: "RATIONAL_B_SPLINE_CURVE",
20680                });
20681            }
20682        }
20683        CurveOrCurveSetRef::SeamCurve(i) => {
20684            if i.0 >= model.seam_curve_arena.items.len() {
20685                return Err(AuthorError::DanglingRef {
20686                    entity: "SEAM_CURVE",
20687                });
20688            }
20689        }
20690        CurveOrCurveSetRef::SurfaceCurve(i) => {
20691            if i.0 >= model.surface_curve_arena.items.len() {
20692                return Err(AuthorError::DanglingRef {
20693                    entity: "SURFACE_CURVE",
20694                });
20695            }
20696        }
20697        CurveOrCurveSetRef::TrimmedCurve(i) => {
20698            if i.0 >= model.trimmed_curve_arena.items.len() {
20699                return Err(AuthorError::DanglingRef {
20700                    entity: "TRIMMED_CURVE",
20701                });
20702            }
20703        }
20704        CurveOrCurveSetRef::UniformCurve(i) => {
20705            if i.0 >= model.uniform_curve_arena.items.len() {
20706                return Err(AuthorError::DanglingRef {
20707                    entity: "UNIFORM_CURVE",
20708                });
20709            }
20710        }
20711        CurveOrCurveSetRef::Complex(i) => {
20712            if i.0 >= model.complex_unit_arena.items.len() {
20713                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20714            }
20715        }
20716    }
20717    Ok(())
20718}
20719fn check_curve_or_render_ref(model: &StepModel, r: &CurveOrRenderRef) -> Result<(), AuthorError> {
20720    match r {
20721        CurveOrRenderRef::CurveStyle(i) => {
20722            if i.0 >= model.curve_style_arena.items.len() {
20723                return Err(AuthorError::DanglingRef {
20724                    entity: "CURVE_STYLE",
20725                });
20726            }
20727        }
20728        CurveOrRenderRef::CurveStyleRendering(i) => {
20729            if i.0 >= model.curve_style_rendering_arena.items.len() {
20730                return Err(AuthorError::DanglingRef {
20731                    entity: "CURVE_STYLE_RENDERING",
20732                });
20733            }
20734        }
20735        CurveOrRenderRef::Complex(i) => {
20736            if i.0 >= model.complex_unit_arena.items.len() {
20737                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20738            }
20739        }
20740    }
20741    Ok(())
20742}
20743fn check_curve_style_ref(model: &StepModel, r: &CurveStyleRef) -> Result<(), AuthorError> {
20744    match r {
20745        CurveStyleRef::CurveStyle(i) => {
20746            if i.0 >= model.curve_style_arena.items.len() {
20747                return Err(AuthorError::DanglingRef {
20748                    entity: "CURVE_STYLE",
20749                });
20750            }
20751        }
20752        CurveStyleRef::Complex(i) => {
20753            if i.0 >= model.complex_unit_arena.items.len() {
20754                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20755            }
20756        }
20757    }
20758    Ok(())
20759}
20760fn check_curve_style_font_pattern_ref(
20761    model: &StepModel,
20762    r: &CurveStyleFontPatternRef,
20763) -> Result<(), AuthorError> {
20764    match r {
20765        CurveStyleFontPatternRef::CurveStyleFontPattern(i) => {
20766            if i.0 >= model.curve_style_font_pattern_arena.items.len() {
20767                return Err(AuthorError::DanglingRef {
20768                    entity: "CURVE_STYLE_FONT_PATTERN",
20769                });
20770            }
20771        }
20772        CurveStyleFontPatternRef::Complex(i) => {
20773            if i.0 >= model.complex_unit_arena.items.len() {
20774                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20775            }
20776        }
20777    }
20778    Ok(())
20779}
20780fn check_curve_style_font_select_ref(
20781    model: &StepModel,
20782    r: &CurveStyleFontSelectRef,
20783) -> Result<(), AuthorError> {
20784    match r {
20785        CurveStyleFontSelectRef::CurveStyleFont(i) => {
20786            if i.0 >= model.curve_style_font_arena.items.len() {
20787                return Err(AuthorError::DanglingRef {
20788                    entity: "CURVE_STYLE_FONT",
20789                });
20790            }
20791        }
20792        CurveStyleFontSelectRef::DraughtingPreDefinedCurveFont(i) => {
20793            if i.0 >= model.draughting_pre_defined_curve_font_arena.items.len() {
20794                return Err(AuthorError::DanglingRef {
20795                    entity: "DRAUGHTING_PRE_DEFINED_CURVE_FONT",
20796                });
20797            }
20798        }
20799        CurveStyleFontSelectRef::ExternallyDefinedCurveFont(i) => {
20800            if i.0 >= model.externally_defined_curve_font_arena.items.len() {
20801                return Err(AuthorError::DanglingRef {
20802                    entity: "EXTERNALLY_DEFINED_CURVE_FONT",
20803                });
20804            }
20805        }
20806        CurveStyleFontSelectRef::PreDefinedCurveFont(i) => {
20807            if i.0 >= model.pre_defined_curve_font_arena.items.len() {
20808                return Err(AuthorError::DanglingRef {
20809                    entity: "PRE_DEFINED_CURVE_FONT",
20810                });
20811            }
20812        }
20813        CurveStyleFontSelectRef::Complex(i) => {
20814            if i.0 >= model.complex_unit_arena.items.len() {
20815                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20816            }
20817        }
20818    }
20819    Ok(())
20820}
20821fn check_date_ref(model: &StepModel, r: &DateRef) -> Result<(), AuthorError> {
20822    match r {
20823        DateRef::CalendarDate(i) => {
20824            if i.0 >= model.calendar_date_arena.items.len() {
20825                return Err(AuthorError::DanglingRef {
20826                    entity: "CALENDAR_DATE",
20827                });
20828            }
20829        }
20830        DateRef::Date(i) => {
20831            if i.0 >= model.date_arena.items.len() {
20832                return Err(AuthorError::DanglingRef { entity: "DATE" });
20833            }
20834        }
20835        DateRef::Complex(i) => {
20836            if i.0 >= model.complex_unit_arena.items.len() {
20837                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20838            }
20839        }
20840    }
20841    Ok(())
20842}
20843fn check_date_and_time_ref(model: &StepModel, r: &DateAndTimeRef) -> Result<(), AuthorError> {
20844    match r {
20845        DateAndTimeRef::DateAndTime(i) => {
20846            if i.0 >= model.date_and_time_arena.items.len() {
20847                return Err(AuthorError::DanglingRef {
20848                    entity: "DATE_AND_TIME",
20849                });
20850            }
20851        }
20852        DateAndTimeRef::Complex(i) => {
20853            if i.0 >= model.complex_unit_arena.items.len() {
20854                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
20855            }
20856        }
20857    }
20858    Ok(())
20859}
20860fn check_date_and_time_item_ref(
20861    model: &StepModel,
20862    r: &DateAndTimeItemRef,
20863) -> Result<(), AuthorError> {
20864    match r {
20865        DateAndTimeItemRef::Action(i) => {
20866            if i.0 >= model.action_arena.items.len() {
20867                return Err(AuthorError::DanglingRef { entity: "ACTION" });
20868            }
20869        }
20870        DateAndTimeItemRef::ActionDirective(i) => {
20871            if i.0 >= model.action_directive_arena.items.len() {
20872                return Err(AuthorError::DanglingRef {
20873                    entity: "ACTION_DIRECTIVE",
20874                });
20875            }
20876        }
20877        DateAndTimeItemRef::ActionMethod(i) => {
20878            if i.0 >= model.action_method_arena.items.len() {
20879                return Err(AuthorError::DanglingRef {
20880                    entity: "ACTION_METHOD",
20881                });
20882            }
20883        }
20884        DateAndTimeItemRef::ActionProperty(i) => {
20885            if i.0 >= model.action_property_arena.items.len() {
20886                return Err(AuthorError::DanglingRef {
20887                    entity: "ACTION_PROPERTY",
20888                });
20889            }
20890        }
20891        DateAndTimeItemRef::ActionRelationship(i) => {
20892            if i.0 >= model.action_relationship_arena.items.len() {
20893                return Err(AuthorError::DanglingRef {
20894                    entity: "ACTION_RELATIONSHIP",
20895                });
20896            }
20897        }
20898        DateAndTimeItemRef::AdvancedBrepShapeRepresentation(i) => {
20899            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
20900                return Err(AuthorError::DanglingRef {
20901                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
20902                });
20903            }
20904        }
20905        DateAndTimeItemRef::AppliedDateAndTimeAssignment(i) => {
20906            if i.0 >= model.applied_date_and_time_assignment_arena.items.len() {
20907                return Err(AuthorError::DanglingRef {
20908                    entity: "APPLIED_DATE_AND_TIME_ASSIGNMENT",
20909                });
20910            }
20911        }
20912        DateAndTimeItemRef::Approval(i) => {
20913            if i.0 >= model.approval_arena.items.len() {
20914                return Err(AuthorError::DanglingRef { entity: "APPROVAL" });
20915            }
20916        }
20917        DateAndTimeItemRef::ApprovalPersonOrganization(i) => {
20918            if i.0 >= model.approval_person_organization_arena.items.len() {
20919                return Err(AuthorError::DanglingRef {
20920                    entity: "APPROVAL_PERSON_ORGANIZATION",
20921                });
20922            }
20923        }
20924        DateAndTimeItemRef::ApprovalStatus(i) => {
20925            if i.0 >= model.approval_status_arena.items.len() {
20926                return Err(AuthorError::DanglingRef {
20927                    entity: "APPROVAL_STATUS",
20928                });
20929            }
20930        }
20931        DateAndTimeItemRef::AscribableState(i) => {
20932            if i.0 >= model.ascribable_state_arena.items.len() {
20933                return Err(AuthorError::DanglingRef {
20934                    entity: "ASCRIBABLE_STATE",
20935                });
20936            }
20937        }
20938        DateAndTimeItemRef::AssemblyComponentUsage(i) => {
20939            if i.0 >= model.assembly_component_usage_arena.items.len() {
20940                return Err(AuthorError::DanglingRef {
20941                    entity: "ASSEMBLY_COMPONENT_USAGE",
20942                });
20943            }
20944        }
20945        DateAndTimeItemRef::CcDesignDateAndTimeAssignment(i) => {
20946            if i.0 >= model.cc_design_date_and_time_assignment_arena.items.len() {
20947                return Err(AuthorError::DanglingRef {
20948                    entity: "CC_DESIGN_DATE_AND_TIME_ASSIGNMENT",
20949                });
20950            }
20951        }
20952        DateAndTimeItemRef::Certification(i) => {
20953            if i.0 >= model.certification_arena.items.len() {
20954                return Err(AuthorError::DanglingRef {
20955                    entity: "CERTIFICATION",
20956                });
20957            }
20958        }
20959        DateAndTimeItemRef::CharacterizedRepresentation(i) => {
20960            if i.0 >= model.characterized_representation_arena.items.len() {
20961                return Err(AuthorError::DanglingRef {
20962                    entity: "CHARACTERIZED_REPRESENTATION",
20963                });
20964            }
20965        }
20966        DateAndTimeItemRef::ConfigurationDesign(i) => {
20967            if i.0 >= model.configuration_design_arena.items.len() {
20968                return Err(AuthorError::DanglingRef {
20969                    entity: "CONFIGURATION_DESIGN",
20970                });
20971            }
20972        }
20973        DateAndTimeItemRef::ConfigurationEffectivity(i) => {
20974            if i.0 >= model.configuration_effectivity_arena.items.len() {
20975                return Err(AuthorError::DanglingRef {
20976                    entity: "CONFIGURATION_EFFECTIVITY",
20977                });
20978            }
20979        }
20980        DateAndTimeItemRef::ConfigurationItem(i) => {
20981            if i.0 >= model.configuration_item_arena.items.len() {
20982                return Err(AuthorError::DanglingRef {
20983                    entity: "CONFIGURATION_ITEM",
20984                });
20985            }
20986        }
20987        DateAndTimeItemRef::ConstructiveGeometryRepresentation(i) => {
20988            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
20989                return Err(AuthorError::DanglingRef {
20990                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
20991                });
20992            }
20993        }
20994        DateAndTimeItemRef::Contract(i) => {
20995            if i.0 >= model.contract_arena.items.len() {
20996                return Err(AuthorError::DanglingRef { entity: "CONTRACT" });
20997            }
20998        }
20999        DateAndTimeItemRef::DateAndTimeAssignment(i) => {
21000            if i.0 >= model.date_and_time_assignment_arena.items.len() {
21001                return Err(AuthorError::DanglingRef {
21002                    entity: "DATE_AND_TIME_ASSIGNMENT",
21003                });
21004            }
21005        }
21006        DateAndTimeItemRef::DefinitionalRepresentation(i) => {
21007            if i.0 >= model.definitional_representation_arena.items.len() {
21008                return Err(AuthorError::DanglingRef {
21009                    entity: "DEFINITIONAL_REPRESENTATION",
21010                });
21011            }
21012        }
21013        DateAndTimeItemRef::DesignContext(i) => {
21014            if i.0 >= model.design_context_arena.items.len() {
21015                return Err(AuthorError::DanglingRef {
21016                    entity: "DESIGN_CONTEXT",
21017                });
21018            }
21019        }
21020        DateAndTimeItemRef::Document(i) => {
21021            if i.0 >= model.document_arena.items.len() {
21022                return Err(AuthorError::DanglingRef { entity: "DOCUMENT" });
21023            }
21024        }
21025        DateAndTimeItemRef::DocumentFile(i) => {
21026            if i.0 >= model.document_file_arena.items.len() {
21027                return Err(AuthorError::DanglingRef {
21028                    entity: "DOCUMENT_FILE",
21029                });
21030            }
21031        }
21032        DateAndTimeItemRef::DraughtingModel(i) => {
21033            if i.0 >= model.draughting_model_arena.items.len() {
21034                return Err(AuthorError::DanglingRef {
21035                    entity: "DRAUGHTING_MODEL",
21036                });
21037            }
21038        }
21039        DateAndTimeItemRef::Effectivity(i) => {
21040            if i.0 >= model.effectivity_arena.items.len() {
21041                return Err(AuthorError::DanglingRef {
21042                    entity: "EFFECTIVITY",
21043                });
21044            }
21045        }
21046        DateAndTimeItemRef::GeneralProperty(i) => {
21047            if i.0 >= model.general_property_arena.items.len() {
21048                return Err(AuthorError::DanglingRef {
21049                    entity: "GENERAL_PROPERTY",
21050                });
21051            }
21052        }
21053        DateAndTimeItemRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
21054            if i.0
21055                >= model
21056                    .geometrically_bounded_surface_shape_representation_arena
21057                    .items
21058                    .len()
21059            {
21060                return Err(AuthorError::DanglingRef {
21061                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
21062                });
21063            }
21064        }
21065        DateAndTimeItemRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
21066            if i.0
21067                >= model
21068                    .geometrically_bounded_wireframe_shape_representation_arena
21069                    .items
21070                    .len()
21071            {
21072                return Err(AuthorError::DanglingRef {
21073                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
21074                });
21075            }
21076        }
21077        DateAndTimeItemRef::MakeFromUsageOption(i) => {
21078            if i.0 >= model.make_from_usage_option_arena.items.len() {
21079                return Err(AuthorError::DanglingRef {
21080                    entity: "MAKE_FROM_USAGE_OPTION",
21081                });
21082            }
21083        }
21084        DateAndTimeItemRef::ManifoldSurfaceShapeRepresentation(i) => {
21085            if i.0
21086                >= model
21087                    .manifold_surface_shape_representation_arena
21088                    .items
21089                    .len()
21090            {
21091                return Err(AuthorError::DanglingRef {
21092                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
21093                });
21094            }
21095        }
21096        DateAndTimeItemRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
21097            if i.0
21098                >= model
21099                    .mechanical_design_geometric_presentation_representation_arena
21100                    .items
21101                    .len()
21102            {
21103                return Err(AuthorError::DanglingRef {
21104                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
21105                });
21106            }
21107        }
21108        DateAndTimeItemRef::MechanicalDesignPresentationRepresentationWithDraughting(i) => {
21109            if i.0
21110                >= model
21111                    .mechanical_design_presentation_representation_with_draughting_arena
21112                    .items
21113                    .len()
21114            {
21115                return Err(AuthorError::DanglingRef {
21116                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
21117                });
21118            }
21119        }
21120        DateAndTimeItemRef::MechanicalDesignShadedPresentationRepresentation(i) => {
21121            if i.0
21122                >= model
21123                    .mechanical_design_shaded_presentation_representation_arena
21124                    .items
21125                    .len()
21126            {
21127                return Err(AuthorError::DanglingRef {
21128                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
21129                });
21130            }
21131        }
21132        DateAndTimeItemRef::NextAssemblyUsageOccurrence(i) => {
21133            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
21134                return Err(AuthorError::DanglingRef {
21135                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
21136                });
21137            }
21138        }
21139        DateAndTimeItemRef::OrganizationRelationship(i) => {
21140            if i.0 >= model.organization_relationship_arena.items.len() {
21141                return Err(AuthorError::DanglingRef {
21142                    entity: "ORGANIZATION_RELATIONSHIP",
21143                });
21144            }
21145        }
21146        DateAndTimeItemRef::OrganizationalAddress(i) => {
21147            if i.0 >= model.organizational_address_arena.items.len() {
21148                return Err(AuthorError::DanglingRef {
21149                    entity: "ORGANIZATIONAL_ADDRESS",
21150                });
21151            }
21152        }
21153        DateAndTimeItemRef::OrganizationalProject(i) => {
21154            if i.0 >= model.organizational_project_arena.items.len() {
21155                return Err(AuthorError::DanglingRef {
21156                    entity: "ORGANIZATIONAL_PROJECT",
21157                });
21158            }
21159        }
21160        DateAndTimeItemRef::Person(i) => {
21161            if i.0 >= model.person_arena.items.len() {
21162                return Err(AuthorError::DanglingRef { entity: "PERSON" });
21163            }
21164        }
21165        DateAndTimeItemRef::PersonAndOrganization(i) => {
21166            if i.0 >= model.person_and_organization_arena.items.len() {
21167                return Err(AuthorError::DanglingRef {
21168                    entity: "PERSON_AND_ORGANIZATION",
21169                });
21170            }
21171        }
21172        DateAndTimeItemRef::PersonAndOrganizationAddress(i) => {
21173            if i.0 >= model.person_and_organization_address_arena.items.len() {
21174                return Err(AuthorError::DanglingRef {
21175                    entity: "PERSON_AND_ORGANIZATION_ADDRESS",
21176                });
21177            }
21178        }
21179        DateAndTimeItemRef::PresentationArea(i) => {
21180            if i.0 >= model.presentation_area_arena.items.len() {
21181                return Err(AuthorError::DanglingRef {
21182                    entity: "PRESENTATION_AREA",
21183                });
21184            }
21185        }
21186        DateAndTimeItemRef::PresentationRepresentation(i) => {
21187            if i.0 >= model.presentation_representation_arena.items.len() {
21188                return Err(AuthorError::DanglingRef {
21189                    entity: "PRESENTATION_REPRESENTATION",
21190                });
21191            }
21192        }
21193        DateAndTimeItemRef::PresentationView(i) => {
21194            if i.0 >= model.presentation_view_arena.items.len() {
21195                return Err(AuthorError::DanglingRef {
21196                    entity: "PRESENTATION_VIEW",
21197                });
21198            }
21199        }
21200        DateAndTimeItemRef::Product(i) => {
21201            if i.0 >= model.product_arena.items.len() {
21202                return Err(AuthorError::DanglingRef { entity: "PRODUCT" });
21203            }
21204        }
21205        DateAndTimeItemRef::ProductConcept(i) => {
21206            if i.0 >= model.product_concept_arena.items.len() {
21207                return Err(AuthorError::DanglingRef {
21208                    entity: "PRODUCT_CONCEPT",
21209                });
21210            }
21211        }
21212        DateAndTimeItemRef::ProductDefinition(i) => {
21213            if i.0 >= model.product_definition_arena.items.len() {
21214                return Err(AuthorError::DanglingRef {
21215                    entity: "PRODUCT_DEFINITION",
21216                });
21217            }
21218        }
21219        DateAndTimeItemRef::ProductDefinitionContext(i) => {
21220            if i.0 >= model.product_definition_context_arena.items.len() {
21221                return Err(AuthorError::DanglingRef {
21222                    entity: "PRODUCT_DEFINITION_CONTEXT",
21223                });
21224            }
21225        }
21226        DateAndTimeItemRef::ProductDefinitionEffectivity(i) => {
21227            if i.0 >= model.product_definition_effectivity_arena.items.len() {
21228                return Err(AuthorError::DanglingRef {
21229                    entity: "PRODUCT_DEFINITION_EFFECTIVITY",
21230                });
21231            }
21232        }
21233        DateAndTimeItemRef::ProductDefinitionFormation(i) => {
21234            if i.0 >= model.product_definition_formation_arena.items.len() {
21235                return Err(AuthorError::DanglingRef {
21236                    entity: "PRODUCT_DEFINITION_FORMATION",
21237                });
21238            }
21239        }
21240        DateAndTimeItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
21241            if i.0
21242                >= model
21243                    .product_definition_formation_with_specified_source_arena
21244                    .items
21245                    .len()
21246            {
21247                return Err(AuthorError::DanglingRef {
21248                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
21249                });
21250            }
21251        }
21252        DateAndTimeItemRef::ProductDefinitionRelationship(i) => {
21253            if i.0 >= model.product_definition_relationship_arena.items.len() {
21254                return Err(AuthorError::DanglingRef {
21255                    entity: "PRODUCT_DEFINITION_RELATIONSHIP",
21256                });
21257            }
21258        }
21259        DateAndTimeItemRef::ProductDefinitionShape(i) => {
21260            if i.0 >= model.product_definition_shape_arena.items.len() {
21261                return Err(AuthorError::DanglingRef {
21262                    entity: "PRODUCT_DEFINITION_SHAPE",
21263                });
21264            }
21265        }
21266        DateAndTimeItemRef::ProductDefinitionUsage(i) => {
21267            if i.0 >= model.product_definition_usage_arena.items.len() {
21268                return Err(AuthorError::DanglingRef {
21269                    entity: "PRODUCT_DEFINITION_USAGE",
21270                });
21271            }
21272        }
21273        DateAndTimeItemRef::ProductDefinitionWithAssociatedDocuments(i) => {
21274            if i.0
21275                >= model
21276                    .product_definition_with_associated_documents_arena
21277                    .items
21278                    .len()
21279            {
21280                return Err(AuthorError::DanglingRef {
21281                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
21282                });
21283            }
21284        }
21285        DateAndTimeItemRef::PropertyDefinition(i) => {
21286            if i.0 >= model.property_definition_arena.items.len() {
21287                return Err(AuthorError::DanglingRef {
21288                    entity: "PROPERTY_DEFINITION",
21289                });
21290            }
21291        }
21292        DateAndTimeItemRef::PropertyDefinitionRepresentation(i) => {
21293            if i.0 >= model.property_definition_representation_arena.items.len() {
21294                return Err(AuthorError::DanglingRef {
21295                    entity: "PROPERTY_DEFINITION_REPRESENTATION",
21296                });
21297            }
21298        }
21299        DateAndTimeItemRef::Representation(i) => {
21300            if i.0 >= model.representation_arena.items.len() {
21301                return Err(AuthorError::DanglingRef {
21302                    entity: "REPRESENTATION",
21303                });
21304            }
21305        }
21306        DateAndTimeItemRef::ResourceProperty(i) => {
21307            if i.0 >= model.resource_property_arena.items.len() {
21308                return Err(AuthorError::DanglingRef {
21309                    entity: "RESOURCE_PROPERTY",
21310                });
21311            }
21312        }
21313        DateAndTimeItemRef::SecurityClassification(i) => {
21314            if i.0 >= model.security_classification_arena.items.len() {
21315                return Err(AuthorError::DanglingRef {
21316                    entity: "SECURITY_CLASSIFICATION",
21317                });
21318            }
21319        }
21320        DateAndTimeItemRef::SecurityClassificationLevel(i) => {
21321            if i.0 >= model.security_classification_level_arena.items.len() {
21322                return Err(AuthorError::DanglingRef {
21323                    entity: "SECURITY_CLASSIFICATION_LEVEL",
21324                });
21325            }
21326        }
21327        DateAndTimeItemRef::ShapeDefinitionRepresentation(i) => {
21328            if i.0 >= model.shape_definition_representation_arena.items.len() {
21329                return Err(AuthorError::DanglingRef {
21330                    entity: "SHAPE_DEFINITION_REPRESENTATION",
21331                });
21332            }
21333        }
21334        DateAndTimeItemRef::ShapeDimensionRepresentation(i) => {
21335            if i.0 >= model.shape_dimension_representation_arena.items.len() {
21336                return Err(AuthorError::DanglingRef {
21337                    entity: "SHAPE_DIMENSION_REPRESENTATION",
21338                });
21339            }
21340        }
21341        DateAndTimeItemRef::ShapeRepresentation(i) => {
21342            if i.0 >= model.shape_representation_arena.items.len() {
21343                return Err(AuthorError::DanglingRef {
21344                    entity: "SHAPE_REPRESENTATION",
21345                });
21346            }
21347        }
21348        DateAndTimeItemRef::ShapeRepresentationWithParameters(i) => {
21349            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
21350                return Err(AuthorError::DanglingRef {
21351                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
21352                });
21353            }
21354        }
21355        DateAndTimeItemRef::StateObserved(i) => {
21356            if i.0 >= model.state_observed_arena.items.len() {
21357                return Err(AuthorError::DanglingRef {
21358                    entity: "STATE_OBSERVED",
21359                });
21360            }
21361        }
21362        DateAndTimeItemRef::StateType(i) => {
21363            if i.0 >= model.state_type_arena.items.len() {
21364                return Err(AuthorError::DanglingRef {
21365                    entity: "STATE_TYPE",
21366                });
21367            }
21368        }
21369        DateAndTimeItemRef::SymbolRepresentation(i) => {
21370            if i.0 >= model.symbol_representation_arena.items.len() {
21371                return Err(AuthorError::DanglingRef {
21372                    entity: "SYMBOL_REPRESENTATION",
21373                });
21374            }
21375        }
21376        DateAndTimeItemRef::TessellatedShapeRepresentation(i) => {
21377            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
21378                return Err(AuthorError::DanglingRef {
21379                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
21380                });
21381            }
21382        }
21383        DateAndTimeItemRef::VersionedActionRequest(i) => {
21384            if i.0 >= model.versioned_action_request_arena.items.len() {
21385                return Err(AuthorError::DanglingRef {
21386                    entity: "VERSIONED_ACTION_REQUEST",
21387                });
21388            }
21389        }
21390        DateAndTimeItemRef::Complex(i) => {
21391            if i.0 >= model.complex_unit_arena.items.len() {
21392                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
21393            }
21394        }
21395    }
21396    Ok(())
21397}
21398fn check_date_time_item_ref(model: &StepModel, r: &DateTimeItemRef) -> Result<(), AuthorError> {
21399    match r {
21400        DateTimeItemRef::ApprovalPersonOrganization(i) => {
21401            if i.0 >= model.approval_person_organization_arena.items.len() {
21402                return Err(AuthorError::DanglingRef {
21403                    entity: "APPROVAL_PERSON_ORGANIZATION",
21404                });
21405            }
21406        }
21407        DateTimeItemRef::Certification(i) => {
21408            if i.0 >= model.certification_arena.items.len() {
21409                return Err(AuthorError::DanglingRef {
21410                    entity: "CERTIFICATION",
21411                });
21412            }
21413        }
21414        DateTimeItemRef::Change(i) => {
21415            if i.0 >= model.change_arena.items.len() {
21416                return Err(AuthorError::DanglingRef { entity: "CHANGE" });
21417            }
21418        }
21419        DateTimeItemRef::ChangeRequest(i) => {
21420            if i.0 >= model.change_request_arena.items.len() {
21421                return Err(AuthorError::DanglingRef {
21422                    entity: "CHANGE_REQUEST",
21423                });
21424            }
21425        }
21426        DateTimeItemRef::Contract(i) => {
21427            if i.0 >= model.contract_arena.items.len() {
21428                return Err(AuthorError::DanglingRef { entity: "CONTRACT" });
21429            }
21430        }
21431        DateTimeItemRef::ProductDefinition(i) => {
21432            if i.0 >= model.product_definition_arena.items.len() {
21433                return Err(AuthorError::DanglingRef {
21434                    entity: "PRODUCT_DEFINITION",
21435                });
21436            }
21437        }
21438        DateTimeItemRef::ProductDefinitionWithAssociatedDocuments(i) => {
21439            if i.0
21440                >= model
21441                    .product_definition_with_associated_documents_arena
21442                    .items
21443                    .len()
21444            {
21445                return Err(AuthorError::DanglingRef {
21446                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
21447                });
21448            }
21449        }
21450        DateTimeItemRef::SecurityClassification(i) => {
21451            if i.0 >= model.security_classification_arena.items.len() {
21452                return Err(AuthorError::DanglingRef {
21453                    entity: "SECURITY_CLASSIFICATION",
21454                });
21455            }
21456        }
21457        DateTimeItemRef::StartRequest(i) => {
21458            if i.0 >= model.start_request_arena.items.len() {
21459                return Err(AuthorError::DanglingRef {
21460                    entity: "START_REQUEST",
21461                });
21462            }
21463        }
21464        DateTimeItemRef::StartWork(i) => {
21465            if i.0 >= model.start_work_arena.items.len() {
21466                return Err(AuthorError::DanglingRef {
21467                    entity: "START_WORK",
21468                });
21469            }
21470        }
21471        DateTimeItemRef::Complex(i) => {
21472            if i.0 >= model.complex_unit_arena.items.len() {
21473                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
21474            }
21475        }
21476    }
21477    Ok(())
21478}
21479fn check_date_time_role_ref(model: &StepModel, r: &DateTimeRoleRef) -> Result<(), AuthorError> {
21480    match r {
21481        DateTimeRoleRef::DateTimeRole(i) => {
21482            if i.0 >= model.date_time_role_arena.items.len() {
21483                return Err(AuthorError::DanglingRef {
21484                    entity: "DATE_TIME_ROLE",
21485                });
21486            }
21487        }
21488    }
21489    Ok(())
21490}
21491fn check_date_time_select_ref(model: &StepModel, r: &DateTimeSelectRef) -> Result<(), AuthorError> {
21492    match r {
21493        DateTimeSelectRef::CalendarDate(i) => {
21494            if i.0 >= model.calendar_date_arena.items.len() {
21495                return Err(AuthorError::DanglingRef {
21496                    entity: "CALENDAR_DATE",
21497                });
21498            }
21499        }
21500        DateTimeSelectRef::Date(i) => {
21501            if i.0 >= model.date_arena.items.len() {
21502                return Err(AuthorError::DanglingRef { entity: "DATE" });
21503            }
21504        }
21505        DateTimeSelectRef::DateAndTime(i) => {
21506            if i.0 >= model.date_and_time_arena.items.len() {
21507                return Err(AuthorError::DanglingRef {
21508                    entity: "DATE_AND_TIME",
21509                });
21510            }
21511        }
21512        DateTimeSelectRef::LocalTime(i) => {
21513            if i.0 >= model.local_time_arena.items.len() {
21514                return Err(AuthorError::DanglingRef {
21515                    entity: "LOCAL_TIME",
21516                });
21517            }
21518        }
21519        DateTimeSelectRef::Complex(i) => {
21520            if i.0 >= model.complex_unit_arena.items.len() {
21521                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
21522            }
21523        }
21524    }
21525    Ok(())
21526}
21527fn check_datum_ref(model: &StepModel, r: &DatumRef) -> Result<(), AuthorError> {
21528    match r {
21529        DatumRef::CommonDatum(i) => {
21530            if i.0 >= model.common_datum_arena.items.len() {
21531                return Err(AuthorError::DanglingRef {
21532                    entity: "COMMON_DATUM",
21533                });
21534            }
21535        }
21536        DatumRef::Datum(i) => {
21537            if i.0 >= model.datum_arena.items.len() {
21538                return Err(AuthorError::DanglingRef { entity: "DATUM" });
21539            }
21540        }
21541        DatumRef::Complex(i) => {
21542            if i.0 >= model.complex_unit_arena.items.len() {
21543                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
21544            }
21545        }
21546    }
21547    Ok(())
21548}
21549fn check_datum_or_common_datum_ref(
21550    model: &StepModel,
21551    r: &DatumOrCommonDatumRef,
21552) -> Result<(), AuthorError> {
21553    match r {
21554        DatumOrCommonDatumRef::CommonDatum(i) => {
21555            if i.0 >= model.common_datum_arena.items.len() {
21556                return Err(AuthorError::DanglingRef {
21557                    entity: "COMMON_DATUM",
21558                });
21559            }
21560        }
21561        DatumOrCommonDatumRef::Datum(i) => {
21562            if i.0 >= model.datum_arena.items.len() {
21563                return Err(AuthorError::DanglingRef { entity: "DATUM" });
21564            }
21565        }
21566        DatumOrCommonDatumRef::DatumReferenceElement(i) => {
21567            if i.0 >= model.datum_reference_element_arena.items.len() {
21568                return Err(AuthorError::DanglingRef {
21569                    entity: "DATUM_REFERENCE_ELEMENT",
21570                });
21571            }
21572        }
21573        DatumOrCommonDatumRef::CommonDatumList(v) => {
21574            for e in v {
21575                check_datum_reference_element_ref(model, e)?;
21576            }
21577        }
21578        DatumOrCommonDatumRef::Complex(i) => {
21579            if i.0 >= model.complex_unit_arena.items.len() {
21580                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
21581            }
21582        }
21583    }
21584    Ok(())
21585}
21586fn check_datum_reference_compartment_ref(
21587    model: &StepModel,
21588    r: &DatumReferenceCompartmentRef,
21589) -> Result<(), AuthorError> {
21590    match r {
21591        DatumReferenceCompartmentRef::DatumReferenceCompartment(i) => {
21592            if i.0 >= model.datum_reference_compartment_arena.items.len() {
21593                return Err(AuthorError::DanglingRef {
21594                    entity: "DATUM_REFERENCE_COMPARTMENT",
21595                });
21596            }
21597        }
21598    }
21599    Ok(())
21600}
21601fn check_datum_reference_element_ref(
21602    model: &StepModel,
21603    r: &DatumReferenceElementRef,
21604) -> Result<(), AuthorError> {
21605    match r {
21606        DatumReferenceElementRef::DatumReferenceElement(i) => {
21607            if i.0 >= model.datum_reference_element_arena.items.len() {
21608                return Err(AuthorError::DanglingRef {
21609                    entity: "DATUM_REFERENCE_ELEMENT",
21610                });
21611            }
21612        }
21613    }
21614    Ok(())
21615}
21616fn check_datum_reference_modifier_ref(
21617    model: &StepModel,
21618    r: &DatumReferenceModifierRef,
21619) -> Result<(), AuthorError> {
21620    match r {
21621        DatumReferenceModifierRef::DatumReferenceModifierWithValue(i) => {
21622            if i.0 >= model.datum_reference_modifier_with_value_arena.items.len() {
21623                return Err(AuthorError::DanglingRef {
21624                    entity: "DATUM_REFERENCE_MODIFIER_WITH_VALUE",
21625                });
21626            }
21627        }
21628        DatumReferenceModifierRef::SimpleDatumReferenceModifier(_) => {}
21629    }
21630    Ok(())
21631}
21632fn check_datum_system_ref(model: &StepModel, r: &DatumSystemRef) -> Result<(), AuthorError> {
21633    match r {
21634        DatumSystemRef::DatumSystem(i) => {
21635            if i.0 >= model.datum_system_arena.items.len() {
21636                return Err(AuthorError::DanglingRef {
21637                    entity: "DATUM_SYSTEM",
21638                });
21639            }
21640        }
21641        DatumSystemRef::Complex(i) => {
21642            if i.0 >= model.complex_unit_arena.items.len() {
21643                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
21644            }
21645        }
21646    }
21647    Ok(())
21648}
21649fn check_datum_system_or_reference_ref(
21650    model: &StepModel,
21651    r: &DatumSystemOrReferenceRef,
21652) -> Result<(), AuthorError> {
21653    match r {
21654        DatumSystemOrReferenceRef::DatumReference(i) => {
21655            if i.0 >= model.datum_reference_arena.items.len() {
21656                return Err(AuthorError::DanglingRef {
21657                    entity: "DATUM_REFERENCE",
21658                });
21659            }
21660        }
21661        DatumSystemOrReferenceRef::DatumSystem(i) => {
21662            if i.0 >= model.datum_system_arena.items.len() {
21663                return Err(AuthorError::DanglingRef {
21664                    entity: "DATUM_SYSTEM",
21665                });
21666            }
21667        }
21668        DatumSystemOrReferenceRef::Complex(i) => {
21669            if i.0 >= model.complex_unit_arena.items.len() {
21670                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
21671            }
21672        }
21673    }
21674    Ok(())
21675}
21676fn check_defined_glyph_select_ref(
21677    model: &StepModel,
21678    r: &DefinedGlyphSelectRef,
21679) -> Result<(), AuthorError> {
21680    match r {
21681        DefinedGlyphSelectRef::ExternallyDefinedCharacterGlyph(i) => {
21682            if i.0 >= model.externally_defined_character_glyph_arena.items.len() {
21683                return Err(AuthorError::DanglingRef {
21684                    entity: "EXTERNALLY_DEFINED_CHARACTER_GLYPH",
21685                });
21686            }
21687        }
21688        DefinedGlyphSelectRef::PreDefinedCharacterGlyph(i) => {
21689            if i.0 >= model.pre_defined_character_glyph_arena.items.len() {
21690                return Err(AuthorError::DanglingRef {
21691                    entity: "PRE_DEFINED_CHARACTER_GLYPH",
21692                });
21693            }
21694        }
21695        DefinedGlyphSelectRef::Complex(i) => {
21696            if i.0 >= model.complex_unit_arena.items.len() {
21697                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
21698            }
21699        }
21700    }
21701    Ok(())
21702}
21703fn check_defined_symbol_select_ref(
21704    model: &StepModel,
21705    r: &DefinedSymbolSelectRef,
21706) -> Result<(), AuthorError> {
21707    match r {
21708        DefinedSymbolSelectRef::ExternallyDefinedSymbol(i) => {
21709            if i.0 >= model.externally_defined_symbol_arena.items.len() {
21710                return Err(AuthorError::DanglingRef {
21711                    entity: "EXTERNALLY_DEFINED_SYMBOL",
21712                });
21713            }
21714        }
21715        DefinedSymbolSelectRef::PreDefinedPointMarkerSymbol(i) => {
21716            if i.0 >= model.pre_defined_point_marker_symbol_arena.items.len() {
21717                return Err(AuthorError::DanglingRef {
21718                    entity: "PRE_DEFINED_POINT_MARKER_SYMBOL",
21719                });
21720            }
21721        }
21722        DefinedSymbolSelectRef::PreDefinedSymbol(i) => {
21723            if i.0 >= model.pre_defined_symbol_arena.items.len() {
21724                return Err(AuthorError::DanglingRef {
21725                    entity: "PRE_DEFINED_SYMBOL",
21726                });
21727            }
21728        }
21729        DefinedSymbolSelectRef::PreDefinedTerminatorSymbol(i) => {
21730            if i.0 >= model.pre_defined_terminator_symbol_arena.items.len() {
21731                return Err(AuthorError::DanglingRef {
21732                    entity: "PRE_DEFINED_TERMINATOR_SYMBOL",
21733                });
21734            }
21735        }
21736        DefinedSymbolSelectRef::Complex(i) => {
21737            if i.0 >= model.complex_unit_arena.items.len() {
21738                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
21739            }
21740        }
21741    }
21742    Ok(())
21743}
21744fn check_definitional_representation_ref(
21745    model: &StepModel,
21746    r: &DefinitionalRepresentationRef,
21747) -> Result<(), AuthorError> {
21748    match r {
21749        DefinitionalRepresentationRef::DefinitionalRepresentation(i) => {
21750            if i.0 >= model.definitional_representation_arena.items.len() {
21751                return Err(AuthorError::DanglingRef {
21752                    entity: "DEFINITIONAL_REPRESENTATION",
21753                });
21754            }
21755        }
21756        DefinitionalRepresentationRef::Complex(i) => {
21757            if i.0 >= model.complex_unit_arena.items.len() {
21758                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
21759            }
21760        }
21761    }
21762    Ok(())
21763}
21764fn check_derived_property_select_ref(
21765    model: &StepModel,
21766    r: &DerivedPropertySelectRef,
21767) -> Result<(), AuthorError> {
21768    match r {
21769        DerivedPropertySelectRef::ActionProperty(i) => {
21770            if i.0 >= model.action_property_arena.items.len() {
21771                return Err(AuthorError::DanglingRef {
21772                    entity: "ACTION_PROPERTY",
21773                });
21774            }
21775        }
21776        DerivedPropertySelectRef::AngularLocation(i) => {
21777            if i.0 >= model.angular_location_arena.items.len() {
21778                return Err(AuthorError::DanglingRef {
21779                    entity: "ANGULAR_LOCATION",
21780                });
21781            }
21782        }
21783        DerivedPropertySelectRef::AngularSize(i) => {
21784            if i.0 >= model.angular_size_arena.items.len() {
21785                return Err(AuthorError::DanglingRef {
21786                    entity: "ANGULAR_SIZE",
21787                });
21788            }
21789        }
21790        DerivedPropertySelectRef::AngularityTolerance(i) => {
21791            if i.0 >= model.angularity_tolerance_arena.items.len() {
21792                return Err(AuthorError::DanglingRef {
21793                    entity: "ANGULARITY_TOLERANCE",
21794                });
21795            }
21796        }
21797        DerivedPropertySelectRef::CircularRunoutTolerance(i) => {
21798            if i.0 >= model.circular_runout_tolerance_arena.items.len() {
21799                return Err(AuthorError::DanglingRef {
21800                    entity: "CIRCULAR_RUNOUT_TOLERANCE",
21801                });
21802            }
21803        }
21804        DerivedPropertySelectRef::CoaxialityTolerance(i) => {
21805            if i.0 >= model.coaxiality_tolerance_arena.items.len() {
21806                return Err(AuthorError::DanglingRef {
21807                    entity: "COAXIALITY_TOLERANCE",
21808                });
21809            }
21810        }
21811        DerivedPropertySelectRef::ConcentricityTolerance(i) => {
21812            if i.0 >= model.concentricity_tolerance_arena.items.len() {
21813                return Err(AuthorError::DanglingRef {
21814                    entity: "CONCENTRICITY_TOLERANCE",
21815                });
21816            }
21817        }
21818        DerivedPropertySelectRef::CylindricityTolerance(i) => {
21819            if i.0 >= model.cylindricity_tolerance_arena.items.len() {
21820                return Err(AuthorError::DanglingRef {
21821                    entity: "CYLINDRICITY_TOLERANCE",
21822                });
21823            }
21824        }
21825        DerivedPropertySelectRef::DimensionalLocation(i) => {
21826            if i.0 >= model.dimensional_location_arena.items.len() {
21827                return Err(AuthorError::DanglingRef {
21828                    entity: "DIMENSIONAL_LOCATION",
21829                });
21830            }
21831        }
21832        DerivedPropertySelectRef::DimensionalLocationWithPath(i) => {
21833            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
21834                return Err(AuthorError::DanglingRef {
21835                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
21836                });
21837            }
21838        }
21839        DerivedPropertySelectRef::DimensionalSize(i) => {
21840            if i.0 >= model.dimensional_size_arena.items.len() {
21841                return Err(AuthorError::DanglingRef {
21842                    entity: "DIMENSIONAL_SIZE",
21843                });
21844            }
21845        }
21846        DerivedPropertySelectRef::DimensionalSizeWithDatumFeature(i) => {
21847            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
21848                return Err(AuthorError::DanglingRef {
21849                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
21850                });
21851            }
21852        }
21853        DerivedPropertySelectRef::DimensionalSizeWithPath(i) => {
21854            if i.0 >= model.dimensional_size_with_path_arena.items.len() {
21855                return Err(AuthorError::DanglingRef {
21856                    entity: "DIMENSIONAL_SIZE_WITH_PATH",
21857                });
21858            }
21859        }
21860        DerivedPropertySelectRef::DirectedDimensionalLocation(i) => {
21861            if i.0 >= model.directed_dimensional_location_arena.items.len() {
21862                return Err(AuthorError::DanglingRef {
21863                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
21864                });
21865            }
21866        }
21867        DerivedPropertySelectRef::FlatnessTolerance(i) => {
21868            if i.0 >= model.flatness_tolerance_arena.items.len() {
21869                return Err(AuthorError::DanglingRef {
21870                    entity: "FLATNESS_TOLERANCE",
21871                });
21872            }
21873        }
21874        DerivedPropertySelectRef::GeometricTolerance(i) => {
21875            if i.0 >= model.geometric_tolerance_arena.items.len() {
21876                return Err(AuthorError::DanglingRef {
21877                    entity: "GEOMETRIC_TOLERANCE",
21878                });
21879            }
21880        }
21881        DerivedPropertySelectRef::GeometricToleranceWithDatumReference(i) => {
21882            if i.0
21883                >= model
21884                    .geometric_tolerance_with_datum_reference_arena
21885                    .items
21886                    .len()
21887            {
21888                return Err(AuthorError::DanglingRef {
21889                    entity: "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
21890                });
21891            }
21892        }
21893        DerivedPropertySelectRef::GeometricToleranceWithDefinedAreaUnit(i) => {
21894            if i.0
21895                >= model
21896                    .geometric_tolerance_with_defined_area_unit_arena
21897                    .items
21898                    .len()
21899            {
21900                return Err(AuthorError::DanglingRef {
21901                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_AREA_UNIT",
21902                });
21903            }
21904        }
21905        DerivedPropertySelectRef::GeometricToleranceWithDefinedUnit(i) => {
21906            if i.0
21907                >= model
21908                    .geometric_tolerance_with_defined_unit_arena
21909                    .items
21910                    .len()
21911            {
21912                return Err(AuthorError::DanglingRef {
21913                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_UNIT",
21914                });
21915            }
21916        }
21917        DerivedPropertySelectRef::GeometricToleranceWithMaximumTolerance(i) => {
21918            if i.0
21919                >= model
21920                    .geometric_tolerance_with_maximum_tolerance_arena
21921                    .items
21922                    .len()
21923            {
21924                return Err(AuthorError::DanglingRef {
21925                    entity: "GEOMETRIC_TOLERANCE_WITH_MAXIMUM_TOLERANCE",
21926                });
21927            }
21928        }
21929        DerivedPropertySelectRef::GeometricToleranceWithModifiers(i) => {
21930            if i.0 >= model.geometric_tolerance_with_modifiers_arena.items.len() {
21931                return Err(AuthorError::DanglingRef {
21932                    entity: "GEOMETRIC_TOLERANCE_WITH_MODIFIERS",
21933                });
21934            }
21935        }
21936        DerivedPropertySelectRef::LineProfileTolerance(i) => {
21937            if i.0 >= model.line_profile_tolerance_arena.items.len() {
21938                return Err(AuthorError::DanglingRef {
21939                    entity: "LINE_PROFILE_TOLERANCE",
21940                });
21941            }
21942        }
21943        DerivedPropertySelectRef::ModifiedGeometricTolerance(i) => {
21944            if i.0 >= model.modified_geometric_tolerance_arena.items.len() {
21945                return Err(AuthorError::DanglingRef {
21946                    entity: "MODIFIED_GEOMETRIC_TOLERANCE",
21947                });
21948            }
21949        }
21950        DerivedPropertySelectRef::ParallelismTolerance(i) => {
21951            if i.0 >= model.parallelism_tolerance_arena.items.len() {
21952                return Err(AuthorError::DanglingRef {
21953                    entity: "PARALLELISM_TOLERANCE",
21954                });
21955            }
21956        }
21957        DerivedPropertySelectRef::PerpendicularityTolerance(i) => {
21958            if i.0 >= model.perpendicularity_tolerance_arena.items.len() {
21959                return Err(AuthorError::DanglingRef {
21960                    entity: "PERPENDICULARITY_TOLERANCE",
21961                });
21962            }
21963        }
21964        DerivedPropertySelectRef::PositionTolerance(i) => {
21965            if i.0 >= model.position_tolerance_arena.items.len() {
21966                return Err(AuthorError::DanglingRef {
21967                    entity: "POSITION_TOLERANCE",
21968                });
21969            }
21970        }
21971        DerivedPropertySelectRef::ProductDefinitionShape(i) => {
21972            if i.0 >= model.product_definition_shape_arena.items.len() {
21973                return Err(AuthorError::DanglingRef {
21974                    entity: "PRODUCT_DEFINITION_SHAPE",
21975                });
21976            }
21977        }
21978        DerivedPropertySelectRef::PropertyDefinition(i) => {
21979            if i.0 >= model.property_definition_arena.items.len() {
21980                return Err(AuthorError::DanglingRef {
21981                    entity: "PROPERTY_DEFINITION",
21982                });
21983            }
21984        }
21985        DerivedPropertySelectRef::ResourceProperty(i) => {
21986            if i.0 >= model.resource_property_arena.items.len() {
21987                return Err(AuthorError::DanglingRef {
21988                    entity: "RESOURCE_PROPERTY",
21989                });
21990            }
21991        }
21992        DerivedPropertySelectRef::RoundnessTolerance(i) => {
21993            if i.0 >= model.roundness_tolerance_arena.items.len() {
21994                return Err(AuthorError::DanglingRef {
21995                    entity: "ROUNDNESS_TOLERANCE",
21996                });
21997            }
21998        }
21999        DerivedPropertySelectRef::StraightnessTolerance(i) => {
22000            if i.0 >= model.straightness_tolerance_arena.items.len() {
22001                return Err(AuthorError::DanglingRef {
22002                    entity: "STRAIGHTNESS_TOLERANCE",
22003                });
22004            }
22005        }
22006        DerivedPropertySelectRef::SurfaceProfileTolerance(i) => {
22007            if i.0 >= model.surface_profile_tolerance_arena.items.len() {
22008                return Err(AuthorError::DanglingRef {
22009                    entity: "SURFACE_PROFILE_TOLERANCE",
22010                });
22011            }
22012        }
22013        DerivedPropertySelectRef::SymmetryTolerance(i) => {
22014            if i.0 >= model.symmetry_tolerance_arena.items.len() {
22015                return Err(AuthorError::DanglingRef {
22016                    entity: "SYMMETRY_TOLERANCE",
22017                });
22018            }
22019        }
22020        DerivedPropertySelectRef::TotalRunoutTolerance(i) => {
22021            if i.0 >= model.total_runout_tolerance_arena.items.len() {
22022                return Err(AuthorError::DanglingRef {
22023                    entity: "TOTAL_RUNOUT_TOLERANCE",
22024                });
22025            }
22026        }
22027        DerivedPropertySelectRef::UnequallyDisposedGeometricTolerance(i) => {
22028            if i.0
22029                >= model
22030                    .unequally_disposed_geometric_tolerance_arena
22031                    .items
22032                    .len()
22033            {
22034                return Err(AuthorError::DanglingRef {
22035                    entity: "UNEQUALLY_DISPOSED_GEOMETRIC_TOLERANCE",
22036                });
22037            }
22038        }
22039        DerivedPropertySelectRef::Complex(i) => {
22040            if i.0 >= model.complex_unit_arena.items.len() {
22041                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
22042            }
22043        }
22044    }
22045    Ok(())
22046}
22047fn check_derived_unit_element_ref(
22048    model: &StepModel,
22049    r: &DerivedUnitElementRef,
22050) -> Result<(), AuthorError> {
22051    match r {
22052        DerivedUnitElementRef::DerivedUnitElement(i) => {
22053            if i.0 >= model.derived_unit_element_arena.items.len() {
22054                return Err(AuthorError::DanglingRef {
22055                    entity: "DERIVED_UNIT_ELEMENT",
22056                });
22057            }
22058        }
22059    }
22060    Ok(())
22061}
22062fn check_des_apll_point_select_ref(
22063    model: &StepModel,
22064    r: &DesApllPointSelectRef,
22065) -> Result<(), AuthorError> {
22066    match r {
22067        DesApllPointSelectRef::ApllPoint(_) => {
22068            return Err(AuthorError::NotAp242 {
22069                entity: "APLL_POINT",
22070            });
22071        }
22072        DesApllPointSelectRef::ApllPointWithSurface(_) => {
22073            return Err(AuthorError::NotAp242 {
22074                entity: "APLL_POINT_WITH_SURFACE",
22075            });
22076        }
22077    }
22078    Ok(())
22079}
22080fn check_description_attribute_select_ref(
22081    model: &StepModel,
22082    r: &DescriptionAttributeSelectRef,
22083) -> Result<(), AuthorError> {
22084    match r {
22085        DescriptionAttributeSelectRef::ActionRequestSolution(i) => {
22086            if i.0 >= model.action_request_solution_arena.items.len() {
22087                return Err(AuthorError::DanglingRef {
22088                    entity: "ACTION_REQUEST_SOLUTION",
22089                });
22090            }
22091        }
22092        DescriptionAttributeSelectRef::AdvancedBrepShapeRepresentation(i) => {
22093            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
22094                return Err(AuthorError::DanglingRef {
22095                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
22096                });
22097            }
22098        }
22099        DescriptionAttributeSelectRef::ApplicationContext(i) => {
22100            if i.0 >= model.application_context_arena.items.len() {
22101                return Err(AuthorError::DanglingRef {
22102                    entity: "APPLICATION_CONTEXT",
22103                });
22104            }
22105        }
22106        DescriptionAttributeSelectRef::ApprovalRole(i) => {
22107            if i.0 >= model.approval_role_arena.items.len() {
22108                return Err(AuthorError::DanglingRef {
22109                    entity: "APPROVAL_ROLE",
22110                });
22111            }
22112        }
22113        DescriptionAttributeSelectRef::CharacterizedRepresentation(i) => {
22114            if i.0 >= model.characterized_representation_arena.items.len() {
22115                return Err(AuthorError::DanglingRef {
22116                    entity: "CHARACTERIZED_REPRESENTATION",
22117                });
22118            }
22119        }
22120        DescriptionAttributeSelectRef::ConfigurationDesign(i) => {
22121            if i.0 >= model.configuration_design_arena.items.len() {
22122                return Err(AuthorError::DanglingRef {
22123                    entity: "CONFIGURATION_DESIGN",
22124                });
22125            }
22126        }
22127        DescriptionAttributeSelectRef::ConfigurationEffectivity(i) => {
22128            if i.0 >= model.configuration_effectivity_arena.items.len() {
22129                return Err(AuthorError::DanglingRef {
22130                    entity: "CONFIGURATION_EFFECTIVITY",
22131                });
22132            }
22133        }
22134        DescriptionAttributeSelectRef::ConstructiveGeometryRepresentation(i) => {
22135            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
22136                return Err(AuthorError::DanglingRef {
22137                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
22138                });
22139            }
22140        }
22141        DescriptionAttributeSelectRef::ContextDependentShapeRepresentation(i) => {
22142            if i.0
22143                >= model
22144                    .context_dependent_shape_representation_arena
22145                    .items
22146                    .len()
22147            {
22148                return Err(AuthorError::DanglingRef {
22149                    entity: "CONTEXT_DEPENDENT_SHAPE_REPRESENTATION",
22150                });
22151            }
22152        }
22153        DescriptionAttributeSelectRef::DateRole(i) => {
22154            if i.0 >= model.date_role_arena.items.len() {
22155                return Err(AuthorError::DanglingRef {
22156                    entity: "DATE_ROLE",
22157                });
22158            }
22159        }
22160        DescriptionAttributeSelectRef::DateTimeRole(i) => {
22161            if i.0 >= model.date_time_role_arena.items.len() {
22162                return Err(AuthorError::DanglingRef {
22163                    entity: "DATE_TIME_ROLE",
22164                });
22165            }
22166        }
22167        DescriptionAttributeSelectRef::DefinitionalRepresentation(i) => {
22168            if i.0 >= model.definitional_representation_arena.items.len() {
22169                return Err(AuthorError::DanglingRef {
22170                    entity: "DEFINITIONAL_REPRESENTATION",
22171                });
22172            }
22173        }
22174        DescriptionAttributeSelectRef::DraughtingModel(i) => {
22175            if i.0 >= model.draughting_model_arena.items.len() {
22176                return Err(AuthorError::DanglingRef {
22177                    entity: "DRAUGHTING_MODEL",
22178                });
22179            }
22180        }
22181        DescriptionAttributeSelectRef::Effectivity(i) => {
22182            if i.0 >= model.effectivity_arena.items.len() {
22183                return Err(AuthorError::DanglingRef {
22184                    entity: "EFFECTIVITY",
22185                });
22186            }
22187        }
22188        DescriptionAttributeSelectRef::ExternalSource(i) => {
22189            if i.0 >= model.external_source_arena.items.len() {
22190                return Err(AuthorError::DanglingRef {
22191                    entity: "EXTERNAL_SOURCE",
22192                });
22193            }
22194        }
22195        DescriptionAttributeSelectRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
22196            if i.0
22197                >= model
22198                    .geometrically_bounded_surface_shape_representation_arena
22199                    .items
22200                    .len()
22201            {
22202                return Err(AuthorError::DanglingRef {
22203                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
22204                });
22205            }
22206        }
22207        DescriptionAttributeSelectRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
22208            if i.0
22209                >= model
22210                    .geometrically_bounded_wireframe_shape_representation_arena
22211                    .items
22212                    .len()
22213            {
22214                return Err(AuthorError::DanglingRef {
22215                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
22216                });
22217            }
22218        }
22219        DescriptionAttributeSelectRef::ManifoldSurfaceShapeRepresentation(i) => {
22220            if i.0
22221                >= model
22222                    .manifold_surface_shape_representation_arena
22223                    .items
22224                    .len()
22225            {
22226                return Err(AuthorError::DanglingRef {
22227                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
22228                });
22229            }
22230        }
22231        DescriptionAttributeSelectRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
22232            if i.0
22233                >= model
22234                    .mechanical_design_geometric_presentation_representation_arena
22235                    .items
22236                    .len()
22237            {
22238                return Err(AuthorError::DanglingRef {
22239                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
22240                });
22241            }
22242        }
22243        DescriptionAttributeSelectRef::MechanicalDesignPresentationRepresentationWithDraughting(
22244            i,
22245        ) => {
22246            if i.0
22247                >= model
22248                    .mechanical_design_presentation_representation_with_draughting_arena
22249                    .items
22250                    .len()
22251            {
22252                return Err(AuthorError::DanglingRef {
22253                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
22254                });
22255            }
22256        }
22257        DescriptionAttributeSelectRef::MechanicalDesignShadedPresentationRepresentation(i) => {
22258            if i.0
22259                >= model
22260                    .mechanical_design_shaded_presentation_representation_arena
22261                    .items
22262                    .len()
22263            {
22264                return Err(AuthorError::DanglingRef {
22265                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
22266                });
22267            }
22268        }
22269        DescriptionAttributeSelectRef::OrganizationRole(i) => {
22270            if i.0 >= model.organization_role_arena.items.len() {
22271                return Err(AuthorError::DanglingRef {
22272                    entity: "ORGANIZATION_ROLE",
22273                });
22274            }
22275        }
22276        DescriptionAttributeSelectRef::OrganizationalProject(i) => {
22277            if i.0 >= model.organizational_project_arena.items.len() {
22278                return Err(AuthorError::DanglingRef {
22279                    entity: "ORGANIZATIONAL_PROJECT",
22280                });
22281            }
22282        }
22283        DescriptionAttributeSelectRef::PersonAndOrganization(i) => {
22284            if i.0 >= model.person_and_organization_arena.items.len() {
22285                return Err(AuthorError::DanglingRef {
22286                    entity: "PERSON_AND_ORGANIZATION",
22287                });
22288            }
22289        }
22290        DescriptionAttributeSelectRef::PersonAndOrganizationRole(i) => {
22291            if i.0 >= model.person_and_organization_role_arena.items.len() {
22292                return Err(AuthorError::DanglingRef {
22293                    entity: "PERSON_AND_ORGANIZATION_ROLE",
22294                });
22295            }
22296        }
22297        DescriptionAttributeSelectRef::PresentationArea(i) => {
22298            if i.0 >= model.presentation_area_arena.items.len() {
22299                return Err(AuthorError::DanglingRef {
22300                    entity: "PRESENTATION_AREA",
22301                });
22302            }
22303        }
22304        DescriptionAttributeSelectRef::PresentationRepresentation(i) => {
22305            if i.0 >= model.presentation_representation_arena.items.len() {
22306                return Err(AuthorError::DanglingRef {
22307                    entity: "PRESENTATION_REPRESENTATION",
22308                });
22309            }
22310        }
22311        DescriptionAttributeSelectRef::PresentationView(i) => {
22312            if i.0 >= model.presentation_view_arena.items.len() {
22313                return Err(AuthorError::DanglingRef {
22314                    entity: "PRESENTATION_VIEW",
22315                });
22316            }
22317        }
22318        DescriptionAttributeSelectRef::ProductDefinitionEffectivity(i) => {
22319            if i.0 >= model.product_definition_effectivity_arena.items.len() {
22320                return Err(AuthorError::DanglingRef {
22321                    entity: "PRODUCT_DEFINITION_EFFECTIVITY",
22322                });
22323            }
22324        }
22325        DescriptionAttributeSelectRef::PropertyDefinitionRepresentation(i) => {
22326            if i.0 >= model.property_definition_representation_arena.items.len() {
22327                return Err(AuthorError::DanglingRef {
22328                    entity: "PROPERTY_DEFINITION_REPRESENTATION",
22329                });
22330            }
22331        }
22332        DescriptionAttributeSelectRef::Representation(i) => {
22333            if i.0 >= model.representation_arena.items.len() {
22334                return Err(AuthorError::DanglingRef {
22335                    entity: "REPRESENTATION",
22336                });
22337            }
22338        }
22339        DescriptionAttributeSelectRef::ShapeDefinitionRepresentation(i) => {
22340            if i.0 >= model.shape_definition_representation_arena.items.len() {
22341                return Err(AuthorError::DanglingRef {
22342                    entity: "SHAPE_DEFINITION_REPRESENTATION",
22343                });
22344            }
22345        }
22346        DescriptionAttributeSelectRef::ShapeDimensionRepresentation(i) => {
22347            if i.0 >= model.shape_dimension_representation_arena.items.len() {
22348                return Err(AuthorError::DanglingRef {
22349                    entity: "SHAPE_DIMENSION_REPRESENTATION",
22350                });
22351            }
22352        }
22353        DescriptionAttributeSelectRef::ShapeRepresentation(i) => {
22354            if i.0 >= model.shape_representation_arena.items.len() {
22355                return Err(AuthorError::DanglingRef {
22356                    entity: "SHAPE_REPRESENTATION",
22357                });
22358            }
22359        }
22360        DescriptionAttributeSelectRef::ShapeRepresentationWithParameters(i) => {
22361            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
22362                return Err(AuthorError::DanglingRef {
22363                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
22364                });
22365            }
22366        }
22367        DescriptionAttributeSelectRef::SymbolRepresentation(i) => {
22368            if i.0 >= model.symbol_representation_arena.items.len() {
22369                return Err(AuthorError::DanglingRef {
22370                    entity: "SYMBOL_REPRESENTATION",
22371                });
22372            }
22373        }
22374        DescriptionAttributeSelectRef::TessellatedShapeRepresentation(i) => {
22375            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
22376                return Err(AuthorError::DanglingRef {
22377                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
22378                });
22379            }
22380        }
22381        DescriptionAttributeSelectRef::Complex(i) => {
22382            if i.0 >= model.complex_unit_arena.items.len() {
22383                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
22384            }
22385        }
22386    }
22387    Ok(())
22388}
22389fn check_dimensional_characteristic_ref(
22390    model: &StepModel,
22391    r: &DimensionalCharacteristicRef,
22392) -> Result<(), AuthorError> {
22393    match r {
22394        DimensionalCharacteristicRef::AngularLocation(i) => {
22395            if i.0 >= model.angular_location_arena.items.len() {
22396                return Err(AuthorError::DanglingRef {
22397                    entity: "ANGULAR_LOCATION",
22398                });
22399            }
22400        }
22401        DimensionalCharacteristicRef::AngularSize(i) => {
22402            if i.0 >= model.angular_size_arena.items.len() {
22403                return Err(AuthorError::DanglingRef {
22404                    entity: "ANGULAR_SIZE",
22405                });
22406            }
22407        }
22408        DimensionalCharacteristicRef::DimensionalLocation(i) => {
22409            if i.0 >= model.dimensional_location_arena.items.len() {
22410                return Err(AuthorError::DanglingRef {
22411                    entity: "DIMENSIONAL_LOCATION",
22412                });
22413            }
22414        }
22415        DimensionalCharacteristicRef::DimensionalLocationWithPath(i) => {
22416            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
22417                return Err(AuthorError::DanglingRef {
22418                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
22419                });
22420            }
22421        }
22422        DimensionalCharacteristicRef::DimensionalSize(i) => {
22423            if i.0 >= model.dimensional_size_arena.items.len() {
22424                return Err(AuthorError::DanglingRef {
22425                    entity: "DIMENSIONAL_SIZE",
22426                });
22427            }
22428        }
22429        DimensionalCharacteristicRef::DimensionalSizeWithDatumFeature(i) => {
22430            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
22431                return Err(AuthorError::DanglingRef {
22432                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
22433                });
22434            }
22435        }
22436        DimensionalCharacteristicRef::DimensionalSizeWithPath(i) => {
22437            if i.0 >= model.dimensional_size_with_path_arena.items.len() {
22438                return Err(AuthorError::DanglingRef {
22439                    entity: "DIMENSIONAL_SIZE_WITH_PATH",
22440                });
22441            }
22442        }
22443        DimensionalCharacteristicRef::DirectedDimensionalLocation(i) => {
22444            if i.0 >= model.directed_dimensional_location_arena.items.len() {
22445                return Err(AuthorError::DanglingRef {
22446                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
22447                });
22448            }
22449        }
22450        DimensionalCharacteristicRef::Complex(i) => {
22451            if i.0 >= model.complex_unit_arena.items.len() {
22452                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
22453            }
22454        }
22455    }
22456    Ok(())
22457}
22458fn check_dimensional_exponents_ref(
22459    model: &StepModel,
22460    r: &DimensionalExponentsRef,
22461) -> Result<(), AuthorError> {
22462    match r {
22463        DimensionalExponentsRef::DimensionalExponents(i) => {
22464            if i.0 >= model.dimensional_exponents_arena.items.len() {
22465                return Err(AuthorError::DanglingRef {
22466                    entity: "DIMENSIONAL_EXPONENTS",
22467                });
22468            }
22469        }
22470    }
22471    Ok(())
22472}
22473fn check_direction_ref(model: &StepModel, r: &DirectionRef) -> Result<(), AuthorError> {
22474    match r {
22475        DirectionRef::Direction(i) => {
22476            if i.0 >= model.direction_arena.items.len() {
22477                return Err(AuthorError::DanglingRef {
22478                    entity: "DIRECTION",
22479                });
22480            }
22481        }
22482        DirectionRef::Complex(i) => {
22483            if i.0 >= model.complex_unit_arena.items.len() {
22484                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
22485            }
22486        }
22487    }
22488    Ok(())
22489}
22490fn check_document_ref(model: &StepModel, r: &DocumentRef) -> Result<(), AuthorError> {
22491    match r {
22492        DocumentRef::Document(i) => {
22493            if i.0 >= model.document_arena.items.len() {
22494                return Err(AuthorError::DanglingRef { entity: "DOCUMENT" });
22495            }
22496        }
22497        DocumentRef::DocumentFile(i) => {
22498            if i.0 >= model.document_file_arena.items.len() {
22499                return Err(AuthorError::DanglingRef {
22500                    entity: "DOCUMENT_FILE",
22501                });
22502            }
22503        }
22504        DocumentRef::Complex(i) => {
22505            if i.0 >= model.complex_unit_arena.items.len() {
22506                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
22507            }
22508        }
22509    }
22510    Ok(())
22511}
22512fn check_document_reference_item_ref(
22513    model: &StepModel,
22514    r: &DocumentReferenceItemRef,
22515) -> Result<(), AuthorError> {
22516    match r {
22517        DocumentReferenceItemRef::ActionDirective(i) => {
22518            if i.0 >= model.action_directive_arena.items.len() {
22519                return Err(AuthorError::DanglingRef {
22520                    entity: "ACTION_DIRECTIVE",
22521                });
22522            }
22523        }
22524        DocumentReferenceItemRef::ActionMethod(i) => {
22525            if i.0 >= model.action_method_arena.items.len() {
22526                return Err(AuthorError::DanglingRef {
22527                    entity: "ACTION_METHOD",
22528                });
22529            }
22530        }
22531        DocumentReferenceItemRef::ActionMethodRelationship(i) => {
22532            if i.0 >= model.action_method_relationship_arena.items.len() {
22533                return Err(AuthorError::DanglingRef {
22534                    entity: "ACTION_METHOD_RELATIONSHIP",
22535                });
22536            }
22537        }
22538        DocumentReferenceItemRef::ActionProperty(i) => {
22539            if i.0 >= model.action_property_arena.items.len() {
22540                return Err(AuthorError::DanglingRef {
22541                    entity: "ACTION_PROPERTY",
22542                });
22543            }
22544        }
22545        DocumentReferenceItemRef::ActionRelationship(i) => {
22546            if i.0 >= model.action_relationship_arena.items.len() {
22547                return Err(AuthorError::DanglingRef {
22548                    entity: "ACTION_RELATIONSHIP",
22549                });
22550            }
22551        }
22552        DocumentReferenceItemRef::AdvancedBrepShapeRepresentation(i) => {
22553            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
22554                return Err(AuthorError::DanglingRef {
22555                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
22556                });
22557            }
22558        }
22559        DocumentReferenceItemRef::AdvancedFace(i) => {
22560            if i.0 >= model.advanced_face_arena.items.len() {
22561                return Err(AuthorError::DanglingRef {
22562                    entity: "ADVANCED_FACE",
22563                });
22564            }
22565        }
22566        DocumentReferenceItemRef::AllAroundShapeAspect(i) => {
22567            if i.0 >= model.all_around_shape_aspect_arena.items.len() {
22568                return Err(AuthorError::DanglingRef {
22569                    entity: "ALL_AROUND_SHAPE_ASPECT",
22570                });
22571            }
22572        }
22573        DocumentReferenceItemRef::AngularLocation(i) => {
22574            if i.0 >= model.angular_location_arena.items.len() {
22575                return Err(AuthorError::DanglingRef {
22576                    entity: "ANGULAR_LOCATION",
22577                });
22578            }
22579        }
22580        DocumentReferenceItemRef::AngularSize(i) => {
22581            if i.0 >= model.angular_size_arena.items.len() {
22582                return Err(AuthorError::DanglingRef {
22583                    entity: "ANGULAR_SIZE",
22584                });
22585            }
22586        }
22587        DocumentReferenceItemRef::AnnotationCurveOccurrence(i) => {
22588            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
22589                return Err(AuthorError::DanglingRef {
22590                    entity: "ANNOTATION_CURVE_OCCURRENCE",
22591                });
22592            }
22593        }
22594        DocumentReferenceItemRef::AnnotationFillAreaOccurrence(i) => {
22595            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
22596                return Err(AuthorError::DanglingRef {
22597                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
22598                });
22599            }
22600        }
22601        DocumentReferenceItemRef::AnnotationOccurrence(i) => {
22602            if i.0 >= model.annotation_occurrence_arena.items.len() {
22603                return Err(AuthorError::DanglingRef {
22604                    entity: "ANNOTATION_OCCURRENCE",
22605                });
22606            }
22607        }
22608        DocumentReferenceItemRef::AnnotationPlaceholderLeaderLine(_) => {
22609            return Err(AuthorError::NotAp242 {
22610                entity: "ANNOTATION_PLACEHOLDER_LEADER_LINE",
22611            });
22612        }
22613        DocumentReferenceItemRef::AnnotationPlaceholderOccurrence(i) => {
22614            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
22615                return Err(AuthorError::DanglingRef {
22616                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
22617                });
22618            }
22619        }
22620        DocumentReferenceItemRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
22621            return Err(AuthorError::NotAp242 {
22622                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
22623            });
22624        }
22625        DocumentReferenceItemRef::AnnotationPlane(i) => {
22626            if i.0 >= model.annotation_plane_arena.items.len() {
22627                return Err(AuthorError::DanglingRef {
22628                    entity: "ANNOTATION_PLANE",
22629                });
22630            }
22631        }
22632        DocumentReferenceItemRef::AnnotationSymbol(i) => {
22633            if i.0 >= model.annotation_symbol_arena.items.len() {
22634                return Err(AuthorError::DanglingRef {
22635                    entity: "ANNOTATION_SYMBOL",
22636                });
22637            }
22638        }
22639        DocumentReferenceItemRef::AnnotationSymbolOccurrence(i) => {
22640            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
22641                return Err(AuthorError::DanglingRef {
22642                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
22643                });
22644            }
22645        }
22646        DocumentReferenceItemRef::AnnotationText(i) => {
22647            if i.0 >= model.annotation_text_arena.items.len() {
22648                return Err(AuthorError::DanglingRef {
22649                    entity: "ANNOTATION_TEXT",
22650                });
22651            }
22652        }
22653        DocumentReferenceItemRef::AnnotationTextCharacter(i) => {
22654            if i.0 >= model.annotation_text_character_arena.items.len() {
22655                return Err(AuthorError::DanglingRef {
22656                    entity: "ANNOTATION_TEXT_CHARACTER",
22657                });
22658            }
22659        }
22660        DocumentReferenceItemRef::AnnotationTextOccurrence(i) => {
22661            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
22662                return Err(AuthorError::DanglingRef {
22663                    entity: "ANNOTATION_TEXT_OCCURRENCE",
22664                });
22665            }
22666        }
22667        DocumentReferenceItemRef::AnnotationToAnnotationLeaderLine(_) => {
22668            return Err(AuthorError::NotAp242 {
22669                entity: "ANNOTATION_TO_ANNOTATION_LEADER_LINE",
22670            });
22671        }
22672        DocumentReferenceItemRef::AnnotationToModelLeaderLine(_) => {
22673            return Err(AuthorError::NotAp242 {
22674                entity: "ANNOTATION_TO_MODEL_LEADER_LINE",
22675            });
22676        }
22677        DocumentReferenceItemRef::ApllPoint(_) => {
22678            return Err(AuthorError::NotAp242 {
22679                entity: "APLL_POINT",
22680            });
22681        }
22682        DocumentReferenceItemRef::ApllPointWithSurface(_) => {
22683            return Err(AuthorError::NotAp242 {
22684                entity: "APLL_POINT_WITH_SURFACE",
22685            });
22686        }
22687        DocumentReferenceItemRef::AppliedDateAndTimeAssignment(i) => {
22688            if i.0 >= model.applied_date_and_time_assignment_arena.items.len() {
22689                return Err(AuthorError::DanglingRef {
22690                    entity: "APPLIED_DATE_AND_TIME_ASSIGNMENT",
22691                });
22692            }
22693        }
22694        DocumentReferenceItemRef::AppliedDocumentReference(i) => {
22695            if i.0 >= model.applied_document_reference_arena.items.len() {
22696                return Err(AuthorError::DanglingRef {
22697                    entity: "APPLIED_DOCUMENT_REFERENCE",
22698                });
22699            }
22700        }
22701        DocumentReferenceItemRef::AppliedExternalIdentificationAssignment(i) => {
22702            if i.0
22703                >= model
22704                    .applied_external_identification_assignment_arena
22705                    .items
22706                    .len()
22707            {
22708                return Err(AuthorError::DanglingRef {
22709                    entity: "APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT",
22710                });
22711            }
22712        }
22713        DocumentReferenceItemRef::Approval(i) => {
22714            if i.0 >= model.approval_arena.items.len() {
22715                return Err(AuthorError::DanglingRef { entity: "APPROVAL" });
22716            }
22717        }
22718        DocumentReferenceItemRef::ApprovalPersonOrganization(i) => {
22719            if i.0 >= model.approval_person_organization_arena.items.len() {
22720                return Err(AuthorError::DanglingRef {
22721                    entity: "APPROVAL_PERSON_ORGANIZATION",
22722                });
22723            }
22724        }
22725        DocumentReferenceItemRef::AssemblyComponentUsage(i) => {
22726            if i.0 >= model.assembly_component_usage_arena.items.len() {
22727                return Err(AuthorError::DanglingRef {
22728                    entity: "ASSEMBLY_COMPONENT_USAGE",
22729                });
22730            }
22731        }
22732        DocumentReferenceItemRef::AuxiliaryLeaderLine(_) => {
22733            return Err(AuthorError::NotAp242 {
22734                entity: "AUXILIARY_LEADER_LINE",
22735            });
22736        }
22737        DocumentReferenceItemRef::Axis1Placement(i) => {
22738            if i.0 >= model.axis1_placement_arena.items.len() {
22739                return Err(AuthorError::DanglingRef {
22740                    entity: "AXIS1_PLACEMENT",
22741                });
22742            }
22743        }
22744        DocumentReferenceItemRef::Axis2Placement2d(i) => {
22745            if i.0 >= model.axis2_placement2d_arena.items.len() {
22746                return Err(AuthorError::DanglingRef {
22747                    entity: "AXIS2_PLACEMENT_2D",
22748                });
22749            }
22750        }
22751        DocumentReferenceItemRef::Axis2Placement3d(i) => {
22752            if i.0 >= model.axis2_placement3d_arena.items.len() {
22753                return Err(AuthorError::DanglingRef {
22754                    entity: "AXIS2_PLACEMENT_3D",
22755                });
22756            }
22757        }
22758        DocumentReferenceItemRef::BSplineCurve(i) => {
22759            if i.0 >= model.b_spline_curve_arena.items.len() {
22760                return Err(AuthorError::DanglingRef {
22761                    entity: "B_SPLINE_CURVE",
22762                });
22763            }
22764        }
22765        DocumentReferenceItemRef::BSplineCurveWithKnots(i) => {
22766            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
22767                return Err(AuthorError::DanglingRef {
22768                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
22769                });
22770            }
22771        }
22772        DocumentReferenceItemRef::BSplineSurface(i) => {
22773            if i.0 >= model.b_spline_surface_arena.items.len() {
22774                return Err(AuthorError::DanglingRef {
22775                    entity: "B_SPLINE_SURFACE",
22776                });
22777            }
22778        }
22779        DocumentReferenceItemRef::BSplineSurfaceWithKnots(i) => {
22780            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
22781                return Err(AuthorError::DanglingRef {
22782                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
22783                });
22784            }
22785        }
22786        DocumentReferenceItemRef::BezierCurve(i) => {
22787            if i.0 >= model.bezier_curve_arena.items.len() {
22788                return Err(AuthorError::DanglingRef {
22789                    entity: "BEZIER_CURVE",
22790                });
22791            }
22792        }
22793        DocumentReferenceItemRef::BezierSurface(i) => {
22794            if i.0 >= model.bezier_surface_arena.items.len() {
22795                return Err(AuthorError::DanglingRef {
22796                    entity: "BEZIER_SURFACE",
22797                });
22798            }
22799        }
22800        DocumentReferenceItemRef::BoundedCurve(i) => {
22801            if i.0 >= model.bounded_curve_arena.items.len() {
22802                return Err(AuthorError::DanglingRef {
22803                    entity: "BOUNDED_CURVE",
22804                });
22805            }
22806        }
22807        DocumentReferenceItemRef::BoundedPcurve(i) => {
22808            if i.0 >= model.bounded_pcurve_arena.items.len() {
22809                return Err(AuthorError::DanglingRef {
22810                    entity: "BOUNDED_PCURVE",
22811                });
22812            }
22813        }
22814        DocumentReferenceItemRef::BoundedSurface(i) => {
22815            if i.0 >= model.bounded_surface_arena.items.len() {
22816                return Err(AuthorError::DanglingRef {
22817                    entity: "BOUNDED_SURFACE",
22818                });
22819            }
22820        }
22821        DocumentReferenceItemRef::BoundedSurfaceCurve(i) => {
22822            if i.0 >= model.bounded_surface_curve_arena.items.len() {
22823                return Err(AuthorError::DanglingRef {
22824                    entity: "BOUNDED_SURFACE_CURVE",
22825                });
22826            }
22827        }
22828        DocumentReferenceItemRef::BrepWithVoids(i) => {
22829            if i.0 >= model.brep_with_voids_arena.items.len() {
22830                return Err(AuthorError::DanglingRef {
22831                    entity: "BREP_WITH_VOIDS",
22832                });
22833            }
22834        }
22835        DocumentReferenceItemRef::CameraImage(i) => {
22836            if i.0 >= model.camera_image_arena.items.len() {
22837                return Err(AuthorError::DanglingRef {
22838                    entity: "CAMERA_IMAGE",
22839                });
22840            }
22841        }
22842        DocumentReferenceItemRef::CameraImage3dWithScale(i) => {
22843            if i.0 >= model.camera_image3d_with_scale_arena.items.len() {
22844                return Err(AuthorError::DanglingRef {
22845                    entity: "CAMERA_IMAGE_3D_WITH_SCALE",
22846                });
22847            }
22848        }
22849        DocumentReferenceItemRef::CameraModel(i) => {
22850            if i.0 >= model.camera_model_arena.items.len() {
22851                return Err(AuthorError::DanglingRef {
22852                    entity: "CAMERA_MODEL",
22853                });
22854            }
22855        }
22856        DocumentReferenceItemRef::CameraModelD3(i) => {
22857            if i.0 >= model.camera_model_d3_arena.items.len() {
22858                return Err(AuthorError::DanglingRef {
22859                    entity: "CAMERA_MODEL_D3",
22860                });
22861            }
22862        }
22863        DocumentReferenceItemRef::CameraModelD3MultiClipping(i) => {
22864            if i.0 >= model.camera_model_d3_multi_clipping_arena.items.len() {
22865                return Err(AuthorError::DanglingRef {
22866                    entity: "CAMERA_MODEL_D3_MULTI_CLIPPING",
22867                });
22868            }
22869        }
22870        DocumentReferenceItemRef::CameraModelD3WithHlhsr(i) => {
22871            if i.0 >= model.camera_model_d3_with_hlhsr_arena.items.len() {
22872                return Err(AuthorError::DanglingRef {
22873                    entity: "CAMERA_MODEL_D3_WITH_HLHSR",
22874                });
22875            }
22876        }
22877        DocumentReferenceItemRef::CartesianPoint(i) => {
22878            if i.0 >= model.cartesian_point_arena.items.len() {
22879                return Err(AuthorError::DanglingRef {
22880                    entity: "CARTESIAN_POINT",
22881                });
22882            }
22883        }
22884        DocumentReferenceItemRef::CcDesignDateAndTimeAssignment(i) => {
22885            if i.0 >= model.cc_design_date_and_time_assignment_arena.items.len() {
22886                return Err(AuthorError::DanglingRef {
22887                    entity: "CC_DESIGN_DATE_AND_TIME_ASSIGNMENT",
22888                });
22889            }
22890        }
22891        DocumentReferenceItemRef::CentreOfSymmetry(i) => {
22892            if i.0 >= model.centre_of_symmetry_arena.items.len() {
22893                return Err(AuthorError::DanglingRef {
22894                    entity: "CENTRE_OF_SYMMETRY",
22895                });
22896            }
22897        }
22898        DocumentReferenceItemRef::Certification(i) => {
22899            if i.0 >= model.certification_arena.items.len() {
22900                return Err(AuthorError::DanglingRef {
22901                    entity: "CERTIFICATION",
22902                });
22903            }
22904        }
22905        DocumentReferenceItemRef::CharacterizedItemWithinRepresentation(i) => {
22906            if i.0
22907                >= model
22908                    .characterized_item_within_representation_arena
22909                    .items
22910                    .len()
22911            {
22912                return Err(AuthorError::DanglingRef {
22913                    entity: "CHARACTERIZED_ITEM_WITHIN_REPRESENTATION",
22914                });
22915            }
22916        }
22917        DocumentReferenceItemRef::CharacterizedObject(i) => {
22918            if i.0 >= model.characterized_object_arena.items.len() {
22919                return Err(AuthorError::DanglingRef {
22920                    entity: "CHARACTERIZED_OBJECT",
22921                });
22922            }
22923        }
22924        DocumentReferenceItemRef::CharacterizedRepresentation(i) => {
22925            if i.0 >= model.characterized_representation_arena.items.len() {
22926                return Err(AuthorError::DanglingRef {
22927                    entity: "CHARACTERIZED_REPRESENTATION",
22928                });
22929            }
22930        }
22931        DocumentReferenceItemRef::Circle(i) => {
22932            if i.0 >= model.circle_arena.items.len() {
22933                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
22934            }
22935        }
22936        DocumentReferenceItemRef::ClosedShell(i) => {
22937            if i.0 >= model.closed_shell_arena.items.len() {
22938                return Err(AuthorError::DanglingRef {
22939                    entity: "CLOSED_SHELL",
22940                });
22941            }
22942        }
22943        DocumentReferenceItemRef::CommonDatum(i) => {
22944            if i.0 >= model.common_datum_arena.items.len() {
22945                return Err(AuthorError::DanglingRef {
22946                    entity: "COMMON_DATUM",
22947                });
22948            }
22949        }
22950        DocumentReferenceItemRef::ComplexTriangulatedFace(i) => {
22951            if i.0 >= model.complex_triangulated_face_arena.items.len() {
22952                return Err(AuthorError::DanglingRef {
22953                    entity: "COMPLEX_TRIANGULATED_FACE",
22954                });
22955            }
22956        }
22957        DocumentReferenceItemRef::ComplexTriangulatedSurfaceSet(i) => {
22958            if i.0 >= model.complex_triangulated_surface_set_arena.items.len() {
22959                return Err(AuthorError::DanglingRef {
22960                    entity: "COMPLEX_TRIANGULATED_SURFACE_SET",
22961                });
22962            }
22963        }
22964        DocumentReferenceItemRef::CompositeCurve(i) => {
22965            if i.0 >= model.composite_curve_arena.items.len() {
22966                return Err(AuthorError::DanglingRef {
22967                    entity: "COMPOSITE_CURVE",
22968                });
22969            }
22970        }
22971        DocumentReferenceItemRef::CompositeGroupShapeAspect(i) => {
22972            if i.0 >= model.composite_group_shape_aspect_arena.items.len() {
22973                return Err(AuthorError::DanglingRef {
22974                    entity: "COMPOSITE_GROUP_SHAPE_ASPECT",
22975                });
22976            }
22977        }
22978        DocumentReferenceItemRef::CompositeShapeAspect(i) => {
22979            if i.0 >= model.composite_shape_aspect_arena.items.len() {
22980                return Err(AuthorError::DanglingRef {
22981                    entity: "COMPOSITE_SHAPE_ASPECT",
22982                });
22983            }
22984        }
22985        DocumentReferenceItemRef::CompositeText(i) => {
22986            if i.0 >= model.composite_text_arena.items.len() {
22987                return Err(AuthorError::DanglingRef {
22988                    entity: "COMPOSITE_TEXT",
22989                });
22990            }
22991        }
22992        DocumentReferenceItemRef::CompoundRepresentationItem(i) => {
22993            if i.0 >= model.compound_representation_item_arena.items.len() {
22994                return Err(AuthorError::DanglingRef {
22995                    entity: "COMPOUND_REPRESENTATION_ITEM",
22996                });
22997            }
22998        }
22999        DocumentReferenceItemRef::ConfigurationDesign(i) => {
23000            if i.0 >= model.configuration_design_arena.items.len() {
23001                return Err(AuthorError::DanglingRef {
23002                    entity: "CONFIGURATION_DESIGN",
23003                });
23004            }
23005        }
23006        DocumentReferenceItemRef::ConfigurationEffectivity(i) => {
23007            if i.0 >= model.configuration_effectivity_arena.items.len() {
23008                return Err(AuthorError::DanglingRef {
23009                    entity: "CONFIGURATION_EFFECTIVITY",
23010                });
23011            }
23012        }
23013        DocumentReferenceItemRef::ConfigurationItem(i) => {
23014            if i.0 >= model.configuration_item_arena.items.len() {
23015                return Err(AuthorError::DanglingRef {
23016                    entity: "CONFIGURATION_ITEM",
23017                });
23018            }
23019        }
23020        DocumentReferenceItemRef::Conic(i) => {
23021            if i.0 >= model.conic_arena.items.len() {
23022                return Err(AuthorError::DanglingRef { entity: "CONIC" });
23023            }
23024        }
23025        DocumentReferenceItemRef::ConicalSurface(i) => {
23026            if i.0 >= model.conical_surface_arena.items.len() {
23027                return Err(AuthorError::DanglingRef {
23028                    entity: "CONICAL_SURFACE",
23029                });
23030            }
23031        }
23032        DocumentReferenceItemRef::ConnectedFaceSet(i) => {
23033            if i.0 >= model.connected_face_set_arena.items.len() {
23034                return Err(AuthorError::DanglingRef {
23035                    entity: "CONNECTED_FACE_SET",
23036                });
23037            }
23038        }
23039        DocumentReferenceItemRef::ConstructiveGeometryRepresentation(i) => {
23040            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
23041                return Err(AuthorError::DanglingRef {
23042                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
23043                });
23044            }
23045        }
23046        DocumentReferenceItemRef::ConstructiveGeometryRepresentationRelationship(i) => {
23047            if i.0
23048                >= model
23049                    .constructive_geometry_representation_relationship_arena
23050                    .items
23051                    .len()
23052            {
23053                return Err(AuthorError::DanglingRef {
23054                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP",
23055                });
23056            }
23057        }
23058        DocumentReferenceItemRef::ContextDependentOverRidingStyledItem(i) => {
23059            if i.0
23060                >= model
23061                    .context_dependent_over_riding_styled_item_arena
23062                    .items
23063                    .len()
23064            {
23065                return Err(AuthorError::DanglingRef {
23066                    entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
23067                });
23068            }
23069        }
23070        DocumentReferenceItemRef::ContinuousShapeAspect(i) => {
23071            if i.0 >= model.continuous_shape_aspect_arena.items.len() {
23072                return Err(AuthorError::DanglingRef {
23073                    entity: "CONTINUOUS_SHAPE_ASPECT",
23074                });
23075            }
23076        }
23077        DocumentReferenceItemRef::Contract(i) => {
23078            if i.0 >= model.contract_arena.items.len() {
23079                return Err(AuthorError::DanglingRef { entity: "CONTRACT" });
23080            }
23081        }
23082        DocumentReferenceItemRef::CoordinatesList(i) => {
23083            if i.0 >= model.coordinates_list_arena.items.len() {
23084                return Err(AuthorError::DanglingRef {
23085                    entity: "COORDINATES_LIST",
23086                });
23087            }
23088        }
23089        DocumentReferenceItemRef::Curve(i) => {
23090            if i.0 >= model.curve_arena.items.len() {
23091                return Err(AuthorError::DanglingRef { entity: "CURVE" });
23092            }
23093        }
23094        DocumentReferenceItemRef::CylindricalSurface(i) => {
23095            if i.0 >= model.cylindrical_surface_arena.items.len() {
23096                return Err(AuthorError::DanglingRef {
23097                    entity: "CYLINDRICAL_SURFACE",
23098                });
23099            }
23100        }
23101        DocumentReferenceItemRef::DateAndTimeAssignment(i) => {
23102            if i.0 >= model.date_and_time_assignment_arena.items.len() {
23103                return Err(AuthorError::DanglingRef {
23104                    entity: "DATE_AND_TIME_ASSIGNMENT",
23105                });
23106            }
23107        }
23108        DocumentReferenceItemRef::Datum(i) => {
23109            if i.0 >= model.datum_arena.items.len() {
23110                return Err(AuthorError::DanglingRef { entity: "DATUM" });
23111            }
23112        }
23113        DocumentReferenceItemRef::DatumFeature(i) => {
23114            if i.0 >= model.datum_feature_arena.items.len() {
23115                return Err(AuthorError::DanglingRef {
23116                    entity: "DATUM_FEATURE",
23117                });
23118            }
23119        }
23120        DocumentReferenceItemRef::DatumReferenceCompartment(i) => {
23121            if i.0 >= model.datum_reference_compartment_arena.items.len() {
23122                return Err(AuthorError::DanglingRef {
23123                    entity: "DATUM_REFERENCE_COMPARTMENT",
23124                });
23125            }
23126        }
23127        DocumentReferenceItemRef::DatumReferenceElement(i) => {
23128            if i.0 >= model.datum_reference_element_arena.items.len() {
23129                return Err(AuthorError::DanglingRef {
23130                    entity: "DATUM_REFERENCE_ELEMENT",
23131                });
23132            }
23133        }
23134        DocumentReferenceItemRef::DatumSystem(i) => {
23135            if i.0 >= model.datum_system_arena.items.len() {
23136                return Err(AuthorError::DanglingRef {
23137                    entity: "DATUM_SYSTEM",
23138                });
23139            }
23140        }
23141        DocumentReferenceItemRef::DatumTarget(i) => {
23142            if i.0 >= model.datum_target_arena.items.len() {
23143                return Err(AuthorError::DanglingRef {
23144                    entity: "DATUM_TARGET",
23145                });
23146            }
23147        }
23148        DocumentReferenceItemRef::DefaultModelGeometricView(i) => {
23149            if i.0 >= model.default_model_geometric_view_arena.items.len() {
23150                return Err(AuthorError::DanglingRef {
23151                    entity: "DEFAULT_MODEL_GEOMETRIC_VIEW",
23152                });
23153            }
23154        }
23155        DocumentReferenceItemRef::DefinedCharacterGlyph(i) => {
23156            if i.0 >= model.defined_character_glyph_arena.items.len() {
23157                return Err(AuthorError::DanglingRef {
23158                    entity: "DEFINED_CHARACTER_GLYPH",
23159                });
23160            }
23161        }
23162        DocumentReferenceItemRef::DefinedSymbol(i) => {
23163            if i.0 >= model.defined_symbol_arena.items.len() {
23164                return Err(AuthorError::DanglingRef {
23165                    entity: "DEFINED_SYMBOL",
23166                });
23167            }
23168        }
23169        DocumentReferenceItemRef::DefinitionalRepresentation(i) => {
23170            if i.0 >= model.definitional_representation_arena.items.len() {
23171                return Err(AuthorError::DanglingRef {
23172                    entity: "DEFINITIONAL_REPRESENTATION",
23173                });
23174            }
23175        }
23176        DocumentReferenceItemRef::DefinitionalRepresentationRelationship(i) => {
23177            if i.0
23178                >= model
23179                    .definitional_representation_relationship_arena
23180                    .items
23181                    .len()
23182            {
23183                return Err(AuthorError::DanglingRef {
23184                    entity: "DEFINITIONAL_REPRESENTATION_RELATIONSHIP",
23185                });
23186            }
23187        }
23188        DocumentReferenceItemRef::DefinitionalRepresentationRelationshipWithSameContext(i) => {
23189            if i.0
23190                >= model
23191                    .definitional_representation_relationship_with_same_context_arena
23192                    .items
23193                    .len()
23194            {
23195                return Err(AuthorError::DanglingRef {
23196                    entity: "DEFINITIONAL_REPRESENTATION_RELATIONSHIP_WITH_SAME_CONTEXT",
23197                });
23198            }
23199        }
23200        DocumentReferenceItemRef::DegenerateToroidalSurface(i) => {
23201            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
23202                return Err(AuthorError::DanglingRef {
23203                    entity: "DEGENERATE_TOROIDAL_SURFACE",
23204                });
23205            }
23206        }
23207        DocumentReferenceItemRef::DerivedShapeAspect(i) => {
23208            if i.0 >= model.derived_shape_aspect_arena.items.len() {
23209                return Err(AuthorError::DanglingRef {
23210                    entity: "DERIVED_SHAPE_ASPECT",
23211                });
23212            }
23213        }
23214        DocumentReferenceItemRef::DescriptiveRepresentationItem(i) => {
23215            if i.0 >= model.descriptive_representation_item_arena.items.len() {
23216                return Err(AuthorError::DanglingRef {
23217                    entity: "DESCRIPTIVE_REPRESENTATION_ITEM",
23218                });
23219            }
23220        }
23221        DocumentReferenceItemRef::DesignContext(i) => {
23222            if i.0 >= model.design_context_arena.items.len() {
23223                return Err(AuthorError::DanglingRef {
23224                    entity: "DESIGN_CONTEXT",
23225                });
23226            }
23227        }
23228        DocumentReferenceItemRef::DimensionalLocation(i) => {
23229            if i.0 >= model.dimensional_location_arena.items.len() {
23230                return Err(AuthorError::DanglingRef {
23231                    entity: "DIMENSIONAL_LOCATION",
23232                });
23233            }
23234        }
23235        DocumentReferenceItemRef::DimensionalLocationWithPath(i) => {
23236            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
23237                return Err(AuthorError::DanglingRef {
23238                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
23239                });
23240            }
23241        }
23242        DocumentReferenceItemRef::DimensionalSize(i) => {
23243            if i.0 >= model.dimensional_size_arena.items.len() {
23244                return Err(AuthorError::DanglingRef {
23245                    entity: "DIMENSIONAL_SIZE",
23246                });
23247            }
23248        }
23249        DocumentReferenceItemRef::DimensionalSizeWithDatumFeature(i) => {
23250            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
23251                return Err(AuthorError::DanglingRef {
23252                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
23253                });
23254            }
23255        }
23256        DocumentReferenceItemRef::DimensionalSizeWithPath(i) => {
23257            if i.0 >= model.dimensional_size_with_path_arena.items.len() {
23258                return Err(AuthorError::DanglingRef {
23259                    entity: "DIMENSIONAL_SIZE_WITH_PATH",
23260                });
23261            }
23262        }
23263        DocumentReferenceItemRef::DirectedDimensionalLocation(i) => {
23264            if i.0 >= model.directed_dimensional_location_arena.items.len() {
23265                return Err(AuthorError::DanglingRef {
23266                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
23267                });
23268            }
23269        }
23270        DocumentReferenceItemRef::Direction(i) => {
23271            if i.0 >= model.direction_arena.items.len() {
23272                return Err(AuthorError::DanglingRef {
23273                    entity: "DIRECTION",
23274                });
23275            }
23276        }
23277        DocumentReferenceItemRef::DocumentFile(i) => {
23278            if i.0 >= model.document_file_arena.items.len() {
23279                return Err(AuthorError::DanglingRef {
23280                    entity: "DOCUMENT_FILE",
23281                });
23282            }
23283        }
23284        DocumentReferenceItemRef::DraughtingAnnotationOccurrence(i) => {
23285            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
23286                return Err(AuthorError::DanglingRef {
23287                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
23288                });
23289            }
23290        }
23291        DocumentReferenceItemRef::DraughtingCallout(i) => {
23292            if i.0 >= model.draughting_callout_arena.items.len() {
23293                return Err(AuthorError::DanglingRef {
23294                    entity: "DRAUGHTING_CALLOUT",
23295                });
23296            }
23297        }
23298        DocumentReferenceItemRef::DraughtingModel(i) => {
23299            if i.0 >= model.draughting_model_arena.items.len() {
23300                return Err(AuthorError::DanglingRef {
23301                    entity: "DRAUGHTING_MODEL",
23302                });
23303            }
23304        }
23305        DocumentReferenceItemRef::Edge(i) => {
23306            if i.0 >= model.edge_arena.items.len() {
23307                return Err(AuthorError::DanglingRef { entity: "EDGE" });
23308            }
23309        }
23310        DocumentReferenceItemRef::EdgeCurve(i) => {
23311            if i.0 >= model.edge_curve_arena.items.len() {
23312                return Err(AuthorError::DanglingRef {
23313                    entity: "EDGE_CURVE",
23314                });
23315            }
23316        }
23317        DocumentReferenceItemRef::EdgeLoop(i) => {
23318            if i.0 >= model.edge_loop_arena.items.len() {
23319                return Err(AuthorError::DanglingRef {
23320                    entity: "EDGE_LOOP",
23321                });
23322            }
23323        }
23324        DocumentReferenceItemRef::Effectivity(i) => {
23325            if i.0 >= model.effectivity_arena.items.len() {
23326                return Err(AuthorError::DanglingRef {
23327                    entity: "EFFECTIVITY",
23328                });
23329            }
23330        }
23331        DocumentReferenceItemRef::ElementarySurface(i) => {
23332            if i.0 >= model.elementary_surface_arena.items.len() {
23333                return Err(AuthorError::DanglingRef {
23334                    entity: "ELEMENTARY_SURFACE",
23335                });
23336            }
23337        }
23338        DocumentReferenceItemRef::Ellipse(i) => {
23339            if i.0 >= model.ellipse_arena.items.len() {
23340                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
23341            }
23342        }
23343        DocumentReferenceItemRef::ExternallyDefinedCharacterGlyph(i) => {
23344            if i.0 >= model.externally_defined_character_glyph_arena.items.len() {
23345                return Err(AuthorError::DanglingRef {
23346                    entity: "EXTERNALLY_DEFINED_CHARACTER_GLYPH",
23347                });
23348            }
23349        }
23350        DocumentReferenceItemRef::ExternallyDefinedCurveFont(i) => {
23351            if i.0 >= model.externally_defined_curve_font_arena.items.len() {
23352                return Err(AuthorError::DanglingRef {
23353                    entity: "EXTERNALLY_DEFINED_CURVE_FONT",
23354                });
23355            }
23356        }
23357        DocumentReferenceItemRef::ExternallyDefinedHatchStyle(i) => {
23358            if i.0 >= model.externally_defined_hatch_style_arena.items.len() {
23359                return Err(AuthorError::DanglingRef {
23360                    entity: "EXTERNALLY_DEFINED_HATCH_STYLE",
23361                });
23362            }
23363        }
23364        DocumentReferenceItemRef::ExternallyDefinedItem(i) => {
23365            if i.0 >= model.externally_defined_item_arena.items.len() {
23366                return Err(AuthorError::DanglingRef {
23367                    entity: "EXTERNALLY_DEFINED_ITEM",
23368                });
23369            }
23370        }
23371        DocumentReferenceItemRef::ExternallyDefinedStyle(i) => {
23372            if i.0 >= model.externally_defined_style_arena.items.len() {
23373                return Err(AuthorError::DanglingRef {
23374                    entity: "EXTERNALLY_DEFINED_STYLE",
23375                });
23376            }
23377        }
23378        DocumentReferenceItemRef::ExternallyDefinedSymbol(i) => {
23379            if i.0 >= model.externally_defined_symbol_arena.items.len() {
23380                return Err(AuthorError::DanglingRef {
23381                    entity: "EXTERNALLY_DEFINED_SYMBOL",
23382                });
23383            }
23384        }
23385        DocumentReferenceItemRef::ExternallyDefinedTextFont(i) => {
23386            if i.0 >= model.externally_defined_text_font_arena.items.len() {
23387                return Err(AuthorError::DanglingRef {
23388                    entity: "EXTERNALLY_DEFINED_TEXT_FONT",
23389                });
23390            }
23391        }
23392        DocumentReferenceItemRef::ExternallyDefinedTile(i) => {
23393            if i.0 >= model.externally_defined_tile_arena.items.len() {
23394                return Err(AuthorError::DanglingRef {
23395                    entity: "EXTERNALLY_DEFINED_TILE",
23396                });
23397            }
23398        }
23399        DocumentReferenceItemRef::ExternallyDefinedTileStyle(i) => {
23400            if i.0 >= model.externally_defined_tile_style_arena.items.len() {
23401                return Err(AuthorError::DanglingRef {
23402                    entity: "EXTERNALLY_DEFINED_TILE_STYLE",
23403                });
23404            }
23405        }
23406        DocumentReferenceItemRef::Face(i) => {
23407            if i.0 >= model.face_arena.items.len() {
23408                return Err(AuthorError::DanglingRef { entity: "FACE" });
23409            }
23410        }
23411        DocumentReferenceItemRef::FaceBound(i) => {
23412            if i.0 >= model.face_bound_arena.items.len() {
23413                return Err(AuthorError::DanglingRef {
23414                    entity: "FACE_BOUND",
23415                });
23416            }
23417        }
23418        DocumentReferenceItemRef::FaceOuterBound(i) => {
23419            if i.0 >= model.face_outer_bound_arena.items.len() {
23420                return Err(AuthorError::DanglingRef {
23421                    entity: "FACE_OUTER_BOUND",
23422                });
23423            }
23424        }
23425        DocumentReferenceItemRef::FaceSurface(i) => {
23426            if i.0 >= model.face_surface_arena.items.len() {
23427                return Err(AuthorError::DanglingRef {
23428                    entity: "FACE_SURFACE",
23429                });
23430            }
23431        }
23432        DocumentReferenceItemRef::FeatureForDatumTargetRelationship(i) => {
23433            if i.0
23434                >= model
23435                    .feature_for_datum_target_relationship_arena
23436                    .items
23437                    .len()
23438            {
23439                return Err(AuthorError::DanglingRef {
23440                    entity: "FEATURE_FOR_DATUM_TARGET_RELATIONSHIP",
23441                });
23442            }
23443        }
23444        DocumentReferenceItemRef::FillAreaStyleHatching(i) => {
23445            if i.0 >= model.fill_area_style_hatching_arena.items.len() {
23446                return Err(AuthorError::DanglingRef {
23447                    entity: "FILL_AREA_STYLE_HATCHING",
23448                });
23449            }
23450        }
23451        DocumentReferenceItemRef::FillAreaStyleTileColouredRegion(i) => {
23452            if i.0 >= model.fill_area_style_tile_coloured_region_arena.items.len() {
23453                return Err(AuthorError::DanglingRef {
23454                    entity: "FILL_AREA_STYLE_TILE_COLOURED_REGION",
23455                });
23456            }
23457        }
23458        DocumentReferenceItemRef::FillAreaStyleTileCurveWithStyle(i) => {
23459            if i.0
23460                >= model
23461                    .fill_area_style_tile_curve_with_style_arena
23462                    .items
23463                    .len()
23464            {
23465                return Err(AuthorError::DanglingRef {
23466                    entity: "FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE",
23467                });
23468            }
23469        }
23470        DocumentReferenceItemRef::FillAreaStyleTileSymbolWithStyle(i) => {
23471            if i.0
23472                >= model
23473                    .fill_area_style_tile_symbol_with_style_arena
23474                    .items
23475                    .len()
23476            {
23477                return Err(AuthorError::DanglingRef {
23478                    entity: "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE",
23479                });
23480            }
23481        }
23482        DocumentReferenceItemRef::FillAreaStyleTiles(i) => {
23483            if i.0 >= model.fill_area_style_tiles_arena.items.len() {
23484                return Err(AuthorError::DanglingRef {
23485                    entity: "FILL_AREA_STYLE_TILES",
23486                });
23487            }
23488        }
23489        DocumentReferenceItemRef::GeneralDatumReference(i) => {
23490            if i.0 >= model.general_datum_reference_arena.items.len() {
23491                return Err(AuthorError::DanglingRef {
23492                    entity: "GENERAL_DATUM_REFERENCE",
23493                });
23494            }
23495        }
23496        DocumentReferenceItemRef::GeneralProperty(i) => {
23497            if i.0 >= model.general_property_arena.items.len() {
23498                return Err(AuthorError::DanglingRef {
23499                    entity: "GENERAL_PROPERTY",
23500                });
23501            }
23502        }
23503        DocumentReferenceItemRef::GeometricCurveSet(i) => {
23504            if i.0 >= model.geometric_curve_set_arena.items.len() {
23505                return Err(AuthorError::DanglingRef {
23506                    entity: "GEOMETRIC_CURVE_SET",
23507                });
23508            }
23509        }
23510        DocumentReferenceItemRef::GeometricRepresentationItem(i) => {
23511            if i.0 >= model.geometric_representation_item_arena.items.len() {
23512                return Err(AuthorError::DanglingRef {
23513                    entity: "GEOMETRIC_REPRESENTATION_ITEM",
23514                });
23515            }
23516        }
23517        DocumentReferenceItemRef::GeometricSet(i) => {
23518            if i.0 >= model.geometric_set_arena.items.len() {
23519                return Err(AuthorError::DanglingRef {
23520                    entity: "GEOMETRIC_SET",
23521                });
23522            }
23523        }
23524        DocumentReferenceItemRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
23525            if i.0
23526                >= model
23527                    .geometrically_bounded_surface_shape_representation_arena
23528                    .items
23529                    .len()
23530            {
23531                return Err(AuthorError::DanglingRef {
23532                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
23533                });
23534            }
23535        }
23536        DocumentReferenceItemRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
23537            if i.0
23538                >= model
23539                    .geometrically_bounded_wireframe_shape_representation_arena
23540                    .items
23541                    .len()
23542            {
23543                return Err(AuthorError::DanglingRef {
23544                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
23545                });
23546            }
23547        }
23548        DocumentReferenceItemRef::Group(i) => {
23549            if i.0 >= model.group_arena.items.len() {
23550                return Err(AuthorError::DanglingRef { entity: "GROUP" });
23551            }
23552        }
23553        DocumentReferenceItemRef::Hyperbola(i) => {
23554            if i.0 >= model.hyperbola_arena.items.len() {
23555                return Err(AuthorError::DanglingRef {
23556                    entity: "HYPERBOLA",
23557                });
23558            }
23559        }
23560        DocumentReferenceItemRef::IntegerRepresentationItem(i) => {
23561            if i.0 >= model.integer_representation_item_arena.items.len() {
23562                return Err(AuthorError::DanglingRef {
23563                    entity: "INTEGER_REPRESENTATION_ITEM",
23564                });
23565            }
23566        }
23567        DocumentReferenceItemRef::IntersectionCurve(i) => {
23568            if i.0 >= model.intersection_curve_arena.items.len() {
23569                return Err(AuthorError::DanglingRef {
23570                    entity: "INTERSECTION_CURVE",
23571                });
23572            }
23573        }
23574        DocumentReferenceItemRef::LeaderCurve(i) => {
23575            if i.0 >= model.leader_curve_arena.items.len() {
23576                return Err(AuthorError::DanglingRef {
23577                    entity: "LEADER_CURVE",
23578                });
23579            }
23580        }
23581        DocumentReferenceItemRef::LeaderDirectedCallout(i) => {
23582            if i.0 >= model.leader_directed_callout_arena.items.len() {
23583                return Err(AuthorError::DanglingRef {
23584                    entity: "LEADER_DIRECTED_CALLOUT",
23585                });
23586            }
23587        }
23588        DocumentReferenceItemRef::LeaderTerminator(i) => {
23589            if i.0 >= model.leader_terminator_arena.items.len() {
23590                return Err(AuthorError::DanglingRef {
23591                    entity: "LEADER_TERMINATOR",
23592                });
23593            }
23594        }
23595        DocumentReferenceItemRef::Line(i) => {
23596            if i.0 >= model.line_arena.items.len() {
23597                return Err(AuthorError::DanglingRef { entity: "LINE" });
23598            }
23599        }
23600        DocumentReferenceItemRef::Loop(i) => {
23601            if i.0 >= model.loop_arena.items.len() {
23602                return Err(AuthorError::DanglingRef { entity: "LOOP" });
23603            }
23604        }
23605        DocumentReferenceItemRef::MakeFromUsageOption(i) => {
23606            if i.0 >= model.make_from_usage_option_arena.items.len() {
23607                return Err(AuthorError::DanglingRef {
23608                    entity: "MAKE_FROM_USAGE_OPTION",
23609                });
23610            }
23611        }
23612        DocumentReferenceItemRef::ManifoldSolidBrep(i) => {
23613            if i.0 >= model.manifold_solid_brep_arena.items.len() {
23614                return Err(AuthorError::DanglingRef {
23615                    entity: "MANIFOLD_SOLID_BREP",
23616                });
23617            }
23618        }
23619        DocumentReferenceItemRef::ManifoldSurfaceShapeRepresentation(i) => {
23620            if i.0
23621                >= model
23622                    .manifold_surface_shape_representation_arena
23623                    .items
23624                    .len()
23625            {
23626                return Err(AuthorError::DanglingRef {
23627                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
23628                });
23629            }
23630        }
23631        DocumentReferenceItemRef::MappedItem(i) => {
23632            if i.0 >= model.mapped_item_arena.items.len() {
23633                return Err(AuthorError::DanglingRef {
23634                    entity: "MAPPED_ITEM",
23635                });
23636            }
23637        }
23638        DocumentReferenceItemRef::MeasureRepresentationItem(i) => {
23639            if i.0 >= model.measure_representation_item_arena.items.len() {
23640                return Err(AuthorError::DanglingRef {
23641                    entity: "MEASURE_REPRESENTATION_ITEM",
23642                });
23643            }
23644        }
23645        DocumentReferenceItemRef::MechanicalDesignAndDraughtingRelationship(i) => {
23646            if i.0
23647                >= model
23648                    .mechanical_design_and_draughting_relationship_arena
23649                    .items
23650                    .len()
23651            {
23652                return Err(AuthorError::DanglingRef {
23653                    entity: "MECHANICAL_DESIGN_AND_DRAUGHTING_RELATIONSHIP",
23654                });
23655            }
23656        }
23657        DocumentReferenceItemRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
23658            if i.0
23659                >= model
23660                    .mechanical_design_geometric_presentation_representation_arena
23661                    .items
23662                    .len()
23663            {
23664                return Err(AuthorError::DanglingRef {
23665                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
23666                });
23667            }
23668        }
23669        DocumentReferenceItemRef::MechanicalDesignPresentationRepresentationWithDraughting(i) => {
23670            if i.0
23671                >= model
23672                    .mechanical_design_presentation_representation_with_draughting_arena
23673                    .items
23674                    .len()
23675            {
23676                return Err(AuthorError::DanglingRef {
23677                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
23678                });
23679            }
23680        }
23681        DocumentReferenceItemRef::MechanicalDesignShadedPresentationRepresentation(i) => {
23682            if i.0
23683                >= model
23684                    .mechanical_design_shaded_presentation_representation_arena
23685                    .items
23686                    .len()
23687            {
23688                return Err(AuthorError::DanglingRef {
23689                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
23690                });
23691            }
23692        }
23693        DocumentReferenceItemRef::ModelGeometricView(i) => {
23694            if i.0 >= model.model_geometric_view_arena.items.len() {
23695                return Err(AuthorError::DanglingRef {
23696                    entity: "MODEL_GEOMETRIC_VIEW",
23697                });
23698            }
23699        }
23700        DocumentReferenceItemRef::NextAssemblyUsageOccurrence(i) => {
23701            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
23702                return Err(AuthorError::DanglingRef {
23703                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
23704                });
23705            }
23706        }
23707        DocumentReferenceItemRef::OffsetSurface(i) => {
23708            if i.0 >= model.offset_surface_arena.items.len() {
23709                return Err(AuthorError::DanglingRef {
23710                    entity: "OFFSET_SURFACE",
23711                });
23712            }
23713        }
23714        DocumentReferenceItemRef::OneDirectionRepeatFactor(i) => {
23715            if i.0 >= model.one_direction_repeat_factor_arena.items.len() {
23716                return Err(AuthorError::DanglingRef {
23717                    entity: "ONE_DIRECTION_REPEAT_FACTOR",
23718                });
23719            }
23720        }
23721        DocumentReferenceItemRef::OpenShell(i) => {
23722            if i.0 >= model.open_shell_arena.items.len() {
23723                return Err(AuthorError::DanglingRef {
23724                    entity: "OPEN_SHELL",
23725                });
23726            }
23727        }
23728        DocumentReferenceItemRef::Organization(i) => {
23729            if i.0 >= model.organization_arena.items.len() {
23730                return Err(AuthorError::DanglingRef {
23731                    entity: "ORGANIZATION",
23732                });
23733            }
23734        }
23735        DocumentReferenceItemRef::OrganizationRelationship(i) => {
23736            if i.0 >= model.organization_relationship_arena.items.len() {
23737                return Err(AuthorError::DanglingRef {
23738                    entity: "ORGANIZATION_RELATIONSHIP",
23739                });
23740            }
23741        }
23742        DocumentReferenceItemRef::OrganizationalAddress(i) => {
23743            if i.0 >= model.organizational_address_arena.items.len() {
23744                return Err(AuthorError::DanglingRef {
23745                    entity: "ORGANIZATIONAL_ADDRESS",
23746                });
23747            }
23748        }
23749        DocumentReferenceItemRef::OrganizationalProject(i) => {
23750            if i.0 >= model.organizational_project_arena.items.len() {
23751                return Err(AuthorError::DanglingRef {
23752                    entity: "ORGANIZATIONAL_PROJECT",
23753                });
23754            }
23755        }
23756        DocumentReferenceItemRef::OrganizationalProjectRelationship(i) => {
23757            if i.0 >= model.organizational_project_relationship_arena.items.len() {
23758                return Err(AuthorError::DanglingRef {
23759                    entity: "ORGANIZATIONAL_PROJECT_RELATIONSHIP",
23760                });
23761            }
23762        }
23763        DocumentReferenceItemRef::OrientedClosedShell(i) => {
23764            if i.0 >= model.oriented_closed_shell_arena.items.len() {
23765                return Err(AuthorError::DanglingRef {
23766                    entity: "ORIENTED_CLOSED_SHELL",
23767                });
23768            }
23769        }
23770        DocumentReferenceItemRef::OrientedEdge(i) => {
23771            if i.0 >= model.oriented_edge_arena.items.len() {
23772                return Err(AuthorError::DanglingRef {
23773                    entity: "ORIENTED_EDGE",
23774                });
23775            }
23776        }
23777        DocumentReferenceItemRef::OverRidingStyledItem(i) => {
23778            if i.0 >= model.over_riding_styled_item_arena.items.len() {
23779                return Err(AuthorError::DanglingRef {
23780                    entity: "OVER_RIDING_STYLED_ITEM",
23781                });
23782            }
23783        }
23784        DocumentReferenceItemRef::Path(i) => {
23785            if i.0 >= model.path_arena.items.len() {
23786                return Err(AuthorError::DanglingRef { entity: "PATH" });
23787            }
23788        }
23789        DocumentReferenceItemRef::Pcurve(i) => {
23790            if i.0 >= model.pcurve_arena.items.len() {
23791                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
23792            }
23793        }
23794        DocumentReferenceItemRef::Person(i) => {
23795            if i.0 >= model.person_arena.items.len() {
23796                return Err(AuthorError::DanglingRef { entity: "PERSON" });
23797            }
23798        }
23799        DocumentReferenceItemRef::PersonAndOrganization(i) => {
23800            if i.0 >= model.person_and_organization_arena.items.len() {
23801                return Err(AuthorError::DanglingRef {
23802                    entity: "PERSON_AND_ORGANIZATION",
23803                });
23804            }
23805        }
23806        DocumentReferenceItemRef::PersonAndOrganizationAddress(i) => {
23807            if i.0 >= model.person_and_organization_address_arena.items.len() {
23808                return Err(AuthorError::DanglingRef {
23809                    entity: "PERSON_AND_ORGANIZATION_ADDRESS",
23810                });
23811            }
23812        }
23813        DocumentReferenceItemRef::PlacedDatumTargetFeature(i) => {
23814            if i.0 >= model.placed_datum_target_feature_arena.items.len() {
23815                return Err(AuthorError::DanglingRef {
23816                    entity: "PLACED_DATUM_TARGET_FEATURE",
23817                });
23818            }
23819        }
23820        DocumentReferenceItemRef::Placement(i) => {
23821            if i.0 >= model.placement_arena.items.len() {
23822                return Err(AuthorError::DanglingRef {
23823                    entity: "PLACEMENT",
23824                });
23825            }
23826        }
23827        DocumentReferenceItemRef::PlanarBox(i) => {
23828            if i.0 >= model.planar_box_arena.items.len() {
23829                return Err(AuthorError::DanglingRef {
23830                    entity: "PLANAR_BOX",
23831                });
23832            }
23833        }
23834        DocumentReferenceItemRef::PlanarExtent(i) => {
23835            if i.0 >= model.planar_extent_arena.items.len() {
23836                return Err(AuthorError::DanglingRef {
23837                    entity: "PLANAR_EXTENT",
23838                });
23839            }
23840        }
23841        DocumentReferenceItemRef::Plane(i) => {
23842            if i.0 >= model.plane_arena.items.len() {
23843                return Err(AuthorError::DanglingRef { entity: "PLANE" });
23844            }
23845        }
23846        DocumentReferenceItemRef::Point(i) => {
23847            if i.0 >= model.point_arena.items.len() {
23848                return Err(AuthorError::DanglingRef { entity: "POINT" });
23849            }
23850        }
23851        DocumentReferenceItemRef::PolyLoop(i) => {
23852            if i.0 >= model.poly_loop_arena.items.len() {
23853                return Err(AuthorError::DanglingRef {
23854                    entity: "POLY_LOOP",
23855                });
23856            }
23857        }
23858        DocumentReferenceItemRef::Polyline(i) => {
23859            if i.0 >= model.polyline_arena.items.len() {
23860                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
23861            }
23862        }
23863        DocumentReferenceItemRef::PresentationArea(i) => {
23864            if i.0 >= model.presentation_area_arena.items.len() {
23865                return Err(AuthorError::DanglingRef {
23866                    entity: "PRESENTATION_AREA",
23867                });
23868            }
23869        }
23870        DocumentReferenceItemRef::PresentationRepresentation(i) => {
23871            if i.0 >= model.presentation_representation_arena.items.len() {
23872                return Err(AuthorError::DanglingRef {
23873                    entity: "PRESENTATION_REPRESENTATION",
23874                });
23875            }
23876        }
23877        DocumentReferenceItemRef::PresentationView(i) => {
23878            if i.0 >= model.presentation_view_arena.items.len() {
23879                return Err(AuthorError::DanglingRef {
23880                    entity: "PRESENTATION_VIEW",
23881                });
23882            }
23883        }
23884        DocumentReferenceItemRef::Product(i) => {
23885            if i.0 >= model.product_arena.items.len() {
23886                return Err(AuthorError::DanglingRef { entity: "PRODUCT" });
23887            }
23888        }
23889        DocumentReferenceItemRef::ProductCategory(i) => {
23890            if i.0 >= model.product_category_arena.items.len() {
23891                return Err(AuthorError::DanglingRef {
23892                    entity: "PRODUCT_CATEGORY",
23893                });
23894            }
23895        }
23896        DocumentReferenceItemRef::ProductConcept(i) => {
23897            if i.0 >= model.product_concept_arena.items.len() {
23898                return Err(AuthorError::DanglingRef {
23899                    entity: "PRODUCT_CONCEPT",
23900                });
23901            }
23902        }
23903        DocumentReferenceItemRef::ProductConceptFeatureCategory(i) => {
23904            if i.0 >= model.product_concept_feature_category_arena.items.len() {
23905                return Err(AuthorError::DanglingRef {
23906                    entity: "PRODUCT_CONCEPT_FEATURE_CATEGORY",
23907                });
23908            }
23909        }
23910        DocumentReferenceItemRef::ProductDefinition(i) => {
23911            if i.0 >= model.product_definition_arena.items.len() {
23912                return Err(AuthorError::DanglingRef {
23913                    entity: "PRODUCT_DEFINITION",
23914                });
23915            }
23916        }
23917        DocumentReferenceItemRef::ProductDefinitionContext(i) => {
23918            if i.0 >= model.product_definition_context_arena.items.len() {
23919                return Err(AuthorError::DanglingRef {
23920                    entity: "PRODUCT_DEFINITION_CONTEXT",
23921                });
23922            }
23923        }
23924        DocumentReferenceItemRef::ProductDefinitionEffectivity(i) => {
23925            if i.0 >= model.product_definition_effectivity_arena.items.len() {
23926                return Err(AuthorError::DanglingRef {
23927                    entity: "PRODUCT_DEFINITION_EFFECTIVITY",
23928                });
23929            }
23930        }
23931        DocumentReferenceItemRef::ProductDefinitionFormation(i) => {
23932            if i.0 >= model.product_definition_formation_arena.items.len() {
23933                return Err(AuthorError::DanglingRef {
23934                    entity: "PRODUCT_DEFINITION_FORMATION",
23935                });
23936            }
23937        }
23938        DocumentReferenceItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
23939            if i.0
23940                >= model
23941                    .product_definition_formation_with_specified_source_arena
23942                    .items
23943                    .len()
23944            {
23945                return Err(AuthorError::DanglingRef {
23946                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
23947                });
23948            }
23949        }
23950        DocumentReferenceItemRef::ProductDefinitionRelationship(i) => {
23951            if i.0 >= model.product_definition_relationship_arena.items.len() {
23952                return Err(AuthorError::DanglingRef {
23953                    entity: "PRODUCT_DEFINITION_RELATIONSHIP",
23954                });
23955            }
23956        }
23957        DocumentReferenceItemRef::ProductDefinitionShape(i) => {
23958            if i.0 >= model.product_definition_shape_arena.items.len() {
23959                return Err(AuthorError::DanglingRef {
23960                    entity: "PRODUCT_DEFINITION_SHAPE",
23961                });
23962            }
23963        }
23964        DocumentReferenceItemRef::ProductDefinitionUsage(i) => {
23965            if i.0 >= model.product_definition_usage_arena.items.len() {
23966                return Err(AuthorError::DanglingRef {
23967                    entity: "PRODUCT_DEFINITION_USAGE",
23968                });
23969            }
23970        }
23971        DocumentReferenceItemRef::ProductDefinitionWithAssociatedDocuments(i) => {
23972            if i.0
23973                >= model
23974                    .product_definition_with_associated_documents_arena
23975                    .items
23976                    .len()
23977            {
23978                return Err(AuthorError::DanglingRef {
23979                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
23980                });
23981            }
23982        }
23983        DocumentReferenceItemRef::ProductRelatedProductCategory(i) => {
23984            if i.0 >= model.product_related_product_category_arena.items.len() {
23985                return Err(AuthorError::DanglingRef {
23986                    entity: "PRODUCT_RELATED_PRODUCT_CATEGORY",
23987                });
23988            }
23989        }
23990        DocumentReferenceItemRef::PropertyDefinition(i) => {
23991            if i.0 >= model.property_definition_arena.items.len() {
23992                return Err(AuthorError::DanglingRef {
23993                    entity: "PROPERTY_DEFINITION",
23994                });
23995            }
23996        }
23997        DocumentReferenceItemRef::PropertyDefinitionRepresentation(i) => {
23998            if i.0 >= model.property_definition_representation_arena.items.len() {
23999                return Err(AuthorError::DanglingRef {
24000                    entity: "PROPERTY_DEFINITION_REPRESENTATION",
24001                });
24002            }
24003        }
24004        DocumentReferenceItemRef::QualifiedRepresentationItem(i) => {
24005            if i.0 >= model.qualified_representation_item_arena.items.len() {
24006                return Err(AuthorError::DanglingRef {
24007                    entity: "QUALIFIED_REPRESENTATION_ITEM",
24008                });
24009            }
24010        }
24011        DocumentReferenceItemRef::QuasiUniformCurve(i) => {
24012            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
24013                return Err(AuthorError::DanglingRef {
24014                    entity: "QUASI_UNIFORM_CURVE",
24015                });
24016            }
24017        }
24018        DocumentReferenceItemRef::QuasiUniformSurface(i) => {
24019            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
24020                return Err(AuthorError::DanglingRef {
24021                    entity: "QUASI_UNIFORM_SURFACE",
24022                });
24023            }
24024        }
24025        DocumentReferenceItemRef::RationalBSplineCurve(i) => {
24026            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
24027                return Err(AuthorError::DanglingRef {
24028                    entity: "RATIONAL_B_SPLINE_CURVE",
24029                });
24030            }
24031        }
24032        DocumentReferenceItemRef::RationalBSplineSurface(i) => {
24033            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
24034                return Err(AuthorError::DanglingRef {
24035                    entity: "RATIONAL_B_SPLINE_SURFACE",
24036                });
24037            }
24038        }
24039        DocumentReferenceItemRef::RealRepresentationItem(i) => {
24040            if i.0 >= model.real_representation_item_arena.items.len() {
24041                return Err(AuthorError::DanglingRef {
24042                    entity: "REAL_REPRESENTATION_ITEM",
24043                });
24044            }
24045        }
24046        DocumentReferenceItemRef::RepositionedTessellatedItem(i) => {
24047            if i.0 >= model.repositioned_tessellated_item_arena.items.len() {
24048                return Err(AuthorError::DanglingRef {
24049                    entity: "REPOSITIONED_TESSELLATED_ITEM",
24050                });
24051            }
24052        }
24053        DocumentReferenceItemRef::Representation(i) => {
24054            if i.0 >= model.representation_arena.items.len() {
24055                return Err(AuthorError::DanglingRef {
24056                    entity: "REPRESENTATION",
24057                });
24058            }
24059        }
24060        DocumentReferenceItemRef::RepresentationItem(i) => {
24061            if i.0 >= model.representation_item_arena.items.len() {
24062                return Err(AuthorError::DanglingRef {
24063                    entity: "REPRESENTATION_ITEM",
24064                });
24065            }
24066        }
24067        DocumentReferenceItemRef::RepresentationRelationship(i) => {
24068            if i.0 >= model.representation_relationship_arena.items.len() {
24069                return Err(AuthorError::DanglingRef {
24070                    entity: "REPRESENTATION_RELATIONSHIP",
24071                });
24072            }
24073        }
24074        DocumentReferenceItemRef::RepresentationRelationshipWithTransformation(i) => {
24075            if i.0
24076                >= model
24077                    .representation_relationship_with_transformation_arena
24078                    .items
24079                    .len()
24080            {
24081                return Err(AuthorError::DanglingRef {
24082                    entity: "REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION",
24083                });
24084            }
24085        }
24086        DocumentReferenceItemRef::ResourceRequirementType(i) => {
24087            if i.0 >= model.resource_requirement_type_arena.items.len() {
24088                return Err(AuthorError::DanglingRef {
24089                    entity: "RESOURCE_REQUIREMENT_TYPE",
24090                });
24091            }
24092        }
24093        DocumentReferenceItemRef::SeamCurve(i) => {
24094            if i.0 >= model.seam_curve_arena.items.len() {
24095                return Err(AuthorError::DanglingRef {
24096                    entity: "SEAM_CURVE",
24097                });
24098            }
24099        }
24100        DocumentReferenceItemRef::SecurityClassification(i) => {
24101            if i.0 >= model.security_classification_arena.items.len() {
24102                return Err(AuthorError::DanglingRef {
24103                    entity: "SECURITY_CLASSIFICATION",
24104                });
24105            }
24106        }
24107        DocumentReferenceItemRef::ShapeAspect(i) => {
24108            if i.0 >= model.shape_aspect_arena.items.len() {
24109                return Err(AuthorError::DanglingRef {
24110                    entity: "SHAPE_ASPECT",
24111                });
24112            }
24113        }
24114        DocumentReferenceItemRef::ShapeAspectAssociativity(i) => {
24115            if i.0 >= model.shape_aspect_associativity_arena.items.len() {
24116                return Err(AuthorError::DanglingRef {
24117                    entity: "SHAPE_ASPECT_ASSOCIATIVITY",
24118                });
24119            }
24120        }
24121        DocumentReferenceItemRef::ShapeAspectDerivingRelationship(i) => {
24122            if i.0 >= model.shape_aspect_deriving_relationship_arena.items.len() {
24123                return Err(AuthorError::DanglingRef {
24124                    entity: "SHAPE_ASPECT_DERIVING_RELATIONSHIP",
24125                });
24126            }
24127        }
24128        DocumentReferenceItemRef::ShapeAspectRelationship(i) => {
24129            if i.0 >= model.shape_aspect_relationship_arena.items.len() {
24130                return Err(AuthorError::DanglingRef {
24131                    entity: "SHAPE_ASPECT_RELATIONSHIP",
24132                });
24133            }
24134        }
24135        DocumentReferenceItemRef::ShapeDefinitionRepresentation(i) => {
24136            if i.0 >= model.shape_definition_representation_arena.items.len() {
24137                return Err(AuthorError::DanglingRef {
24138                    entity: "SHAPE_DEFINITION_REPRESENTATION",
24139                });
24140            }
24141        }
24142        DocumentReferenceItemRef::ShapeDimensionRepresentation(i) => {
24143            if i.0 >= model.shape_dimension_representation_arena.items.len() {
24144                return Err(AuthorError::DanglingRef {
24145                    entity: "SHAPE_DIMENSION_REPRESENTATION",
24146                });
24147            }
24148        }
24149        DocumentReferenceItemRef::ShapeRepresentation(i) => {
24150            if i.0 >= model.shape_representation_arena.items.len() {
24151                return Err(AuthorError::DanglingRef {
24152                    entity: "SHAPE_REPRESENTATION",
24153                });
24154            }
24155        }
24156        DocumentReferenceItemRef::ShapeRepresentationRelationship(i) => {
24157            if i.0 >= model.shape_representation_relationship_arena.items.len() {
24158                return Err(AuthorError::DanglingRef {
24159                    entity: "SHAPE_REPRESENTATION_RELATIONSHIP",
24160                });
24161            }
24162        }
24163        DocumentReferenceItemRef::ShapeRepresentationWithParameters(i) => {
24164            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
24165                return Err(AuthorError::DanglingRef {
24166                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
24167                });
24168            }
24169        }
24170        DocumentReferenceItemRef::ShellBasedSurfaceModel(i) => {
24171            if i.0 >= model.shell_based_surface_model_arena.items.len() {
24172                return Err(AuthorError::DanglingRef {
24173                    entity: "SHELL_BASED_SURFACE_MODEL",
24174                });
24175            }
24176        }
24177        DocumentReferenceItemRef::SolidModel(i) => {
24178            if i.0 >= model.solid_model_arena.items.len() {
24179                return Err(AuthorError::DanglingRef {
24180                    entity: "SOLID_MODEL",
24181                });
24182            }
24183        }
24184        DocumentReferenceItemRef::SphericalSurface(i) => {
24185            if i.0 >= model.spherical_surface_arena.items.len() {
24186                return Err(AuthorError::DanglingRef {
24187                    entity: "SPHERICAL_SURFACE",
24188                });
24189            }
24190        }
24191        DocumentReferenceItemRef::StateObserved(i) => {
24192            if i.0 >= model.state_observed_arena.items.len() {
24193                return Err(AuthorError::DanglingRef {
24194                    entity: "STATE_OBSERVED",
24195                });
24196            }
24197        }
24198        DocumentReferenceItemRef::StateType(i) => {
24199            if i.0 >= model.state_type_arena.items.len() {
24200                return Err(AuthorError::DanglingRef {
24201                    entity: "STATE_TYPE",
24202                });
24203            }
24204        }
24205        DocumentReferenceItemRef::StyledItem(i) => {
24206            if i.0 >= model.styled_item_arena.items.len() {
24207                return Err(AuthorError::DanglingRef {
24208                    entity: "STYLED_ITEM",
24209                });
24210            }
24211        }
24212        DocumentReferenceItemRef::Surface(i) => {
24213            if i.0 >= model.surface_arena.items.len() {
24214                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
24215            }
24216        }
24217        DocumentReferenceItemRef::SurfaceCurve(i) => {
24218            if i.0 >= model.surface_curve_arena.items.len() {
24219                return Err(AuthorError::DanglingRef {
24220                    entity: "SURFACE_CURVE",
24221                });
24222            }
24223        }
24224        DocumentReferenceItemRef::SurfaceOfLinearExtrusion(i) => {
24225            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
24226                return Err(AuthorError::DanglingRef {
24227                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
24228                });
24229            }
24230        }
24231        DocumentReferenceItemRef::SurfaceOfRevolution(i) => {
24232            if i.0 >= model.surface_of_revolution_arena.items.len() {
24233                return Err(AuthorError::DanglingRef {
24234                    entity: "SURFACE_OF_REVOLUTION",
24235                });
24236            }
24237        }
24238        DocumentReferenceItemRef::SweptSurface(i) => {
24239            if i.0 >= model.swept_surface_arena.items.len() {
24240                return Err(AuthorError::DanglingRef {
24241                    entity: "SWEPT_SURFACE",
24242                });
24243            }
24244        }
24245        DocumentReferenceItemRef::SymbolRepresentation(i) => {
24246            if i.0 >= model.symbol_representation_arena.items.len() {
24247                return Err(AuthorError::DanglingRef {
24248                    entity: "SYMBOL_REPRESENTATION",
24249                });
24250            }
24251        }
24252        DocumentReferenceItemRef::SymbolTarget(i) => {
24253            if i.0 >= model.symbol_target_arena.items.len() {
24254                return Err(AuthorError::DanglingRef {
24255                    entity: "SYMBOL_TARGET",
24256                });
24257            }
24258        }
24259        DocumentReferenceItemRef::TerminatorSymbol(i) => {
24260            if i.0 >= model.terminator_symbol_arena.items.len() {
24261                return Err(AuthorError::DanglingRef {
24262                    entity: "TERMINATOR_SYMBOL",
24263                });
24264            }
24265        }
24266        DocumentReferenceItemRef::TessellatedAnnotationOccurrence(i) => {
24267            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
24268                return Err(AuthorError::DanglingRef {
24269                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
24270                });
24271            }
24272        }
24273        DocumentReferenceItemRef::TessellatedCurveSet(i) => {
24274            if i.0 >= model.tessellated_curve_set_arena.items.len() {
24275                return Err(AuthorError::DanglingRef {
24276                    entity: "TESSELLATED_CURVE_SET",
24277                });
24278            }
24279        }
24280        DocumentReferenceItemRef::TessellatedFace(i) => {
24281            if i.0 >= model.tessellated_face_arena.items.len() {
24282                return Err(AuthorError::DanglingRef {
24283                    entity: "TESSELLATED_FACE",
24284                });
24285            }
24286        }
24287        DocumentReferenceItemRef::TessellatedGeometricSet(i) => {
24288            if i.0 >= model.tessellated_geometric_set_arena.items.len() {
24289                return Err(AuthorError::DanglingRef {
24290                    entity: "TESSELLATED_GEOMETRIC_SET",
24291                });
24292            }
24293        }
24294        DocumentReferenceItemRef::TessellatedItem(i) => {
24295            if i.0 >= model.tessellated_item_arena.items.len() {
24296                return Err(AuthorError::DanglingRef {
24297                    entity: "TESSELLATED_ITEM",
24298                });
24299            }
24300        }
24301        DocumentReferenceItemRef::TessellatedShapeRepresentation(i) => {
24302            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
24303                return Err(AuthorError::DanglingRef {
24304                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
24305                });
24306            }
24307        }
24308        DocumentReferenceItemRef::TessellatedShell(i) => {
24309            if i.0 >= model.tessellated_shell_arena.items.len() {
24310                return Err(AuthorError::DanglingRef {
24311                    entity: "TESSELLATED_SHELL",
24312                });
24313            }
24314        }
24315        DocumentReferenceItemRef::TessellatedSolid(i) => {
24316            if i.0 >= model.tessellated_solid_arena.items.len() {
24317                return Err(AuthorError::DanglingRef {
24318                    entity: "TESSELLATED_SOLID",
24319                });
24320            }
24321        }
24322        DocumentReferenceItemRef::TessellatedStructuredItem(i) => {
24323            if i.0 >= model.tessellated_structured_item_arena.items.len() {
24324                return Err(AuthorError::DanglingRef {
24325                    entity: "TESSELLATED_STRUCTURED_ITEM",
24326                });
24327            }
24328        }
24329        DocumentReferenceItemRef::TessellatedSurfaceSet(i) => {
24330            if i.0 >= model.tessellated_surface_set_arena.items.len() {
24331                return Err(AuthorError::DanglingRef {
24332                    entity: "TESSELLATED_SURFACE_SET",
24333                });
24334            }
24335        }
24336        DocumentReferenceItemRef::TextLiteral(i) => {
24337            if i.0 >= model.text_literal_arena.items.len() {
24338                return Err(AuthorError::DanglingRef {
24339                    entity: "TEXT_LITERAL",
24340                });
24341            }
24342        }
24343        DocumentReferenceItemRef::ToleranceZone(i) => {
24344            if i.0 >= model.tolerance_zone_arena.items.len() {
24345                return Err(AuthorError::DanglingRef {
24346                    entity: "TOLERANCE_ZONE",
24347                });
24348            }
24349        }
24350        DocumentReferenceItemRef::ToleranceZoneWithDatum(i) => {
24351            if i.0 >= model.tolerance_zone_with_datum_arena.items.len() {
24352                return Err(AuthorError::DanglingRef {
24353                    entity: "TOLERANCE_ZONE_WITH_DATUM",
24354                });
24355            }
24356        }
24357        DocumentReferenceItemRef::TopologicalRepresentationItem(i) => {
24358            if i.0 >= model.topological_representation_item_arena.items.len() {
24359                return Err(AuthorError::DanglingRef {
24360                    entity: "TOPOLOGICAL_REPRESENTATION_ITEM",
24361                });
24362            }
24363        }
24364        DocumentReferenceItemRef::ToroidalSurface(i) => {
24365            if i.0 >= model.toroidal_surface_arena.items.len() {
24366                return Err(AuthorError::DanglingRef {
24367                    entity: "TOROIDAL_SURFACE",
24368                });
24369            }
24370        }
24371        DocumentReferenceItemRef::TrimmedCurve(i) => {
24372            if i.0 >= model.trimmed_curve_arena.items.len() {
24373                return Err(AuthorError::DanglingRef {
24374                    entity: "TRIMMED_CURVE",
24375                });
24376            }
24377        }
24378        DocumentReferenceItemRef::TwoDirectionRepeatFactor(i) => {
24379            if i.0 >= model.two_direction_repeat_factor_arena.items.len() {
24380                return Err(AuthorError::DanglingRef {
24381                    entity: "TWO_DIRECTION_REPEAT_FACTOR",
24382                });
24383            }
24384        }
24385        DocumentReferenceItemRef::UniformCurve(i) => {
24386            if i.0 >= model.uniform_curve_arena.items.len() {
24387                return Err(AuthorError::DanglingRef {
24388                    entity: "UNIFORM_CURVE",
24389                });
24390            }
24391        }
24392        DocumentReferenceItemRef::UniformSurface(i) => {
24393            if i.0 >= model.uniform_surface_arena.items.len() {
24394                return Err(AuthorError::DanglingRef {
24395                    entity: "UNIFORM_SURFACE",
24396                });
24397            }
24398        }
24399        DocumentReferenceItemRef::ValueRepresentationItem(i) => {
24400            if i.0 >= model.value_representation_item_arena.items.len() {
24401                return Err(AuthorError::DanglingRef {
24402                    entity: "VALUE_REPRESENTATION_ITEM",
24403                });
24404            }
24405        }
24406        DocumentReferenceItemRef::Vector(i) => {
24407            if i.0 >= model.vector_arena.items.len() {
24408                return Err(AuthorError::DanglingRef { entity: "VECTOR" });
24409            }
24410        }
24411        DocumentReferenceItemRef::VersionedActionRequest(i) => {
24412            if i.0 >= model.versioned_action_request_arena.items.len() {
24413                return Err(AuthorError::DanglingRef {
24414                    entity: "VERSIONED_ACTION_REQUEST",
24415                });
24416            }
24417        }
24418        DocumentReferenceItemRef::Vertex(i) => {
24419            if i.0 >= model.vertex_arena.items.len() {
24420                return Err(AuthorError::DanglingRef { entity: "VERTEX" });
24421            }
24422        }
24423        DocumentReferenceItemRef::VertexLoop(i) => {
24424            if i.0 >= model.vertex_loop_arena.items.len() {
24425                return Err(AuthorError::DanglingRef {
24426                    entity: "VERTEX_LOOP",
24427                });
24428            }
24429        }
24430        DocumentReferenceItemRef::VertexPoint(i) => {
24431            if i.0 >= model.vertex_point_arena.items.len() {
24432                return Err(AuthorError::DanglingRef {
24433                    entity: "VERTEX_POINT",
24434                });
24435            }
24436        }
24437        DocumentReferenceItemRef::VertexShell(i) => {
24438            if i.0 >= model.vertex_shell_arena.items.len() {
24439                return Err(AuthorError::DanglingRef {
24440                    entity: "VERTEX_SHELL",
24441                });
24442            }
24443        }
24444        DocumentReferenceItemRef::WireShell(i) => {
24445            if i.0 >= model.wire_shell_arena.items.len() {
24446                return Err(AuthorError::DanglingRef {
24447                    entity: "WIRE_SHELL",
24448                });
24449            }
24450        }
24451        DocumentReferenceItemRef::Complex(i) => {
24452            if i.0 >= model.complex_unit_arena.items.len() {
24453                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
24454            }
24455        }
24456    }
24457    Ok(())
24458}
24459fn check_document_type_ref(model: &StepModel, r: &DocumentTypeRef) -> Result<(), AuthorError> {
24460    match r {
24461        DocumentTypeRef::DocumentType(i) => {
24462            if i.0 >= model.document_type_arena.items.len() {
24463                return Err(AuthorError::DanglingRef {
24464                    entity: "DOCUMENT_TYPE",
24465                });
24466            }
24467        }
24468    }
24469    Ok(())
24470}
24471fn check_draughting_callout_ref(
24472    model: &StepModel,
24473    r: &DraughtingCalloutRef,
24474) -> Result<(), AuthorError> {
24475    match r {
24476        DraughtingCalloutRef::DraughtingCallout(i) => {
24477            if i.0 >= model.draughting_callout_arena.items.len() {
24478                return Err(AuthorError::DanglingRef {
24479                    entity: "DRAUGHTING_CALLOUT",
24480                });
24481            }
24482        }
24483        DraughtingCalloutRef::LeaderDirectedCallout(i) => {
24484            if i.0 >= model.leader_directed_callout_arena.items.len() {
24485                return Err(AuthorError::DanglingRef {
24486                    entity: "LEADER_DIRECTED_CALLOUT",
24487                });
24488            }
24489        }
24490        DraughtingCalloutRef::Complex(i) => {
24491            if i.0 >= model.complex_unit_arena.items.len() {
24492                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
24493            }
24494        }
24495    }
24496    Ok(())
24497}
24498fn check_draughting_callout_element_ref(
24499    model: &StepModel,
24500    r: &DraughtingCalloutElementRef,
24501) -> Result<(), AuthorError> {
24502    match r {
24503        DraughtingCalloutElementRef::AnnotationCurveOccurrence(i) => {
24504            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
24505                return Err(AuthorError::DanglingRef {
24506                    entity: "ANNOTATION_CURVE_OCCURRENCE",
24507                });
24508            }
24509        }
24510        DraughtingCalloutElementRef::AnnotationFillAreaOccurrence(i) => {
24511            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
24512                return Err(AuthorError::DanglingRef {
24513                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
24514                });
24515            }
24516        }
24517        DraughtingCalloutElementRef::AnnotationPlaceholderOccurrence(i) => {
24518            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
24519                return Err(AuthorError::DanglingRef {
24520                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
24521                });
24522            }
24523        }
24524        DraughtingCalloutElementRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
24525            return Err(AuthorError::NotAp242 {
24526                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
24527            });
24528        }
24529        DraughtingCalloutElementRef::AnnotationSymbolOccurrence(i) => {
24530            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
24531                return Err(AuthorError::DanglingRef {
24532                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
24533                });
24534            }
24535        }
24536        DraughtingCalloutElementRef::AnnotationTextOccurrence(i) => {
24537            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
24538                return Err(AuthorError::DanglingRef {
24539                    entity: "ANNOTATION_TEXT_OCCURRENCE",
24540                });
24541            }
24542        }
24543        DraughtingCalloutElementRef::LeaderCurve(i) => {
24544            if i.0 >= model.leader_curve_arena.items.len() {
24545                return Err(AuthorError::DanglingRef {
24546                    entity: "LEADER_CURVE",
24547                });
24548            }
24549        }
24550        DraughtingCalloutElementRef::LeaderTerminator(i) => {
24551            if i.0 >= model.leader_terminator_arena.items.len() {
24552                return Err(AuthorError::DanglingRef {
24553                    entity: "LEADER_TERMINATOR",
24554                });
24555            }
24556        }
24557        DraughtingCalloutElementRef::TerminatorSymbol(i) => {
24558            if i.0 >= model.terminator_symbol_arena.items.len() {
24559                return Err(AuthorError::DanglingRef {
24560                    entity: "TERMINATOR_SYMBOL",
24561                });
24562            }
24563        }
24564        DraughtingCalloutElementRef::TessellatedAnnotationOccurrence(i) => {
24565            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
24566                return Err(AuthorError::DanglingRef {
24567                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
24568                });
24569            }
24570        }
24571        DraughtingCalloutElementRef::Complex(i) => {
24572            if i.0 >= model.complex_unit_arena.items.len() {
24573                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
24574            }
24575        }
24576    }
24577    Ok(())
24578}
24579fn check_draughting_model_item_association_select_ref(
24580    model: &StepModel,
24581    r: &DraughtingModelItemAssociationSelectRef,
24582) -> Result<(), AuthorError> {
24583    match r {
24584        DraughtingModelItemAssociationSelectRef::AnnotationCurveOccurrence(i) => {
24585            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
24586                return Err(AuthorError::DanglingRef {
24587                    entity: "ANNOTATION_CURVE_OCCURRENCE",
24588                });
24589            }
24590        }
24591        DraughtingModelItemAssociationSelectRef::AnnotationFillAreaOccurrence(i) => {
24592            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
24593                return Err(AuthorError::DanglingRef {
24594                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
24595                });
24596            }
24597        }
24598        DraughtingModelItemAssociationSelectRef::AnnotationOccurrence(i) => {
24599            if i.0 >= model.annotation_occurrence_arena.items.len() {
24600                return Err(AuthorError::DanglingRef {
24601                    entity: "ANNOTATION_OCCURRENCE",
24602                });
24603            }
24604        }
24605        DraughtingModelItemAssociationSelectRef::AnnotationPlaceholderOccurrence(i) => {
24606            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
24607                return Err(AuthorError::DanglingRef {
24608                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
24609                });
24610            }
24611        }
24612        DraughtingModelItemAssociationSelectRef::AnnotationPlaceholderOccurrenceWithLeaderLine(
24613            _,
24614        ) => {
24615            return Err(AuthorError::NotAp242 {
24616                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
24617            });
24618        }
24619        DraughtingModelItemAssociationSelectRef::AnnotationPlane(i) => {
24620            if i.0 >= model.annotation_plane_arena.items.len() {
24621                return Err(AuthorError::DanglingRef {
24622                    entity: "ANNOTATION_PLANE",
24623                });
24624            }
24625        }
24626        DraughtingModelItemAssociationSelectRef::AnnotationSymbolOccurrence(i) => {
24627            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
24628                return Err(AuthorError::DanglingRef {
24629                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
24630                });
24631            }
24632        }
24633        DraughtingModelItemAssociationSelectRef::AnnotationTextOccurrence(i) => {
24634            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
24635                return Err(AuthorError::DanglingRef {
24636                    entity: "ANNOTATION_TEXT_OCCURRENCE",
24637                });
24638            }
24639        }
24640        DraughtingModelItemAssociationSelectRef::DraughtingAnnotationOccurrence(i) => {
24641            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
24642                return Err(AuthorError::DanglingRef {
24643                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
24644                });
24645            }
24646        }
24647        DraughtingModelItemAssociationSelectRef::DraughtingCallout(i) => {
24648            if i.0 >= model.draughting_callout_arena.items.len() {
24649                return Err(AuthorError::DanglingRef {
24650                    entity: "DRAUGHTING_CALLOUT",
24651                });
24652            }
24653        }
24654        DraughtingModelItemAssociationSelectRef::LeaderCurve(i) => {
24655            if i.0 >= model.leader_curve_arena.items.len() {
24656                return Err(AuthorError::DanglingRef {
24657                    entity: "LEADER_CURVE",
24658                });
24659            }
24660        }
24661        DraughtingModelItemAssociationSelectRef::LeaderDirectedCallout(i) => {
24662            if i.0 >= model.leader_directed_callout_arena.items.len() {
24663                return Err(AuthorError::DanglingRef {
24664                    entity: "LEADER_DIRECTED_CALLOUT",
24665                });
24666            }
24667        }
24668        DraughtingModelItemAssociationSelectRef::LeaderTerminator(i) => {
24669            if i.0 >= model.leader_terminator_arena.items.len() {
24670                return Err(AuthorError::DanglingRef {
24671                    entity: "LEADER_TERMINATOR",
24672                });
24673            }
24674        }
24675        DraughtingModelItemAssociationSelectRef::TerminatorSymbol(i) => {
24676            if i.0 >= model.terminator_symbol_arena.items.len() {
24677                return Err(AuthorError::DanglingRef {
24678                    entity: "TERMINATOR_SYMBOL",
24679                });
24680            }
24681        }
24682        DraughtingModelItemAssociationSelectRef::TessellatedAnnotationOccurrence(i) => {
24683            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
24684                return Err(AuthorError::DanglingRef {
24685                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
24686                });
24687            }
24688        }
24689        DraughtingModelItemAssociationSelectRef::Complex(i) => {
24690            if i.0 >= model.complex_unit_arena.items.len() {
24691                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
24692            }
24693        }
24694    }
24695    Ok(())
24696}
24697fn check_draughting_model_item_definition_ref(
24698    model: &StepModel,
24699    r: &DraughtingModelItemDefinitionRef,
24700) -> Result<(), AuthorError> {
24701    match r {
24702        DraughtingModelItemDefinitionRef::AllAroundShapeAspect(i) => {
24703            if i.0 >= model.all_around_shape_aspect_arena.items.len() {
24704                return Err(AuthorError::DanglingRef {
24705                    entity: "ALL_AROUND_SHAPE_ASPECT",
24706                });
24707            }
24708        }
24709        DraughtingModelItemDefinitionRef::AngularLocation(i) => {
24710            if i.0 >= model.angular_location_arena.items.len() {
24711                return Err(AuthorError::DanglingRef {
24712                    entity: "ANGULAR_LOCATION",
24713                });
24714            }
24715        }
24716        DraughtingModelItemDefinitionRef::AngularSize(i) => {
24717            if i.0 >= model.angular_size_arena.items.len() {
24718                return Err(AuthorError::DanglingRef {
24719                    entity: "ANGULAR_SIZE",
24720                });
24721            }
24722        }
24723        DraughtingModelItemDefinitionRef::AngularityTolerance(i) => {
24724            if i.0 >= model.angularity_tolerance_arena.items.len() {
24725                return Err(AuthorError::DanglingRef {
24726                    entity: "ANGULARITY_TOLERANCE",
24727                });
24728            }
24729        }
24730        DraughtingModelItemDefinitionRef::AssemblyComponentUsage(i) => {
24731            if i.0 >= model.assembly_component_usage_arena.items.len() {
24732                return Err(AuthorError::DanglingRef {
24733                    entity: "ASSEMBLY_COMPONENT_USAGE",
24734                });
24735            }
24736        }
24737        DraughtingModelItemDefinitionRef::CentreOfSymmetry(i) => {
24738            if i.0 >= model.centre_of_symmetry_arena.items.len() {
24739                return Err(AuthorError::DanglingRef {
24740                    entity: "CENTRE_OF_SYMMETRY",
24741                });
24742            }
24743        }
24744        DraughtingModelItemDefinitionRef::CircularRunoutTolerance(i) => {
24745            if i.0 >= model.circular_runout_tolerance_arena.items.len() {
24746                return Err(AuthorError::DanglingRef {
24747                    entity: "CIRCULAR_RUNOUT_TOLERANCE",
24748                });
24749            }
24750        }
24751        DraughtingModelItemDefinitionRef::CoaxialityTolerance(i) => {
24752            if i.0 >= model.coaxiality_tolerance_arena.items.len() {
24753                return Err(AuthorError::DanglingRef {
24754                    entity: "COAXIALITY_TOLERANCE",
24755                });
24756            }
24757        }
24758        DraughtingModelItemDefinitionRef::CommonDatum(i) => {
24759            if i.0 >= model.common_datum_arena.items.len() {
24760                return Err(AuthorError::DanglingRef {
24761                    entity: "COMMON_DATUM",
24762                });
24763            }
24764        }
24765        DraughtingModelItemDefinitionRef::CompositeGroupShapeAspect(i) => {
24766            if i.0 >= model.composite_group_shape_aspect_arena.items.len() {
24767                return Err(AuthorError::DanglingRef {
24768                    entity: "COMPOSITE_GROUP_SHAPE_ASPECT",
24769                });
24770            }
24771        }
24772        DraughtingModelItemDefinitionRef::CompositeShapeAspect(i) => {
24773            if i.0 >= model.composite_shape_aspect_arena.items.len() {
24774                return Err(AuthorError::DanglingRef {
24775                    entity: "COMPOSITE_SHAPE_ASPECT",
24776                });
24777            }
24778        }
24779        DraughtingModelItemDefinitionRef::ConcentricityTolerance(i) => {
24780            if i.0 >= model.concentricity_tolerance_arena.items.len() {
24781                return Err(AuthorError::DanglingRef {
24782                    entity: "CONCENTRICITY_TOLERANCE",
24783                });
24784            }
24785        }
24786        DraughtingModelItemDefinitionRef::ContinuousShapeAspect(i) => {
24787            if i.0 >= model.continuous_shape_aspect_arena.items.len() {
24788                return Err(AuthorError::DanglingRef {
24789                    entity: "CONTINUOUS_SHAPE_ASPECT",
24790                });
24791            }
24792        }
24793        DraughtingModelItemDefinitionRef::CylindricityTolerance(i) => {
24794            if i.0 >= model.cylindricity_tolerance_arena.items.len() {
24795                return Err(AuthorError::DanglingRef {
24796                    entity: "CYLINDRICITY_TOLERANCE",
24797                });
24798            }
24799        }
24800        DraughtingModelItemDefinitionRef::Datum(i) => {
24801            if i.0 >= model.datum_arena.items.len() {
24802                return Err(AuthorError::DanglingRef { entity: "DATUM" });
24803            }
24804        }
24805        DraughtingModelItemDefinitionRef::DatumFeature(i) => {
24806            if i.0 >= model.datum_feature_arena.items.len() {
24807                return Err(AuthorError::DanglingRef {
24808                    entity: "DATUM_FEATURE",
24809                });
24810            }
24811        }
24812        DraughtingModelItemDefinitionRef::DatumReferenceCompartment(i) => {
24813            if i.0 >= model.datum_reference_compartment_arena.items.len() {
24814                return Err(AuthorError::DanglingRef {
24815                    entity: "DATUM_REFERENCE_COMPARTMENT",
24816                });
24817            }
24818        }
24819        DraughtingModelItemDefinitionRef::DatumReferenceElement(i) => {
24820            if i.0 >= model.datum_reference_element_arena.items.len() {
24821                return Err(AuthorError::DanglingRef {
24822                    entity: "DATUM_REFERENCE_ELEMENT",
24823                });
24824            }
24825        }
24826        DraughtingModelItemDefinitionRef::DatumSystem(i) => {
24827            if i.0 >= model.datum_system_arena.items.len() {
24828                return Err(AuthorError::DanglingRef {
24829                    entity: "DATUM_SYSTEM",
24830                });
24831            }
24832        }
24833        DraughtingModelItemDefinitionRef::DatumTarget(i) => {
24834            if i.0 >= model.datum_target_arena.items.len() {
24835                return Err(AuthorError::DanglingRef {
24836                    entity: "DATUM_TARGET",
24837                });
24838            }
24839        }
24840        DraughtingModelItemDefinitionRef::DefaultModelGeometricView(i) => {
24841            if i.0 >= model.default_model_geometric_view_arena.items.len() {
24842                return Err(AuthorError::DanglingRef {
24843                    entity: "DEFAULT_MODEL_GEOMETRIC_VIEW",
24844                });
24845            }
24846        }
24847        DraughtingModelItemDefinitionRef::DerivedShapeAspect(i) => {
24848            if i.0 >= model.derived_shape_aspect_arena.items.len() {
24849                return Err(AuthorError::DanglingRef {
24850                    entity: "DERIVED_SHAPE_ASPECT",
24851                });
24852            }
24853        }
24854        DraughtingModelItemDefinitionRef::DimensionalLocation(i) => {
24855            if i.0 >= model.dimensional_location_arena.items.len() {
24856                return Err(AuthorError::DanglingRef {
24857                    entity: "DIMENSIONAL_LOCATION",
24858                });
24859            }
24860        }
24861        DraughtingModelItemDefinitionRef::DimensionalLocationWithPath(i) => {
24862            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
24863                return Err(AuthorError::DanglingRef {
24864                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
24865                });
24866            }
24867        }
24868        DraughtingModelItemDefinitionRef::DimensionalSize(i) => {
24869            if i.0 >= model.dimensional_size_arena.items.len() {
24870                return Err(AuthorError::DanglingRef {
24871                    entity: "DIMENSIONAL_SIZE",
24872                });
24873            }
24874        }
24875        DraughtingModelItemDefinitionRef::DimensionalSizeWithDatumFeature(i) => {
24876            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
24877                return Err(AuthorError::DanglingRef {
24878                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
24879                });
24880            }
24881        }
24882        DraughtingModelItemDefinitionRef::DimensionalSizeWithPath(i) => {
24883            if i.0 >= model.dimensional_size_with_path_arena.items.len() {
24884                return Err(AuthorError::DanglingRef {
24885                    entity: "DIMENSIONAL_SIZE_WITH_PATH",
24886                });
24887            }
24888        }
24889        DraughtingModelItemDefinitionRef::DirectedDimensionalLocation(i) => {
24890            if i.0 >= model.directed_dimensional_location_arena.items.len() {
24891                return Err(AuthorError::DanglingRef {
24892                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
24893                });
24894            }
24895        }
24896        DraughtingModelItemDefinitionRef::FeatureForDatumTargetRelationship(i) => {
24897            if i.0
24898                >= model
24899                    .feature_for_datum_target_relationship_arena
24900                    .items
24901                    .len()
24902            {
24903                return Err(AuthorError::DanglingRef {
24904                    entity: "FEATURE_FOR_DATUM_TARGET_RELATIONSHIP",
24905                });
24906            }
24907        }
24908        DraughtingModelItemDefinitionRef::FlatnessTolerance(i) => {
24909            if i.0 >= model.flatness_tolerance_arena.items.len() {
24910                return Err(AuthorError::DanglingRef {
24911                    entity: "FLATNESS_TOLERANCE",
24912                });
24913            }
24914        }
24915        DraughtingModelItemDefinitionRef::GeneralDatumReference(i) => {
24916            if i.0 >= model.general_datum_reference_arena.items.len() {
24917                return Err(AuthorError::DanglingRef {
24918                    entity: "GENERAL_DATUM_REFERENCE",
24919                });
24920            }
24921        }
24922        DraughtingModelItemDefinitionRef::GeometricTolerance(i) => {
24923            if i.0 >= model.geometric_tolerance_arena.items.len() {
24924                return Err(AuthorError::DanglingRef {
24925                    entity: "GEOMETRIC_TOLERANCE",
24926                });
24927            }
24928        }
24929        DraughtingModelItemDefinitionRef::GeometricToleranceWithDatumReference(i) => {
24930            if i.0
24931                >= model
24932                    .geometric_tolerance_with_datum_reference_arena
24933                    .items
24934                    .len()
24935            {
24936                return Err(AuthorError::DanglingRef {
24937                    entity: "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
24938                });
24939            }
24940        }
24941        DraughtingModelItemDefinitionRef::GeometricToleranceWithDefinedAreaUnit(i) => {
24942            if i.0
24943                >= model
24944                    .geometric_tolerance_with_defined_area_unit_arena
24945                    .items
24946                    .len()
24947            {
24948                return Err(AuthorError::DanglingRef {
24949                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_AREA_UNIT",
24950                });
24951            }
24952        }
24953        DraughtingModelItemDefinitionRef::GeometricToleranceWithDefinedUnit(i) => {
24954            if i.0
24955                >= model
24956                    .geometric_tolerance_with_defined_unit_arena
24957                    .items
24958                    .len()
24959            {
24960                return Err(AuthorError::DanglingRef {
24961                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_UNIT",
24962                });
24963            }
24964        }
24965        DraughtingModelItemDefinitionRef::GeometricToleranceWithMaximumTolerance(i) => {
24966            if i.0
24967                >= model
24968                    .geometric_tolerance_with_maximum_tolerance_arena
24969                    .items
24970                    .len()
24971            {
24972                return Err(AuthorError::DanglingRef {
24973                    entity: "GEOMETRIC_TOLERANCE_WITH_MAXIMUM_TOLERANCE",
24974                });
24975            }
24976        }
24977        DraughtingModelItemDefinitionRef::GeometricToleranceWithModifiers(i) => {
24978            if i.0 >= model.geometric_tolerance_with_modifiers_arena.items.len() {
24979                return Err(AuthorError::DanglingRef {
24980                    entity: "GEOMETRIC_TOLERANCE_WITH_MODIFIERS",
24981                });
24982            }
24983        }
24984        DraughtingModelItemDefinitionRef::LineProfileTolerance(i) => {
24985            if i.0 >= model.line_profile_tolerance_arena.items.len() {
24986                return Err(AuthorError::DanglingRef {
24987                    entity: "LINE_PROFILE_TOLERANCE",
24988                });
24989            }
24990        }
24991        DraughtingModelItemDefinitionRef::MakeFromUsageOption(i) => {
24992            if i.0 >= model.make_from_usage_option_arena.items.len() {
24993                return Err(AuthorError::DanglingRef {
24994                    entity: "MAKE_FROM_USAGE_OPTION",
24995                });
24996            }
24997        }
24998        DraughtingModelItemDefinitionRef::ModifiedGeometricTolerance(i) => {
24999            if i.0 >= model.modified_geometric_tolerance_arena.items.len() {
25000                return Err(AuthorError::DanglingRef {
25001                    entity: "MODIFIED_GEOMETRIC_TOLERANCE",
25002                });
25003            }
25004        }
25005        DraughtingModelItemDefinitionRef::NextAssemblyUsageOccurrence(i) => {
25006            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
25007                return Err(AuthorError::DanglingRef {
25008                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
25009                });
25010            }
25011        }
25012        DraughtingModelItemDefinitionRef::ParallelismTolerance(i) => {
25013            if i.0 >= model.parallelism_tolerance_arena.items.len() {
25014                return Err(AuthorError::DanglingRef {
25015                    entity: "PARALLELISM_TOLERANCE",
25016                });
25017            }
25018        }
25019        DraughtingModelItemDefinitionRef::PerpendicularityTolerance(i) => {
25020            if i.0 >= model.perpendicularity_tolerance_arena.items.len() {
25021                return Err(AuthorError::DanglingRef {
25022                    entity: "PERPENDICULARITY_TOLERANCE",
25023                });
25024            }
25025        }
25026        DraughtingModelItemDefinitionRef::PlacedDatumTargetFeature(i) => {
25027            if i.0 >= model.placed_datum_target_feature_arena.items.len() {
25028                return Err(AuthorError::DanglingRef {
25029                    entity: "PLACED_DATUM_TARGET_FEATURE",
25030                });
25031            }
25032        }
25033        DraughtingModelItemDefinitionRef::PositionTolerance(i) => {
25034            if i.0 >= model.position_tolerance_arena.items.len() {
25035                return Err(AuthorError::DanglingRef {
25036                    entity: "POSITION_TOLERANCE",
25037                });
25038            }
25039        }
25040        DraughtingModelItemDefinitionRef::ProductDefinitionRelationship(i) => {
25041            if i.0 >= model.product_definition_relationship_arena.items.len() {
25042                return Err(AuthorError::DanglingRef {
25043                    entity: "PRODUCT_DEFINITION_RELATIONSHIP",
25044                });
25045            }
25046        }
25047        DraughtingModelItemDefinitionRef::ProductDefinitionShape(i) => {
25048            if i.0 >= model.product_definition_shape_arena.items.len() {
25049                return Err(AuthorError::DanglingRef {
25050                    entity: "PRODUCT_DEFINITION_SHAPE",
25051                });
25052            }
25053        }
25054        DraughtingModelItemDefinitionRef::ProductDefinitionUsage(i) => {
25055            if i.0 >= model.product_definition_usage_arena.items.len() {
25056                return Err(AuthorError::DanglingRef {
25057                    entity: "PRODUCT_DEFINITION_USAGE",
25058                });
25059            }
25060        }
25061        DraughtingModelItemDefinitionRef::PropertyDefinition(i) => {
25062            if i.0 >= model.property_definition_arena.items.len() {
25063                return Err(AuthorError::DanglingRef {
25064                    entity: "PROPERTY_DEFINITION",
25065                });
25066            }
25067        }
25068        DraughtingModelItemDefinitionRef::RoundnessTolerance(i) => {
25069            if i.0 >= model.roundness_tolerance_arena.items.len() {
25070                return Err(AuthorError::DanglingRef {
25071                    entity: "ROUNDNESS_TOLERANCE",
25072                });
25073            }
25074        }
25075        DraughtingModelItemDefinitionRef::ShapeAspect(i) => {
25076            if i.0 >= model.shape_aspect_arena.items.len() {
25077                return Err(AuthorError::DanglingRef {
25078                    entity: "SHAPE_ASPECT",
25079                });
25080            }
25081        }
25082        DraughtingModelItemDefinitionRef::ShapeAspectAssociativity(i) => {
25083            if i.0 >= model.shape_aspect_associativity_arena.items.len() {
25084                return Err(AuthorError::DanglingRef {
25085                    entity: "SHAPE_ASPECT_ASSOCIATIVITY",
25086                });
25087            }
25088        }
25089        DraughtingModelItemDefinitionRef::ShapeAspectDerivingRelationship(i) => {
25090            if i.0 >= model.shape_aspect_deriving_relationship_arena.items.len() {
25091                return Err(AuthorError::DanglingRef {
25092                    entity: "SHAPE_ASPECT_DERIVING_RELATIONSHIP",
25093                });
25094            }
25095        }
25096        DraughtingModelItemDefinitionRef::ShapeAspectRelationship(i) => {
25097            if i.0 >= model.shape_aspect_relationship_arena.items.len() {
25098                return Err(AuthorError::DanglingRef {
25099                    entity: "SHAPE_ASPECT_RELATIONSHIP",
25100                });
25101            }
25102        }
25103        DraughtingModelItemDefinitionRef::StraightnessTolerance(i) => {
25104            if i.0 >= model.straightness_tolerance_arena.items.len() {
25105                return Err(AuthorError::DanglingRef {
25106                    entity: "STRAIGHTNESS_TOLERANCE",
25107                });
25108            }
25109        }
25110        DraughtingModelItemDefinitionRef::SurfaceProfileTolerance(i) => {
25111            if i.0 >= model.surface_profile_tolerance_arena.items.len() {
25112                return Err(AuthorError::DanglingRef {
25113                    entity: "SURFACE_PROFILE_TOLERANCE",
25114                });
25115            }
25116        }
25117        DraughtingModelItemDefinitionRef::SymmetryTolerance(i) => {
25118            if i.0 >= model.symmetry_tolerance_arena.items.len() {
25119                return Err(AuthorError::DanglingRef {
25120                    entity: "SYMMETRY_TOLERANCE",
25121                });
25122            }
25123        }
25124        DraughtingModelItemDefinitionRef::ToleranceZone(i) => {
25125            if i.0 >= model.tolerance_zone_arena.items.len() {
25126                return Err(AuthorError::DanglingRef {
25127                    entity: "TOLERANCE_ZONE",
25128                });
25129            }
25130        }
25131        DraughtingModelItemDefinitionRef::ToleranceZoneWithDatum(i) => {
25132            if i.0 >= model.tolerance_zone_with_datum_arena.items.len() {
25133                return Err(AuthorError::DanglingRef {
25134                    entity: "TOLERANCE_ZONE_WITH_DATUM",
25135                });
25136            }
25137        }
25138        DraughtingModelItemDefinitionRef::TotalRunoutTolerance(i) => {
25139            if i.0 >= model.total_runout_tolerance_arena.items.len() {
25140                return Err(AuthorError::DanglingRef {
25141                    entity: "TOTAL_RUNOUT_TOLERANCE",
25142                });
25143            }
25144        }
25145        DraughtingModelItemDefinitionRef::UnequallyDisposedGeometricTolerance(i) => {
25146            if i.0
25147                >= model
25148                    .unequally_disposed_geometric_tolerance_arena
25149                    .items
25150                    .len()
25151            {
25152                return Err(AuthorError::DanglingRef {
25153                    entity: "UNEQUALLY_DISPOSED_GEOMETRIC_TOLERANCE",
25154                });
25155            }
25156        }
25157        DraughtingModelItemDefinitionRef::Complex(i) => {
25158            if i.0 >= model.complex_unit_arena.items.len() {
25159                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
25160            }
25161        }
25162    }
25163    Ok(())
25164}
25165fn check_edge_ref(model: &StepModel, r: &EdgeRef) -> Result<(), AuthorError> {
25166    match r {
25167        EdgeRef::Edge(i) => {
25168            if i.0 >= model.edge_arena.items.len() {
25169                return Err(AuthorError::DanglingRef { entity: "EDGE" });
25170            }
25171        }
25172        EdgeRef::EdgeCurve(i) => {
25173            if i.0 >= model.edge_curve_arena.items.len() {
25174                return Err(AuthorError::DanglingRef {
25175                    entity: "EDGE_CURVE",
25176                });
25177            }
25178        }
25179        EdgeRef::OrientedEdge(i) => {
25180            if i.0 >= model.oriented_edge_arena.items.len() {
25181                return Err(AuthorError::DanglingRef {
25182                    entity: "ORIENTED_EDGE",
25183                });
25184            }
25185        }
25186        EdgeRef::Complex(i) => {
25187            if i.0 >= model.complex_unit_arena.items.len() {
25188                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
25189            }
25190        }
25191    }
25192    Ok(())
25193}
25194fn check_external_identification_item_ref(
25195    model: &StepModel,
25196    r: &ExternalIdentificationItemRef,
25197) -> Result<(), AuthorError> {
25198    match r {
25199        ExternalIdentificationItemRef::ActionDirective(i) => {
25200            if i.0 >= model.action_directive_arena.items.len() {
25201                return Err(AuthorError::DanglingRef {
25202                    entity: "ACTION_DIRECTIVE",
25203                });
25204            }
25205        }
25206        ExternalIdentificationItemRef::ActionMethod(i) => {
25207            if i.0 >= model.action_method_arena.items.len() {
25208                return Err(AuthorError::DanglingRef {
25209                    entity: "ACTION_METHOD",
25210                });
25211            }
25212        }
25213        ExternalIdentificationItemRef::ActionMethodRelationship(i) => {
25214            if i.0 >= model.action_method_relationship_arena.items.len() {
25215                return Err(AuthorError::DanglingRef {
25216                    entity: "ACTION_METHOD_RELATIONSHIP",
25217                });
25218            }
25219        }
25220        ExternalIdentificationItemRef::ActionRelationship(i) => {
25221            if i.0 >= model.action_relationship_arena.items.len() {
25222                return Err(AuthorError::DanglingRef {
25223                    entity: "ACTION_RELATIONSHIP",
25224                });
25225            }
25226        }
25227        ExternalIdentificationItemRef::Address(i) => {
25228            if i.0 >= model.address_arena.items.len() {
25229                return Err(AuthorError::DanglingRef { entity: "ADDRESS" });
25230            }
25231        }
25232        ExternalIdentificationItemRef::AdvancedBrepShapeRepresentation(i) => {
25233            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
25234                return Err(AuthorError::DanglingRef {
25235                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
25236                });
25237            }
25238        }
25239        ExternalIdentificationItemRef::AdvancedFace(i) => {
25240            if i.0 >= model.advanced_face_arena.items.len() {
25241                return Err(AuthorError::DanglingRef {
25242                    entity: "ADVANCED_FACE",
25243                });
25244            }
25245        }
25246        ExternalIdentificationItemRef::AnnotationCurveOccurrence(i) => {
25247            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
25248                return Err(AuthorError::DanglingRef {
25249                    entity: "ANNOTATION_CURVE_OCCURRENCE",
25250                });
25251            }
25252        }
25253        ExternalIdentificationItemRef::AnnotationFillAreaOccurrence(i) => {
25254            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
25255                return Err(AuthorError::DanglingRef {
25256                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
25257                });
25258            }
25259        }
25260        ExternalIdentificationItemRef::AnnotationOccurrence(i) => {
25261            if i.0 >= model.annotation_occurrence_arena.items.len() {
25262                return Err(AuthorError::DanglingRef {
25263                    entity: "ANNOTATION_OCCURRENCE",
25264                });
25265            }
25266        }
25267        ExternalIdentificationItemRef::AnnotationPlaceholderLeaderLine(_) => {
25268            return Err(AuthorError::NotAp242 {
25269                entity: "ANNOTATION_PLACEHOLDER_LEADER_LINE",
25270            });
25271        }
25272        ExternalIdentificationItemRef::AnnotationPlaceholderOccurrence(i) => {
25273            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
25274                return Err(AuthorError::DanglingRef {
25275                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
25276                });
25277            }
25278        }
25279        ExternalIdentificationItemRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
25280            return Err(AuthorError::NotAp242 {
25281                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
25282            });
25283        }
25284        ExternalIdentificationItemRef::AnnotationPlane(i) => {
25285            if i.0 >= model.annotation_plane_arena.items.len() {
25286                return Err(AuthorError::DanglingRef {
25287                    entity: "ANNOTATION_PLANE",
25288                });
25289            }
25290        }
25291        ExternalIdentificationItemRef::AnnotationSymbol(i) => {
25292            if i.0 >= model.annotation_symbol_arena.items.len() {
25293                return Err(AuthorError::DanglingRef {
25294                    entity: "ANNOTATION_SYMBOL",
25295                });
25296            }
25297        }
25298        ExternalIdentificationItemRef::AnnotationSymbolOccurrence(i) => {
25299            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
25300                return Err(AuthorError::DanglingRef {
25301                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
25302                });
25303            }
25304        }
25305        ExternalIdentificationItemRef::AnnotationText(i) => {
25306            if i.0 >= model.annotation_text_arena.items.len() {
25307                return Err(AuthorError::DanglingRef {
25308                    entity: "ANNOTATION_TEXT",
25309                });
25310            }
25311        }
25312        ExternalIdentificationItemRef::AnnotationTextCharacter(i) => {
25313            if i.0 >= model.annotation_text_character_arena.items.len() {
25314                return Err(AuthorError::DanglingRef {
25315                    entity: "ANNOTATION_TEXT_CHARACTER",
25316                });
25317            }
25318        }
25319        ExternalIdentificationItemRef::AnnotationTextOccurrence(i) => {
25320            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
25321                return Err(AuthorError::DanglingRef {
25322                    entity: "ANNOTATION_TEXT_OCCURRENCE",
25323                });
25324            }
25325        }
25326        ExternalIdentificationItemRef::AnnotationToAnnotationLeaderLine(_) => {
25327            return Err(AuthorError::NotAp242 {
25328                entity: "ANNOTATION_TO_ANNOTATION_LEADER_LINE",
25329            });
25330        }
25331        ExternalIdentificationItemRef::AnnotationToModelLeaderLine(_) => {
25332            return Err(AuthorError::NotAp242 {
25333                entity: "ANNOTATION_TO_MODEL_LEADER_LINE",
25334            });
25335        }
25336        ExternalIdentificationItemRef::ApllPoint(_) => {
25337            return Err(AuthorError::NotAp242 {
25338                entity: "APLL_POINT",
25339            });
25340        }
25341        ExternalIdentificationItemRef::ApllPointWithSurface(_) => {
25342            return Err(AuthorError::NotAp242 {
25343                entity: "APLL_POINT_WITH_SURFACE",
25344            });
25345        }
25346        ExternalIdentificationItemRef::AppliedDateAndTimeAssignment(i) => {
25347            if i.0 >= model.applied_date_and_time_assignment_arena.items.len() {
25348                return Err(AuthorError::DanglingRef {
25349                    entity: "APPLIED_DATE_AND_TIME_ASSIGNMENT",
25350                });
25351            }
25352        }
25353        ExternalIdentificationItemRef::AppliedExternalIdentificationAssignment(i) => {
25354            if i.0
25355                >= model
25356                    .applied_external_identification_assignment_arena
25357                    .items
25358                    .len()
25359            {
25360                return Err(AuthorError::DanglingRef {
25361                    entity: "APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT",
25362                });
25363            }
25364        }
25365        ExternalIdentificationItemRef::Approval(i) => {
25366            if i.0 >= model.approval_arena.items.len() {
25367                return Err(AuthorError::DanglingRef { entity: "APPROVAL" });
25368            }
25369        }
25370        ExternalIdentificationItemRef::ApprovalPersonOrganization(i) => {
25371            if i.0 >= model.approval_person_organization_arena.items.len() {
25372                return Err(AuthorError::DanglingRef {
25373                    entity: "APPROVAL_PERSON_ORGANIZATION",
25374                });
25375            }
25376        }
25377        ExternalIdentificationItemRef::ApprovalStatus(i) => {
25378            if i.0 >= model.approval_status_arena.items.len() {
25379                return Err(AuthorError::DanglingRef {
25380                    entity: "APPROVAL_STATUS",
25381                });
25382            }
25383        }
25384        ExternalIdentificationItemRef::AreaUnit(i) => {
25385            if i.0 >= model.area_unit_arena.items.len() {
25386                return Err(AuthorError::DanglingRef {
25387                    entity: "AREA_UNIT",
25388                });
25389            }
25390        }
25391        ExternalIdentificationItemRef::AssemblyComponentUsage(i) => {
25392            if i.0 >= model.assembly_component_usage_arena.items.len() {
25393                return Err(AuthorError::DanglingRef {
25394                    entity: "ASSEMBLY_COMPONENT_USAGE",
25395                });
25396            }
25397        }
25398        ExternalIdentificationItemRef::AuxiliaryLeaderLine(_) => {
25399            return Err(AuthorError::NotAp242 {
25400                entity: "AUXILIARY_LEADER_LINE",
25401            });
25402        }
25403        ExternalIdentificationItemRef::Axis1Placement(i) => {
25404            if i.0 >= model.axis1_placement_arena.items.len() {
25405                return Err(AuthorError::DanglingRef {
25406                    entity: "AXIS1_PLACEMENT",
25407                });
25408            }
25409        }
25410        ExternalIdentificationItemRef::Axis2Placement2d(i) => {
25411            if i.0 >= model.axis2_placement2d_arena.items.len() {
25412                return Err(AuthorError::DanglingRef {
25413                    entity: "AXIS2_PLACEMENT_2D",
25414                });
25415            }
25416        }
25417        ExternalIdentificationItemRef::Axis2Placement3d(i) => {
25418            if i.0 >= model.axis2_placement3d_arena.items.len() {
25419                return Err(AuthorError::DanglingRef {
25420                    entity: "AXIS2_PLACEMENT_3D",
25421                });
25422            }
25423        }
25424        ExternalIdentificationItemRef::BSplineCurve(i) => {
25425            if i.0 >= model.b_spline_curve_arena.items.len() {
25426                return Err(AuthorError::DanglingRef {
25427                    entity: "B_SPLINE_CURVE",
25428                });
25429            }
25430        }
25431        ExternalIdentificationItemRef::BSplineCurveWithKnots(i) => {
25432            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
25433                return Err(AuthorError::DanglingRef {
25434                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
25435                });
25436            }
25437        }
25438        ExternalIdentificationItemRef::BSplineSurface(i) => {
25439            if i.0 >= model.b_spline_surface_arena.items.len() {
25440                return Err(AuthorError::DanglingRef {
25441                    entity: "B_SPLINE_SURFACE",
25442                });
25443            }
25444        }
25445        ExternalIdentificationItemRef::BSplineSurfaceWithKnots(i) => {
25446            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
25447                return Err(AuthorError::DanglingRef {
25448                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
25449                });
25450            }
25451        }
25452        ExternalIdentificationItemRef::BezierCurve(i) => {
25453            if i.0 >= model.bezier_curve_arena.items.len() {
25454                return Err(AuthorError::DanglingRef {
25455                    entity: "BEZIER_CURVE",
25456                });
25457            }
25458        }
25459        ExternalIdentificationItemRef::BezierSurface(i) => {
25460            if i.0 >= model.bezier_surface_arena.items.len() {
25461                return Err(AuthorError::DanglingRef {
25462                    entity: "BEZIER_SURFACE",
25463                });
25464            }
25465        }
25466        ExternalIdentificationItemRef::BoundedCurve(i) => {
25467            if i.0 >= model.bounded_curve_arena.items.len() {
25468                return Err(AuthorError::DanglingRef {
25469                    entity: "BOUNDED_CURVE",
25470                });
25471            }
25472        }
25473        ExternalIdentificationItemRef::BoundedPcurve(i) => {
25474            if i.0 >= model.bounded_pcurve_arena.items.len() {
25475                return Err(AuthorError::DanglingRef {
25476                    entity: "BOUNDED_PCURVE",
25477                });
25478            }
25479        }
25480        ExternalIdentificationItemRef::BoundedSurface(i) => {
25481            if i.0 >= model.bounded_surface_arena.items.len() {
25482                return Err(AuthorError::DanglingRef {
25483                    entity: "BOUNDED_SURFACE",
25484                });
25485            }
25486        }
25487        ExternalIdentificationItemRef::BoundedSurfaceCurve(i) => {
25488            if i.0 >= model.bounded_surface_curve_arena.items.len() {
25489                return Err(AuthorError::DanglingRef {
25490                    entity: "BOUNDED_SURFACE_CURVE",
25491                });
25492            }
25493        }
25494        ExternalIdentificationItemRef::BrepWithVoids(i) => {
25495            if i.0 >= model.brep_with_voids_arena.items.len() {
25496                return Err(AuthorError::DanglingRef {
25497                    entity: "BREP_WITH_VOIDS",
25498                });
25499            }
25500        }
25501        ExternalIdentificationItemRef::CameraImage(i) => {
25502            if i.0 >= model.camera_image_arena.items.len() {
25503                return Err(AuthorError::DanglingRef {
25504                    entity: "CAMERA_IMAGE",
25505                });
25506            }
25507        }
25508        ExternalIdentificationItemRef::CameraImage3dWithScale(i) => {
25509            if i.0 >= model.camera_image3d_with_scale_arena.items.len() {
25510                return Err(AuthorError::DanglingRef {
25511                    entity: "CAMERA_IMAGE_3D_WITH_SCALE",
25512                });
25513            }
25514        }
25515        ExternalIdentificationItemRef::CameraModel(i) => {
25516            if i.0 >= model.camera_model_arena.items.len() {
25517                return Err(AuthorError::DanglingRef {
25518                    entity: "CAMERA_MODEL",
25519                });
25520            }
25521        }
25522        ExternalIdentificationItemRef::CameraModelD3(i) => {
25523            if i.0 >= model.camera_model_d3_arena.items.len() {
25524                return Err(AuthorError::DanglingRef {
25525                    entity: "CAMERA_MODEL_D3",
25526                });
25527            }
25528        }
25529        ExternalIdentificationItemRef::CameraModelD3MultiClipping(i) => {
25530            if i.0 >= model.camera_model_d3_multi_clipping_arena.items.len() {
25531                return Err(AuthorError::DanglingRef {
25532                    entity: "CAMERA_MODEL_D3_MULTI_CLIPPING",
25533                });
25534            }
25535        }
25536        ExternalIdentificationItemRef::CameraModelD3WithHlhsr(i) => {
25537            if i.0 >= model.camera_model_d3_with_hlhsr_arena.items.len() {
25538                return Err(AuthorError::DanglingRef {
25539                    entity: "CAMERA_MODEL_D3_WITH_HLHSR",
25540                });
25541            }
25542        }
25543        ExternalIdentificationItemRef::CartesianPoint(i) => {
25544            if i.0 >= model.cartesian_point_arena.items.len() {
25545                return Err(AuthorError::DanglingRef {
25546                    entity: "CARTESIAN_POINT",
25547                });
25548            }
25549        }
25550        ExternalIdentificationItemRef::CcDesignDateAndTimeAssignment(i) => {
25551            if i.0 >= model.cc_design_date_and_time_assignment_arena.items.len() {
25552                return Err(AuthorError::DanglingRef {
25553                    entity: "CC_DESIGN_DATE_AND_TIME_ASSIGNMENT",
25554                });
25555            }
25556        }
25557        ExternalIdentificationItemRef::Certification(i) => {
25558            if i.0 >= model.certification_arena.items.len() {
25559                return Err(AuthorError::DanglingRef {
25560                    entity: "CERTIFICATION",
25561                });
25562            }
25563        }
25564        ExternalIdentificationItemRef::CharacterizedRepresentation(i) => {
25565            if i.0 >= model.characterized_representation_arena.items.len() {
25566                return Err(AuthorError::DanglingRef {
25567                    entity: "CHARACTERIZED_REPRESENTATION",
25568                });
25569            }
25570        }
25571        ExternalIdentificationItemRef::Circle(i) => {
25572            if i.0 >= model.circle_arena.items.len() {
25573                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
25574            }
25575        }
25576        ExternalIdentificationItemRef::ClosedShell(i) => {
25577            if i.0 >= model.closed_shell_arena.items.len() {
25578                return Err(AuthorError::DanglingRef {
25579                    entity: "CLOSED_SHELL",
25580                });
25581            }
25582        }
25583        ExternalIdentificationItemRef::ComplexTriangulatedFace(i) => {
25584            if i.0 >= model.complex_triangulated_face_arena.items.len() {
25585                return Err(AuthorError::DanglingRef {
25586                    entity: "COMPLEX_TRIANGULATED_FACE",
25587                });
25588            }
25589        }
25590        ExternalIdentificationItemRef::ComplexTriangulatedSurfaceSet(i) => {
25591            if i.0 >= model.complex_triangulated_surface_set_arena.items.len() {
25592                return Err(AuthorError::DanglingRef {
25593                    entity: "COMPLEX_TRIANGULATED_SURFACE_SET",
25594                });
25595            }
25596        }
25597        ExternalIdentificationItemRef::CompositeCurve(i) => {
25598            if i.0 >= model.composite_curve_arena.items.len() {
25599                return Err(AuthorError::DanglingRef {
25600                    entity: "COMPOSITE_CURVE",
25601                });
25602            }
25603        }
25604        ExternalIdentificationItemRef::CompositeText(i) => {
25605            if i.0 >= model.composite_text_arena.items.len() {
25606                return Err(AuthorError::DanglingRef {
25607                    entity: "COMPOSITE_TEXT",
25608                });
25609            }
25610        }
25611        ExternalIdentificationItemRef::CompoundRepresentationItem(i) => {
25612            if i.0 >= model.compound_representation_item_arena.items.len() {
25613                return Err(AuthorError::DanglingRef {
25614                    entity: "COMPOUND_REPRESENTATION_ITEM",
25615                });
25616            }
25617        }
25618        ExternalIdentificationItemRef::ConfigurationEffectivity(i) => {
25619            if i.0 >= model.configuration_effectivity_arena.items.len() {
25620                return Err(AuthorError::DanglingRef {
25621                    entity: "CONFIGURATION_EFFECTIVITY",
25622                });
25623            }
25624        }
25625        ExternalIdentificationItemRef::Conic(i) => {
25626            if i.0 >= model.conic_arena.items.len() {
25627                return Err(AuthorError::DanglingRef { entity: "CONIC" });
25628            }
25629        }
25630        ExternalIdentificationItemRef::ConicalSurface(i) => {
25631            if i.0 >= model.conical_surface_arena.items.len() {
25632                return Err(AuthorError::DanglingRef {
25633                    entity: "CONICAL_SURFACE",
25634                });
25635            }
25636        }
25637        ExternalIdentificationItemRef::ConnectedFaceSet(i) => {
25638            if i.0 >= model.connected_face_set_arena.items.len() {
25639                return Err(AuthorError::DanglingRef {
25640                    entity: "CONNECTED_FACE_SET",
25641                });
25642            }
25643        }
25644        ExternalIdentificationItemRef::ConstructiveGeometryRepresentation(i) => {
25645            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
25646                return Err(AuthorError::DanglingRef {
25647                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
25648                });
25649            }
25650        }
25651        ExternalIdentificationItemRef::ContextDependentOverRidingStyledItem(i) => {
25652            if i.0
25653                >= model
25654                    .context_dependent_over_riding_styled_item_arena
25655                    .items
25656                    .len()
25657            {
25658                return Err(AuthorError::DanglingRef {
25659                    entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
25660                });
25661            }
25662        }
25663        ExternalIdentificationItemRef::ContextDependentUnit(i) => {
25664            if i.0 >= model.context_dependent_unit_arena.items.len() {
25665                return Err(AuthorError::DanglingRef {
25666                    entity: "CONTEXT_DEPENDENT_UNIT",
25667                });
25668            }
25669        }
25670        ExternalIdentificationItemRef::Contract(i) => {
25671            if i.0 >= model.contract_arena.items.len() {
25672                return Err(AuthorError::DanglingRef { entity: "CONTRACT" });
25673            }
25674        }
25675        ExternalIdentificationItemRef::ConversionBasedUnit(i) => {
25676            if i.0 >= model.conversion_based_unit_arena.items.len() {
25677                return Err(AuthorError::DanglingRef {
25678                    entity: "CONVERSION_BASED_UNIT",
25679                });
25680            }
25681        }
25682        ExternalIdentificationItemRef::CoordinatesList(i) => {
25683            if i.0 >= model.coordinates_list_arena.items.len() {
25684                return Err(AuthorError::DanglingRef {
25685                    entity: "COORDINATES_LIST",
25686                });
25687            }
25688        }
25689        ExternalIdentificationItemRef::Curve(i) => {
25690            if i.0 >= model.curve_arena.items.len() {
25691                return Err(AuthorError::DanglingRef { entity: "CURVE" });
25692            }
25693        }
25694        ExternalIdentificationItemRef::CylindricalSurface(i) => {
25695            if i.0 >= model.cylindrical_surface_arena.items.len() {
25696                return Err(AuthorError::DanglingRef {
25697                    entity: "CYLINDRICAL_SURFACE",
25698                });
25699            }
25700        }
25701        ExternalIdentificationItemRef::DateAndTimeAssignment(i) => {
25702            if i.0 >= model.date_and_time_assignment_arena.items.len() {
25703                return Err(AuthorError::DanglingRef {
25704                    entity: "DATE_AND_TIME_ASSIGNMENT",
25705                });
25706            }
25707        }
25708        ExternalIdentificationItemRef::DefinedCharacterGlyph(i) => {
25709            if i.0 >= model.defined_character_glyph_arena.items.len() {
25710                return Err(AuthorError::DanglingRef {
25711                    entity: "DEFINED_CHARACTER_GLYPH",
25712                });
25713            }
25714        }
25715        ExternalIdentificationItemRef::DefinedSymbol(i) => {
25716            if i.0 >= model.defined_symbol_arena.items.len() {
25717                return Err(AuthorError::DanglingRef {
25718                    entity: "DEFINED_SYMBOL",
25719                });
25720            }
25721        }
25722        ExternalIdentificationItemRef::DefinitionalRepresentation(i) => {
25723            if i.0 >= model.definitional_representation_arena.items.len() {
25724                return Err(AuthorError::DanglingRef {
25725                    entity: "DEFINITIONAL_REPRESENTATION",
25726                });
25727            }
25728        }
25729        ExternalIdentificationItemRef::DegenerateToroidalSurface(i) => {
25730            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
25731                return Err(AuthorError::DanglingRef {
25732                    entity: "DEGENERATE_TOROIDAL_SURFACE",
25733                });
25734            }
25735        }
25736        ExternalIdentificationItemRef::DerivedUnit(i) => {
25737            if i.0 >= model.derived_unit_arena.items.len() {
25738                return Err(AuthorError::DanglingRef {
25739                    entity: "DERIVED_UNIT",
25740                });
25741            }
25742        }
25743        ExternalIdentificationItemRef::DescriptiveRepresentationItem(i) => {
25744            if i.0 >= model.descriptive_representation_item_arena.items.len() {
25745                return Err(AuthorError::DanglingRef {
25746                    entity: "DESCRIPTIVE_REPRESENTATION_ITEM",
25747                });
25748            }
25749        }
25750        ExternalIdentificationItemRef::DesignContext(i) => {
25751            if i.0 >= model.design_context_arena.items.len() {
25752                return Err(AuthorError::DanglingRef {
25753                    entity: "DESIGN_CONTEXT",
25754                });
25755            }
25756        }
25757        ExternalIdentificationItemRef::Direction(i) => {
25758            if i.0 >= model.direction_arena.items.len() {
25759                return Err(AuthorError::DanglingRef {
25760                    entity: "DIRECTION",
25761                });
25762            }
25763        }
25764        ExternalIdentificationItemRef::DocumentFile(i) => {
25765            if i.0 >= model.document_file_arena.items.len() {
25766                return Err(AuthorError::DanglingRef {
25767                    entity: "DOCUMENT_FILE",
25768                });
25769            }
25770        }
25771        ExternalIdentificationItemRef::DraughtingAnnotationOccurrence(i) => {
25772            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
25773                return Err(AuthorError::DanglingRef {
25774                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
25775                });
25776            }
25777        }
25778        ExternalIdentificationItemRef::DraughtingCallout(i) => {
25779            if i.0 >= model.draughting_callout_arena.items.len() {
25780                return Err(AuthorError::DanglingRef {
25781                    entity: "DRAUGHTING_CALLOUT",
25782                });
25783            }
25784        }
25785        ExternalIdentificationItemRef::DraughtingModel(i) => {
25786            if i.0 >= model.draughting_model_arena.items.len() {
25787                return Err(AuthorError::DanglingRef {
25788                    entity: "DRAUGHTING_MODEL",
25789                });
25790            }
25791        }
25792        ExternalIdentificationItemRef::Edge(i) => {
25793            if i.0 >= model.edge_arena.items.len() {
25794                return Err(AuthorError::DanglingRef { entity: "EDGE" });
25795            }
25796        }
25797        ExternalIdentificationItemRef::EdgeCurve(i) => {
25798            if i.0 >= model.edge_curve_arena.items.len() {
25799                return Err(AuthorError::DanglingRef {
25800                    entity: "EDGE_CURVE",
25801                });
25802            }
25803        }
25804        ExternalIdentificationItemRef::EdgeLoop(i) => {
25805            if i.0 >= model.edge_loop_arena.items.len() {
25806                return Err(AuthorError::DanglingRef {
25807                    entity: "EDGE_LOOP",
25808                });
25809            }
25810        }
25811        ExternalIdentificationItemRef::Effectivity(i) => {
25812            if i.0 >= model.effectivity_arena.items.len() {
25813                return Err(AuthorError::DanglingRef {
25814                    entity: "EFFECTIVITY",
25815                });
25816            }
25817        }
25818        ExternalIdentificationItemRef::ElementarySurface(i) => {
25819            if i.0 >= model.elementary_surface_arena.items.len() {
25820                return Err(AuthorError::DanglingRef {
25821                    entity: "ELEMENTARY_SURFACE",
25822                });
25823            }
25824        }
25825        ExternalIdentificationItemRef::Ellipse(i) => {
25826            if i.0 >= model.ellipse_arena.items.len() {
25827                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
25828            }
25829        }
25830        ExternalIdentificationItemRef::ExternalSource(i) => {
25831            if i.0 >= model.external_source_arena.items.len() {
25832                return Err(AuthorError::DanglingRef {
25833                    entity: "EXTERNAL_SOURCE",
25834                });
25835            }
25836        }
25837        ExternalIdentificationItemRef::ExternallyDefinedHatchStyle(i) => {
25838            if i.0 >= model.externally_defined_hatch_style_arena.items.len() {
25839                return Err(AuthorError::DanglingRef {
25840                    entity: "EXTERNALLY_DEFINED_HATCH_STYLE",
25841                });
25842            }
25843        }
25844        ExternalIdentificationItemRef::ExternallyDefinedTileStyle(i) => {
25845            if i.0 >= model.externally_defined_tile_style_arena.items.len() {
25846                return Err(AuthorError::DanglingRef {
25847                    entity: "EXTERNALLY_DEFINED_TILE_STYLE",
25848                });
25849            }
25850        }
25851        ExternalIdentificationItemRef::Face(i) => {
25852            if i.0 >= model.face_arena.items.len() {
25853                return Err(AuthorError::DanglingRef { entity: "FACE" });
25854            }
25855        }
25856        ExternalIdentificationItemRef::FaceBound(i) => {
25857            if i.0 >= model.face_bound_arena.items.len() {
25858                return Err(AuthorError::DanglingRef {
25859                    entity: "FACE_BOUND",
25860                });
25861            }
25862        }
25863        ExternalIdentificationItemRef::FaceOuterBound(i) => {
25864            if i.0 >= model.face_outer_bound_arena.items.len() {
25865                return Err(AuthorError::DanglingRef {
25866                    entity: "FACE_OUTER_BOUND",
25867                });
25868            }
25869        }
25870        ExternalIdentificationItemRef::FaceSurface(i) => {
25871            if i.0 >= model.face_surface_arena.items.len() {
25872                return Err(AuthorError::DanglingRef {
25873                    entity: "FACE_SURFACE",
25874                });
25875            }
25876        }
25877        ExternalIdentificationItemRef::FillAreaStyleHatching(i) => {
25878            if i.0 >= model.fill_area_style_hatching_arena.items.len() {
25879                return Err(AuthorError::DanglingRef {
25880                    entity: "FILL_AREA_STYLE_HATCHING",
25881                });
25882            }
25883        }
25884        ExternalIdentificationItemRef::FillAreaStyleTileColouredRegion(i) => {
25885            if i.0 >= model.fill_area_style_tile_coloured_region_arena.items.len() {
25886                return Err(AuthorError::DanglingRef {
25887                    entity: "FILL_AREA_STYLE_TILE_COLOURED_REGION",
25888                });
25889            }
25890        }
25891        ExternalIdentificationItemRef::FillAreaStyleTileCurveWithStyle(i) => {
25892            if i.0
25893                >= model
25894                    .fill_area_style_tile_curve_with_style_arena
25895                    .items
25896                    .len()
25897            {
25898                return Err(AuthorError::DanglingRef {
25899                    entity: "FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE",
25900                });
25901            }
25902        }
25903        ExternalIdentificationItemRef::FillAreaStyleTileSymbolWithStyle(i) => {
25904            if i.0
25905                >= model
25906                    .fill_area_style_tile_symbol_with_style_arena
25907                    .items
25908                    .len()
25909            {
25910                return Err(AuthorError::DanglingRef {
25911                    entity: "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE",
25912                });
25913            }
25914        }
25915        ExternalIdentificationItemRef::FillAreaStyleTiles(i) => {
25916            if i.0 >= model.fill_area_style_tiles_arena.items.len() {
25917                return Err(AuthorError::DanglingRef {
25918                    entity: "FILL_AREA_STYLE_TILES",
25919                });
25920            }
25921        }
25922        ExternalIdentificationItemRef::GeneralProperty(i) => {
25923            if i.0 >= model.general_property_arena.items.len() {
25924                return Err(AuthorError::DanglingRef {
25925                    entity: "GENERAL_PROPERTY",
25926                });
25927            }
25928        }
25929        ExternalIdentificationItemRef::GenericProductDefinitionReference(i) => {
25930            if i.0 >= model.generic_product_definition_reference_arena.items.len() {
25931                return Err(AuthorError::DanglingRef {
25932                    entity: "GENERIC_PRODUCT_DEFINITION_REFERENCE",
25933                });
25934            }
25935        }
25936        ExternalIdentificationItemRef::GeometricCurveSet(i) => {
25937            if i.0 >= model.geometric_curve_set_arena.items.len() {
25938                return Err(AuthorError::DanglingRef {
25939                    entity: "GEOMETRIC_CURVE_SET",
25940                });
25941            }
25942        }
25943        ExternalIdentificationItemRef::GeometricRepresentationItem(i) => {
25944            if i.0 >= model.geometric_representation_item_arena.items.len() {
25945                return Err(AuthorError::DanglingRef {
25946                    entity: "GEOMETRIC_REPRESENTATION_ITEM",
25947                });
25948            }
25949        }
25950        ExternalIdentificationItemRef::GeometricSet(i) => {
25951            if i.0 >= model.geometric_set_arena.items.len() {
25952                return Err(AuthorError::DanglingRef {
25953                    entity: "GEOMETRIC_SET",
25954                });
25955            }
25956        }
25957        ExternalIdentificationItemRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
25958            if i.0
25959                >= model
25960                    .geometrically_bounded_surface_shape_representation_arena
25961                    .items
25962                    .len()
25963            {
25964                return Err(AuthorError::DanglingRef {
25965                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
25966                });
25967            }
25968        }
25969        ExternalIdentificationItemRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
25970            if i.0
25971                >= model
25972                    .geometrically_bounded_wireframe_shape_representation_arena
25973                    .items
25974                    .len()
25975            {
25976                return Err(AuthorError::DanglingRef {
25977                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
25978                });
25979            }
25980        }
25981        ExternalIdentificationItemRef::Group(i) => {
25982            if i.0 >= model.group_arena.items.len() {
25983                return Err(AuthorError::DanglingRef { entity: "GROUP" });
25984            }
25985        }
25986        ExternalIdentificationItemRef::Hyperbola(i) => {
25987            if i.0 >= model.hyperbola_arena.items.len() {
25988                return Err(AuthorError::DanglingRef {
25989                    entity: "HYPERBOLA",
25990                });
25991            }
25992        }
25993        ExternalIdentificationItemRef::IntegerRepresentationItem(i) => {
25994            if i.0 >= model.integer_representation_item_arena.items.len() {
25995                return Err(AuthorError::DanglingRef {
25996                    entity: "INTEGER_REPRESENTATION_ITEM",
25997                });
25998            }
25999        }
26000        ExternalIdentificationItemRef::IntersectionCurve(i) => {
26001            if i.0 >= model.intersection_curve_arena.items.len() {
26002                return Err(AuthorError::DanglingRef {
26003                    entity: "INTERSECTION_CURVE",
26004                });
26005            }
26006        }
26007        ExternalIdentificationItemRef::LeaderCurve(i) => {
26008            if i.0 >= model.leader_curve_arena.items.len() {
26009                return Err(AuthorError::DanglingRef {
26010                    entity: "LEADER_CURVE",
26011                });
26012            }
26013        }
26014        ExternalIdentificationItemRef::LeaderDirectedCallout(i) => {
26015            if i.0 >= model.leader_directed_callout_arena.items.len() {
26016                return Err(AuthorError::DanglingRef {
26017                    entity: "LEADER_DIRECTED_CALLOUT",
26018                });
26019            }
26020        }
26021        ExternalIdentificationItemRef::LeaderTerminator(i) => {
26022            if i.0 >= model.leader_terminator_arena.items.len() {
26023                return Err(AuthorError::DanglingRef {
26024                    entity: "LEADER_TERMINATOR",
26025                });
26026            }
26027        }
26028        ExternalIdentificationItemRef::LengthUnit(i) => {
26029            if i.0 >= model.length_unit_arena.items.len() {
26030                return Err(AuthorError::DanglingRef {
26031                    entity: "LENGTH_UNIT",
26032                });
26033            }
26034        }
26035        ExternalIdentificationItemRef::Line(i) => {
26036            if i.0 >= model.line_arena.items.len() {
26037                return Err(AuthorError::DanglingRef { entity: "LINE" });
26038            }
26039        }
26040        ExternalIdentificationItemRef::Loop(i) => {
26041            if i.0 >= model.loop_arena.items.len() {
26042                return Err(AuthorError::DanglingRef { entity: "LOOP" });
26043            }
26044        }
26045        ExternalIdentificationItemRef::ManifoldSolidBrep(i) => {
26046            if i.0 >= model.manifold_solid_brep_arena.items.len() {
26047                return Err(AuthorError::DanglingRef {
26048                    entity: "MANIFOLD_SOLID_BREP",
26049                });
26050            }
26051        }
26052        ExternalIdentificationItemRef::ManifoldSurfaceShapeRepresentation(i) => {
26053            if i.0
26054                >= model
26055                    .manifold_surface_shape_representation_arena
26056                    .items
26057                    .len()
26058            {
26059                return Err(AuthorError::DanglingRef {
26060                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
26061                });
26062            }
26063        }
26064        ExternalIdentificationItemRef::MappedItem(i) => {
26065            if i.0 >= model.mapped_item_arena.items.len() {
26066                return Err(AuthorError::DanglingRef {
26067                    entity: "MAPPED_ITEM",
26068                });
26069            }
26070        }
26071        ExternalIdentificationItemRef::MassUnit(i) => {
26072            if i.0 >= model.mass_unit_arena.items.len() {
26073                return Err(AuthorError::DanglingRef {
26074                    entity: "MASS_UNIT",
26075                });
26076            }
26077        }
26078        ExternalIdentificationItemRef::MeasureRepresentationItem(i) => {
26079            if i.0 >= model.measure_representation_item_arena.items.len() {
26080                return Err(AuthorError::DanglingRef {
26081                    entity: "MEASURE_REPRESENTATION_ITEM",
26082                });
26083            }
26084        }
26085        ExternalIdentificationItemRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
26086            if i.0
26087                >= model
26088                    .mechanical_design_geometric_presentation_representation_arena
26089                    .items
26090                    .len()
26091            {
26092                return Err(AuthorError::DanglingRef {
26093                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
26094                });
26095            }
26096        }
26097        ExternalIdentificationItemRef::MechanicalDesignPresentationRepresentationWithDraughting(
26098            i,
26099        ) => {
26100            if i.0
26101                >= model
26102                    .mechanical_design_presentation_representation_with_draughting_arena
26103                    .items
26104                    .len()
26105            {
26106                return Err(AuthorError::DanglingRef {
26107                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
26108                });
26109            }
26110        }
26111        ExternalIdentificationItemRef::MechanicalDesignShadedPresentationRepresentation(i) => {
26112            if i.0
26113                >= model
26114                    .mechanical_design_shaded_presentation_representation_arena
26115                    .items
26116                    .len()
26117            {
26118                return Err(AuthorError::DanglingRef {
26119                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
26120                });
26121            }
26122        }
26123        ExternalIdentificationItemRef::NamedUnit(i) => {
26124            if i.0 >= model.named_unit_arena.items.len() {
26125                return Err(AuthorError::DanglingRef {
26126                    entity: "NAMED_UNIT",
26127                });
26128            }
26129        }
26130        ExternalIdentificationItemRef::NextAssemblyUsageOccurrence(i) => {
26131            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
26132                return Err(AuthorError::DanglingRef {
26133                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
26134                });
26135            }
26136        }
26137        ExternalIdentificationItemRef::OffsetSurface(i) => {
26138            if i.0 >= model.offset_surface_arena.items.len() {
26139                return Err(AuthorError::DanglingRef {
26140                    entity: "OFFSET_SURFACE",
26141                });
26142            }
26143        }
26144        ExternalIdentificationItemRef::OneDirectionRepeatFactor(i) => {
26145            if i.0 >= model.one_direction_repeat_factor_arena.items.len() {
26146                return Err(AuthorError::DanglingRef {
26147                    entity: "ONE_DIRECTION_REPEAT_FACTOR",
26148                });
26149            }
26150        }
26151        ExternalIdentificationItemRef::OpenShell(i) => {
26152            if i.0 >= model.open_shell_arena.items.len() {
26153                return Err(AuthorError::DanglingRef {
26154                    entity: "OPEN_SHELL",
26155                });
26156            }
26157        }
26158        ExternalIdentificationItemRef::Organization(i) => {
26159            if i.0 >= model.organization_arena.items.len() {
26160                return Err(AuthorError::DanglingRef {
26161                    entity: "ORGANIZATION",
26162                });
26163            }
26164        }
26165        ExternalIdentificationItemRef::OrganizationalAddress(i) => {
26166            if i.0 >= model.organizational_address_arena.items.len() {
26167                return Err(AuthorError::DanglingRef {
26168                    entity: "ORGANIZATIONAL_ADDRESS",
26169                });
26170            }
26171        }
26172        ExternalIdentificationItemRef::OrganizationalProject(i) => {
26173            if i.0 >= model.organizational_project_arena.items.len() {
26174                return Err(AuthorError::DanglingRef {
26175                    entity: "ORGANIZATIONAL_PROJECT",
26176                });
26177            }
26178        }
26179        ExternalIdentificationItemRef::OrientedClosedShell(i) => {
26180            if i.0 >= model.oriented_closed_shell_arena.items.len() {
26181                return Err(AuthorError::DanglingRef {
26182                    entity: "ORIENTED_CLOSED_SHELL",
26183                });
26184            }
26185        }
26186        ExternalIdentificationItemRef::OrientedEdge(i) => {
26187            if i.0 >= model.oriented_edge_arena.items.len() {
26188                return Err(AuthorError::DanglingRef {
26189                    entity: "ORIENTED_EDGE",
26190                });
26191            }
26192        }
26193        ExternalIdentificationItemRef::OverRidingStyledItem(i) => {
26194            if i.0 >= model.over_riding_styled_item_arena.items.len() {
26195                return Err(AuthorError::DanglingRef {
26196                    entity: "OVER_RIDING_STYLED_ITEM",
26197                });
26198            }
26199        }
26200        ExternalIdentificationItemRef::Path(i) => {
26201            if i.0 >= model.path_arena.items.len() {
26202                return Err(AuthorError::DanglingRef { entity: "PATH" });
26203            }
26204        }
26205        ExternalIdentificationItemRef::Pcurve(i) => {
26206            if i.0 >= model.pcurve_arena.items.len() {
26207                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
26208            }
26209        }
26210        ExternalIdentificationItemRef::Person(i) => {
26211            if i.0 >= model.person_arena.items.len() {
26212                return Err(AuthorError::DanglingRef { entity: "PERSON" });
26213            }
26214        }
26215        ExternalIdentificationItemRef::PersonAndOrganization(i) => {
26216            if i.0 >= model.person_and_organization_arena.items.len() {
26217                return Err(AuthorError::DanglingRef {
26218                    entity: "PERSON_AND_ORGANIZATION",
26219                });
26220            }
26221        }
26222        ExternalIdentificationItemRef::PersonAndOrganizationAddress(i) => {
26223            if i.0 >= model.person_and_organization_address_arena.items.len() {
26224                return Err(AuthorError::DanglingRef {
26225                    entity: "PERSON_AND_ORGANIZATION_ADDRESS",
26226                });
26227            }
26228        }
26229        ExternalIdentificationItemRef::PersonalAddress(i) => {
26230            if i.0 >= model.personal_address_arena.items.len() {
26231                return Err(AuthorError::DanglingRef {
26232                    entity: "PERSONAL_ADDRESS",
26233                });
26234            }
26235        }
26236        ExternalIdentificationItemRef::Placement(i) => {
26237            if i.0 >= model.placement_arena.items.len() {
26238                return Err(AuthorError::DanglingRef {
26239                    entity: "PLACEMENT",
26240                });
26241            }
26242        }
26243        ExternalIdentificationItemRef::PlanarBox(i) => {
26244            if i.0 >= model.planar_box_arena.items.len() {
26245                return Err(AuthorError::DanglingRef {
26246                    entity: "PLANAR_BOX",
26247                });
26248            }
26249        }
26250        ExternalIdentificationItemRef::PlanarExtent(i) => {
26251            if i.0 >= model.planar_extent_arena.items.len() {
26252                return Err(AuthorError::DanglingRef {
26253                    entity: "PLANAR_EXTENT",
26254                });
26255            }
26256        }
26257        ExternalIdentificationItemRef::Plane(i) => {
26258            if i.0 >= model.plane_arena.items.len() {
26259                return Err(AuthorError::DanglingRef { entity: "PLANE" });
26260            }
26261        }
26262        ExternalIdentificationItemRef::PlaneAngleUnit(i) => {
26263            if i.0 >= model.plane_angle_unit_arena.items.len() {
26264                return Err(AuthorError::DanglingRef {
26265                    entity: "PLANE_ANGLE_UNIT",
26266                });
26267            }
26268        }
26269        ExternalIdentificationItemRef::Point(i) => {
26270            if i.0 >= model.point_arena.items.len() {
26271                return Err(AuthorError::DanglingRef { entity: "POINT" });
26272            }
26273        }
26274        ExternalIdentificationItemRef::PolyLoop(i) => {
26275            if i.0 >= model.poly_loop_arena.items.len() {
26276                return Err(AuthorError::DanglingRef {
26277                    entity: "POLY_LOOP",
26278                });
26279            }
26280        }
26281        ExternalIdentificationItemRef::Polyline(i) => {
26282            if i.0 >= model.polyline_arena.items.len() {
26283                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
26284            }
26285        }
26286        ExternalIdentificationItemRef::PrecisionQualifier(i) => {
26287            if i.0 >= model.precision_qualifier_arena.items.len() {
26288                return Err(AuthorError::DanglingRef {
26289                    entity: "PRECISION_QUALIFIER",
26290                });
26291            }
26292        }
26293        ExternalIdentificationItemRef::PresentationArea(i) => {
26294            if i.0 >= model.presentation_area_arena.items.len() {
26295                return Err(AuthorError::DanglingRef {
26296                    entity: "PRESENTATION_AREA",
26297                });
26298            }
26299        }
26300        ExternalIdentificationItemRef::PresentationRepresentation(i) => {
26301            if i.0 >= model.presentation_representation_arena.items.len() {
26302                return Err(AuthorError::DanglingRef {
26303                    entity: "PRESENTATION_REPRESENTATION",
26304                });
26305            }
26306        }
26307        ExternalIdentificationItemRef::PresentationView(i) => {
26308            if i.0 >= model.presentation_view_arena.items.len() {
26309                return Err(AuthorError::DanglingRef {
26310                    entity: "PRESENTATION_VIEW",
26311                });
26312            }
26313        }
26314        ExternalIdentificationItemRef::Product(i) => {
26315            if i.0 >= model.product_arena.items.len() {
26316                return Err(AuthorError::DanglingRef { entity: "PRODUCT" });
26317            }
26318        }
26319        ExternalIdentificationItemRef::ProductConcept(i) => {
26320            if i.0 >= model.product_concept_arena.items.len() {
26321                return Err(AuthorError::DanglingRef {
26322                    entity: "PRODUCT_CONCEPT",
26323                });
26324            }
26325        }
26326        ExternalIdentificationItemRef::ProductConceptContext(i) => {
26327            if i.0 >= model.product_concept_context_arena.items.len() {
26328                return Err(AuthorError::DanglingRef {
26329                    entity: "PRODUCT_CONCEPT_CONTEXT",
26330                });
26331            }
26332        }
26333        ExternalIdentificationItemRef::ProductConceptFeatureCategory(i) => {
26334            if i.0 >= model.product_concept_feature_category_arena.items.len() {
26335                return Err(AuthorError::DanglingRef {
26336                    entity: "PRODUCT_CONCEPT_FEATURE_CATEGORY",
26337                });
26338            }
26339        }
26340        ExternalIdentificationItemRef::ProductDefinition(i) => {
26341            if i.0 >= model.product_definition_arena.items.len() {
26342                return Err(AuthorError::DanglingRef {
26343                    entity: "PRODUCT_DEFINITION",
26344                });
26345            }
26346        }
26347        ExternalIdentificationItemRef::ProductDefinitionContext(i) => {
26348            if i.0 >= model.product_definition_context_arena.items.len() {
26349                return Err(AuthorError::DanglingRef {
26350                    entity: "PRODUCT_DEFINITION_CONTEXT",
26351                });
26352            }
26353        }
26354        ExternalIdentificationItemRef::ProductDefinitionEffectivity(i) => {
26355            if i.0 >= model.product_definition_effectivity_arena.items.len() {
26356                return Err(AuthorError::DanglingRef {
26357                    entity: "PRODUCT_DEFINITION_EFFECTIVITY",
26358                });
26359            }
26360        }
26361        ExternalIdentificationItemRef::ProductDefinitionFormation(i) => {
26362            if i.0 >= model.product_definition_formation_arena.items.len() {
26363                return Err(AuthorError::DanglingRef {
26364                    entity: "PRODUCT_DEFINITION_FORMATION",
26365                });
26366            }
26367        }
26368        ExternalIdentificationItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
26369            if i.0
26370                >= model
26371                    .product_definition_formation_with_specified_source_arena
26372                    .items
26373                    .len()
26374            {
26375                return Err(AuthorError::DanglingRef {
26376                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
26377                });
26378            }
26379        }
26380        ExternalIdentificationItemRef::ProductDefinitionOccurrence(i) => {
26381            if i.0 >= model.product_definition_occurrence_arena.items.len() {
26382                return Err(AuthorError::DanglingRef {
26383                    entity: "PRODUCT_DEFINITION_OCCURRENCE",
26384                });
26385            }
26386        }
26387        ExternalIdentificationItemRef::ProductDefinitionShape(i) => {
26388            if i.0 >= model.product_definition_shape_arena.items.len() {
26389                return Err(AuthorError::DanglingRef {
26390                    entity: "PRODUCT_DEFINITION_SHAPE",
26391                });
26392            }
26393        }
26394        ExternalIdentificationItemRef::ProductDefinitionWithAssociatedDocuments(i) => {
26395            if i.0
26396                >= model
26397                    .product_definition_with_associated_documents_arena
26398                    .items
26399                    .len()
26400            {
26401                return Err(AuthorError::DanglingRef {
26402                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
26403                });
26404            }
26405        }
26406        ExternalIdentificationItemRef::PropertyDefinition(i) => {
26407            if i.0 >= model.property_definition_arena.items.len() {
26408                return Err(AuthorError::DanglingRef {
26409                    entity: "PROPERTY_DEFINITION",
26410                });
26411            }
26412        }
26413        ExternalIdentificationItemRef::QualifiedRepresentationItem(i) => {
26414            if i.0 >= model.qualified_representation_item_arena.items.len() {
26415                return Err(AuthorError::DanglingRef {
26416                    entity: "QUALIFIED_REPRESENTATION_ITEM",
26417                });
26418            }
26419        }
26420        ExternalIdentificationItemRef::QuasiUniformCurve(i) => {
26421            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
26422                return Err(AuthorError::DanglingRef {
26423                    entity: "QUASI_UNIFORM_CURVE",
26424                });
26425            }
26426        }
26427        ExternalIdentificationItemRef::QuasiUniformSurface(i) => {
26428            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
26429                return Err(AuthorError::DanglingRef {
26430                    entity: "QUASI_UNIFORM_SURFACE",
26431                });
26432            }
26433        }
26434        ExternalIdentificationItemRef::RatioUnit(i) => {
26435            if i.0 >= model.ratio_unit_arena.items.len() {
26436                return Err(AuthorError::DanglingRef {
26437                    entity: "RATIO_UNIT",
26438                });
26439            }
26440        }
26441        ExternalIdentificationItemRef::RationalBSplineCurve(i) => {
26442            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
26443                return Err(AuthorError::DanglingRef {
26444                    entity: "RATIONAL_B_SPLINE_CURVE",
26445                });
26446            }
26447        }
26448        ExternalIdentificationItemRef::RationalBSplineSurface(i) => {
26449            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
26450                return Err(AuthorError::DanglingRef {
26451                    entity: "RATIONAL_B_SPLINE_SURFACE",
26452                });
26453            }
26454        }
26455        ExternalIdentificationItemRef::RealRepresentationItem(i) => {
26456            if i.0 >= model.real_representation_item_arena.items.len() {
26457                return Err(AuthorError::DanglingRef {
26458                    entity: "REAL_REPRESENTATION_ITEM",
26459                });
26460            }
26461        }
26462        ExternalIdentificationItemRef::RepositionedTessellatedItem(i) => {
26463            if i.0 >= model.repositioned_tessellated_item_arena.items.len() {
26464                return Err(AuthorError::DanglingRef {
26465                    entity: "REPOSITIONED_TESSELLATED_ITEM",
26466                });
26467            }
26468        }
26469        ExternalIdentificationItemRef::Representation(i) => {
26470            if i.0 >= model.representation_arena.items.len() {
26471                return Err(AuthorError::DanglingRef {
26472                    entity: "REPRESENTATION",
26473                });
26474            }
26475        }
26476        ExternalIdentificationItemRef::RepresentationItem(i) => {
26477            if i.0 >= model.representation_item_arena.items.len() {
26478                return Err(AuthorError::DanglingRef {
26479                    entity: "REPRESENTATION_ITEM",
26480                });
26481            }
26482        }
26483        ExternalIdentificationItemRef::SeamCurve(i) => {
26484            if i.0 >= model.seam_curve_arena.items.len() {
26485                return Err(AuthorError::DanglingRef {
26486                    entity: "SEAM_CURVE",
26487                });
26488            }
26489        }
26490        ExternalIdentificationItemRef::SecurityClassification(i) => {
26491            if i.0 >= model.security_classification_arena.items.len() {
26492                return Err(AuthorError::DanglingRef {
26493                    entity: "SECURITY_CLASSIFICATION",
26494                });
26495            }
26496        }
26497        ExternalIdentificationItemRef::ShapeDimensionRepresentation(i) => {
26498            if i.0 >= model.shape_dimension_representation_arena.items.len() {
26499                return Err(AuthorError::DanglingRef {
26500                    entity: "SHAPE_DIMENSION_REPRESENTATION",
26501                });
26502            }
26503        }
26504        ExternalIdentificationItemRef::ShapeRepresentation(i) => {
26505            if i.0 >= model.shape_representation_arena.items.len() {
26506                return Err(AuthorError::DanglingRef {
26507                    entity: "SHAPE_REPRESENTATION",
26508                });
26509            }
26510        }
26511        ExternalIdentificationItemRef::ShapeRepresentationWithParameters(i) => {
26512            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
26513                return Err(AuthorError::DanglingRef {
26514                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
26515                });
26516            }
26517        }
26518        ExternalIdentificationItemRef::ShellBasedSurfaceModel(i) => {
26519            if i.0 >= model.shell_based_surface_model_arena.items.len() {
26520                return Err(AuthorError::DanglingRef {
26521                    entity: "SHELL_BASED_SURFACE_MODEL",
26522                });
26523            }
26524        }
26525        ExternalIdentificationItemRef::SiUnit(i) => {
26526            if i.0 >= model.si_unit_arena.items.len() {
26527                return Err(AuthorError::DanglingRef { entity: "SI_UNIT" });
26528            }
26529        }
26530        ExternalIdentificationItemRef::SolidAngleUnit(i) => {
26531            if i.0 >= model.solid_angle_unit_arena.items.len() {
26532                return Err(AuthorError::DanglingRef {
26533                    entity: "SOLID_ANGLE_UNIT",
26534                });
26535            }
26536        }
26537        ExternalIdentificationItemRef::SolidModel(i) => {
26538            if i.0 >= model.solid_model_arena.items.len() {
26539                return Err(AuthorError::DanglingRef {
26540                    entity: "SOLID_MODEL",
26541                });
26542            }
26543        }
26544        ExternalIdentificationItemRef::SphericalSurface(i) => {
26545            if i.0 >= model.spherical_surface_arena.items.len() {
26546                return Err(AuthorError::DanglingRef {
26547                    entity: "SPHERICAL_SURFACE",
26548                });
26549            }
26550        }
26551        ExternalIdentificationItemRef::StateObserved(i) => {
26552            if i.0 >= model.state_observed_arena.items.len() {
26553                return Err(AuthorError::DanglingRef {
26554                    entity: "STATE_OBSERVED",
26555                });
26556            }
26557        }
26558        ExternalIdentificationItemRef::StateType(i) => {
26559            if i.0 >= model.state_type_arena.items.len() {
26560                return Err(AuthorError::DanglingRef {
26561                    entity: "STATE_TYPE",
26562                });
26563            }
26564        }
26565        ExternalIdentificationItemRef::StyledItem(i) => {
26566            if i.0 >= model.styled_item_arena.items.len() {
26567                return Err(AuthorError::DanglingRef {
26568                    entity: "STYLED_ITEM",
26569                });
26570            }
26571        }
26572        ExternalIdentificationItemRef::Surface(i) => {
26573            if i.0 >= model.surface_arena.items.len() {
26574                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
26575            }
26576        }
26577        ExternalIdentificationItemRef::SurfaceCurve(i) => {
26578            if i.0 >= model.surface_curve_arena.items.len() {
26579                return Err(AuthorError::DanglingRef {
26580                    entity: "SURFACE_CURVE",
26581                });
26582            }
26583        }
26584        ExternalIdentificationItemRef::SurfaceOfLinearExtrusion(i) => {
26585            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
26586                return Err(AuthorError::DanglingRef {
26587                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
26588                });
26589            }
26590        }
26591        ExternalIdentificationItemRef::SurfaceOfRevolution(i) => {
26592            if i.0 >= model.surface_of_revolution_arena.items.len() {
26593                return Err(AuthorError::DanglingRef {
26594                    entity: "SURFACE_OF_REVOLUTION",
26595                });
26596            }
26597        }
26598        ExternalIdentificationItemRef::SweptSurface(i) => {
26599            if i.0 >= model.swept_surface_arena.items.len() {
26600                return Err(AuthorError::DanglingRef {
26601                    entity: "SWEPT_SURFACE",
26602                });
26603            }
26604        }
26605        ExternalIdentificationItemRef::SymbolRepresentation(i) => {
26606            if i.0 >= model.symbol_representation_arena.items.len() {
26607                return Err(AuthorError::DanglingRef {
26608                    entity: "SYMBOL_REPRESENTATION",
26609                });
26610            }
26611        }
26612        ExternalIdentificationItemRef::SymbolTarget(i) => {
26613            if i.0 >= model.symbol_target_arena.items.len() {
26614                return Err(AuthorError::DanglingRef {
26615                    entity: "SYMBOL_TARGET",
26616                });
26617            }
26618        }
26619        ExternalIdentificationItemRef::TerminatorSymbol(i) => {
26620            if i.0 >= model.terminator_symbol_arena.items.len() {
26621                return Err(AuthorError::DanglingRef {
26622                    entity: "TERMINATOR_SYMBOL",
26623                });
26624            }
26625        }
26626        ExternalIdentificationItemRef::TessellatedAnnotationOccurrence(i) => {
26627            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
26628                return Err(AuthorError::DanglingRef {
26629                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
26630                });
26631            }
26632        }
26633        ExternalIdentificationItemRef::TessellatedCurveSet(i) => {
26634            if i.0 >= model.tessellated_curve_set_arena.items.len() {
26635                return Err(AuthorError::DanglingRef {
26636                    entity: "TESSELLATED_CURVE_SET",
26637                });
26638            }
26639        }
26640        ExternalIdentificationItemRef::TessellatedFace(i) => {
26641            if i.0 >= model.tessellated_face_arena.items.len() {
26642                return Err(AuthorError::DanglingRef {
26643                    entity: "TESSELLATED_FACE",
26644                });
26645            }
26646        }
26647        ExternalIdentificationItemRef::TessellatedGeometricSet(i) => {
26648            if i.0 >= model.tessellated_geometric_set_arena.items.len() {
26649                return Err(AuthorError::DanglingRef {
26650                    entity: "TESSELLATED_GEOMETRIC_SET",
26651                });
26652            }
26653        }
26654        ExternalIdentificationItemRef::TessellatedItem(i) => {
26655            if i.0 >= model.tessellated_item_arena.items.len() {
26656                return Err(AuthorError::DanglingRef {
26657                    entity: "TESSELLATED_ITEM",
26658                });
26659            }
26660        }
26661        ExternalIdentificationItemRef::TessellatedShapeRepresentation(i) => {
26662            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
26663                return Err(AuthorError::DanglingRef {
26664                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
26665                });
26666            }
26667        }
26668        ExternalIdentificationItemRef::TessellatedShell(i) => {
26669            if i.0 >= model.tessellated_shell_arena.items.len() {
26670                return Err(AuthorError::DanglingRef {
26671                    entity: "TESSELLATED_SHELL",
26672                });
26673            }
26674        }
26675        ExternalIdentificationItemRef::TessellatedSolid(i) => {
26676            if i.0 >= model.tessellated_solid_arena.items.len() {
26677                return Err(AuthorError::DanglingRef {
26678                    entity: "TESSELLATED_SOLID",
26679                });
26680            }
26681        }
26682        ExternalIdentificationItemRef::TessellatedStructuredItem(i) => {
26683            if i.0 >= model.tessellated_structured_item_arena.items.len() {
26684                return Err(AuthorError::DanglingRef {
26685                    entity: "TESSELLATED_STRUCTURED_ITEM",
26686                });
26687            }
26688        }
26689        ExternalIdentificationItemRef::TessellatedSurfaceSet(i) => {
26690            if i.0 >= model.tessellated_surface_set_arena.items.len() {
26691                return Err(AuthorError::DanglingRef {
26692                    entity: "TESSELLATED_SURFACE_SET",
26693                });
26694            }
26695        }
26696        ExternalIdentificationItemRef::TextLiteral(i) => {
26697            if i.0 >= model.text_literal_arena.items.len() {
26698                return Err(AuthorError::DanglingRef {
26699                    entity: "TEXT_LITERAL",
26700                });
26701            }
26702        }
26703        ExternalIdentificationItemRef::TimeUnit(i) => {
26704            if i.0 >= model.time_unit_arena.items.len() {
26705                return Err(AuthorError::DanglingRef {
26706                    entity: "TIME_UNIT",
26707                });
26708            }
26709        }
26710        ExternalIdentificationItemRef::TopologicalRepresentationItem(i) => {
26711            if i.0 >= model.topological_representation_item_arena.items.len() {
26712                return Err(AuthorError::DanglingRef {
26713                    entity: "TOPOLOGICAL_REPRESENTATION_ITEM",
26714                });
26715            }
26716        }
26717        ExternalIdentificationItemRef::ToroidalSurface(i) => {
26718            if i.0 >= model.toroidal_surface_arena.items.len() {
26719                return Err(AuthorError::DanglingRef {
26720                    entity: "TOROIDAL_SURFACE",
26721                });
26722            }
26723        }
26724        ExternalIdentificationItemRef::TrimmedCurve(i) => {
26725            if i.0 >= model.trimmed_curve_arena.items.len() {
26726                return Err(AuthorError::DanglingRef {
26727                    entity: "TRIMMED_CURVE",
26728                });
26729            }
26730        }
26731        ExternalIdentificationItemRef::TwoDirectionRepeatFactor(i) => {
26732            if i.0 >= model.two_direction_repeat_factor_arena.items.len() {
26733                return Err(AuthorError::DanglingRef {
26734                    entity: "TWO_DIRECTION_REPEAT_FACTOR",
26735                });
26736            }
26737        }
26738        ExternalIdentificationItemRef::TypeQualifier(i) => {
26739            if i.0 >= model.type_qualifier_arena.items.len() {
26740                return Err(AuthorError::DanglingRef {
26741                    entity: "TYPE_QUALIFIER",
26742                });
26743            }
26744        }
26745        ExternalIdentificationItemRef::UncertaintyQualifier(i) => {
26746            if i.0 >= model.uncertainty_qualifier_arena.items.len() {
26747                return Err(AuthorError::DanglingRef {
26748                    entity: "UNCERTAINTY_QUALIFIER",
26749                });
26750            }
26751        }
26752        ExternalIdentificationItemRef::UniformCurve(i) => {
26753            if i.0 >= model.uniform_curve_arena.items.len() {
26754                return Err(AuthorError::DanglingRef {
26755                    entity: "UNIFORM_CURVE",
26756                });
26757            }
26758        }
26759        ExternalIdentificationItemRef::UniformSurface(i) => {
26760            if i.0 >= model.uniform_surface_arena.items.len() {
26761                return Err(AuthorError::DanglingRef {
26762                    entity: "UNIFORM_SURFACE",
26763                });
26764            }
26765        }
26766        ExternalIdentificationItemRef::ValueRepresentationItem(i) => {
26767            if i.0 >= model.value_representation_item_arena.items.len() {
26768                return Err(AuthorError::DanglingRef {
26769                    entity: "VALUE_REPRESENTATION_ITEM",
26770                });
26771            }
26772        }
26773        ExternalIdentificationItemRef::Vector(i) => {
26774            if i.0 >= model.vector_arena.items.len() {
26775                return Err(AuthorError::DanglingRef { entity: "VECTOR" });
26776            }
26777        }
26778        ExternalIdentificationItemRef::VersionedActionRequest(i) => {
26779            if i.0 >= model.versioned_action_request_arena.items.len() {
26780                return Err(AuthorError::DanglingRef {
26781                    entity: "VERSIONED_ACTION_REQUEST",
26782                });
26783            }
26784        }
26785        ExternalIdentificationItemRef::Vertex(i) => {
26786            if i.0 >= model.vertex_arena.items.len() {
26787                return Err(AuthorError::DanglingRef { entity: "VERTEX" });
26788            }
26789        }
26790        ExternalIdentificationItemRef::VertexLoop(i) => {
26791            if i.0 >= model.vertex_loop_arena.items.len() {
26792                return Err(AuthorError::DanglingRef {
26793                    entity: "VERTEX_LOOP",
26794                });
26795            }
26796        }
26797        ExternalIdentificationItemRef::VertexPoint(i) => {
26798            if i.0 >= model.vertex_point_arena.items.len() {
26799                return Err(AuthorError::DanglingRef {
26800                    entity: "VERTEX_POINT",
26801                });
26802            }
26803        }
26804        ExternalIdentificationItemRef::VertexShell(i) => {
26805            if i.0 >= model.vertex_shell_arena.items.len() {
26806                return Err(AuthorError::DanglingRef {
26807                    entity: "VERTEX_SHELL",
26808                });
26809            }
26810        }
26811        ExternalIdentificationItemRef::VolumeUnit(i) => {
26812            if i.0 >= model.volume_unit_arena.items.len() {
26813                return Err(AuthorError::DanglingRef {
26814                    entity: "VOLUME_UNIT",
26815                });
26816            }
26817        }
26818        ExternalIdentificationItemRef::WireShell(i) => {
26819            if i.0 >= model.wire_shell_arena.items.len() {
26820                return Err(AuthorError::DanglingRef {
26821                    entity: "WIRE_SHELL",
26822                });
26823            }
26824        }
26825        ExternalIdentificationItemRef::Complex(i) => {
26826            if i.0 >= model.complex_unit_arena.items.len() {
26827                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
26828            }
26829        }
26830    }
26831    Ok(())
26832}
26833fn check_external_source_ref(model: &StepModel, r: &ExternalSourceRef) -> Result<(), AuthorError> {
26834    match r {
26835        ExternalSourceRef::ExternalSource(i) => {
26836            if i.0 >= model.external_source_arena.items.len() {
26837                return Err(AuthorError::DanglingRef {
26838                    entity: "EXTERNAL_SOURCE",
26839                });
26840            }
26841        }
26842        ExternalSourceRef::Complex(i) => {
26843            if i.0 >= model.complex_unit_arena.items.len() {
26844                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
26845            }
26846        }
26847    }
26848    Ok(())
26849}
26850fn check_face_ref(model: &StepModel, r: &FaceRef) -> Result<(), AuthorError> {
26851    match r {
26852        FaceRef::AdvancedFace(i) => {
26853            if i.0 >= model.advanced_face_arena.items.len() {
26854                return Err(AuthorError::DanglingRef {
26855                    entity: "ADVANCED_FACE",
26856                });
26857            }
26858        }
26859        FaceRef::Face(i) => {
26860            if i.0 >= model.face_arena.items.len() {
26861                return Err(AuthorError::DanglingRef { entity: "FACE" });
26862            }
26863        }
26864        FaceRef::FaceSurface(i) => {
26865            if i.0 >= model.face_surface_arena.items.len() {
26866                return Err(AuthorError::DanglingRef {
26867                    entity: "FACE_SURFACE",
26868                });
26869            }
26870        }
26871        FaceRef::Complex(i) => {
26872            if i.0 >= model.complex_unit_arena.items.len() {
26873                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
26874            }
26875        }
26876    }
26877    Ok(())
26878}
26879fn check_face_bound_ref(model: &StepModel, r: &FaceBoundRef) -> Result<(), AuthorError> {
26880    match r {
26881        FaceBoundRef::FaceBound(i) => {
26882            if i.0 >= model.face_bound_arena.items.len() {
26883                return Err(AuthorError::DanglingRef {
26884                    entity: "FACE_BOUND",
26885                });
26886            }
26887        }
26888        FaceBoundRef::FaceOuterBound(i) => {
26889            if i.0 >= model.face_outer_bound_arena.items.len() {
26890                return Err(AuthorError::DanglingRef {
26891                    entity: "FACE_OUTER_BOUND",
26892                });
26893            }
26894        }
26895        FaceBoundRef::Complex(i) => {
26896            if i.0 >= model.complex_unit_arena.items.len() {
26897                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
26898            }
26899        }
26900    }
26901    Ok(())
26902}
26903fn check_face_or_surface_ref(model: &StepModel, r: &FaceOrSurfaceRef) -> Result<(), AuthorError> {
26904    match r {
26905        FaceOrSurfaceRef::AdvancedFace(i) => {
26906            if i.0 >= model.advanced_face_arena.items.len() {
26907                return Err(AuthorError::DanglingRef {
26908                    entity: "ADVANCED_FACE",
26909                });
26910            }
26911        }
26912        FaceOrSurfaceRef::BSplineSurface(i) => {
26913            if i.0 >= model.b_spline_surface_arena.items.len() {
26914                return Err(AuthorError::DanglingRef {
26915                    entity: "B_SPLINE_SURFACE",
26916                });
26917            }
26918        }
26919        FaceOrSurfaceRef::BSplineSurfaceWithKnots(i) => {
26920            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
26921                return Err(AuthorError::DanglingRef {
26922                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
26923                });
26924            }
26925        }
26926        FaceOrSurfaceRef::BezierSurface(i) => {
26927            if i.0 >= model.bezier_surface_arena.items.len() {
26928                return Err(AuthorError::DanglingRef {
26929                    entity: "BEZIER_SURFACE",
26930                });
26931            }
26932        }
26933        FaceOrSurfaceRef::BoundedSurface(i) => {
26934            if i.0 >= model.bounded_surface_arena.items.len() {
26935                return Err(AuthorError::DanglingRef {
26936                    entity: "BOUNDED_SURFACE",
26937                });
26938            }
26939        }
26940        FaceOrSurfaceRef::ConicalSurface(i) => {
26941            if i.0 >= model.conical_surface_arena.items.len() {
26942                return Err(AuthorError::DanglingRef {
26943                    entity: "CONICAL_SURFACE",
26944                });
26945            }
26946        }
26947        FaceOrSurfaceRef::CylindricalSurface(i) => {
26948            if i.0 >= model.cylindrical_surface_arena.items.len() {
26949                return Err(AuthorError::DanglingRef {
26950                    entity: "CYLINDRICAL_SURFACE",
26951                });
26952            }
26953        }
26954        FaceOrSurfaceRef::DegenerateToroidalSurface(i) => {
26955            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
26956                return Err(AuthorError::DanglingRef {
26957                    entity: "DEGENERATE_TOROIDAL_SURFACE",
26958                });
26959            }
26960        }
26961        FaceOrSurfaceRef::ElementarySurface(i) => {
26962            if i.0 >= model.elementary_surface_arena.items.len() {
26963                return Err(AuthorError::DanglingRef {
26964                    entity: "ELEMENTARY_SURFACE",
26965                });
26966            }
26967        }
26968        FaceOrSurfaceRef::Face(i) => {
26969            if i.0 >= model.face_arena.items.len() {
26970                return Err(AuthorError::DanglingRef { entity: "FACE" });
26971            }
26972        }
26973        FaceOrSurfaceRef::FaceSurface(i) => {
26974            if i.0 >= model.face_surface_arena.items.len() {
26975                return Err(AuthorError::DanglingRef {
26976                    entity: "FACE_SURFACE",
26977                });
26978            }
26979        }
26980        FaceOrSurfaceRef::OffsetSurface(i) => {
26981            if i.0 >= model.offset_surface_arena.items.len() {
26982                return Err(AuthorError::DanglingRef {
26983                    entity: "OFFSET_SURFACE",
26984                });
26985            }
26986        }
26987        FaceOrSurfaceRef::Plane(i) => {
26988            if i.0 >= model.plane_arena.items.len() {
26989                return Err(AuthorError::DanglingRef { entity: "PLANE" });
26990            }
26991        }
26992        FaceOrSurfaceRef::QuasiUniformSurface(i) => {
26993            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
26994                return Err(AuthorError::DanglingRef {
26995                    entity: "QUASI_UNIFORM_SURFACE",
26996                });
26997            }
26998        }
26999        FaceOrSurfaceRef::RationalBSplineSurface(i) => {
27000            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
27001                return Err(AuthorError::DanglingRef {
27002                    entity: "RATIONAL_B_SPLINE_SURFACE",
27003                });
27004            }
27005        }
27006        FaceOrSurfaceRef::SphericalSurface(i) => {
27007            if i.0 >= model.spherical_surface_arena.items.len() {
27008                return Err(AuthorError::DanglingRef {
27009                    entity: "SPHERICAL_SURFACE",
27010                });
27011            }
27012        }
27013        FaceOrSurfaceRef::Surface(i) => {
27014            if i.0 >= model.surface_arena.items.len() {
27015                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
27016            }
27017        }
27018        FaceOrSurfaceRef::SurfaceOfLinearExtrusion(i) => {
27019            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
27020                return Err(AuthorError::DanglingRef {
27021                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
27022                });
27023            }
27024        }
27025        FaceOrSurfaceRef::SurfaceOfRevolution(i) => {
27026            if i.0 >= model.surface_of_revolution_arena.items.len() {
27027                return Err(AuthorError::DanglingRef {
27028                    entity: "SURFACE_OF_REVOLUTION",
27029                });
27030            }
27031        }
27032        FaceOrSurfaceRef::SweptSurface(i) => {
27033            if i.0 >= model.swept_surface_arena.items.len() {
27034                return Err(AuthorError::DanglingRef {
27035                    entity: "SWEPT_SURFACE",
27036                });
27037            }
27038        }
27039        FaceOrSurfaceRef::ToroidalSurface(i) => {
27040            if i.0 >= model.toroidal_surface_arena.items.len() {
27041                return Err(AuthorError::DanglingRef {
27042                    entity: "TOROIDAL_SURFACE",
27043                });
27044            }
27045        }
27046        FaceOrSurfaceRef::UniformSurface(i) => {
27047            if i.0 >= model.uniform_surface_arena.items.len() {
27048                return Err(AuthorError::DanglingRef {
27049                    entity: "UNIFORM_SURFACE",
27050                });
27051            }
27052        }
27053        FaceOrSurfaceRef::Complex(i) => {
27054            if i.0 >= model.complex_unit_arena.items.len() {
27055                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
27056            }
27057        }
27058    }
27059    Ok(())
27060}
27061fn check_face_surface_ref(model: &StepModel, r: &FaceSurfaceRef) -> Result<(), AuthorError> {
27062    match r {
27063        FaceSurfaceRef::AdvancedFace(i) => {
27064            if i.0 >= model.advanced_face_arena.items.len() {
27065                return Err(AuthorError::DanglingRef {
27066                    entity: "ADVANCED_FACE",
27067                });
27068            }
27069        }
27070        FaceSurfaceRef::FaceSurface(i) => {
27071            if i.0 >= model.face_surface_arena.items.len() {
27072                return Err(AuthorError::DanglingRef {
27073                    entity: "FACE_SURFACE",
27074                });
27075            }
27076        }
27077        FaceSurfaceRef::Complex(i) => {
27078            if i.0 >= model.complex_unit_arena.items.len() {
27079                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
27080            }
27081        }
27082    }
27083    Ok(())
27084}
27085fn check_fill_area_style_ref(model: &StepModel, r: &FillAreaStyleRef) -> Result<(), AuthorError> {
27086    match r {
27087        FillAreaStyleRef::FillAreaStyle(i) => {
27088            if i.0 >= model.fill_area_style_arena.items.len() {
27089                return Err(AuthorError::DanglingRef {
27090                    entity: "FILL_AREA_STYLE",
27091                });
27092            }
27093        }
27094        FillAreaStyleRef::Complex(i) => {
27095            if i.0 >= model.complex_unit_arena.items.len() {
27096                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
27097            }
27098        }
27099    }
27100    Ok(())
27101}
27102fn check_fill_area_style_tile_shape_select_ref(
27103    model: &StepModel,
27104    r: &FillAreaStyleTileShapeSelectRef,
27105) -> Result<(), AuthorError> {
27106    match r {
27107        FillAreaStyleTileShapeSelectRef::ExternallyDefinedTile(i) => {
27108            if i.0 >= model.externally_defined_tile_arena.items.len() {
27109                return Err(AuthorError::DanglingRef {
27110                    entity: "EXTERNALLY_DEFINED_TILE",
27111                });
27112            }
27113        }
27114        FillAreaStyleTileShapeSelectRef::FillAreaStyleTileColouredRegion(i) => {
27115            if i.0 >= model.fill_area_style_tile_coloured_region_arena.items.len() {
27116                return Err(AuthorError::DanglingRef {
27117                    entity: "FILL_AREA_STYLE_TILE_COLOURED_REGION",
27118                });
27119            }
27120        }
27121        FillAreaStyleTileShapeSelectRef::FillAreaStyleTileCurveWithStyle(i) => {
27122            if i.0
27123                >= model
27124                    .fill_area_style_tile_curve_with_style_arena
27125                    .items
27126                    .len()
27127            {
27128                return Err(AuthorError::DanglingRef {
27129                    entity: "FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE",
27130                });
27131            }
27132        }
27133        FillAreaStyleTileShapeSelectRef::FillAreaStyleTileSymbolWithStyle(i) => {
27134            if i.0
27135                >= model
27136                    .fill_area_style_tile_symbol_with_style_arena
27137                    .items
27138                    .len()
27139            {
27140                return Err(AuthorError::DanglingRef {
27141                    entity: "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE",
27142                });
27143            }
27144        }
27145        FillAreaStyleTileShapeSelectRef::PreDefinedTile(i) => {
27146            if i.0 >= model.pre_defined_tile_arena.items.len() {
27147                return Err(AuthorError::DanglingRef {
27148                    entity: "PRE_DEFINED_TILE",
27149                });
27150            }
27151        }
27152        FillAreaStyleTileShapeSelectRef::Complex(i) => {
27153            if i.0 >= model.complex_unit_arena.items.len() {
27154                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
27155            }
27156        }
27157    }
27158    Ok(())
27159}
27160fn check_fill_style_select_ref(
27161    model: &StepModel,
27162    r: &FillStyleSelectRef,
27163) -> Result<(), AuthorError> {
27164    match r {
27165        FillStyleSelectRef::ExternallyDefinedHatchStyle(i) => {
27166            if i.0 >= model.externally_defined_hatch_style_arena.items.len() {
27167                return Err(AuthorError::DanglingRef {
27168                    entity: "EXTERNALLY_DEFINED_HATCH_STYLE",
27169                });
27170            }
27171        }
27172        FillStyleSelectRef::ExternallyDefinedTileStyle(i) => {
27173            if i.0 >= model.externally_defined_tile_style_arena.items.len() {
27174                return Err(AuthorError::DanglingRef {
27175                    entity: "EXTERNALLY_DEFINED_TILE_STYLE",
27176                });
27177            }
27178        }
27179        FillStyleSelectRef::FillAreaStyleColour(i) => {
27180            if i.0 >= model.fill_area_style_colour_arena.items.len() {
27181                return Err(AuthorError::DanglingRef {
27182                    entity: "FILL_AREA_STYLE_COLOUR",
27183                });
27184            }
27185        }
27186        FillStyleSelectRef::FillAreaStyleHatching(i) => {
27187            if i.0 >= model.fill_area_style_hatching_arena.items.len() {
27188                return Err(AuthorError::DanglingRef {
27189                    entity: "FILL_AREA_STYLE_HATCHING",
27190                });
27191            }
27192        }
27193        FillStyleSelectRef::FillAreaStyleTiles(i) => {
27194            if i.0 >= model.fill_area_style_tiles_arena.items.len() {
27195                return Err(AuthorError::DanglingRef {
27196                    entity: "FILL_AREA_STYLE_TILES",
27197                });
27198            }
27199        }
27200        FillStyleSelectRef::TextureStyleSpecification(i) => {
27201            if i.0 >= model.texture_style_specification_arena.items.len() {
27202                return Err(AuthorError::DanglingRef {
27203                    entity: "TEXTURE_STYLE_SPECIFICATION",
27204                });
27205            }
27206        }
27207        FillStyleSelectRef::TextureStyleTessellationSpecification(i) => {
27208            if i.0
27209                >= model
27210                    .texture_style_tessellation_specification_arena
27211                    .items
27212                    .len()
27213            {
27214                return Err(AuthorError::DanglingRef {
27215                    entity: "TEXTURE_STYLE_TESSELLATION_SPECIFICATION",
27216                });
27217            }
27218        }
27219        FillStyleSelectRef::Complex(i) => {
27220            if i.0 >= model.complex_unit_arena.items.len() {
27221                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
27222            }
27223        }
27224    }
27225    Ok(())
27226}
27227fn check_font_select_ref(model: &StepModel, r: &FontSelectRef) -> Result<(), AuthorError> {
27228    match r {
27229        FontSelectRef::DraughtingPreDefinedTextFont(i) => {
27230            if i.0 >= model.draughting_pre_defined_text_font_arena.items.len() {
27231                return Err(AuthorError::DanglingRef {
27232                    entity: "DRAUGHTING_PRE_DEFINED_TEXT_FONT",
27233                });
27234            }
27235        }
27236        FontSelectRef::ExternallyDefinedTextFont(i) => {
27237            if i.0 >= model.externally_defined_text_font_arena.items.len() {
27238                return Err(AuthorError::DanglingRef {
27239                    entity: "EXTERNALLY_DEFINED_TEXT_FONT",
27240                });
27241            }
27242        }
27243        FontSelectRef::PreDefinedTextFont(i) => {
27244            if i.0 >= model.pre_defined_text_font_arena.items.len() {
27245                return Err(AuthorError::DanglingRef {
27246                    entity: "PRE_DEFINED_TEXT_FONT",
27247                });
27248            }
27249        }
27250        FontSelectRef::TextFont(i) => {
27251            if i.0 >= model.text_font_arena.items.len() {
27252                return Err(AuthorError::DanglingRef {
27253                    entity: "TEXT_FONT",
27254                });
27255            }
27256        }
27257        FontSelectRef::Complex(i) => {
27258            if i.0 >= model.complex_unit_arena.items.len() {
27259                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
27260            }
27261        }
27262    }
27263    Ok(())
27264}
27265fn check_general_property_ref(
27266    model: &StepModel,
27267    r: &GeneralPropertyRef,
27268) -> Result<(), AuthorError> {
27269    match r {
27270        GeneralPropertyRef::GeneralProperty(i) => {
27271            if i.0 >= model.general_property_arena.items.len() {
27272                return Err(AuthorError::DanglingRef {
27273                    entity: "GENERAL_PROPERTY",
27274                });
27275            }
27276        }
27277        GeneralPropertyRef::Complex(i) => {
27278            if i.0 >= model.complex_unit_arena.items.len() {
27279                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
27280            }
27281        }
27282    }
27283    Ok(())
27284}
27285fn check_geometric_item_specific_usage_select_ref(
27286    model: &StepModel,
27287    r: &GeometricItemSpecificUsageSelectRef,
27288) -> Result<(), AuthorError> {
27289    match r {
27290        GeometricItemSpecificUsageSelectRef::AllAroundShapeAspect(i) => {
27291            if i.0 >= model.all_around_shape_aspect_arena.items.len() {
27292                return Err(AuthorError::DanglingRef {
27293                    entity: "ALL_AROUND_SHAPE_ASPECT",
27294                });
27295            }
27296        }
27297        GeometricItemSpecificUsageSelectRef::AngularLocation(i) => {
27298            if i.0 >= model.angular_location_arena.items.len() {
27299                return Err(AuthorError::DanglingRef {
27300                    entity: "ANGULAR_LOCATION",
27301                });
27302            }
27303        }
27304        GeometricItemSpecificUsageSelectRef::CentreOfSymmetry(i) => {
27305            if i.0 >= model.centre_of_symmetry_arena.items.len() {
27306                return Err(AuthorError::DanglingRef {
27307                    entity: "CENTRE_OF_SYMMETRY",
27308                });
27309            }
27310        }
27311        GeometricItemSpecificUsageSelectRef::CommonDatum(i) => {
27312            if i.0 >= model.common_datum_arena.items.len() {
27313                return Err(AuthorError::DanglingRef {
27314                    entity: "COMMON_DATUM",
27315                });
27316            }
27317        }
27318        GeometricItemSpecificUsageSelectRef::CompositeGroupShapeAspect(i) => {
27319            if i.0 >= model.composite_group_shape_aspect_arena.items.len() {
27320                return Err(AuthorError::DanglingRef {
27321                    entity: "COMPOSITE_GROUP_SHAPE_ASPECT",
27322                });
27323            }
27324        }
27325        GeometricItemSpecificUsageSelectRef::CompositeShapeAspect(i) => {
27326            if i.0 >= model.composite_shape_aspect_arena.items.len() {
27327                return Err(AuthorError::DanglingRef {
27328                    entity: "COMPOSITE_SHAPE_ASPECT",
27329                });
27330            }
27331        }
27332        GeometricItemSpecificUsageSelectRef::ContinuousShapeAspect(i) => {
27333            if i.0 >= model.continuous_shape_aspect_arena.items.len() {
27334                return Err(AuthorError::DanglingRef {
27335                    entity: "CONTINUOUS_SHAPE_ASPECT",
27336                });
27337            }
27338        }
27339        GeometricItemSpecificUsageSelectRef::Datum(i) => {
27340            if i.0 >= model.datum_arena.items.len() {
27341                return Err(AuthorError::DanglingRef { entity: "DATUM" });
27342            }
27343        }
27344        GeometricItemSpecificUsageSelectRef::DatumFeature(i) => {
27345            if i.0 >= model.datum_feature_arena.items.len() {
27346                return Err(AuthorError::DanglingRef {
27347                    entity: "DATUM_FEATURE",
27348                });
27349            }
27350        }
27351        GeometricItemSpecificUsageSelectRef::DatumReferenceCompartment(i) => {
27352            if i.0 >= model.datum_reference_compartment_arena.items.len() {
27353                return Err(AuthorError::DanglingRef {
27354                    entity: "DATUM_REFERENCE_COMPARTMENT",
27355                });
27356            }
27357        }
27358        GeometricItemSpecificUsageSelectRef::DatumReferenceElement(i) => {
27359            if i.0 >= model.datum_reference_element_arena.items.len() {
27360                return Err(AuthorError::DanglingRef {
27361                    entity: "DATUM_REFERENCE_ELEMENT",
27362                });
27363            }
27364        }
27365        GeometricItemSpecificUsageSelectRef::DatumSystem(i) => {
27366            if i.0 >= model.datum_system_arena.items.len() {
27367                return Err(AuthorError::DanglingRef {
27368                    entity: "DATUM_SYSTEM",
27369                });
27370            }
27371        }
27372        GeometricItemSpecificUsageSelectRef::DatumTarget(i) => {
27373            if i.0 >= model.datum_target_arena.items.len() {
27374                return Err(AuthorError::DanglingRef {
27375                    entity: "DATUM_TARGET",
27376                });
27377            }
27378        }
27379        GeometricItemSpecificUsageSelectRef::DefaultModelGeometricView(i) => {
27380            if i.0 >= model.default_model_geometric_view_arena.items.len() {
27381                return Err(AuthorError::DanglingRef {
27382                    entity: "DEFAULT_MODEL_GEOMETRIC_VIEW",
27383                });
27384            }
27385        }
27386        GeometricItemSpecificUsageSelectRef::DerivedShapeAspect(i) => {
27387            if i.0 >= model.derived_shape_aspect_arena.items.len() {
27388                return Err(AuthorError::DanglingRef {
27389                    entity: "DERIVED_SHAPE_ASPECT",
27390                });
27391            }
27392        }
27393        GeometricItemSpecificUsageSelectRef::DimensionalLocation(i) => {
27394            if i.0 >= model.dimensional_location_arena.items.len() {
27395                return Err(AuthorError::DanglingRef {
27396                    entity: "DIMENSIONAL_LOCATION",
27397                });
27398            }
27399        }
27400        GeometricItemSpecificUsageSelectRef::DimensionalLocationWithPath(i) => {
27401            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
27402                return Err(AuthorError::DanglingRef {
27403                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
27404                });
27405            }
27406        }
27407        GeometricItemSpecificUsageSelectRef::DimensionalSizeWithDatumFeature(i) => {
27408            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
27409                return Err(AuthorError::DanglingRef {
27410                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
27411                });
27412            }
27413        }
27414        GeometricItemSpecificUsageSelectRef::DirectedDimensionalLocation(i) => {
27415            if i.0 >= model.directed_dimensional_location_arena.items.len() {
27416                return Err(AuthorError::DanglingRef {
27417                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
27418                });
27419            }
27420        }
27421        GeometricItemSpecificUsageSelectRef::FeatureForDatumTargetRelationship(i) => {
27422            if i.0
27423                >= model
27424                    .feature_for_datum_target_relationship_arena
27425                    .items
27426                    .len()
27427            {
27428                return Err(AuthorError::DanglingRef {
27429                    entity: "FEATURE_FOR_DATUM_TARGET_RELATIONSHIP",
27430                });
27431            }
27432        }
27433        GeometricItemSpecificUsageSelectRef::GeneralDatumReference(i) => {
27434            if i.0 >= model.general_datum_reference_arena.items.len() {
27435                return Err(AuthorError::DanglingRef {
27436                    entity: "GENERAL_DATUM_REFERENCE",
27437                });
27438            }
27439        }
27440        GeometricItemSpecificUsageSelectRef::PlacedDatumTargetFeature(i) => {
27441            if i.0 >= model.placed_datum_target_feature_arena.items.len() {
27442                return Err(AuthorError::DanglingRef {
27443                    entity: "PLACED_DATUM_TARGET_FEATURE",
27444                });
27445            }
27446        }
27447        GeometricItemSpecificUsageSelectRef::ShapeAspect(i) => {
27448            if i.0 >= model.shape_aspect_arena.items.len() {
27449                return Err(AuthorError::DanglingRef {
27450                    entity: "SHAPE_ASPECT",
27451                });
27452            }
27453        }
27454        GeometricItemSpecificUsageSelectRef::ShapeAspectAssociativity(i) => {
27455            if i.0 >= model.shape_aspect_associativity_arena.items.len() {
27456                return Err(AuthorError::DanglingRef {
27457                    entity: "SHAPE_ASPECT_ASSOCIATIVITY",
27458                });
27459            }
27460        }
27461        GeometricItemSpecificUsageSelectRef::ShapeAspectDerivingRelationship(i) => {
27462            if i.0 >= model.shape_aspect_deriving_relationship_arena.items.len() {
27463                return Err(AuthorError::DanglingRef {
27464                    entity: "SHAPE_ASPECT_DERIVING_RELATIONSHIP",
27465                });
27466            }
27467        }
27468        GeometricItemSpecificUsageSelectRef::ShapeAspectRelationship(i) => {
27469            if i.0 >= model.shape_aspect_relationship_arena.items.len() {
27470                return Err(AuthorError::DanglingRef {
27471                    entity: "SHAPE_ASPECT_RELATIONSHIP",
27472                });
27473            }
27474        }
27475        GeometricItemSpecificUsageSelectRef::ToleranceZone(i) => {
27476            if i.0 >= model.tolerance_zone_arena.items.len() {
27477                return Err(AuthorError::DanglingRef {
27478                    entity: "TOLERANCE_ZONE",
27479                });
27480            }
27481        }
27482        GeometricItemSpecificUsageSelectRef::ToleranceZoneWithDatum(i) => {
27483            if i.0 >= model.tolerance_zone_with_datum_arena.items.len() {
27484                return Err(AuthorError::DanglingRef {
27485                    entity: "TOLERANCE_ZONE_WITH_DATUM",
27486                });
27487            }
27488        }
27489        GeometricItemSpecificUsageSelectRef::Complex(i) => {
27490            if i.0 >= model.complex_unit_arena.items.len() {
27491                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
27492            }
27493        }
27494    }
27495    Ok(())
27496}
27497fn check_geometric_model_item_ref(
27498    model: &StepModel,
27499    r: &GeometricModelItemRef,
27500) -> Result<(), AuthorError> {
27501    match r {
27502        GeometricModelItemRef::AdvancedFace(i) => {
27503            if i.0 >= model.advanced_face_arena.items.len() {
27504                return Err(AuthorError::DanglingRef {
27505                    entity: "ADVANCED_FACE",
27506                });
27507            }
27508        }
27509        GeometricModelItemRef::AnnotationPlaceholderLeaderLine(_) => {
27510            return Err(AuthorError::NotAp242 {
27511                entity: "ANNOTATION_PLACEHOLDER_LEADER_LINE",
27512            });
27513        }
27514        GeometricModelItemRef::AnnotationPlaceholderOccurrence(i) => {
27515            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
27516                return Err(AuthorError::DanglingRef {
27517                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
27518                });
27519            }
27520        }
27521        GeometricModelItemRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
27522            return Err(AuthorError::NotAp242 {
27523                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
27524            });
27525        }
27526        GeometricModelItemRef::AnnotationPlane(i) => {
27527            if i.0 >= model.annotation_plane_arena.items.len() {
27528                return Err(AuthorError::DanglingRef {
27529                    entity: "ANNOTATION_PLANE",
27530                });
27531            }
27532        }
27533        GeometricModelItemRef::AnnotationToAnnotationLeaderLine(_) => {
27534            return Err(AuthorError::NotAp242 {
27535                entity: "ANNOTATION_TO_ANNOTATION_LEADER_LINE",
27536            });
27537        }
27538        GeometricModelItemRef::AnnotationToModelLeaderLine(_) => {
27539            return Err(AuthorError::NotAp242 {
27540                entity: "ANNOTATION_TO_MODEL_LEADER_LINE",
27541            });
27542        }
27543        GeometricModelItemRef::ApllPoint(_) => {
27544            return Err(AuthorError::NotAp242 {
27545                entity: "APLL_POINT",
27546            });
27547        }
27548        GeometricModelItemRef::ApllPointWithSurface(_) => {
27549            return Err(AuthorError::NotAp242 {
27550                entity: "APLL_POINT_WITH_SURFACE",
27551            });
27552        }
27553        GeometricModelItemRef::AuxiliaryLeaderLine(_) => {
27554            return Err(AuthorError::NotAp242 {
27555                entity: "AUXILIARY_LEADER_LINE",
27556            });
27557        }
27558        GeometricModelItemRef::Axis1Placement(i) => {
27559            if i.0 >= model.axis1_placement_arena.items.len() {
27560                return Err(AuthorError::DanglingRef {
27561                    entity: "AXIS1_PLACEMENT",
27562                });
27563            }
27564        }
27565        GeometricModelItemRef::Axis2Placement2d(i) => {
27566            if i.0 >= model.axis2_placement2d_arena.items.len() {
27567                return Err(AuthorError::DanglingRef {
27568                    entity: "AXIS2_PLACEMENT_2D",
27569                });
27570            }
27571        }
27572        GeometricModelItemRef::Axis2Placement3d(i) => {
27573            if i.0 >= model.axis2_placement3d_arena.items.len() {
27574                return Err(AuthorError::DanglingRef {
27575                    entity: "AXIS2_PLACEMENT_3D",
27576                });
27577            }
27578        }
27579        GeometricModelItemRef::BSplineCurve(i) => {
27580            if i.0 >= model.b_spline_curve_arena.items.len() {
27581                return Err(AuthorError::DanglingRef {
27582                    entity: "B_SPLINE_CURVE",
27583                });
27584            }
27585        }
27586        GeometricModelItemRef::BSplineCurveWithKnots(i) => {
27587            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
27588                return Err(AuthorError::DanglingRef {
27589                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
27590                });
27591            }
27592        }
27593        GeometricModelItemRef::BSplineSurface(i) => {
27594            if i.0 >= model.b_spline_surface_arena.items.len() {
27595                return Err(AuthorError::DanglingRef {
27596                    entity: "B_SPLINE_SURFACE",
27597                });
27598            }
27599        }
27600        GeometricModelItemRef::BSplineSurfaceWithKnots(i) => {
27601            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
27602                return Err(AuthorError::DanglingRef {
27603                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
27604                });
27605            }
27606        }
27607        GeometricModelItemRef::BezierCurve(i) => {
27608            if i.0 >= model.bezier_curve_arena.items.len() {
27609                return Err(AuthorError::DanglingRef {
27610                    entity: "BEZIER_CURVE",
27611                });
27612            }
27613        }
27614        GeometricModelItemRef::BezierSurface(i) => {
27615            if i.0 >= model.bezier_surface_arena.items.len() {
27616                return Err(AuthorError::DanglingRef {
27617                    entity: "BEZIER_SURFACE",
27618                });
27619            }
27620        }
27621        GeometricModelItemRef::BoundedCurve(i) => {
27622            if i.0 >= model.bounded_curve_arena.items.len() {
27623                return Err(AuthorError::DanglingRef {
27624                    entity: "BOUNDED_CURVE",
27625                });
27626            }
27627        }
27628        GeometricModelItemRef::BoundedPcurve(i) => {
27629            if i.0 >= model.bounded_pcurve_arena.items.len() {
27630                return Err(AuthorError::DanglingRef {
27631                    entity: "BOUNDED_PCURVE",
27632                });
27633            }
27634        }
27635        GeometricModelItemRef::BoundedSurface(i) => {
27636            if i.0 >= model.bounded_surface_arena.items.len() {
27637                return Err(AuthorError::DanglingRef {
27638                    entity: "BOUNDED_SURFACE",
27639                });
27640            }
27641        }
27642        GeometricModelItemRef::BoundedSurfaceCurve(i) => {
27643            if i.0 >= model.bounded_surface_curve_arena.items.len() {
27644                return Err(AuthorError::DanglingRef {
27645                    entity: "BOUNDED_SURFACE_CURVE",
27646                });
27647            }
27648        }
27649        GeometricModelItemRef::BrepWithVoids(i) => {
27650            if i.0 >= model.brep_with_voids_arena.items.len() {
27651                return Err(AuthorError::DanglingRef {
27652                    entity: "BREP_WITH_VOIDS",
27653                });
27654            }
27655        }
27656        GeometricModelItemRef::CameraModel(i) => {
27657            if i.0 >= model.camera_model_arena.items.len() {
27658                return Err(AuthorError::DanglingRef {
27659                    entity: "CAMERA_MODEL",
27660                });
27661            }
27662        }
27663        GeometricModelItemRef::CameraModelD3(i) => {
27664            if i.0 >= model.camera_model_d3_arena.items.len() {
27665                return Err(AuthorError::DanglingRef {
27666                    entity: "CAMERA_MODEL_D3",
27667                });
27668            }
27669        }
27670        GeometricModelItemRef::CameraModelD3MultiClipping(i) => {
27671            if i.0 >= model.camera_model_d3_multi_clipping_arena.items.len() {
27672                return Err(AuthorError::DanglingRef {
27673                    entity: "CAMERA_MODEL_D3_MULTI_CLIPPING",
27674                });
27675            }
27676        }
27677        GeometricModelItemRef::CameraModelD3WithHlhsr(i) => {
27678            if i.0 >= model.camera_model_d3_with_hlhsr_arena.items.len() {
27679                return Err(AuthorError::DanglingRef {
27680                    entity: "CAMERA_MODEL_D3_WITH_HLHSR",
27681                });
27682            }
27683        }
27684        GeometricModelItemRef::CartesianPoint(i) => {
27685            if i.0 >= model.cartesian_point_arena.items.len() {
27686                return Err(AuthorError::DanglingRef {
27687                    entity: "CARTESIAN_POINT",
27688                });
27689            }
27690        }
27691        GeometricModelItemRef::Circle(i) => {
27692            if i.0 >= model.circle_arena.items.len() {
27693                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
27694            }
27695        }
27696        GeometricModelItemRef::ClosedShell(i) => {
27697            if i.0 >= model.closed_shell_arena.items.len() {
27698                return Err(AuthorError::DanglingRef {
27699                    entity: "CLOSED_SHELL",
27700                });
27701            }
27702        }
27703        GeometricModelItemRef::ComplexTriangulatedFace(i) => {
27704            if i.0 >= model.complex_triangulated_face_arena.items.len() {
27705                return Err(AuthorError::DanglingRef {
27706                    entity: "COMPLEX_TRIANGULATED_FACE",
27707                });
27708            }
27709        }
27710        GeometricModelItemRef::ComplexTriangulatedSurfaceSet(i) => {
27711            if i.0 >= model.complex_triangulated_surface_set_arena.items.len() {
27712                return Err(AuthorError::DanglingRef {
27713                    entity: "COMPLEX_TRIANGULATED_SURFACE_SET",
27714                });
27715            }
27716        }
27717        GeometricModelItemRef::CompositeCurve(i) => {
27718            if i.0 >= model.composite_curve_arena.items.len() {
27719                return Err(AuthorError::DanglingRef {
27720                    entity: "COMPOSITE_CURVE",
27721                });
27722            }
27723        }
27724        GeometricModelItemRef::CompositeText(i) => {
27725            if i.0 >= model.composite_text_arena.items.len() {
27726                return Err(AuthorError::DanglingRef {
27727                    entity: "COMPOSITE_TEXT",
27728                });
27729            }
27730        }
27731        GeometricModelItemRef::Conic(i) => {
27732            if i.0 >= model.conic_arena.items.len() {
27733                return Err(AuthorError::DanglingRef { entity: "CONIC" });
27734            }
27735        }
27736        GeometricModelItemRef::ConicalSurface(i) => {
27737            if i.0 >= model.conical_surface_arena.items.len() {
27738                return Err(AuthorError::DanglingRef {
27739                    entity: "CONICAL_SURFACE",
27740                });
27741            }
27742        }
27743        GeometricModelItemRef::ConnectedFaceSet(i) => {
27744            if i.0 >= model.connected_face_set_arena.items.len() {
27745                return Err(AuthorError::DanglingRef {
27746                    entity: "CONNECTED_FACE_SET",
27747                });
27748            }
27749        }
27750        GeometricModelItemRef::CoordinatesList(i) => {
27751            if i.0 >= model.coordinates_list_arena.items.len() {
27752                return Err(AuthorError::DanglingRef {
27753                    entity: "COORDINATES_LIST",
27754                });
27755            }
27756        }
27757        GeometricModelItemRef::Curve(i) => {
27758            if i.0 >= model.curve_arena.items.len() {
27759                return Err(AuthorError::DanglingRef { entity: "CURVE" });
27760            }
27761        }
27762        GeometricModelItemRef::CylindricalSurface(i) => {
27763            if i.0 >= model.cylindrical_surface_arena.items.len() {
27764                return Err(AuthorError::DanglingRef {
27765                    entity: "CYLINDRICAL_SURFACE",
27766                });
27767            }
27768        }
27769        GeometricModelItemRef::DefinedCharacterGlyph(i) => {
27770            if i.0 >= model.defined_character_glyph_arena.items.len() {
27771                return Err(AuthorError::DanglingRef {
27772                    entity: "DEFINED_CHARACTER_GLYPH",
27773                });
27774            }
27775        }
27776        GeometricModelItemRef::DefinedSymbol(i) => {
27777            if i.0 >= model.defined_symbol_arena.items.len() {
27778                return Err(AuthorError::DanglingRef {
27779                    entity: "DEFINED_SYMBOL",
27780                });
27781            }
27782        }
27783        GeometricModelItemRef::DegenerateToroidalSurface(i) => {
27784            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
27785                return Err(AuthorError::DanglingRef {
27786                    entity: "DEGENERATE_TOROIDAL_SURFACE",
27787                });
27788            }
27789        }
27790        GeometricModelItemRef::Direction(i) => {
27791            if i.0 >= model.direction_arena.items.len() {
27792                return Err(AuthorError::DanglingRef {
27793                    entity: "DIRECTION",
27794                });
27795            }
27796        }
27797        GeometricModelItemRef::DraughtingCallout(i) => {
27798            if i.0 >= model.draughting_callout_arena.items.len() {
27799                return Err(AuthorError::DanglingRef {
27800                    entity: "DRAUGHTING_CALLOUT",
27801                });
27802            }
27803        }
27804        GeometricModelItemRef::EdgeCurve(i) => {
27805            if i.0 >= model.edge_curve_arena.items.len() {
27806                return Err(AuthorError::DanglingRef {
27807                    entity: "EDGE_CURVE",
27808                });
27809            }
27810        }
27811        GeometricModelItemRef::EdgeLoop(i) => {
27812            if i.0 >= model.edge_loop_arena.items.len() {
27813                return Err(AuthorError::DanglingRef {
27814                    entity: "EDGE_LOOP",
27815                });
27816            }
27817        }
27818        GeometricModelItemRef::ElementarySurface(i) => {
27819            if i.0 >= model.elementary_surface_arena.items.len() {
27820                return Err(AuthorError::DanglingRef {
27821                    entity: "ELEMENTARY_SURFACE",
27822                });
27823            }
27824        }
27825        GeometricModelItemRef::Ellipse(i) => {
27826            if i.0 >= model.ellipse_arena.items.len() {
27827                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
27828            }
27829        }
27830        GeometricModelItemRef::ExternallyDefinedHatchStyle(i) => {
27831            if i.0 >= model.externally_defined_hatch_style_arena.items.len() {
27832                return Err(AuthorError::DanglingRef {
27833                    entity: "EXTERNALLY_DEFINED_HATCH_STYLE",
27834                });
27835            }
27836        }
27837        GeometricModelItemRef::ExternallyDefinedTileStyle(i) => {
27838            if i.0 >= model.externally_defined_tile_style_arena.items.len() {
27839                return Err(AuthorError::DanglingRef {
27840                    entity: "EXTERNALLY_DEFINED_TILE_STYLE",
27841                });
27842            }
27843        }
27844        GeometricModelItemRef::FaceSurface(i) => {
27845            if i.0 >= model.face_surface_arena.items.len() {
27846                return Err(AuthorError::DanglingRef {
27847                    entity: "FACE_SURFACE",
27848                });
27849            }
27850        }
27851        GeometricModelItemRef::FillAreaStyleHatching(i) => {
27852            if i.0 >= model.fill_area_style_hatching_arena.items.len() {
27853                return Err(AuthorError::DanglingRef {
27854                    entity: "FILL_AREA_STYLE_HATCHING",
27855                });
27856            }
27857        }
27858        GeometricModelItemRef::FillAreaStyleTileColouredRegion(i) => {
27859            if i.0 >= model.fill_area_style_tile_coloured_region_arena.items.len() {
27860                return Err(AuthorError::DanglingRef {
27861                    entity: "FILL_AREA_STYLE_TILE_COLOURED_REGION",
27862                });
27863            }
27864        }
27865        GeometricModelItemRef::FillAreaStyleTileCurveWithStyle(i) => {
27866            if i.0
27867                >= model
27868                    .fill_area_style_tile_curve_with_style_arena
27869                    .items
27870                    .len()
27871            {
27872                return Err(AuthorError::DanglingRef {
27873                    entity: "FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE",
27874                });
27875            }
27876        }
27877        GeometricModelItemRef::FillAreaStyleTileSymbolWithStyle(i) => {
27878            if i.0
27879                >= model
27880                    .fill_area_style_tile_symbol_with_style_arena
27881                    .items
27882                    .len()
27883            {
27884                return Err(AuthorError::DanglingRef {
27885                    entity: "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE",
27886                });
27887            }
27888        }
27889        GeometricModelItemRef::FillAreaStyleTiles(i) => {
27890            if i.0 >= model.fill_area_style_tiles_arena.items.len() {
27891                return Err(AuthorError::DanglingRef {
27892                    entity: "FILL_AREA_STYLE_TILES",
27893                });
27894            }
27895        }
27896        GeometricModelItemRef::GeometricCurveSet(i) => {
27897            if i.0 >= model.geometric_curve_set_arena.items.len() {
27898                return Err(AuthorError::DanglingRef {
27899                    entity: "GEOMETRIC_CURVE_SET",
27900                });
27901            }
27902        }
27903        GeometricModelItemRef::GeometricRepresentationItem(i) => {
27904            if i.0 >= model.geometric_representation_item_arena.items.len() {
27905                return Err(AuthorError::DanglingRef {
27906                    entity: "GEOMETRIC_REPRESENTATION_ITEM",
27907                });
27908            }
27909        }
27910        GeometricModelItemRef::GeometricSet(i) => {
27911            if i.0 >= model.geometric_set_arena.items.len() {
27912                return Err(AuthorError::DanglingRef {
27913                    entity: "GEOMETRIC_SET",
27914                });
27915            }
27916        }
27917        GeometricModelItemRef::Hyperbola(i) => {
27918            if i.0 >= model.hyperbola_arena.items.len() {
27919                return Err(AuthorError::DanglingRef {
27920                    entity: "HYPERBOLA",
27921                });
27922            }
27923        }
27924        GeometricModelItemRef::IntersectionCurve(i) => {
27925            if i.0 >= model.intersection_curve_arena.items.len() {
27926                return Err(AuthorError::DanglingRef {
27927                    entity: "INTERSECTION_CURVE",
27928                });
27929            }
27930        }
27931        GeometricModelItemRef::LeaderDirectedCallout(i) => {
27932            if i.0 >= model.leader_directed_callout_arena.items.len() {
27933                return Err(AuthorError::DanglingRef {
27934                    entity: "LEADER_DIRECTED_CALLOUT",
27935                });
27936            }
27937        }
27938        GeometricModelItemRef::Line(i) => {
27939            if i.0 >= model.line_arena.items.len() {
27940                return Err(AuthorError::DanglingRef { entity: "LINE" });
27941            }
27942        }
27943        GeometricModelItemRef::ManifoldSolidBrep(i) => {
27944            if i.0 >= model.manifold_solid_brep_arena.items.len() {
27945                return Err(AuthorError::DanglingRef {
27946                    entity: "MANIFOLD_SOLID_BREP",
27947                });
27948            }
27949        }
27950        GeometricModelItemRef::OffsetSurface(i) => {
27951            if i.0 >= model.offset_surface_arena.items.len() {
27952                return Err(AuthorError::DanglingRef {
27953                    entity: "OFFSET_SURFACE",
27954                });
27955            }
27956        }
27957        GeometricModelItemRef::OneDirectionRepeatFactor(i) => {
27958            if i.0 >= model.one_direction_repeat_factor_arena.items.len() {
27959                return Err(AuthorError::DanglingRef {
27960                    entity: "ONE_DIRECTION_REPEAT_FACTOR",
27961                });
27962            }
27963        }
27964        GeometricModelItemRef::OpenShell(i) => {
27965            if i.0 >= model.open_shell_arena.items.len() {
27966                return Err(AuthorError::DanglingRef {
27967                    entity: "OPEN_SHELL",
27968                });
27969            }
27970        }
27971        GeometricModelItemRef::OrientedClosedShell(i) => {
27972            if i.0 >= model.oriented_closed_shell_arena.items.len() {
27973                return Err(AuthorError::DanglingRef {
27974                    entity: "ORIENTED_CLOSED_SHELL",
27975                });
27976            }
27977        }
27978        GeometricModelItemRef::Pcurve(i) => {
27979            if i.0 >= model.pcurve_arena.items.len() {
27980                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
27981            }
27982        }
27983        GeometricModelItemRef::Placement(i) => {
27984            if i.0 >= model.placement_arena.items.len() {
27985                return Err(AuthorError::DanglingRef {
27986                    entity: "PLACEMENT",
27987                });
27988            }
27989        }
27990        GeometricModelItemRef::PlanarBox(i) => {
27991            if i.0 >= model.planar_box_arena.items.len() {
27992                return Err(AuthorError::DanglingRef {
27993                    entity: "PLANAR_BOX",
27994                });
27995            }
27996        }
27997        GeometricModelItemRef::PlanarExtent(i) => {
27998            if i.0 >= model.planar_extent_arena.items.len() {
27999                return Err(AuthorError::DanglingRef {
28000                    entity: "PLANAR_EXTENT",
28001                });
28002            }
28003        }
28004        GeometricModelItemRef::Plane(i) => {
28005            if i.0 >= model.plane_arena.items.len() {
28006                return Err(AuthorError::DanglingRef { entity: "PLANE" });
28007            }
28008        }
28009        GeometricModelItemRef::Point(i) => {
28010            if i.0 >= model.point_arena.items.len() {
28011                return Err(AuthorError::DanglingRef { entity: "POINT" });
28012            }
28013        }
28014        GeometricModelItemRef::PolyLoop(i) => {
28015            if i.0 >= model.poly_loop_arena.items.len() {
28016                return Err(AuthorError::DanglingRef {
28017                    entity: "POLY_LOOP",
28018                });
28019            }
28020        }
28021        GeometricModelItemRef::Polyline(i) => {
28022            if i.0 >= model.polyline_arena.items.len() {
28023                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
28024            }
28025        }
28026        GeometricModelItemRef::QuasiUniformCurve(i) => {
28027            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
28028                return Err(AuthorError::DanglingRef {
28029                    entity: "QUASI_UNIFORM_CURVE",
28030                });
28031            }
28032        }
28033        GeometricModelItemRef::QuasiUniformSurface(i) => {
28034            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
28035                return Err(AuthorError::DanglingRef {
28036                    entity: "QUASI_UNIFORM_SURFACE",
28037                });
28038            }
28039        }
28040        GeometricModelItemRef::RationalBSplineCurve(i) => {
28041            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
28042                return Err(AuthorError::DanglingRef {
28043                    entity: "RATIONAL_B_SPLINE_CURVE",
28044                });
28045            }
28046        }
28047        GeometricModelItemRef::RationalBSplineSurface(i) => {
28048            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
28049                return Err(AuthorError::DanglingRef {
28050                    entity: "RATIONAL_B_SPLINE_SURFACE",
28051                });
28052            }
28053        }
28054        GeometricModelItemRef::RepositionedTessellatedItem(i) => {
28055            if i.0 >= model.repositioned_tessellated_item_arena.items.len() {
28056                return Err(AuthorError::DanglingRef {
28057                    entity: "REPOSITIONED_TESSELLATED_ITEM",
28058                });
28059            }
28060        }
28061        GeometricModelItemRef::SeamCurve(i) => {
28062            if i.0 >= model.seam_curve_arena.items.len() {
28063                return Err(AuthorError::DanglingRef {
28064                    entity: "SEAM_CURVE",
28065                });
28066            }
28067        }
28068        GeometricModelItemRef::ShellBasedSurfaceModel(i) => {
28069            if i.0 >= model.shell_based_surface_model_arena.items.len() {
28070                return Err(AuthorError::DanglingRef {
28071                    entity: "SHELL_BASED_SURFACE_MODEL",
28072                });
28073            }
28074        }
28075        GeometricModelItemRef::SolidModel(i) => {
28076            if i.0 >= model.solid_model_arena.items.len() {
28077                return Err(AuthorError::DanglingRef {
28078                    entity: "SOLID_MODEL",
28079                });
28080            }
28081        }
28082        GeometricModelItemRef::SphericalSurface(i) => {
28083            if i.0 >= model.spherical_surface_arena.items.len() {
28084                return Err(AuthorError::DanglingRef {
28085                    entity: "SPHERICAL_SURFACE",
28086                });
28087            }
28088        }
28089        GeometricModelItemRef::Surface(i) => {
28090            if i.0 >= model.surface_arena.items.len() {
28091                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
28092            }
28093        }
28094        GeometricModelItemRef::SurfaceCurve(i) => {
28095            if i.0 >= model.surface_curve_arena.items.len() {
28096                return Err(AuthorError::DanglingRef {
28097                    entity: "SURFACE_CURVE",
28098                });
28099            }
28100        }
28101        GeometricModelItemRef::SurfaceOfLinearExtrusion(i) => {
28102            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
28103                return Err(AuthorError::DanglingRef {
28104                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
28105                });
28106            }
28107        }
28108        GeometricModelItemRef::SurfaceOfRevolution(i) => {
28109            if i.0 >= model.surface_of_revolution_arena.items.len() {
28110                return Err(AuthorError::DanglingRef {
28111                    entity: "SURFACE_OF_REVOLUTION",
28112                });
28113            }
28114        }
28115        GeometricModelItemRef::SweptSurface(i) => {
28116            if i.0 >= model.swept_surface_arena.items.len() {
28117                return Err(AuthorError::DanglingRef {
28118                    entity: "SWEPT_SURFACE",
28119                });
28120            }
28121        }
28122        GeometricModelItemRef::SymbolTarget(i) => {
28123            if i.0 >= model.symbol_target_arena.items.len() {
28124                return Err(AuthorError::DanglingRef {
28125                    entity: "SYMBOL_TARGET",
28126                });
28127            }
28128        }
28129        GeometricModelItemRef::TessellatedCurveSet(i) => {
28130            if i.0 >= model.tessellated_curve_set_arena.items.len() {
28131                return Err(AuthorError::DanglingRef {
28132                    entity: "TESSELLATED_CURVE_SET",
28133                });
28134            }
28135        }
28136        GeometricModelItemRef::TessellatedFace(i) => {
28137            if i.0 >= model.tessellated_face_arena.items.len() {
28138                return Err(AuthorError::DanglingRef {
28139                    entity: "TESSELLATED_FACE",
28140                });
28141            }
28142        }
28143        GeometricModelItemRef::TessellatedGeometricSet(i) => {
28144            if i.0 >= model.tessellated_geometric_set_arena.items.len() {
28145                return Err(AuthorError::DanglingRef {
28146                    entity: "TESSELLATED_GEOMETRIC_SET",
28147                });
28148            }
28149        }
28150        GeometricModelItemRef::TessellatedItem(i) => {
28151            if i.0 >= model.tessellated_item_arena.items.len() {
28152                return Err(AuthorError::DanglingRef {
28153                    entity: "TESSELLATED_ITEM",
28154                });
28155            }
28156        }
28157        GeometricModelItemRef::TessellatedShell(i) => {
28158            if i.0 >= model.tessellated_shell_arena.items.len() {
28159                return Err(AuthorError::DanglingRef {
28160                    entity: "TESSELLATED_SHELL",
28161                });
28162            }
28163        }
28164        GeometricModelItemRef::TessellatedSolid(i) => {
28165            if i.0 >= model.tessellated_solid_arena.items.len() {
28166                return Err(AuthorError::DanglingRef {
28167                    entity: "TESSELLATED_SOLID",
28168                });
28169            }
28170        }
28171        GeometricModelItemRef::TessellatedStructuredItem(i) => {
28172            if i.0 >= model.tessellated_structured_item_arena.items.len() {
28173                return Err(AuthorError::DanglingRef {
28174                    entity: "TESSELLATED_STRUCTURED_ITEM",
28175                });
28176            }
28177        }
28178        GeometricModelItemRef::TessellatedSurfaceSet(i) => {
28179            if i.0 >= model.tessellated_surface_set_arena.items.len() {
28180                return Err(AuthorError::DanglingRef {
28181                    entity: "TESSELLATED_SURFACE_SET",
28182                });
28183            }
28184        }
28185        GeometricModelItemRef::TextLiteral(i) => {
28186            if i.0 >= model.text_literal_arena.items.len() {
28187                return Err(AuthorError::DanglingRef {
28188                    entity: "TEXT_LITERAL",
28189                });
28190            }
28191        }
28192        GeometricModelItemRef::ToroidalSurface(i) => {
28193            if i.0 >= model.toroidal_surface_arena.items.len() {
28194                return Err(AuthorError::DanglingRef {
28195                    entity: "TOROIDAL_SURFACE",
28196                });
28197            }
28198        }
28199        GeometricModelItemRef::TrimmedCurve(i) => {
28200            if i.0 >= model.trimmed_curve_arena.items.len() {
28201                return Err(AuthorError::DanglingRef {
28202                    entity: "TRIMMED_CURVE",
28203                });
28204            }
28205        }
28206        GeometricModelItemRef::TwoDirectionRepeatFactor(i) => {
28207            if i.0 >= model.two_direction_repeat_factor_arena.items.len() {
28208                return Err(AuthorError::DanglingRef {
28209                    entity: "TWO_DIRECTION_REPEAT_FACTOR",
28210                });
28211            }
28212        }
28213        GeometricModelItemRef::UniformCurve(i) => {
28214            if i.0 >= model.uniform_curve_arena.items.len() {
28215                return Err(AuthorError::DanglingRef {
28216                    entity: "UNIFORM_CURVE",
28217                });
28218            }
28219        }
28220        GeometricModelItemRef::UniformSurface(i) => {
28221            if i.0 >= model.uniform_surface_arena.items.len() {
28222                return Err(AuthorError::DanglingRef {
28223                    entity: "UNIFORM_SURFACE",
28224                });
28225            }
28226        }
28227        GeometricModelItemRef::Vector(i) => {
28228            if i.0 >= model.vector_arena.items.len() {
28229                return Err(AuthorError::DanglingRef { entity: "VECTOR" });
28230            }
28231        }
28232        GeometricModelItemRef::VertexPoint(i) => {
28233            if i.0 >= model.vertex_point_arena.items.len() {
28234                return Err(AuthorError::DanglingRef {
28235                    entity: "VERTEX_POINT",
28236                });
28237            }
28238        }
28239        GeometricModelItemRef::Complex(i) => {
28240            if i.0 >= model.complex_unit_arena.items.len() {
28241                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
28242            }
28243        }
28244    }
28245    Ok(())
28246}
28247fn check_geometric_set_select_ref(
28248    model: &StepModel,
28249    r: &GeometricSetSelectRef,
28250) -> Result<(), AuthorError> {
28251    match r {
28252        GeometricSetSelectRef::AnnotationText(i) => {
28253            if i.0 >= model.annotation_text_arena.items.len() {
28254                return Err(AuthorError::DanglingRef {
28255                    entity: "ANNOTATION_TEXT",
28256                });
28257            }
28258        }
28259        GeometricSetSelectRef::ApllPoint(_) => {
28260            return Err(AuthorError::NotAp242 {
28261                entity: "APLL_POINT",
28262            });
28263        }
28264        GeometricSetSelectRef::ApllPointWithSurface(_) => {
28265            return Err(AuthorError::NotAp242 {
28266                entity: "APLL_POINT_WITH_SURFACE",
28267            });
28268        }
28269        GeometricSetSelectRef::Axis1Placement(i) => {
28270            if i.0 >= model.axis1_placement_arena.items.len() {
28271                return Err(AuthorError::DanglingRef {
28272                    entity: "AXIS1_PLACEMENT",
28273                });
28274            }
28275        }
28276        GeometricSetSelectRef::Axis2Placement2d(i) => {
28277            if i.0 >= model.axis2_placement2d_arena.items.len() {
28278                return Err(AuthorError::DanglingRef {
28279                    entity: "AXIS2_PLACEMENT_2D",
28280                });
28281            }
28282        }
28283        GeometricSetSelectRef::Axis2Placement3d(i) => {
28284            if i.0 >= model.axis2_placement3d_arena.items.len() {
28285                return Err(AuthorError::DanglingRef {
28286                    entity: "AXIS2_PLACEMENT_3D",
28287                });
28288            }
28289        }
28290        GeometricSetSelectRef::BSplineCurve(i) => {
28291            if i.0 >= model.b_spline_curve_arena.items.len() {
28292                return Err(AuthorError::DanglingRef {
28293                    entity: "B_SPLINE_CURVE",
28294                });
28295            }
28296        }
28297        GeometricSetSelectRef::BSplineCurveWithKnots(i) => {
28298            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
28299                return Err(AuthorError::DanglingRef {
28300                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
28301                });
28302            }
28303        }
28304        GeometricSetSelectRef::BSplineSurface(i) => {
28305            if i.0 >= model.b_spline_surface_arena.items.len() {
28306                return Err(AuthorError::DanglingRef {
28307                    entity: "B_SPLINE_SURFACE",
28308                });
28309            }
28310        }
28311        GeometricSetSelectRef::BSplineSurfaceWithKnots(i) => {
28312            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
28313                return Err(AuthorError::DanglingRef {
28314                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
28315                });
28316            }
28317        }
28318        GeometricSetSelectRef::BezierCurve(i) => {
28319            if i.0 >= model.bezier_curve_arena.items.len() {
28320                return Err(AuthorError::DanglingRef {
28321                    entity: "BEZIER_CURVE",
28322                });
28323            }
28324        }
28325        GeometricSetSelectRef::BezierSurface(i) => {
28326            if i.0 >= model.bezier_surface_arena.items.len() {
28327                return Err(AuthorError::DanglingRef {
28328                    entity: "BEZIER_SURFACE",
28329                });
28330            }
28331        }
28332        GeometricSetSelectRef::BoundedCurve(i) => {
28333            if i.0 >= model.bounded_curve_arena.items.len() {
28334                return Err(AuthorError::DanglingRef {
28335                    entity: "BOUNDED_CURVE",
28336                });
28337            }
28338        }
28339        GeometricSetSelectRef::BoundedPcurve(i) => {
28340            if i.0 >= model.bounded_pcurve_arena.items.len() {
28341                return Err(AuthorError::DanglingRef {
28342                    entity: "BOUNDED_PCURVE",
28343                });
28344            }
28345        }
28346        GeometricSetSelectRef::BoundedSurface(i) => {
28347            if i.0 >= model.bounded_surface_arena.items.len() {
28348                return Err(AuthorError::DanglingRef {
28349                    entity: "BOUNDED_SURFACE",
28350                });
28351            }
28352        }
28353        GeometricSetSelectRef::BoundedSurfaceCurve(i) => {
28354            if i.0 >= model.bounded_surface_curve_arena.items.len() {
28355                return Err(AuthorError::DanglingRef {
28356                    entity: "BOUNDED_SURFACE_CURVE",
28357                });
28358            }
28359        }
28360        GeometricSetSelectRef::CartesianPoint(i) => {
28361            if i.0 >= model.cartesian_point_arena.items.len() {
28362                return Err(AuthorError::DanglingRef {
28363                    entity: "CARTESIAN_POINT",
28364                });
28365            }
28366        }
28367        GeometricSetSelectRef::Circle(i) => {
28368            if i.0 >= model.circle_arena.items.len() {
28369                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
28370            }
28371        }
28372        GeometricSetSelectRef::CompositeCurve(i) => {
28373            if i.0 >= model.composite_curve_arena.items.len() {
28374                return Err(AuthorError::DanglingRef {
28375                    entity: "COMPOSITE_CURVE",
28376                });
28377            }
28378        }
28379        GeometricSetSelectRef::Conic(i) => {
28380            if i.0 >= model.conic_arena.items.len() {
28381                return Err(AuthorError::DanglingRef { entity: "CONIC" });
28382            }
28383        }
28384        GeometricSetSelectRef::ConicalSurface(i) => {
28385            if i.0 >= model.conical_surface_arena.items.len() {
28386                return Err(AuthorError::DanglingRef {
28387                    entity: "CONICAL_SURFACE",
28388                });
28389            }
28390        }
28391        GeometricSetSelectRef::Curve(i) => {
28392            if i.0 >= model.curve_arena.items.len() {
28393                return Err(AuthorError::DanglingRef { entity: "CURVE" });
28394            }
28395        }
28396        GeometricSetSelectRef::CylindricalSurface(i) => {
28397            if i.0 >= model.cylindrical_surface_arena.items.len() {
28398                return Err(AuthorError::DanglingRef {
28399                    entity: "CYLINDRICAL_SURFACE",
28400                });
28401            }
28402        }
28403        GeometricSetSelectRef::DegenerateToroidalSurface(i) => {
28404            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
28405                return Err(AuthorError::DanglingRef {
28406                    entity: "DEGENERATE_TOROIDAL_SURFACE",
28407                });
28408            }
28409        }
28410        GeometricSetSelectRef::ElementarySurface(i) => {
28411            if i.0 >= model.elementary_surface_arena.items.len() {
28412                return Err(AuthorError::DanglingRef {
28413                    entity: "ELEMENTARY_SURFACE",
28414                });
28415            }
28416        }
28417        GeometricSetSelectRef::Ellipse(i) => {
28418            if i.0 >= model.ellipse_arena.items.len() {
28419                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
28420            }
28421        }
28422        GeometricSetSelectRef::Hyperbola(i) => {
28423            if i.0 >= model.hyperbola_arena.items.len() {
28424                return Err(AuthorError::DanglingRef {
28425                    entity: "HYPERBOLA",
28426                });
28427            }
28428        }
28429        GeometricSetSelectRef::IntersectionCurve(i) => {
28430            if i.0 >= model.intersection_curve_arena.items.len() {
28431                return Err(AuthorError::DanglingRef {
28432                    entity: "INTERSECTION_CURVE",
28433                });
28434            }
28435        }
28436        GeometricSetSelectRef::Line(i) => {
28437            if i.0 >= model.line_arena.items.len() {
28438                return Err(AuthorError::DanglingRef { entity: "LINE" });
28439            }
28440        }
28441        GeometricSetSelectRef::OffsetSurface(i) => {
28442            if i.0 >= model.offset_surface_arena.items.len() {
28443                return Err(AuthorError::DanglingRef {
28444                    entity: "OFFSET_SURFACE",
28445                });
28446            }
28447        }
28448        GeometricSetSelectRef::Pcurve(i) => {
28449            if i.0 >= model.pcurve_arena.items.len() {
28450                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
28451            }
28452        }
28453        GeometricSetSelectRef::Placement(i) => {
28454            if i.0 >= model.placement_arena.items.len() {
28455                return Err(AuthorError::DanglingRef {
28456                    entity: "PLACEMENT",
28457                });
28458            }
28459        }
28460        GeometricSetSelectRef::PlanarBox(i) => {
28461            if i.0 >= model.planar_box_arena.items.len() {
28462                return Err(AuthorError::DanglingRef {
28463                    entity: "PLANAR_BOX",
28464                });
28465            }
28466        }
28467        GeometricSetSelectRef::Plane(i) => {
28468            if i.0 >= model.plane_arena.items.len() {
28469                return Err(AuthorError::DanglingRef { entity: "PLANE" });
28470            }
28471        }
28472        GeometricSetSelectRef::Point(i) => {
28473            if i.0 >= model.point_arena.items.len() {
28474                return Err(AuthorError::DanglingRef { entity: "POINT" });
28475            }
28476        }
28477        GeometricSetSelectRef::Polyline(i) => {
28478            if i.0 >= model.polyline_arena.items.len() {
28479                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
28480            }
28481        }
28482        GeometricSetSelectRef::QuasiUniformCurve(i) => {
28483            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
28484                return Err(AuthorError::DanglingRef {
28485                    entity: "QUASI_UNIFORM_CURVE",
28486                });
28487            }
28488        }
28489        GeometricSetSelectRef::QuasiUniformSurface(i) => {
28490            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
28491                return Err(AuthorError::DanglingRef {
28492                    entity: "QUASI_UNIFORM_SURFACE",
28493                });
28494            }
28495        }
28496        GeometricSetSelectRef::RationalBSplineCurve(i) => {
28497            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
28498                return Err(AuthorError::DanglingRef {
28499                    entity: "RATIONAL_B_SPLINE_CURVE",
28500                });
28501            }
28502        }
28503        GeometricSetSelectRef::RationalBSplineSurface(i) => {
28504            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
28505                return Err(AuthorError::DanglingRef {
28506                    entity: "RATIONAL_B_SPLINE_SURFACE",
28507                });
28508            }
28509        }
28510        GeometricSetSelectRef::SeamCurve(i) => {
28511            if i.0 >= model.seam_curve_arena.items.len() {
28512                return Err(AuthorError::DanglingRef {
28513                    entity: "SEAM_CURVE",
28514                });
28515            }
28516        }
28517        GeometricSetSelectRef::SphericalSurface(i) => {
28518            if i.0 >= model.spherical_surface_arena.items.len() {
28519                return Err(AuthorError::DanglingRef {
28520                    entity: "SPHERICAL_SURFACE",
28521                });
28522            }
28523        }
28524        GeometricSetSelectRef::Surface(i) => {
28525            if i.0 >= model.surface_arena.items.len() {
28526                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
28527            }
28528        }
28529        GeometricSetSelectRef::SurfaceCurve(i) => {
28530            if i.0 >= model.surface_curve_arena.items.len() {
28531                return Err(AuthorError::DanglingRef {
28532                    entity: "SURFACE_CURVE",
28533                });
28534            }
28535        }
28536        GeometricSetSelectRef::SurfaceOfLinearExtrusion(i) => {
28537            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
28538                return Err(AuthorError::DanglingRef {
28539                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
28540                });
28541            }
28542        }
28543        GeometricSetSelectRef::SurfaceOfRevolution(i) => {
28544            if i.0 >= model.surface_of_revolution_arena.items.len() {
28545                return Err(AuthorError::DanglingRef {
28546                    entity: "SURFACE_OF_REVOLUTION",
28547                });
28548            }
28549        }
28550        GeometricSetSelectRef::SweptSurface(i) => {
28551            if i.0 >= model.swept_surface_arena.items.len() {
28552                return Err(AuthorError::DanglingRef {
28553                    entity: "SWEPT_SURFACE",
28554                });
28555            }
28556        }
28557        GeometricSetSelectRef::ToroidalSurface(i) => {
28558            if i.0 >= model.toroidal_surface_arena.items.len() {
28559                return Err(AuthorError::DanglingRef {
28560                    entity: "TOROIDAL_SURFACE",
28561                });
28562            }
28563        }
28564        GeometricSetSelectRef::TrimmedCurve(i) => {
28565            if i.0 >= model.trimmed_curve_arena.items.len() {
28566                return Err(AuthorError::DanglingRef {
28567                    entity: "TRIMMED_CURVE",
28568                });
28569            }
28570        }
28571        GeometricSetSelectRef::UniformCurve(i) => {
28572            if i.0 >= model.uniform_curve_arena.items.len() {
28573                return Err(AuthorError::DanglingRef {
28574                    entity: "UNIFORM_CURVE",
28575                });
28576            }
28577        }
28578        GeometricSetSelectRef::UniformSurface(i) => {
28579            if i.0 >= model.uniform_surface_arena.items.len() {
28580                return Err(AuthorError::DanglingRef {
28581                    entity: "UNIFORM_SURFACE",
28582                });
28583            }
28584        }
28585        GeometricSetSelectRef::Complex(i) => {
28586            if i.0 >= model.complex_unit_arena.items.len() {
28587                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
28588            }
28589        }
28590    }
28591    Ok(())
28592}
28593fn check_geometric_tolerance_ref(
28594    model: &StepModel,
28595    r: &GeometricToleranceRef,
28596) -> Result<(), AuthorError> {
28597    match r {
28598        GeometricToleranceRef::AngularityTolerance(i) => {
28599            if i.0 >= model.angularity_tolerance_arena.items.len() {
28600                return Err(AuthorError::DanglingRef {
28601                    entity: "ANGULARITY_TOLERANCE",
28602                });
28603            }
28604        }
28605        GeometricToleranceRef::CircularRunoutTolerance(i) => {
28606            if i.0 >= model.circular_runout_tolerance_arena.items.len() {
28607                return Err(AuthorError::DanglingRef {
28608                    entity: "CIRCULAR_RUNOUT_TOLERANCE",
28609                });
28610            }
28611        }
28612        GeometricToleranceRef::CoaxialityTolerance(i) => {
28613            if i.0 >= model.coaxiality_tolerance_arena.items.len() {
28614                return Err(AuthorError::DanglingRef {
28615                    entity: "COAXIALITY_TOLERANCE",
28616                });
28617            }
28618        }
28619        GeometricToleranceRef::ConcentricityTolerance(i) => {
28620            if i.0 >= model.concentricity_tolerance_arena.items.len() {
28621                return Err(AuthorError::DanglingRef {
28622                    entity: "CONCENTRICITY_TOLERANCE",
28623                });
28624            }
28625        }
28626        GeometricToleranceRef::CylindricityTolerance(i) => {
28627            if i.0 >= model.cylindricity_tolerance_arena.items.len() {
28628                return Err(AuthorError::DanglingRef {
28629                    entity: "CYLINDRICITY_TOLERANCE",
28630                });
28631            }
28632        }
28633        GeometricToleranceRef::FlatnessTolerance(i) => {
28634            if i.0 >= model.flatness_tolerance_arena.items.len() {
28635                return Err(AuthorError::DanglingRef {
28636                    entity: "FLATNESS_TOLERANCE",
28637                });
28638            }
28639        }
28640        GeometricToleranceRef::GeometricTolerance(i) => {
28641            if i.0 >= model.geometric_tolerance_arena.items.len() {
28642                return Err(AuthorError::DanglingRef {
28643                    entity: "GEOMETRIC_TOLERANCE",
28644                });
28645            }
28646        }
28647        GeometricToleranceRef::GeometricToleranceWithDatumReference(i) => {
28648            if i.0
28649                >= model
28650                    .geometric_tolerance_with_datum_reference_arena
28651                    .items
28652                    .len()
28653            {
28654                return Err(AuthorError::DanglingRef {
28655                    entity: "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
28656                });
28657            }
28658        }
28659        GeometricToleranceRef::GeometricToleranceWithDefinedAreaUnit(i) => {
28660            if i.0
28661                >= model
28662                    .geometric_tolerance_with_defined_area_unit_arena
28663                    .items
28664                    .len()
28665            {
28666                return Err(AuthorError::DanglingRef {
28667                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_AREA_UNIT",
28668                });
28669            }
28670        }
28671        GeometricToleranceRef::GeometricToleranceWithDefinedUnit(i) => {
28672            if i.0
28673                >= model
28674                    .geometric_tolerance_with_defined_unit_arena
28675                    .items
28676                    .len()
28677            {
28678                return Err(AuthorError::DanglingRef {
28679                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_UNIT",
28680                });
28681            }
28682        }
28683        GeometricToleranceRef::GeometricToleranceWithMaximumTolerance(i) => {
28684            if i.0
28685                >= model
28686                    .geometric_tolerance_with_maximum_tolerance_arena
28687                    .items
28688                    .len()
28689            {
28690                return Err(AuthorError::DanglingRef {
28691                    entity: "GEOMETRIC_TOLERANCE_WITH_MAXIMUM_TOLERANCE",
28692                });
28693            }
28694        }
28695        GeometricToleranceRef::GeometricToleranceWithModifiers(i) => {
28696            if i.0 >= model.geometric_tolerance_with_modifiers_arena.items.len() {
28697                return Err(AuthorError::DanglingRef {
28698                    entity: "GEOMETRIC_TOLERANCE_WITH_MODIFIERS",
28699                });
28700            }
28701        }
28702        GeometricToleranceRef::LineProfileTolerance(i) => {
28703            if i.0 >= model.line_profile_tolerance_arena.items.len() {
28704                return Err(AuthorError::DanglingRef {
28705                    entity: "LINE_PROFILE_TOLERANCE",
28706                });
28707            }
28708        }
28709        GeometricToleranceRef::ModifiedGeometricTolerance(i) => {
28710            if i.0 >= model.modified_geometric_tolerance_arena.items.len() {
28711                return Err(AuthorError::DanglingRef {
28712                    entity: "MODIFIED_GEOMETRIC_TOLERANCE",
28713                });
28714            }
28715        }
28716        GeometricToleranceRef::ParallelismTolerance(i) => {
28717            if i.0 >= model.parallelism_tolerance_arena.items.len() {
28718                return Err(AuthorError::DanglingRef {
28719                    entity: "PARALLELISM_TOLERANCE",
28720                });
28721            }
28722        }
28723        GeometricToleranceRef::PerpendicularityTolerance(i) => {
28724            if i.0 >= model.perpendicularity_tolerance_arena.items.len() {
28725                return Err(AuthorError::DanglingRef {
28726                    entity: "PERPENDICULARITY_TOLERANCE",
28727                });
28728            }
28729        }
28730        GeometricToleranceRef::PositionTolerance(i) => {
28731            if i.0 >= model.position_tolerance_arena.items.len() {
28732                return Err(AuthorError::DanglingRef {
28733                    entity: "POSITION_TOLERANCE",
28734                });
28735            }
28736        }
28737        GeometricToleranceRef::RoundnessTolerance(i) => {
28738            if i.0 >= model.roundness_tolerance_arena.items.len() {
28739                return Err(AuthorError::DanglingRef {
28740                    entity: "ROUNDNESS_TOLERANCE",
28741                });
28742            }
28743        }
28744        GeometricToleranceRef::StraightnessTolerance(i) => {
28745            if i.0 >= model.straightness_tolerance_arena.items.len() {
28746                return Err(AuthorError::DanglingRef {
28747                    entity: "STRAIGHTNESS_TOLERANCE",
28748                });
28749            }
28750        }
28751        GeometricToleranceRef::SurfaceProfileTolerance(i) => {
28752            if i.0 >= model.surface_profile_tolerance_arena.items.len() {
28753                return Err(AuthorError::DanglingRef {
28754                    entity: "SURFACE_PROFILE_TOLERANCE",
28755                });
28756            }
28757        }
28758        GeometricToleranceRef::SymmetryTolerance(i) => {
28759            if i.0 >= model.symmetry_tolerance_arena.items.len() {
28760                return Err(AuthorError::DanglingRef {
28761                    entity: "SYMMETRY_TOLERANCE",
28762                });
28763            }
28764        }
28765        GeometricToleranceRef::TotalRunoutTolerance(i) => {
28766            if i.0 >= model.total_runout_tolerance_arena.items.len() {
28767                return Err(AuthorError::DanglingRef {
28768                    entity: "TOTAL_RUNOUT_TOLERANCE",
28769                });
28770            }
28771        }
28772        GeometricToleranceRef::UnequallyDisposedGeometricTolerance(i) => {
28773            if i.0
28774                >= model
28775                    .unequally_disposed_geometric_tolerance_arena
28776                    .items
28777                    .len()
28778            {
28779                return Err(AuthorError::DanglingRef {
28780                    entity: "UNEQUALLY_DISPOSED_GEOMETRIC_TOLERANCE",
28781                });
28782            }
28783        }
28784        GeometricToleranceRef::Complex(i) => {
28785            if i.0 >= model.complex_unit_arena.items.len() {
28786                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
28787            }
28788        }
28789    }
28790    Ok(())
28791}
28792fn check_geometric_tolerance_target_ref(
28793    model: &StepModel,
28794    r: &GeometricToleranceTargetRef,
28795) -> Result<(), AuthorError> {
28796    match r {
28797        GeometricToleranceTargetRef::AllAroundShapeAspect(i) => {
28798            if i.0 >= model.all_around_shape_aspect_arena.items.len() {
28799                return Err(AuthorError::DanglingRef {
28800                    entity: "ALL_AROUND_SHAPE_ASPECT",
28801                });
28802            }
28803        }
28804        GeometricToleranceTargetRef::AngularLocation(i) => {
28805            if i.0 >= model.angular_location_arena.items.len() {
28806                return Err(AuthorError::DanglingRef {
28807                    entity: "ANGULAR_LOCATION",
28808                });
28809            }
28810        }
28811        GeometricToleranceTargetRef::AngularSize(i) => {
28812            if i.0 >= model.angular_size_arena.items.len() {
28813                return Err(AuthorError::DanglingRef {
28814                    entity: "ANGULAR_SIZE",
28815                });
28816            }
28817        }
28818        GeometricToleranceTargetRef::CentreOfSymmetry(i) => {
28819            if i.0 >= model.centre_of_symmetry_arena.items.len() {
28820                return Err(AuthorError::DanglingRef {
28821                    entity: "CENTRE_OF_SYMMETRY",
28822                });
28823            }
28824        }
28825        GeometricToleranceTargetRef::CommonDatum(i) => {
28826            if i.0 >= model.common_datum_arena.items.len() {
28827                return Err(AuthorError::DanglingRef {
28828                    entity: "COMMON_DATUM",
28829                });
28830            }
28831        }
28832        GeometricToleranceTargetRef::CompositeGroupShapeAspect(i) => {
28833            if i.0 >= model.composite_group_shape_aspect_arena.items.len() {
28834                return Err(AuthorError::DanglingRef {
28835                    entity: "COMPOSITE_GROUP_SHAPE_ASPECT",
28836                });
28837            }
28838        }
28839        GeometricToleranceTargetRef::CompositeShapeAspect(i) => {
28840            if i.0 >= model.composite_shape_aspect_arena.items.len() {
28841                return Err(AuthorError::DanglingRef {
28842                    entity: "COMPOSITE_SHAPE_ASPECT",
28843                });
28844            }
28845        }
28846        GeometricToleranceTargetRef::ContinuousShapeAspect(i) => {
28847            if i.0 >= model.continuous_shape_aspect_arena.items.len() {
28848                return Err(AuthorError::DanglingRef {
28849                    entity: "CONTINUOUS_SHAPE_ASPECT",
28850                });
28851            }
28852        }
28853        GeometricToleranceTargetRef::Datum(i) => {
28854            if i.0 >= model.datum_arena.items.len() {
28855                return Err(AuthorError::DanglingRef { entity: "DATUM" });
28856            }
28857        }
28858        GeometricToleranceTargetRef::DatumFeature(i) => {
28859            if i.0 >= model.datum_feature_arena.items.len() {
28860                return Err(AuthorError::DanglingRef {
28861                    entity: "DATUM_FEATURE",
28862                });
28863            }
28864        }
28865        GeometricToleranceTargetRef::DatumReferenceCompartment(i) => {
28866            if i.0 >= model.datum_reference_compartment_arena.items.len() {
28867                return Err(AuthorError::DanglingRef {
28868                    entity: "DATUM_REFERENCE_COMPARTMENT",
28869                });
28870            }
28871        }
28872        GeometricToleranceTargetRef::DatumReferenceElement(i) => {
28873            if i.0 >= model.datum_reference_element_arena.items.len() {
28874                return Err(AuthorError::DanglingRef {
28875                    entity: "DATUM_REFERENCE_ELEMENT",
28876                });
28877            }
28878        }
28879        GeometricToleranceTargetRef::DatumSystem(i) => {
28880            if i.0 >= model.datum_system_arena.items.len() {
28881                return Err(AuthorError::DanglingRef {
28882                    entity: "DATUM_SYSTEM",
28883                });
28884            }
28885        }
28886        GeometricToleranceTargetRef::DatumTarget(i) => {
28887            if i.0 >= model.datum_target_arena.items.len() {
28888                return Err(AuthorError::DanglingRef {
28889                    entity: "DATUM_TARGET",
28890                });
28891            }
28892        }
28893        GeometricToleranceTargetRef::DefaultModelGeometricView(i) => {
28894            if i.0 >= model.default_model_geometric_view_arena.items.len() {
28895                return Err(AuthorError::DanglingRef {
28896                    entity: "DEFAULT_MODEL_GEOMETRIC_VIEW",
28897                });
28898            }
28899        }
28900        GeometricToleranceTargetRef::DerivedShapeAspect(i) => {
28901            if i.0 >= model.derived_shape_aspect_arena.items.len() {
28902                return Err(AuthorError::DanglingRef {
28903                    entity: "DERIVED_SHAPE_ASPECT",
28904                });
28905            }
28906        }
28907        GeometricToleranceTargetRef::DimensionalLocation(i) => {
28908            if i.0 >= model.dimensional_location_arena.items.len() {
28909                return Err(AuthorError::DanglingRef {
28910                    entity: "DIMENSIONAL_LOCATION",
28911                });
28912            }
28913        }
28914        GeometricToleranceTargetRef::DimensionalLocationWithPath(i) => {
28915            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
28916                return Err(AuthorError::DanglingRef {
28917                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
28918                });
28919            }
28920        }
28921        GeometricToleranceTargetRef::DimensionalSize(i) => {
28922            if i.0 >= model.dimensional_size_arena.items.len() {
28923                return Err(AuthorError::DanglingRef {
28924                    entity: "DIMENSIONAL_SIZE",
28925                });
28926            }
28927        }
28928        GeometricToleranceTargetRef::DimensionalSizeWithDatumFeature(i) => {
28929            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
28930                return Err(AuthorError::DanglingRef {
28931                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
28932                });
28933            }
28934        }
28935        GeometricToleranceTargetRef::DimensionalSizeWithPath(i) => {
28936            if i.0 >= model.dimensional_size_with_path_arena.items.len() {
28937                return Err(AuthorError::DanglingRef {
28938                    entity: "DIMENSIONAL_SIZE_WITH_PATH",
28939                });
28940            }
28941        }
28942        GeometricToleranceTargetRef::DirectedDimensionalLocation(i) => {
28943            if i.0 >= model.directed_dimensional_location_arena.items.len() {
28944                return Err(AuthorError::DanglingRef {
28945                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
28946                });
28947            }
28948        }
28949        GeometricToleranceTargetRef::GeneralDatumReference(i) => {
28950            if i.0 >= model.general_datum_reference_arena.items.len() {
28951                return Err(AuthorError::DanglingRef {
28952                    entity: "GENERAL_DATUM_REFERENCE",
28953                });
28954            }
28955        }
28956        GeometricToleranceTargetRef::PlacedDatumTargetFeature(i) => {
28957            if i.0 >= model.placed_datum_target_feature_arena.items.len() {
28958                return Err(AuthorError::DanglingRef {
28959                    entity: "PLACED_DATUM_TARGET_FEATURE",
28960                });
28961            }
28962        }
28963        GeometricToleranceTargetRef::ProductDefinitionShape(i) => {
28964            if i.0 >= model.product_definition_shape_arena.items.len() {
28965                return Err(AuthorError::DanglingRef {
28966                    entity: "PRODUCT_DEFINITION_SHAPE",
28967                });
28968            }
28969        }
28970        GeometricToleranceTargetRef::ShapeAspect(i) => {
28971            if i.0 >= model.shape_aspect_arena.items.len() {
28972                return Err(AuthorError::DanglingRef {
28973                    entity: "SHAPE_ASPECT",
28974                });
28975            }
28976        }
28977        GeometricToleranceTargetRef::ToleranceZone(i) => {
28978            if i.0 >= model.tolerance_zone_arena.items.len() {
28979                return Err(AuthorError::DanglingRef {
28980                    entity: "TOLERANCE_ZONE",
28981                });
28982            }
28983        }
28984        GeometricToleranceTargetRef::ToleranceZoneWithDatum(i) => {
28985            if i.0 >= model.tolerance_zone_with_datum_arena.items.len() {
28986                return Err(AuthorError::DanglingRef {
28987                    entity: "TOLERANCE_ZONE_WITH_DATUM",
28988                });
28989            }
28990        }
28991        GeometricToleranceTargetRef::Complex(i) => {
28992            if i.0 >= model.complex_unit_arena.items.len() {
28993                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
28994            }
28995        }
28996    }
28997    Ok(())
28998}
28999fn check_group_ref(model: &StepModel, r: &GroupRef) -> Result<(), AuthorError> {
29000    match r {
29001        GroupRef::Group(i) => {
29002            if i.0 >= model.group_arena.items.len() {
29003                return Err(AuthorError::DanglingRef { entity: "GROUP" });
29004            }
29005        }
29006        GroupRef::ProductConceptFeatureCategory(i) => {
29007            if i.0 >= model.product_concept_feature_category_arena.items.len() {
29008                return Err(AuthorError::DanglingRef {
29009                    entity: "PRODUCT_CONCEPT_FEATURE_CATEGORY",
29010                });
29011            }
29012        }
29013        GroupRef::Complex(i) => {
29014            if i.0 >= model.complex_unit_arena.items.len() {
29015                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
29016            }
29017        }
29018    }
29019    Ok(())
29020}
29021fn check_groupable_item_ref(model: &StepModel, r: &GroupableItemRef) -> Result<(), AuthorError> {
29022    match r {
29023        GroupableItemRef::ActionMethod(i) => {
29024            if i.0 >= model.action_method_arena.items.len() {
29025                return Err(AuthorError::DanglingRef {
29026                    entity: "ACTION_METHOD",
29027                });
29028            }
29029        }
29030        GroupableItemRef::Address(i) => {
29031            if i.0 >= model.address_arena.items.len() {
29032                return Err(AuthorError::DanglingRef { entity: "ADDRESS" });
29033            }
29034        }
29035        GroupableItemRef::AdvancedBrepShapeRepresentation(i) => {
29036            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
29037                return Err(AuthorError::DanglingRef {
29038                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
29039                });
29040            }
29041        }
29042        GroupableItemRef::AdvancedFace(i) => {
29043            if i.0 >= model.advanced_face_arena.items.len() {
29044                return Err(AuthorError::DanglingRef {
29045                    entity: "ADVANCED_FACE",
29046                });
29047            }
29048        }
29049        GroupableItemRef::AllAroundShapeAspect(i) => {
29050            if i.0 >= model.all_around_shape_aspect_arena.items.len() {
29051                return Err(AuthorError::DanglingRef {
29052                    entity: "ALL_AROUND_SHAPE_ASPECT",
29053                });
29054            }
29055        }
29056        GroupableItemRef::AngularLocation(i) => {
29057            if i.0 >= model.angular_location_arena.items.len() {
29058                return Err(AuthorError::DanglingRef {
29059                    entity: "ANGULAR_LOCATION",
29060                });
29061            }
29062        }
29063        GroupableItemRef::AnnotationCurveOccurrence(i) => {
29064            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
29065                return Err(AuthorError::DanglingRef {
29066                    entity: "ANNOTATION_CURVE_OCCURRENCE",
29067                });
29068            }
29069        }
29070        GroupableItemRef::AnnotationFillAreaOccurrence(i) => {
29071            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
29072                return Err(AuthorError::DanglingRef {
29073                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
29074                });
29075            }
29076        }
29077        GroupableItemRef::AnnotationOccurrence(i) => {
29078            if i.0 >= model.annotation_occurrence_arena.items.len() {
29079                return Err(AuthorError::DanglingRef {
29080                    entity: "ANNOTATION_OCCURRENCE",
29081                });
29082            }
29083        }
29084        GroupableItemRef::AnnotationPlaceholderLeaderLine(_) => {
29085            return Err(AuthorError::NotAp242 {
29086                entity: "ANNOTATION_PLACEHOLDER_LEADER_LINE",
29087            });
29088        }
29089        GroupableItemRef::AnnotationPlaceholderOccurrence(i) => {
29090            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
29091                return Err(AuthorError::DanglingRef {
29092                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
29093                });
29094            }
29095        }
29096        GroupableItemRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
29097            return Err(AuthorError::NotAp242 {
29098                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
29099            });
29100        }
29101        GroupableItemRef::AnnotationPlane(i) => {
29102            if i.0 >= model.annotation_plane_arena.items.len() {
29103                return Err(AuthorError::DanglingRef {
29104                    entity: "ANNOTATION_PLANE",
29105                });
29106            }
29107        }
29108        GroupableItemRef::AnnotationSymbol(i) => {
29109            if i.0 >= model.annotation_symbol_arena.items.len() {
29110                return Err(AuthorError::DanglingRef {
29111                    entity: "ANNOTATION_SYMBOL",
29112                });
29113            }
29114        }
29115        GroupableItemRef::AnnotationSymbolOccurrence(i) => {
29116            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
29117                return Err(AuthorError::DanglingRef {
29118                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
29119                });
29120            }
29121        }
29122        GroupableItemRef::AnnotationText(i) => {
29123            if i.0 >= model.annotation_text_arena.items.len() {
29124                return Err(AuthorError::DanglingRef {
29125                    entity: "ANNOTATION_TEXT",
29126                });
29127            }
29128        }
29129        GroupableItemRef::AnnotationTextCharacter(i) => {
29130            if i.0 >= model.annotation_text_character_arena.items.len() {
29131                return Err(AuthorError::DanglingRef {
29132                    entity: "ANNOTATION_TEXT_CHARACTER",
29133                });
29134            }
29135        }
29136        GroupableItemRef::AnnotationTextOccurrence(i) => {
29137            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
29138                return Err(AuthorError::DanglingRef {
29139                    entity: "ANNOTATION_TEXT_OCCURRENCE",
29140                });
29141            }
29142        }
29143        GroupableItemRef::AnnotationToAnnotationLeaderLine(_) => {
29144            return Err(AuthorError::NotAp242 {
29145                entity: "ANNOTATION_TO_ANNOTATION_LEADER_LINE",
29146            });
29147        }
29148        GroupableItemRef::AnnotationToModelLeaderLine(_) => {
29149            return Err(AuthorError::NotAp242 {
29150                entity: "ANNOTATION_TO_MODEL_LEADER_LINE",
29151            });
29152        }
29153        GroupableItemRef::ApllPoint(_) => {
29154            return Err(AuthorError::NotAp242 {
29155                entity: "APLL_POINT",
29156            });
29157        }
29158        GroupableItemRef::ApllPointWithSurface(_) => {
29159            return Err(AuthorError::NotAp242 {
29160                entity: "APLL_POINT_WITH_SURFACE",
29161            });
29162        }
29163        GroupableItemRef::AppliedDateAndTimeAssignment(i) => {
29164            if i.0 >= model.applied_date_and_time_assignment_arena.items.len() {
29165                return Err(AuthorError::DanglingRef {
29166                    entity: "APPLIED_DATE_AND_TIME_ASSIGNMENT",
29167                });
29168            }
29169        }
29170        GroupableItemRef::AppliedGroupAssignment(i) => {
29171            if i.0 >= model.applied_group_assignment_arena.items.len() {
29172                return Err(AuthorError::DanglingRef {
29173                    entity: "APPLIED_GROUP_ASSIGNMENT",
29174                });
29175            }
29176        }
29177        GroupableItemRef::Approval(i) => {
29178            if i.0 >= model.approval_arena.items.len() {
29179                return Err(AuthorError::DanglingRef { entity: "APPROVAL" });
29180            }
29181        }
29182        GroupableItemRef::ApprovalPersonOrganization(i) => {
29183            if i.0 >= model.approval_person_organization_arena.items.len() {
29184                return Err(AuthorError::DanglingRef {
29185                    entity: "APPROVAL_PERSON_ORGANIZATION",
29186                });
29187            }
29188        }
29189        GroupableItemRef::ApprovalStatus(i) => {
29190            if i.0 >= model.approval_status_arena.items.len() {
29191                return Err(AuthorError::DanglingRef {
29192                    entity: "APPROVAL_STATUS",
29193                });
29194            }
29195        }
29196        GroupableItemRef::AreaUnit(i) => {
29197            if i.0 >= model.area_unit_arena.items.len() {
29198                return Err(AuthorError::DanglingRef {
29199                    entity: "AREA_UNIT",
29200                });
29201            }
29202        }
29203        GroupableItemRef::AscribableState(i) => {
29204            if i.0 >= model.ascribable_state_arena.items.len() {
29205                return Err(AuthorError::DanglingRef {
29206                    entity: "ASCRIBABLE_STATE",
29207                });
29208            }
29209        }
29210        GroupableItemRef::AscribableStateRelationship(i) => {
29211            if i.0 >= model.ascribable_state_relationship_arena.items.len() {
29212                return Err(AuthorError::DanglingRef {
29213                    entity: "ASCRIBABLE_STATE_RELATIONSHIP",
29214                });
29215            }
29216        }
29217        GroupableItemRef::AssemblyComponentUsage(i) => {
29218            if i.0 >= model.assembly_component_usage_arena.items.len() {
29219                return Err(AuthorError::DanglingRef {
29220                    entity: "ASSEMBLY_COMPONENT_USAGE",
29221                });
29222            }
29223        }
29224        GroupableItemRef::AuxiliaryLeaderLine(_) => {
29225            return Err(AuthorError::NotAp242 {
29226                entity: "AUXILIARY_LEADER_LINE",
29227            });
29228        }
29229        GroupableItemRef::Axis1Placement(i) => {
29230            if i.0 >= model.axis1_placement_arena.items.len() {
29231                return Err(AuthorError::DanglingRef {
29232                    entity: "AXIS1_PLACEMENT",
29233                });
29234            }
29235        }
29236        GroupableItemRef::Axis2Placement2d(i) => {
29237            if i.0 >= model.axis2_placement2d_arena.items.len() {
29238                return Err(AuthorError::DanglingRef {
29239                    entity: "AXIS2_PLACEMENT_2D",
29240                });
29241            }
29242        }
29243        GroupableItemRef::Axis2Placement3d(i) => {
29244            if i.0 >= model.axis2_placement3d_arena.items.len() {
29245                return Err(AuthorError::DanglingRef {
29246                    entity: "AXIS2_PLACEMENT_3D",
29247                });
29248            }
29249        }
29250        GroupableItemRef::BSplineCurve(i) => {
29251            if i.0 >= model.b_spline_curve_arena.items.len() {
29252                return Err(AuthorError::DanglingRef {
29253                    entity: "B_SPLINE_CURVE",
29254                });
29255            }
29256        }
29257        GroupableItemRef::BSplineCurveWithKnots(i) => {
29258            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
29259                return Err(AuthorError::DanglingRef {
29260                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
29261                });
29262            }
29263        }
29264        GroupableItemRef::BSplineSurface(i) => {
29265            if i.0 >= model.b_spline_surface_arena.items.len() {
29266                return Err(AuthorError::DanglingRef {
29267                    entity: "B_SPLINE_SURFACE",
29268                });
29269            }
29270        }
29271        GroupableItemRef::BSplineSurfaceWithKnots(i) => {
29272            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
29273                return Err(AuthorError::DanglingRef {
29274                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
29275                });
29276            }
29277        }
29278        GroupableItemRef::BezierCurve(i) => {
29279            if i.0 >= model.bezier_curve_arena.items.len() {
29280                return Err(AuthorError::DanglingRef {
29281                    entity: "BEZIER_CURVE",
29282                });
29283            }
29284        }
29285        GroupableItemRef::BezierSurface(i) => {
29286            if i.0 >= model.bezier_surface_arena.items.len() {
29287                return Err(AuthorError::DanglingRef {
29288                    entity: "BEZIER_SURFACE",
29289                });
29290            }
29291        }
29292        GroupableItemRef::BoundedCurve(i) => {
29293            if i.0 >= model.bounded_curve_arena.items.len() {
29294                return Err(AuthorError::DanglingRef {
29295                    entity: "BOUNDED_CURVE",
29296                });
29297            }
29298        }
29299        GroupableItemRef::BoundedPcurve(i) => {
29300            if i.0 >= model.bounded_pcurve_arena.items.len() {
29301                return Err(AuthorError::DanglingRef {
29302                    entity: "BOUNDED_PCURVE",
29303                });
29304            }
29305        }
29306        GroupableItemRef::BoundedSurface(i) => {
29307            if i.0 >= model.bounded_surface_arena.items.len() {
29308                return Err(AuthorError::DanglingRef {
29309                    entity: "BOUNDED_SURFACE",
29310                });
29311            }
29312        }
29313        GroupableItemRef::BoundedSurfaceCurve(i) => {
29314            if i.0 >= model.bounded_surface_curve_arena.items.len() {
29315                return Err(AuthorError::DanglingRef {
29316                    entity: "BOUNDED_SURFACE_CURVE",
29317                });
29318            }
29319        }
29320        GroupableItemRef::BrepWithVoids(i) => {
29321            if i.0 >= model.brep_with_voids_arena.items.len() {
29322                return Err(AuthorError::DanglingRef {
29323                    entity: "BREP_WITH_VOIDS",
29324                });
29325            }
29326        }
29327        GroupableItemRef::CalendarDate(i) => {
29328            if i.0 >= model.calendar_date_arena.items.len() {
29329                return Err(AuthorError::DanglingRef {
29330                    entity: "CALENDAR_DATE",
29331                });
29332            }
29333        }
29334        GroupableItemRef::CameraImage(i) => {
29335            if i.0 >= model.camera_image_arena.items.len() {
29336                return Err(AuthorError::DanglingRef {
29337                    entity: "CAMERA_IMAGE",
29338                });
29339            }
29340        }
29341        GroupableItemRef::CameraImage3dWithScale(i) => {
29342            if i.0 >= model.camera_image3d_with_scale_arena.items.len() {
29343                return Err(AuthorError::DanglingRef {
29344                    entity: "CAMERA_IMAGE_3D_WITH_SCALE",
29345                });
29346            }
29347        }
29348        GroupableItemRef::CameraModel(i) => {
29349            if i.0 >= model.camera_model_arena.items.len() {
29350                return Err(AuthorError::DanglingRef {
29351                    entity: "CAMERA_MODEL",
29352                });
29353            }
29354        }
29355        GroupableItemRef::CameraModelD3(i) => {
29356            if i.0 >= model.camera_model_d3_arena.items.len() {
29357                return Err(AuthorError::DanglingRef {
29358                    entity: "CAMERA_MODEL_D3",
29359                });
29360            }
29361        }
29362        GroupableItemRef::CameraModelD3MultiClipping(i) => {
29363            if i.0 >= model.camera_model_d3_multi_clipping_arena.items.len() {
29364                return Err(AuthorError::DanglingRef {
29365                    entity: "CAMERA_MODEL_D3_MULTI_CLIPPING",
29366                });
29367            }
29368        }
29369        GroupableItemRef::CameraModelD3WithHlhsr(i) => {
29370            if i.0 >= model.camera_model_d3_with_hlhsr_arena.items.len() {
29371                return Err(AuthorError::DanglingRef {
29372                    entity: "CAMERA_MODEL_D3_WITH_HLHSR",
29373                });
29374            }
29375        }
29376        GroupableItemRef::CartesianPoint(i) => {
29377            if i.0 >= model.cartesian_point_arena.items.len() {
29378                return Err(AuthorError::DanglingRef {
29379                    entity: "CARTESIAN_POINT",
29380                });
29381            }
29382        }
29383        GroupableItemRef::CcDesignDateAndTimeAssignment(i) => {
29384            if i.0 >= model.cc_design_date_and_time_assignment_arena.items.len() {
29385                return Err(AuthorError::DanglingRef {
29386                    entity: "CC_DESIGN_DATE_AND_TIME_ASSIGNMENT",
29387                });
29388            }
29389        }
29390        GroupableItemRef::CentreOfSymmetry(i) => {
29391            if i.0 >= model.centre_of_symmetry_arena.items.len() {
29392                return Err(AuthorError::DanglingRef {
29393                    entity: "CENTRE_OF_SYMMETRY",
29394                });
29395            }
29396        }
29397        GroupableItemRef::Certification(i) => {
29398            if i.0 >= model.certification_arena.items.len() {
29399                return Err(AuthorError::DanglingRef {
29400                    entity: "CERTIFICATION",
29401                });
29402            }
29403        }
29404        GroupableItemRef::CharacterizedRepresentation(i) => {
29405            if i.0 >= model.characterized_representation_arena.items.len() {
29406                return Err(AuthorError::DanglingRef {
29407                    entity: "CHARACTERIZED_REPRESENTATION",
29408                });
29409            }
29410        }
29411        GroupableItemRef::Circle(i) => {
29412            if i.0 >= model.circle_arena.items.len() {
29413                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
29414            }
29415        }
29416        GroupableItemRef::ClosedShell(i) => {
29417            if i.0 >= model.closed_shell_arena.items.len() {
29418                return Err(AuthorError::DanglingRef {
29419                    entity: "CLOSED_SHELL",
29420                });
29421            }
29422        }
29423        GroupableItemRef::CommonDatum(i) => {
29424            if i.0 >= model.common_datum_arena.items.len() {
29425                return Err(AuthorError::DanglingRef {
29426                    entity: "COMMON_DATUM",
29427                });
29428            }
29429        }
29430        GroupableItemRef::ComplexTriangulatedFace(i) => {
29431            if i.0 >= model.complex_triangulated_face_arena.items.len() {
29432                return Err(AuthorError::DanglingRef {
29433                    entity: "COMPLEX_TRIANGULATED_FACE",
29434                });
29435            }
29436        }
29437        GroupableItemRef::ComplexTriangulatedSurfaceSet(i) => {
29438            if i.0 >= model.complex_triangulated_surface_set_arena.items.len() {
29439                return Err(AuthorError::DanglingRef {
29440                    entity: "COMPLEX_TRIANGULATED_SURFACE_SET",
29441                });
29442            }
29443        }
29444        GroupableItemRef::CompositeCurve(i) => {
29445            if i.0 >= model.composite_curve_arena.items.len() {
29446                return Err(AuthorError::DanglingRef {
29447                    entity: "COMPOSITE_CURVE",
29448                });
29449            }
29450        }
29451        GroupableItemRef::CompositeGroupShapeAspect(i) => {
29452            if i.0 >= model.composite_group_shape_aspect_arena.items.len() {
29453                return Err(AuthorError::DanglingRef {
29454                    entity: "COMPOSITE_GROUP_SHAPE_ASPECT",
29455                });
29456            }
29457        }
29458        GroupableItemRef::CompositeShapeAspect(i) => {
29459            if i.0 >= model.composite_shape_aspect_arena.items.len() {
29460                return Err(AuthorError::DanglingRef {
29461                    entity: "COMPOSITE_SHAPE_ASPECT",
29462                });
29463            }
29464        }
29465        GroupableItemRef::CompositeText(i) => {
29466            if i.0 >= model.composite_text_arena.items.len() {
29467                return Err(AuthorError::DanglingRef {
29468                    entity: "COMPOSITE_TEXT",
29469                });
29470            }
29471        }
29472        GroupableItemRef::CompoundRepresentationItem(i) => {
29473            if i.0 >= model.compound_representation_item_arena.items.len() {
29474                return Err(AuthorError::DanglingRef {
29475                    entity: "COMPOUND_REPRESENTATION_ITEM",
29476                });
29477            }
29478        }
29479        GroupableItemRef::ConfigurationDesign(i) => {
29480            if i.0 >= model.configuration_design_arena.items.len() {
29481                return Err(AuthorError::DanglingRef {
29482                    entity: "CONFIGURATION_DESIGN",
29483                });
29484            }
29485        }
29486        GroupableItemRef::ConfigurationEffectivity(i) => {
29487            if i.0 >= model.configuration_effectivity_arena.items.len() {
29488                return Err(AuthorError::DanglingRef {
29489                    entity: "CONFIGURATION_EFFECTIVITY",
29490                });
29491            }
29492        }
29493        GroupableItemRef::ConfigurationItem(i) => {
29494            if i.0 >= model.configuration_item_arena.items.len() {
29495                return Err(AuthorError::DanglingRef {
29496                    entity: "CONFIGURATION_ITEM",
29497                });
29498            }
29499        }
29500        GroupableItemRef::Conic(i) => {
29501            if i.0 >= model.conic_arena.items.len() {
29502                return Err(AuthorError::DanglingRef { entity: "CONIC" });
29503            }
29504        }
29505        GroupableItemRef::ConicalSurface(i) => {
29506            if i.0 >= model.conical_surface_arena.items.len() {
29507                return Err(AuthorError::DanglingRef {
29508                    entity: "CONICAL_SURFACE",
29509                });
29510            }
29511        }
29512        GroupableItemRef::ConnectedFaceSet(i) => {
29513            if i.0 >= model.connected_face_set_arena.items.len() {
29514                return Err(AuthorError::DanglingRef {
29515                    entity: "CONNECTED_FACE_SET",
29516                });
29517            }
29518        }
29519        GroupableItemRef::ConstructiveGeometryRepresentation(i) => {
29520            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
29521                return Err(AuthorError::DanglingRef {
29522                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
29523                });
29524            }
29525        }
29526        GroupableItemRef::ConstructiveGeometryRepresentationRelationship(i) => {
29527            if i.0
29528                >= model
29529                    .constructive_geometry_representation_relationship_arena
29530                    .items
29531                    .len()
29532            {
29533                return Err(AuthorError::DanglingRef {
29534                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP",
29535                });
29536            }
29537        }
29538        GroupableItemRef::ContextDependentOverRidingStyledItem(i) => {
29539            if i.0
29540                >= model
29541                    .context_dependent_over_riding_styled_item_arena
29542                    .items
29543                    .len()
29544            {
29545                return Err(AuthorError::DanglingRef {
29546                    entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
29547                });
29548            }
29549        }
29550        GroupableItemRef::ContextDependentShapeRepresentation(i) => {
29551            if i.0
29552                >= model
29553                    .context_dependent_shape_representation_arena
29554                    .items
29555                    .len()
29556            {
29557                return Err(AuthorError::DanglingRef {
29558                    entity: "CONTEXT_DEPENDENT_SHAPE_REPRESENTATION",
29559                });
29560            }
29561        }
29562        GroupableItemRef::ContextDependentUnit(i) => {
29563            if i.0 >= model.context_dependent_unit_arena.items.len() {
29564                return Err(AuthorError::DanglingRef {
29565                    entity: "CONTEXT_DEPENDENT_UNIT",
29566                });
29567            }
29568        }
29569        GroupableItemRef::ContinuousShapeAspect(i) => {
29570            if i.0 >= model.continuous_shape_aspect_arena.items.len() {
29571                return Err(AuthorError::DanglingRef {
29572                    entity: "CONTINUOUS_SHAPE_ASPECT",
29573                });
29574            }
29575        }
29576        GroupableItemRef::Contract(i) => {
29577            if i.0 >= model.contract_arena.items.len() {
29578                return Err(AuthorError::DanglingRef { entity: "CONTRACT" });
29579            }
29580        }
29581        GroupableItemRef::ConversionBasedUnit(i) => {
29582            if i.0 >= model.conversion_based_unit_arena.items.len() {
29583                return Err(AuthorError::DanglingRef {
29584                    entity: "CONVERSION_BASED_UNIT",
29585                });
29586            }
29587        }
29588        GroupableItemRef::CoordinatedUniversalTimeOffset(i) => {
29589            if i.0 >= model.coordinated_universal_time_offset_arena.items.len() {
29590                return Err(AuthorError::DanglingRef {
29591                    entity: "COORDINATED_UNIVERSAL_TIME_OFFSET",
29592                });
29593            }
29594        }
29595        GroupableItemRef::CoordinatesList(i) => {
29596            if i.0 >= model.coordinates_list_arena.items.len() {
29597                return Err(AuthorError::DanglingRef {
29598                    entity: "COORDINATES_LIST",
29599                });
29600            }
29601        }
29602        GroupableItemRef::Curve(i) => {
29603            if i.0 >= model.curve_arena.items.len() {
29604                return Err(AuthorError::DanglingRef { entity: "CURVE" });
29605            }
29606        }
29607        GroupableItemRef::CylindricalSurface(i) => {
29608            if i.0 >= model.cylindrical_surface_arena.items.len() {
29609                return Err(AuthorError::DanglingRef {
29610                    entity: "CYLINDRICAL_SURFACE",
29611                });
29612            }
29613        }
29614        GroupableItemRef::DateAndTime(i) => {
29615            if i.0 >= model.date_and_time_arena.items.len() {
29616                return Err(AuthorError::DanglingRef {
29617                    entity: "DATE_AND_TIME",
29618                });
29619            }
29620        }
29621        GroupableItemRef::DateAndTimeAssignment(i) => {
29622            if i.0 >= model.date_and_time_assignment_arena.items.len() {
29623                return Err(AuthorError::DanglingRef {
29624                    entity: "DATE_AND_TIME_ASSIGNMENT",
29625                });
29626            }
29627        }
29628        GroupableItemRef::Datum(i) => {
29629            if i.0 >= model.datum_arena.items.len() {
29630                return Err(AuthorError::DanglingRef { entity: "DATUM" });
29631            }
29632        }
29633        GroupableItemRef::DatumFeature(i) => {
29634            if i.0 >= model.datum_feature_arena.items.len() {
29635                return Err(AuthorError::DanglingRef {
29636                    entity: "DATUM_FEATURE",
29637                });
29638            }
29639        }
29640        GroupableItemRef::DatumReferenceCompartment(i) => {
29641            if i.0 >= model.datum_reference_compartment_arena.items.len() {
29642                return Err(AuthorError::DanglingRef {
29643                    entity: "DATUM_REFERENCE_COMPARTMENT",
29644                });
29645            }
29646        }
29647        GroupableItemRef::DatumReferenceElement(i) => {
29648            if i.0 >= model.datum_reference_element_arena.items.len() {
29649                return Err(AuthorError::DanglingRef {
29650                    entity: "DATUM_REFERENCE_ELEMENT",
29651                });
29652            }
29653        }
29654        GroupableItemRef::DatumSystem(i) => {
29655            if i.0 >= model.datum_system_arena.items.len() {
29656                return Err(AuthorError::DanglingRef {
29657                    entity: "DATUM_SYSTEM",
29658                });
29659            }
29660        }
29661        GroupableItemRef::DatumTarget(i) => {
29662            if i.0 >= model.datum_target_arena.items.len() {
29663                return Err(AuthorError::DanglingRef {
29664                    entity: "DATUM_TARGET",
29665                });
29666            }
29667        }
29668        GroupableItemRef::DefaultModelGeometricView(i) => {
29669            if i.0 >= model.default_model_geometric_view_arena.items.len() {
29670                return Err(AuthorError::DanglingRef {
29671                    entity: "DEFAULT_MODEL_GEOMETRIC_VIEW",
29672                });
29673            }
29674        }
29675        GroupableItemRef::DefinedCharacterGlyph(i) => {
29676            if i.0 >= model.defined_character_glyph_arena.items.len() {
29677                return Err(AuthorError::DanglingRef {
29678                    entity: "DEFINED_CHARACTER_GLYPH",
29679                });
29680            }
29681        }
29682        GroupableItemRef::DefinedSymbol(i) => {
29683            if i.0 >= model.defined_symbol_arena.items.len() {
29684                return Err(AuthorError::DanglingRef {
29685                    entity: "DEFINED_SYMBOL",
29686                });
29687            }
29688        }
29689        GroupableItemRef::DefinitionalRepresentation(i) => {
29690            if i.0 >= model.definitional_representation_arena.items.len() {
29691                return Err(AuthorError::DanglingRef {
29692                    entity: "DEFINITIONAL_REPRESENTATION",
29693                });
29694            }
29695        }
29696        GroupableItemRef::DefinitionalRepresentationRelationship(i) => {
29697            if i.0
29698                >= model
29699                    .definitional_representation_relationship_arena
29700                    .items
29701                    .len()
29702            {
29703                return Err(AuthorError::DanglingRef {
29704                    entity: "DEFINITIONAL_REPRESENTATION_RELATIONSHIP",
29705                });
29706            }
29707        }
29708        GroupableItemRef::DefinitionalRepresentationRelationshipWithSameContext(i) => {
29709            if i.0
29710                >= model
29711                    .definitional_representation_relationship_with_same_context_arena
29712                    .items
29713                    .len()
29714            {
29715                return Err(AuthorError::DanglingRef {
29716                    entity: "DEFINITIONAL_REPRESENTATION_RELATIONSHIP_WITH_SAME_CONTEXT",
29717                });
29718            }
29719        }
29720        GroupableItemRef::DegenerateToroidalSurface(i) => {
29721            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
29722                return Err(AuthorError::DanglingRef {
29723                    entity: "DEGENERATE_TOROIDAL_SURFACE",
29724                });
29725            }
29726        }
29727        GroupableItemRef::DerivedShapeAspect(i) => {
29728            if i.0 >= model.derived_shape_aspect_arena.items.len() {
29729                return Err(AuthorError::DanglingRef {
29730                    entity: "DERIVED_SHAPE_ASPECT",
29731                });
29732            }
29733        }
29734        GroupableItemRef::DerivedUnit(i) => {
29735            if i.0 >= model.derived_unit_arena.items.len() {
29736                return Err(AuthorError::DanglingRef {
29737                    entity: "DERIVED_UNIT",
29738                });
29739            }
29740        }
29741        GroupableItemRef::DerivedUnitElement(i) => {
29742            if i.0 >= model.derived_unit_element_arena.items.len() {
29743                return Err(AuthorError::DanglingRef {
29744                    entity: "DERIVED_UNIT_ELEMENT",
29745                });
29746            }
29747        }
29748        GroupableItemRef::DescriptiveRepresentationItem(i) => {
29749            if i.0 >= model.descriptive_representation_item_arena.items.len() {
29750                return Err(AuthorError::DanglingRef {
29751                    entity: "DESCRIPTIVE_REPRESENTATION_ITEM",
29752                });
29753            }
29754        }
29755        GroupableItemRef::DesignContext(i) => {
29756            if i.0 >= model.design_context_arena.items.len() {
29757                return Err(AuthorError::DanglingRef {
29758                    entity: "DESIGN_CONTEXT",
29759                });
29760            }
29761        }
29762        GroupableItemRef::DimensionalLocation(i) => {
29763            if i.0 >= model.dimensional_location_arena.items.len() {
29764                return Err(AuthorError::DanglingRef {
29765                    entity: "DIMENSIONAL_LOCATION",
29766                });
29767            }
29768        }
29769        GroupableItemRef::DimensionalLocationWithPath(i) => {
29770            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
29771                return Err(AuthorError::DanglingRef {
29772                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
29773                });
29774            }
29775        }
29776        GroupableItemRef::DimensionalSizeWithDatumFeature(i) => {
29777            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
29778                return Err(AuthorError::DanglingRef {
29779                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
29780                });
29781            }
29782        }
29783        GroupableItemRef::DirectedDimensionalLocation(i) => {
29784            if i.0 >= model.directed_dimensional_location_arena.items.len() {
29785                return Err(AuthorError::DanglingRef {
29786                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
29787                });
29788            }
29789        }
29790        GroupableItemRef::Direction(i) => {
29791            if i.0 >= model.direction_arena.items.len() {
29792                return Err(AuthorError::DanglingRef {
29793                    entity: "DIRECTION",
29794                });
29795            }
29796        }
29797        GroupableItemRef::DocumentFile(i) => {
29798            if i.0 >= model.document_file_arena.items.len() {
29799                return Err(AuthorError::DanglingRef {
29800                    entity: "DOCUMENT_FILE",
29801                });
29802            }
29803        }
29804        GroupableItemRef::DraughtingAnnotationOccurrence(i) => {
29805            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
29806                return Err(AuthorError::DanglingRef {
29807                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
29808                });
29809            }
29810        }
29811        GroupableItemRef::DraughtingCallout(i) => {
29812            if i.0 >= model.draughting_callout_arena.items.len() {
29813                return Err(AuthorError::DanglingRef {
29814                    entity: "DRAUGHTING_CALLOUT",
29815                });
29816            }
29817        }
29818        GroupableItemRef::DraughtingModel(i) => {
29819            if i.0 >= model.draughting_model_arena.items.len() {
29820                return Err(AuthorError::DanglingRef {
29821                    entity: "DRAUGHTING_MODEL",
29822                });
29823            }
29824        }
29825        GroupableItemRef::Edge(i) => {
29826            if i.0 >= model.edge_arena.items.len() {
29827                return Err(AuthorError::DanglingRef { entity: "EDGE" });
29828            }
29829        }
29830        GroupableItemRef::EdgeCurve(i) => {
29831            if i.0 >= model.edge_curve_arena.items.len() {
29832                return Err(AuthorError::DanglingRef {
29833                    entity: "EDGE_CURVE",
29834                });
29835            }
29836        }
29837        GroupableItemRef::EdgeLoop(i) => {
29838            if i.0 >= model.edge_loop_arena.items.len() {
29839                return Err(AuthorError::DanglingRef {
29840                    entity: "EDGE_LOOP",
29841                });
29842            }
29843        }
29844        GroupableItemRef::Effectivity(i) => {
29845            if i.0 >= model.effectivity_arena.items.len() {
29846                return Err(AuthorError::DanglingRef {
29847                    entity: "EFFECTIVITY",
29848                });
29849            }
29850        }
29851        GroupableItemRef::ElementarySurface(i) => {
29852            if i.0 >= model.elementary_surface_arena.items.len() {
29853                return Err(AuthorError::DanglingRef {
29854                    entity: "ELEMENTARY_SURFACE",
29855                });
29856            }
29857        }
29858        GroupableItemRef::Ellipse(i) => {
29859            if i.0 >= model.ellipse_arena.items.len() {
29860                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
29861            }
29862        }
29863        GroupableItemRef::ExternalSource(i) => {
29864            if i.0 >= model.external_source_arena.items.len() {
29865                return Err(AuthorError::DanglingRef {
29866                    entity: "EXTERNAL_SOURCE",
29867                });
29868            }
29869        }
29870        GroupableItemRef::ExternallyDefinedHatchStyle(i) => {
29871            if i.0 >= model.externally_defined_hatch_style_arena.items.len() {
29872                return Err(AuthorError::DanglingRef {
29873                    entity: "EXTERNALLY_DEFINED_HATCH_STYLE",
29874                });
29875            }
29876        }
29877        GroupableItemRef::ExternallyDefinedTileStyle(i) => {
29878            if i.0 >= model.externally_defined_tile_style_arena.items.len() {
29879                return Err(AuthorError::DanglingRef {
29880                    entity: "EXTERNALLY_DEFINED_TILE_STYLE",
29881                });
29882            }
29883        }
29884        GroupableItemRef::Face(i) => {
29885            if i.0 >= model.face_arena.items.len() {
29886                return Err(AuthorError::DanglingRef { entity: "FACE" });
29887            }
29888        }
29889        GroupableItemRef::FaceBound(i) => {
29890            if i.0 >= model.face_bound_arena.items.len() {
29891                return Err(AuthorError::DanglingRef {
29892                    entity: "FACE_BOUND",
29893                });
29894            }
29895        }
29896        GroupableItemRef::FaceOuterBound(i) => {
29897            if i.0 >= model.face_outer_bound_arena.items.len() {
29898                return Err(AuthorError::DanglingRef {
29899                    entity: "FACE_OUTER_BOUND",
29900                });
29901            }
29902        }
29903        GroupableItemRef::FaceSurface(i) => {
29904            if i.0 >= model.face_surface_arena.items.len() {
29905                return Err(AuthorError::DanglingRef {
29906                    entity: "FACE_SURFACE",
29907                });
29908            }
29909        }
29910        GroupableItemRef::FeatureForDatumTargetRelationship(i) => {
29911            if i.0
29912                >= model
29913                    .feature_for_datum_target_relationship_arena
29914                    .items
29915                    .len()
29916            {
29917                return Err(AuthorError::DanglingRef {
29918                    entity: "FEATURE_FOR_DATUM_TARGET_RELATIONSHIP",
29919                });
29920            }
29921        }
29922        GroupableItemRef::FillAreaStyleHatching(i) => {
29923            if i.0 >= model.fill_area_style_hatching_arena.items.len() {
29924                return Err(AuthorError::DanglingRef {
29925                    entity: "FILL_AREA_STYLE_HATCHING",
29926                });
29927            }
29928        }
29929        GroupableItemRef::FillAreaStyleTileColouredRegion(i) => {
29930            if i.0 >= model.fill_area_style_tile_coloured_region_arena.items.len() {
29931                return Err(AuthorError::DanglingRef {
29932                    entity: "FILL_AREA_STYLE_TILE_COLOURED_REGION",
29933                });
29934            }
29935        }
29936        GroupableItemRef::FillAreaStyleTileCurveWithStyle(i) => {
29937            if i.0
29938                >= model
29939                    .fill_area_style_tile_curve_with_style_arena
29940                    .items
29941                    .len()
29942            {
29943                return Err(AuthorError::DanglingRef {
29944                    entity: "FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE",
29945                });
29946            }
29947        }
29948        GroupableItemRef::FillAreaStyleTileSymbolWithStyle(i) => {
29949            if i.0
29950                >= model
29951                    .fill_area_style_tile_symbol_with_style_arena
29952                    .items
29953                    .len()
29954            {
29955                return Err(AuthorError::DanglingRef {
29956                    entity: "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE",
29957                });
29958            }
29959        }
29960        GroupableItemRef::FillAreaStyleTiles(i) => {
29961            if i.0 >= model.fill_area_style_tiles_arena.items.len() {
29962                return Err(AuthorError::DanglingRef {
29963                    entity: "FILL_AREA_STYLE_TILES",
29964                });
29965            }
29966        }
29967        GroupableItemRef::GeneralDatumReference(i) => {
29968            if i.0 >= model.general_datum_reference_arena.items.len() {
29969                return Err(AuthorError::DanglingRef {
29970                    entity: "GENERAL_DATUM_REFERENCE",
29971                });
29972            }
29973        }
29974        GroupableItemRef::GeneralProperty(i) => {
29975            if i.0 >= model.general_property_arena.items.len() {
29976                return Err(AuthorError::DanglingRef {
29977                    entity: "GENERAL_PROPERTY",
29978                });
29979            }
29980        }
29981        GroupableItemRef::GeometricCurveSet(i) => {
29982            if i.0 >= model.geometric_curve_set_arena.items.len() {
29983                return Err(AuthorError::DanglingRef {
29984                    entity: "GEOMETRIC_CURVE_SET",
29985                });
29986            }
29987        }
29988        GroupableItemRef::GeometricItemSpecificUsage(i) => {
29989            if i.0 >= model.geometric_item_specific_usage_arena.items.len() {
29990                return Err(AuthorError::DanglingRef {
29991                    entity: "GEOMETRIC_ITEM_SPECIFIC_USAGE",
29992                });
29993            }
29994        }
29995        GroupableItemRef::GeometricRepresentationContext(i) => {
29996            if i.0 >= model.geometric_representation_context_arena.items.len() {
29997                return Err(AuthorError::DanglingRef {
29998                    entity: "GEOMETRIC_REPRESENTATION_CONTEXT",
29999                });
30000            }
30001        }
30002        GroupableItemRef::GeometricRepresentationItem(i) => {
30003            if i.0 >= model.geometric_representation_item_arena.items.len() {
30004                return Err(AuthorError::DanglingRef {
30005                    entity: "GEOMETRIC_REPRESENTATION_ITEM",
30006                });
30007            }
30008        }
30009        GroupableItemRef::GeometricSet(i) => {
30010            if i.0 >= model.geometric_set_arena.items.len() {
30011                return Err(AuthorError::DanglingRef {
30012                    entity: "GEOMETRIC_SET",
30013                });
30014            }
30015        }
30016        GroupableItemRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
30017            if i.0
30018                >= model
30019                    .geometrically_bounded_surface_shape_representation_arena
30020                    .items
30021                    .len()
30022            {
30023                return Err(AuthorError::DanglingRef {
30024                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
30025                });
30026            }
30027        }
30028        GroupableItemRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
30029            if i.0
30030                >= model
30031                    .geometrically_bounded_wireframe_shape_representation_arena
30032                    .items
30033                    .len()
30034            {
30035                return Err(AuthorError::DanglingRef {
30036                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
30037                });
30038            }
30039        }
30040        GroupableItemRef::GlobalUncertaintyAssignedContext(i) => {
30041            if i.0 >= model.global_uncertainty_assigned_context_arena.items.len() {
30042                return Err(AuthorError::DanglingRef {
30043                    entity: "GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT",
30044                });
30045            }
30046        }
30047        GroupableItemRef::GlobalUnitAssignedContext(i) => {
30048            if i.0 >= model.global_unit_assigned_context_arena.items.len() {
30049                return Err(AuthorError::DanglingRef {
30050                    entity: "GLOBAL_UNIT_ASSIGNED_CONTEXT",
30051                });
30052            }
30053        }
30054        GroupableItemRef::Hyperbola(i) => {
30055            if i.0 >= model.hyperbola_arena.items.len() {
30056                return Err(AuthorError::DanglingRef {
30057                    entity: "HYPERBOLA",
30058                });
30059            }
30060        }
30061        GroupableItemRef::IntegerRepresentationItem(i) => {
30062            if i.0 >= model.integer_representation_item_arena.items.len() {
30063                return Err(AuthorError::DanglingRef {
30064                    entity: "INTEGER_REPRESENTATION_ITEM",
30065                });
30066            }
30067        }
30068        GroupableItemRef::IntersectionCurve(i) => {
30069            if i.0 >= model.intersection_curve_arena.items.len() {
30070                return Err(AuthorError::DanglingRef {
30071                    entity: "INTERSECTION_CURVE",
30072                });
30073            }
30074        }
30075        GroupableItemRef::ItemDefinedTransformation(i) => {
30076            if i.0 >= model.item_defined_transformation_arena.items.len() {
30077                return Err(AuthorError::DanglingRef {
30078                    entity: "ITEM_DEFINED_TRANSFORMATION",
30079                });
30080            }
30081        }
30082        GroupableItemRef::LeaderCurve(i) => {
30083            if i.0 >= model.leader_curve_arena.items.len() {
30084                return Err(AuthorError::DanglingRef {
30085                    entity: "LEADER_CURVE",
30086                });
30087            }
30088        }
30089        GroupableItemRef::LeaderDirectedCallout(i) => {
30090            if i.0 >= model.leader_directed_callout_arena.items.len() {
30091                return Err(AuthorError::DanglingRef {
30092                    entity: "LEADER_DIRECTED_CALLOUT",
30093                });
30094            }
30095        }
30096        GroupableItemRef::LeaderTerminator(i) => {
30097            if i.0 >= model.leader_terminator_arena.items.len() {
30098                return Err(AuthorError::DanglingRef {
30099                    entity: "LEADER_TERMINATOR",
30100                });
30101            }
30102        }
30103        GroupableItemRef::LengthMeasureWithUnit(i) => {
30104            if i.0 >= model.length_measure_with_unit_arena.items.len() {
30105                return Err(AuthorError::DanglingRef {
30106                    entity: "LENGTH_MEASURE_WITH_UNIT",
30107                });
30108            }
30109        }
30110        GroupableItemRef::LengthUnit(i) => {
30111            if i.0 >= model.length_unit_arena.items.len() {
30112                return Err(AuthorError::DanglingRef {
30113                    entity: "LENGTH_UNIT",
30114                });
30115            }
30116        }
30117        GroupableItemRef::Line(i) => {
30118            if i.0 >= model.line_arena.items.len() {
30119                return Err(AuthorError::DanglingRef { entity: "LINE" });
30120            }
30121        }
30122        GroupableItemRef::LocalTime(i) => {
30123            if i.0 >= model.local_time_arena.items.len() {
30124                return Err(AuthorError::DanglingRef {
30125                    entity: "LOCAL_TIME",
30126                });
30127            }
30128        }
30129        GroupableItemRef::Loop(i) => {
30130            if i.0 >= model.loop_arena.items.len() {
30131                return Err(AuthorError::DanglingRef { entity: "LOOP" });
30132            }
30133        }
30134        GroupableItemRef::MakeFromUsageOption(i) => {
30135            if i.0 >= model.make_from_usage_option_arena.items.len() {
30136                return Err(AuthorError::DanglingRef {
30137                    entity: "MAKE_FROM_USAGE_OPTION",
30138                });
30139            }
30140        }
30141        GroupableItemRef::ManifoldSolidBrep(i) => {
30142            if i.0 >= model.manifold_solid_brep_arena.items.len() {
30143                return Err(AuthorError::DanglingRef {
30144                    entity: "MANIFOLD_SOLID_BREP",
30145                });
30146            }
30147        }
30148        GroupableItemRef::ManifoldSurfaceShapeRepresentation(i) => {
30149            if i.0
30150                >= model
30151                    .manifold_surface_shape_representation_arena
30152                    .items
30153                    .len()
30154            {
30155                return Err(AuthorError::DanglingRef {
30156                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
30157                });
30158            }
30159        }
30160        GroupableItemRef::MappedItem(i) => {
30161            if i.0 >= model.mapped_item_arena.items.len() {
30162                return Err(AuthorError::DanglingRef {
30163                    entity: "MAPPED_ITEM",
30164                });
30165            }
30166        }
30167        GroupableItemRef::MassMeasureWithUnit(i) => {
30168            if i.0 >= model.mass_measure_with_unit_arena.items.len() {
30169                return Err(AuthorError::DanglingRef {
30170                    entity: "MASS_MEASURE_WITH_UNIT",
30171                });
30172            }
30173        }
30174        GroupableItemRef::MassUnit(i) => {
30175            if i.0 >= model.mass_unit_arena.items.len() {
30176                return Err(AuthorError::DanglingRef {
30177                    entity: "MASS_UNIT",
30178                });
30179            }
30180        }
30181        GroupableItemRef::MeasureRepresentationItem(i) => {
30182            if i.0 >= model.measure_representation_item_arena.items.len() {
30183                return Err(AuthorError::DanglingRef {
30184                    entity: "MEASURE_REPRESENTATION_ITEM",
30185                });
30186            }
30187        }
30188        GroupableItemRef::MeasureWithUnit(i) => {
30189            if i.0 >= model.measure_with_unit_arena.items.len() {
30190                return Err(AuthorError::DanglingRef {
30191                    entity: "MEASURE_WITH_UNIT",
30192                });
30193            }
30194        }
30195        GroupableItemRef::MechanicalDesignAndDraughtingRelationship(i) => {
30196            if i.0
30197                >= model
30198                    .mechanical_design_and_draughting_relationship_arena
30199                    .items
30200                    .len()
30201            {
30202                return Err(AuthorError::DanglingRef {
30203                    entity: "MECHANICAL_DESIGN_AND_DRAUGHTING_RELATIONSHIP",
30204                });
30205            }
30206        }
30207        GroupableItemRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
30208            if i.0
30209                >= model
30210                    .mechanical_design_geometric_presentation_representation_arena
30211                    .items
30212                    .len()
30213            {
30214                return Err(AuthorError::DanglingRef {
30215                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
30216                });
30217            }
30218        }
30219        GroupableItemRef::MechanicalDesignPresentationRepresentationWithDraughting(i) => {
30220            if i.0
30221                >= model
30222                    .mechanical_design_presentation_representation_with_draughting_arena
30223                    .items
30224                    .len()
30225            {
30226                return Err(AuthorError::DanglingRef {
30227                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
30228                });
30229            }
30230        }
30231        GroupableItemRef::MechanicalDesignShadedPresentationRepresentation(i) => {
30232            if i.0
30233                >= model
30234                    .mechanical_design_shaded_presentation_representation_arena
30235                    .items
30236                    .len()
30237            {
30238                return Err(AuthorError::DanglingRef {
30239                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
30240                });
30241            }
30242        }
30243        GroupableItemRef::NamedUnit(i) => {
30244            if i.0 >= model.named_unit_arena.items.len() {
30245                return Err(AuthorError::DanglingRef {
30246                    entity: "NAMED_UNIT",
30247                });
30248            }
30249        }
30250        GroupableItemRef::NextAssemblyUsageOccurrence(i) => {
30251            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
30252                return Err(AuthorError::DanglingRef {
30253                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
30254                });
30255            }
30256        }
30257        GroupableItemRef::OffsetSurface(i) => {
30258            if i.0 >= model.offset_surface_arena.items.len() {
30259                return Err(AuthorError::DanglingRef {
30260                    entity: "OFFSET_SURFACE",
30261                });
30262            }
30263        }
30264        GroupableItemRef::OneDirectionRepeatFactor(i) => {
30265            if i.0 >= model.one_direction_repeat_factor_arena.items.len() {
30266                return Err(AuthorError::DanglingRef {
30267                    entity: "ONE_DIRECTION_REPEAT_FACTOR",
30268                });
30269            }
30270        }
30271        GroupableItemRef::OpenShell(i) => {
30272            if i.0 >= model.open_shell_arena.items.len() {
30273                return Err(AuthorError::DanglingRef {
30274                    entity: "OPEN_SHELL",
30275                });
30276            }
30277        }
30278        GroupableItemRef::Organization(i) => {
30279            if i.0 >= model.organization_arena.items.len() {
30280                return Err(AuthorError::DanglingRef {
30281                    entity: "ORGANIZATION",
30282                });
30283            }
30284        }
30285        GroupableItemRef::OrganizationRelationship(i) => {
30286            if i.0 >= model.organization_relationship_arena.items.len() {
30287                return Err(AuthorError::DanglingRef {
30288                    entity: "ORGANIZATION_RELATIONSHIP",
30289                });
30290            }
30291        }
30292        GroupableItemRef::OrganizationType(i) => {
30293            if i.0 >= model.organization_type_arena.items.len() {
30294                return Err(AuthorError::DanglingRef {
30295                    entity: "ORGANIZATION_TYPE",
30296                });
30297            }
30298        }
30299        GroupableItemRef::OrganizationalAddress(i) => {
30300            if i.0 >= model.organizational_address_arena.items.len() {
30301                return Err(AuthorError::DanglingRef {
30302                    entity: "ORGANIZATIONAL_ADDRESS",
30303                });
30304            }
30305        }
30306        GroupableItemRef::OrganizationalProject(i) => {
30307            if i.0 >= model.organizational_project_arena.items.len() {
30308                return Err(AuthorError::DanglingRef {
30309                    entity: "ORGANIZATIONAL_PROJECT",
30310                });
30311            }
30312        }
30313        GroupableItemRef::OrganizationalProjectRelationship(i) => {
30314            if i.0 >= model.organizational_project_relationship_arena.items.len() {
30315                return Err(AuthorError::DanglingRef {
30316                    entity: "ORGANIZATIONAL_PROJECT_RELATIONSHIP",
30317                });
30318            }
30319        }
30320        GroupableItemRef::OrientedClosedShell(i) => {
30321            if i.0 >= model.oriented_closed_shell_arena.items.len() {
30322                return Err(AuthorError::DanglingRef {
30323                    entity: "ORIENTED_CLOSED_SHELL",
30324                });
30325            }
30326        }
30327        GroupableItemRef::OrientedEdge(i) => {
30328            if i.0 >= model.oriented_edge_arena.items.len() {
30329                return Err(AuthorError::DanglingRef {
30330                    entity: "ORIENTED_EDGE",
30331                });
30332            }
30333        }
30334        GroupableItemRef::OverRidingStyledItem(i) => {
30335            if i.0 >= model.over_riding_styled_item_arena.items.len() {
30336                return Err(AuthorError::DanglingRef {
30337                    entity: "OVER_RIDING_STYLED_ITEM",
30338                });
30339            }
30340        }
30341        GroupableItemRef::ParametricRepresentationContext(i) => {
30342            if i.0 >= model.parametric_representation_context_arena.items.len() {
30343                return Err(AuthorError::DanglingRef {
30344                    entity: "PARAMETRIC_REPRESENTATION_CONTEXT",
30345                });
30346            }
30347        }
30348        GroupableItemRef::Path(i) => {
30349            if i.0 >= model.path_arena.items.len() {
30350                return Err(AuthorError::DanglingRef { entity: "PATH" });
30351            }
30352        }
30353        GroupableItemRef::Pcurve(i) => {
30354            if i.0 >= model.pcurve_arena.items.len() {
30355                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
30356            }
30357        }
30358        GroupableItemRef::Person(i) => {
30359            if i.0 >= model.person_arena.items.len() {
30360                return Err(AuthorError::DanglingRef { entity: "PERSON" });
30361            }
30362        }
30363        GroupableItemRef::PersonAndOrganization(i) => {
30364            if i.0 >= model.person_and_organization_arena.items.len() {
30365                return Err(AuthorError::DanglingRef {
30366                    entity: "PERSON_AND_ORGANIZATION",
30367                });
30368            }
30369        }
30370        GroupableItemRef::PersonAndOrganizationAddress(i) => {
30371            if i.0 >= model.person_and_organization_address_arena.items.len() {
30372                return Err(AuthorError::DanglingRef {
30373                    entity: "PERSON_AND_ORGANIZATION_ADDRESS",
30374                });
30375            }
30376        }
30377        GroupableItemRef::PersonalAddress(i) => {
30378            if i.0 >= model.personal_address_arena.items.len() {
30379                return Err(AuthorError::DanglingRef {
30380                    entity: "PERSONAL_ADDRESS",
30381                });
30382            }
30383        }
30384        GroupableItemRef::PlacedDatumTargetFeature(i) => {
30385            if i.0 >= model.placed_datum_target_feature_arena.items.len() {
30386                return Err(AuthorError::DanglingRef {
30387                    entity: "PLACED_DATUM_TARGET_FEATURE",
30388                });
30389            }
30390        }
30391        GroupableItemRef::Placement(i) => {
30392            if i.0 >= model.placement_arena.items.len() {
30393                return Err(AuthorError::DanglingRef {
30394                    entity: "PLACEMENT",
30395                });
30396            }
30397        }
30398        GroupableItemRef::PlanarBox(i) => {
30399            if i.0 >= model.planar_box_arena.items.len() {
30400                return Err(AuthorError::DanglingRef {
30401                    entity: "PLANAR_BOX",
30402                });
30403            }
30404        }
30405        GroupableItemRef::PlanarExtent(i) => {
30406            if i.0 >= model.planar_extent_arena.items.len() {
30407                return Err(AuthorError::DanglingRef {
30408                    entity: "PLANAR_EXTENT",
30409                });
30410            }
30411        }
30412        GroupableItemRef::Plane(i) => {
30413            if i.0 >= model.plane_arena.items.len() {
30414                return Err(AuthorError::DanglingRef { entity: "PLANE" });
30415            }
30416        }
30417        GroupableItemRef::PlaneAngleMeasureWithUnit(i) => {
30418            if i.0 >= model.plane_angle_measure_with_unit_arena.items.len() {
30419                return Err(AuthorError::DanglingRef {
30420                    entity: "PLANE_ANGLE_MEASURE_WITH_UNIT",
30421                });
30422            }
30423        }
30424        GroupableItemRef::PlaneAngleUnit(i) => {
30425            if i.0 >= model.plane_angle_unit_arena.items.len() {
30426                return Err(AuthorError::DanglingRef {
30427                    entity: "PLANE_ANGLE_UNIT",
30428                });
30429            }
30430        }
30431        GroupableItemRef::Point(i) => {
30432            if i.0 >= model.point_arena.items.len() {
30433                return Err(AuthorError::DanglingRef { entity: "POINT" });
30434            }
30435        }
30436        GroupableItemRef::PolyLoop(i) => {
30437            if i.0 >= model.poly_loop_arena.items.len() {
30438                return Err(AuthorError::DanglingRef {
30439                    entity: "POLY_LOOP",
30440                });
30441            }
30442        }
30443        GroupableItemRef::Polyline(i) => {
30444            if i.0 >= model.polyline_arena.items.len() {
30445                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
30446            }
30447        }
30448        GroupableItemRef::PrecisionQualifier(i) => {
30449            if i.0 >= model.precision_qualifier_arena.items.len() {
30450                return Err(AuthorError::DanglingRef {
30451                    entity: "PRECISION_QUALIFIER",
30452                });
30453            }
30454        }
30455        GroupableItemRef::PresentationArea(i) => {
30456            if i.0 >= model.presentation_area_arena.items.len() {
30457                return Err(AuthorError::DanglingRef {
30458                    entity: "PRESENTATION_AREA",
30459                });
30460            }
30461        }
30462        GroupableItemRef::PresentationRepresentation(i) => {
30463            if i.0 >= model.presentation_representation_arena.items.len() {
30464                return Err(AuthorError::DanglingRef {
30465                    entity: "PRESENTATION_REPRESENTATION",
30466                });
30467            }
30468        }
30469        GroupableItemRef::PresentationView(i) => {
30470            if i.0 >= model.presentation_view_arena.items.len() {
30471                return Err(AuthorError::DanglingRef {
30472                    entity: "PRESENTATION_VIEW",
30473                });
30474            }
30475        }
30476        GroupableItemRef::Product(i) => {
30477            if i.0 >= model.product_arena.items.len() {
30478                return Err(AuthorError::DanglingRef { entity: "PRODUCT" });
30479            }
30480        }
30481        GroupableItemRef::ProductConcept(i) => {
30482            if i.0 >= model.product_concept_arena.items.len() {
30483                return Err(AuthorError::DanglingRef {
30484                    entity: "PRODUCT_CONCEPT",
30485                });
30486            }
30487        }
30488        GroupableItemRef::ProductConceptContext(i) => {
30489            if i.0 >= model.product_concept_context_arena.items.len() {
30490                return Err(AuthorError::DanglingRef {
30491                    entity: "PRODUCT_CONCEPT_CONTEXT",
30492                });
30493            }
30494        }
30495        GroupableItemRef::ProductDefinition(i) => {
30496            if i.0 >= model.product_definition_arena.items.len() {
30497                return Err(AuthorError::DanglingRef {
30498                    entity: "PRODUCT_DEFINITION",
30499                });
30500            }
30501        }
30502        GroupableItemRef::ProductDefinitionContext(i) => {
30503            if i.0 >= model.product_definition_context_arena.items.len() {
30504                return Err(AuthorError::DanglingRef {
30505                    entity: "PRODUCT_DEFINITION_CONTEXT",
30506                });
30507            }
30508        }
30509        GroupableItemRef::ProductDefinitionEffectivity(i) => {
30510            if i.0 >= model.product_definition_effectivity_arena.items.len() {
30511                return Err(AuthorError::DanglingRef {
30512                    entity: "PRODUCT_DEFINITION_EFFECTIVITY",
30513                });
30514            }
30515        }
30516        GroupableItemRef::ProductDefinitionFormation(i) => {
30517            if i.0 >= model.product_definition_formation_arena.items.len() {
30518                return Err(AuthorError::DanglingRef {
30519                    entity: "PRODUCT_DEFINITION_FORMATION",
30520                });
30521            }
30522        }
30523        GroupableItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
30524            if i.0
30525                >= model
30526                    .product_definition_formation_with_specified_source_arena
30527                    .items
30528                    .len()
30529            {
30530                return Err(AuthorError::DanglingRef {
30531                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
30532                });
30533            }
30534        }
30535        GroupableItemRef::ProductDefinitionRelationship(i) => {
30536            if i.0 >= model.product_definition_relationship_arena.items.len() {
30537                return Err(AuthorError::DanglingRef {
30538                    entity: "PRODUCT_DEFINITION_RELATIONSHIP",
30539                });
30540            }
30541        }
30542        GroupableItemRef::ProductDefinitionShape(i) => {
30543            if i.0 >= model.product_definition_shape_arena.items.len() {
30544                return Err(AuthorError::DanglingRef {
30545                    entity: "PRODUCT_DEFINITION_SHAPE",
30546                });
30547            }
30548        }
30549        GroupableItemRef::ProductDefinitionUsage(i) => {
30550            if i.0 >= model.product_definition_usage_arena.items.len() {
30551                return Err(AuthorError::DanglingRef {
30552                    entity: "PRODUCT_DEFINITION_USAGE",
30553                });
30554            }
30555        }
30556        GroupableItemRef::ProductDefinitionWithAssociatedDocuments(i) => {
30557            if i.0
30558                >= model
30559                    .product_definition_with_associated_documents_arena
30560                    .items
30561                    .len()
30562            {
30563                return Err(AuthorError::DanglingRef {
30564                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
30565                });
30566            }
30567        }
30568        GroupableItemRef::PropertyDefinition(i) => {
30569            if i.0 >= model.property_definition_arena.items.len() {
30570                return Err(AuthorError::DanglingRef {
30571                    entity: "PROPERTY_DEFINITION",
30572                });
30573            }
30574        }
30575        GroupableItemRef::PropertyDefinitionRepresentation(i) => {
30576            if i.0 >= model.property_definition_representation_arena.items.len() {
30577                return Err(AuthorError::DanglingRef {
30578                    entity: "PROPERTY_DEFINITION_REPRESENTATION",
30579                });
30580            }
30581        }
30582        GroupableItemRef::QualifiedRepresentationItem(i) => {
30583            if i.0 >= model.qualified_representation_item_arena.items.len() {
30584                return Err(AuthorError::DanglingRef {
30585                    entity: "QUALIFIED_REPRESENTATION_ITEM",
30586                });
30587            }
30588        }
30589        GroupableItemRef::QuasiUniformCurve(i) => {
30590            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
30591                return Err(AuthorError::DanglingRef {
30592                    entity: "QUASI_UNIFORM_CURVE",
30593                });
30594            }
30595        }
30596        GroupableItemRef::QuasiUniformSurface(i) => {
30597            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
30598                return Err(AuthorError::DanglingRef {
30599                    entity: "QUASI_UNIFORM_SURFACE",
30600                });
30601            }
30602        }
30603        GroupableItemRef::RatioMeasureWithUnit(i) => {
30604            if i.0 >= model.ratio_measure_with_unit_arena.items.len() {
30605                return Err(AuthorError::DanglingRef {
30606                    entity: "RATIO_MEASURE_WITH_UNIT",
30607                });
30608            }
30609        }
30610        GroupableItemRef::RatioUnit(i) => {
30611            if i.0 >= model.ratio_unit_arena.items.len() {
30612                return Err(AuthorError::DanglingRef {
30613                    entity: "RATIO_UNIT",
30614                });
30615            }
30616        }
30617        GroupableItemRef::RationalBSplineCurve(i) => {
30618            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
30619                return Err(AuthorError::DanglingRef {
30620                    entity: "RATIONAL_B_SPLINE_CURVE",
30621                });
30622            }
30623        }
30624        GroupableItemRef::RationalBSplineSurface(i) => {
30625            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
30626                return Err(AuthorError::DanglingRef {
30627                    entity: "RATIONAL_B_SPLINE_SURFACE",
30628                });
30629            }
30630        }
30631        GroupableItemRef::RealRepresentationItem(i) => {
30632            if i.0 >= model.real_representation_item_arena.items.len() {
30633                return Err(AuthorError::DanglingRef {
30634                    entity: "REAL_REPRESENTATION_ITEM",
30635                });
30636            }
30637        }
30638        GroupableItemRef::RepositionedTessellatedItem(i) => {
30639            if i.0 >= model.repositioned_tessellated_item_arena.items.len() {
30640                return Err(AuthorError::DanglingRef {
30641                    entity: "REPOSITIONED_TESSELLATED_ITEM",
30642                });
30643            }
30644        }
30645        GroupableItemRef::Representation(i) => {
30646            if i.0 >= model.representation_arena.items.len() {
30647                return Err(AuthorError::DanglingRef {
30648                    entity: "REPRESENTATION",
30649                });
30650            }
30651        }
30652        GroupableItemRef::RepresentationContext(i) => {
30653            if i.0 >= model.representation_context_arena.items.len() {
30654                return Err(AuthorError::DanglingRef {
30655                    entity: "REPRESENTATION_CONTEXT",
30656                });
30657            }
30658        }
30659        GroupableItemRef::RepresentationItem(i) => {
30660            if i.0 >= model.representation_item_arena.items.len() {
30661                return Err(AuthorError::DanglingRef {
30662                    entity: "REPRESENTATION_ITEM",
30663                });
30664            }
30665        }
30666        GroupableItemRef::RepresentationRelationship(i) => {
30667            if i.0 >= model.representation_relationship_arena.items.len() {
30668                return Err(AuthorError::DanglingRef {
30669                    entity: "REPRESENTATION_RELATIONSHIP",
30670                });
30671            }
30672        }
30673        GroupableItemRef::RepresentationRelationshipWithTransformation(i) => {
30674            if i.0
30675                >= model
30676                    .representation_relationship_with_transformation_arena
30677                    .items
30678                    .len()
30679            {
30680                return Err(AuthorError::DanglingRef {
30681                    entity: "REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION",
30682                });
30683            }
30684        }
30685        GroupableItemRef::SeamCurve(i) => {
30686            if i.0 >= model.seam_curve_arena.items.len() {
30687                return Err(AuthorError::DanglingRef {
30688                    entity: "SEAM_CURVE",
30689                });
30690            }
30691        }
30692        GroupableItemRef::SecurityClassification(i) => {
30693            if i.0 >= model.security_classification_arena.items.len() {
30694                return Err(AuthorError::DanglingRef {
30695                    entity: "SECURITY_CLASSIFICATION",
30696                });
30697            }
30698        }
30699        GroupableItemRef::ShapeAspect(i) => {
30700            if i.0 >= model.shape_aspect_arena.items.len() {
30701                return Err(AuthorError::DanglingRef {
30702                    entity: "SHAPE_ASPECT",
30703                });
30704            }
30705        }
30706        GroupableItemRef::ShapeAspectAssociativity(i) => {
30707            if i.0 >= model.shape_aspect_associativity_arena.items.len() {
30708                return Err(AuthorError::DanglingRef {
30709                    entity: "SHAPE_ASPECT_ASSOCIATIVITY",
30710                });
30711            }
30712        }
30713        GroupableItemRef::ShapeAspectDerivingRelationship(i) => {
30714            if i.0 >= model.shape_aspect_deriving_relationship_arena.items.len() {
30715                return Err(AuthorError::DanglingRef {
30716                    entity: "SHAPE_ASPECT_DERIVING_RELATIONSHIP",
30717                });
30718            }
30719        }
30720        GroupableItemRef::ShapeAspectRelationship(i) => {
30721            if i.0 >= model.shape_aspect_relationship_arena.items.len() {
30722                return Err(AuthorError::DanglingRef {
30723                    entity: "SHAPE_ASPECT_RELATIONSHIP",
30724                });
30725            }
30726        }
30727        GroupableItemRef::ShapeDefinitionRepresentation(i) => {
30728            if i.0 >= model.shape_definition_representation_arena.items.len() {
30729                return Err(AuthorError::DanglingRef {
30730                    entity: "SHAPE_DEFINITION_REPRESENTATION",
30731                });
30732            }
30733        }
30734        GroupableItemRef::ShapeDimensionRepresentation(i) => {
30735            if i.0 >= model.shape_dimension_representation_arena.items.len() {
30736                return Err(AuthorError::DanglingRef {
30737                    entity: "SHAPE_DIMENSION_REPRESENTATION",
30738                });
30739            }
30740        }
30741        GroupableItemRef::ShapeRepresentation(i) => {
30742            if i.0 >= model.shape_representation_arena.items.len() {
30743                return Err(AuthorError::DanglingRef {
30744                    entity: "SHAPE_REPRESENTATION",
30745                });
30746            }
30747        }
30748        GroupableItemRef::ShapeRepresentationRelationship(i) => {
30749            if i.0 >= model.shape_representation_relationship_arena.items.len() {
30750                return Err(AuthorError::DanglingRef {
30751                    entity: "SHAPE_REPRESENTATION_RELATIONSHIP",
30752                });
30753            }
30754        }
30755        GroupableItemRef::ShapeRepresentationWithParameters(i) => {
30756            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
30757                return Err(AuthorError::DanglingRef {
30758                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
30759                });
30760            }
30761        }
30762        GroupableItemRef::ShellBasedSurfaceModel(i) => {
30763            if i.0 >= model.shell_based_surface_model_arena.items.len() {
30764                return Err(AuthorError::DanglingRef {
30765                    entity: "SHELL_BASED_SURFACE_MODEL",
30766                });
30767            }
30768        }
30769        GroupableItemRef::SiUnit(i) => {
30770            if i.0 >= model.si_unit_arena.items.len() {
30771                return Err(AuthorError::DanglingRef { entity: "SI_UNIT" });
30772            }
30773        }
30774        GroupableItemRef::SolidAngleUnit(i) => {
30775            if i.0 >= model.solid_angle_unit_arena.items.len() {
30776                return Err(AuthorError::DanglingRef {
30777                    entity: "SOLID_ANGLE_UNIT",
30778                });
30779            }
30780        }
30781        GroupableItemRef::SolidModel(i) => {
30782            if i.0 >= model.solid_model_arena.items.len() {
30783                return Err(AuthorError::DanglingRef {
30784                    entity: "SOLID_MODEL",
30785                });
30786            }
30787        }
30788        GroupableItemRef::SphericalSurface(i) => {
30789            if i.0 >= model.spherical_surface_arena.items.len() {
30790                return Err(AuthorError::DanglingRef {
30791                    entity: "SPHERICAL_SURFACE",
30792                });
30793            }
30794        }
30795        GroupableItemRef::StateObserved(i) => {
30796            if i.0 >= model.state_observed_arena.items.len() {
30797                return Err(AuthorError::DanglingRef {
30798                    entity: "STATE_OBSERVED",
30799                });
30800            }
30801        }
30802        GroupableItemRef::StateType(i) => {
30803            if i.0 >= model.state_type_arena.items.len() {
30804                return Err(AuthorError::DanglingRef {
30805                    entity: "STATE_TYPE",
30806                });
30807            }
30808        }
30809        GroupableItemRef::StyledItem(i) => {
30810            if i.0 >= model.styled_item_arena.items.len() {
30811                return Err(AuthorError::DanglingRef {
30812                    entity: "STYLED_ITEM",
30813                });
30814            }
30815        }
30816        GroupableItemRef::Surface(i) => {
30817            if i.0 >= model.surface_arena.items.len() {
30818                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
30819            }
30820        }
30821        GroupableItemRef::SurfaceCurve(i) => {
30822            if i.0 >= model.surface_curve_arena.items.len() {
30823                return Err(AuthorError::DanglingRef {
30824                    entity: "SURFACE_CURVE",
30825                });
30826            }
30827        }
30828        GroupableItemRef::SurfaceOfLinearExtrusion(i) => {
30829            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
30830                return Err(AuthorError::DanglingRef {
30831                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
30832                });
30833            }
30834        }
30835        GroupableItemRef::SurfaceOfRevolution(i) => {
30836            if i.0 >= model.surface_of_revolution_arena.items.len() {
30837                return Err(AuthorError::DanglingRef {
30838                    entity: "SURFACE_OF_REVOLUTION",
30839                });
30840            }
30841        }
30842        GroupableItemRef::SweptSurface(i) => {
30843            if i.0 >= model.swept_surface_arena.items.len() {
30844                return Err(AuthorError::DanglingRef {
30845                    entity: "SWEPT_SURFACE",
30846                });
30847            }
30848        }
30849        GroupableItemRef::SymbolRepresentation(i) => {
30850            if i.0 >= model.symbol_representation_arena.items.len() {
30851                return Err(AuthorError::DanglingRef {
30852                    entity: "SYMBOL_REPRESENTATION",
30853                });
30854            }
30855        }
30856        GroupableItemRef::SymbolTarget(i) => {
30857            if i.0 >= model.symbol_target_arena.items.len() {
30858                return Err(AuthorError::DanglingRef {
30859                    entity: "SYMBOL_TARGET",
30860                });
30861            }
30862        }
30863        GroupableItemRef::TerminatorSymbol(i) => {
30864            if i.0 >= model.terminator_symbol_arena.items.len() {
30865                return Err(AuthorError::DanglingRef {
30866                    entity: "TERMINATOR_SYMBOL",
30867                });
30868            }
30869        }
30870        GroupableItemRef::TessellatedAnnotationOccurrence(i) => {
30871            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
30872                return Err(AuthorError::DanglingRef {
30873                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
30874                });
30875            }
30876        }
30877        GroupableItemRef::TessellatedCurveSet(i) => {
30878            if i.0 >= model.tessellated_curve_set_arena.items.len() {
30879                return Err(AuthorError::DanglingRef {
30880                    entity: "TESSELLATED_CURVE_SET",
30881                });
30882            }
30883        }
30884        GroupableItemRef::TessellatedFace(i) => {
30885            if i.0 >= model.tessellated_face_arena.items.len() {
30886                return Err(AuthorError::DanglingRef {
30887                    entity: "TESSELLATED_FACE",
30888                });
30889            }
30890        }
30891        GroupableItemRef::TessellatedGeometricSet(i) => {
30892            if i.0 >= model.tessellated_geometric_set_arena.items.len() {
30893                return Err(AuthorError::DanglingRef {
30894                    entity: "TESSELLATED_GEOMETRIC_SET",
30895                });
30896            }
30897        }
30898        GroupableItemRef::TessellatedItem(i) => {
30899            if i.0 >= model.tessellated_item_arena.items.len() {
30900                return Err(AuthorError::DanglingRef {
30901                    entity: "TESSELLATED_ITEM",
30902                });
30903            }
30904        }
30905        GroupableItemRef::TessellatedShapeRepresentation(i) => {
30906            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
30907                return Err(AuthorError::DanglingRef {
30908                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
30909                });
30910            }
30911        }
30912        GroupableItemRef::TessellatedShell(i) => {
30913            if i.0 >= model.tessellated_shell_arena.items.len() {
30914                return Err(AuthorError::DanglingRef {
30915                    entity: "TESSELLATED_SHELL",
30916                });
30917            }
30918        }
30919        GroupableItemRef::TessellatedSolid(i) => {
30920            if i.0 >= model.tessellated_solid_arena.items.len() {
30921                return Err(AuthorError::DanglingRef {
30922                    entity: "TESSELLATED_SOLID",
30923                });
30924            }
30925        }
30926        GroupableItemRef::TessellatedStructuredItem(i) => {
30927            if i.0 >= model.tessellated_structured_item_arena.items.len() {
30928                return Err(AuthorError::DanglingRef {
30929                    entity: "TESSELLATED_STRUCTURED_ITEM",
30930                });
30931            }
30932        }
30933        GroupableItemRef::TessellatedSurfaceSet(i) => {
30934            if i.0 >= model.tessellated_surface_set_arena.items.len() {
30935                return Err(AuthorError::DanglingRef {
30936                    entity: "TESSELLATED_SURFACE_SET",
30937                });
30938            }
30939        }
30940        GroupableItemRef::TextLiteral(i) => {
30941            if i.0 >= model.text_literal_arena.items.len() {
30942                return Err(AuthorError::DanglingRef {
30943                    entity: "TEXT_LITERAL",
30944                });
30945            }
30946        }
30947        GroupableItemRef::TimeUnit(i) => {
30948            if i.0 >= model.time_unit_arena.items.len() {
30949                return Err(AuthorError::DanglingRef {
30950                    entity: "TIME_UNIT",
30951                });
30952            }
30953        }
30954        GroupableItemRef::ToleranceZone(i) => {
30955            if i.0 >= model.tolerance_zone_arena.items.len() {
30956                return Err(AuthorError::DanglingRef {
30957                    entity: "TOLERANCE_ZONE",
30958                });
30959            }
30960        }
30961        GroupableItemRef::ToleranceZoneWithDatum(i) => {
30962            if i.0 >= model.tolerance_zone_with_datum_arena.items.len() {
30963                return Err(AuthorError::DanglingRef {
30964                    entity: "TOLERANCE_ZONE_WITH_DATUM",
30965                });
30966            }
30967        }
30968        GroupableItemRef::TopologicalRepresentationItem(i) => {
30969            if i.0 >= model.topological_representation_item_arena.items.len() {
30970                return Err(AuthorError::DanglingRef {
30971                    entity: "TOPOLOGICAL_REPRESENTATION_ITEM",
30972                });
30973            }
30974        }
30975        GroupableItemRef::ToroidalSurface(i) => {
30976            if i.0 >= model.toroidal_surface_arena.items.len() {
30977                return Err(AuthorError::DanglingRef {
30978                    entity: "TOROIDAL_SURFACE",
30979                });
30980            }
30981        }
30982        GroupableItemRef::TrimmedCurve(i) => {
30983            if i.0 >= model.trimmed_curve_arena.items.len() {
30984                return Err(AuthorError::DanglingRef {
30985                    entity: "TRIMMED_CURVE",
30986                });
30987            }
30988        }
30989        GroupableItemRef::TwoDirectionRepeatFactor(i) => {
30990            if i.0 >= model.two_direction_repeat_factor_arena.items.len() {
30991                return Err(AuthorError::DanglingRef {
30992                    entity: "TWO_DIRECTION_REPEAT_FACTOR",
30993                });
30994            }
30995        }
30996        GroupableItemRef::TypeQualifier(i) => {
30997            if i.0 >= model.type_qualifier_arena.items.len() {
30998                return Err(AuthorError::DanglingRef {
30999                    entity: "TYPE_QUALIFIER",
31000                });
31001            }
31002        }
31003        GroupableItemRef::UncertaintyMeasureWithUnit(i) => {
31004            if i.0 >= model.uncertainty_measure_with_unit_arena.items.len() {
31005                return Err(AuthorError::DanglingRef {
31006                    entity: "UNCERTAINTY_MEASURE_WITH_UNIT",
31007                });
31008            }
31009        }
31010        GroupableItemRef::UncertaintyQualifier(i) => {
31011            if i.0 >= model.uncertainty_qualifier_arena.items.len() {
31012                return Err(AuthorError::DanglingRef {
31013                    entity: "UNCERTAINTY_QUALIFIER",
31014                });
31015            }
31016        }
31017        GroupableItemRef::UniformCurve(i) => {
31018            if i.0 >= model.uniform_curve_arena.items.len() {
31019                return Err(AuthorError::DanglingRef {
31020                    entity: "UNIFORM_CURVE",
31021                });
31022            }
31023        }
31024        GroupableItemRef::UniformSurface(i) => {
31025            if i.0 >= model.uniform_surface_arena.items.len() {
31026                return Err(AuthorError::DanglingRef {
31027                    entity: "UNIFORM_SURFACE",
31028                });
31029            }
31030        }
31031        GroupableItemRef::ValueRepresentationItem(i) => {
31032            if i.0 >= model.value_representation_item_arena.items.len() {
31033                return Err(AuthorError::DanglingRef {
31034                    entity: "VALUE_REPRESENTATION_ITEM",
31035                });
31036            }
31037        }
31038        GroupableItemRef::Vector(i) => {
31039            if i.0 >= model.vector_arena.items.len() {
31040                return Err(AuthorError::DanglingRef { entity: "VECTOR" });
31041            }
31042        }
31043        GroupableItemRef::VersionedActionRequest(i) => {
31044            if i.0 >= model.versioned_action_request_arena.items.len() {
31045                return Err(AuthorError::DanglingRef {
31046                    entity: "VERSIONED_ACTION_REQUEST",
31047                });
31048            }
31049        }
31050        GroupableItemRef::Vertex(i) => {
31051            if i.0 >= model.vertex_arena.items.len() {
31052                return Err(AuthorError::DanglingRef { entity: "VERTEX" });
31053            }
31054        }
31055        GroupableItemRef::VertexLoop(i) => {
31056            if i.0 >= model.vertex_loop_arena.items.len() {
31057                return Err(AuthorError::DanglingRef {
31058                    entity: "VERTEX_LOOP",
31059                });
31060            }
31061        }
31062        GroupableItemRef::VertexPoint(i) => {
31063            if i.0 >= model.vertex_point_arena.items.len() {
31064                return Err(AuthorError::DanglingRef {
31065                    entity: "VERTEX_POINT",
31066                });
31067            }
31068        }
31069        GroupableItemRef::VertexShell(i) => {
31070            if i.0 >= model.vertex_shell_arena.items.len() {
31071                return Err(AuthorError::DanglingRef {
31072                    entity: "VERTEX_SHELL",
31073                });
31074            }
31075        }
31076        GroupableItemRef::VolumeUnit(i) => {
31077            if i.0 >= model.volume_unit_arena.items.len() {
31078                return Err(AuthorError::DanglingRef {
31079                    entity: "VOLUME_UNIT",
31080                });
31081            }
31082        }
31083        GroupableItemRef::WireShell(i) => {
31084            if i.0 >= model.wire_shell_arena.items.len() {
31085                return Err(AuthorError::DanglingRef {
31086                    entity: "WIRE_SHELL",
31087                });
31088            }
31089        }
31090        GroupableItemRef::Complex(i) => {
31091            if i.0 >= model.complex_unit_arena.items.len() {
31092                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
31093            }
31094        }
31095    }
31096    Ok(())
31097}
31098fn check_id_attribute_select_ref(
31099    model: &StepModel,
31100    r: &IdAttributeSelectRef,
31101) -> Result<(), AuthorError> {
31102    match r {
31103        IdAttributeSelectRef::Action(i) => {
31104            if i.0 >= model.action_arena.items.len() {
31105                return Err(AuthorError::DanglingRef { entity: "ACTION" });
31106            }
31107        }
31108        IdAttributeSelectRef::Address(i) => {
31109            if i.0 >= model.address_arena.items.len() {
31110                return Err(AuthorError::DanglingRef { entity: "ADDRESS" });
31111            }
31112        }
31113        IdAttributeSelectRef::AdvancedBrepShapeRepresentation(i) => {
31114            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
31115                return Err(AuthorError::DanglingRef {
31116                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
31117                });
31118            }
31119        }
31120        IdAttributeSelectRef::AdvancedFace(i) => {
31121            if i.0 >= model.advanced_face_arena.items.len() {
31122                return Err(AuthorError::DanglingRef {
31123                    entity: "ADVANCED_FACE",
31124                });
31125            }
31126        }
31127        IdAttributeSelectRef::AllAroundShapeAspect(i) => {
31128            if i.0 >= model.all_around_shape_aspect_arena.items.len() {
31129                return Err(AuthorError::DanglingRef {
31130                    entity: "ALL_AROUND_SHAPE_ASPECT",
31131                });
31132            }
31133        }
31134        IdAttributeSelectRef::AngularLocation(i) => {
31135            if i.0 >= model.angular_location_arena.items.len() {
31136                return Err(AuthorError::DanglingRef {
31137                    entity: "ANGULAR_LOCATION",
31138                });
31139            }
31140        }
31141        IdAttributeSelectRef::AngularSize(i) => {
31142            if i.0 >= model.angular_size_arena.items.len() {
31143                return Err(AuthorError::DanglingRef {
31144                    entity: "ANGULAR_SIZE",
31145                });
31146            }
31147        }
31148        IdAttributeSelectRef::AngularityTolerance(i) => {
31149            if i.0 >= model.angularity_tolerance_arena.items.len() {
31150                return Err(AuthorError::DanglingRef {
31151                    entity: "ANGULARITY_TOLERANCE",
31152                });
31153            }
31154        }
31155        IdAttributeSelectRef::ApplicationContext(i) => {
31156            if i.0 >= model.application_context_arena.items.len() {
31157                return Err(AuthorError::DanglingRef {
31158                    entity: "APPLICATION_CONTEXT",
31159                });
31160            }
31161        }
31162        IdAttributeSelectRef::AscribableStateRelationship(i) => {
31163            if i.0 >= model.ascribable_state_relationship_arena.items.len() {
31164                return Err(AuthorError::DanglingRef {
31165                    entity: "ASCRIBABLE_STATE_RELATIONSHIP",
31166                });
31167            }
31168        }
31169        IdAttributeSelectRef::CentreOfSymmetry(i) => {
31170            if i.0 >= model.centre_of_symmetry_arena.items.len() {
31171                return Err(AuthorError::DanglingRef {
31172                    entity: "CENTRE_OF_SYMMETRY",
31173                });
31174            }
31175        }
31176        IdAttributeSelectRef::CharacterizedRepresentation(i) => {
31177            if i.0 >= model.characterized_representation_arena.items.len() {
31178                return Err(AuthorError::DanglingRef {
31179                    entity: "CHARACTERIZED_REPRESENTATION",
31180                });
31181            }
31182        }
31183        IdAttributeSelectRef::CircularRunoutTolerance(i) => {
31184            if i.0 >= model.circular_runout_tolerance_arena.items.len() {
31185                return Err(AuthorError::DanglingRef {
31186                    entity: "CIRCULAR_RUNOUT_TOLERANCE",
31187                });
31188            }
31189        }
31190        IdAttributeSelectRef::ClosedShell(i) => {
31191            if i.0 >= model.closed_shell_arena.items.len() {
31192                return Err(AuthorError::DanglingRef {
31193                    entity: "CLOSED_SHELL",
31194                });
31195            }
31196        }
31197        IdAttributeSelectRef::CoaxialityTolerance(i) => {
31198            if i.0 >= model.coaxiality_tolerance_arena.items.len() {
31199                return Err(AuthorError::DanglingRef {
31200                    entity: "COAXIALITY_TOLERANCE",
31201                });
31202            }
31203        }
31204        IdAttributeSelectRef::CommonDatum(i) => {
31205            if i.0 >= model.common_datum_arena.items.len() {
31206                return Err(AuthorError::DanglingRef {
31207                    entity: "COMMON_DATUM",
31208                });
31209            }
31210        }
31211        IdAttributeSelectRef::CompositeGroupShapeAspect(i) => {
31212            if i.0 >= model.composite_group_shape_aspect_arena.items.len() {
31213                return Err(AuthorError::DanglingRef {
31214                    entity: "COMPOSITE_GROUP_SHAPE_ASPECT",
31215                });
31216            }
31217        }
31218        IdAttributeSelectRef::CompositeShapeAspect(i) => {
31219            if i.0 >= model.composite_shape_aspect_arena.items.len() {
31220                return Err(AuthorError::DanglingRef {
31221                    entity: "COMPOSITE_SHAPE_ASPECT",
31222                });
31223            }
31224        }
31225        IdAttributeSelectRef::ConcentricityTolerance(i) => {
31226            if i.0 >= model.concentricity_tolerance_arena.items.len() {
31227                return Err(AuthorError::DanglingRef {
31228                    entity: "CONCENTRICITY_TOLERANCE",
31229                });
31230            }
31231        }
31232        IdAttributeSelectRef::ConnectedFaceSet(i) => {
31233            if i.0 >= model.connected_face_set_arena.items.len() {
31234                return Err(AuthorError::DanglingRef {
31235                    entity: "CONNECTED_FACE_SET",
31236                });
31237            }
31238        }
31239        IdAttributeSelectRef::ConstructiveGeometryRepresentation(i) => {
31240            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
31241                return Err(AuthorError::DanglingRef {
31242                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
31243                });
31244            }
31245        }
31246        IdAttributeSelectRef::ContinuousShapeAspect(i) => {
31247            if i.0 >= model.continuous_shape_aspect_arena.items.len() {
31248                return Err(AuthorError::DanglingRef {
31249                    entity: "CONTINUOUS_SHAPE_ASPECT",
31250                });
31251            }
31252        }
31253        IdAttributeSelectRef::CylindricityTolerance(i) => {
31254            if i.0 >= model.cylindricity_tolerance_arena.items.len() {
31255                return Err(AuthorError::DanglingRef {
31256                    entity: "CYLINDRICITY_TOLERANCE",
31257                });
31258            }
31259        }
31260        IdAttributeSelectRef::Datum(i) => {
31261            if i.0 >= model.datum_arena.items.len() {
31262                return Err(AuthorError::DanglingRef { entity: "DATUM" });
31263            }
31264        }
31265        IdAttributeSelectRef::DatumFeature(i) => {
31266            if i.0 >= model.datum_feature_arena.items.len() {
31267                return Err(AuthorError::DanglingRef {
31268                    entity: "DATUM_FEATURE",
31269                });
31270            }
31271        }
31272        IdAttributeSelectRef::DatumReferenceCompartment(i) => {
31273            if i.0 >= model.datum_reference_compartment_arena.items.len() {
31274                return Err(AuthorError::DanglingRef {
31275                    entity: "DATUM_REFERENCE_COMPARTMENT",
31276                });
31277            }
31278        }
31279        IdAttributeSelectRef::DatumReferenceElement(i) => {
31280            if i.0 >= model.datum_reference_element_arena.items.len() {
31281                return Err(AuthorError::DanglingRef {
31282                    entity: "DATUM_REFERENCE_ELEMENT",
31283                });
31284            }
31285        }
31286        IdAttributeSelectRef::DatumSystem(i) => {
31287            if i.0 >= model.datum_system_arena.items.len() {
31288                return Err(AuthorError::DanglingRef {
31289                    entity: "DATUM_SYSTEM",
31290                });
31291            }
31292        }
31293        IdAttributeSelectRef::DatumTarget(i) => {
31294            if i.0 >= model.datum_target_arena.items.len() {
31295                return Err(AuthorError::DanglingRef {
31296                    entity: "DATUM_TARGET",
31297                });
31298            }
31299        }
31300        IdAttributeSelectRef::DefaultModelGeometricView(i) => {
31301            if i.0 >= model.default_model_geometric_view_arena.items.len() {
31302                return Err(AuthorError::DanglingRef {
31303                    entity: "DEFAULT_MODEL_GEOMETRIC_VIEW",
31304                });
31305            }
31306        }
31307        IdAttributeSelectRef::DefinitionalRepresentation(i) => {
31308            if i.0 >= model.definitional_representation_arena.items.len() {
31309                return Err(AuthorError::DanglingRef {
31310                    entity: "DEFINITIONAL_REPRESENTATION",
31311                });
31312            }
31313        }
31314        IdAttributeSelectRef::DerivedShapeAspect(i) => {
31315            if i.0 >= model.derived_shape_aspect_arena.items.len() {
31316                return Err(AuthorError::DanglingRef {
31317                    entity: "DERIVED_SHAPE_ASPECT",
31318                });
31319            }
31320        }
31321        IdAttributeSelectRef::DimensionalLocation(i) => {
31322            if i.0 >= model.dimensional_location_arena.items.len() {
31323                return Err(AuthorError::DanglingRef {
31324                    entity: "DIMENSIONAL_LOCATION",
31325                });
31326            }
31327        }
31328        IdAttributeSelectRef::DimensionalLocationWithPath(i) => {
31329            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
31330                return Err(AuthorError::DanglingRef {
31331                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
31332                });
31333            }
31334        }
31335        IdAttributeSelectRef::DimensionalSize(i) => {
31336            if i.0 >= model.dimensional_size_arena.items.len() {
31337                return Err(AuthorError::DanglingRef {
31338                    entity: "DIMENSIONAL_SIZE",
31339                });
31340            }
31341        }
31342        IdAttributeSelectRef::DimensionalSizeWithDatumFeature(i) => {
31343            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
31344                return Err(AuthorError::DanglingRef {
31345                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
31346                });
31347            }
31348        }
31349        IdAttributeSelectRef::DimensionalSizeWithPath(i) => {
31350            if i.0 >= model.dimensional_size_with_path_arena.items.len() {
31351                return Err(AuthorError::DanglingRef {
31352                    entity: "DIMENSIONAL_SIZE_WITH_PATH",
31353                });
31354            }
31355        }
31356        IdAttributeSelectRef::DirectedDimensionalLocation(i) => {
31357            if i.0 >= model.directed_dimensional_location_arena.items.len() {
31358                return Err(AuthorError::DanglingRef {
31359                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
31360                });
31361            }
31362        }
31363        IdAttributeSelectRef::DraughtingModel(i) => {
31364            if i.0 >= model.draughting_model_arena.items.len() {
31365                return Err(AuthorError::DanglingRef {
31366                    entity: "DRAUGHTING_MODEL",
31367                });
31368            }
31369        }
31370        IdAttributeSelectRef::Edge(i) => {
31371            if i.0 >= model.edge_arena.items.len() {
31372                return Err(AuthorError::DanglingRef { entity: "EDGE" });
31373            }
31374        }
31375        IdAttributeSelectRef::EdgeCurve(i) => {
31376            if i.0 >= model.edge_curve_arena.items.len() {
31377                return Err(AuthorError::DanglingRef {
31378                    entity: "EDGE_CURVE",
31379                });
31380            }
31381        }
31382        IdAttributeSelectRef::EdgeLoop(i) => {
31383            if i.0 >= model.edge_loop_arena.items.len() {
31384                return Err(AuthorError::DanglingRef {
31385                    entity: "EDGE_LOOP",
31386                });
31387            }
31388        }
31389        IdAttributeSelectRef::Face(i) => {
31390            if i.0 >= model.face_arena.items.len() {
31391                return Err(AuthorError::DanglingRef { entity: "FACE" });
31392            }
31393        }
31394        IdAttributeSelectRef::FaceBound(i) => {
31395            if i.0 >= model.face_bound_arena.items.len() {
31396                return Err(AuthorError::DanglingRef {
31397                    entity: "FACE_BOUND",
31398                });
31399            }
31400        }
31401        IdAttributeSelectRef::FaceOuterBound(i) => {
31402            if i.0 >= model.face_outer_bound_arena.items.len() {
31403                return Err(AuthorError::DanglingRef {
31404                    entity: "FACE_OUTER_BOUND",
31405                });
31406            }
31407        }
31408        IdAttributeSelectRef::FaceSurface(i) => {
31409            if i.0 >= model.face_surface_arena.items.len() {
31410                return Err(AuthorError::DanglingRef {
31411                    entity: "FACE_SURFACE",
31412                });
31413            }
31414        }
31415        IdAttributeSelectRef::FeatureForDatumTargetRelationship(i) => {
31416            if i.0
31417                >= model
31418                    .feature_for_datum_target_relationship_arena
31419                    .items
31420                    .len()
31421            {
31422                return Err(AuthorError::DanglingRef {
31423                    entity: "FEATURE_FOR_DATUM_TARGET_RELATIONSHIP",
31424                });
31425            }
31426        }
31427        IdAttributeSelectRef::FlatnessTolerance(i) => {
31428            if i.0 >= model.flatness_tolerance_arena.items.len() {
31429                return Err(AuthorError::DanglingRef {
31430                    entity: "FLATNESS_TOLERANCE",
31431                });
31432            }
31433        }
31434        IdAttributeSelectRef::GeneralDatumReference(i) => {
31435            if i.0 >= model.general_datum_reference_arena.items.len() {
31436                return Err(AuthorError::DanglingRef {
31437                    entity: "GENERAL_DATUM_REFERENCE",
31438                });
31439            }
31440        }
31441        IdAttributeSelectRef::GeometricTolerance(i) => {
31442            if i.0 >= model.geometric_tolerance_arena.items.len() {
31443                return Err(AuthorError::DanglingRef {
31444                    entity: "GEOMETRIC_TOLERANCE",
31445                });
31446            }
31447        }
31448        IdAttributeSelectRef::GeometricToleranceWithDatumReference(i) => {
31449            if i.0
31450                >= model
31451                    .geometric_tolerance_with_datum_reference_arena
31452                    .items
31453                    .len()
31454            {
31455                return Err(AuthorError::DanglingRef {
31456                    entity: "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
31457                });
31458            }
31459        }
31460        IdAttributeSelectRef::GeometricToleranceWithDefinedAreaUnit(i) => {
31461            if i.0
31462                >= model
31463                    .geometric_tolerance_with_defined_area_unit_arena
31464                    .items
31465                    .len()
31466            {
31467                return Err(AuthorError::DanglingRef {
31468                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_AREA_UNIT",
31469                });
31470            }
31471        }
31472        IdAttributeSelectRef::GeometricToleranceWithDefinedUnit(i) => {
31473            if i.0
31474                >= model
31475                    .geometric_tolerance_with_defined_unit_arena
31476                    .items
31477                    .len()
31478            {
31479                return Err(AuthorError::DanglingRef {
31480                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_UNIT",
31481                });
31482            }
31483        }
31484        IdAttributeSelectRef::GeometricToleranceWithMaximumTolerance(i) => {
31485            if i.0
31486                >= model
31487                    .geometric_tolerance_with_maximum_tolerance_arena
31488                    .items
31489                    .len()
31490            {
31491                return Err(AuthorError::DanglingRef {
31492                    entity: "GEOMETRIC_TOLERANCE_WITH_MAXIMUM_TOLERANCE",
31493                });
31494            }
31495        }
31496        IdAttributeSelectRef::GeometricToleranceWithModifiers(i) => {
31497            if i.0 >= model.geometric_tolerance_with_modifiers_arena.items.len() {
31498                return Err(AuthorError::DanglingRef {
31499                    entity: "GEOMETRIC_TOLERANCE_WITH_MODIFIERS",
31500                });
31501            }
31502        }
31503        IdAttributeSelectRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
31504            if i.0
31505                >= model
31506                    .geometrically_bounded_surface_shape_representation_arena
31507                    .items
31508                    .len()
31509            {
31510                return Err(AuthorError::DanglingRef {
31511                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
31512                });
31513            }
31514        }
31515        IdAttributeSelectRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
31516            if i.0
31517                >= model
31518                    .geometrically_bounded_wireframe_shape_representation_arena
31519                    .items
31520                    .len()
31521            {
31522                return Err(AuthorError::DanglingRef {
31523                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
31524                });
31525            }
31526        }
31527        IdAttributeSelectRef::Group(i) => {
31528            if i.0 >= model.group_arena.items.len() {
31529                return Err(AuthorError::DanglingRef { entity: "GROUP" });
31530            }
31531        }
31532        IdAttributeSelectRef::LineProfileTolerance(i) => {
31533            if i.0 >= model.line_profile_tolerance_arena.items.len() {
31534                return Err(AuthorError::DanglingRef {
31535                    entity: "LINE_PROFILE_TOLERANCE",
31536                });
31537            }
31538        }
31539        IdAttributeSelectRef::Loop(i) => {
31540            if i.0 >= model.loop_arena.items.len() {
31541                return Err(AuthorError::DanglingRef { entity: "LOOP" });
31542            }
31543        }
31544        IdAttributeSelectRef::ManifoldSurfaceShapeRepresentation(i) => {
31545            if i.0
31546                >= model
31547                    .manifold_surface_shape_representation_arena
31548                    .items
31549                    .len()
31550            {
31551                return Err(AuthorError::DanglingRef {
31552                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
31553                });
31554            }
31555        }
31556        IdAttributeSelectRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
31557            if i.0
31558                >= model
31559                    .mechanical_design_geometric_presentation_representation_arena
31560                    .items
31561                    .len()
31562            {
31563                return Err(AuthorError::DanglingRef {
31564                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
31565                });
31566            }
31567        }
31568        IdAttributeSelectRef::MechanicalDesignPresentationRepresentationWithDraughting(i) => {
31569            if i.0
31570                >= model
31571                    .mechanical_design_presentation_representation_with_draughting_arena
31572                    .items
31573                    .len()
31574            {
31575                return Err(AuthorError::DanglingRef {
31576                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
31577                });
31578            }
31579        }
31580        IdAttributeSelectRef::MechanicalDesignShadedPresentationRepresentation(i) => {
31581            if i.0
31582                >= model
31583                    .mechanical_design_shaded_presentation_representation_arena
31584                    .items
31585                    .len()
31586            {
31587                return Err(AuthorError::DanglingRef {
31588                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
31589                });
31590            }
31591        }
31592        IdAttributeSelectRef::ModifiedGeometricTolerance(i) => {
31593            if i.0 >= model.modified_geometric_tolerance_arena.items.len() {
31594                return Err(AuthorError::DanglingRef {
31595                    entity: "MODIFIED_GEOMETRIC_TOLERANCE",
31596                });
31597            }
31598        }
31599        IdAttributeSelectRef::OpenShell(i) => {
31600            if i.0 >= model.open_shell_arena.items.len() {
31601                return Err(AuthorError::DanglingRef {
31602                    entity: "OPEN_SHELL",
31603                });
31604            }
31605        }
31606        IdAttributeSelectRef::OrganizationalAddress(i) => {
31607            if i.0 >= model.organizational_address_arena.items.len() {
31608                return Err(AuthorError::DanglingRef {
31609                    entity: "ORGANIZATIONAL_ADDRESS",
31610                });
31611            }
31612        }
31613        IdAttributeSelectRef::OrganizationalProject(i) => {
31614            if i.0 >= model.organizational_project_arena.items.len() {
31615                return Err(AuthorError::DanglingRef {
31616                    entity: "ORGANIZATIONAL_PROJECT",
31617                });
31618            }
31619        }
31620        IdAttributeSelectRef::OrientedClosedShell(i) => {
31621            if i.0 >= model.oriented_closed_shell_arena.items.len() {
31622                return Err(AuthorError::DanglingRef {
31623                    entity: "ORIENTED_CLOSED_SHELL",
31624                });
31625            }
31626        }
31627        IdAttributeSelectRef::OrientedEdge(i) => {
31628            if i.0 >= model.oriented_edge_arena.items.len() {
31629                return Err(AuthorError::DanglingRef {
31630                    entity: "ORIENTED_EDGE",
31631                });
31632            }
31633        }
31634        IdAttributeSelectRef::ParallelismTolerance(i) => {
31635            if i.0 >= model.parallelism_tolerance_arena.items.len() {
31636                return Err(AuthorError::DanglingRef {
31637                    entity: "PARALLELISM_TOLERANCE",
31638                });
31639            }
31640        }
31641        IdAttributeSelectRef::Path(i) => {
31642            if i.0 >= model.path_arena.items.len() {
31643                return Err(AuthorError::DanglingRef { entity: "PATH" });
31644            }
31645        }
31646        IdAttributeSelectRef::PerpendicularityTolerance(i) => {
31647            if i.0 >= model.perpendicularity_tolerance_arena.items.len() {
31648                return Err(AuthorError::DanglingRef {
31649                    entity: "PERPENDICULARITY_TOLERANCE",
31650                });
31651            }
31652        }
31653        IdAttributeSelectRef::PersonAndOrganizationAddress(i) => {
31654            if i.0 >= model.person_and_organization_address_arena.items.len() {
31655                return Err(AuthorError::DanglingRef {
31656                    entity: "PERSON_AND_ORGANIZATION_ADDRESS",
31657                });
31658            }
31659        }
31660        IdAttributeSelectRef::PersonalAddress(i) => {
31661            if i.0 >= model.personal_address_arena.items.len() {
31662                return Err(AuthorError::DanglingRef {
31663                    entity: "PERSONAL_ADDRESS",
31664                });
31665            }
31666        }
31667        IdAttributeSelectRef::PlacedDatumTargetFeature(i) => {
31668            if i.0 >= model.placed_datum_target_feature_arena.items.len() {
31669                return Err(AuthorError::DanglingRef {
31670                    entity: "PLACED_DATUM_TARGET_FEATURE",
31671                });
31672            }
31673        }
31674        IdAttributeSelectRef::PolyLoop(i) => {
31675            if i.0 >= model.poly_loop_arena.items.len() {
31676                return Err(AuthorError::DanglingRef {
31677                    entity: "POLY_LOOP",
31678                });
31679            }
31680        }
31681        IdAttributeSelectRef::PositionTolerance(i) => {
31682            if i.0 >= model.position_tolerance_arena.items.len() {
31683                return Err(AuthorError::DanglingRef {
31684                    entity: "POSITION_TOLERANCE",
31685                });
31686            }
31687        }
31688        IdAttributeSelectRef::PresentationArea(i) => {
31689            if i.0 >= model.presentation_area_arena.items.len() {
31690                return Err(AuthorError::DanglingRef {
31691                    entity: "PRESENTATION_AREA",
31692                });
31693            }
31694        }
31695        IdAttributeSelectRef::PresentationRepresentation(i) => {
31696            if i.0 >= model.presentation_representation_arena.items.len() {
31697                return Err(AuthorError::DanglingRef {
31698                    entity: "PRESENTATION_REPRESENTATION",
31699                });
31700            }
31701        }
31702        IdAttributeSelectRef::PresentationView(i) => {
31703            if i.0 >= model.presentation_view_arena.items.len() {
31704                return Err(AuthorError::DanglingRef {
31705                    entity: "PRESENTATION_VIEW",
31706                });
31707            }
31708        }
31709        IdAttributeSelectRef::ProductCategory(i) => {
31710            if i.0 >= model.product_category_arena.items.len() {
31711                return Err(AuthorError::DanglingRef {
31712                    entity: "PRODUCT_CATEGORY",
31713                });
31714            }
31715        }
31716        IdAttributeSelectRef::ProductConceptFeatureCategory(i) => {
31717            if i.0 >= model.product_concept_feature_category_arena.items.len() {
31718                return Err(AuthorError::DanglingRef {
31719                    entity: "PRODUCT_CONCEPT_FEATURE_CATEGORY",
31720                });
31721            }
31722        }
31723        IdAttributeSelectRef::ProductDefinitionShape(i) => {
31724            if i.0 >= model.product_definition_shape_arena.items.len() {
31725                return Err(AuthorError::DanglingRef {
31726                    entity: "PRODUCT_DEFINITION_SHAPE",
31727                });
31728            }
31729        }
31730        IdAttributeSelectRef::ProductRelatedProductCategory(i) => {
31731            if i.0 >= model.product_related_product_category_arena.items.len() {
31732                return Err(AuthorError::DanglingRef {
31733                    entity: "PRODUCT_RELATED_PRODUCT_CATEGORY",
31734                });
31735            }
31736        }
31737        IdAttributeSelectRef::PropertyDefinition(i) => {
31738            if i.0 >= model.property_definition_arena.items.len() {
31739                return Err(AuthorError::DanglingRef {
31740                    entity: "PROPERTY_DEFINITION",
31741                });
31742            }
31743        }
31744        IdAttributeSelectRef::Representation(i) => {
31745            if i.0 >= model.representation_arena.items.len() {
31746                return Err(AuthorError::DanglingRef {
31747                    entity: "REPRESENTATION",
31748                });
31749            }
31750        }
31751        IdAttributeSelectRef::RoundnessTolerance(i) => {
31752            if i.0 >= model.roundness_tolerance_arena.items.len() {
31753                return Err(AuthorError::DanglingRef {
31754                    entity: "ROUNDNESS_TOLERANCE",
31755                });
31756            }
31757        }
31758        IdAttributeSelectRef::ShapeAspect(i) => {
31759            if i.0 >= model.shape_aspect_arena.items.len() {
31760                return Err(AuthorError::DanglingRef {
31761                    entity: "SHAPE_ASPECT",
31762                });
31763            }
31764        }
31765        IdAttributeSelectRef::ShapeAspectAssociativity(i) => {
31766            if i.0 >= model.shape_aspect_associativity_arena.items.len() {
31767                return Err(AuthorError::DanglingRef {
31768                    entity: "SHAPE_ASPECT_ASSOCIATIVITY",
31769                });
31770            }
31771        }
31772        IdAttributeSelectRef::ShapeAspectDerivingRelationship(i) => {
31773            if i.0 >= model.shape_aspect_deriving_relationship_arena.items.len() {
31774                return Err(AuthorError::DanglingRef {
31775                    entity: "SHAPE_ASPECT_DERIVING_RELATIONSHIP",
31776                });
31777            }
31778        }
31779        IdAttributeSelectRef::ShapeAspectRelationship(i) => {
31780            if i.0 >= model.shape_aspect_relationship_arena.items.len() {
31781                return Err(AuthorError::DanglingRef {
31782                    entity: "SHAPE_ASPECT_RELATIONSHIP",
31783                });
31784            }
31785        }
31786        IdAttributeSelectRef::ShapeDimensionRepresentation(i) => {
31787            if i.0 >= model.shape_dimension_representation_arena.items.len() {
31788                return Err(AuthorError::DanglingRef {
31789                    entity: "SHAPE_DIMENSION_REPRESENTATION",
31790                });
31791            }
31792        }
31793        IdAttributeSelectRef::ShapeRepresentation(i) => {
31794            if i.0 >= model.shape_representation_arena.items.len() {
31795                return Err(AuthorError::DanglingRef {
31796                    entity: "SHAPE_REPRESENTATION",
31797                });
31798            }
31799        }
31800        IdAttributeSelectRef::ShapeRepresentationWithParameters(i) => {
31801            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
31802                return Err(AuthorError::DanglingRef {
31803                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
31804                });
31805            }
31806        }
31807        IdAttributeSelectRef::StraightnessTolerance(i) => {
31808            if i.0 >= model.straightness_tolerance_arena.items.len() {
31809                return Err(AuthorError::DanglingRef {
31810                    entity: "STRAIGHTNESS_TOLERANCE",
31811                });
31812            }
31813        }
31814        IdAttributeSelectRef::SurfaceProfileTolerance(i) => {
31815            if i.0 >= model.surface_profile_tolerance_arena.items.len() {
31816                return Err(AuthorError::DanglingRef {
31817                    entity: "SURFACE_PROFILE_TOLERANCE",
31818                });
31819            }
31820        }
31821        IdAttributeSelectRef::SymbolRepresentation(i) => {
31822            if i.0 >= model.symbol_representation_arena.items.len() {
31823                return Err(AuthorError::DanglingRef {
31824                    entity: "SYMBOL_REPRESENTATION",
31825                });
31826            }
31827        }
31828        IdAttributeSelectRef::SymmetryTolerance(i) => {
31829            if i.0 >= model.symmetry_tolerance_arena.items.len() {
31830                return Err(AuthorError::DanglingRef {
31831                    entity: "SYMMETRY_TOLERANCE",
31832                });
31833            }
31834        }
31835        IdAttributeSelectRef::TessellatedShapeRepresentation(i) => {
31836            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
31837                return Err(AuthorError::DanglingRef {
31838                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
31839                });
31840            }
31841        }
31842        IdAttributeSelectRef::ToleranceZone(i) => {
31843            if i.0 >= model.tolerance_zone_arena.items.len() {
31844                return Err(AuthorError::DanglingRef {
31845                    entity: "TOLERANCE_ZONE",
31846                });
31847            }
31848        }
31849        IdAttributeSelectRef::ToleranceZoneWithDatum(i) => {
31850            if i.0 >= model.tolerance_zone_with_datum_arena.items.len() {
31851                return Err(AuthorError::DanglingRef {
31852                    entity: "TOLERANCE_ZONE_WITH_DATUM",
31853                });
31854            }
31855        }
31856        IdAttributeSelectRef::TopologicalRepresentationItem(i) => {
31857            if i.0 >= model.topological_representation_item_arena.items.len() {
31858                return Err(AuthorError::DanglingRef {
31859                    entity: "TOPOLOGICAL_REPRESENTATION_ITEM",
31860                });
31861            }
31862        }
31863        IdAttributeSelectRef::TotalRunoutTolerance(i) => {
31864            if i.0 >= model.total_runout_tolerance_arena.items.len() {
31865                return Err(AuthorError::DanglingRef {
31866                    entity: "TOTAL_RUNOUT_TOLERANCE",
31867                });
31868            }
31869        }
31870        IdAttributeSelectRef::UnequallyDisposedGeometricTolerance(i) => {
31871            if i.0
31872                >= model
31873                    .unequally_disposed_geometric_tolerance_arena
31874                    .items
31875                    .len()
31876            {
31877                return Err(AuthorError::DanglingRef {
31878                    entity: "UNEQUALLY_DISPOSED_GEOMETRIC_TOLERANCE",
31879                });
31880            }
31881        }
31882        IdAttributeSelectRef::Vertex(i) => {
31883            if i.0 >= model.vertex_arena.items.len() {
31884                return Err(AuthorError::DanglingRef { entity: "VERTEX" });
31885            }
31886        }
31887        IdAttributeSelectRef::VertexLoop(i) => {
31888            if i.0 >= model.vertex_loop_arena.items.len() {
31889                return Err(AuthorError::DanglingRef {
31890                    entity: "VERTEX_LOOP",
31891                });
31892            }
31893        }
31894        IdAttributeSelectRef::VertexPoint(i) => {
31895            if i.0 >= model.vertex_point_arena.items.len() {
31896                return Err(AuthorError::DanglingRef {
31897                    entity: "VERTEX_POINT",
31898                });
31899            }
31900        }
31901        IdAttributeSelectRef::VertexShell(i) => {
31902            if i.0 >= model.vertex_shell_arena.items.len() {
31903                return Err(AuthorError::DanglingRef {
31904                    entity: "VERTEX_SHELL",
31905                });
31906            }
31907        }
31908        IdAttributeSelectRef::WireShell(i) => {
31909            if i.0 >= model.wire_shell_arena.items.len() {
31910                return Err(AuthorError::DanglingRef {
31911                    entity: "WIRE_SHELL",
31912                });
31913            }
31914        }
31915        IdAttributeSelectRef::Complex(i) => {
31916            if i.0 >= model.complex_unit_arena.items.len() {
31917                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
31918            }
31919        }
31920    }
31921    Ok(())
31922}
31923fn check_identification_role_ref(
31924    model: &StepModel,
31925    r: &IdentificationRoleRef,
31926) -> Result<(), AuthorError> {
31927    match r {
31928        IdentificationRoleRef::IdentificationRole(i) => {
31929            if i.0 >= model.identification_role_arena.items.len() {
31930                return Err(AuthorError::DanglingRef {
31931                    entity: "IDENTIFICATION_ROLE",
31932                });
31933            }
31934        }
31935    }
31936    Ok(())
31937}
31938fn check_invisible_item_ref(model: &StepModel, r: &InvisibleItemRef) -> Result<(), AuthorError> {
31939    match r {
31940        InvisibleItemRef::AdvancedBrepShapeRepresentation(i) => {
31941            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
31942                return Err(AuthorError::DanglingRef {
31943                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
31944                });
31945            }
31946        }
31947        InvisibleItemRef::AnnotationCurveOccurrence(i) => {
31948            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
31949                return Err(AuthorError::DanglingRef {
31950                    entity: "ANNOTATION_CURVE_OCCURRENCE",
31951                });
31952            }
31953        }
31954        InvisibleItemRef::AnnotationFillAreaOccurrence(i) => {
31955            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
31956                return Err(AuthorError::DanglingRef {
31957                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
31958                });
31959            }
31960        }
31961        InvisibleItemRef::AnnotationOccurrence(i) => {
31962            if i.0 >= model.annotation_occurrence_arena.items.len() {
31963                return Err(AuthorError::DanglingRef {
31964                    entity: "ANNOTATION_OCCURRENCE",
31965                });
31966            }
31967        }
31968        InvisibleItemRef::AnnotationPlaceholderOccurrence(i) => {
31969            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
31970                return Err(AuthorError::DanglingRef {
31971                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
31972                });
31973            }
31974        }
31975        InvisibleItemRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
31976            return Err(AuthorError::NotAp242 {
31977                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
31978            });
31979        }
31980        InvisibleItemRef::AnnotationPlane(i) => {
31981            if i.0 >= model.annotation_plane_arena.items.len() {
31982                return Err(AuthorError::DanglingRef {
31983                    entity: "ANNOTATION_PLANE",
31984                });
31985            }
31986        }
31987        InvisibleItemRef::AnnotationSymbolOccurrence(i) => {
31988            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
31989                return Err(AuthorError::DanglingRef {
31990                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
31991                });
31992            }
31993        }
31994        InvisibleItemRef::AnnotationTextOccurrence(i) => {
31995            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
31996                return Err(AuthorError::DanglingRef {
31997                    entity: "ANNOTATION_TEXT_OCCURRENCE",
31998                });
31999            }
32000        }
32001        InvisibleItemRef::CharacterizedRepresentation(i) => {
32002            if i.0 >= model.characterized_representation_arena.items.len() {
32003                return Err(AuthorError::DanglingRef {
32004                    entity: "CHARACTERIZED_REPRESENTATION",
32005                });
32006            }
32007        }
32008        InvisibleItemRef::ConstructiveGeometryRepresentation(i) => {
32009            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
32010                return Err(AuthorError::DanglingRef {
32011                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
32012                });
32013            }
32014        }
32015        InvisibleItemRef::ContextDependentOverRidingStyledItem(i) => {
32016            if i.0
32017                >= model
32018                    .context_dependent_over_riding_styled_item_arena
32019                    .items
32020                    .len()
32021            {
32022                return Err(AuthorError::DanglingRef {
32023                    entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
32024                });
32025            }
32026        }
32027        InvisibleItemRef::DefinitionalRepresentation(i) => {
32028            if i.0 >= model.definitional_representation_arena.items.len() {
32029                return Err(AuthorError::DanglingRef {
32030                    entity: "DEFINITIONAL_REPRESENTATION",
32031                });
32032            }
32033        }
32034        InvisibleItemRef::DraughtingAnnotationOccurrence(i) => {
32035            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
32036                return Err(AuthorError::DanglingRef {
32037                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
32038                });
32039            }
32040        }
32041        InvisibleItemRef::DraughtingCallout(i) => {
32042            if i.0 >= model.draughting_callout_arena.items.len() {
32043                return Err(AuthorError::DanglingRef {
32044                    entity: "DRAUGHTING_CALLOUT",
32045                });
32046            }
32047        }
32048        InvisibleItemRef::DraughtingModel(i) => {
32049            if i.0 >= model.draughting_model_arena.items.len() {
32050                return Err(AuthorError::DanglingRef {
32051                    entity: "DRAUGHTING_MODEL",
32052                });
32053            }
32054        }
32055        InvisibleItemRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
32056            if i.0
32057                >= model
32058                    .geometrically_bounded_surface_shape_representation_arena
32059                    .items
32060                    .len()
32061            {
32062                return Err(AuthorError::DanglingRef {
32063                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
32064                });
32065            }
32066        }
32067        InvisibleItemRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
32068            if i.0
32069                >= model
32070                    .geometrically_bounded_wireframe_shape_representation_arena
32071                    .items
32072                    .len()
32073            {
32074                return Err(AuthorError::DanglingRef {
32075                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
32076                });
32077            }
32078        }
32079        InvisibleItemRef::LeaderCurve(i) => {
32080            if i.0 >= model.leader_curve_arena.items.len() {
32081                return Err(AuthorError::DanglingRef {
32082                    entity: "LEADER_CURVE",
32083                });
32084            }
32085        }
32086        InvisibleItemRef::LeaderDirectedCallout(i) => {
32087            if i.0 >= model.leader_directed_callout_arena.items.len() {
32088                return Err(AuthorError::DanglingRef {
32089                    entity: "LEADER_DIRECTED_CALLOUT",
32090                });
32091            }
32092        }
32093        InvisibleItemRef::LeaderTerminator(i) => {
32094            if i.0 >= model.leader_terminator_arena.items.len() {
32095                return Err(AuthorError::DanglingRef {
32096                    entity: "LEADER_TERMINATOR",
32097                });
32098            }
32099        }
32100        InvisibleItemRef::ManifoldSurfaceShapeRepresentation(i) => {
32101            if i.0
32102                >= model
32103                    .manifold_surface_shape_representation_arena
32104                    .items
32105                    .len()
32106            {
32107                return Err(AuthorError::DanglingRef {
32108                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
32109                });
32110            }
32111        }
32112        InvisibleItemRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
32113            if i.0
32114                >= model
32115                    .mechanical_design_geometric_presentation_representation_arena
32116                    .items
32117                    .len()
32118            {
32119                return Err(AuthorError::DanglingRef {
32120                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
32121                });
32122            }
32123        }
32124        InvisibleItemRef::MechanicalDesignPresentationRepresentationWithDraughting(i) => {
32125            if i.0
32126                >= model
32127                    .mechanical_design_presentation_representation_with_draughting_arena
32128                    .items
32129                    .len()
32130            {
32131                return Err(AuthorError::DanglingRef {
32132                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
32133                });
32134            }
32135        }
32136        InvisibleItemRef::MechanicalDesignShadedPresentationRepresentation(i) => {
32137            if i.0
32138                >= model
32139                    .mechanical_design_shaded_presentation_representation_arena
32140                    .items
32141                    .len()
32142            {
32143                return Err(AuthorError::DanglingRef {
32144                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
32145                });
32146            }
32147        }
32148        InvisibleItemRef::OverRidingStyledItem(i) => {
32149            if i.0 >= model.over_riding_styled_item_arena.items.len() {
32150                return Err(AuthorError::DanglingRef {
32151                    entity: "OVER_RIDING_STYLED_ITEM",
32152                });
32153            }
32154        }
32155        InvisibleItemRef::PresentationArea(i) => {
32156            if i.0 >= model.presentation_area_arena.items.len() {
32157                return Err(AuthorError::DanglingRef {
32158                    entity: "PRESENTATION_AREA",
32159                });
32160            }
32161        }
32162        InvisibleItemRef::PresentationLayerAssignment(i) => {
32163            if i.0 >= model.presentation_layer_assignment_arena.items.len() {
32164                return Err(AuthorError::DanglingRef {
32165                    entity: "PRESENTATION_LAYER_ASSIGNMENT",
32166                });
32167            }
32168        }
32169        InvisibleItemRef::PresentationRepresentation(i) => {
32170            if i.0 >= model.presentation_representation_arena.items.len() {
32171                return Err(AuthorError::DanglingRef {
32172                    entity: "PRESENTATION_REPRESENTATION",
32173                });
32174            }
32175        }
32176        InvisibleItemRef::PresentationView(i) => {
32177            if i.0 >= model.presentation_view_arena.items.len() {
32178                return Err(AuthorError::DanglingRef {
32179                    entity: "PRESENTATION_VIEW",
32180                });
32181            }
32182        }
32183        InvisibleItemRef::Representation(i) => {
32184            if i.0 >= model.representation_arena.items.len() {
32185                return Err(AuthorError::DanglingRef {
32186                    entity: "REPRESENTATION",
32187                });
32188            }
32189        }
32190        InvisibleItemRef::ShapeDimensionRepresentation(i) => {
32191            if i.0 >= model.shape_dimension_representation_arena.items.len() {
32192                return Err(AuthorError::DanglingRef {
32193                    entity: "SHAPE_DIMENSION_REPRESENTATION",
32194                });
32195            }
32196        }
32197        InvisibleItemRef::ShapeRepresentation(i) => {
32198            if i.0 >= model.shape_representation_arena.items.len() {
32199                return Err(AuthorError::DanglingRef {
32200                    entity: "SHAPE_REPRESENTATION",
32201                });
32202            }
32203        }
32204        InvisibleItemRef::ShapeRepresentationWithParameters(i) => {
32205            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
32206                return Err(AuthorError::DanglingRef {
32207                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
32208                });
32209            }
32210        }
32211        InvisibleItemRef::StyledItem(i) => {
32212            if i.0 >= model.styled_item_arena.items.len() {
32213                return Err(AuthorError::DanglingRef {
32214                    entity: "STYLED_ITEM",
32215                });
32216            }
32217        }
32218        InvisibleItemRef::SymbolRepresentation(i) => {
32219            if i.0 >= model.symbol_representation_arena.items.len() {
32220                return Err(AuthorError::DanglingRef {
32221                    entity: "SYMBOL_REPRESENTATION",
32222                });
32223            }
32224        }
32225        InvisibleItemRef::TerminatorSymbol(i) => {
32226            if i.0 >= model.terminator_symbol_arena.items.len() {
32227                return Err(AuthorError::DanglingRef {
32228                    entity: "TERMINATOR_SYMBOL",
32229                });
32230            }
32231        }
32232        InvisibleItemRef::TessellatedAnnotationOccurrence(i) => {
32233            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
32234                return Err(AuthorError::DanglingRef {
32235                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
32236                });
32237            }
32238        }
32239        InvisibleItemRef::TessellatedShapeRepresentation(i) => {
32240            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
32241                return Err(AuthorError::DanglingRef {
32242                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
32243                });
32244            }
32245        }
32246        InvisibleItemRef::Complex(i) => {
32247            if i.0 >= model.complex_unit_arena.items.len() {
32248                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
32249            }
32250        }
32251    }
32252    Ok(())
32253}
32254fn check_item_defined_transformation_ref(
32255    model: &StepModel,
32256    r: &ItemDefinedTransformationRef,
32257) -> Result<(), AuthorError> {
32258    match r {
32259        ItemDefinedTransformationRef::ItemDefinedTransformation(i) => {
32260            if i.0 >= model.item_defined_transformation_arena.items.len() {
32261                return Err(AuthorError::DanglingRef {
32262                    entity: "ITEM_DEFINED_TRANSFORMATION",
32263                });
32264            }
32265        }
32266        ItemDefinedTransformationRef::Complex(i) => {
32267            if i.0 >= model.complex_unit_arena.items.len() {
32268                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
32269            }
32270        }
32271    }
32272    Ok(())
32273}
32274fn check_item_identified_representation_usage_definition_ref(
32275    model: &StepModel,
32276    r: &ItemIdentifiedRepresentationUsageDefinitionRef,
32277) -> Result<(), AuthorError> {
32278    match r {
32279        ItemIdentifiedRepresentationUsageDefinitionRef::AllAroundShapeAspect(i) => {
32280            if i.0 >= model.all_around_shape_aspect_arena.items.len() {
32281                return Err(AuthorError::DanglingRef {
32282                    entity: "ALL_AROUND_SHAPE_ASPECT",
32283                });
32284            }
32285        }
32286        ItemIdentifiedRepresentationUsageDefinitionRef::AngularLocation(i) => {
32287            if i.0 >= model.angular_location_arena.items.len() {
32288                return Err(AuthorError::DanglingRef {
32289                    entity: "ANGULAR_LOCATION",
32290                });
32291            }
32292        }
32293        ItemIdentifiedRepresentationUsageDefinitionRef::AngularSize(i) => {
32294            if i.0 >= model.angular_size_arena.items.len() {
32295                return Err(AuthorError::DanglingRef {
32296                    entity: "ANGULAR_SIZE",
32297                });
32298            }
32299        }
32300        ItemIdentifiedRepresentationUsageDefinitionRef::AngularityTolerance(i) => {
32301            if i.0 >= model.angularity_tolerance_arena.items.len() {
32302                return Err(AuthorError::DanglingRef {
32303                    entity: "ANGULARITY_TOLERANCE",
32304                });
32305            }
32306        }
32307        ItemIdentifiedRepresentationUsageDefinitionRef::AppliedApprovalAssignment(i) => {
32308            if i.0 >= model.applied_approval_assignment_arena.items.len() {
32309                return Err(AuthorError::DanglingRef {
32310                    entity: "APPLIED_APPROVAL_ASSIGNMENT",
32311                });
32312            }
32313        }
32314        ItemIdentifiedRepresentationUsageDefinitionRef::AppliedDateAndTimeAssignment(i) => {
32315            if i.0 >= model.applied_date_and_time_assignment_arena.items.len() {
32316                return Err(AuthorError::DanglingRef {
32317                    entity: "APPLIED_DATE_AND_TIME_ASSIGNMENT",
32318                });
32319            }
32320        }
32321        ItemIdentifiedRepresentationUsageDefinitionRef::AppliedDocumentReference(i) => {
32322            if i.0 >= model.applied_document_reference_arena.items.len() {
32323                return Err(AuthorError::DanglingRef {
32324                    entity: "APPLIED_DOCUMENT_REFERENCE",
32325                });
32326            }
32327        }
32328        ItemIdentifiedRepresentationUsageDefinitionRef::AppliedExternalIdentificationAssignment(
32329            i,
32330        ) => {
32331            if i.0
32332                >= model
32333                    .applied_external_identification_assignment_arena
32334                    .items
32335                    .len()
32336            {
32337                return Err(AuthorError::DanglingRef {
32338                    entity: "APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT",
32339                });
32340            }
32341        }
32342        ItemIdentifiedRepresentationUsageDefinitionRef::AppliedGroupAssignment(i) => {
32343            if i.0 >= model.applied_group_assignment_arena.items.len() {
32344                return Err(AuthorError::DanglingRef {
32345                    entity: "APPLIED_GROUP_ASSIGNMENT",
32346                });
32347            }
32348        }
32349        ItemIdentifiedRepresentationUsageDefinitionRef::AppliedPersonAndOrganizationAssignment(
32350            i,
32351        ) => {
32352            if i.0
32353                >= model
32354                    .applied_person_and_organization_assignment_arena
32355                    .items
32356                    .len()
32357            {
32358                return Err(AuthorError::DanglingRef {
32359                    entity: "APPLIED_PERSON_AND_ORGANIZATION_ASSIGNMENT",
32360                });
32361            }
32362        }
32363        ItemIdentifiedRepresentationUsageDefinitionRef::AssemblyComponentUsage(i) => {
32364            if i.0 >= model.assembly_component_usage_arena.items.len() {
32365                return Err(AuthorError::DanglingRef {
32366                    entity: "ASSEMBLY_COMPONENT_USAGE",
32367                });
32368            }
32369        }
32370        ItemIdentifiedRepresentationUsageDefinitionRef::CentreOfSymmetry(i) => {
32371            if i.0 >= model.centre_of_symmetry_arena.items.len() {
32372                return Err(AuthorError::DanglingRef {
32373                    entity: "CENTRE_OF_SYMMETRY",
32374                });
32375            }
32376        }
32377        ItemIdentifiedRepresentationUsageDefinitionRef::CharacterizedItemWithinRepresentation(
32378            i,
32379        ) => {
32380            if i.0
32381                >= model
32382                    .characterized_item_within_representation_arena
32383                    .items
32384                    .len()
32385            {
32386                return Err(AuthorError::DanglingRef {
32387                    entity: "CHARACTERIZED_ITEM_WITHIN_REPRESENTATION",
32388                });
32389            }
32390        }
32391        ItemIdentifiedRepresentationUsageDefinitionRef::CharacterizedObject(i) => {
32392            if i.0 >= model.characterized_object_arena.items.len() {
32393                return Err(AuthorError::DanglingRef {
32394                    entity: "CHARACTERIZED_OBJECT",
32395                });
32396            }
32397        }
32398        ItemIdentifiedRepresentationUsageDefinitionRef::CharacterizedRepresentation(i) => {
32399            if i.0 >= model.characterized_representation_arena.items.len() {
32400                return Err(AuthorError::DanglingRef {
32401                    entity: "CHARACTERIZED_REPRESENTATION",
32402                });
32403            }
32404        }
32405        ItemIdentifiedRepresentationUsageDefinitionRef::CircularRunoutTolerance(i) => {
32406            if i.0 >= model.circular_runout_tolerance_arena.items.len() {
32407                return Err(AuthorError::DanglingRef {
32408                    entity: "CIRCULAR_RUNOUT_TOLERANCE",
32409                });
32410            }
32411        }
32412        ItemIdentifiedRepresentationUsageDefinitionRef::CoaxialityTolerance(i) => {
32413            if i.0 >= model.coaxiality_tolerance_arena.items.len() {
32414                return Err(AuthorError::DanglingRef {
32415                    entity: "COAXIALITY_TOLERANCE",
32416                });
32417            }
32418        }
32419        ItemIdentifiedRepresentationUsageDefinitionRef::CommonDatum(i) => {
32420            if i.0 >= model.common_datum_arena.items.len() {
32421                return Err(AuthorError::DanglingRef {
32422                    entity: "COMMON_DATUM",
32423                });
32424            }
32425        }
32426        ItemIdentifiedRepresentationUsageDefinitionRef::CompositeGroupShapeAspect(i) => {
32427            if i.0 >= model.composite_group_shape_aspect_arena.items.len() {
32428                return Err(AuthorError::DanglingRef {
32429                    entity: "COMPOSITE_GROUP_SHAPE_ASPECT",
32430                });
32431            }
32432        }
32433        ItemIdentifiedRepresentationUsageDefinitionRef::CompositeShapeAspect(i) => {
32434            if i.0 >= model.composite_shape_aspect_arena.items.len() {
32435                return Err(AuthorError::DanglingRef {
32436                    entity: "COMPOSITE_SHAPE_ASPECT",
32437                });
32438            }
32439        }
32440        ItemIdentifiedRepresentationUsageDefinitionRef::ConcentricityTolerance(i) => {
32441            if i.0 >= model.concentricity_tolerance_arena.items.len() {
32442                return Err(AuthorError::DanglingRef {
32443                    entity: "CONCENTRICITY_TOLERANCE",
32444                });
32445            }
32446        }
32447        ItemIdentifiedRepresentationUsageDefinitionRef::ContinuousShapeAspect(i) => {
32448            if i.0 >= model.continuous_shape_aspect_arena.items.len() {
32449                return Err(AuthorError::DanglingRef {
32450                    entity: "CONTINUOUS_SHAPE_ASPECT",
32451                });
32452            }
32453        }
32454        ItemIdentifiedRepresentationUsageDefinitionRef::CylindricityTolerance(i) => {
32455            if i.0 >= model.cylindricity_tolerance_arena.items.len() {
32456                return Err(AuthorError::DanglingRef {
32457                    entity: "CYLINDRICITY_TOLERANCE",
32458                });
32459            }
32460        }
32461        ItemIdentifiedRepresentationUsageDefinitionRef::Datum(i) => {
32462            if i.0 >= model.datum_arena.items.len() {
32463                return Err(AuthorError::DanglingRef { entity: "DATUM" });
32464            }
32465        }
32466        ItemIdentifiedRepresentationUsageDefinitionRef::DatumFeature(i) => {
32467            if i.0 >= model.datum_feature_arena.items.len() {
32468                return Err(AuthorError::DanglingRef {
32469                    entity: "DATUM_FEATURE",
32470                });
32471            }
32472        }
32473        ItemIdentifiedRepresentationUsageDefinitionRef::DatumReferenceCompartment(i) => {
32474            if i.0 >= model.datum_reference_compartment_arena.items.len() {
32475                return Err(AuthorError::DanglingRef {
32476                    entity: "DATUM_REFERENCE_COMPARTMENT",
32477                });
32478            }
32479        }
32480        ItemIdentifiedRepresentationUsageDefinitionRef::DatumReferenceElement(i) => {
32481            if i.0 >= model.datum_reference_element_arena.items.len() {
32482                return Err(AuthorError::DanglingRef {
32483                    entity: "DATUM_REFERENCE_ELEMENT",
32484                });
32485            }
32486        }
32487        ItemIdentifiedRepresentationUsageDefinitionRef::DatumSystem(i) => {
32488            if i.0 >= model.datum_system_arena.items.len() {
32489                return Err(AuthorError::DanglingRef {
32490                    entity: "DATUM_SYSTEM",
32491                });
32492            }
32493        }
32494        ItemIdentifiedRepresentationUsageDefinitionRef::DatumTarget(i) => {
32495            if i.0 >= model.datum_target_arena.items.len() {
32496                return Err(AuthorError::DanglingRef {
32497                    entity: "DATUM_TARGET",
32498                });
32499            }
32500        }
32501        ItemIdentifiedRepresentationUsageDefinitionRef::DefaultModelGeometricView(i) => {
32502            if i.0 >= model.default_model_geometric_view_arena.items.len() {
32503                return Err(AuthorError::DanglingRef {
32504                    entity: "DEFAULT_MODEL_GEOMETRIC_VIEW",
32505                });
32506            }
32507        }
32508        ItemIdentifiedRepresentationUsageDefinitionRef::DerivedShapeAspect(i) => {
32509            if i.0 >= model.derived_shape_aspect_arena.items.len() {
32510                return Err(AuthorError::DanglingRef {
32511                    entity: "DERIVED_SHAPE_ASPECT",
32512                });
32513            }
32514        }
32515        ItemIdentifiedRepresentationUsageDefinitionRef::DimensionalLocation(i) => {
32516            if i.0 >= model.dimensional_location_arena.items.len() {
32517                return Err(AuthorError::DanglingRef {
32518                    entity: "DIMENSIONAL_LOCATION",
32519                });
32520            }
32521        }
32522        ItemIdentifiedRepresentationUsageDefinitionRef::DimensionalLocationWithPath(i) => {
32523            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
32524                return Err(AuthorError::DanglingRef {
32525                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
32526                });
32527            }
32528        }
32529        ItemIdentifiedRepresentationUsageDefinitionRef::DimensionalSize(i) => {
32530            if i.0 >= model.dimensional_size_arena.items.len() {
32531                return Err(AuthorError::DanglingRef {
32532                    entity: "DIMENSIONAL_SIZE",
32533                });
32534            }
32535        }
32536        ItemIdentifiedRepresentationUsageDefinitionRef::DimensionalSizeWithDatumFeature(i) => {
32537            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
32538                return Err(AuthorError::DanglingRef {
32539                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
32540                });
32541            }
32542        }
32543        ItemIdentifiedRepresentationUsageDefinitionRef::DimensionalSizeWithPath(i) => {
32544            if i.0 >= model.dimensional_size_with_path_arena.items.len() {
32545                return Err(AuthorError::DanglingRef {
32546                    entity: "DIMENSIONAL_SIZE_WITH_PATH",
32547                });
32548            }
32549        }
32550        ItemIdentifiedRepresentationUsageDefinitionRef::DirectedDimensionalLocation(i) => {
32551            if i.0 >= model.directed_dimensional_location_arena.items.len() {
32552                return Err(AuthorError::DanglingRef {
32553                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
32554                });
32555            }
32556        }
32557        ItemIdentifiedRepresentationUsageDefinitionRef::DocumentFile(i) => {
32558            if i.0 >= model.document_file_arena.items.len() {
32559                return Err(AuthorError::DanglingRef {
32560                    entity: "DOCUMENT_FILE",
32561                });
32562            }
32563        }
32564        ItemIdentifiedRepresentationUsageDefinitionRef::FeatureForDatumTargetRelationship(i) => {
32565            if i.0
32566                >= model
32567                    .feature_for_datum_target_relationship_arena
32568                    .items
32569                    .len()
32570            {
32571                return Err(AuthorError::DanglingRef {
32572                    entity: "FEATURE_FOR_DATUM_TARGET_RELATIONSHIP",
32573                });
32574            }
32575        }
32576        ItemIdentifiedRepresentationUsageDefinitionRef::FlatnessTolerance(i) => {
32577            if i.0 >= model.flatness_tolerance_arena.items.len() {
32578                return Err(AuthorError::DanglingRef {
32579                    entity: "FLATNESS_TOLERANCE",
32580                });
32581            }
32582        }
32583        ItemIdentifiedRepresentationUsageDefinitionRef::GeneralDatumReference(i) => {
32584            if i.0 >= model.general_datum_reference_arena.items.len() {
32585                return Err(AuthorError::DanglingRef {
32586                    entity: "GENERAL_DATUM_REFERENCE",
32587                });
32588            }
32589        }
32590        ItemIdentifiedRepresentationUsageDefinitionRef::GeneralProperty(i) => {
32591            if i.0 >= model.general_property_arena.items.len() {
32592                return Err(AuthorError::DanglingRef {
32593                    entity: "GENERAL_PROPERTY",
32594                });
32595            }
32596        }
32597        ItemIdentifiedRepresentationUsageDefinitionRef::GeometricTolerance(i) => {
32598            if i.0 >= model.geometric_tolerance_arena.items.len() {
32599                return Err(AuthorError::DanglingRef {
32600                    entity: "GEOMETRIC_TOLERANCE",
32601                });
32602            }
32603        }
32604        ItemIdentifiedRepresentationUsageDefinitionRef::GeometricToleranceWithDatumReference(i) => {
32605            if i.0
32606                >= model
32607                    .geometric_tolerance_with_datum_reference_arena
32608                    .items
32609                    .len()
32610            {
32611                return Err(AuthorError::DanglingRef {
32612                    entity: "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
32613                });
32614            }
32615        }
32616        ItemIdentifiedRepresentationUsageDefinitionRef::GeometricToleranceWithDefinedAreaUnit(
32617            i,
32618        ) => {
32619            if i.0
32620                >= model
32621                    .geometric_tolerance_with_defined_area_unit_arena
32622                    .items
32623                    .len()
32624            {
32625                return Err(AuthorError::DanglingRef {
32626                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_AREA_UNIT",
32627                });
32628            }
32629        }
32630        ItemIdentifiedRepresentationUsageDefinitionRef::GeometricToleranceWithDefinedUnit(i) => {
32631            if i.0
32632                >= model
32633                    .geometric_tolerance_with_defined_unit_arena
32634                    .items
32635                    .len()
32636            {
32637                return Err(AuthorError::DanglingRef {
32638                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_UNIT",
32639                });
32640            }
32641        }
32642        ItemIdentifiedRepresentationUsageDefinitionRef::GeometricToleranceWithMaximumTolerance(
32643            i,
32644        ) => {
32645            if i.0
32646                >= model
32647                    .geometric_tolerance_with_maximum_tolerance_arena
32648                    .items
32649                    .len()
32650            {
32651                return Err(AuthorError::DanglingRef {
32652                    entity: "GEOMETRIC_TOLERANCE_WITH_MAXIMUM_TOLERANCE",
32653                });
32654            }
32655        }
32656        ItemIdentifiedRepresentationUsageDefinitionRef::GeometricToleranceWithModifiers(i) => {
32657            if i.0 >= model.geometric_tolerance_with_modifiers_arena.items.len() {
32658                return Err(AuthorError::DanglingRef {
32659                    entity: "GEOMETRIC_TOLERANCE_WITH_MODIFIERS",
32660                });
32661            }
32662        }
32663        ItemIdentifiedRepresentationUsageDefinitionRef::LineProfileTolerance(i) => {
32664            if i.0 >= model.line_profile_tolerance_arena.items.len() {
32665                return Err(AuthorError::DanglingRef {
32666                    entity: "LINE_PROFILE_TOLERANCE",
32667                });
32668            }
32669        }
32670        ItemIdentifiedRepresentationUsageDefinitionRef::MakeFromUsageOption(i) => {
32671            if i.0 >= model.make_from_usage_option_arena.items.len() {
32672                return Err(AuthorError::DanglingRef {
32673                    entity: "MAKE_FROM_USAGE_OPTION",
32674                });
32675            }
32676        }
32677        ItemIdentifiedRepresentationUsageDefinitionRef::ModelGeometricView(i) => {
32678            if i.0 >= model.model_geometric_view_arena.items.len() {
32679                return Err(AuthorError::DanglingRef {
32680                    entity: "MODEL_GEOMETRIC_VIEW",
32681                });
32682            }
32683        }
32684        ItemIdentifiedRepresentationUsageDefinitionRef::ModifiedGeometricTolerance(i) => {
32685            if i.0 >= model.modified_geometric_tolerance_arena.items.len() {
32686                return Err(AuthorError::DanglingRef {
32687                    entity: "MODIFIED_GEOMETRIC_TOLERANCE",
32688                });
32689            }
32690        }
32691        ItemIdentifiedRepresentationUsageDefinitionRef::NextAssemblyUsageOccurrence(i) => {
32692            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
32693                return Err(AuthorError::DanglingRef {
32694                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
32695                });
32696            }
32697        }
32698        ItemIdentifiedRepresentationUsageDefinitionRef::ParallelismTolerance(i) => {
32699            if i.0 >= model.parallelism_tolerance_arena.items.len() {
32700                return Err(AuthorError::DanglingRef {
32701                    entity: "PARALLELISM_TOLERANCE",
32702                });
32703            }
32704        }
32705        ItemIdentifiedRepresentationUsageDefinitionRef::PerpendicularityTolerance(i) => {
32706            if i.0 >= model.perpendicularity_tolerance_arena.items.len() {
32707                return Err(AuthorError::DanglingRef {
32708                    entity: "PERPENDICULARITY_TOLERANCE",
32709                });
32710            }
32711        }
32712        ItemIdentifiedRepresentationUsageDefinitionRef::PlacedDatumTargetFeature(i) => {
32713            if i.0 >= model.placed_datum_target_feature_arena.items.len() {
32714                return Err(AuthorError::DanglingRef {
32715                    entity: "PLACED_DATUM_TARGET_FEATURE",
32716                });
32717            }
32718        }
32719        ItemIdentifiedRepresentationUsageDefinitionRef::PositionTolerance(i) => {
32720            if i.0 >= model.position_tolerance_arena.items.len() {
32721                return Err(AuthorError::DanglingRef {
32722                    entity: "POSITION_TOLERANCE",
32723                });
32724            }
32725        }
32726        ItemIdentifiedRepresentationUsageDefinitionRef::ProductDefinitionRelationship(i) => {
32727            if i.0 >= model.product_definition_relationship_arena.items.len() {
32728                return Err(AuthorError::DanglingRef {
32729                    entity: "PRODUCT_DEFINITION_RELATIONSHIP",
32730                });
32731            }
32732        }
32733        ItemIdentifiedRepresentationUsageDefinitionRef::ProductDefinitionShape(i) => {
32734            if i.0 >= model.product_definition_shape_arena.items.len() {
32735                return Err(AuthorError::DanglingRef {
32736                    entity: "PRODUCT_DEFINITION_SHAPE",
32737                });
32738            }
32739        }
32740        ItemIdentifiedRepresentationUsageDefinitionRef::ProductDefinitionUsage(i) => {
32741            if i.0 >= model.product_definition_usage_arena.items.len() {
32742                return Err(AuthorError::DanglingRef {
32743                    entity: "PRODUCT_DEFINITION_USAGE",
32744                });
32745            }
32746        }
32747        ItemIdentifiedRepresentationUsageDefinitionRef::PropertyDefinition(i) => {
32748            if i.0 >= model.property_definition_arena.items.len() {
32749                return Err(AuthorError::DanglingRef {
32750                    entity: "PROPERTY_DEFINITION",
32751                });
32752            }
32753        }
32754        ItemIdentifiedRepresentationUsageDefinitionRef::PropertyDefinitionRelationship(i) => {
32755            if i.0 >= model.property_definition_relationship_arena.items.len() {
32756                return Err(AuthorError::DanglingRef {
32757                    entity: "PROPERTY_DEFINITION_RELATIONSHIP",
32758                });
32759            }
32760        }
32761        ItemIdentifiedRepresentationUsageDefinitionRef::RoundnessTolerance(i) => {
32762            if i.0 >= model.roundness_tolerance_arena.items.len() {
32763                return Err(AuthorError::DanglingRef {
32764                    entity: "ROUNDNESS_TOLERANCE",
32765                });
32766            }
32767        }
32768        ItemIdentifiedRepresentationUsageDefinitionRef::ShapeAspect(i) => {
32769            if i.0 >= model.shape_aspect_arena.items.len() {
32770                return Err(AuthorError::DanglingRef {
32771                    entity: "SHAPE_ASPECT",
32772                });
32773            }
32774        }
32775        ItemIdentifiedRepresentationUsageDefinitionRef::ShapeAspectAssociativity(i) => {
32776            if i.0 >= model.shape_aspect_associativity_arena.items.len() {
32777                return Err(AuthorError::DanglingRef {
32778                    entity: "SHAPE_ASPECT_ASSOCIATIVITY",
32779                });
32780            }
32781        }
32782        ItemIdentifiedRepresentationUsageDefinitionRef::ShapeAspectDerivingRelationship(i) => {
32783            if i.0 >= model.shape_aspect_deriving_relationship_arena.items.len() {
32784                return Err(AuthorError::DanglingRef {
32785                    entity: "SHAPE_ASPECT_DERIVING_RELATIONSHIP",
32786                });
32787            }
32788        }
32789        ItemIdentifiedRepresentationUsageDefinitionRef::ShapeAspectRelationship(i) => {
32790            if i.0 >= model.shape_aspect_relationship_arena.items.len() {
32791                return Err(AuthorError::DanglingRef {
32792                    entity: "SHAPE_ASPECT_RELATIONSHIP",
32793                });
32794            }
32795        }
32796        ItemIdentifiedRepresentationUsageDefinitionRef::StraightnessTolerance(i) => {
32797            if i.0 >= model.straightness_tolerance_arena.items.len() {
32798                return Err(AuthorError::DanglingRef {
32799                    entity: "STRAIGHTNESS_TOLERANCE",
32800                });
32801            }
32802        }
32803        ItemIdentifiedRepresentationUsageDefinitionRef::SurfaceProfileTolerance(i) => {
32804            if i.0 >= model.surface_profile_tolerance_arena.items.len() {
32805                return Err(AuthorError::DanglingRef {
32806                    entity: "SURFACE_PROFILE_TOLERANCE",
32807                });
32808            }
32809        }
32810        ItemIdentifiedRepresentationUsageDefinitionRef::SymmetryTolerance(i) => {
32811            if i.0 >= model.symmetry_tolerance_arena.items.len() {
32812                return Err(AuthorError::DanglingRef {
32813                    entity: "SYMMETRY_TOLERANCE",
32814                });
32815            }
32816        }
32817        ItemIdentifiedRepresentationUsageDefinitionRef::ToleranceZone(i) => {
32818            if i.0 >= model.tolerance_zone_arena.items.len() {
32819                return Err(AuthorError::DanglingRef {
32820                    entity: "TOLERANCE_ZONE",
32821                });
32822            }
32823        }
32824        ItemIdentifiedRepresentationUsageDefinitionRef::ToleranceZoneWithDatum(i) => {
32825            if i.0 >= model.tolerance_zone_with_datum_arena.items.len() {
32826                return Err(AuthorError::DanglingRef {
32827                    entity: "TOLERANCE_ZONE_WITH_DATUM",
32828                });
32829            }
32830        }
32831        ItemIdentifiedRepresentationUsageDefinitionRef::TotalRunoutTolerance(i) => {
32832            if i.0 >= model.total_runout_tolerance_arena.items.len() {
32833                return Err(AuthorError::DanglingRef {
32834                    entity: "TOTAL_RUNOUT_TOLERANCE",
32835                });
32836            }
32837        }
32838        ItemIdentifiedRepresentationUsageDefinitionRef::UnequallyDisposedGeometricTolerance(i) => {
32839            if i.0
32840                >= model
32841                    .unequally_disposed_geometric_tolerance_arena
32842                    .items
32843                    .len()
32844            {
32845                return Err(AuthorError::DanglingRef {
32846                    entity: "UNEQUALLY_DISPOSED_GEOMETRIC_TOLERANCE",
32847                });
32848            }
32849        }
32850        ItemIdentifiedRepresentationUsageDefinitionRef::Complex(i) => {
32851            if i.0 >= model.complex_unit_arena.items.len() {
32852                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
32853            }
32854        }
32855    }
32856    Ok(())
32857}
32858fn check_item_identified_representation_usage_select_ref(
32859    model: &StepModel,
32860    r: &ItemIdentifiedRepresentationUsageSelectRef,
32861) -> Result<(), AuthorError> {
32862    match r {
32863        ItemIdentifiedRepresentationUsageSelectRef::AdvancedFace(i) => { if i.0 >= model.advanced_face_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ADVANCED_FACE" }); } }
32864        ItemIdentifiedRepresentationUsageSelectRef::AnnotationCurveOccurrence(i) => { if i.0 >= model.annotation_curve_occurrence_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ANNOTATION_CURVE_OCCURRENCE" }); } }
32865        ItemIdentifiedRepresentationUsageSelectRef::AnnotationFillAreaOccurrence(i) => { if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ANNOTATION_FILL_AREA_OCCURRENCE" }); } }
32866        ItemIdentifiedRepresentationUsageSelectRef::AnnotationOccurrence(i) => { if i.0 >= model.annotation_occurrence_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ANNOTATION_OCCURRENCE" }); } }
32867        ItemIdentifiedRepresentationUsageSelectRef::AnnotationPlaceholderLeaderLine(_) => return Err(AuthorError::NotAp242 { entity: "ANNOTATION_PLACEHOLDER_LEADER_LINE" }),
32868        ItemIdentifiedRepresentationUsageSelectRef::AnnotationPlaceholderOccurrence(i) => { if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE" }); } }
32869        ItemIdentifiedRepresentationUsageSelectRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => return Err(AuthorError::NotAp242 { entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE" }),
32870        ItemIdentifiedRepresentationUsageSelectRef::AnnotationPlane(i) => { if i.0 >= model.annotation_plane_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ANNOTATION_PLANE" }); } }
32871        ItemIdentifiedRepresentationUsageSelectRef::AnnotationSymbol(i) => { if i.0 >= model.annotation_symbol_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ANNOTATION_SYMBOL" }); } }
32872        ItemIdentifiedRepresentationUsageSelectRef::AnnotationSymbolOccurrence(i) => { if i.0 >= model.annotation_symbol_occurrence_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ANNOTATION_SYMBOL_OCCURRENCE" }); } }
32873        ItemIdentifiedRepresentationUsageSelectRef::AnnotationText(i) => { if i.0 >= model.annotation_text_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ANNOTATION_TEXT" }); } }
32874        ItemIdentifiedRepresentationUsageSelectRef::AnnotationTextCharacter(i) => { if i.0 >= model.annotation_text_character_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ANNOTATION_TEXT_CHARACTER" }); } }
32875        ItemIdentifiedRepresentationUsageSelectRef::AnnotationTextOccurrence(i) => { if i.0 >= model.annotation_text_occurrence_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ANNOTATION_TEXT_OCCURRENCE" }); } }
32876        ItemIdentifiedRepresentationUsageSelectRef::AnnotationToAnnotationLeaderLine(_) => return Err(AuthorError::NotAp242 { entity: "ANNOTATION_TO_ANNOTATION_LEADER_LINE" }),
32877        ItemIdentifiedRepresentationUsageSelectRef::AnnotationToModelLeaderLine(_) => return Err(AuthorError::NotAp242 { entity: "ANNOTATION_TO_MODEL_LEADER_LINE" }),
32878        ItemIdentifiedRepresentationUsageSelectRef::ApllPoint(_) => return Err(AuthorError::NotAp242 { entity: "APLL_POINT" }),
32879        ItemIdentifiedRepresentationUsageSelectRef::ApllPointWithSurface(_) => return Err(AuthorError::NotAp242 { entity: "APLL_POINT_WITH_SURFACE" }),
32880        ItemIdentifiedRepresentationUsageSelectRef::AuxiliaryLeaderLine(_) => return Err(AuthorError::NotAp242 { entity: "AUXILIARY_LEADER_LINE" }),
32881        ItemIdentifiedRepresentationUsageSelectRef::Axis1Placement(i) => { if i.0 >= model.axis1_placement_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "AXIS1_PLACEMENT" }); } }
32882        ItemIdentifiedRepresentationUsageSelectRef::Axis2Placement2d(i) => { if i.0 >= model.axis2_placement2d_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "AXIS2_PLACEMENT_2D" }); } }
32883        ItemIdentifiedRepresentationUsageSelectRef::Axis2Placement3d(i) => { if i.0 >= model.axis2_placement3d_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "AXIS2_PLACEMENT_3D" }); } }
32884        ItemIdentifiedRepresentationUsageSelectRef::BSplineCurve(i) => { if i.0 >= model.b_spline_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "B_SPLINE_CURVE" }); } }
32885        ItemIdentifiedRepresentationUsageSelectRef::BSplineCurveWithKnots(i) => { if i.0 >= model.b_spline_curve_with_knots_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "B_SPLINE_CURVE_WITH_KNOTS" }); } }
32886        ItemIdentifiedRepresentationUsageSelectRef::BSplineSurface(i) => { if i.0 >= model.b_spline_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "B_SPLINE_SURFACE" }); } }
32887        ItemIdentifiedRepresentationUsageSelectRef::BSplineSurfaceWithKnots(i) => { if i.0 >= model.b_spline_surface_with_knots_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "B_SPLINE_SURFACE_WITH_KNOTS" }); } }
32888        ItemIdentifiedRepresentationUsageSelectRef::BezierCurve(i) => { if i.0 >= model.bezier_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "BEZIER_CURVE" }); } }
32889        ItemIdentifiedRepresentationUsageSelectRef::BezierSurface(i) => { if i.0 >= model.bezier_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "BEZIER_SURFACE" }); } }
32890        ItemIdentifiedRepresentationUsageSelectRef::BoundedCurve(i) => { if i.0 >= model.bounded_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "BOUNDED_CURVE" }); } }
32891        ItemIdentifiedRepresentationUsageSelectRef::BoundedPcurve(i) => { if i.0 >= model.bounded_pcurve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "BOUNDED_PCURVE" }); } }
32892        ItemIdentifiedRepresentationUsageSelectRef::BoundedSurface(i) => { if i.0 >= model.bounded_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "BOUNDED_SURFACE" }); } }
32893        ItemIdentifiedRepresentationUsageSelectRef::BoundedSurfaceCurve(i) => { if i.0 >= model.bounded_surface_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "BOUNDED_SURFACE_CURVE" }); } }
32894        ItemIdentifiedRepresentationUsageSelectRef::BrepWithVoids(i) => { if i.0 >= model.brep_with_voids_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "BREP_WITH_VOIDS" }); } }
32895        ItemIdentifiedRepresentationUsageSelectRef::CameraImage(i) => { if i.0 >= model.camera_image_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CAMERA_IMAGE" }); } }
32896        ItemIdentifiedRepresentationUsageSelectRef::CameraImage3dWithScale(i) => { if i.0 >= model.camera_image3d_with_scale_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CAMERA_IMAGE_3D_WITH_SCALE" }); } }
32897        ItemIdentifiedRepresentationUsageSelectRef::CameraModel(i) => { if i.0 >= model.camera_model_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CAMERA_MODEL" }); } }
32898        ItemIdentifiedRepresentationUsageSelectRef::CameraModelD3(i) => { if i.0 >= model.camera_model_d3_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CAMERA_MODEL_D3" }); } }
32899        ItemIdentifiedRepresentationUsageSelectRef::CameraModelD3MultiClipping(i) => { if i.0 >= model.camera_model_d3_multi_clipping_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CAMERA_MODEL_D3_MULTI_CLIPPING" }); } }
32900        ItemIdentifiedRepresentationUsageSelectRef::CameraModelD3WithHlhsr(i) => { if i.0 >= model.camera_model_d3_with_hlhsr_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CAMERA_MODEL_D3_WITH_HLHSR" }); } }
32901        ItemIdentifiedRepresentationUsageSelectRef::CartesianPoint(i) => { if i.0 >= model.cartesian_point_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CARTESIAN_POINT" }); } }
32902        ItemIdentifiedRepresentationUsageSelectRef::Circle(i) => { if i.0 >= model.circle_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CIRCLE" }); } }
32903        ItemIdentifiedRepresentationUsageSelectRef::ClosedShell(i) => { if i.0 >= model.closed_shell_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CLOSED_SHELL" }); } }
32904        ItemIdentifiedRepresentationUsageSelectRef::ComplexTriangulatedFace(i) => { if i.0 >= model.complex_triangulated_face_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "COMPLEX_TRIANGULATED_FACE" }); } }
32905        ItemIdentifiedRepresentationUsageSelectRef::ComplexTriangulatedSurfaceSet(i) => { if i.0 >= model.complex_triangulated_surface_set_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "COMPLEX_TRIANGULATED_SURFACE_SET" }); } }
32906        ItemIdentifiedRepresentationUsageSelectRef::CompositeCurve(i) => { if i.0 >= model.composite_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "COMPOSITE_CURVE" }); } }
32907        ItemIdentifiedRepresentationUsageSelectRef::CompositeText(i) => { if i.0 >= model.composite_text_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "COMPOSITE_TEXT" }); } }
32908        ItemIdentifiedRepresentationUsageSelectRef::CompoundRepresentationItem(i) => { if i.0 >= model.compound_representation_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "COMPOUND_REPRESENTATION_ITEM" }); } }
32909        ItemIdentifiedRepresentationUsageSelectRef::Conic(i) => { if i.0 >= model.conic_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CONIC" }); } }
32910        ItemIdentifiedRepresentationUsageSelectRef::ConicalSurface(i) => { if i.0 >= model.conical_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CONICAL_SURFACE" }); } }
32911        ItemIdentifiedRepresentationUsageSelectRef::ConnectedFaceSet(i) => { if i.0 >= model.connected_face_set_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CONNECTED_FACE_SET" }); } }
32912        ItemIdentifiedRepresentationUsageSelectRef::ContextDependentOverRidingStyledItem(i) => { if i.0 >= model.context_dependent_over_riding_styled_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM" }); } }
32913        ItemIdentifiedRepresentationUsageSelectRef::CoordinatesList(i) => { if i.0 >= model.coordinates_list_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "COORDINATES_LIST" }); } }
32914        ItemIdentifiedRepresentationUsageSelectRef::Curve(i) => { if i.0 >= model.curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CURVE" }); } }
32915        ItemIdentifiedRepresentationUsageSelectRef::CylindricalSurface(i) => { if i.0 >= model.cylindrical_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CYLINDRICAL_SURFACE" }); } }
32916        ItemIdentifiedRepresentationUsageSelectRef::DefinedCharacterGlyph(i) => { if i.0 >= model.defined_character_glyph_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "DEFINED_CHARACTER_GLYPH" }); } }
32917        ItemIdentifiedRepresentationUsageSelectRef::DefinedSymbol(i) => { if i.0 >= model.defined_symbol_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "DEFINED_SYMBOL" }); } }
32918        ItemIdentifiedRepresentationUsageSelectRef::DegenerateToroidalSurface(i) => { if i.0 >= model.degenerate_toroidal_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "DEGENERATE_TOROIDAL_SURFACE" }); } }
32919        ItemIdentifiedRepresentationUsageSelectRef::DescriptiveRepresentationItem(i) => { if i.0 >= model.descriptive_representation_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "DESCRIPTIVE_REPRESENTATION_ITEM" }); } }
32920        ItemIdentifiedRepresentationUsageSelectRef::Direction(i) => { if i.0 >= model.direction_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "DIRECTION" }); } }
32921        ItemIdentifiedRepresentationUsageSelectRef::DraughtingAnnotationOccurrence(i) => { if i.0 >= model.draughting_annotation_occurrence_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "DRAUGHTING_ANNOTATION_OCCURRENCE" }); } }
32922        ItemIdentifiedRepresentationUsageSelectRef::DraughtingCallout(i) => { if i.0 >= model.draughting_callout_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "DRAUGHTING_CALLOUT" }); } }
32923        ItemIdentifiedRepresentationUsageSelectRef::Edge(i) => { if i.0 >= model.edge_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "EDGE" }); } }
32924        ItemIdentifiedRepresentationUsageSelectRef::EdgeCurve(i) => { if i.0 >= model.edge_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "EDGE_CURVE" }); } }
32925        ItemIdentifiedRepresentationUsageSelectRef::EdgeLoop(i) => { if i.0 >= model.edge_loop_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "EDGE_LOOP" }); } }
32926        ItemIdentifiedRepresentationUsageSelectRef::ElementarySurface(i) => { if i.0 >= model.elementary_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ELEMENTARY_SURFACE" }); } }
32927        ItemIdentifiedRepresentationUsageSelectRef::Ellipse(i) => { if i.0 >= model.ellipse_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ELLIPSE" }); } }
32928        ItemIdentifiedRepresentationUsageSelectRef::ExternallyDefinedHatchStyle(i) => { if i.0 >= model.externally_defined_hatch_style_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "EXTERNALLY_DEFINED_HATCH_STYLE" }); } }
32929        ItemIdentifiedRepresentationUsageSelectRef::ExternallyDefinedTileStyle(i) => { if i.0 >= model.externally_defined_tile_style_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "EXTERNALLY_DEFINED_TILE_STYLE" }); } }
32930        ItemIdentifiedRepresentationUsageSelectRef::Face(i) => { if i.0 >= model.face_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "FACE" }); } }
32931        ItemIdentifiedRepresentationUsageSelectRef::FaceBound(i) => { if i.0 >= model.face_bound_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "FACE_BOUND" }); } }
32932        ItemIdentifiedRepresentationUsageSelectRef::FaceOuterBound(i) => { if i.0 >= model.face_outer_bound_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "FACE_OUTER_BOUND" }); } }
32933        ItemIdentifiedRepresentationUsageSelectRef::FaceSurface(i) => { if i.0 >= model.face_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "FACE_SURFACE" }); } }
32934        ItemIdentifiedRepresentationUsageSelectRef::FillAreaStyleHatching(i) => { if i.0 >= model.fill_area_style_hatching_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "FILL_AREA_STYLE_HATCHING" }); } }
32935        ItemIdentifiedRepresentationUsageSelectRef::FillAreaStyleTileColouredRegion(i) => { if i.0 >= model.fill_area_style_tile_coloured_region_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "FILL_AREA_STYLE_TILE_COLOURED_REGION" }); } }
32936        ItemIdentifiedRepresentationUsageSelectRef::FillAreaStyleTileCurveWithStyle(i) => { if i.0 >= model.fill_area_style_tile_curve_with_style_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE" }); } }
32937        ItemIdentifiedRepresentationUsageSelectRef::FillAreaStyleTileSymbolWithStyle(i) => { if i.0 >= model.fill_area_style_tile_symbol_with_style_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE" }); } }
32938        ItemIdentifiedRepresentationUsageSelectRef::FillAreaStyleTiles(i) => { if i.0 >= model.fill_area_style_tiles_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "FILL_AREA_STYLE_TILES" }); } }
32939        ItemIdentifiedRepresentationUsageSelectRef::GeometricCurveSet(i) => { if i.0 >= model.geometric_curve_set_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "GEOMETRIC_CURVE_SET" }); } }
32940        ItemIdentifiedRepresentationUsageSelectRef::GeometricRepresentationItem(i) => { if i.0 >= model.geometric_representation_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "GEOMETRIC_REPRESENTATION_ITEM" }); } }
32941        ItemIdentifiedRepresentationUsageSelectRef::GeometricSet(i) => { if i.0 >= model.geometric_set_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "GEOMETRIC_SET" }); } }
32942        ItemIdentifiedRepresentationUsageSelectRef::Hyperbola(i) => { if i.0 >= model.hyperbola_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "HYPERBOLA" }); } }
32943        ItemIdentifiedRepresentationUsageSelectRef::IntegerRepresentationItem(i) => { if i.0 >= model.integer_representation_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "INTEGER_REPRESENTATION_ITEM" }); } }
32944        ItemIdentifiedRepresentationUsageSelectRef::IntersectionCurve(i) => { if i.0 >= model.intersection_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "INTERSECTION_CURVE" }); } }
32945        ItemIdentifiedRepresentationUsageSelectRef::LeaderCurve(i) => { if i.0 >= model.leader_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "LEADER_CURVE" }); } }
32946        ItemIdentifiedRepresentationUsageSelectRef::LeaderDirectedCallout(i) => { if i.0 >= model.leader_directed_callout_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "LEADER_DIRECTED_CALLOUT" }); } }
32947        ItemIdentifiedRepresentationUsageSelectRef::LeaderTerminator(i) => { if i.0 >= model.leader_terminator_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "LEADER_TERMINATOR" }); } }
32948        ItemIdentifiedRepresentationUsageSelectRef::Line(i) => { if i.0 >= model.line_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "LINE" }); } }
32949        ItemIdentifiedRepresentationUsageSelectRef::Loop(i) => { if i.0 >= model.loop_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "LOOP" }); } }
32950        ItemIdentifiedRepresentationUsageSelectRef::ManifoldSolidBrep(i) => { if i.0 >= model.manifold_solid_brep_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "MANIFOLD_SOLID_BREP" }); } }
32951        ItemIdentifiedRepresentationUsageSelectRef::MappedItem(i) => { if i.0 >= model.mapped_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "MAPPED_ITEM" }); } }
32952        ItemIdentifiedRepresentationUsageSelectRef::MeasureRepresentationItem(i) => { if i.0 >= model.measure_representation_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "MEASURE_REPRESENTATION_ITEM" }); } }
32953        ItemIdentifiedRepresentationUsageSelectRef::OffsetSurface(i) => { if i.0 >= model.offset_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "OFFSET_SURFACE" }); } }
32954        ItemIdentifiedRepresentationUsageSelectRef::OneDirectionRepeatFactor(i) => { if i.0 >= model.one_direction_repeat_factor_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ONE_DIRECTION_REPEAT_FACTOR" }); } }
32955        ItemIdentifiedRepresentationUsageSelectRef::OpenShell(i) => { if i.0 >= model.open_shell_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "OPEN_SHELL" }); } }
32956        ItemIdentifiedRepresentationUsageSelectRef::OrientedClosedShell(i) => { if i.0 >= model.oriented_closed_shell_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ORIENTED_CLOSED_SHELL" }); } }
32957        ItemIdentifiedRepresentationUsageSelectRef::OrientedEdge(i) => { if i.0 >= model.oriented_edge_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ORIENTED_EDGE" }); } }
32958        ItemIdentifiedRepresentationUsageSelectRef::OverRidingStyledItem(i) => { if i.0 >= model.over_riding_styled_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "OVER_RIDING_STYLED_ITEM" }); } }
32959        ItemIdentifiedRepresentationUsageSelectRef::Path(i) => { if i.0 >= model.path_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "PATH" }); } }
32960        ItemIdentifiedRepresentationUsageSelectRef::Pcurve(i) => { if i.0 >= model.pcurve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "PCURVE" }); } }
32961        ItemIdentifiedRepresentationUsageSelectRef::Placement(i) => { if i.0 >= model.placement_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "PLACEMENT" }); } }
32962        ItemIdentifiedRepresentationUsageSelectRef::PlanarBox(i) => { if i.0 >= model.planar_box_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "PLANAR_BOX" }); } }
32963        ItemIdentifiedRepresentationUsageSelectRef::PlanarExtent(i) => { if i.0 >= model.planar_extent_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "PLANAR_EXTENT" }); } }
32964        ItemIdentifiedRepresentationUsageSelectRef::Plane(i) => { if i.0 >= model.plane_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "PLANE" }); } }
32965        ItemIdentifiedRepresentationUsageSelectRef::Point(i) => { if i.0 >= model.point_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "POINT" }); } }
32966        ItemIdentifiedRepresentationUsageSelectRef::PolyLoop(i) => { if i.0 >= model.poly_loop_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "POLY_LOOP" }); } }
32967        ItemIdentifiedRepresentationUsageSelectRef::Polyline(i) => { if i.0 >= model.polyline_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "POLYLINE" }); } }
32968        ItemIdentifiedRepresentationUsageSelectRef::QualifiedRepresentationItem(i) => { if i.0 >= model.qualified_representation_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "QUALIFIED_REPRESENTATION_ITEM" }); } }
32969        ItemIdentifiedRepresentationUsageSelectRef::QuasiUniformCurve(i) => { if i.0 >= model.quasi_uniform_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "QUASI_UNIFORM_CURVE" }); } }
32970        ItemIdentifiedRepresentationUsageSelectRef::QuasiUniformSurface(i) => { if i.0 >= model.quasi_uniform_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "QUASI_UNIFORM_SURFACE" }); } }
32971        ItemIdentifiedRepresentationUsageSelectRef::RationalBSplineCurve(i) => { if i.0 >= model.rational_b_spline_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "RATIONAL_B_SPLINE_CURVE" }); } }
32972        ItemIdentifiedRepresentationUsageSelectRef::RationalBSplineSurface(i) => { if i.0 >= model.rational_b_spline_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "RATIONAL_B_SPLINE_SURFACE" }); } }
32973        ItemIdentifiedRepresentationUsageSelectRef::RealRepresentationItem(i) => { if i.0 >= model.real_representation_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "REAL_REPRESENTATION_ITEM" }); } }
32974        ItemIdentifiedRepresentationUsageSelectRef::RepositionedTessellatedItem(i) => { if i.0 >= model.repositioned_tessellated_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "REPOSITIONED_TESSELLATED_ITEM" }); } }
32975        ItemIdentifiedRepresentationUsageSelectRef::RepresentationItem(i) => { if i.0 >= model.representation_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "REPRESENTATION_ITEM" }); } }
32976        ItemIdentifiedRepresentationUsageSelectRef::SeamCurve(i) => { if i.0 >= model.seam_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SEAM_CURVE" }); } }
32977        ItemIdentifiedRepresentationUsageSelectRef::ShellBasedSurfaceModel(i) => { if i.0 >= model.shell_based_surface_model_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SHELL_BASED_SURFACE_MODEL" }); } }
32978        ItemIdentifiedRepresentationUsageSelectRef::SolidModel(i) => { if i.0 >= model.solid_model_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SOLID_MODEL" }); } }
32979        ItemIdentifiedRepresentationUsageSelectRef::SphericalSurface(i) => { if i.0 >= model.spherical_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SPHERICAL_SURFACE" }); } }
32980        ItemIdentifiedRepresentationUsageSelectRef::StyledItem(i) => { if i.0 >= model.styled_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "STYLED_ITEM" }); } }
32981        ItemIdentifiedRepresentationUsageSelectRef::Surface(i) => { if i.0 >= model.surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SURFACE" }); } }
32982        ItemIdentifiedRepresentationUsageSelectRef::SurfaceCurve(i) => { if i.0 >= model.surface_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SURFACE_CURVE" }); } }
32983        ItemIdentifiedRepresentationUsageSelectRef::SurfaceOfLinearExtrusion(i) => { if i.0 >= model.surface_of_linear_extrusion_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SURFACE_OF_LINEAR_EXTRUSION" }); } }
32984        ItemIdentifiedRepresentationUsageSelectRef::SurfaceOfRevolution(i) => { if i.0 >= model.surface_of_revolution_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SURFACE_OF_REVOLUTION" }); } }
32985        ItemIdentifiedRepresentationUsageSelectRef::SweptSurface(i) => { if i.0 >= model.swept_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SWEPT_SURFACE" }); } }
32986        ItemIdentifiedRepresentationUsageSelectRef::SymbolTarget(i) => { if i.0 >= model.symbol_target_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SYMBOL_TARGET" }); } }
32987        ItemIdentifiedRepresentationUsageSelectRef::TerminatorSymbol(i) => { if i.0 >= model.terminator_symbol_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TERMINATOR_SYMBOL" }); } }
32988        ItemIdentifiedRepresentationUsageSelectRef::TessellatedAnnotationOccurrence(i) => { if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TESSELLATED_ANNOTATION_OCCURRENCE" }); } }
32989        ItemIdentifiedRepresentationUsageSelectRef::TessellatedCurveSet(i) => { if i.0 >= model.tessellated_curve_set_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TESSELLATED_CURVE_SET" }); } }
32990        ItemIdentifiedRepresentationUsageSelectRef::TessellatedFace(i) => { if i.0 >= model.tessellated_face_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TESSELLATED_FACE" }); } }
32991        ItemIdentifiedRepresentationUsageSelectRef::TessellatedGeometricSet(i) => { if i.0 >= model.tessellated_geometric_set_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TESSELLATED_GEOMETRIC_SET" }); } }
32992        ItemIdentifiedRepresentationUsageSelectRef::TessellatedItem(i) => { if i.0 >= model.tessellated_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TESSELLATED_ITEM" }); } }
32993        ItemIdentifiedRepresentationUsageSelectRef::TessellatedShell(i) => { if i.0 >= model.tessellated_shell_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TESSELLATED_SHELL" }); } }
32994        ItemIdentifiedRepresentationUsageSelectRef::TessellatedSolid(i) => { if i.0 >= model.tessellated_solid_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TESSELLATED_SOLID" }); } }
32995        ItemIdentifiedRepresentationUsageSelectRef::TessellatedStructuredItem(i) => { if i.0 >= model.tessellated_structured_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TESSELLATED_STRUCTURED_ITEM" }); } }
32996        ItemIdentifiedRepresentationUsageSelectRef::TessellatedSurfaceSet(i) => { if i.0 >= model.tessellated_surface_set_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TESSELLATED_SURFACE_SET" }); } }
32997        ItemIdentifiedRepresentationUsageSelectRef::TextLiteral(i) => { if i.0 >= model.text_literal_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TEXT_LITERAL" }); } }
32998        ItemIdentifiedRepresentationUsageSelectRef::TopologicalRepresentationItem(i) => { if i.0 >= model.topological_representation_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TOPOLOGICAL_REPRESENTATION_ITEM" }); } }
32999        ItemIdentifiedRepresentationUsageSelectRef::ToroidalSurface(i) => { if i.0 >= model.toroidal_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TOROIDAL_SURFACE" }); } }
33000        ItemIdentifiedRepresentationUsageSelectRef::TrimmedCurve(i) => { if i.0 >= model.trimmed_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TRIMMED_CURVE" }); } }
33001        ItemIdentifiedRepresentationUsageSelectRef::TwoDirectionRepeatFactor(i) => { if i.0 >= model.two_direction_repeat_factor_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TWO_DIRECTION_REPEAT_FACTOR" }); } }
33002        ItemIdentifiedRepresentationUsageSelectRef::UniformCurve(i) => { if i.0 >= model.uniform_curve_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "UNIFORM_CURVE" }); } }
33003        ItemIdentifiedRepresentationUsageSelectRef::UniformSurface(i) => { if i.0 >= model.uniform_surface_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "UNIFORM_SURFACE" }); } }
33004        ItemIdentifiedRepresentationUsageSelectRef::ValueRepresentationItem(i) => { if i.0 >= model.value_representation_item_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "VALUE_REPRESENTATION_ITEM" }); } }
33005        ItemIdentifiedRepresentationUsageSelectRef::Vector(i) => { if i.0 >= model.vector_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "VECTOR" }); } }
33006        ItemIdentifiedRepresentationUsageSelectRef::Vertex(i) => { if i.0 >= model.vertex_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "VERTEX" }); } }
33007        ItemIdentifiedRepresentationUsageSelectRef::VertexLoop(i) => { if i.0 >= model.vertex_loop_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "VERTEX_LOOP" }); } }
33008        ItemIdentifiedRepresentationUsageSelectRef::VertexPoint(i) => { if i.0 >= model.vertex_point_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "VERTEX_POINT" }); } }
33009        ItemIdentifiedRepresentationUsageSelectRef::VertexShell(i) => { if i.0 >= model.vertex_shell_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "VERTEX_SHELL" }); } }
33010        ItemIdentifiedRepresentationUsageSelectRef::WireShell(i) => { if i.0 >= model.wire_shell_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "WIRE_SHELL" }); } }
33011        ItemIdentifiedRepresentationUsageSelectRef::ListRepresentationItem(v) => { for e in v { check_representation_item_ref(model, e)?; } }
33012        ItemIdentifiedRepresentationUsageSelectRef::SetRepresentationItem(v) => { for e in v { check_representation_item_ref(model, e)?; } }
33013        ItemIdentifiedRepresentationUsageSelectRef::Complex(i) => { if i.0 >= model.complex_unit_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "COMPLEX" }); } }
33014    }
33015    Ok(())
33016}
33017fn check_layered_item_ref(model: &StepModel, r: &LayeredItemRef) -> Result<(), AuthorError> {
33018    match r {
33019        LayeredItemRef::AdvancedFace(i) => {
33020            if i.0 >= model.advanced_face_arena.items.len() {
33021                return Err(AuthorError::DanglingRef {
33022                    entity: "ADVANCED_FACE",
33023                });
33024            }
33025        }
33026        LayeredItemRef::AnnotationCurveOccurrence(i) => {
33027            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
33028                return Err(AuthorError::DanglingRef {
33029                    entity: "ANNOTATION_CURVE_OCCURRENCE",
33030                });
33031            }
33032        }
33033        LayeredItemRef::AnnotationFillAreaOccurrence(i) => {
33034            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
33035                return Err(AuthorError::DanglingRef {
33036                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
33037                });
33038            }
33039        }
33040        LayeredItemRef::AnnotationOccurrence(i) => {
33041            if i.0 >= model.annotation_occurrence_arena.items.len() {
33042                return Err(AuthorError::DanglingRef {
33043                    entity: "ANNOTATION_OCCURRENCE",
33044                });
33045            }
33046        }
33047        LayeredItemRef::AnnotationPlaceholderLeaderLine(_) => {
33048            return Err(AuthorError::NotAp242 {
33049                entity: "ANNOTATION_PLACEHOLDER_LEADER_LINE",
33050            });
33051        }
33052        LayeredItemRef::AnnotationPlaceholderOccurrence(i) => {
33053            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
33054                return Err(AuthorError::DanglingRef {
33055                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
33056                });
33057            }
33058        }
33059        LayeredItemRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
33060            return Err(AuthorError::NotAp242 {
33061                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
33062            });
33063        }
33064        LayeredItemRef::AnnotationPlane(i) => {
33065            if i.0 >= model.annotation_plane_arena.items.len() {
33066                return Err(AuthorError::DanglingRef {
33067                    entity: "ANNOTATION_PLANE",
33068                });
33069            }
33070        }
33071        LayeredItemRef::AnnotationSymbol(i) => {
33072            if i.0 >= model.annotation_symbol_arena.items.len() {
33073                return Err(AuthorError::DanglingRef {
33074                    entity: "ANNOTATION_SYMBOL",
33075                });
33076            }
33077        }
33078        LayeredItemRef::AnnotationSymbolOccurrence(i) => {
33079            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
33080                return Err(AuthorError::DanglingRef {
33081                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
33082                });
33083            }
33084        }
33085        LayeredItemRef::AnnotationText(i) => {
33086            if i.0 >= model.annotation_text_arena.items.len() {
33087                return Err(AuthorError::DanglingRef {
33088                    entity: "ANNOTATION_TEXT",
33089                });
33090            }
33091        }
33092        LayeredItemRef::AnnotationTextCharacter(i) => {
33093            if i.0 >= model.annotation_text_character_arena.items.len() {
33094                return Err(AuthorError::DanglingRef {
33095                    entity: "ANNOTATION_TEXT_CHARACTER",
33096                });
33097            }
33098        }
33099        LayeredItemRef::AnnotationTextOccurrence(i) => {
33100            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
33101                return Err(AuthorError::DanglingRef {
33102                    entity: "ANNOTATION_TEXT_OCCURRENCE",
33103                });
33104            }
33105        }
33106        LayeredItemRef::AnnotationToAnnotationLeaderLine(_) => {
33107            return Err(AuthorError::NotAp242 {
33108                entity: "ANNOTATION_TO_ANNOTATION_LEADER_LINE",
33109            });
33110        }
33111        LayeredItemRef::AnnotationToModelLeaderLine(_) => {
33112            return Err(AuthorError::NotAp242 {
33113                entity: "ANNOTATION_TO_MODEL_LEADER_LINE",
33114            });
33115        }
33116        LayeredItemRef::ApllPoint(_) => {
33117            return Err(AuthorError::NotAp242 {
33118                entity: "APLL_POINT",
33119            });
33120        }
33121        LayeredItemRef::ApllPointWithSurface(_) => {
33122            return Err(AuthorError::NotAp242 {
33123                entity: "APLL_POINT_WITH_SURFACE",
33124            });
33125        }
33126        LayeredItemRef::AuxiliaryLeaderLine(_) => {
33127            return Err(AuthorError::NotAp242 {
33128                entity: "AUXILIARY_LEADER_LINE",
33129            });
33130        }
33131        LayeredItemRef::Axis1Placement(i) => {
33132            if i.0 >= model.axis1_placement_arena.items.len() {
33133                return Err(AuthorError::DanglingRef {
33134                    entity: "AXIS1_PLACEMENT",
33135                });
33136            }
33137        }
33138        LayeredItemRef::Axis2Placement2d(i) => {
33139            if i.0 >= model.axis2_placement2d_arena.items.len() {
33140                return Err(AuthorError::DanglingRef {
33141                    entity: "AXIS2_PLACEMENT_2D",
33142                });
33143            }
33144        }
33145        LayeredItemRef::Axis2Placement3d(i) => {
33146            if i.0 >= model.axis2_placement3d_arena.items.len() {
33147                return Err(AuthorError::DanglingRef {
33148                    entity: "AXIS2_PLACEMENT_3D",
33149                });
33150            }
33151        }
33152        LayeredItemRef::BSplineCurve(i) => {
33153            if i.0 >= model.b_spline_curve_arena.items.len() {
33154                return Err(AuthorError::DanglingRef {
33155                    entity: "B_SPLINE_CURVE",
33156                });
33157            }
33158        }
33159        LayeredItemRef::BSplineCurveWithKnots(i) => {
33160            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
33161                return Err(AuthorError::DanglingRef {
33162                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
33163                });
33164            }
33165        }
33166        LayeredItemRef::BSplineSurface(i) => {
33167            if i.0 >= model.b_spline_surface_arena.items.len() {
33168                return Err(AuthorError::DanglingRef {
33169                    entity: "B_SPLINE_SURFACE",
33170                });
33171            }
33172        }
33173        LayeredItemRef::BSplineSurfaceWithKnots(i) => {
33174            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
33175                return Err(AuthorError::DanglingRef {
33176                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
33177                });
33178            }
33179        }
33180        LayeredItemRef::BezierCurve(i) => {
33181            if i.0 >= model.bezier_curve_arena.items.len() {
33182                return Err(AuthorError::DanglingRef {
33183                    entity: "BEZIER_CURVE",
33184                });
33185            }
33186        }
33187        LayeredItemRef::BezierSurface(i) => {
33188            if i.0 >= model.bezier_surface_arena.items.len() {
33189                return Err(AuthorError::DanglingRef {
33190                    entity: "BEZIER_SURFACE",
33191                });
33192            }
33193        }
33194        LayeredItemRef::BoundedCurve(i) => {
33195            if i.0 >= model.bounded_curve_arena.items.len() {
33196                return Err(AuthorError::DanglingRef {
33197                    entity: "BOUNDED_CURVE",
33198                });
33199            }
33200        }
33201        LayeredItemRef::BoundedPcurve(i) => {
33202            if i.0 >= model.bounded_pcurve_arena.items.len() {
33203                return Err(AuthorError::DanglingRef {
33204                    entity: "BOUNDED_PCURVE",
33205                });
33206            }
33207        }
33208        LayeredItemRef::BoundedSurface(i) => {
33209            if i.0 >= model.bounded_surface_arena.items.len() {
33210                return Err(AuthorError::DanglingRef {
33211                    entity: "BOUNDED_SURFACE",
33212                });
33213            }
33214        }
33215        LayeredItemRef::BoundedSurfaceCurve(i) => {
33216            if i.0 >= model.bounded_surface_curve_arena.items.len() {
33217                return Err(AuthorError::DanglingRef {
33218                    entity: "BOUNDED_SURFACE_CURVE",
33219                });
33220            }
33221        }
33222        LayeredItemRef::BrepWithVoids(i) => {
33223            if i.0 >= model.brep_with_voids_arena.items.len() {
33224                return Err(AuthorError::DanglingRef {
33225                    entity: "BREP_WITH_VOIDS",
33226                });
33227            }
33228        }
33229        LayeredItemRef::CameraImage(i) => {
33230            if i.0 >= model.camera_image_arena.items.len() {
33231                return Err(AuthorError::DanglingRef {
33232                    entity: "CAMERA_IMAGE",
33233                });
33234            }
33235        }
33236        LayeredItemRef::CameraImage3dWithScale(i) => {
33237            if i.0 >= model.camera_image3d_with_scale_arena.items.len() {
33238                return Err(AuthorError::DanglingRef {
33239                    entity: "CAMERA_IMAGE_3D_WITH_SCALE",
33240                });
33241            }
33242        }
33243        LayeredItemRef::CameraModel(i) => {
33244            if i.0 >= model.camera_model_arena.items.len() {
33245                return Err(AuthorError::DanglingRef {
33246                    entity: "CAMERA_MODEL",
33247                });
33248            }
33249        }
33250        LayeredItemRef::CameraModelD3(i) => {
33251            if i.0 >= model.camera_model_d3_arena.items.len() {
33252                return Err(AuthorError::DanglingRef {
33253                    entity: "CAMERA_MODEL_D3",
33254                });
33255            }
33256        }
33257        LayeredItemRef::CameraModelD3MultiClipping(i) => {
33258            if i.0 >= model.camera_model_d3_multi_clipping_arena.items.len() {
33259                return Err(AuthorError::DanglingRef {
33260                    entity: "CAMERA_MODEL_D3_MULTI_CLIPPING",
33261                });
33262            }
33263        }
33264        LayeredItemRef::CameraModelD3WithHlhsr(i) => {
33265            if i.0 >= model.camera_model_d3_with_hlhsr_arena.items.len() {
33266                return Err(AuthorError::DanglingRef {
33267                    entity: "CAMERA_MODEL_D3_WITH_HLHSR",
33268                });
33269            }
33270        }
33271        LayeredItemRef::CartesianPoint(i) => {
33272            if i.0 >= model.cartesian_point_arena.items.len() {
33273                return Err(AuthorError::DanglingRef {
33274                    entity: "CARTESIAN_POINT",
33275                });
33276            }
33277        }
33278        LayeredItemRef::Circle(i) => {
33279            if i.0 >= model.circle_arena.items.len() {
33280                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
33281            }
33282        }
33283        LayeredItemRef::ClosedShell(i) => {
33284            if i.0 >= model.closed_shell_arena.items.len() {
33285                return Err(AuthorError::DanglingRef {
33286                    entity: "CLOSED_SHELL",
33287                });
33288            }
33289        }
33290        LayeredItemRef::ComplexTriangulatedFace(i) => {
33291            if i.0 >= model.complex_triangulated_face_arena.items.len() {
33292                return Err(AuthorError::DanglingRef {
33293                    entity: "COMPLEX_TRIANGULATED_FACE",
33294                });
33295            }
33296        }
33297        LayeredItemRef::ComplexTriangulatedSurfaceSet(i) => {
33298            if i.0 >= model.complex_triangulated_surface_set_arena.items.len() {
33299                return Err(AuthorError::DanglingRef {
33300                    entity: "COMPLEX_TRIANGULATED_SURFACE_SET",
33301                });
33302            }
33303        }
33304        LayeredItemRef::CompositeCurve(i) => {
33305            if i.0 >= model.composite_curve_arena.items.len() {
33306                return Err(AuthorError::DanglingRef {
33307                    entity: "COMPOSITE_CURVE",
33308                });
33309            }
33310        }
33311        LayeredItemRef::CompositeText(i) => {
33312            if i.0 >= model.composite_text_arena.items.len() {
33313                return Err(AuthorError::DanglingRef {
33314                    entity: "COMPOSITE_TEXT",
33315                });
33316            }
33317        }
33318        LayeredItemRef::CompoundRepresentationItem(i) => {
33319            if i.0 >= model.compound_representation_item_arena.items.len() {
33320                return Err(AuthorError::DanglingRef {
33321                    entity: "COMPOUND_REPRESENTATION_ITEM",
33322                });
33323            }
33324        }
33325        LayeredItemRef::Conic(i) => {
33326            if i.0 >= model.conic_arena.items.len() {
33327                return Err(AuthorError::DanglingRef { entity: "CONIC" });
33328            }
33329        }
33330        LayeredItemRef::ConicalSurface(i) => {
33331            if i.0 >= model.conical_surface_arena.items.len() {
33332                return Err(AuthorError::DanglingRef {
33333                    entity: "CONICAL_SURFACE",
33334                });
33335            }
33336        }
33337        LayeredItemRef::ConnectedFaceSet(i) => {
33338            if i.0 >= model.connected_face_set_arena.items.len() {
33339                return Err(AuthorError::DanglingRef {
33340                    entity: "CONNECTED_FACE_SET",
33341                });
33342            }
33343        }
33344        LayeredItemRef::ContextDependentOverRidingStyledItem(i) => {
33345            if i.0
33346                >= model
33347                    .context_dependent_over_riding_styled_item_arena
33348                    .items
33349                    .len()
33350            {
33351                return Err(AuthorError::DanglingRef {
33352                    entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
33353                });
33354            }
33355        }
33356        LayeredItemRef::CoordinatesList(i) => {
33357            if i.0 >= model.coordinates_list_arena.items.len() {
33358                return Err(AuthorError::DanglingRef {
33359                    entity: "COORDINATES_LIST",
33360                });
33361            }
33362        }
33363        LayeredItemRef::Curve(i) => {
33364            if i.0 >= model.curve_arena.items.len() {
33365                return Err(AuthorError::DanglingRef { entity: "CURVE" });
33366            }
33367        }
33368        LayeredItemRef::CylindricalSurface(i) => {
33369            if i.0 >= model.cylindrical_surface_arena.items.len() {
33370                return Err(AuthorError::DanglingRef {
33371                    entity: "CYLINDRICAL_SURFACE",
33372                });
33373            }
33374        }
33375        LayeredItemRef::DefinedCharacterGlyph(i) => {
33376            if i.0 >= model.defined_character_glyph_arena.items.len() {
33377                return Err(AuthorError::DanglingRef {
33378                    entity: "DEFINED_CHARACTER_GLYPH",
33379                });
33380            }
33381        }
33382        LayeredItemRef::DefinedSymbol(i) => {
33383            if i.0 >= model.defined_symbol_arena.items.len() {
33384                return Err(AuthorError::DanglingRef {
33385                    entity: "DEFINED_SYMBOL",
33386                });
33387            }
33388        }
33389        LayeredItemRef::DegenerateToroidalSurface(i) => {
33390            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
33391                return Err(AuthorError::DanglingRef {
33392                    entity: "DEGENERATE_TOROIDAL_SURFACE",
33393                });
33394            }
33395        }
33396        LayeredItemRef::DescriptiveRepresentationItem(i) => {
33397            if i.0 >= model.descriptive_representation_item_arena.items.len() {
33398                return Err(AuthorError::DanglingRef {
33399                    entity: "DESCRIPTIVE_REPRESENTATION_ITEM",
33400                });
33401            }
33402        }
33403        LayeredItemRef::Direction(i) => {
33404            if i.0 >= model.direction_arena.items.len() {
33405                return Err(AuthorError::DanglingRef {
33406                    entity: "DIRECTION",
33407                });
33408            }
33409        }
33410        LayeredItemRef::DraughtingAnnotationOccurrence(i) => {
33411            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
33412                return Err(AuthorError::DanglingRef {
33413                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
33414                });
33415            }
33416        }
33417        LayeredItemRef::DraughtingCallout(i) => {
33418            if i.0 >= model.draughting_callout_arena.items.len() {
33419                return Err(AuthorError::DanglingRef {
33420                    entity: "DRAUGHTING_CALLOUT",
33421                });
33422            }
33423        }
33424        LayeredItemRef::Edge(i) => {
33425            if i.0 >= model.edge_arena.items.len() {
33426                return Err(AuthorError::DanglingRef { entity: "EDGE" });
33427            }
33428        }
33429        LayeredItemRef::EdgeCurve(i) => {
33430            if i.0 >= model.edge_curve_arena.items.len() {
33431                return Err(AuthorError::DanglingRef {
33432                    entity: "EDGE_CURVE",
33433                });
33434            }
33435        }
33436        LayeredItemRef::EdgeLoop(i) => {
33437            if i.0 >= model.edge_loop_arena.items.len() {
33438                return Err(AuthorError::DanglingRef {
33439                    entity: "EDGE_LOOP",
33440                });
33441            }
33442        }
33443        LayeredItemRef::ElementarySurface(i) => {
33444            if i.0 >= model.elementary_surface_arena.items.len() {
33445                return Err(AuthorError::DanglingRef {
33446                    entity: "ELEMENTARY_SURFACE",
33447                });
33448            }
33449        }
33450        LayeredItemRef::Ellipse(i) => {
33451            if i.0 >= model.ellipse_arena.items.len() {
33452                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
33453            }
33454        }
33455        LayeredItemRef::ExternallyDefinedHatchStyle(i) => {
33456            if i.0 >= model.externally_defined_hatch_style_arena.items.len() {
33457                return Err(AuthorError::DanglingRef {
33458                    entity: "EXTERNALLY_DEFINED_HATCH_STYLE",
33459                });
33460            }
33461        }
33462        LayeredItemRef::ExternallyDefinedTileStyle(i) => {
33463            if i.0 >= model.externally_defined_tile_style_arena.items.len() {
33464                return Err(AuthorError::DanglingRef {
33465                    entity: "EXTERNALLY_DEFINED_TILE_STYLE",
33466                });
33467            }
33468        }
33469        LayeredItemRef::Face(i) => {
33470            if i.0 >= model.face_arena.items.len() {
33471                return Err(AuthorError::DanglingRef { entity: "FACE" });
33472            }
33473        }
33474        LayeredItemRef::FaceBound(i) => {
33475            if i.0 >= model.face_bound_arena.items.len() {
33476                return Err(AuthorError::DanglingRef {
33477                    entity: "FACE_BOUND",
33478                });
33479            }
33480        }
33481        LayeredItemRef::FaceOuterBound(i) => {
33482            if i.0 >= model.face_outer_bound_arena.items.len() {
33483                return Err(AuthorError::DanglingRef {
33484                    entity: "FACE_OUTER_BOUND",
33485                });
33486            }
33487        }
33488        LayeredItemRef::FaceSurface(i) => {
33489            if i.0 >= model.face_surface_arena.items.len() {
33490                return Err(AuthorError::DanglingRef {
33491                    entity: "FACE_SURFACE",
33492                });
33493            }
33494        }
33495        LayeredItemRef::FillAreaStyleHatching(i) => {
33496            if i.0 >= model.fill_area_style_hatching_arena.items.len() {
33497                return Err(AuthorError::DanglingRef {
33498                    entity: "FILL_AREA_STYLE_HATCHING",
33499                });
33500            }
33501        }
33502        LayeredItemRef::FillAreaStyleTileColouredRegion(i) => {
33503            if i.0 >= model.fill_area_style_tile_coloured_region_arena.items.len() {
33504                return Err(AuthorError::DanglingRef {
33505                    entity: "FILL_AREA_STYLE_TILE_COLOURED_REGION",
33506                });
33507            }
33508        }
33509        LayeredItemRef::FillAreaStyleTileCurveWithStyle(i) => {
33510            if i.0
33511                >= model
33512                    .fill_area_style_tile_curve_with_style_arena
33513                    .items
33514                    .len()
33515            {
33516                return Err(AuthorError::DanglingRef {
33517                    entity: "FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE",
33518                });
33519            }
33520        }
33521        LayeredItemRef::FillAreaStyleTileSymbolWithStyle(i) => {
33522            if i.0
33523                >= model
33524                    .fill_area_style_tile_symbol_with_style_arena
33525                    .items
33526                    .len()
33527            {
33528                return Err(AuthorError::DanglingRef {
33529                    entity: "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE",
33530                });
33531            }
33532        }
33533        LayeredItemRef::FillAreaStyleTiles(i) => {
33534            if i.0 >= model.fill_area_style_tiles_arena.items.len() {
33535                return Err(AuthorError::DanglingRef {
33536                    entity: "FILL_AREA_STYLE_TILES",
33537                });
33538            }
33539        }
33540        LayeredItemRef::GeometricCurveSet(i) => {
33541            if i.0 >= model.geometric_curve_set_arena.items.len() {
33542                return Err(AuthorError::DanglingRef {
33543                    entity: "GEOMETRIC_CURVE_SET",
33544                });
33545            }
33546        }
33547        LayeredItemRef::GeometricRepresentationItem(i) => {
33548            if i.0 >= model.geometric_representation_item_arena.items.len() {
33549                return Err(AuthorError::DanglingRef {
33550                    entity: "GEOMETRIC_REPRESENTATION_ITEM",
33551                });
33552            }
33553        }
33554        LayeredItemRef::GeometricSet(i) => {
33555            if i.0 >= model.geometric_set_arena.items.len() {
33556                return Err(AuthorError::DanglingRef {
33557                    entity: "GEOMETRIC_SET",
33558                });
33559            }
33560        }
33561        LayeredItemRef::Hyperbola(i) => {
33562            if i.0 >= model.hyperbola_arena.items.len() {
33563                return Err(AuthorError::DanglingRef {
33564                    entity: "HYPERBOLA",
33565                });
33566            }
33567        }
33568        LayeredItemRef::IntegerRepresentationItem(i) => {
33569            if i.0 >= model.integer_representation_item_arena.items.len() {
33570                return Err(AuthorError::DanglingRef {
33571                    entity: "INTEGER_REPRESENTATION_ITEM",
33572                });
33573            }
33574        }
33575        LayeredItemRef::IntersectionCurve(i) => {
33576            if i.0 >= model.intersection_curve_arena.items.len() {
33577                return Err(AuthorError::DanglingRef {
33578                    entity: "INTERSECTION_CURVE",
33579                });
33580            }
33581        }
33582        LayeredItemRef::LeaderCurve(i) => {
33583            if i.0 >= model.leader_curve_arena.items.len() {
33584                return Err(AuthorError::DanglingRef {
33585                    entity: "LEADER_CURVE",
33586                });
33587            }
33588        }
33589        LayeredItemRef::LeaderDirectedCallout(i) => {
33590            if i.0 >= model.leader_directed_callout_arena.items.len() {
33591                return Err(AuthorError::DanglingRef {
33592                    entity: "LEADER_DIRECTED_CALLOUT",
33593                });
33594            }
33595        }
33596        LayeredItemRef::LeaderTerminator(i) => {
33597            if i.0 >= model.leader_terminator_arena.items.len() {
33598                return Err(AuthorError::DanglingRef {
33599                    entity: "LEADER_TERMINATOR",
33600                });
33601            }
33602        }
33603        LayeredItemRef::Line(i) => {
33604            if i.0 >= model.line_arena.items.len() {
33605                return Err(AuthorError::DanglingRef { entity: "LINE" });
33606            }
33607        }
33608        LayeredItemRef::Loop(i) => {
33609            if i.0 >= model.loop_arena.items.len() {
33610                return Err(AuthorError::DanglingRef { entity: "LOOP" });
33611            }
33612        }
33613        LayeredItemRef::ManifoldSolidBrep(i) => {
33614            if i.0 >= model.manifold_solid_brep_arena.items.len() {
33615                return Err(AuthorError::DanglingRef {
33616                    entity: "MANIFOLD_SOLID_BREP",
33617                });
33618            }
33619        }
33620        LayeredItemRef::MappedItem(i) => {
33621            if i.0 >= model.mapped_item_arena.items.len() {
33622                return Err(AuthorError::DanglingRef {
33623                    entity: "MAPPED_ITEM",
33624                });
33625            }
33626        }
33627        LayeredItemRef::MeasureRepresentationItem(i) => {
33628            if i.0 >= model.measure_representation_item_arena.items.len() {
33629                return Err(AuthorError::DanglingRef {
33630                    entity: "MEASURE_REPRESENTATION_ITEM",
33631                });
33632            }
33633        }
33634        LayeredItemRef::OffsetSurface(i) => {
33635            if i.0 >= model.offset_surface_arena.items.len() {
33636                return Err(AuthorError::DanglingRef {
33637                    entity: "OFFSET_SURFACE",
33638                });
33639            }
33640        }
33641        LayeredItemRef::OneDirectionRepeatFactor(i) => {
33642            if i.0 >= model.one_direction_repeat_factor_arena.items.len() {
33643                return Err(AuthorError::DanglingRef {
33644                    entity: "ONE_DIRECTION_REPEAT_FACTOR",
33645                });
33646            }
33647        }
33648        LayeredItemRef::OpenShell(i) => {
33649            if i.0 >= model.open_shell_arena.items.len() {
33650                return Err(AuthorError::DanglingRef {
33651                    entity: "OPEN_SHELL",
33652                });
33653            }
33654        }
33655        LayeredItemRef::OrientedClosedShell(i) => {
33656            if i.0 >= model.oriented_closed_shell_arena.items.len() {
33657                return Err(AuthorError::DanglingRef {
33658                    entity: "ORIENTED_CLOSED_SHELL",
33659                });
33660            }
33661        }
33662        LayeredItemRef::OrientedEdge(i) => {
33663            if i.0 >= model.oriented_edge_arena.items.len() {
33664                return Err(AuthorError::DanglingRef {
33665                    entity: "ORIENTED_EDGE",
33666                });
33667            }
33668        }
33669        LayeredItemRef::OverRidingStyledItem(i) => {
33670            if i.0 >= model.over_riding_styled_item_arena.items.len() {
33671                return Err(AuthorError::DanglingRef {
33672                    entity: "OVER_RIDING_STYLED_ITEM",
33673                });
33674            }
33675        }
33676        LayeredItemRef::Path(i) => {
33677            if i.0 >= model.path_arena.items.len() {
33678                return Err(AuthorError::DanglingRef { entity: "PATH" });
33679            }
33680        }
33681        LayeredItemRef::Pcurve(i) => {
33682            if i.0 >= model.pcurve_arena.items.len() {
33683                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
33684            }
33685        }
33686        LayeredItemRef::Placement(i) => {
33687            if i.0 >= model.placement_arena.items.len() {
33688                return Err(AuthorError::DanglingRef {
33689                    entity: "PLACEMENT",
33690                });
33691            }
33692        }
33693        LayeredItemRef::PlanarBox(i) => {
33694            if i.0 >= model.planar_box_arena.items.len() {
33695                return Err(AuthorError::DanglingRef {
33696                    entity: "PLANAR_BOX",
33697                });
33698            }
33699        }
33700        LayeredItemRef::PlanarExtent(i) => {
33701            if i.0 >= model.planar_extent_arena.items.len() {
33702                return Err(AuthorError::DanglingRef {
33703                    entity: "PLANAR_EXTENT",
33704                });
33705            }
33706        }
33707        LayeredItemRef::Plane(i) => {
33708            if i.0 >= model.plane_arena.items.len() {
33709                return Err(AuthorError::DanglingRef { entity: "PLANE" });
33710            }
33711        }
33712        LayeredItemRef::Point(i) => {
33713            if i.0 >= model.point_arena.items.len() {
33714                return Err(AuthorError::DanglingRef { entity: "POINT" });
33715            }
33716        }
33717        LayeredItemRef::PolyLoop(i) => {
33718            if i.0 >= model.poly_loop_arena.items.len() {
33719                return Err(AuthorError::DanglingRef {
33720                    entity: "POLY_LOOP",
33721                });
33722            }
33723        }
33724        LayeredItemRef::Polyline(i) => {
33725            if i.0 >= model.polyline_arena.items.len() {
33726                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
33727            }
33728        }
33729        LayeredItemRef::PresentationArea(i) => {
33730            if i.0 >= model.presentation_area_arena.items.len() {
33731                return Err(AuthorError::DanglingRef {
33732                    entity: "PRESENTATION_AREA",
33733                });
33734            }
33735        }
33736        LayeredItemRef::PresentationRepresentation(i) => {
33737            if i.0 >= model.presentation_representation_arena.items.len() {
33738                return Err(AuthorError::DanglingRef {
33739                    entity: "PRESENTATION_REPRESENTATION",
33740                });
33741            }
33742        }
33743        LayeredItemRef::PresentationView(i) => {
33744            if i.0 >= model.presentation_view_arena.items.len() {
33745                return Err(AuthorError::DanglingRef {
33746                    entity: "PRESENTATION_VIEW",
33747                });
33748            }
33749        }
33750        LayeredItemRef::QualifiedRepresentationItem(i) => {
33751            if i.0 >= model.qualified_representation_item_arena.items.len() {
33752                return Err(AuthorError::DanglingRef {
33753                    entity: "QUALIFIED_REPRESENTATION_ITEM",
33754                });
33755            }
33756        }
33757        LayeredItemRef::QuasiUniformCurve(i) => {
33758            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
33759                return Err(AuthorError::DanglingRef {
33760                    entity: "QUASI_UNIFORM_CURVE",
33761                });
33762            }
33763        }
33764        LayeredItemRef::QuasiUniformSurface(i) => {
33765            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
33766                return Err(AuthorError::DanglingRef {
33767                    entity: "QUASI_UNIFORM_SURFACE",
33768                });
33769            }
33770        }
33771        LayeredItemRef::RationalBSplineCurve(i) => {
33772            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
33773                return Err(AuthorError::DanglingRef {
33774                    entity: "RATIONAL_B_SPLINE_CURVE",
33775                });
33776            }
33777        }
33778        LayeredItemRef::RationalBSplineSurface(i) => {
33779            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
33780                return Err(AuthorError::DanglingRef {
33781                    entity: "RATIONAL_B_SPLINE_SURFACE",
33782                });
33783            }
33784        }
33785        LayeredItemRef::RealRepresentationItem(i) => {
33786            if i.0 >= model.real_representation_item_arena.items.len() {
33787                return Err(AuthorError::DanglingRef {
33788                    entity: "REAL_REPRESENTATION_ITEM",
33789                });
33790            }
33791        }
33792        LayeredItemRef::RepositionedTessellatedItem(i) => {
33793            if i.0 >= model.repositioned_tessellated_item_arena.items.len() {
33794                return Err(AuthorError::DanglingRef {
33795                    entity: "REPOSITIONED_TESSELLATED_ITEM",
33796                });
33797            }
33798        }
33799        LayeredItemRef::RepresentationItem(i) => {
33800            if i.0 >= model.representation_item_arena.items.len() {
33801                return Err(AuthorError::DanglingRef {
33802                    entity: "REPRESENTATION_ITEM",
33803                });
33804            }
33805        }
33806        LayeredItemRef::SeamCurve(i) => {
33807            if i.0 >= model.seam_curve_arena.items.len() {
33808                return Err(AuthorError::DanglingRef {
33809                    entity: "SEAM_CURVE",
33810                });
33811            }
33812        }
33813        LayeredItemRef::ShellBasedSurfaceModel(i) => {
33814            if i.0 >= model.shell_based_surface_model_arena.items.len() {
33815                return Err(AuthorError::DanglingRef {
33816                    entity: "SHELL_BASED_SURFACE_MODEL",
33817                });
33818            }
33819        }
33820        LayeredItemRef::SolidModel(i) => {
33821            if i.0 >= model.solid_model_arena.items.len() {
33822                return Err(AuthorError::DanglingRef {
33823                    entity: "SOLID_MODEL",
33824                });
33825            }
33826        }
33827        LayeredItemRef::SphericalSurface(i) => {
33828            if i.0 >= model.spherical_surface_arena.items.len() {
33829                return Err(AuthorError::DanglingRef {
33830                    entity: "SPHERICAL_SURFACE",
33831                });
33832            }
33833        }
33834        LayeredItemRef::StyledItem(i) => {
33835            if i.0 >= model.styled_item_arena.items.len() {
33836                return Err(AuthorError::DanglingRef {
33837                    entity: "STYLED_ITEM",
33838                });
33839            }
33840        }
33841        LayeredItemRef::Surface(i) => {
33842            if i.0 >= model.surface_arena.items.len() {
33843                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
33844            }
33845        }
33846        LayeredItemRef::SurfaceCurve(i) => {
33847            if i.0 >= model.surface_curve_arena.items.len() {
33848                return Err(AuthorError::DanglingRef {
33849                    entity: "SURFACE_CURVE",
33850                });
33851            }
33852        }
33853        LayeredItemRef::SurfaceOfLinearExtrusion(i) => {
33854            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
33855                return Err(AuthorError::DanglingRef {
33856                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
33857                });
33858            }
33859        }
33860        LayeredItemRef::SurfaceOfRevolution(i) => {
33861            if i.0 >= model.surface_of_revolution_arena.items.len() {
33862                return Err(AuthorError::DanglingRef {
33863                    entity: "SURFACE_OF_REVOLUTION",
33864                });
33865            }
33866        }
33867        LayeredItemRef::SweptSurface(i) => {
33868            if i.0 >= model.swept_surface_arena.items.len() {
33869                return Err(AuthorError::DanglingRef {
33870                    entity: "SWEPT_SURFACE",
33871                });
33872            }
33873        }
33874        LayeredItemRef::SymbolTarget(i) => {
33875            if i.0 >= model.symbol_target_arena.items.len() {
33876                return Err(AuthorError::DanglingRef {
33877                    entity: "SYMBOL_TARGET",
33878                });
33879            }
33880        }
33881        LayeredItemRef::TerminatorSymbol(i) => {
33882            if i.0 >= model.terminator_symbol_arena.items.len() {
33883                return Err(AuthorError::DanglingRef {
33884                    entity: "TERMINATOR_SYMBOL",
33885                });
33886            }
33887        }
33888        LayeredItemRef::TessellatedAnnotationOccurrence(i) => {
33889            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
33890                return Err(AuthorError::DanglingRef {
33891                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
33892                });
33893            }
33894        }
33895        LayeredItemRef::TessellatedCurveSet(i) => {
33896            if i.0 >= model.tessellated_curve_set_arena.items.len() {
33897                return Err(AuthorError::DanglingRef {
33898                    entity: "TESSELLATED_CURVE_SET",
33899                });
33900            }
33901        }
33902        LayeredItemRef::TessellatedFace(i) => {
33903            if i.0 >= model.tessellated_face_arena.items.len() {
33904                return Err(AuthorError::DanglingRef {
33905                    entity: "TESSELLATED_FACE",
33906                });
33907            }
33908        }
33909        LayeredItemRef::TessellatedGeometricSet(i) => {
33910            if i.0 >= model.tessellated_geometric_set_arena.items.len() {
33911                return Err(AuthorError::DanglingRef {
33912                    entity: "TESSELLATED_GEOMETRIC_SET",
33913                });
33914            }
33915        }
33916        LayeredItemRef::TessellatedItem(i) => {
33917            if i.0 >= model.tessellated_item_arena.items.len() {
33918                return Err(AuthorError::DanglingRef {
33919                    entity: "TESSELLATED_ITEM",
33920                });
33921            }
33922        }
33923        LayeredItemRef::TessellatedShell(i) => {
33924            if i.0 >= model.tessellated_shell_arena.items.len() {
33925                return Err(AuthorError::DanglingRef {
33926                    entity: "TESSELLATED_SHELL",
33927                });
33928            }
33929        }
33930        LayeredItemRef::TessellatedSolid(i) => {
33931            if i.0 >= model.tessellated_solid_arena.items.len() {
33932                return Err(AuthorError::DanglingRef {
33933                    entity: "TESSELLATED_SOLID",
33934                });
33935            }
33936        }
33937        LayeredItemRef::TessellatedStructuredItem(i) => {
33938            if i.0 >= model.tessellated_structured_item_arena.items.len() {
33939                return Err(AuthorError::DanglingRef {
33940                    entity: "TESSELLATED_STRUCTURED_ITEM",
33941                });
33942            }
33943        }
33944        LayeredItemRef::TessellatedSurfaceSet(i) => {
33945            if i.0 >= model.tessellated_surface_set_arena.items.len() {
33946                return Err(AuthorError::DanglingRef {
33947                    entity: "TESSELLATED_SURFACE_SET",
33948                });
33949            }
33950        }
33951        LayeredItemRef::TextLiteral(i) => {
33952            if i.0 >= model.text_literal_arena.items.len() {
33953                return Err(AuthorError::DanglingRef {
33954                    entity: "TEXT_LITERAL",
33955                });
33956            }
33957        }
33958        LayeredItemRef::TopologicalRepresentationItem(i) => {
33959            if i.0 >= model.topological_representation_item_arena.items.len() {
33960                return Err(AuthorError::DanglingRef {
33961                    entity: "TOPOLOGICAL_REPRESENTATION_ITEM",
33962                });
33963            }
33964        }
33965        LayeredItemRef::ToroidalSurface(i) => {
33966            if i.0 >= model.toroidal_surface_arena.items.len() {
33967                return Err(AuthorError::DanglingRef {
33968                    entity: "TOROIDAL_SURFACE",
33969                });
33970            }
33971        }
33972        LayeredItemRef::TrimmedCurve(i) => {
33973            if i.0 >= model.trimmed_curve_arena.items.len() {
33974                return Err(AuthorError::DanglingRef {
33975                    entity: "TRIMMED_CURVE",
33976                });
33977            }
33978        }
33979        LayeredItemRef::TwoDirectionRepeatFactor(i) => {
33980            if i.0 >= model.two_direction_repeat_factor_arena.items.len() {
33981                return Err(AuthorError::DanglingRef {
33982                    entity: "TWO_DIRECTION_REPEAT_FACTOR",
33983                });
33984            }
33985        }
33986        LayeredItemRef::UniformCurve(i) => {
33987            if i.0 >= model.uniform_curve_arena.items.len() {
33988                return Err(AuthorError::DanglingRef {
33989                    entity: "UNIFORM_CURVE",
33990                });
33991            }
33992        }
33993        LayeredItemRef::UniformSurface(i) => {
33994            if i.0 >= model.uniform_surface_arena.items.len() {
33995                return Err(AuthorError::DanglingRef {
33996                    entity: "UNIFORM_SURFACE",
33997                });
33998            }
33999        }
34000        LayeredItemRef::ValueRepresentationItem(i) => {
34001            if i.0 >= model.value_representation_item_arena.items.len() {
34002                return Err(AuthorError::DanglingRef {
34003                    entity: "VALUE_REPRESENTATION_ITEM",
34004                });
34005            }
34006        }
34007        LayeredItemRef::Vector(i) => {
34008            if i.0 >= model.vector_arena.items.len() {
34009                return Err(AuthorError::DanglingRef { entity: "VECTOR" });
34010            }
34011        }
34012        LayeredItemRef::Vertex(i) => {
34013            if i.0 >= model.vertex_arena.items.len() {
34014                return Err(AuthorError::DanglingRef { entity: "VERTEX" });
34015            }
34016        }
34017        LayeredItemRef::VertexLoop(i) => {
34018            if i.0 >= model.vertex_loop_arena.items.len() {
34019                return Err(AuthorError::DanglingRef {
34020                    entity: "VERTEX_LOOP",
34021                });
34022            }
34023        }
34024        LayeredItemRef::VertexPoint(i) => {
34025            if i.0 >= model.vertex_point_arena.items.len() {
34026                return Err(AuthorError::DanglingRef {
34027                    entity: "VERTEX_POINT",
34028                });
34029            }
34030        }
34031        LayeredItemRef::VertexShell(i) => {
34032            if i.0 >= model.vertex_shell_arena.items.len() {
34033                return Err(AuthorError::DanglingRef {
34034                    entity: "VERTEX_SHELL",
34035                });
34036            }
34037        }
34038        LayeredItemRef::WireShell(i) => {
34039            if i.0 >= model.wire_shell_arena.items.len() {
34040                return Err(AuthorError::DanglingRef {
34041                    entity: "WIRE_SHELL",
34042                });
34043            }
34044        }
34045        LayeredItemRef::Complex(i) => {
34046            if i.0 >= model.complex_unit_arena.items.len() {
34047                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34048            }
34049        }
34050    }
34051    Ok(())
34052}
34053fn check_length_measure_with_unit_ref(
34054    model: &StepModel,
34055    r: &LengthMeasureWithUnitRef,
34056) -> Result<(), AuthorError> {
34057    match r {
34058        LengthMeasureWithUnitRef::LengthMeasureWithUnit(i) => {
34059            if i.0 >= model.length_measure_with_unit_arena.items.len() {
34060                return Err(AuthorError::DanglingRef {
34061                    entity: "LENGTH_MEASURE_WITH_UNIT",
34062                });
34063            }
34064        }
34065        LengthMeasureWithUnitRef::Complex(i) => {
34066            if i.0 >= model.complex_unit_arena.items.len() {
34067                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34068            }
34069        }
34070    }
34071    Ok(())
34072}
34073fn check_length_or_plane_angle_measure_with_unit_select_ref(
34074    model: &StepModel,
34075    r: &LengthOrPlaneAngleMeasureWithUnitSelectRef,
34076) -> Result<(), AuthorError> {
34077    match r {
34078        LengthOrPlaneAngleMeasureWithUnitSelectRef::LengthMeasureWithUnit(i) => {
34079            if i.0 >= model.length_measure_with_unit_arena.items.len() {
34080                return Err(AuthorError::DanglingRef {
34081                    entity: "LENGTH_MEASURE_WITH_UNIT",
34082                });
34083            }
34084        }
34085        LengthOrPlaneAngleMeasureWithUnitSelectRef::PlaneAngleMeasureWithUnit(i) => {
34086            if i.0 >= model.plane_angle_measure_with_unit_arena.items.len() {
34087                return Err(AuthorError::DanglingRef {
34088                    entity: "PLANE_ANGLE_MEASURE_WITH_UNIT",
34089                });
34090            }
34091        }
34092        LengthOrPlaneAngleMeasureWithUnitSelectRef::Complex(i) => {
34093            if i.0 >= model.complex_unit_arena.items.len() {
34094                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34095            }
34096        }
34097    }
34098    Ok(())
34099}
34100fn check_local_time_ref(model: &StepModel, r: &LocalTimeRef) -> Result<(), AuthorError> {
34101    match r {
34102        LocalTimeRef::LocalTime(i) => {
34103            if i.0 >= model.local_time_arena.items.len() {
34104                return Err(AuthorError::DanglingRef {
34105                    entity: "LOCAL_TIME",
34106                });
34107            }
34108        }
34109    }
34110    Ok(())
34111}
34112fn check_loop_ref(model: &StepModel, r: &LoopRef) -> Result<(), AuthorError> {
34113    match r {
34114        LoopRef::EdgeLoop(i) => {
34115            if i.0 >= model.edge_loop_arena.items.len() {
34116                return Err(AuthorError::DanglingRef {
34117                    entity: "EDGE_LOOP",
34118                });
34119            }
34120        }
34121        LoopRef::Loop(i) => {
34122            if i.0 >= model.loop_arena.items.len() {
34123                return Err(AuthorError::DanglingRef { entity: "LOOP" });
34124            }
34125        }
34126        LoopRef::PolyLoop(i) => {
34127            if i.0 >= model.poly_loop_arena.items.len() {
34128                return Err(AuthorError::DanglingRef {
34129                    entity: "POLY_LOOP",
34130                });
34131            }
34132        }
34133        LoopRef::VertexLoop(i) => {
34134            if i.0 >= model.vertex_loop_arena.items.len() {
34135                return Err(AuthorError::DanglingRef {
34136                    entity: "VERTEX_LOOP",
34137                });
34138            }
34139        }
34140        LoopRef::Complex(i) => {
34141            if i.0 >= model.complex_unit_arena.items.len() {
34142                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34143            }
34144        }
34145    }
34146    Ok(())
34147}
34148fn check_manifold_solid_brep_ref(
34149    model: &StepModel,
34150    r: &ManifoldSolidBrepRef,
34151) -> Result<(), AuthorError> {
34152    match r {
34153        ManifoldSolidBrepRef::BrepWithVoids(i) => {
34154            if i.0 >= model.brep_with_voids_arena.items.len() {
34155                return Err(AuthorError::DanglingRef {
34156                    entity: "BREP_WITH_VOIDS",
34157                });
34158            }
34159        }
34160        ManifoldSolidBrepRef::ManifoldSolidBrep(i) => {
34161            if i.0 >= model.manifold_solid_brep_arena.items.len() {
34162                return Err(AuthorError::DanglingRef {
34163                    entity: "MANIFOLD_SOLID_BREP",
34164                });
34165            }
34166        }
34167        ManifoldSolidBrepRef::Complex(i) => {
34168            if i.0 >= model.complex_unit_arena.items.len() {
34169                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34170            }
34171        }
34172    }
34173    Ok(())
34174}
34175fn check_marker_select_ref(model: &StepModel, r: &MarkerSelectRef) -> Result<(), AuthorError> {
34176    match r {
34177        MarkerSelectRef::PreDefinedMarker(i) => {
34178            if i.0 >= model.pre_defined_marker_arena.items.len() {
34179                return Err(AuthorError::DanglingRef {
34180                    entity: "PRE_DEFINED_MARKER",
34181                });
34182            }
34183        }
34184        MarkerSelectRef::PreDefinedPointMarkerSymbol(i) => {
34185            if i.0 >= model.pre_defined_point_marker_symbol_arena.items.len() {
34186                return Err(AuthorError::DanglingRef {
34187                    entity: "PRE_DEFINED_POINT_MARKER_SYMBOL",
34188                });
34189            }
34190        }
34191        MarkerSelectRef::MarkerType(_) => {}
34192        MarkerSelectRef::Complex(i) => {
34193            if i.0 >= model.complex_unit_arena.items.len() {
34194                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34195            }
34196        }
34197    }
34198    Ok(())
34199}
34200fn check_measure_with_unit_ref(
34201    model: &StepModel,
34202    r: &MeasureWithUnitRef,
34203) -> Result<(), AuthorError> {
34204    match r {
34205        MeasureWithUnitRef::LengthMeasureWithUnit(i) => {
34206            if i.0 >= model.length_measure_with_unit_arena.items.len() {
34207                return Err(AuthorError::DanglingRef {
34208                    entity: "LENGTH_MEASURE_WITH_UNIT",
34209                });
34210            }
34211        }
34212        MeasureWithUnitRef::MassMeasureWithUnit(i) => {
34213            if i.0 >= model.mass_measure_with_unit_arena.items.len() {
34214                return Err(AuthorError::DanglingRef {
34215                    entity: "MASS_MEASURE_WITH_UNIT",
34216                });
34217            }
34218        }
34219        MeasureWithUnitRef::MeasureRepresentationItem(i) => {
34220            if i.0 >= model.measure_representation_item_arena.items.len() {
34221                return Err(AuthorError::DanglingRef {
34222                    entity: "MEASURE_REPRESENTATION_ITEM",
34223                });
34224            }
34225        }
34226        MeasureWithUnitRef::MeasureWithUnit(i) => {
34227            if i.0 >= model.measure_with_unit_arena.items.len() {
34228                return Err(AuthorError::DanglingRef {
34229                    entity: "MEASURE_WITH_UNIT",
34230                });
34231            }
34232        }
34233        MeasureWithUnitRef::PlaneAngleMeasureWithUnit(i) => {
34234            if i.0 >= model.plane_angle_measure_with_unit_arena.items.len() {
34235                return Err(AuthorError::DanglingRef {
34236                    entity: "PLANE_ANGLE_MEASURE_WITH_UNIT",
34237                });
34238            }
34239        }
34240        MeasureWithUnitRef::RatioMeasureWithUnit(i) => {
34241            if i.0 >= model.ratio_measure_with_unit_arena.items.len() {
34242                return Err(AuthorError::DanglingRef {
34243                    entity: "RATIO_MEASURE_WITH_UNIT",
34244                });
34245            }
34246        }
34247        MeasureWithUnitRef::UncertaintyMeasureWithUnit(i) => {
34248            if i.0 >= model.uncertainty_measure_with_unit_arena.items.len() {
34249                return Err(AuthorError::DanglingRef {
34250                    entity: "UNCERTAINTY_MEASURE_WITH_UNIT",
34251                });
34252            }
34253        }
34254        MeasureWithUnitRef::Complex(i) => {
34255            if i.0 >= model.complex_unit_arena.items.len() {
34256                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34257            }
34258        }
34259    }
34260    Ok(())
34261}
34262fn check_mechanical_design_and_draughting_relationship_select_ref(
34263    model: &StepModel,
34264    r: &MechanicalDesignAndDraughtingRelationshipSelectRef,
34265) -> Result<(), AuthorError> {
34266    match r {
34267        MechanicalDesignAndDraughtingRelationshipSelectRef::AdvancedBrepShapeRepresentation(i) => { if i.0 >= model.advanced_brep_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ADVANCED_BREP_SHAPE_REPRESENTATION" }); } }
34268        MechanicalDesignAndDraughtingRelationshipSelectRef::DraughtingModel(i) => { if i.0 >= model.draughting_model_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "DRAUGHTING_MODEL" }); } }
34269        MechanicalDesignAndDraughtingRelationshipSelectRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => { if i.0 >= model.geometrically_bounded_surface_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION" }); } }
34270        MechanicalDesignAndDraughtingRelationshipSelectRef::GeometricallyBoundedWireframeShapeRepresentation(i) => { if i.0 >= model.geometrically_bounded_wireframe_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION" }); } }
34271        MechanicalDesignAndDraughtingRelationshipSelectRef::ManifoldSurfaceShapeRepresentation(i) => { if i.0 >= model.manifold_surface_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION" }); } }
34272        MechanicalDesignAndDraughtingRelationshipSelectRef::MechanicalDesignGeometricPresentationRepresentation(i) => { if i.0 >= model.mechanical_design_geometric_presentation_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION" }); } }
34273        MechanicalDesignAndDraughtingRelationshipSelectRef::MechanicalDesignPresentationRepresentationWithDraughting(i) => { if i.0 >= model.mechanical_design_presentation_representation_with_draughting_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING" }); } }
34274        MechanicalDesignAndDraughtingRelationshipSelectRef::MechanicalDesignShadedPresentationRepresentation(i) => { if i.0 >= model.mechanical_design_shaded_presentation_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION" }); } }
34275        MechanicalDesignAndDraughtingRelationshipSelectRef::ShapeDimensionRepresentation(i) => { if i.0 >= model.shape_dimension_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SHAPE_DIMENSION_REPRESENTATION" }); } }
34276        MechanicalDesignAndDraughtingRelationshipSelectRef::ShapeRepresentation(i) => { if i.0 >= model.shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SHAPE_REPRESENTATION" }); } }
34277        MechanicalDesignAndDraughtingRelationshipSelectRef::ShapeRepresentationWithParameters(i) => { if i.0 >= model.shape_representation_with_parameters_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS" }); } }
34278        MechanicalDesignAndDraughtingRelationshipSelectRef::TessellatedShapeRepresentation(i) => { if i.0 >= model.tessellated_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TESSELLATED_SHAPE_REPRESENTATION" }); } }
34279        MechanicalDesignAndDraughtingRelationshipSelectRef::Complex(i) => { if i.0 >= model.complex_unit_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "COMPLEX" }); } }
34280    }
34281    Ok(())
34282}
34283fn check_name_attribute_select_ref(
34284    model: &StepModel,
34285    r: &NameAttributeSelectRef,
34286) -> Result<(), AuthorError> {
34287    match r {
34288        NameAttributeSelectRef::ActionRequestSolution(i) => {
34289            if i.0 >= model.action_request_solution_arena.items.len() {
34290                return Err(AuthorError::DanglingRef {
34291                    entity: "ACTION_REQUEST_SOLUTION",
34292                });
34293            }
34294        }
34295        NameAttributeSelectRef::Address(i) => {
34296            if i.0 >= model.address_arena.items.len() {
34297                return Err(AuthorError::DanglingRef { entity: "ADDRESS" });
34298            }
34299        }
34300        NameAttributeSelectRef::AreaUnit(i) => {
34301            if i.0 >= model.area_unit_arena.items.len() {
34302                return Err(AuthorError::DanglingRef {
34303                    entity: "AREA_UNIT",
34304                });
34305            }
34306        }
34307        NameAttributeSelectRef::ConfigurationDesign(i) => {
34308            if i.0 >= model.configuration_design_arena.items.len() {
34309                return Err(AuthorError::DanglingRef {
34310                    entity: "CONFIGURATION_DESIGN",
34311                });
34312            }
34313        }
34314        NameAttributeSelectRef::ConfigurationEffectivity(i) => {
34315            if i.0 >= model.configuration_effectivity_arena.items.len() {
34316                return Err(AuthorError::DanglingRef {
34317                    entity: "CONFIGURATION_EFFECTIVITY",
34318                });
34319            }
34320        }
34321        NameAttributeSelectRef::ContextDependentShapeRepresentation(i) => {
34322            if i.0
34323                >= model
34324                    .context_dependent_shape_representation_arena
34325                    .items
34326                    .len()
34327            {
34328                return Err(AuthorError::DanglingRef {
34329                    entity: "CONTEXT_DEPENDENT_SHAPE_REPRESENTATION",
34330                });
34331            }
34332        }
34333        NameAttributeSelectRef::DerivedUnit(i) => {
34334            if i.0 >= model.derived_unit_arena.items.len() {
34335                return Err(AuthorError::DanglingRef {
34336                    entity: "DERIVED_UNIT",
34337                });
34338            }
34339        }
34340        NameAttributeSelectRef::Effectivity(i) => {
34341            if i.0 >= model.effectivity_arena.items.len() {
34342                return Err(AuthorError::DanglingRef {
34343                    entity: "EFFECTIVITY",
34344                });
34345            }
34346        }
34347        NameAttributeSelectRef::OrganizationalAddress(i) => {
34348            if i.0 >= model.organizational_address_arena.items.len() {
34349                return Err(AuthorError::DanglingRef {
34350                    entity: "ORGANIZATIONAL_ADDRESS",
34351                });
34352            }
34353        }
34354        NameAttributeSelectRef::PersonAndOrganization(i) => {
34355            if i.0 >= model.person_and_organization_arena.items.len() {
34356                return Err(AuthorError::DanglingRef {
34357                    entity: "PERSON_AND_ORGANIZATION",
34358                });
34359            }
34360        }
34361        NameAttributeSelectRef::PersonAndOrganizationAddress(i) => {
34362            if i.0 >= model.person_and_organization_address_arena.items.len() {
34363                return Err(AuthorError::DanglingRef {
34364                    entity: "PERSON_AND_ORGANIZATION_ADDRESS",
34365                });
34366            }
34367        }
34368        NameAttributeSelectRef::PersonalAddress(i) => {
34369            if i.0 >= model.personal_address_arena.items.len() {
34370                return Err(AuthorError::DanglingRef {
34371                    entity: "PERSONAL_ADDRESS",
34372                });
34373            }
34374        }
34375        NameAttributeSelectRef::ProductDefinition(i) => {
34376            if i.0 >= model.product_definition_arena.items.len() {
34377                return Err(AuthorError::DanglingRef {
34378                    entity: "PRODUCT_DEFINITION",
34379                });
34380            }
34381        }
34382        NameAttributeSelectRef::ProductDefinitionEffectivity(i) => {
34383            if i.0 >= model.product_definition_effectivity_arena.items.len() {
34384                return Err(AuthorError::DanglingRef {
34385                    entity: "PRODUCT_DEFINITION_EFFECTIVITY",
34386                });
34387            }
34388        }
34389        NameAttributeSelectRef::ProductDefinitionSubstitute(i) => {
34390            if i.0 >= model.product_definition_substitute_arena.items.len() {
34391                return Err(AuthorError::DanglingRef {
34392                    entity: "PRODUCT_DEFINITION_SUBSTITUTE",
34393                });
34394            }
34395        }
34396        NameAttributeSelectRef::ProductDefinitionWithAssociatedDocuments(i) => {
34397            if i.0
34398                >= model
34399                    .product_definition_with_associated_documents_arena
34400                    .items
34401                    .len()
34402            {
34403                return Err(AuthorError::DanglingRef {
34404                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
34405                });
34406            }
34407        }
34408        NameAttributeSelectRef::PropertyDefinitionRepresentation(i) => {
34409            if i.0 >= model.property_definition_representation_arena.items.len() {
34410                return Err(AuthorError::DanglingRef {
34411                    entity: "PROPERTY_DEFINITION_REPRESENTATION",
34412                });
34413            }
34414        }
34415        NameAttributeSelectRef::ShapeDefinitionRepresentation(i) => {
34416            if i.0 >= model.shape_definition_representation_arena.items.len() {
34417                return Err(AuthorError::DanglingRef {
34418                    entity: "SHAPE_DEFINITION_REPRESENTATION",
34419                });
34420            }
34421        }
34422        NameAttributeSelectRef::VolumeUnit(i) => {
34423            if i.0 >= model.volume_unit_arena.items.len() {
34424                return Err(AuthorError::DanglingRef {
34425                    entity: "VOLUME_UNIT",
34426                });
34427            }
34428        }
34429        NameAttributeSelectRef::Complex(i) => {
34430            if i.0 >= model.complex_unit_arena.items.len() {
34431                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34432            }
34433        }
34434    }
34435    Ok(())
34436}
34437fn check_named_unit_ref(model: &StepModel, r: &NamedUnitRef) -> Result<(), AuthorError> {
34438    match r {
34439        NamedUnitRef::ContextDependentUnit(i) => {
34440            if i.0 >= model.context_dependent_unit_arena.items.len() {
34441                return Err(AuthorError::DanglingRef {
34442                    entity: "CONTEXT_DEPENDENT_UNIT",
34443                });
34444            }
34445        }
34446        NamedUnitRef::ConversionBasedUnit(i) => {
34447            if i.0 >= model.conversion_based_unit_arena.items.len() {
34448                return Err(AuthorError::DanglingRef {
34449                    entity: "CONVERSION_BASED_UNIT",
34450                });
34451            }
34452        }
34453        NamedUnitRef::LengthUnit(i) => {
34454            if i.0 >= model.length_unit_arena.items.len() {
34455                return Err(AuthorError::DanglingRef {
34456                    entity: "LENGTH_UNIT",
34457                });
34458            }
34459        }
34460        NamedUnitRef::MassUnit(i) => {
34461            if i.0 >= model.mass_unit_arena.items.len() {
34462                return Err(AuthorError::DanglingRef {
34463                    entity: "MASS_UNIT",
34464                });
34465            }
34466        }
34467        NamedUnitRef::NamedUnit(i) => {
34468            if i.0 >= model.named_unit_arena.items.len() {
34469                return Err(AuthorError::DanglingRef {
34470                    entity: "NAMED_UNIT",
34471                });
34472            }
34473        }
34474        NamedUnitRef::PlaneAngleUnit(i) => {
34475            if i.0 >= model.plane_angle_unit_arena.items.len() {
34476                return Err(AuthorError::DanglingRef {
34477                    entity: "PLANE_ANGLE_UNIT",
34478                });
34479            }
34480        }
34481        NamedUnitRef::RatioUnit(i) => {
34482            if i.0 >= model.ratio_unit_arena.items.len() {
34483                return Err(AuthorError::DanglingRef {
34484                    entity: "RATIO_UNIT",
34485                });
34486            }
34487        }
34488        NamedUnitRef::SiUnit(i) => {
34489            if i.0 >= model.si_unit_arena.items.len() {
34490                return Err(AuthorError::DanglingRef { entity: "SI_UNIT" });
34491            }
34492        }
34493        NamedUnitRef::SolidAngleUnit(i) => {
34494            if i.0 >= model.solid_angle_unit_arena.items.len() {
34495                return Err(AuthorError::DanglingRef {
34496                    entity: "SOLID_ANGLE_UNIT",
34497                });
34498            }
34499        }
34500        NamedUnitRef::TimeUnit(i) => {
34501            if i.0 >= model.time_unit_arena.items.len() {
34502                return Err(AuthorError::DanglingRef {
34503                    entity: "TIME_UNIT",
34504                });
34505            }
34506        }
34507        NamedUnitRef::Complex(i) => {
34508            if i.0 >= model.complex_unit_arena.items.len() {
34509                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34510            }
34511        }
34512    }
34513    Ok(())
34514}
34515fn check_object_role_ref(model: &StepModel, r: &ObjectRoleRef) -> Result<(), AuthorError> {
34516    match r {
34517        ObjectRoleRef::ObjectRole(i) => {
34518            if i.0 >= model.object_role_arena.items.len() {
34519                return Err(AuthorError::DanglingRef {
34520                    entity: "OBJECT_ROLE",
34521                });
34522            }
34523        }
34524    }
34525    Ok(())
34526}
34527fn check_one_direction_repeat_factor_ref(
34528    model: &StepModel,
34529    r: &OneDirectionRepeatFactorRef,
34530) -> Result<(), AuthorError> {
34531    match r {
34532        OneDirectionRepeatFactorRef::OneDirectionRepeatFactor(i) => {
34533            if i.0 >= model.one_direction_repeat_factor_arena.items.len() {
34534                return Err(AuthorError::DanglingRef {
34535                    entity: "ONE_DIRECTION_REPEAT_FACTOR",
34536                });
34537            }
34538        }
34539        OneDirectionRepeatFactorRef::TwoDirectionRepeatFactor(i) => {
34540            if i.0 >= model.two_direction_repeat_factor_arena.items.len() {
34541                return Err(AuthorError::DanglingRef {
34542                    entity: "TWO_DIRECTION_REPEAT_FACTOR",
34543                });
34544            }
34545        }
34546        OneDirectionRepeatFactorRef::Complex(i) => {
34547            if i.0 >= model.complex_unit_arena.items.len() {
34548                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34549            }
34550        }
34551    }
34552    Ok(())
34553}
34554fn check_organization_ref(model: &StepModel, r: &OrganizationRef) -> Result<(), AuthorError> {
34555    match r {
34556        OrganizationRef::Organization(i) => {
34557            if i.0 >= model.organization_arena.items.len() {
34558                return Err(AuthorError::DanglingRef {
34559                    entity: "ORGANIZATION",
34560                });
34561            }
34562        }
34563    }
34564    Ok(())
34565}
34566fn check_organizational_project_ref(
34567    model: &StepModel,
34568    r: &OrganizationalProjectRef,
34569) -> Result<(), AuthorError> {
34570    match r {
34571        OrganizationalProjectRef::OrganizationalProject(i) => {
34572            if i.0 >= model.organizational_project_arena.items.len() {
34573                return Err(AuthorError::DanglingRef {
34574                    entity: "ORGANIZATIONAL_PROJECT",
34575                });
34576            }
34577        }
34578    }
34579    Ok(())
34580}
34581fn check_oriented_closed_shell_ref(
34582    model: &StepModel,
34583    r: &OrientedClosedShellRef,
34584) -> Result<(), AuthorError> {
34585    match r {
34586        OrientedClosedShellRef::OrientedClosedShell(i) => {
34587            if i.0 >= model.oriented_closed_shell_arena.items.len() {
34588                return Err(AuthorError::DanglingRef {
34589                    entity: "ORIENTED_CLOSED_SHELL",
34590                });
34591            }
34592        }
34593        OrientedClosedShellRef::Complex(i) => {
34594            if i.0 >= model.complex_unit_arena.items.len() {
34595                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34596            }
34597        }
34598    }
34599    Ok(())
34600}
34601fn check_oriented_edge_ref(model: &StepModel, r: &OrientedEdgeRef) -> Result<(), AuthorError> {
34602    match r {
34603        OrientedEdgeRef::OrientedEdge(i) => {
34604            if i.0 >= model.oriented_edge_arena.items.len() {
34605                return Err(AuthorError::DanglingRef {
34606                    entity: "ORIENTED_EDGE",
34607                });
34608            }
34609        }
34610        OrientedEdgeRef::Complex(i) => {
34611            if i.0 >= model.complex_unit_arena.items.len() {
34612                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34613            }
34614        }
34615    }
34616    Ok(())
34617}
34618fn check_pcurve_or_surface_ref(
34619    model: &StepModel,
34620    r: &PcurveOrSurfaceRef,
34621) -> Result<(), AuthorError> {
34622    match r {
34623        PcurveOrSurfaceRef::BSplineSurface(i) => {
34624            if i.0 >= model.b_spline_surface_arena.items.len() {
34625                return Err(AuthorError::DanglingRef {
34626                    entity: "B_SPLINE_SURFACE",
34627                });
34628            }
34629        }
34630        PcurveOrSurfaceRef::BSplineSurfaceWithKnots(i) => {
34631            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
34632                return Err(AuthorError::DanglingRef {
34633                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
34634                });
34635            }
34636        }
34637        PcurveOrSurfaceRef::BezierSurface(i) => {
34638            if i.0 >= model.bezier_surface_arena.items.len() {
34639                return Err(AuthorError::DanglingRef {
34640                    entity: "BEZIER_SURFACE",
34641                });
34642            }
34643        }
34644        PcurveOrSurfaceRef::BoundedPcurve(i) => {
34645            if i.0 >= model.bounded_pcurve_arena.items.len() {
34646                return Err(AuthorError::DanglingRef {
34647                    entity: "BOUNDED_PCURVE",
34648                });
34649            }
34650        }
34651        PcurveOrSurfaceRef::BoundedSurface(i) => {
34652            if i.0 >= model.bounded_surface_arena.items.len() {
34653                return Err(AuthorError::DanglingRef {
34654                    entity: "BOUNDED_SURFACE",
34655                });
34656            }
34657        }
34658        PcurveOrSurfaceRef::ConicalSurface(i) => {
34659            if i.0 >= model.conical_surface_arena.items.len() {
34660                return Err(AuthorError::DanglingRef {
34661                    entity: "CONICAL_SURFACE",
34662                });
34663            }
34664        }
34665        PcurveOrSurfaceRef::CylindricalSurface(i) => {
34666            if i.0 >= model.cylindrical_surface_arena.items.len() {
34667                return Err(AuthorError::DanglingRef {
34668                    entity: "CYLINDRICAL_SURFACE",
34669                });
34670            }
34671        }
34672        PcurveOrSurfaceRef::DegenerateToroidalSurface(i) => {
34673            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
34674                return Err(AuthorError::DanglingRef {
34675                    entity: "DEGENERATE_TOROIDAL_SURFACE",
34676                });
34677            }
34678        }
34679        PcurveOrSurfaceRef::ElementarySurface(i) => {
34680            if i.0 >= model.elementary_surface_arena.items.len() {
34681                return Err(AuthorError::DanglingRef {
34682                    entity: "ELEMENTARY_SURFACE",
34683                });
34684            }
34685        }
34686        PcurveOrSurfaceRef::OffsetSurface(i) => {
34687            if i.0 >= model.offset_surface_arena.items.len() {
34688                return Err(AuthorError::DanglingRef {
34689                    entity: "OFFSET_SURFACE",
34690                });
34691            }
34692        }
34693        PcurveOrSurfaceRef::Pcurve(i) => {
34694            if i.0 >= model.pcurve_arena.items.len() {
34695                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
34696            }
34697        }
34698        PcurveOrSurfaceRef::Plane(i) => {
34699            if i.0 >= model.plane_arena.items.len() {
34700                return Err(AuthorError::DanglingRef { entity: "PLANE" });
34701            }
34702        }
34703        PcurveOrSurfaceRef::QuasiUniformSurface(i) => {
34704            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
34705                return Err(AuthorError::DanglingRef {
34706                    entity: "QUASI_UNIFORM_SURFACE",
34707                });
34708            }
34709        }
34710        PcurveOrSurfaceRef::RationalBSplineSurface(i) => {
34711            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
34712                return Err(AuthorError::DanglingRef {
34713                    entity: "RATIONAL_B_SPLINE_SURFACE",
34714                });
34715            }
34716        }
34717        PcurveOrSurfaceRef::SphericalSurface(i) => {
34718            if i.0 >= model.spherical_surface_arena.items.len() {
34719                return Err(AuthorError::DanglingRef {
34720                    entity: "SPHERICAL_SURFACE",
34721                });
34722            }
34723        }
34724        PcurveOrSurfaceRef::Surface(i) => {
34725            if i.0 >= model.surface_arena.items.len() {
34726                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
34727            }
34728        }
34729        PcurveOrSurfaceRef::SurfaceOfLinearExtrusion(i) => {
34730            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
34731                return Err(AuthorError::DanglingRef {
34732                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
34733                });
34734            }
34735        }
34736        PcurveOrSurfaceRef::SurfaceOfRevolution(i) => {
34737            if i.0 >= model.surface_of_revolution_arena.items.len() {
34738                return Err(AuthorError::DanglingRef {
34739                    entity: "SURFACE_OF_REVOLUTION",
34740                });
34741            }
34742        }
34743        PcurveOrSurfaceRef::SweptSurface(i) => {
34744            if i.0 >= model.swept_surface_arena.items.len() {
34745                return Err(AuthorError::DanglingRef {
34746                    entity: "SWEPT_SURFACE",
34747                });
34748            }
34749        }
34750        PcurveOrSurfaceRef::ToroidalSurface(i) => {
34751            if i.0 >= model.toroidal_surface_arena.items.len() {
34752                return Err(AuthorError::DanglingRef {
34753                    entity: "TOROIDAL_SURFACE",
34754                });
34755            }
34756        }
34757        PcurveOrSurfaceRef::UniformSurface(i) => {
34758            if i.0 >= model.uniform_surface_arena.items.len() {
34759                return Err(AuthorError::DanglingRef {
34760                    entity: "UNIFORM_SURFACE",
34761                });
34762            }
34763        }
34764        PcurveOrSurfaceRef::Complex(i) => {
34765            if i.0 >= model.complex_unit_arena.items.len() {
34766                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
34767            }
34768        }
34769    }
34770    Ok(())
34771}
34772fn check_person_ref(model: &StepModel, r: &PersonRef) -> Result<(), AuthorError> {
34773    match r {
34774        PersonRef::Person(i) => {
34775            if i.0 >= model.person_arena.items.len() {
34776                return Err(AuthorError::DanglingRef { entity: "PERSON" });
34777            }
34778        }
34779    }
34780    Ok(())
34781}
34782fn check_person_and_organization_ref(
34783    model: &StepModel,
34784    r: &PersonAndOrganizationRef,
34785) -> Result<(), AuthorError> {
34786    match r {
34787        PersonAndOrganizationRef::PersonAndOrganization(i) => {
34788            if i.0 >= model.person_and_organization_arena.items.len() {
34789                return Err(AuthorError::DanglingRef {
34790                    entity: "PERSON_AND_ORGANIZATION",
34791                });
34792            }
34793        }
34794    }
34795    Ok(())
34796}
34797fn check_person_and_organization_item_ref(
34798    model: &StepModel,
34799    r: &PersonAndOrganizationItemRef,
34800) -> Result<(), AuthorError> {
34801    match r {
34802        PersonAndOrganizationItemRef::Action(i) => {
34803            if i.0 >= model.action_arena.items.len() {
34804                return Err(AuthorError::DanglingRef { entity: "ACTION" });
34805            }
34806        }
34807        PersonAndOrganizationItemRef::ActionDirective(i) => {
34808            if i.0 >= model.action_directive_arena.items.len() {
34809                return Err(AuthorError::DanglingRef {
34810                    entity: "ACTION_DIRECTIVE",
34811                });
34812            }
34813        }
34814        PersonAndOrganizationItemRef::ActionMethod(i) => {
34815            if i.0 >= model.action_method_arena.items.len() {
34816                return Err(AuthorError::DanglingRef {
34817                    entity: "ACTION_METHOD",
34818                });
34819            }
34820        }
34821        PersonAndOrganizationItemRef::ActionProperty(i) => {
34822            if i.0 >= model.action_property_arena.items.len() {
34823                return Err(AuthorError::DanglingRef {
34824                    entity: "ACTION_PROPERTY",
34825                });
34826            }
34827        }
34828        PersonAndOrganizationItemRef::ActionRelationship(i) => {
34829            if i.0 >= model.action_relationship_arena.items.len() {
34830                return Err(AuthorError::DanglingRef {
34831                    entity: "ACTION_RELATIONSHIP",
34832                });
34833            }
34834        }
34835        PersonAndOrganizationItemRef::ActionRequestSolution(i) => {
34836            if i.0 >= model.action_request_solution_arena.items.len() {
34837                return Err(AuthorError::DanglingRef {
34838                    entity: "ACTION_REQUEST_SOLUTION",
34839                });
34840            }
34841        }
34842        PersonAndOrganizationItemRef::AdvancedBrepShapeRepresentation(i) => {
34843            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
34844                return Err(AuthorError::DanglingRef {
34845                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
34846                });
34847            }
34848        }
34849        PersonAndOrganizationItemRef::AppliedDateAndTimeAssignment(i) => {
34850            if i.0 >= model.applied_date_and_time_assignment_arena.items.len() {
34851                return Err(AuthorError::DanglingRef {
34852                    entity: "APPLIED_DATE_AND_TIME_ASSIGNMENT",
34853                });
34854            }
34855        }
34856        PersonAndOrganizationItemRef::AppliedDocumentReference(i) => {
34857            if i.0 >= model.applied_document_reference_arena.items.len() {
34858                return Err(AuthorError::DanglingRef {
34859                    entity: "APPLIED_DOCUMENT_REFERENCE",
34860                });
34861            }
34862        }
34863        PersonAndOrganizationItemRef::AppliedPersonAndOrganizationAssignment(i) => {
34864            if i.0
34865                >= model
34866                    .applied_person_and_organization_assignment_arena
34867                    .items
34868                    .len()
34869            {
34870                return Err(AuthorError::DanglingRef {
34871                    entity: "APPLIED_PERSON_AND_ORGANIZATION_ASSIGNMENT",
34872                });
34873            }
34874        }
34875        PersonAndOrganizationItemRef::Approval(i) => {
34876            if i.0 >= model.approval_arena.items.len() {
34877                return Err(AuthorError::DanglingRef { entity: "APPROVAL" });
34878            }
34879        }
34880        PersonAndOrganizationItemRef::ApprovalStatus(i) => {
34881            if i.0 >= model.approval_status_arena.items.len() {
34882                return Err(AuthorError::DanglingRef {
34883                    entity: "APPROVAL_STATUS",
34884                });
34885            }
34886        }
34887        PersonAndOrganizationItemRef::AscribableState(i) => {
34888            if i.0 >= model.ascribable_state_arena.items.len() {
34889                return Err(AuthorError::DanglingRef {
34890                    entity: "ASCRIBABLE_STATE",
34891                });
34892            }
34893        }
34894        PersonAndOrganizationItemRef::AssemblyComponentUsage(i) => {
34895            if i.0 >= model.assembly_component_usage_arena.items.len() {
34896                return Err(AuthorError::DanglingRef {
34897                    entity: "ASSEMBLY_COMPONENT_USAGE",
34898                });
34899            }
34900        }
34901        PersonAndOrganizationItemRef::CcDesignDateAndTimeAssignment(i) => {
34902            if i.0 >= model.cc_design_date_and_time_assignment_arena.items.len() {
34903                return Err(AuthorError::DanglingRef {
34904                    entity: "CC_DESIGN_DATE_AND_TIME_ASSIGNMENT",
34905                });
34906            }
34907        }
34908        PersonAndOrganizationItemRef::Certification(i) => {
34909            if i.0 >= model.certification_arena.items.len() {
34910                return Err(AuthorError::DanglingRef {
34911                    entity: "CERTIFICATION",
34912                });
34913            }
34914        }
34915        PersonAndOrganizationItemRef::CharacterizedRepresentation(i) => {
34916            if i.0 >= model.characterized_representation_arena.items.len() {
34917                return Err(AuthorError::DanglingRef {
34918                    entity: "CHARACTERIZED_REPRESENTATION",
34919                });
34920            }
34921        }
34922        PersonAndOrganizationItemRef::ConfigurationDesign(i) => {
34923            if i.0 >= model.configuration_design_arena.items.len() {
34924                return Err(AuthorError::DanglingRef {
34925                    entity: "CONFIGURATION_DESIGN",
34926                });
34927            }
34928        }
34929        PersonAndOrganizationItemRef::ConfigurationEffectivity(i) => {
34930            if i.0 >= model.configuration_effectivity_arena.items.len() {
34931                return Err(AuthorError::DanglingRef {
34932                    entity: "CONFIGURATION_EFFECTIVITY",
34933                });
34934            }
34935        }
34936        PersonAndOrganizationItemRef::ConfigurationItem(i) => {
34937            if i.0 >= model.configuration_item_arena.items.len() {
34938                return Err(AuthorError::DanglingRef {
34939                    entity: "CONFIGURATION_ITEM",
34940                });
34941            }
34942        }
34943        PersonAndOrganizationItemRef::ConstructiveGeometryRepresentation(i) => {
34944            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
34945                return Err(AuthorError::DanglingRef {
34946                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
34947                });
34948            }
34949        }
34950        PersonAndOrganizationItemRef::Contract(i) => {
34951            if i.0 >= model.contract_arena.items.len() {
34952                return Err(AuthorError::DanglingRef { entity: "CONTRACT" });
34953            }
34954        }
34955        PersonAndOrganizationItemRef::DateAndTimeAssignment(i) => {
34956            if i.0 >= model.date_and_time_assignment_arena.items.len() {
34957                return Err(AuthorError::DanglingRef {
34958                    entity: "DATE_AND_TIME_ASSIGNMENT",
34959                });
34960            }
34961        }
34962        PersonAndOrganizationItemRef::DefinitionalRepresentation(i) => {
34963            if i.0 >= model.definitional_representation_arena.items.len() {
34964                return Err(AuthorError::DanglingRef {
34965                    entity: "DEFINITIONAL_REPRESENTATION",
34966                });
34967            }
34968        }
34969        PersonAndOrganizationItemRef::DesignContext(i) => {
34970            if i.0 >= model.design_context_arena.items.len() {
34971                return Err(AuthorError::DanglingRef {
34972                    entity: "DESIGN_CONTEXT",
34973                });
34974            }
34975        }
34976        PersonAndOrganizationItemRef::DocumentFile(i) => {
34977            if i.0 >= model.document_file_arena.items.len() {
34978                return Err(AuthorError::DanglingRef {
34979                    entity: "DOCUMENT_FILE",
34980                });
34981            }
34982        }
34983        PersonAndOrganizationItemRef::DocumentType(i) => {
34984            if i.0 >= model.document_type_arena.items.len() {
34985                return Err(AuthorError::DanglingRef {
34986                    entity: "DOCUMENT_TYPE",
34987                });
34988            }
34989        }
34990        PersonAndOrganizationItemRef::DraughtingModel(i) => {
34991            if i.0 >= model.draughting_model_arena.items.len() {
34992                return Err(AuthorError::DanglingRef {
34993                    entity: "DRAUGHTING_MODEL",
34994                });
34995            }
34996        }
34997        PersonAndOrganizationItemRef::Effectivity(i) => {
34998            if i.0 >= model.effectivity_arena.items.len() {
34999                return Err(AuthorError::DanglingRef {
35000                    entity: "EFFECTIVITY",
35001                });
35002            }
35003        }
35004        PersonAndOrganizationItemRef::GeneralProperty(i) => {
35005            if i.0 >= model.general_property_arena.items.len() {
35006                return Err(AuthorError::DanglingRef {
35007                    entity: "GENERAL_PROPERTY",
35008                });
35009            }
35010        }
35011        PersonAndOrganizationItemRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
35012            if i.0
35013                >= model
35014                    .geometrically_bounded_surface_shape_representation_arena
35015                    .items
35016                    .len()
35017            {
35018                return Err(AuthorError::DanglingRef {
35019                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
35020                });
35021            }
35022        }
35023        PersonAndOrganizationItemRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
35024            if i.0
35025                >= model
35026                    .geometrically_bounded_wireframe_shape_representation_arena
35027                    .items
35028                    .len()
35029            {
35030                return Err(AuthorError::DanglingRef {
35031                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
35032                });
35033            }
35034        }
35035        PersonAndOrganizationItemRef::MakeFromUsageOption(i) => {
35036            if i.0 >= model.make_from_usage_option_arena.items.len() {
35037                return Err(AuthorError::DanglingRef {
35038                    entity: "MAKE_FROM_USAGE_OPTION",
35039                });
35040            }
35041        }
35042        PersonAndOrganizationItemRef::ManifoldSurfaceShapeRepresentation(i) => {
35043            if i.0
35044                >= model
35045                    .manifold_surface_shape_representation_arena
35046                    .items
35047                    .len()
35048            {
35049                return Err(AuthorError::DanglingRef {
35050                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
35051                });
35052            }
35053        }
35054        PersonAndOrganizationItemRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
35055            if i.0
35056                >= model
35057                    .mechanical_design_geometric_presentation_representation_arena
35058                    .items
35059                    .len()
35060            {
35061                return Err(AuthorError::DanglingRef {
35062                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
35063                });
35064            }
35065        }
35066        PersonAndOrganizationItemRef::MechanicalDesignPresentationRepresentationWithDraughting(
35067            i,
35068        ) => {
35069            if i.0
35070                >= model
35071                    .mechanical_design_presentation_representation_with_draughting_arena
35072                    .items
35073                    .len()
35074            {
35075                return Err(AuthorError::DanglingRef {
35076                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
35077                });
35078            }
35079        }
35080        PersonAndOrganizationItemRef::MechanicalDesignShadedPresentationRepresentation(i) => {
35081            if i.0
35082                >= model
35083                    .mechanical_design_shaded_presentation_representation_arena
35084                    .items
35085                    .len()
35086            {
35087                return Err(AuthorError::DanglingRef {
35088                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
35089                });
35090            }
35091        }
35092        PersonAndOrganizationItemRef::NextAssemblyUsageOccurrence(i) => {
35093            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
35094                return Err(AuthorError::DanglingRef {
35095                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
35096                });
35097            }
35098        }
35099        PersonAndOrganizationItemRef::Organization(i) => {
35100            if i.0 >= model.organization_arena.items.len() {
35101                return Err(AuthorError::DanglingRef {
35102                    entity: "ORGANIZATION",
35103                });
35104            }
35105        }
35106        PersonAndOrganizationItemRef::OrganizationRelationship(i) => {
35107            if i.0 >= model.organization_relationship_arena.items.len() {
35108                return Err(AuthorError::DanglingRef {
35109                    entity: "ORGANIZATION_RELATIONSHIP",
35110                });
35111            }
35112        }
35113        PersonAndOrganizationItemRef::OrganizationalAddress(i) => {
35114            if i.0 >= model.organizational_address_arena.items.len() {
35115                return Err(AuthorError::DanglingRef {
35116                    entity: "ORGANIZATIONAL_ADDRESS",
35117                });
35118            }
35119        }
35120        PersonAndOrganizationItemRef::OrganizationalProject(i) => {
35121            if i.0 >= model.organizational_project_arena.items.len() {
35122                return Err(AuthorError::DanglingRef {
35123                    entity: "ORGANIZATIONAL_PROJECT",
35124                });
35125            }
35126        }
35127        PersonAndOrganizationItemRef::PersonAndOrganization(i) => {
35128            if i.0 >= model.person_and_organization_arena.items.len() {
35129                return Err(AuthorError::DanglingRef {
35130                    entity: "PERSON_AND_ORGANIZATION",
35131                });
35132            }
35133        }
35134        PersonAndOrganizationItemRef::PersonAndOrganizationAddress(i) => {
35135            if i.0 >= model.person_and_organization_address_arena.items.len() {
35136                return Err(AuthorError::DanglingRef {
35137                    entity: "PERSON_AND_ORGANIZATION_ADDRESS",
35138                });
35139            }
35140        }
35141        PersonAndOrganizationItemRef::PresentationArea(i) => {
35142            if i.0 >= model.presentation_area_arena.items.len() {
35143                return Err(AuthorError::DanglingRef {
35144                    entity: "PRESENTATION_AREA",
35145                });
35146            }
35147        }
35148        PersonAndOrganizationItemRef::PresentationRepresentation(i) => {
35149            if i.0 >= model.presentation_representation_arena.items.len() {
35150                return Err(AuthorError::DanglingRef {
35151                    entity: "PRESENTATION_REPRESENTATION",
35152                });
35153            }
35154        }
35155        PersonAndOrganizationItemRef::PresentationView(i) => {
35156            if i.0 >= model.presentation_view_arena.items.len() {
35157                return Err(AuthorError::DanglingRef {
35158                    entity: "PRESENTATION_VIEW",
35159                });
35160            }
35161        }
35162        PersonAndOrganizationItemRef::Product(i) => {
35163            if i.0 >= model.product_arena.items.len() {
35164                return Err(AuthorError::DanglingRef { entity: "PRODUCT" });
35165            }
35166        }
35167        PersonAndOrganizationItemRef::ProductConcept(i) => {
35168            if i.0 >= model.product_concept_arena.items.len() {
35169                return Err(AuthorError::DanglingRef {
35170                    entity: "PRODUCT_CONCEPT",
35171                });
35172            }
35173        }
35174        PersonAndOrganizationItemRef::ProductConceptFeature(i) => {
35175            if i.0 >= model.product_concept_feature_arena.items.len() {
35176                return Err(AuthorError::DanglingRef {
35177                    entity: "PRODUCT_CONCEPT_FEATURE",
35178                });
35179            }
35180        }
35181        PersonAndOrganizationItemRef::ProductConceptFeatureCategory(i) => {
35182            if i.0 >= model.product_concept_feature_category_arena.items.len() {
35183                return Err(AuthorError::DanglingRef {
35184                    entity: "PRODUCT_CONCEPT_FEATURE_CATEGORY",
35185                });
35186            }
35187        }
35188        PersonAndOrganizationItemRef::ProductDefinition(i) => {
35189            if i.0 >= model.product_definition_arena.items.len() {
35190                return Err(AuthorError::DanglingRef {
35191                    entity: "PRODUCT_DEFINITION",
35192                });
35193            }
35194        }
35195        PersonAndOrganizationItemRef::ProductDefinitionContext(i) => {
35196            if i.0 >= model.product_definition_context_arena.items.len() {
35197                return Err(AuthorError::DanglingRef {
35198                    entity: "PRODUCT_DEFINITION_CONTEXT",
35199                });
35200            }
35201        }
35202        PersonAndOrganizationItemRef::ProductDefinitionEffectivity(i) => {
35203            if i.0 >= model.product_definition_effectivity_arena.items.len() {
35204                return Err(AuthorError::DanglingRef {
35205                    entity: "PRODUCT_DEFINITION_EFFECTIVITY",
35206                });
35207            }
35208        }
35209        PersonAndOrganizationItemRef::ProductDefinitionFormation(i) => {
35210            if i.0 >= model.product_definition_formation_arena.items.len() {
35211                return Err(AuthorError::DanglingRef {
35212                    entity: "PRODUCT_DEFINITION_FORMATION",
35213                });
35214            }
35215        }
35216        PersonAndOrganizationItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
35217            if i.0
35218                >= model
35219                    .product_definition_formation_with_specified_source_arena
35220                    .items
35221                    .len()
35222            {
35223                return Err(AuthorError::DanglingRef {
35224                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
35225                });
35226            }
35227        }
35228        PersonAndOrganizationItemRef::ProductDefinitionRelationship(i) => {
35229            if i.0 >= model.product_definition_relationship_arena.items.len() {
35230                return Err(AuthorError::DanglingRef {
35231                    entity: "PRODUCT_DEFINITION_RELATIONSHIP",
35232                });
35233            }
35234        }
35235        PersonAndOrganizationItemRef::ProductDefinitionShape(i) => {
35236            if i.0 >= model.product_definition_shape_arena.items.len() {
35237                return Err(AuthorError::DanglingRef {
35238                    entity: "PRODUCT_DEFINITION_SHAPE",
35239                });
35240            }
35241        }
35242        PersonAndOrganizationItemRef::ProductDefinitionSubstitute(i) => {
35243            if i.0 >= model.product_definition_substitute_arena.items.len() {
35244                return Err(AuthorError::DanglingRef {
35245                    entity: "PRODUCT_DEFINITION_SUBSTITUTE",
35246                });
35247            }
35248        }
35249        PersonAndOrganizationItemRef::ProductDefinitionUsage(i) => {
35250            if i.0 >= model.product_definition_usage_arena.items.len() {
35251                return Err(AuthorError::DanglingRef {
35252                    entity: "PRODUCT_DEFINITION_USAGE",
35253                });
35254            }
35255        }
35256        PersonAndOrganizationItemRef::ProductDefinitionWithAssociatedDocuments(i) => {
35257            if i.0
35258                >= model
35259                    .product_definition_with_associated_documents_arena
35260                    .items
35261                    .len()
35262            {
35263                return Err(AuthorError::DanglingRef {
35264                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
35265                });
35266            }
35267        }
35268        PersonAndOrganizationItemRef::PropertyDefinition(i) => {
35269            if i.0 >= model.property_definition_arena.items.len() {
35270                return Err(AuthorError::DanglingRef {
35271                    entity: "PROPERTY_DEFINITION",
35272                });
35273            }
35274        }
35275        PersonAndOrganizationItemRef::PropertyDefinitionRepresentation(i) => {
35276            if i.0 >= model.property_definition_representation_arena.items.len() {
35277                return Err(AuthorError::DanglingRef {
35278                    entity: "PROPERTY_DEFINITION_REPRESENTATION",
35279                });
35280            }
35281        }
35282        PersonAndOrganizationItemRef::Representation(i) => {
35283            if i.0 >= model.representation_arena.items.len() {
35284                return Err(AuthorError::DanglingRef {
35285                    entity: "REPRESENTATION",
35286                });
35287            }
35288        }
35289        PersonAndOrganizationItemRef::ResourceProperty(i) => {
35290            if i.0 >= model.resource_property_arena.items.len() {
35291                return Err(AuthorError::DanglingRef {
35292                    entity: "RESOURCE_PROPERTY",
35293                });
35294            }
35295        }
35296        PersonAndOrganizationItemRef::SecurityClassification(i) => {
35297            if i.0 >= model.security_classification_arena.items.len() {
35298                return Err(AuthorError::DanglingRef {
35299                    entity: "SECURITY_CLASSIFICATION",
35300                });
35301            }
35302        }
35303        PersonAndOrganizationItemRef::SecurityClassificationLevel(i) => {
35304            if i.0 >= model.security_classification_level_arena.items.len() {
35305                return Err(AuthorError::DanglingRef {
35306                    entity: "SECURITY_CLASSIFICATION_LEVEL",
35307                });
35308            }
35309        }
35310        PersonAndOrganizationItemRef::ShapeDefinitionRepresentation(i) => {
35311            if i.0 >= model.shape_definition_representation_arena.items.len() {
35312                return Err(AuthorError::DanglingRef {
35313                    entity: "SHAPE_DEFINITION_REPRESENTATION",
35314                });
35315            }
35316        }
35317        PersonAndOrganizationItemRef::ShapeDimensionRepresentation(i) => {
35318            if i.0 >= model.shape_dimension_representation_arena.items.len() {
35319                return Err(AuthorError::DanglingRef {
35320                    entity: "SHAPE_DIMENSION_REPRESENTATION",
35321                });
35322            }
35323        }
35324        PersonAndOrganizationItemRef::ShapeRepresentation(i) => {
35325            if i.0 >= model.shape_representation_arena.items.len() {
35326                return Err(AuthorError::DanglingRef {
35327                    entity: "SHAPE_REPRESENTATION",
35328                });
35329            }
35330        }
35331        PersonAndOrganizationItemRef::ShapeRepresentationWithParameters(i) => {
35332            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
35333                return Err(AuthorError::DanglingRef {
35334                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
35335                });
35336            }
35337        }
35338        PersonAndOrganizationItemRef::StateObserved(i) => {
35339            if i.0 >= model.state_observed_arena.items.len() {
35340                return Err(AuthorError::DanglingRef {
35341                    entity: "STATE_OBSERVED",
35342                });
35343            }
35344        }
35345        PersonAndOrganizationItemRef::StateType(i) => {
35346            if i.0 >= model.state_type_arena.items.len() {
35347                return Err(AuthorError::DanglingRef {
35348                    entity: "STATE_TYPE",
35349                });
35350            }
35351        }
35352        PersonAndOrganizationItemRef::SymbolRepresentation(i) => {
35353            if i.0 >= model.symbol_representation_arena.items.len() {
35354                return Err(AuthorError::DanglingRef {
35355                    entity: "SYMBOL_REPRESENTATION",
35356                });
35357            }
35358        }
35359        PersonAndOrganizationItemRef::TessellatedShapeRepresentation(i) => {
35360            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
35361                return Err(AuthorError::DanglingRef {
35362                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
35363                });
35364            }
35365        }
35366        PersonAndOrganizationItemRef::VersionedActionRequest(i) => {
35367            if i.0 >= model.versioned_action_request_arena.items.len() {
35368                return Err(AuthorError::DanglingRef {
35369                    entity: "VERSIONED_ACTION_REQUEST",
35370                });
35371            }
35372        }
35373        PersonAndOrganizationItemRef::Complex(i) => {
35374            if i.0 >= model.complex_unit_arena.items.len() {
35375                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35376            }
35377        }
35378    }
35379    Ok(())
35380}
35381fn check_person_and_organization_role_ref(
35382    model: &StepModel,
35383    r: &PersonAndOrganizationRoleRef,
35384) -> Result<(), AuthorError> {
35385    match r {
35386        PersonAndOrganizationRoleRef::PersonAndOrganizationRole(i) => {
35387            if i.0 >= model.person_and_organization_role_arena.items.len() {
35388                return Err(AuthorError::DanglingRef {
35389                    entity: "PERSON_AND_ORGANIZATION_ROLE",
35390                });
35391            }
35392        }
35393    }
35394    Ok(())
35395}
35396fn check_person_organization_select_ref(
35397    model: &StepModel,
35398    r: &PersonOrganizationSelectRef,
35399) -> Result<(), AuthorError> {
35400    match r {
35401        PersonOrganizationSelectRef::Organization(i) => {
35402            if i.0 >= model.organization_arena.items.len() {
35403                return Err(AuthorError::DanglingRef {
35404                    entity: "ORGANIZATION",
35405                });
35406            }
35407        }
35408        PersonOrganizationSelectRef::Person(i) => {
35409            if i.0 >= model.person_arena.items.len() {
35410                return Err(AuthorError::DanglingRef { entity: "PERSON" });
35411            }
35412        }
35413        PersonOrganizationSelectRef::PersonAndOrganization(i) => {
35414            if i.0 >= model.person_and_organization_arena.items.len() {
35415                return Err(AuthorError::DanglingRef {
35416                    entity: "PERSON_AND_ORGANIZATION",
35417                });
35418            }
35419        }
35420    }
35421    Ok(())
35422}
35423fn check_planar_box_ref(model: &StepModel, r: &PlanarBoxRef) -> Result<(), AuthorError> {
35424    match r {
35425        PlanarBoxRef::PlanarBox(i) => {
35426            if i.0 >= model.planar_box_arena.items.len() {
35427                return Err(AuthorError::DanglingRef {
35428                    entity: "PLANAR_BOX",
35429                });
35430            }
35431        }
35432        PlanarBoxRef::Complex(i) => {
35433            if i.0 >= model.complex_unit_arena.items.len() {
35434                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35435            }
35436        }
35437    }
35438    Ok(())
35439}
35440fn check_plane_or_planar_box_ref(
35441    model: &StepModel,
35442    r: &PlaneOrPlanarBoxRef,
35443) -> Result<(), AuthorError> {
35444    match r {
35445        PlaneOrPlanarBoxRef::PlanarBox(i) => {
35446            if i.0 >= model.planar_box_arena.items.len() {
35447                return Err(AuthorError::DanglingRef {
35448                    entity: "PLANAR_BOX",
35449                });
35450            }
35451        }
35452        PlaneOrPlanarBoxRef::Plane(i) => {
35453            if i.0 >= model.plane_arena.items.len() {
35454                return Err(AuthorError::DanglingRef { entity: "PLANE" });
35455            }
35456        }
35457        PlaneOrPlanarBoxRef::Complex(i) => {
35458            if i.0 >= model.complex_unit_arena.items.len() {
35459                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35460            }
35461        }
35462    }
35463    Ok(())
35464}
35465fn check_point_ref(model: &StepModel, r: &PointRef) -> Result<(), AuthorError> {
35466    match r {
35467        PointRef::ApllPoint(_) => {
35468            return Err(AuthorError::NotAp242 {
35469                entity: "APLL_POINT",
35470            });
35471        }
35472        PointRef::ApllPointWithSurface(_) => {
35473            return Err(AuthorError::NotAp242 {
35474                entity: "APLL_POINT_WITH_SURFACE",
35475            });
35476        }
35477        PointRef::CartesianPoint(i) => {
35478            if i.0 >= model.cartesian_point_arena.items.len() {
35479                return Err(AuthorError::DanglingRef {
35480                    entity: "CARTESIAN_POINT",
35481                });
35482            }
35483        }
35484        PointRef::Point(i) => {
35485            if i.0 >= model.point_arena.items.len() {
35486                return Err(AuthorError::DanglingRef { entity: "POINT" });
35487            }
35488        }
35489        PointRef::Complex(i) => {
35490            if i.0 >= model.complex_unit_arena.items.len() {
35491                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35492            }
35493        }
35494    }
35495    Ok(())
35496}
35497fn check_presentation_area_ref(
35498    model: &StepModel,
35499    r: &PresentationAreaRef,
35500) -> Result<(), AuthorError> {
35501    match r {
35502        PresentationAreaRef::PresentationArea(i) => {
35503            if i.0 >= model.presentation_area_arena.items.len() {
35504                return Err(AuthorError::DanglingRef {
35505                    entity: "PRESENTATION_AREA",
35506                });
35507            }
35508        }
35509        PresentationAreaRef::Complex(i) => {
35510            if i.0 >= model.complex_unit_arena.items.len() {
35511                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35512            }
35513        }
35514    }
35515    Ok(())
35516}
35517fn check_presentation_representation_select_ref(
35518    model: &StepModel,
35519    r: &PresentationRepresentationSelectRef,
35520) -> Result<(), AuthorError> {
35521    match r {
35522        PresentationRepresentationSelectRef::PresentationArea(i) => {
35523            if i.0 >= model.presentation_area_arena.items.len() {
35524                return Err(AuthorError::DanglingRef {
35525                    entity: "PRESENTATION_AREA",
35526                });
35527            }
35528        }
35529        PresentationRepresentationSelectRef::PresentationRepresentation(i) => {
35530            if i.0 >= model.presentation_representation_arena.items.len() {
35531                return Err(AuthorError::DanglingRef {
35532                    entity: "PRESENTATION_REPRESENTATION",
35533                });
35534            }
35535        }
35536        PresentationRepresentationSelectRef::PresentationSet(i) => {
35537            if i.0 >= model.presentation_set_arena.items.len() {
35538                return Err(AuthorError::DanglingRef {
35539                    entity: "PRESENTATION_SET",
35540                });
35541            }
35542        }
35543        PresentationRepresentationSelectRef::PresentationView(i) => {
35544            if i.0 >= model.presentation_view_arena.items.len() {
35545                return Err(AuthorError::DanglingRef {
35546                    entity: "PRESENTATION_VIEW",
35547                });
35548            }
35549        }
35550        PresentationRepresentationSelectRef::Complex(i) => {
35551            if i.0 >= model.complex_unit_arena.items.len() {
35552                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35553            }
35554        }
35555    }
35556    Ok(())
35557}
35558fn check_presentation_set_ref(
35559    model: &StepModel,
35560    r: &PresentationSetRef,
35561) -> Result<(), AuthorError> {
35562    match r {
35563        PresentationSetRef::PresentationSet(i) => {
35564            if i.0 >= model.presentation_set_arena.items.len() {
35565                return Err(AuthorError::DanglingRef {
35566                    entity: "PRESENTATION_SET",
35567                });
35568            }
35569        }
35570        PresentationSetRef::Complex(i) => {
35571            if i.0 >= model.complex_unit_arena.items.len() {
35572                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35573            }
35574        }
35575    }
35576    Ok(())
35577}
35578fn check_presentation_size_assignment_select_ref(
35579    model: &StepModel,
35580    r: &PresentationSizeAssignmentSelectRef,
35581) -> Result<(), AuthorError> {
35582    match r {
35583        PresentationSizeAssignmentSelectRef::AreaInSet(i) => {
35584            if i.0 >= model.area_in_set_arena.items.len() {
35585                return Err(AuthorError::DanglingRef {
35586                    entity: "AREA_IN_SET",
35587                });
35588            }
35589        }
35590        PresentationSizeAssignmentSelectRef::PresentationArea(i) => {
35591            if i.0 >= model.presentation_area_arena.items.len() {
35592                return Err(AuthorError::DanglingRef {
35593                    entity: "PRESENTATION_AREA",
35594                });
35595            }
35596        }
35597        PresentationSizeAssignmentSelectRef::PresentationView(i) => {
35598            if i.0 >= model.presentation_view_arena.items.len() {
35599                return Err(AuthorError::DanglingRef {
35600                    entity: "PRESENTATION_VIEW",
35601                });
35602            }
35603        }
35604        PresentationSizeAssignmentSelectRef::Complex(i) => {
35605            if i.0 >= model.complex_unit_arena.items.len() {
35606                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35607            }
35608        }
35609    }
35610    Ok(())
35611}
35612fn check_presentation_style_assignment_ref(
35613    model: &StepModel,
35614    r: &PresentationStyleAssignmentRef,
35615) -> Result<(), AuthorError> {
35616    match r {
35617        PresentationStyleAssignmentRef::PresentationStyleAssignment(i) => {
35618            if i.0 >= model.presentation_style_assignment_arena.items.len() {
35619                return Err(AuthorError::DanglingRef {
35620                    entity: "PRESENTATION_STYLE_ASSIGNMENT",
35621                });
35622            }
35623        }
35624        PresentationStyleAssignmentRef::PresentationStyleByContext(i) => {
35625            if i.0 >= model.presentation_style_by_context_arena.items.len() {
35626                return Err(AuthorError::DanglingRef {
35627                    entity: "PRESENTATION_STYLE_BY_CONTEXT",
35628                });
35629            }
35630        }
35631        PresentationStyleAssignmentRef::Complex(i) => {
35632            if i.0 >= model.complex_unit_arena.items.len() {
35633                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35634            }
35635        }
35636    }
35637    Ok(())
35638}
35639fn check_presentation_style_select_ref(
35640    model: &StepModel,
35641    r: &PresentationStyleSelectRef,
35642) -> Result<(), AuthorError> {
35643    match r {
35644        PresentationStyleSelectRef::ApproximationTolerance(_) => {
35645            return Err(AuthorError::NotAp242 {
35646                entity: "APPROXIMATION_TOLERANCE",
35647            });
35648        }
35649        PresentationStyleSelectRef::CurveStyle(i) => {
35650            if i.0 >= model.curve_style_arena.items.len() {
35651                return Err(AuthorError::DanglingRef {
35652                    entity: "CURVE_STYLE",
35653                });
35654            }
35655        }
35656        PresentationStyleSelectRef::ExternallyDefinedStyle(i) => {
35657            if i.0 >= model.externally_defined_style_arena.items.len() {
35658                return Err(AuthorError::DanglingRef {
35659                    entity: "EXTERNALLY_DEFINED_STYLE",
35660                });
35661            }
35662        }
35663        PresentationStyleSelectRef::FillAreaStyle(i) => {
35664            if i.0 >= model.fill_area_style_arena.items.len() {
35665                return Err(AuthorError::DanglingRef {
35666                    entity: "FILL_AREA_STYLE",
35667                });
35668            }
35669        }
35670        PresentationStyleSelectRef::PointStyle(i) => {
35671            if i.0 >= model.point_style_arena.items.len() {
35672                return Err(AuthorError::DanglingRef {
35673                    entity: "POINT_STYLE",
35674                });
35675            }
35676        }
35677        PresentationStyleSelectRef::PreDefinedPresentationStyle(_) => {
35678            return Err(AuthorError::NotAp242 {
35679                entity: "PRE_DEFINED_PRESENTATION_STYLE",
35680            });
35681        }
35682        PresentationStyleSelectRef::SurfaceStyleUsage(i) => {
35683            if i.0 >= model.surface_style_usage_arena.items.len() {
35684                return Err(AuthorError::DanglingRef {
35685                    entity: "SURFACE_STYLE_USAGE",
35686                });
35687            }
35688        }
35689        PresentationStyleSelectRef::SymbolStyle(i) => {
35690            if i.0 >= model.symbol_style_arena.items.len() {
35691                return Err(AuthorError::DanglingRef {
35692                    entity: "SYMBOL_STYLE",
35693                });
35694            }
35695        }
35696        PresentationStyleSelectRef::TextStyle(i) => {
35697            if i.0 >= model.text_style_arena.items.len() {
35698                return Err(AuthorError::DanglingRef {
35699                    entity: "TEXT_STYLE",
35700                });
35701            }
35702        }
35703        PresentationStyleSelectRef::TextStyleWithBoxCharacteristics(i) => {
35704            if i.0 >= model.text_style_with_box_characteristics_arena.items.len() {
35705                return Err(AuthorError::DanglingRef {
35706                    entity: "TEXT_STYLE_WITH_BOX_CHARACTERISTICS",
35707                });
35708            }
35709        }
35710        PresentationStyleSelectRef::TextureStyleTessellationSpecification(i) => {
35711            if i.0
35712                >= model
35713                    .texture_style_tessellation_specification_arena
35714                    .items
35715                    .len()
35716            {
35717                return Err(AuthorError::DanglingRef {
35718                    entity: "TEXTURE_STYLE_TESSELLATION_SPECIFICATION",
35719                });
35720            }
35721        }
35722        PresentationStyleSelectRef::NullStyle(_) => {}
35723        PresentationStyleSelectRef::Complex(i) => {
35724            if i.0 >= model.complex_unit_arena.items.len() {
35725                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35726            }
35727        }
35728    }
35729    Ok(())
35730}
35731fn check_presented_item_ref(model: &StepModel, r: &PresentedItemRef) -> Result<(), AuthorError> {
35732    match r {
35733        PresentedItemRef::AppliedPresentedItem(i) => {
35734            if i.0 >= model.applied_presented_item_arena.items.len() {
35735                return Err(AuthorError::DanglingRef {
35736                    entity: "APPLIED_PRESENTED_ITEM",
35737                });
35738            }
35739        }
35740        PresentedItemRef::PresentedItem(i) => {
35741            if i.0 >= model.presented_item_arena.items.len() {
35742                return Err(AuthorError::DanglingRef {
35743                    entity: "PRESENTED_ITEM",
35744                });
35745            }
35746        }
35747        PresentedItemRef::Complex(i) => {
35748            if i.0 >= model.complex_unit_arena.items.len() {
35749                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35750            }
35751        }
35752    }
35753    Ok(())
35754}
35755fn check_presented_item_select_ref(
35756    model: &StepModel,
35757    r: &PresentedItemSelectRef,
35758) -> Result<(), AuthorError> {
35759    match r {
35760        PresentedItemSelectRef::Action(i) => {
35761            if i.0 >= model.action_arena.items.len() {
35762                return Err(AuthorError::DanglingRef { entity: "ACTION" });
35763            }
35764        }
35765        PresentedItemSelectRef::ActionMethod(i) => {
35766            if i.0 >= model.action_method_arena.items.len() {
35767                return Err(AuthorError::DanglingRef {
35768                    entity: "ACTION_METHOD",
35769                });
35770            }
35771        }
35772        PresentedItemSelectRef::ActionRelationship(i) => {
35773            if i.0 >= model.action_relationship_arena.items.len() {
35774                return Err(AuthorError::DanglingRef {
35775                    entity: "ACTION_RELATIONSHIP",
35776                });
35777            }
35778        }
35779        PresentedItemSelectRef::AssemblyComponentUsage(i) => {
35780            if i.0 >= model.assembly_component_usage_arena.items.len() {
35781                return Err(AuthorError::DanglingRef {
35782                    entity: "ASSEMBLY_COMPONENT_USAGE",
35783                });
35784            }
35785        }
35786        PresentedItemSelectRef::MakeFromUsageOption(i) => {
35787            if i.0 >= model.make_from_usage_option_arena.items.len() {
35788                return Err(AuthorError::DanglingRef {
35789                    entity: "MAKE_FROM_USAGE_OPTION",
35790                });
35791            }
35792        }
35793        PresentedItemSelectRef::NextAssemblyUsageOccurrence(i) => {
35794            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
35795                return Err(AuthorError::DanglingRef {
35796                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
35797                });
35798            }
35799        }
35800        PresentedItemSelectRef::ProductConcept(i) => {
35801            if i.0 >= model.product_concept_arena.items.len() {
35802                return Err(AuthorError::DanglingRef {
35803                    entity: "PRODUCT_CONCEPT",
35804                });
35805            }
35806        }
35807        PresentedItemSelectRef::ProductConceptFeature(i) => {
35808            if i.0 >= model.product_concept_feature_arena.items.len() {
35809                return Err(AuthorError::DanglingRef {
35810                    entity: "PRODUCT_CONCEPT_FEATURE",
35811                });
35812            }
35813        }
35814        PresentedItemSelectRef::ProductConceptFeatureCategory(i) => {
35815            if i.0 >= model.product_concept_feature_category_arena.items.len() {
35816                return Err(AuthorError::DanglingRef {
35817                    entity: "PRODUCT_CONCEPT_FEATURE_CATEGORY",
35818                });
35819            }
35820        }
35821        PresentedItemSelectRef::ProductDefinition(i) => {
35822            if i.0 >= model.product_definition_arena.items.len() {
35823                return Err(AuthorError::DanglingRef {
35824                    entity: "PRODUCT_DEFINITION",
35825                });
35826            }
35827        }
35828        PresentedItemSelectRef::ProductDefinitionFormation(i) => {
35829            if i.0 >= model.product_definition_formation_arena.items.len() {
35830                return Err(AuthorError::DanglingRef {
35831                    entity: "PRODUCT_DEFINITION_FORMATION",
35832                });
35833            }
35834        }
35835        PresentedItemSelectRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
35836            if i.0
35837                >= model
35838                    .product_definition_formation_with_specified_source_arena
35839                    .items
35840                    .len()
35841            {
35842                return Err(AuthorError::DanglingRef {
35843                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
35844                });
35845            }
35846        }
35847        PresentedItemSelectRef::ProductDefinitionRelationship(i) => {
35848            if i.0 >= model.product_definition_relationship_arena.items.len() {
35849                return Err(AuthorError::DanglingRef {
35850                    entity: "PRODUCT_DEFINITION_RELATIONSHIP",
35851                });
35852            }
35853        }
35854        PresentedItemSelectRef::ProductDefinitionUsage(i) => {
35855            if i.0 >= model.product_definition_usage_arena.items.len() {
35856                return Err(AuthorError::DanglingRef {
35857                    entity: "PRODUCT_DEFINITION_USAGE",
35858                });
35859            }
35860        }
35861        PresentedItemSelectRef::ProductDefinitionWithAssociatedDocuments(i) => {
35862            if i.0
35863                >= model
35864                    .product_definition_with_associated_documents_arena
35865                    .items
35866                    .len()
35867            {
35868                return Err(AuthorError::DanglingRef {
35869                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
35870                });
35871            }
35872        }
35873        PresentedItemSelectRef::Complex(i) => {
35874            if i.0 >= model.complex_unit_arena.items.len() {
35875                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35876            }
35877        }
35878    }
35879    Ok(())
35880}
35881fn check_product_ref(model: &StepModel, r: &ProductRef) -> Result<(), AuthorError> {
35882    match r {
35883        ProductRef::Product(i) => {
35884            if i.0 >= model.product_arena.items.len() {
35885                return Err(AuthorError::DanglingRef { entity: "PRODUCT" });
35886            }
35887        }
35888        ProductRef::Complex(i) => {
35889            if i.0 >= model.complex_unit_arena.items.len() {
35890                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35891            }
35892        }
35893    }
35894    Ok(())
35895}
35896fn check_product_category_ref(
35897    model: &StepModel,
35898    r: &ProductCategoryRef,
35899) -> Result<(), AuthorError> {
35900    match r {
35901        ProductCategoryRef::ProductCategory(i) => {
35902            if i.0 >= model.product_category_arena.items.len() {
35903                return Err(AuthorError::DanglingRef {
35904                    entity: "PRODUCT_CATEGORY",
35905                });
35906            }
35907        }
35908        ProductCategoryRef::ProductRelatedProductCategory(i) => {
35909            if i.0 >= model.product_related_product_category_arena.items.len() {
35910                return Err(AuthorError::DanglingRef {
35911                    entity: "PRODUCT_RELATED_PRODUCT_CATEGORY",
35912                });
35913            }
35914        }
35915        ProductCategoryRef::Complex(i) => {
35916            if i.0 >= model.complex_unit_arena.items.len() {
35917                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35918            }
35919        }
35920    }
35921    Ok(())
35922}
35923fn check_product_concept_ref(model: &StepModel, r: &ProductConceptRef) -> Result<(), AuthorError> {
35924    match r {
35925        ProductConceptRef::ProductConcept(i) => {
35926            if i.0 >= model.product_concept_arena.items.len() {
35927                return Err(AuthorError::DanglingRef {
35928                    entity: "PRODUCT_CONCEPT",
35929                });
35930            }
35931        }
35932        ProductConceptRef::Complex(i) => {
35933            if i.0 >= model.complex_unit_arena.items.len() {
35934                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35935            }
35936        }
35937    }
35938    Ok(())
35939}
35940fn check_product_concept_context_ref(
35941    model: &StepModel,
35942    r: &ProductConceptContextRef,
35943) -> Result<(), AuthorError> {
35944    match r {
35945        ProductConceptContextRef::ProductConceptContext(i) => {
35946            if i.0 >= model.product_concept_context_arena.items.len() {
35947                return Err(AuthorError::DanglingRef {
35948                    entity: "PRODUCT_CONCEPT_CONTEXT",
35949                });
35950            }
35951        }
35952    }
35953    Ok(())
35954}
35955fn check_product_context_ref(model: &StepModel, r: &ProductContextRef) -> Result<(), AuthorError> {
35956    match r {
35957        ProductContextRef::MechanicalContext(i) => {
35958            if i.0 >= model.mechanical_context_arena.items.len() {
35959                return Err(AuthorError::DanglingRef {
35960                    entity: "MECHANICAL_CONTEXT",
35961                });
35962            }
35963        }
35964        ProductContextRef::ProductContext(i) => {
35965            if i.0 >= model.product_context_arena.items.len() {
35966                return Err(AuthorError::DanglingRef {
35967                    entity: "PRODUCT_CONTEXT",
35968                });
35969            }
35970        }
35971        ProductContextRef::Complex(i) => {
35972            if i.0 >= model.complex_unit_arena.items.len() {
35973                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
35974            }
35975        }
35976    }
35977    Ok(())
35978}
35979fn check_product_definition_ref(
35980    model: &StepModel,
35981    r: &ProductDefinitionRef,
35982) -> Result<(), AuthorError> {
35983    match r {
35984        ProductDefinitionRef::ProductDefinition(i) => {
35985            if i.0 >= model.product_definition_arena.items.len() {
35986                return Err(AuthorError::DanglingRef {
35987                    entity: "PRODUCT_DEFINITION",
35988                });
35989            }
35990        }
35991        ProductDefinitionRef::ProductDefinitionWithAssociatedDocuments(i) => {
35992            if i.0
35993                >= model
35994                    .product_definition_with_associated_documents_arena
35995                    .items
35996                    .len()
35997            {
35998                return Err(AuthorError::DanglingRef {
35999                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
36000                });
36001            }
36002        }
36003        ProductDefinitionRef::Complex(i) => {
36004            if i.0 >= model.complex_unit_arena.items.len() {
36005                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
36006            }
36007        }
36008    }
36009    Ok(())
36010}
36011fn check_product_definition_context_ref(
36012    model: &StepModel,
36013    r: &ProductDefinitionContextRef,
36014) -> Result<(), AuthorError> {
36015    match r {
36016        ProductDefinitionContextRef::DesignContext(i) => {
36017            if i.0 >= model.design_context_arena.items.len() {
36018                return Err(AuthorError::DanglingRef {
36019                    entity: "DESIGN_CONTEXT",
36020                });
36021            }
36022        }
36023        ProductDefinitionContextRef::ProductDefinitionContext(i) => {
36024            if i.0 >= model.product_definition_context_arena.items.len() {
36025                return Err(AuthorError::DanglingRef {
36026                    entity: "PRODUCT_DEFINITION_CONTEXT",
36027                });
36028            }
36029        }
36030        ProductDefinitionContextRef::Complex(i) => {
36031            if i.0 >= model.complex_unit_arena.items.len() {
36032                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
36033            }
36034        }
36035    }
36036    Ok(())
36037}
36038fn check_product_definition_context_role_ref(
36039    model: &StepModel,
36040    r: &ProductDefinitionContextRoleRef,
36041) -> Result<(), AuthorError> {
36042    match r {
36043        ProductDefinitionContextRoleRef::ProductDefinitionContextRole(i) => {
36044            if i.0 >= model.product_definition_context_role_arena.items.len() {
36045                return Err(AuthorError::DanglingRef {
36046                    entity: "PRODUCT_DEFINITION_CONTEXT_ROLE",
36047                });
36048            }
36049        }
36050    }
36051    Ok(())
36052}
36053fn check_product_definition_formation_ref(
36054    model: &StepModel,
36055    r: &ProductDefinitionFormationRef,
36056) -> Result<(), AuthorError> {
36057    match r {
36058        ProductDefinitionFormationRef::ProductDefinitionFormation(i) => {
36059            if i.0 >= model.product_definition_formation_arena.items.len() {
36060                return Err(AuthorError::DanglingRef {
36061                    entity: "PRODUCT_DEFINITION_FORMATION",
36062                });
36063            }
36064        }
36065        ProductDefinitionFormationRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
36066            if i.0
36067                >= model
36068                    .product_definition_formation_with_specified_source_arena
36069                    .items
36070                    .len()
36071            {
36072                return Err(AuthorError::DanglingRef {
36073                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
36074                });
36075            }
36076        }
36077        ProductDefinitionFormationRef::Complex(i) => {
36078            if i.0 >= model.complex_unit_arena.items.len() {
36079                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
36080            }
36081        }
36082    }
36083    Ok(())
36084}
36085fn check_product_definition_or_reference_ref(
36086    model: &StepModel,
36087    r: &ProductDefinitionOrReferenceRef,
36088) -> Result<(), AuthorError> {
36089    match r {
36090        ProductDefinitionOrReferenceRef::GenericProductDefinitionReference(i) => {
36091            if i.0 >= model.generic_product_definition_reference_arena.items.len() {
36092                return Err(AuthorError::DanglingRef {
36093                    entity: "GENERIC_PRODUCT_DEFINITION_REFERENCE",
36094                });
36095            }
36096        }
36097        ProductDefinitionOrReferenceRef::ProductDefinition(i) => {
36098            if i.0 >= model.product_definition_arena.items.len() {
36099                return Err(AuthorError::DanglingRef {
36100                    entity: "PRODUCT_DEFINITION",
36101                });
36102            }
36103        }
36104        ProductDefinitionOrReferenceRef::ProductDefinitionOccurrence(i) => {
36105            if i.0 >= model.product_definition_occurrence_arena.items.len() {
36106                return Err(AuthorError::DanglingRef {
36107                    entity: "PRODUCT_DEFINITION_OCCURRENCE",
36108                });
36109            }
36110        }
36111        ProductDefinitionOrReferenceRef::ProductDefinitionWithAssociatedDocuments(i) => {
36112            if i.0
36113                >= model
36114                    .product_definition_with_associated_documents_arena
36115                    .items
36116                    .len()
36117            {
36118                return Err(AuthorError::DanglingRef {
36119                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
36120                });
36121            }
36122        }
36123        ProductDefinitionOrReferenceRef::Complex(i) => {
36124            if i.0 >= model.complex_unit_arena.items.len() {
36125                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
36126            }
36127        }
36128    }
36129    Ok(())
36130}
36131fn check_product_definition_relationship_ref(
36132    model: &StepModel,
36133    r: &ProductDefinitionRelationshipRef,
36134) -> Result<(), AuthorError> {
36135    match r {
36136        ProductDefinitionRelationshipRef::AssemblyComponentUsage(i) => {
36137            if i.0 >= model.assembly_component_usage_arena.items.len() {
36138                return Err(AuthorError::DanglingRef {
36139                    entity: "ASSEMBLY_COMPONENT_USAGE",
36140                });
36141            }
36142        }
36143        ProductDefinitionRelationshipRef::MakeFromUsageOption(i) => {
36144            if i.0 >= model.make_from_usage_option_arena.items.len() {
36145                return Err(AuthorError::DanglingRef {
36146                    entity: "MAKE_FROM_USAGE_OPTION",
36147                });
36148            }
36149        }
36150        ProductDefinitionRelationshipRef::NextAssemblyUsageOccurrence(i) => {
36151            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
36152                return Err(AuthorError::DanglingRef {
36153                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
36154                });
36155            }
36156        }
36157        ProductDefinitionRelationshipRef::ProductDefinitionRelationship(i) => {
36158            if i.0 >= model.product_definition_relationship_arena.items.len() {
36159                return Err(AuthorError::DanglingRef {
36160                    entity: "PRODUCT_DEFINITION_RELATIONSHIP",
36161                });
36162            }
36163        }
36164        ProductDefinitionRelationshipRef::ProductDefinitionUsage(i) => {
36165            if i.0 >= model.product_definition_usage_arena.items.len() {
36166                return Err(AuthorError::DanglingRef {
36167                    entity: "PRODUCT_DEFINITION_USAGE",
36168                });
36169            }
36170        }
36171        ProductDefinitionRelationshipRef::Complex(i) => {
36172            if i.0 >= model.complex_unit_arena.items.len() {
36173                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
36174            }
36175        }
36176    }
36177    Ok(())
36178}
36179fn check_product_definition_shape_ref(
36180    model: &StepModel,
36181    r: &ProductDefinitionShapeRef,
36182) -> Result<(), AuthorError> {
36183    match r {
36184        ProductDefinitionShapeRef::ProductDefinitionShape(i) => {
36185            if i.0 >= model.product_definition_shape_arena.items.len() {
36186                return Err(AuthorError::DanglingRef {
36187                    entity: "PRODUCT_DEFINITION_SHAPE",
36188                });
36189            }
36190        }
36191        ProductDefinitionShapeRef::Complex(i) => {
36192            if i.0 >= model.complex_unit_arena.items.len() {
36193                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
36194            }
36195        }
36196    }
36197    Ok(())
36198}
36199fn check_product_or_formation_or_definition_ref(
36200    model: &StepModel,
36201    r: &ProductOrFormationOrDefinitionRef,
36202) -> Result<(), AuthorError> {
36203    match r {
36204        ProductOrFormationOrDefinitionRef::Product(i) => {
36205            if i.0 >= model.product_arena.items.len() {
36206                return Err(AuthorError::DanglingRef { entity: "PRODUCT" });
36207            }
36208        }
36209        ProductOrFormationOrDefinitionRef::ProductDefinition(i) => {
36210            if i.0 >= model.product_definition_arena.items.len() {
36211                return Err(AuthorError::DanglingRef {
36212                    entity: "PRODUCT_DEFINITION",
36213                });
36214            }
36215        }
36216        ProductOrFormationOrDefinitionRef::ProductDefinitionFormation(i) => {
36217            if i.0 >= model.product_definition_formation_arena.items.len() {
36218                return Err(AuthorError::DanglingRef {
36219                    entity: "PRODUCT_DEFINITION_FORMATION",
36220                });
36221            }
36222        }
36223        ProductOrFormationOrDefinitionRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
36224            if i.0
36225                >= model
36226                    .product_definition_formation_with_specified_source_arena
36227                    .items
36228                    .len()
36229            {
36230                return Err(AuthorError::DanglingRef {
36231                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
36232                });
36233            }
36234        }
36235        ProductOrFormationOrDefinitionRef::ProductDefinitionWithAssociatedDocuments(i) => {
36236            if i.0
36237                >= model
36238                    .product_definition_with_associated_documents_arena
36239                    .items
36240                    .len()
36241            {
36242                return Err(AuthorError::DanglingRef {
36243                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
36244                });
36245            }
36246        }
36247        ProductOrFormationOrDefinitionRef::Complex(i) => {
36248            if i.0 >= model.complex_unit_arena.items.len() {
36249                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
36250            }
36251        }
36252    }
36253    Ok(())
36254}
36255fn check_property_definition_ref(
36256    model: &StepModel,
36257    r: &PropertyDefinitionRef,
36258) -> Result<(), AuthorError> {
36259    match r {
36260        PropertyDefinitionRef::ProductDefinitionShape(i) => {
36261            if i.0 >= model.product_definition_shape_arena.items.len() {
36262                return Err(AuthorError::DanglingRef {
36263                    entity: "PRODUCT_DEFINITION_SHAPE",
36264                });
36265            }
36266        }
36267        PropertyDefinitionRef::PropertyDefinition(i) => {
36268            if i.0 >= model.property_definition_arena.items.len() {
36269                return Err(AuthorError::DanglingRef {
36270                    entity: "PROPERTY_DEFINITION",
36271                });
36272            }
36273        }
36274        PropertyDefinitionRef::Complex(i) => {
36275            if i.0 >= model.complex_unit_arena.items.len() {
36276                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
36277            }
36278        }
36279    }
36280    Ok(())
36281}
36282fn check_rendering_properties_select_ref(
36283    model: &StepModel,
36284    r: &RenderingPropertiesSelectRef,
36285) -> Result<(), AuthorError> {
36286    match r {
36287        RenderingPropertiesSelectRef::SurfaceStyleReflectanceAmbient(i) => {
36288            if i.0 >= model.surface_style_reflectance_ambient_arena.items.len() {
36289                return Err(AuthorError::DanglingRef {
36290                    entity: "SURFACE_STYLE_REFLECTANCE_AMBIENT",
36291                });
36292            }
36293        }
36294        RenderingPropertiesSelectRef::SurfaceStyleTransparent(i) => {
36295            if i.0 >= model.surface_style_transparent_arena.items.len() {
36296                return Err(AuthorError::DanglingRef {
36297                    entity: "SURFACE_STYLE_TRANSPARENT",
36298                });
36299            }
36300        }
36301        RenderingPropertiesSelectRef::Complex(i) => {
36302            if i.0 >= model.complex_unit_arena.items.len() {
36303                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
36304            }
36305        }
36306    }
36307    Ok(())
36308}
36309fn check_representation_ref(model: &StepModel, r: &RepresentationRef) -> Result<(), AuthorError> {
36310    match r {
36311        RepresentationRef::AdvancedBrepShapeRepresentation(i) => {
36312            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
36313                return Err(AuthorError::DanglingRef {
36314                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
36315                });
36316            }
36317        }
36318        RepresentationRef::CharacterizedRepresentation(i) => {
36319            if i.0 >= model.characterized_representation_arena.items.len() {
36320                return Err(AuthorError::DanglingRef {
36321                    entity: "CHARACTERIZED_REPRESENTATION",
36322                });
36323            }
36324        }
36325        RepresentationRef::ConstructiveGeometryRepresentation(i) => {
36326            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
36327                return Err(AuthorError::DanglingRef {
36328                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
36329                });
36330            }
36331        }
36332        RepresentationRef::DefinitionalRepresentation(i) => {
36333            if i.0 >= model.definitional_representation_arena.items.len() {
36334                return Err(AuthorError::DanglingRef {
36335                    entity: "DEFINITIONAL_REPRESENTATION",
36336                });
36337            }
36338        }
36339        RepresentationRef::DraughtingModel(i) => {
36340            if i.0 >= model.draughting_model_arena.items.len() {
36341                return Err(AuthorError::DanglingRef {
36342                    entity: "DRAUGHTING_MODEL",
36343                });
36344            }
36345        }
36346        RepresentationRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
36347            if i.0
36348                >= model
36349                    .geometrically_bounded_surface_shape_representation_arena
36350                    .items
36351                    .len()
36352            {
36353                return Err(AuthorError::DanglingRef {
36354                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
36355                });
36356            }
36357        }
36358        RepresentationRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
36359            if i.0
36360                >= model
36361                    .geometrically_bounded_wireframe_shape_representation_arena
36362                    .items
36363                    .len()
36364            {
36365                return Err(AuthorError::DanglingRef {
36366                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
36367                });
36368            }
36369        }
36370        RepresentationRef::ManifoldSurfaceShapeRepresentation(i) => {
36371            if i.0
36372                >= model
36373                    .manifold_surface_shape_representation_arena
36374                    .items
36375                    .len()
36376            {
36377                return Err(AuthorError::DanglingRef {
36378                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
36379                });
36380            }
36381        }
36382        RepresentationRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
36383            if i.0
36384                >= model
36385                    .mechanical_design_geometric_presentation_representation_arena
36386                    .items
36387                    .len()
36388            {
36389                return Err(AuthorError::DanglingRef {
36390                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
36391                });
36392            }
36393        }
36394        RepresentationRef::MechanicalDesignPresentationRepresentationWithDraughting(i) => {
36395            if i.0
36396                >= model
36397                    .mechanical_design_presentation_representation_with_draughting_arena
36398                    .items
36399                    .len()
36400            {
36401                return Err(AuthorError::DanglingRef {
36402                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
36403                });
36404            }
36405        }
36406        RepresentationRef::MechanicalDesignShadedPresentationRepresentation(i) => {
36407            if i.0
36408                >= model
36409                    .mechanical_design_shaded_presentation_representation_arena
36410                    .items
36411                    .len()
36412            {
36413                return Err(AuthorError::DanglingRef {
36414                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
36415                });
36416            }
36417        }
36418        RepresentationRef::PresentationArea(i) => {
36419            if i.0 >= model.presentation_area_arena.items.len() {
36420                return Err(AuthorError::DanglingRef {
36421                    entity: "PRESENTATION_AREA",
36422                });
36423            }
36424        }
36425        RepresentationRef::PresentationRepresentation(i) => {
36426            if i.0 >= model.presentation_representation_arena.items.len() {
36427                return Err(AuthorError::DanglingRef {
36428                    entity: "PRESENTATION_REPRESENTATION",
36429                });
36430            }
36431        }
36432        RepresentationRef::PresentationView(i) => {
36433            if i.0 >= model.presentation_view_arena.items.len() {
36434                return Err(AuthorError::DanglingRef {
36435                    entity: "PRESENTATION_VIEW",
36436                });
36437            }
36438        }
36439        RepresentationRef::Representation(i) => {
36440            if i.0 >= model.representation_arena.items.len() {
36441                return Err(AuthorError::DanglingRef {
36442                    entity: "REPRESENTATION",
36443                });
36444            }
36445        }
36446        RepresentationRef::ShapeDimensionRepresentation(i) => {
36447            if i.0 >= model.shape_dimension_representation_arena.items.len() {
36448                return Err(AuthorError::DanglingRef {
36449                    entity: "SHAPE_DIMENSION_REPRESENTATION",
36450                });
36451            }
36452        }
36453        RepresentationRef::ShapeRepresentation(i) => {
36454            if i.0 >= model.shape_representation_arena.items.len() {
36455                return Err(AuthorError::DanglingRef {
36456                    entity: "SHAPE_REPRESENTATION",
36457                });
36458            }
36459        }
36460        RepresentationRef::ShapeRepresentationWithParameters(i) => {
36461            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
36462                return Err(AuthorError::DanglingRef {
36463                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
36464                });
36465            }
36466        }
36467        RepresentationRef::SymbolRepresentation(i) => {
36468            if i.0 >= model.symbol_representation_arena.items.len() {
36469                return Err(AuthorError::DanglingRef {
36470                    entity: "SYMBOL_REPRESENTATION",
36471                });
36472            }
36473        }
36474        RepresentationRef::TessellatedShapeRepresentation(i) => {
36475            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
36476                return Err(AuthorError::DanglingRef {
36477                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
36478                });
36479            }
36480        }
36481        RepresentationRef::Complex(i) => {
36482            if i.0 >= model.complex_unit_arena.items.len() {
36483                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
36484            }
36485        }
36486    }
36487    Ok(())
36488}
36489fn check_representation_context_ref(
36490    model: &StepModel,
36491    r: &RepresentationContextRef,
36492) -> Result<(), AuthorError> {
36493    match r {
36494        RepresentationContextRef::GeometricRepresentationContext(i) => {
36495            if i.0 >= model.geometric_representation_context_arena.items.len() {
36496                return Err(AuthorError::DanglingRef {
36497                    entity: "GEOMETRIC_REPRESENTATION_CONTEXT",
36498                });
36499            }
36500        }
36501        RepresentationContextRef::GlobalUncertaintyAssignedContext(i) => {
36502            if i.0 >= model.global_uncertainty_assigned_context_arena.items.len() {
36503                return Err(AuthorError::DanglingRef {
36504                    entity: "GLOBAL_UNCERTAINTY_ASSIGNED_CONTEXT",
36505                });
36506            }
36507        }
36508        RepresentationContextRef::GlobalUnitAssignedContext(i) => {
36509            if i.0 >= model.global_unit_assigned_context_arena.items.len() {
36510                return Err(AuthorError::DanglingRef {
36511                    entity: "GLOBAL_UNIT_ASSIGNED_CONTEXT",
36512                });
36513            }
36514        }
36515        RepresentationContextRef::ParametricRepresentationContext(i) => {
36516            if i.0 >= model.parametric_representation_context_arena.items.len() {
36517                return Err(AuthorError::DanglingRef {
36518                    entity: "PARAMETRIC_REPRESENTATION_CONTEXT",
36519                });
36520            }
36521        }
36522        RepresentationContextRef::RepresentationContext(i) => {
36523            if i.0 >= model.representation_context_arena.items.len() {
36524                return Err(AuthorError::DanglingRef {
36525                    entity: "REPRESENTATION_CONTEXT",
36526                });
36527            }
36528        }
36529        RepresentationContextRef::Complex(i) => {
36530            if i.0 >= model.complex_unit_arena.items.len() {
36531                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
36532            }
36533        }
36534    }
36535    Ok(())
36536}
36537fn check_representation_context_reference_ref(
36538    model: &StepModel,
36539    r: &RepresentationContextReferenceRef,
36540) -> Result<(), AuthorError> {
36541    match r {
36542        RepresentationContextReferenceRef::RepresentationContextReference(i) => {
36543            if i.0 >= model.representation_context_reference_arena.items.len() {
36544                return Err(AuthorError::DanglingRef {
36545                    entity: "REPRESENTATION_CONTEXT_REFERENCE",
36546                });
36547            }
36548        }
36549    }
36550    Ok(())
36551}
36552fn check_representation_item_ref(
36553    model: &StepModel,
36554    r: &RepresentationItemRef,
36555) -> Result<(), AuthorError> {
36556    match r {
36557        RepresentationItemRef::AdvancedFace(i) => {
36558            if i.0 >= model.advanced_face_arena.items.len() {
36559                return Err(AuthorError::DanglingRef {
36560                    entity: "ADVANCED_FACE",
36561                });
36562            }
36563        }
36564        RepresentationItemRef::AnnotationCurveOccurrence(i) => {
36565            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
36566                return Err(AuthorError::DanglingRef {
36567                    entity: "ANNOTATION_CURVE_OCCURRENCE",
36568                });
36569            }
36570        }
36571        RepresentationItemRef::AnnotationFillAreaOccurrence(i) => {
36572            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
36573                return Err(AuthorError::DanglingRef {
36574                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
36575                });
36576            }
36577        }
36578        RepresentationItemRef::AnnotationOccurrence(i) => {
36579            if i.0 >= model.annotation_occurrence_arena.items.len() {
36580                return Err(AuthorError::DanglingRef {
36581                    entity: "ANNOTATION_OCCURRENCE",
36582                });
36583            }
36584        }
36585        RepresentationItemRef::AnnotationPlaceholderLeaderLine(_) => {
36586            return Err(AuthorError::NotAp242 {
36587                entity: "ANNOTATION_PLACEHOLDER_LEADER_LINE",
36588            });
36589        }
36590        RepresentationItemRef::AnnotationPlaceholderOccurrence(i) => {
36591            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
36592                return Err(AuthorError::DanglingRef {
36593                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
36594                });
36595            }
36596        }
36597        RepresentationItemRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
36598            return Err(AuthorError::NotAp242 {
36599                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
36600            });
36601        }
36602        RepresentationItemRef::AnnotationPlane(i) => {
36603            if i.0 >= model.annotation_plane_arena.items.len() {
36604                return Err(AuthorError::DanglingRef {
36605                    entity: "ANNOTATION_PLANE",
36606                });
36607            }
36608        }
36609        RepresentationItemRef::AnnotationSymbol(i) => {
36610            if i.0 >= model.annotation_symbol_arena.items.len() {
36611                return Err(AuthorError::DanglingRef {
36612                    entity: "ANNOTATION_SYMBOL",
36613                });
36614            }
36615        }
36616        RepresentationItemRef::AnnotationSymbolOccurrence(i) => {
36617            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
36618                return Err(AuthorError::DanglingRef {
36619                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
36620                });
36621            }
36622        }
36623        RepresentationItemRef::AnnotationText(i) => {
36624            if i.0 >= model.annotation_text_arena.items.len() {
36625                return Err(AuthorError::DanglingRef {
36626                    entity: "ANNOTATION_TEXT",
36627                });
36628            }
36629        }
36630        RepresentationItemRef::AnnotationTextCharacter(i) => {
36631            if i.0 >= model.annotation_text_character_arena.items.len() {
36632                return Err(AuthorError::DanglingRef {
36633                    entity: "ANNOTATION_TEXT_CHARACTER",
36634                });
36635            }
36636        }
36637        RepresentationItemRef::AnnotationTextOccurrence(i) => {
36638            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
36639                return Err(AuthorError::DanglingRef {
36640                    entity: "ANNOTATION_TEXT_OCCURRENCE",
36641                });
36642            }
36643        }
36644        RepresentationItemRef::AnnotationToAnnotationLeaderLine(_) => {
36645            return Err(AuthorError::NotAp242 {
36646                entity: "ANNOTATION_TO_ANNOTATION_LEADER_LINE",
36647            });
36648        }
36649        RepresentationItemRef::AnnotationToModelLeaderLine(_) => {
36650            return Err(AuthorError::NotAp242 {
36651                entity: "ANNOTATION_TO_MODEL_LEADER_LINE",
36652            });
36653        }
36654        RepresentationItemRef::ApllPoint(_) => {
36655            return Err(AuthorError::NotAp242 {
36656                entity: "APLL_POINT",
36657            });
36658        }
36659        RepresentationItemRef::ApllPointWithSurface(_) => {
36660            return Err(AuthorError::NotAp242 {
36661                entity: "APLL_POINT_WITH_SURFACE",
36662            });
36663        }
36664        RepresentationItemRef::AuxiliaryLeaderLine(_) => {
36665            return Err(AuthorError::NotAp242 {
36666                entity: "AUXILIARY_LEADER_LINE",
36667            });
36668        }
36669        RepresentationItemRef::Axis1Placement(i) => {
36670            if i.0 >= model.axis1_placement_arena.items.len() {
36671                return Err(AuthorError::DanglingRef {
36672                    entity: "AXIS1_PLACEMENT",
36673                });
36674            }
36675        }
36676        RepresentationItemRef::Axis2Placement2d(i) => {
36677            if i.0 >= model.axis2_placement2d_arena.items.len() {
36678                return Err(AuthorError::DanglingRef {
36679                    entity: "AXIS2_PLACEMENT_2D",
36680                });
36681            }
36682        }
36683        RepresentationItemRef::Axis2Placement3d(i) => {
36684            if i.0 >= model.axis2_placement3d_arena.items.len() {
36685                return Err(AuthorError::DanglingRef {
36686                    entity: "AXIS2_PLACEMENT_3D",
36687                });
36688            }
36689        }
36690        RepresentationItemRef::BSplineCurve(i) => {
36691            if i.0 >= model.b_spline_curve_arena.items.len() {
36692                return Err(AuthorError::DanglingRef {
36693                    entity: "B_SPLINE_CURVE",
36694                });
36695            }
36696        }
36697        RepresentationItemRef::BSplineCurveWithKnots(i) => {
36698            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
36699                return Err(AuthorError::DanglingRef {
36700                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
36701                });
36702            }
36703        }
36704        RepresentationItemRef::BSplineSurface(i) => {
36705            if i.0 >= model.b_spline_surface_arena.items.len() {
36706                return Err(AuthorError::DanglingRef {
36707                    entity: "B_SPLINE_SURFACE",
36708                });
36709            }
36710        }
36711        RepresentationItemRef::BSplineSurfaceWithKnots(i) => {
36712            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
36713                return Err(AuthorError::DanglingRef {
36714                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
36715                });
36716            }
36717        }
36718        RepresentationItemRef::BezierCurve(i) => {
36719            if i.0 >= model.bezier_curve_arena.items.len() {
36720                return Err(AuthorError::DanglingRef {
36721                    entity: "BEZIER_CURVE",
36722                });
36723            }
36724        }
36725        RepresentationItemRef::BezierSurface(i) => {
36726            if i.0 >= model.bezier_surface_arena.items.len() {
36727                return Err(AuthorError::DanglingRef {
36728                    entity: "BEZIER_SURFACE",
36729                });
36730            }
36731        }
36732        RepresentationItemRef::BoundedCurve(i) => {
36733            if i.0 >= model.bounded_curve_arena.items.len() {
36734                return Err(AuthorError::DanglingRef {
36735                    entity: "BOUNDED_CURVE",
36736                });
36737            }
36738        }
36739        RepresentationItemRef::BoundedPcurve(i) => {
36740            if i.0 >= model.bounded_pcurve_arena.items.len() {
36741                return Err(AuthorError::DanglingRef {
36742                    entity: "BOUNDED_PCURVE",
36743                });
36744            }
36745        }
36746        RepresentationItemRef::BoundedSurface(i) => {
36747            if i.0 >= model.bounded_surface_arena.items.len() {
36748                return Err(AuthorError::DanglingRef {
36749                    entity: "BOUNDED_SURFACE",
36750                });
36751            }
36752        }
36753        RepresentationItemRef::BoundedSurfaceCurve(i) => {
36754            if i.0 >= model.bounded_surface_curve_arena.items.len() {
36755                return Err(AuthorError::DanglingRef {
36756                    entity: "BOUNDED_SURFACE_CURVE",
36757                });
36758            }
36759        }
36760        RepresentationItemRef::BrepWithVoids(i) => {
36761            if i.0 >= model.brep_with_voids_arena.items.len() {
36762                return Err(AuthorError::DanglingRef {
36763                    entity: "BREP_WITH_VOIDS",
36764                });
36765            }
36766        }
36767        RepresentationItemRef::CameraImage(i) => {
36768            if i.0 >= model.camera_image_arena.items.len() {
36769                return Err(AuthorError::DanglingRef {
36770                    entity: "CAMERA_IMAGE",
36771                });
36772            }
36773        }
36774        RepresentationItemRef::CameraImage3dWithScale(i) => {
36775            if i.0 >= model.camera_image3d_with_scale_arena.items.len() {
36776                return Err(AuthorError::DanglingRef {
36777                    entity: "CAMERA_IMAGE_3D_WITH_SCALE",
36778                });
36779            }
36780        }
36781        RepresentationItemRef::CameraModel(i) => {
36782            if i.0 >= model.camera_model_arena.items.len() {
36783                return Err(AuthorError::DanglingRef {
36784                    entity: "CAMERA_MODEL",
36785                });
36786            }
36787        }
36788        RepresentationItemRef::CameraModelD3(i) => {
36789            if i.0 >= model.camera_model_d3_arena.items.len() {
36790                return Err(AuthorError::DanglingRef {
36791                    entity: "CAMERA_MODEL_D3",
36792                });
36793            }
36794        }
36795        RepresentationItemRef::CameraModelD3MultiClipping(i) => {
36796            if i.0 >= model.camera_model_d3_multi_clipping_arena.items.len() {
36797                return Err(AuthorError::DanglingRef {
36798                    entity: "CAMERA_MODEL_D3_MULTI_CLIPPING",
36799                });
36800            }
36801        }
36802        RepresentationItemRef::CameraModelD3WithHlhsr(i) => {
36803            if i.0 >= model.camera_model_d3_with_hlhsr_arena.items.len() {
36804                return Err(AuthorError::DanglingRef {
36805                    entity: "CAMERA_MODEL_D3_WITH_HLHSR",
36806                });
36807            }
36808        }
36809        RepresentationItemRef::CartesianPoint(i) => {
36810            if i.0 >= model.cartesian_point_arena.items.len() {
36811                return Err(AuthorError::DanglingRef {
36812                    entity: "CARTESIAN_POINT",
36813                });
36814            }
36815        }
36816        RepresentationItemRef::Circle(i) => {
36817            if i.0 >= model.circle_arena.items.len() {
36818                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
36819            }
36820        }
36821        RepresentationItemRef::ClosedShell(i) => {
36822            if i.0 >= model.closed_shell_arena.items.len() {
36823                return Err(AuthorError::DanglingRef {
36824                    entity: "CLOSED_SHELL",
36825                });
36826            }
36827        }
36828        RepresentationItemRef::ComplexTriangulatedFace(i) => {
36829            if i.0 >= model.complex_triangulated_face_arena.items.len() {
36830                return Err(AuthorError::DanglingRef {
36831                    entity: "COMPLEX_TRIANGULATED_FACE",
36832                });
36833            }
36834        }
36835        RepresentationItemRef::ComplexTriangulatedSurfaceSet(i) => {
36836            if i.0 >= model.complex_triangulated_surface_set_arena.items.len() {
36837                return Err(AuthorError::DanglingRef {
36838                    entity: "COMPLEX_TRIANGULATED_SURFACE_SET",
36839                });
36840            }
36841        }
36842        RepresentationItemRef::CompositeCurve(i) => {
36843            if i.0 >= model.composite_curve_arena.items.len() {
36844                return Err(AuthorError::DanglingRef {
36845                    entity: "COMPOSITE_CURVE",
36846                });
36847            }
36848        }
36849        RepresentationItemRef::CompositeText(i) => {
36850            if i.0 >= model.composite_text_arena.items.len() {
36851                return Err(AuthorError::DanglingRef {
36852                    entity: "COMPOSITE_TEXT",
36853                });
36854            }
36855        }
36856        RepresentationItemRef::CompoundRepresentationItem(i) => {
36857            if i.0 >= model.compound_representation_item_arena.items.len() {
36858                return Err(AuthorError::DanglingRef {
36859                    entity: "COMPOUND_REPRESENTATION_ITEM",
36860                });
36861            }
36862        }
36863        RepresentationItemRef::Conic(i) => {
36864            if i.0 >= model.conic_arena.items.len() {
36865                return Err(AuthorError::DanglingRef { entity: "CONIC" });
36866            }
36867        }
36868        RepresentationItemRef::ConicalSurface(i) => {
36869            if i.0 >= model.conical_surface_arena.items.len() {
36870                return Err(AuthorError::DanglingRef {
36871                    entity: "CONICAL_SURFACE",
36872                });
36873            }
36874        }
36875        RepresentationItemRef::ConnectedFaceSet(i) => {
36876            if i.0 >= model.connected_face_set_arena.items.len() {
36877                return Err(AuthorError::DanglingRef {
36878                    entity: "CONNECTED_FACE_SET",
36879                });
36880            }
36881        }
36882        RepresentationItemRef::ContextDependentOverRidingStyledItem(i) => {
36883            if i.0
36884                >= model
36885                    .context_dependent_over_riding_styled_item_arena
36886                    .items
36887                    .len()
36888            {
36889                return Err(AuthorError::DanglingRef {
36890                    entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
36891                });
36892            }
36893        }
36894        RepresentationItemRef::CoordinatesList(i) => {
36895            if i.0 >= model.coordinates_list_arena.items.len() {
36896                return Err(AuthorError::DanglingRef {
36897                    entity: "COORDINATES_LIST",
36898                });
36899            }
36900        }
36901        RepresentationItemRef::Curve(i) => {
36902            if i.0 >= model.curve_arena.items.len() {
36903                return Err(AuthorError::DanglingRef { entity: "CURVE" });
36904            }
36905        }
36906        RepresentationItemRef::CylindricalSurface(i) => {
36907            if i.0 >= model.cylindrical_surface_arena.items.len() {
36908                return Err(AuthorError::DanglingRef {
36909                    entity: "CYLINDRICAL_SURFACE",
36910                });
36911            }
36912        }
36913        RepresentationItemRef::DefinedCharacterGlyph(i) => {
36914            if i.0 >= model.defined_character_glyph_arena.items.len() {
36915                return Err(AuthorError::DanglingRef {
36916                    entity: "DEFINED_CHARACTER_GLYPH",
36917                });
36918            }
36919        }
36920        RepresentationItemRef::DefinedSymbol(i) => {
36921            if i.0 >= model.defined_symbol_arena.items.len() {
36922                return Err(AuthorError::DanglingRef {
36923                    entity: "DEFINED_SYMBOL",
36924                });
36925            }
36926        }
36927        RepresentationItemRef::DegenerateToroidalSurface(i) => {
36928            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
36929                return Err(AuthorError::DanglingRef {
36930                    entity: "DEGENERATE_TOROIDAL_SURFACE",
36931                });
36932            }
36933        }
36934        RepresentationItemRef::DescriptiveRepresentationItem(i) => {
36935            if i.0 >= model.descriptive_representation_item_arena.items.len() {
36936                return Err(AuthorError::DanglingRef {
36937                    entity: "DESCRIPTIVE_REPRESENTATION_ITEM",
36938                });
36939            }
36940        }
36941        RepresentationItemRef::Direction(i) => {
36942            if i.0 >= model.direction_arena.items.len() {
36943                return Err(AuthorError::DanglingRef {
36944                    entity: "DIRECTION",
36945                });
36946            }
36947        }
36948        RepresentationItemRef::DraughtingAnnotationOccurrence(i) => {
36949            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
36950                return Err(AuthorError::DanglingRef {
36951                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
36952                });
36953            }
36954        }
36955        RepresentationItemRef::DraughtingCallout(i) => {
36956            if i.0 >= model.draughting_callout_arena.items.len() {
36957                return Err(AuthorError::DanglingRef {
36958                    entity: "DRAUGHTING_CALLOUT",
36959                });
36960            }
36961        }
36962        RepresentationItemRef::Edge(i) => {
36963            if i.0 >= model.edge_arena.items.len() {
36964                return Err(AuthorError::DanglingRef { entity: "EDGE" });
36965            }
36966        }
36967        RepresentationItemRef::EdgeCurve(i) => {
36968            if i.0 >= model.edge_curve_arena.items.len() {
36969                return Err(AuthorError::DanglingRef {
36970                    entity: "EDGE_CURVE",
36971                });
36972            }
36973        }
36974        RepresentationItemRef::EdgeLoop(i) => {
36975            if i.0 >= model.edge_loop_arena.items.len() {
36976                return Err(AuthorError::DanglingRef {
36977                    entity: "EDGE_LOOP",
36978                });
36979            }
36980        }
36981        RepresentationItemRef::ElementarySurface(i) => {
36982            if i.0 >= model.elementary_surface_arena.items.len() {
36983                return Err(AuthorError::DanglingRef {
36984                    entity: "ELEMENTARY_SURFACE",
36985                });
36986            }
36987        }
36988        RepresentationItemRef::Ellipse(i) => {
36989            if i.0 >= model.ellipse_arena.items.len() {
36990                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
36991            }
36992        }
36993        RepresentationItemRef::ExternallyDefinedHatchStyle(i) => {
36994            if i.0 >= model.externally_defined_hatch_style_arena.items.len() {
36995                return Err(AuthorError::DanglingRef {
36996                    entity: "EXTERNALLY_DEFINED_HATCH_STYLE",
36997                });
36998            }
36999        }
37000        RepresentationItemRef::ExternallyDefinedTileStyle(i) => {
37001            if i.0 >= model.externally_defined_tile_style_arena.items.len() {
37002                return Err(AuthorError::DanglingRef {
37003                    entity: "EXTERNALLY_DEFINED_TILE_STYLE",
37004                });
37005            }
37006        }
37007        RepresentationItemRef::Face(i) => {
37008            if i.0 >= model.face_arena.items.len() {
37009                return Err(AuthorError::DanglingRef { entity: "FACE" });
37010            }
37011        }
37012        RepresentationItemRef::FaceBound(i) => {
37013            if i.0 >= model.face_bound_arena.items.len() {
37014                return Err(AuthorError::DanglingRef {
37015                    entity: "FACE_BOUND",
37016                });
37017            }
37018        }
37019        RepresentationItemRef::FaceOuterBound(i) => {
37020            if i.0 >= model.face_outer_bound_arena.items.len() {
37021                return Err(AuthorError::DanglingRef {
37022                    entity: "FACE_OUTER_BOUND",
37023                });
37024            }
37025        }
37026        RepresentationItemRef::FaceSurface(i) => {
37027            if i.0 >= model.face_surface_arena.items.len() {
37028                return Err(AuthorError::DanglingRef {
37029                    entity: "FACE_SURFACE",
37030                });
37031            }
37032        }
37033        RepresentationItemRef::FillAreaStyleHatching(i) => {
37034            if i.0 >= model.fill_area_style_hatching_arena.items.len() {
37035                return Err(AuthorError::DanglingRef {
37036                    entity: "FILL_AREA_STYLE_HATCHING",
37037                });
37038            }
37039        }
37040        RepresentationItemRef::FillAreaStyleTileColouredRegion(i) => {
37041            if i.0 >= model.fill_area_style_tile_coloured_region_arena.items.len() {
37042                return Err(AuthorError::DanglingRef {
37043                    entity: "FILL_AREA_STYLE_TILE_COLOURED_REGION",
37044                });
37045            }
37046        }
37047        RepresentationItemRef::FillAreaStyleTileCurveWithStyle(i) => {
37048            if i.0
37049                >= model
37050                    .fill_area_style_tile_curve_with_style_arena
37051                    .items
37052                    .len()
37053            {
37054                return Err(AuthorError::DanglingRef {
37055                    entity: "FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE",
37056                });
37057            }
37058        }
37059        RepresentationItemRef::FillAreaStyleTileSymbolWithStyle(i) => {
37060            if i.0
37061                >= model
37062                    .fill_area_style_tile_symbol_with_style_arena
37063                    .items
37064                    .len()
37065            {
37066                return Err(AuthorError::DanglingRef {
37067                    entity: "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE",
37068                });
37069            }
37070        }
37071        RepresentationItemRef::FillAreaStyleTiles(i) => {
37072            if i.0 >= model.fill_area_style_tiles_arena.items.len() {
37073                return Err(AuthorError::DanglingRef {
37074                    entity: "FILL_AREA_STYLE_TILES",
37075                });
37076            }
37077        }
37078        RepresentationItemRef::GeometricCurveSet(i) => {
37079            if i.0 >= model.geometric_curve_set_arena.items.len() {
37080                return Err(AuthorError::DanglingRef {
37081                    entity: "GEOMETRIC_CURVE_SET",
37082                });
37083            }
37084        }
37085        RepresentationItemRef::GeometricRepresentationItem(i) => {
37086            if i.0 >= model.geometric_representation_item_arena.items.len() {
37087                return Err(AuthorError::DanglingRef {
37088                    entity: "GEOMETRIC_REPRESENTATION_ITEM",
37089                });
37090            }
37091        }
37092        RepresentationItemRef::GeometricSet(i) => {
37093            if i.0 >= model.geometric_set_arena.items.len() {
37094                return Err(AuthorError::DanglingRef {
37095                    entity: "GEOMETRIC_SET",
37096                });
37097            }
37098        }
37099        RepresentationItemRef::Hyperbola(i) => {
37100            if i.0 >= model.hyperbola_arena.items.len() {
37101                return Err(AuthorError::DanglingRef {
37102                    entity: "HYPERBOLA",
37103                });
37104            }
37105        }
37106        RepresentationItemRef::IntegerRepresentationItem(i) => {
37107            if i.0 >= model.integer_representation_item_arena.items.len() {
37108                return Err(AuthorError::DanglingRef {
37109                    entity: "INTEGER_REPRESENTATION_ITEM",
37110                });
37111            }
37112        }
37113        RepresentationItemRef::IntersectionCurve(i) => {
37114            if i.0 >= model.intersection_curve_arena.items.len() {
37115                return Err(AuthorError::DanglingRef {
37116                    entity: "INTERSECTION_CURVE",
37117                });
37118            }
37119        }
37120        RepresentationItemRef::LeaderCurve(i) => {
37121            if i.0 >= model.leader_curve_arena.items.len() {
37122                return Err(AuthorError::DanglingRef {
37123                    entity: "LEADER_CURVE",
37124                });
37125            }
37126        }
37127        RepresentationItemRef::LeaderDirectedCallout(i) => {
37128            if i.0 >= model.leader_directed_callout_arena.items.len() {
37129                return Err(AuthorError::DanglingRef {
37130                    entity: "LEADER_DIRECTED_CALLOUT",
37131                });
37132            }
37133        }
37134        RepresentationItemRef::LeaderTerminator(i) => {
37135            if i.0 >= model.leader_terminator_arena.items.len() {
37136                return Err(AuthorError::DanglingRef {
37137                    entity: "LEADER_TERMINATOR",
37138                });
37139            }
37140        }
37141        RepresentationItemRef::Line(i) => {
37142            if i.0 >= model.line_arena.items.len() {
37143                return Err(AuthorError::DanglingRef { entity: "LINE" });
37144            }
37145        }
37146        RepresentationItemRef::Loop(i) => {
37147            if i.0 >= model.loop_arena.items.len() {
37148                return Err(AuthorError::DanglingRef { entity: "LOOP" });
37149            }
37150        }
37151        RepresentationItemRef::ManifoldSolidBrep(i) => {
37152            if i.0 >= model.manifold_solid_brep_arena.items.len() {
37153                return Err(AuthorError::DanglingRef {
37154                    entity: "MANIFOLD_SOLID_BREP",
37155                });
37156            }
37157        }
37158        RepresentationItemRef::MappedItem(i) => {
37159            if i.0 >= model.mapped_item_arena.items.len() {
37160                return Err(AuthorError::DanglingRef {
37161                    entity: "MAPPED_ITEM",
37162                });
37163            }
37164        }
37165        RepresentationItemRef::MeasureRepresentationItem(i) => {
37166            if i.0 >= model.measure_representation_item_arena.items.len() {
37167                return Err(AuthorError::DanglingRef {
37168                    entity: "MEASURE_REPRESENTATION_ITEM",
37169                });
37170            }
37171        }
37172        RepresentationItemRef::OffsetSurface(i) => {
37173            if i.0 >= model.offset_surface_arena.items.len() {
37174                return Err(AuthorError::DanglingRef {
37175                    entity: "OFFSET_SURFACE",
37176                });
37177            }
37178        }
37179        RepresentationItemRef::OneDirectionRepeatFactor(i) => {
37180            if i.0 >= model.one_direction_repeat_factor_arena.items.len() {
37181                return Err(AuthorError::DanglingRef {
37182                    entity: "ONE_DIRECTION_REPEAT_FACTOR",
37183                });
37184            }
37185        }
37186        RepresentationItemRef::OpenShell(i) => {
37187            if i.0 >= model.open_shell_arena.items.len() {
37188                return Err(AuthorError::DanglingRef {
37189                    entity: "OPEN_SHELL",
37190                });
37191            }
37192        }
37193        RepresentationItemRef::OrientedClosedShell(i) => {
37194            if i.0 >= model.oriented_closed_shell_arena.items.len() {
37195                return Err(AuthorError::DanglingRef {
37196                    entity: "ORIENTED_CLOSED_SHELL",
37197                });
37198            }
37199        }
37200        RepresentationItemRef::OrientedEdge(i) => {
37201            if i.0 >= model.oriented_edge_arena.items.len() {
37202                return Err(AuthorError::DanglingRef {
37203                    entity: "ORIENTED_EDGE",
37204                });
37205            }
37206        }
37207        RepresentationItemRef::OverRidingStyledItem(i) => {
37208            if i.0 >= model.over_riding_styled_item_arena.items.len() {
37209                return Err(AuthorError::DanglingRef {
37210                    entity: "OVER_RIDING_STYLED_ITEM",
37211                });
37212            }
37213        }
37214        RepresentationItemRef::Path(i) => {
37215            if i.0 >= model.path_arena.items.len() {
37216                return Err(AuthorError::DanglingRef { entity: "PATH" });
37217            }
37218        }
37219        RepresentationItemRef::Pcurve(i) => {
37220            if i.0 >= model.pcurve_arena.items.len() {
37221                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
37222            }
37223        }
37224        RepresentationItemRef::Placement(i) => {
37225            if i.0 >= model.placement_arena.items.len() {
37226                return Err(AuthorError::DanglingRef {
37227                    entity: "PLACEMENT",
37228                });
37229            }
37230        }
37231        RepresentationItemRef::PlanarBox(i) => {
37232            if i.0 >= model.planar_box_arena.items.len() {
37233                return Err(AuthorError::DanglingRef {
37234                    entity: "PLANAR_BOX",
37235                });
37236            }
37237        }
37238        RepresentationItemRef::PlanarExtent(i) => {
37239            if i.0 >= model.planar_extent_arena.items.len() {
37240                return Err(AuthorError::DanglingRef {
37241                    entity: "PLANAR_EXTENT",
37242                });
37243            }
37244        }
37245        RepresentationItemRef::Plane(i) => {
37246            if i.0 >= model.plane_arena.items.len() {
37247                return Err(AuthorError::DanglingRef { entity: "PLANE" });
37248            }
37249        }
37250        RepresentationItemRef::Point(i) => {
37251            if i.0 >= model.point_arena.items.len() {
37252                return Err(AuthorError::DanglingRef { entity: "POINT" });
37253            }
37254        }
37255        RepresentationItemRef::PolyLoop(i) => {
37256            if i.0 >= model.poly_loop_arena.items.len() {
37257                return Err(AuthorError::DanglingRef {
37258                    entity: "POLY_LOOP",
37259                });
37260            }
37261        }
37262        RepresentationItemRef::Polyline(i) => {
37263            if i.0 >= model.polyline_arena.items.len() {
37264                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
37265            }
37266        }
37267        RepresentationItemRef::QualifiedRepresentationItem(i) => {
37268            if i.0 >= model.qualified_representation_item_arena.items.len() {
37269                return Err(AuthorError::DanglingRef {
37270                    entity: "QUALIFIED_REPRESENTATION_ITEM",
37271                });
37272            }
37273        }
37274        RepresentationItemRef::QuasiUniformCurve(i) => {
37275            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
37276                return Err(AuthorError::DanglingRef {
37277                    entity: "QUASI_UNIFORM_CURVE",
37278                });
37279            }
37280        }
37281        RepresentationItemRef::QuasiUniformSurface(i) => {
37282            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
37283                return Err(AuthorError::DanglingRef {
37284                    entity: "QUASI_UNIFORM_SURFACE",
37285                });
37286            }
37287        }
37288        RepresentationItemRef::RationalBSplineCurve(i) => {
37289            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
37290                return Err(AuthorError::DanglingRef {
37291                    entity: "RATIONAL_B_SPLINE_CURVE",
37292                });
37293            }
37294        }
37295        RepresentationItemRef::RationalBSplineSurface(i) => {
37296            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
37297                return Err(AuthorError::DanglingRef {
37298                    entity: "RATIONAL_B_SPLINE_SURFACE",
37299                });
37300            }
37301        }
37302        RepresentationItemRef::RealRepresentationItem(i) => {
37303            if i.0 >= model.real_representation_item_arena.items.len() {
37304                return Err(AuthorError::DanglingRef {
37305                    entity: "REAL_REPRESENTATION_ITEM",
37306                });
37307            }
37308        }
37309        RepresentationItemRef::RepositionedTessellatedItem(i) => {
37310            if i.0 >= model.repositioned_tessellated_item_arena.items.len() {
37311                return Err(AuthorError::DanglingRef {
37312                    entity: "REPOSITIONED_TESSELLATED_ITEM",
37313                });
37314            }
37315        }
37316        RepresentationItemRef::RepresentationItem(i) => {
37317            if i.0 >= model.representation_item_arena.items.len() {
37318                return Err(AuthorError::DanglingRef {
37319                    entity: "REPRESENTATION_ITEM",
37320                });
37321            }
37322        }
37323        RepresentationItemRef::SeamCurve(i) => {
37324            if i.0 >= model.seam_curve_arena.items.len() {
37325                return Err(AuthorError::DanglingRef {
37326                    entity: "SEAM_CURVE",
37327                });
37328            }
37329        }
37330        RepresentationItemRef::ShellBasedSurfaceModel(i) => {
37331            if i.0 >= model.shell_based_surface_model_arena.items.len() {
37332                return Err(AuthorError::DanglingRef {
37333                    entity: "SHELL_BASED_SURFACE_MODEL",
37334                });
37335            }
37336        }
37337        RepresentationItemRef::SolidModel(i) => {
37338            if i.0 >= model.solid_model_arena.items.len() {
37339                return Err(AuthorError::DanglingRef {
37340                    entity: "SOLID_MODEL",
37341                });
37342            }
37343        }
37344        RepresentationItemRef::SphericalSurface(i) => {
37345            if i.0 >= model.spherical_surface_arena.items.len() {
37346                return Err(AuthorError::DanglingRef {
37347                    entity: "SPHERICAL_SURFACE",
37348                });
37349            }
37350        }
37351        RepresentationItemRef::StyledItem(i) => {
37352            if i.0 >= model.styled_item_arena.items.len() {
37353                return Err(AuthorError::DanglingRef {
37354                    entity: "STYLED_ITEM",
37355                });
37356            }
37357        }
37358        RepresentationItemRef::Surface(i) => {
37359            if i.0 >= model.surface_arena.items.len() {
37360                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
37361            }
37362        }
37363        RepresentationItemRef::SurfaceCurve(i) => {
37364            if i.0 >= model.surface_curve_arena.items.len() {
37365                return Err(AuthorError::DanglingRef {
37366                    entity: "SURFACE_CURVE",
37367                });
37368            }
37369        }
37370        RepresentationItemRef::SurfaceOfLinearExtrusion(i) => {
37371            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
37372                return Err(AuthorError::DanglingRef {
37373                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
37374                });
37375            }
37376        }
37377        RepresentationItemRef::SurfaceOfRevolution(i) => {
37378            if i.0 >= model.surface_of_revolution_arena.items.len() {
37379                return Err(AuthorError::DanglingRef {
37380                    entity: "SURFACE_OF_REVOLUTION",
37381                });
37382            }
37383        }
37384        RepresentationItemRef::SweptSurface(i) => {
37385            if i.0 >= model.swept_surface_arena.items.len() {
37386                return Err(AuthorError::DanglingRef {
37387                    entity: "SWEPT_SURFACE",
37388                });
37389            }
37390        }
37391        RepresentationItemRef::SymbolTarget(i) => {
37392            if i.0 >= model.symbol_target_arena.items.len() {
37393                return Err(AuthorError::DanglingRef {
37394                    entity: "SYMBOL_TARGET",
37395                });
37396            }
37397        }
37398        RepresentationItemRef::TerminatorSymbol(i) => {
37399            if i.0 >= model.terminator_symbol_arena.items.len() {
37400                return Err(AuthorError::DanglingRef {
37401                    entity: "TERMINATOR_SYMBOL",
37402                });
37403            }
37404        }
37405        RepresentationItemRef::TessellatedAnnotationOccurrence(i) => {
37406            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
37407                return Err(AuthorError::DanglingRef {
37408                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
37409                });
37410            }
37411        }
37412        RepresentationItemRef::TessellatedCurveSet(i) => {
37413            if i.0 >= model.tessellated_curve_set_arena.items.len() {
37414                return Err(AuthorError::DanglingRef {
37415                    entity: "TESSELLATED_CURVE_SET",
37416                });
37417            }
37418        }
37419        RepresentationItemRef::TessellatedFace(i) => {
37420            if i.0 >= model.tessellated_face_arena.items.len() {
37421                return Err(AuthorError::DanglingRef {
37422                    entity: "TESSELLATED_FACE",
37423                });
37424            }
37425        }
37426        RepresentationItemRef::TessellatedGeometricSet(i) => {
37427            if i.0 >= model.tessellated_geometric_set_arena.items.len() {
37428                return Err(AuthorError::DanglingRef {
37429                    entity: "TESSELLATED_GEOMETRIC_SET",
37430                });
37431            }
37432        }
37433        RepresentationItemRef::TessellatedItem(i) => {
37434            if i.0 >= model.tessellated_item_arena.items.len() {
37435                return Err(AuthorError::DanglingRef {
37436                    entity: "TESSELLATED_ITEM",
37437                });
37438            }
37439        }
37440        RepresentationItemRef::TessellatedShell(i) => {
37441            if i.0 >= model.tessellated_shell_arena.items.len() {
37442                return Err(AuthorError::DanglingRef {
37443                    entity: "TESSELLATED_SHELL",
37444                });
37445            }
37446        }
37447        RepresentationItemRef::TessellatedSolid(i) => {
37448            if i.0 >= model.tessellated_solid_arena.items.len() {
37449                return Err(AuthorError::DanglingRef {
37450                    entity: "TESSELLATED_SOLID",
37451                });
37452            }
37453        }
37454        RepresentationItemRef::TessellatedStructuredItem(i) => {
37455            if i.0 >= model.tessellated_structured_item_arena.items.len() {
37456                return Err(AuthorError::DanglingRef {
37457                    entity: "TESSELLATED_STRUCTURED_ITEM",
37458                });
37459            }
37460        }
37461        RepresentationItemRef::TessellatedSurfaceSet(i) => {
37462            if i.0 >= model.tessellated_surface_set_arena.items.len() {
37463                return Err(AuthorError::DanglingRef {
37464                    entity: "TESSELLATED_SURFACE_SET",
37465                });
37466            }
37467        }
37468        RepresentationItemRef::TextLiteral(i) => {
37469            if i.0 >= model.text_literal_arena.items.len() {
37470                return Err(AuthorError::DanglingRef {
37471                    entity: "TEXT_LITERAL",
37472                });
37473            }
37474        }
37475        RepresentationItemRef::TopologicalRepresentationItem(i) => {
37476            if i.0 >= model.topological_representation_item_arena.items.len() {
37477                return Err(AuthorError::DanglingRef {
37478                    entity: "TOPOLOGICAL_REPRESENTATION_ITEM",
37479                });
37480            }
37481        }
37482        RepresentationItemRef::ToroidalSurface(i) => {
37483            if i.0 >= model.toroidal_surface_arena.items.len() {
37484                return Err(AuthorError::DanglingRef {
37485                    entity: "TOROIDAL_SURFACE",
37486                });
37487            }
37488        }
37489        RepresentationItemRef::TrimmedCurve(i) => {
37490            if i.0 >= model.trimmed_curve_arena.items.len() {
37491                return Err(AuthorError::DanglingRef {
37492                    entity: "TRIMMED_CURVE",
37493                });
37494            }
37495        }
37496        RepresentationItemRef::TwoDirectionRepeatFactor(i) => {
37497            if i.0 >= model.two_direction_repeat_factor_arena.items.len() {
37498                return Err(AuthorError::DanglingRef {
37499                    entity: "TWO_DIRECTION_REPEAT_FACTOR",
37500                });
37501            }
37502        }
37503        RepresentationItemRef::UniformCurve(i) => {
37504            if i.0 >= model.uniform_curve_arena.items.len() {
37505                return Err(AuthorError::DanglingRef {
37506                    entity: "UNIFORM_CURVE",
37507                });
37508            }
37509        }
37510        RepresentationItemRef::UniformSurface(i) => {
37511            if i.0 >= model.uniform_surface_arena.items.len() {
37512                return Err(AuthorError::DanglingRef {
37513                    entity: "UNIFORM_SURFACE",
37514                });
37515            }
37516        }
37517        RepresentationItemRef::ValueRepresentationItem(i) => {
37518            if i.0 >= model.value_representation_item_arena.items.len() {
37519                return Err(AuthorError::DanglingRef {
37520                    entity: "VALUE_REPRESENTATION_ITEM",
37521                });
37522            }
37523        }
37524        RepresentationItemRef::Vector(i) => {
37525            if i.0 >= model.vector_arena.items.len() {
37526                return Err(AuthorError::DanglingRef { entity: "VECTOR" });
37527            }
37528        }
37529        RepresentationItemRef::Vertex(i) => {
37530            if i.0 >= model.vertex_arena.items.len() {
37531                return Err(AuthorError::DanglingRef { entity: "VERTEX" });
37532            }
37533        }
37534        RepresentationItemRef::VertexLoop(i) => {
37535            if i.0 >= model.vertex_loop_arena.items.len() {
37536                return Err(AuthorError::DanglingRef {
37537                    entity: "VERTEX_LOOP",
37538                });
37539            }
37540        }
37541        RepresentationItemRef::VertexPoint(i) => {
37542            if i.0 >= model.vertex_point_arena.items.len() {
37543                return Err(AuthorError::DanglingRef {
37544                    entity: "VERTEX_POINT",
37545                });
37546            }
37547        }
37548        RepresentationItemRef::VertexShell(i) => {
37549            if i.0 >= model.vertex_shell_arena.items.len() {
37550                return Err(AuthorError::DanglingRef {
37551                    entity: "VERTEX_SHELL",
37552                });
37553            }
37554        }
37555        RepresentationItemRef::WireShell(i) => {
37556            if i.0 >= model.wire_shell_arena.items.len() {
37557                return Err(AuthorError::DanglingRef {
37558                    entity: "WIRE_SHELL",
37559                });
37560            }
37561        }
37562        RepresentationItemRef::Complex(i) => {
37563            if i.0 >= model.complex_unit_arena.items.len() {
37564                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
37565            }
37566        }
37567    }
37568    Ok(())
37569}
37570fn check_representation_map_ref(
37571    model: &StepModel,
37572    r: &RepresentationMapRef,
37573) -> Result<(), AuthorError> {
37574    match r {
37575        RepresentationMapRef::CameraUsage(i) => {
37576            if i.0 >= model.camera_usage_arena.items.len() {
37577                return Err(AuthorError::DanglingRef {
37578                    entity: "CAMERA_USAGE",
37579                });
37580            }
37581        }
37582        RepresentationMapRef::RepresentationMap(i) => {
37583            if i.0 >= model.representation_map_arena.items.len() {
37584                return Err(AuthorError::DanglingRef {
37585                    entity: "REPRESENTATION_MAP",
37586                });
37587            }
37588        }
37589        RepresentationMapRef::Complex(i) => {
37590            if i.0 >= model.complex_unit_arena.items.len() {
37591                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
37592            }
37593        }
37594    }
37595    Ok(())
37596}
37597fn check_representation_or_representation_reference_ref(
37598    model: &StepModel,
37599    r: &RepresentationOrRepresentationReferenceRef,
37600) -> Result<(), AuthorError> {
37601    match r {
37602        RepresentationOrRepresentationReferenceRef::AdvancedBrepShapeRepresentation(i) => { if i.0 >= model.advanced_brep_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "ADVANCED_BREP_SHAPE_REPRESENTATION" }); } }
37603        RepresentationOrRepresentationReferenceRef::CharacterizedRepresentation(i) => { if i.0 >= model.characterized_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CHARACTERIZED_REPRESENTATION" }); } }
37604        RepresentationOrRepresentationReferenceRef::ConstructiveGeometryRepresentation(i) => { if i.0 >= model.constructive_geometry_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION" }); } }
37605        RepresentationOrRepresentationReferenceRef::DefinitionalRepresentation(i) => { if i.0 >= model.definitional_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "DEFINITIONAL_REPRESENTATION" }); } }
37606        RepresentationOrRepresentationReferenceRef::DraughtingModel(i) => { if i.0 >= model.draughting_model_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "DRAUGHTING_MODEL" }); } }
37607        RepresentationOrRepresentationReferenceRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => { if i.0 >= model.geometrically_bounded_surface_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION" }); } }
37608        RepresentationOrRepresentationReferenceRef::GeometricallyBoundedWireframeShapeRepresentation(i) => { if i.0 >= model.geometrically_bounded_wireframe_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION" }); } }
37609        RepresentationOrRepresentationReferenceRef::ManifoldSurfaceShapeRepresentation(i) => { if i.0 >= model.manifold_surface_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION" }); } }
37610        RepresentationOrRepresentationReferenceRef::MechanicalDesignGeometricPresentationRepresentation(i) => { if i.0 >= model.mechanical_design_geometric_presentation_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION" }); } }
37611        RepresentationOrRepresentationReferenceRef::MechanicalDesignPresentationRepresentationWithDraughting(i) => { if i.0 >= model.mechanical_design_presentation_representation_with_draughting_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING" }); } }
37612        RepresentationOrRepresentationReferenceRef::MechanicalDesignShadedPresentationRepresentation(i) => { if i.0 >= model.mechanical_design_shaded_presentation_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION" }); } }
37613        RepresentationOrRepresentationReferenceRef::PresentationArea(i) => { if i.0 >= model.presentation_area_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "PRESENTATION_AREA" }); } }
37614        RepresentationOrRepresentationReferenceRef::PresentationRepresentation(i) => { if i.0 >= model.presentation_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "PRESENTATION_REPRESENTATION" }); } }
37615        RepresentationOrRepresentationReferenceRef::PresentationView(i) => { if i.0 >= model.presentation_view_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "PRESENTATION_VIEW" }); } }
37616        RepresentationOrRepresentationReferenceRef::Representation(i) => { if i.0 >= model.representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "REPRESENTATION" }); } }
37617        RepresentationOrRepresentationReferenceRef::RepresentationReference(i) => { if i.0 >= model.representation_reference_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "REPRESENTATION_REFERENCE" }); } }
37618        RepresentationOrRepresentationReferenceRef::ShapeDimensionRepresentation(i) => { if i.0 >= model.shape_dimension_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SHAPE_DIMENSION_REPRESENTATION" }); } }
37619        RepresentationOrRepresentationReferenceRef::ShapeRepresentation(i) => { if i.0 >= model.shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SHAPE_REPRESENTATION" }); } }
37620        RepresentationOrRepresentationReferenceRef::ShapeRepresentationWithParameters(i) => { if i.0 >= model.shape_representation_with_parameters_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS" }); } }
37621        RepresentationOrRepresentationReferenceRef::SymbolRepresentation(i) => { if i.0 >= model.symbol_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "SYMBOL_REPRESENTATION" }); } }
37622        RepresentationOrRepresentationReferenceRef::TessellatedShapeRepresentation(i) => { if i.0 >= model.tessellated_shape_representation_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "TESSELLATED_SHAPE_REPRESENTATION" }); } }
37623        RepresentationOrRepresentationReferenceRef::Complex(i) => { if i.0 >= model.complex_unit_arena.items.len() { return Err(AuthorError::DanglingRef { entity: "COMPLEX" }); } }
37624    }
37625    Ok(())
37626}
37627fn check_represented_definition_ref(
37628    model: &StepModel,
37629    r: &RepresentedDefinitionRef,
37630) -> Result<(), AuthorError> {
37631    match r {
37632        RepresentedDefinitionRef::AllAroundShapeAspect(i) => {
37633            if i.0 >= model.all_around_shape_aspect_arena.items.len() {
37634                return Err(AuthorError::DanglingRef {
37635                    entity: "ALL_AROUND_SHAPE_ASPECT",
37636                });
37637            }
37638        }
37639        RepresentedDefinitionRef::AngularLocation(i) => {
37640            if i.0 >= model.angular_location_arena.items.len() {
37641                return Err(AuthorError::DanglingRef {
37642                    entity: "ANGULAR_LOCATION",
37643                });
37644            }
37645        }
37646        RepresentedDefinitionRef::CentreOfSymmetry(i) => {
37647            if i.0 >= model.centre_of_symmetry_arena.items.len() {
37648                return Err(AuthorError::DanglingRef {
37649                    entity: "CENTRE_OF_SYMMETRY",
37650                });
37651            }
37652        }
37653        RepresentedDefinitionRef::CommonDatum(i) => {
37654            if i.0 >= model.common_datum_arena.items.len() {
37655                return Err(AuthorError::DanglingRef {
37656                    entity: "COMMON_DATUM",
37657                });
37658            }
37659        }
37660        RepresentedDefinitionRef::CompositeGroupShapeAspect(i) => {
37661            if i.0 >= model.composite_group_shape_aspect_arena.items.len() {
37662                return Err(AuthorError::DanglingRef {
37663                    entity: "COMPOSITE_GROUP_SHAPE_ASPECT",
37664                });
37665            }
37666        }
37667        RepresentedDefinitionRef::CompositeShapeAspect(i) => {
37668            if i.0 >= model.composite_shape_aspect_arena.items.len() {
37669                return Err(AuthorError::DanglingRef {
37670                    entity: "COMPOSITE_SHAPE_ASPECT",
37671                });
37672            }
37673        }
37674        RepresentedDefinitionRef::ContinuousShapeAspect(i) => {
37675            if i.0 >= model.continuous_shape_aspect_arena.items.len() {
37676                return Err(AuthorError::DanglingRef {
37677                    entity: "CONTINUOUS_SHAPE_ASPECT",
37678                });
37679            }
37680        }
37681        RepresentedDefinitionRef::Datum(i) => {
37682            if i.0 >= model.datum_arena.items.len() {
37683                return Err(AuthorError::DanglingRef { entity: "DATUM" });
37684            }
37685        }
37686        RepresentedDefinitionRef::DatumFeature(i) => {
37687            if i.0 >= model.datum_feature_arena.items.len() {
37688                return Err(AuthorError::DanglingRef {
37689                    entity: "DATUM_FEATURE",
37690                });
37691            }
37692        }
37693        RepresentedDefinitionRef::DatumReferenceCompartment(i) => {
37694            if i.0 >= model.datum_reference_compartment_arena.items.len() {
37695                return Err(AuthorError::DanglingRef {
37696                    entity: "DATUM_REFERENCE_COMPARTMENT",
37697                });
37698            }
37699        }
37700        RepresentedDefinitionRef::DatumReferenceElement(i) => {
37701            if i.0 >= model.datum_reference_element_arena.items.len() {
37702                return Err(AuthorError::DanglingRef {
37703                    entity: "DATUM_REFERENCE_ELEMENT",
37704                });
37705            }
37706        }
37707        RepresentedDefinitionRef::DatumSystem(i) => {
37708            if i.0 >= model.datum_system_arena.items.len() {
37709                return Err(AuthorError::DanglingRef {
37710                    entity: "DATUM_SYSTEM",
37711                });
37712            }
37713        }
37714        RepresentedDefinitionRef::DatumTarget(i) => {
37715            if i.0 >= model.datum_target_arena.items.len() {
37716                return Err(AuthorError::DanglingRef {
37717                    entity: "DATUM_TARGET",
37718                });
37719            }
37720        }
37721        RepresentedDefinitionRef::DefaultModelGeometricView(i) => {
37722            if i.0 >= model.default_model_geometric_view_arena.items.len() {
37723                return Err(AuthorError::DanglingRef {
37724                    entity: "DEFAULT_MODEL_GEOMETRIC_VIEW",
37725                });
37726            }
37727        }
37728        RepresentedDefinitionRef::DerivedShapeAspect(i) => {
37729            if i.0 >= model.derived_shape_aspect_arena.items.len() {
37730                return Err(AuthorError::DanglingRef {
37731                    entity: "DERIVED_SHAPE_ASPECT",
37732                });
37733            }
37734        }
37735        RepresentedDefinitionRef::DimensionalLocation(i) => {
37736            if i.0 >= model.dimensional_location_arena.items.len() {
37737                return Err(AuthorError::DanglingRef {
37738                    entity: "DIMENSIONAL_LOCATION",
37739                });
37740            }
37741        }
37742        RepresentedDefinitionRef::DimensionalLocationWithPath(i) => {
37743            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
37744                return Err(AuthorError::DanglingRef {
37745                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
37746                });
37747            }
37748        }
37749        RepresentedDefinitionRef::DimensionalSizeWithDatumFeature(i) => {
37750            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
37751                return Err(AuthorError::DanglingRef {
37752                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
37753                });
37754            }
37755        }
37756        RepresentedDefinitionRef::DirectedDimensionalLocation(i) => {
37757            if i.0 >= model.directed_dimensional_location_arena.items.len() {
37758                return Err(AuthorError::DanglingRef {
37759                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
37760                });
37761            }
37762        }
37763        RepresentedDefinitionRef::FeatureForDatumTargetRelationship(i) => {
37764            if i.0
37765                >= model
37766                    .feature_for_datum_target_relationship_arena
37767                    .items
37768                    .len()
37769            {
37770                return Err(AuthorError::DanglingRef {
37771                    entity: "FEATURE_FOR_DATUM_TARGET_RELATIONSHIP",
37772                });
37773            }
37774        }
37775        RepresentedDefinitionRef::GeneralDatumReference(i) => {
37776            if i.0 >= model.general_datum_reference_arena.items.len() {
37777                return Err(AuthorError::DanglingRef {
37778                    entity: "GENERAL_DATUM_REFERENCE",
37779                });
37780            }
37781        }
37782        RepresentedDefinitionRef::GeneralProperty(i) => {
37783            if i.0 >= model.general_property_arena.items.len() {
37784                return Err(AuthorError::DanglingRef {
37785                    entity: "GENERAL_PROPERTY",
37786                });
37787            }
37788        }
37789        RepresentedDefinitionRef::PlacedDatumTargetFeature(i) => {
37790            if i.0 >= model.placed_datum_target_feature_arena.items.len() {
37791                return Err(AuthorError::DanglingRef {
37792                    entity: "PLACED_DATUM_TARGET_FEATURE",
37793                });
37794            }
37795        }
37796        RepresentedDefinitionRef::ProductDefinitionShape(i) => {
37797            if i.0 >= model.product_definition_shape_arena.items.len() {
37798                return Err(AuthorError::DanglingRef {
37799                    entity: "PRODUCT_DEFINITION_SHAPE",
37800                });
37801            }
37802        }
37803        RepresentedDefinitionRef::PropertyDefinition(i) => {
37804            if i.0 >= model.property_definition_arena.items.len() {
37805                return Err(AuthorError::DanglingRef {
37806                    entity: "PROPERTY_DEFINITION",
37807                });
37808            }
37809        }
37810        RepresentedDefinitionRef::PropertyDefinitionRelationship(i) => {
37811            if i.0 >= model.property_definition_relationship_arena.items.len() {
37812                return Err(AuthorError::DanglingRef {
37813                    entity: "PROPERTY_DEFINITION_RELATIONSHIP",
37814                });
37815            }
37816        }
37817        RepresentedDefinitionRef::ShapeAspect(i) => {
37818            if i.0 >= model.shape_aspect_arena.items.len() {
37819                return Err(AuthorError::DanglingRef {
37820                    entity: "SHAPE_ASPECT",
37821                });
37822            }
37823        }
37824        RepresentedDefinitionRef::ShapeAspectAssociativity(i) => {
37825            if i.0 >= model.shape_aspect_associativity_arena.items.len() {
37826                return Err(AuthorError::DanglingRef {
37827                    entity: "SHAPE_ASPECT_ASSOCIATIVITY",
37828                });
37829            }
37830        }
37831        RepresentedDefinitionRef::ShapeAspectDerivingRelationship(i) => {
37832            if i.0 >= model.shape_aspect_deriving_relationship_arena.items.len() {
37833                return Err(AuthorError::DanglingRef {
37834                    entity: "SHAPE_ASPECT_DERIVING_RELATIONSHIP",
37835                });
37836            }
37837        }
37838        RepresentedDefinitionRef::ShapeAspectRelationship(i) => {
37839            if i.0 >= model.shape_aspect_relationship_arena.items.len() {
37840                return Err(AuthorError::DanglingRef {
37841                    entity: "SHAPE_ASPECT_RELATIONSHIP",
37842                });
37843            }
37844        }
37845        RepresentedDefinitionRef::ToleranceZone(i) => {
37846            if i.0 >= model.tolerance_zone_arena.items.len() {
37847                return Err(AuthorError::DanglingRef {
37848                    entity: "TOLERANCE_ZONE",
37849                });
37850            }
37851        }
37852        RepresentedDefinitionRef::ToleranceZoneWithDatum(i) => {
37853            if i.0 >= model.tolerance_zone_with_datum_arena.items.len() {
37854                return Err(AuthorError::DanglingRef {
37855                    entity: "TOLERANCE_ZONE_WITH_DATUM",
37856                });
37857            }
37858        }
37859        RepresentedDefinitionRef::Complex(i) => {
37860            if i.0 >= model.complex_unit_arena.items.len() {
37861                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
37862            }
37863        }
37864    }
37865    Ok(())
37866}
37867fn check_resource_requirement_type_ref(
37868    model: &StepModel,
37869    r: &ResourceRequirementTypeRef,
37870) -> Result<(), AuthorError> {
37871    match r {
37872        ResourceRequirementTypeRef::ResourceRequirementType(i) => {
37873            if i.0 >= model.resource_requirement_type_arena.items.len() {
37874                return Err(AuthorError::DanglingRef {
37875                    entity: "RESOURCE_REQUIREMENT_TYPE",
37876                });
37877            }
37878        }
37879    }
37880    Ok(())
37881}
37882fn check_role_select_ref(model: &StepModel, r: &RoleSelectRef) -> Result<(), AuthorError> {
37883    match r {
37884        RoleSelectRef::ActionAssignment(i) => {
37885            if i.0 >= model.action_assignment_arena.items.len() {
37886                return Err(AuthorError::DanglingRef {
37887                    entity: "ACTION_ASSIGNMENT",
37888                });
37889            }
37890        }
37891        RoleSelectRef::ActionRequestAssignment(i) => {
37892            if i.0 >= model.action_request_assignment_arena.items.len() {
37893                return Err(AuthorError::DanglingRef {
37894                    entity: "ACTION_REQUEST_ASSIGNMENT",
37895                });
37896            }
37897        }
37898        RoleSelectRef::AppliedApprovalAssignment(i) => {
37899            if i.0 >= model.applied_approval_assignment_arena.items.len() {
37900                return Err(AuthorError::DanglingRef {
37901                    entity: "APPLIED_APPROVAL_ASSIGNMENT",
37902                });
37903            }
37904        }
37905        RoleSelectRef::AppliedDocumentReference(i) => {
37906            if i.0 >= model.applied_document_reference_arena.items.len() {
37907                return Err(AuthorError::DanglingRef {
37908                    entity: "APPLIED_DOCUMENT_REFERENCE",
37909                });
37910            }
37911        }
37912        RoleSelectRef::AppliedGroupAssignment(i) => {
37913            if i.0 >= model.applied_group_assignment_arena.items.len() {
37914                return Err(AuthorError::DanglingRef {
37915                    entity: "APPLIED_GROUP_ASSIGNMENT",
37916                });
37917            }
37918        }
37919        RoleSelectRef::AppliedSecurityClassificationAssignment(i) => {
37920            if i.0
37921                >= model
37922                    .applied_security_classification_assignment_arena
37923                    .items
37924                    .len()
37925            {
37926                return Err(AuthorError::DanglingRef {
37927                    entity: "APPLIED_SECURITY_CLASSIFICATION_ASSIGNMENT",
37928                });
37929            }
37930        }
37931        RoleSelectRef::ApprovalAssignment(i) => {
37932            if i.0 >= model.approval_assignment_arena.items.len() {
37933                return Err(AuthorError::DanglingRef {
37934                    entity: "APPROVAL_ASSIGNMENT",
37935                });
37936            }
37937        }
37938        RoleSelectRef::ApprovalDateTime(i) => {
37939            if i.0 >= model.approval_date_time_arena.items.len() {
37940                return Err(AuthorError::DanglingRef {
37941                    entity: "APPROVAL_DATE_TIME",
37942                });
37943            }
37944        }
37945        RoleSelectRef::CcDesignApproval(i) => {
37946            if i.0 >= model.cc_design_approval_arena.items.len() {
37947                return Err(AuthorError::DanglingRef {
37948                    entity: "CC_DESIGN_APPROVAL",
37949                });
37950            }
37951        }
37952        RoleSelectRef::CcDesignSecurityClassification(i) => {
37953            if i.0 >= model.cc_design_security_classification_arena.items.len() {
37954                return Err(AuthorError::DanglingRef {
37955                    entity: "CC_DESIGN_SECURITY_CLASSIFICATION",
37956                });
37957            }
37958        }
37959        RoleSelectRef::Change(i) => {
37960            if i.0 >= model.change_arena.items.len() {
37961                return Err(AuthorError::DanglingRef { entity: "CHANGE" });
37962            }
37963        }
37964        RoleSelectRef::ChangeRequest(i) => {
37965            if i.0 >= model.change_request_arena.items.len() {
37966                return Err(AuthorError::DanglingRef {
37967                    entity: "CHANGE_REQUEST",
37968                });
37969            }
37970        }
37971        RoleSelectRef::DocumentReference(i) => {
37972            if i.0 >= model.document_reference_arena.items.len() {
37973                return Err(AuthorError::DanglingRef {
37974                    entity: "DOCUMENT_REFERENCE",
37975                });
37976            }
37977        }
37978        RoleSelectRef::GroupAssignment(i) => {
37979            if i.0 >= model.group_assignment_arena.items.len() {
37980                return Err(AuthorError::DanglingRef {
37981                    entity: "GROUP_ASSIGNMENT",
37982                });
37983            }
37984        }
37985        RoleSelectRef::SecurityClassificationAssignment(i) => {
37986            if i.0 >= model.security_classification_assignment_arena.items.len() {
37987                return Err(AuthorError::DanglingRef {
37988                    entity: "SECURITY_CLASSIFICATION_ASSIGNMENT",
37989                });
37990            }
37991        }
37992        RoleSelectRef::StartRequest(i) => {
37993            if i.0 >= model.start_request_arena.items.len() {
37994                return Err(AuthorError::DanglingRef {
37995                    entity: "START_REQUEST",
37996                });
37997            }
37998        }
37999        RoleSelectRef::StartWork(i) => {
38000            if i.0 >= model.start_work_arena.items.len() {
38001                return Err(AuthorError::DanglingRef {
38002                    entity: "START_WORK",
38003                });
38004            }
38005        }
38006        RoleSelectRef::Complex(i) => {
38007            if i.0 >= model.complex_unit_arena.items.len() {
38008                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
38009            }
38010        }
38011    }
38012    Ok(())
38013}
38014fn check_security_classification_ref(
38015    model: &StepModel,
38016    r: &SecurityClassificationRef,
38017) -> Result<(), AuthorError> {
38018    match r {
38019        SecurityClassificationRef::SecurityClassification(i) => {
38020            if i.0 >= model.security_classification_arena.items.len() {
38021                return Err(AuthorError::DanglingRef {
38022                    entity: "SECURITY_CLASSIFICATION",
38023                });
38024            }
38025        }
38026    }
38027    Ok(())
38028}
38029fn check_security_classification_item_ref(
38030    model: &StepModel,
38031    r: &SecurityClassificationItemRef,
38032) -> Result<(), AuthorError> {
38033    match r {
38034        SecurityClassificationItemRef::Action(i) => {
38035            if i.0 >= model.action_arena.items.len() {
38036                return Err(AuthorError::DanglingRef { entity: "ACTION" });
38037            }
38038        }
38039        SecurityClassificationItemRef::ActionDirective(i) => {
38040            if i.0 >= model.action_directive_arena.items.len() {
38041                return Err(AuthorError::DanglingRef {
38042                    entity: "ACTION_DIRECTIVE",
38043                });
38044            }
38045        }
38046        SecurityClassificationItemRef::ActionMethod(i) => {
38047            if i.0 >= model.action_method_arena.items.len() {
38048                return Err(AuthorError::DanglingRef {
38049                    entity: "ACTION_METHOD",
38050                });
38051            }
38052        }
38053        SecurityClassificationItemRef::ActionMethodRelationship(i) => {
38054            if i.0 >= model.action_method_relationship_arena.items.len() {
38055                return Err(AuthorError::DanglingRef {
38056                    entity: "ACTION_METHOD_RELATIONSHIP",
38057                });
38058            }
38059        }
38060        SecurityClassificationItemRef::ActionProperty(i) => {
38061            if i.0 >= model.action_property_arena.items.len() {
38062                return Err(AuthorError::DanglingRef {
38063                    entity: "ACTION_PROPERTY",
38064                });
38065            }
38066        }
38067        SecurityClassificationItemRef::AdvancedBrepShapeRepresentation(i) => {
38068            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
38069                return Err(AuthorError::DanglingRef {
38070                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
38071                });
38072            }
38073        }
38074        SecurityClassificationItemRef::AppliedDocumentReference(i) => {
38075            if i.0 >= model.applied_document_reference_arena.items.len() {
38076                return Err(AuthorError::DanglingRef {
38077                    entity: "APPLIED_DOCUMENT_REFERENCE",
38078                });
38079            }
38080        }
38081        SecurityClassificationItemRef::AppliedExternalIdentificationAssignment(i) => {
38082            if i.0
38083                >= model
38084                    .applied_external_identification_assignment_arena
38085                    .items
38086                    .len()
38087            {
38088                return Err(AuthorError::DanglingRef {
38089                    entity: "APPLIED_EXTERNAL_IDENTIFICATION_ASSIGNMENT",
38090                });
38091            }
38092        }
38093        SecurityClassificationItemRef::AssemblyComponentUsage(i) => {
38094            if i.0 >= model.assembly_component_usage_arena.items.len() {
38095                return Err(AuthorError::DanglingRef {
38096                    entity: "ASSEMBLY_COMPONENT_USAGE",
38097                });
38098            }
38099        }
38100        SecurityClassificationItemRef::CharacterizedRepresentation(i) => {
38101            if i.0 >= model.characterized_representation_arena.items.len() {
38102                return Err(AuthorError::DanglingRef {
38103                    entity: "CHARACTERIZED_REPRESENTATION",
38104                });
38105            }
38106        }
38107        SecurityClassificationItemRef::ConfigurationDesign(i) => {
38108            if i.0 >= model.configuration_design_arena.items.len() {
38109                return Err(AuthorError::DanglingRef {
38110                    entity: "CONFIGURATION_DESIGN",
38111                });
38112            }
38113        }
38114        SecurityClassificationItemRef::ConfigurationEffectivity(i) => {
38115            if i.0 >= model.configuration_effectivity_arena.items.len() {
38116                return Err(AuthorError::DanglingRef {
38117                    entity: "CONFIGURATION_EFFECTIVITY",
38118                });
38119            }
38120        }
38121        SecurityClassificationItemRef::ConstructiveGeometryRepresentation(i) => {
38122            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
38123                return Err(AuthorError::DanglingRef {
38124                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
38125                });
38126            }
38127        }
38128        SecurityClassificationItemRef::DefinitionalRepresentation(i) => {
38129            if i.0 >= model.definitional_representation_arena.items.len() {
38130                return Err(AuthorError::DanglingRef {
38131                    entity: "DEFINITIONAL_REPRESENTATION",
38132                });
38133            }
38134        }
38135        SecurityClassificationItemRef::Document(i) => {
38136            if i.0 >= model.document_arena.items.len() {
38137                return Err(AuthorError::DanglingRef { entity: "DOCUMENT" });
38138            }
38139        }
38140        SecurityClassificationItemRef::DocumentFile(i) => {
38141            if i.0 >= model.document_file_arena.items.len() {
38142                return Err(AuthorError::DanglingRef {
38143                    entity: "DOCUMENT_FILE",
38144                });
38145            }
38146        }
38147        SecurityClassificationItemRef::DraughtingModel(i) => {
38148            if i.0 >= model.draughting_model_arena.items.len() {
38149                return Err(AuthorError::DanglingRef {
38150                    entity: "DRAUGHTING_MODEL",
38151                });
38152            }
38153        }
38154        SecurityClassificationItemRef::GeneralProperty(i) => {
38155            if i.0 >= model.general_property_arena.items.len() {
38156                return Err(AuthorError::DanglingRef {
38157                    entity: "GENERAL_PROPERTY",
38158                });
38159            }
38160        }
38161        SecurityClassificationItemRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
38162            if i.0
38163                >= model
38164                    .geometrically_bounded_surface_shape_representation_arena
38165                    .items
38166                    .len()
38167            {
38168                return Err(AuthorError::DanglingRef {
38169                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
38170                });
38171            }
38172        }
38173        SecurityClassificationItemRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
38174            if i.0
38175                >= model
38176                    .geometrically_bounded_wireframe_shape_representation_arena
38177                    .items
38178                    .len()
38179            {
38180                return Err(AuthorError::DanglingRef {
38181                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
38182                });
38183            }
38184        }
38185        SecurityClassificationItemRef::Group(i) => {
38186            if i.0 >= model.group_arena.items.len() {
38187                return Err(AuthorError::DanglingRef { entity: "GROUP" });
38188            }
38189        }
38190        SecurityClassificationItemRef::MakeFromUsageOption(i) => {
38191            if i.0 >= model.make_from_usage_option_arena.items.len() {
38192                return Err(AuthorError::DanglingRef {
38193                    entity: "MAKE_FROM_USAGE_OPTION",
38194                });
38195            }
38196        }
38197        SecurityClassificationItemRef::ManifoldSurfaceShapeRepresentation(i) => {
38198            if i.0
38199                >= model
38200                    .manifold_surface_shape_representation_arena
38201                    .items
38202                    .len()
38203            {
38204                return Err(AuthorError::DanglingRef {
38205                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
38206                });
38207            }
38208        }
38209        SecurityClassificationItemRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
38210            if i.0
38211                >= model
38212                    .mechanical_design_geometric_presentation_representation_arena
38213                    .items
38214                    .len()
38215            {
38216                return Err(AuthorError::DanglingRef {
38217                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
38218                });
38219            }
38220        }
38221        SecurityClassificationItemRef::MechanicalDesignPresentationRepresentationWithDraughting(
38222            i,
38223        ) => {
38224            if i.0
38225                >= model
38226                    .mechanical_design_presentation_representation_with_draughting_arena
38227                    .items
38228                    .len()
38229            {
38230                return Err(AuthorError::DanglingRef {
38231                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
38232                });
38233            }
38234        }
38235        SecurityClassificationItemRef::MechanicalDesignShadedPresentationRepresentation(i) => {
38236            if i.0
38237                >= model
38238                    .mechanical_design_shaded_presentation_representation_arena
38239                    .items
38240                    .len()
38241            {
38242                return Err(AuthorError::DanglingRef {
38243                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
38244                });
38245            }
38246        }
38247        SecurityClassificationItemRef::NextAssemblyUsageOccurrence(i) => {
38248            if i.0 >= model.next_assembly_usage_occurrence_arena.items.len() {
38249                return Err(AuthorError::DanglingRef {
38250                    entity: "NEXT_ASSEMBLY_USAGE_OCCURRENCE",
38251                });
38252            }
38253        }
38254        SecurityClassificationItemRef::OrganizationalProject(i) => {
38255            if i.0 >= model.organizational_project_arena.items.len() {
38256                return Err(AuthorError::DanglingRef {
38257                    entity: "ORGANIZATIONAL_PROJECT",
38258                });
38259            }
38260        }
38261        SecurityClassificationItemRef::PresentationArea(i) => {
38262            if i.0 >= model.presentation_area_arena.items.len() {
38263                return Err(AuthorError::DanglingRef {
38264                    entity: "PRESENTATION_AREA",
38265                });
38266            }
38267        }
38268        SecurityClassificationItemRef::PresentationRepresentation(i) => {
38269            if i.0 >= model.presentation_representation_arena.items.len() {
38270                return Err(AuthorError::DanglingRef {
38271                    entity: "PRESENTATION_REPRESENTATION",
38272                });
38273            }
38274        }
38275        SecurityClassificationItemRef::PresentationView(i) => {
38276            if i.0 >= model.presentation_view_arena.items.len() {
38277                return Err(AuthorError::DanglingRef {
38278                    entity: "PRESENTATION_VIEW",
38279                });
38280            }
38281        }
38282        SecurityClassificationItemRef::Product(i) => {
38283            if i.0 >= model.product_arena.items.len() {
38284                return Err(AuthorError::DanglingRef { entity: "PRODUCT" });
38285            }
38286        }
38287        SecurityClassificationItemRef::ProductConcept(i) => {
38288            if i.0 >= model.product_concept_arena.items.len() {
38289                return Err(AuthorError::DanglingRef {
38290                    entity: "PRODUCT_CONCEPT",
38291                });
38292            }
38293        }
38294        SecurityClassificationItemRef::ProductConceptFeature(i) => {
38295            if i.0 >= model.product_concept_feature_arena.items.len() {
38296                return Err(AuthorError::DanglingRef {
38297                    entity: "PRODUCT_CONCEPT_FEATURE",
38298                });
38299            }
38300        }
38301        SecurityClassificationItemRef::ProductConceptFeatureCategory(i) => {
38302            if i.0 >= model.product_concept_feature_category_arena.items.len() {
38303                return Err(AuthorError::DanglingRef {
38304                    entity: "PRODUCT_CONCEPT_FEATURE_CATEGORY",
38305                });
38306            }
38307        }
38308        SecurityClassificationItemRef::ProductDefinition(i) => {
38309            if i.0 >= model.product_definition_arena.items.len() {
38310                return Err(AuthorError::DanglingRef {
38311                    entity: "PRODUCT_DEFINITION",
38312                });
38313            }
38314        }
38315        SecurityClassificationItemRef::ProductDefinitionFormation(i) => {
38316            if i.0 >= model.product_definition_formation_arena.items.len() {
38317                return Err(AuthorError::DanglingRef {
38318                    entity: "PRODUCT_DEFINITION_FORMATION",
38319                });
38320            }
38321        }
38322        SecurityClassificationItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
38323            if i.0
38324                >= model
38325                    .product_definition_formation_with_specified_source_arena
38326                    .items
38327                    .len()
38328            {
38329                return Err(AuthorError::DanglingRef {
38330                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
38331                });
38332            }
38333        }
38334        SecurityClassificationItemRef::ProductDefinitionRelationship(i) => {
38335            if i.0 >= model.product_definition_relationship_arena.items.len() {
38336                return Err(AuthorError::DanglingRef {
38337                    entity: "PRODUCT_DEFINITION_RELATIONSHIP",
38338                });
38339            }
38340        }
38341        SecurityClassificationItemRef::ProductDefinitionShape(i) => {
38342            if i.0 >= model.product_definition_shape_arena.items.len() {
38343                return Err(AuthorError::DanglingRef {
38344                    entity: "PRODUCT_DEFINITION_SHAPE",
38345                });
38346            }
38347        }
38348        SecurityClassificationItemRef::ProductDefinitionUsage(i) => {
38349            if i.0 >= model.product_definition_usage_arena.items.len() {
38350                return Err(AuthorError::DanglingRef {
38351                    entity: "PRODUCT_DEFINITION_USAGE",
38352                });
38353            }
38354        }
38355        SecurityClassificationItemRef::ProductDefinitionWithAssociatedDocuments(i) => {
38356            if i.0
38357                >= model
38358                    .product_definition_with_associated_documents_arena
38359                    .items
38360                    .len()
38361            {
38362                return Err(AuthorError::DanglingRef {
38363                    entity: "PRODUCT_DEFINITION_WITH_ASSOCIATED_DOCUMENTS",
38364                });
38365            }
38366        }
38367        SecurityClassificationItemRef::PropertyDefinition(i) => {
38368            if i.0 >= model.property_definition_arena.items.len() {
38369                return Err(AuthorError::DanglingRef {
38370                    entity: "PROPERTY_DEFINITION",
38371                });
38372            }
38373        }
38374        SecurityClassificationItemRef::PropertyDefinitionRepresentation(i) => {
38375            if i.0 >= model.property_definition_representation_arena.items.len() {
38376                return Err(AuthorError::DanglingRef {
38377                    entity: "PROPERTY_DEFINITION_REPRESENTATION",
38378                });
38379            }
38380        }
38381        SecurityClassificationItemRef::Representation(i) => {
38382            if i.0 >= model.representation_arena.items.len() {
38383                return Err(AuthorError::DanglingRef {
38384                    entity: "REPRESENTATION",
38385                });
38386            }
38387        }
38388        SecurityClassificationItemRef::ResourceProperty(i) => {
38389            if i.0 >= model.resource_property_arena.items.len() {
38390                return Err(AuthorError::DanglingRef {
38391                    entity: "RESOURCE_PROPERTY",
38392                });
38393            }
38394        }
38395        SecurityClassificationItemRef::ShapeDefinitionRepresentation(i) => {
38396            if i.0 >= model.shape_definition_representation_arena.items.len() {
38397                return Err(AuthorError::DanglingRef {
38398                    entity: "SHAPE_DEFINITION_REPRESENTATION",
38399                });
38400            }
38401        }
38402        SecurityClassificationItemRef::ShapeDimensionRepresentation(i) => {
38403            if i.0 >= model.shape_dimension_representation_arena.items.len() {
38404                return Err(AuthorError::DanglingRef {
38405                    entity: "SHAPE_DIMENSION_REPRESENTATION",
38406                });
38407            }
38408        }
38409        SecurityClassificationItemRef::ShapeRepresentation(i) => {
38410            if i.0 >= model.shape_representation_arena.items.len() {
38411                return Err(AuthorError::DanglingRef {
38412                    entity: "SHAPE_REPRESENTATION",
38413                });
38414            }
38415        }
38416        SecurityClassificationItemRef::ShapeRepresentationWithParameters(i) => {
38417            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
38418                return Err(AuthorError::DanglingRef {
38419                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
38420                });
38421            }
38422        }
38423        SecurityClassificationItemRef::SymbolRepresentation(i) => {
38424            if i.0 >= model.symbol_representation_arena.items.len() {
38425                return Err(AuthorError::DanglingRef {
38426                    entity: "SYMBOL_REPRESENTATION",
38427                });
38428            }
38429        }
38430        SecurityClassificationItemRef::TessellatedShapeRepresentation(i) => {
38431            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
38432                return Err(AuthorError::DanglingRef {
38433                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
38434                });
38435            }
38436        }
38437        SecurityClassificationItemRef::VersionedActionRequest(i) => {
38438            if i.0 >= model.versioned_action_request_arena.items.len() {
38439                return Err(AuthorError::DanglingRef {
38440                    entity: "VERSIONED_ACTION_REQUEST",
38441                });
38442            }
38443        }
38444        SecurityClassificationItemRef::Complex(i) => {
38445            if i.0 >= model.complex_unit_arena.items.len() {
38446                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
38447            }
38448        }
38449    }
38450    Ok(())
38451}
38452fn check_security_classification_level_ref(
38453    model: &StepModel,
38454    r: &SecurityClassificationLevelRef,
38455) -> Result<(), AuthorError> {
38456    match r {
38457        SecurityClassificationLevelRef::SecurityClassificationLevel(i) => {
38458            if i.0 >= model.security_classification_level_arena.items.len() {
38459                return Err(AuthorError::DanglingRef {
38460                    entity: "SECURITY_CLASSIFICATION_LEVEL",
38461                });
38462            }
38463        }
38464    }
38465    Ok(())
38466}
38467fn check_shape_aspect_ref(model: &StepModel, r: &ShapeAspectRef) -> Result<(), AuthorError> {
38468    match r {
38469        ShapeAspectRef::AllAroundShapeAspect(i) => {
38470            if i.0 >= model.all_around_shape_aspect_arena.items.len() {
38471                return Err(AuthorError::DanglingRef {
38472                    entity: "ALL_AROUND_SHAPE_ASPECT",
38473                });
38474            }
38475        }
38476        ShapeAspectRef::CentreOfSymmetry(i) => {
38477            if i.0 >= model.centre_of_symmetry_arena.items.len() {
38478                return Err(AuthorError::DanglingRef {
38479                    entity: "CENTRE_OF_SYMMETRY",
38480                });
38481            }
38482        }
38483        ShapeAspectRef::CommonDatum(i) => {
38484            if i.0 >= model.common_datum_arena.items.len() {
38485                return Err(AuthorError::DanglingRef {
38486                    entity: "COMMON_DATUM",
38487                });
38488            }
38489        }
38490        ShapeAspectRef::CompositeGroupShapeAspect(i) => {
38491            if i.0 >= model.composite_group_shape_aspect_arena.items.len() {
38492                return Err(AuthorError::DanglingRef {
38493                    entity: "COMPOSITE_GROUP_SHAPE_ASPECT",
38494                });
38495            }
38496        }
38497        ShapeAspectRef::CompositeShapeAspect(i) => {
38498            if i.0 >= model.composite_shape_aspect_arena.items.len() {
38499                return Err(AuthorError::DanglingRef {
38500                    entity: "COMPOSITE_SHAPE_ASPECT",
38501                });
38502            }
38503        }
38504        ShapeAspectRef::ContinuousShapeAspect(i) => {
38505            if i.0 >= model.continuous_shape_aspect_arena.items.len() {
38506                return Err(AuthorError::DanglingRef {
38507                    entity: "CONTINUOUS_SHAPE_ASPECT",
38508                });
38509            }
38510        }
38511        ShapeAspectRef::Datum(i) => {
38512            if i.0 >= model.datum_arena.items.len() {
38513                return Err(AuthorError::DanglingRef { entity: "DATUM" });
38514            }
38515        }
38516        ShapeAspectRef::DatumFeature(i) => {
38517            if i.0 >= model.datum_feature_arena.items.len() {
38518                return Err(AuthorError::DanglingRef {
38519                    entity: "DATUM_FEATURE",
38520                });
38521            }
38522        }
38523        ShapeAspectRef::DatumReferenceCompartment(i) => {
38524            if i.0 >= model.datum_reference_compartment_arena.items.len() {
38525                return Err(AuthorError::DanglingRef {
38526                    entity: "DATUM_REFERENCE_COMPARTMENT",
38527                });
38528            }
38529        }
38530        ShapeAspectRef::DatumReferenceElement(i) => {
38531            if i.0 >= model.datum_reference_element_arena.items.len() {
38532                return Err(AuthorError::DanglingRef {
38533                    entity: "DATUM_REFERENCE_ELEMENT",
38534                });
38535            }
38536        }
38537        ShapeAspectRef::DatumSystem(i) => {
38538            if i.0 >= model.datum_system_arena.items.len() {
38539                return Err(AuthorError::DanglingRef {
38540                    entity: "DATUM_SYSTEM",
38541                });
38542            }
38543        }
38544        ShapeAspectRef::DatumTarget(i) => {
38545            if i.0 >= model.datum_target_arena.items.len() {
38546                return Err(AuthorError::DanglingRef {
38547                    entity: "DATUM_TARGET",
38548                });
38549            }
38550        }
38551        ShapeAspectRef::DefaultModelGeometricView(i) => {
38552            if i.0 >= model.default_model_geometric_view_arena.items.len() {
38553                return Err(AuthorError::DanglingRef {
38554                    entity: "DEFAULT_MODEL_GEOMETRIC_VIEW",
38555                });
38556            }
38557        }
38558        ShapeAspectRef::DerivedShapeAspect(i) => {
38559            if i.0 >= model.derived_shape_aspect_arena.items.len() {
38560                return Err(AuthorError::DanglingRef {
38561                    entity: "DERIVED_SHAPE_ASPECT",
38562                });
38563            }
38564        }
38565        ShapeAspectRef::DimensionalSizeWithDatumFeature(i) => {
38566            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
38567                return Err(AuthorError::DanglingRef {
38568                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
38569                });
38570            }
38571        }
38572        ShapeAspectRef::GeneralDatumReference(i) => {
38573            if i.0 >= model.general_datum_reference_arena.items.len() {
38574                return Err(AuthorError::DanglingRef {
38575                    entity: "GENERAL_DATUM_REFERENCE",
38576                });
38577            }
38578        }
38579        ShapeAspectRef::PlacedDatumTargetFeature(i) => {
38580            if i.0 >= model.placed_datum_target_feature_arena.items.len() {
38581                return Err(AuthorError::DanglingRef {
38582                    entity: "PLACED_DATUM_TARGET_FEATURE",
38583                });
38584            }
38585        }
38586        ShapeAspectRef::ShapeAspect(i) => {
38587            if i.0 >= model.shape_aspect_arena.items.len() {
38588                return Err(AuthorError::DanglingRef {
38589                    entity: "SHAPE_ASPECT",
38590                });
38591            }
38592        }
38593        ShapeAspectRef::ToleranceZone(i) => {
38594            if i.0 >= model.tolerance_zone_arena.items.len() {
38595                return Err(AuthorError::DanglingRef {
38596                    entity: "TOLERANCE_ZONE",
38597                });
38598            }
38599        }
38600        ShapeAspectRef::ToleranceZoneWithDatum(i) => {
38601            if i.0 >= model.tolerance_zone_with_datum_arena.items.len() {
38602                return Err(AuthorError::DanglingRef {
38603                    entity: "TOLERANCE_ZONE_WITH_DATUM",
38604                });
38605            }
38606        }
38607        ShapeAspectRef::Complex(i) => {
38608            if i.0 >= model.complex_unit_arena.items.len() {
38609                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
38610            }
38611        }
38612    }
38613    Ok(())
38614}
38615fn check_shape_dimension_representation_ref(
38616    model: &StepModel,
38617    r: &ShapeDimensionRepresentationRef,
38618) -> Result<(), AuthorError> {
38619    match r {
38620        ShapeDimensionRepresentationRef::ShapeDimensionRepresentation(i) => {
38621            if i.0 >= model.shape_dimension_representation_arena.items.len() {
38622                return Err(AuthorError::DanglingRef {
38623                    entity: "SHAPE_DIMENSION_REPRESENTATION",
38624                });
38625            }
38626        }
38627        ShapeDimensionRepresentationRef::Complex(i) => {
38628            if i.0 >= model.complex_unit_arena.items.len() {
38629                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
38630            }
38631        }
38632    }
38633    Ok(())
38634}
38635fn check_shape_model_ref(model: &StepModel, r: &ShapeModelRef) -> Result<(), AuthorError> {
38636    match r {
38637        ShapeModelRef::AdvancedBrepShapeRepresentation(i) => {
38638            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
38639                return Err(AuthorError::DanglingRef {
38640                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
38641                });
38642            }
38643        }
38644        ShapeModelRef::ConstructiveGeometryRepresentation(i) => {
38645            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
38646                return Err(AuthorError::DanglingRef {
38647                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
38648                });
38649            }
38650        }
38651        ShapeModelRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
38652            if i.0
38653                >= model
38654                    .geometrically_bounded_surface_shape_representation_arena
38655                    .items
38656                    .len()
38657            {
38658                return Err(AuthorError::DanglingRef {
38659                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
38660                });
38661            }
38662        }
38663        ShapeModelRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
38664            if i.0
38665                >= model
38666                    .geometrically_bounded_wireframe_shape_representation_arena
38667                    .items
38668                    .len()
38669            {
38670                return Err(AuthorError::DanglingRef {
38671                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
38672                });
38673            }
38674        }
38675        ShapeModelRef::ManifoldSurfaceShapeRepresentation(i) => {
38676            if i.0
38677                >= model
38678                    .manifold_surface_shape_representation_arena
38679                    .items
38680                    .len()
38681            {
38682                return Err(AuthorError::DanglingRef {
38683                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
38684                });
38685            }
38686        }
38687        ShapeModelRef::ShapeDimensionRepresentation(i) => {
38688            if i.0 >= model.shape_dimension_representation_arena.items.len() {
38689                return Err(AuthorError::DanglingRef {
38690                    entity: "SHAPE_DIMENSION_REPRESENTATION",
38691                });
38692            }
38693        }
38694        ShapeModelRef::ShapeRepresentation(i) => {
38695            if i.0 >= model.shape_representation_arena.items.len() {
38696                return Err(AuthorError::DanglingRef {
38697                    entity: "SHAPE_REPRESENTATION",
38698                });
38699            }
38700        }
38701        ShapeModelRef::ShapeRepresentationWithParameters(i) => {
38702            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
38703                return Err(AuthorError::DanglingRef {
38704                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
38705                });
38706            }
38707        }
38708        ShapeModelRef::TessellatedShapeRepresentation(i) => {
38709            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
38710                return Err(AuthorError::DanglingRef {
38711                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
38712                });
38713            }
38714        }
38715        ShapeModelRef::Complex(i) => {
38716            if i.0 >= model.complex_unit_arena.items.len() {
38717                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
38718            }
38719        }
38720    }
38721    Ok(())
38722}
38723fn check_shape_representation_relationship_ref(
38724    model: &StepModel,
38725    r: &ShapeRepresentationRelationshipRef,
38726) -> Result<(), AuthorError> {
38727    match r {
38728        ShapeRepresentationRelationshipRef::ShapeRepresentationRelationship(i) => {
38729            if i.0 >= model.shape_representation_relationship_arena.items.len() {
38730                return Err(AuthorError::DanglingRef {
38731                    entity: "SHAPE_REPRESENTATION_RELATIONSHIP",
38732                });
38733            }
38734        }
38735        ShapeRepresentationRelationshipRef::Complex(i) => {
38736            if i.0 >= model.complex_unit_arena.items.len() {
38737                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
38738            }
38739        }
38740    }
38741    Ok(())
38742}
38743fn check_shell_ref(model: &StepModel, r: &ShellRef) -> Result<(), AuthorError> {
38744    match r {
38745        ShellRef::ClosedShell(i) => {
38746            if i.0 >= model.closed_shell_arena.items.len() {
38747                return Err(AuthorError::DanglingRef {
38748                    entity: "CLOSED_SHELL",
38749                });
38750            }
38751        }
38752        ShellRef::OpenShell(i) => {
38753            if i.0 >= model.open_shell_arena.items.len() {
38754                return Err(AuthorError::DanglingRef {
38755                    entity: "OPEN_SHELL",
38756                });
38757            }
38758        }
38759        ShellRef::OrientedClosedShell(i) => {
38760            if i.0 >= model.oriented_closed_shell_arena.items.len() {
38761                return Err(AuthorError::DanglingRef {
38762                    entity: "ORIENTED_CLOSED_SHELL",
38763                });
38764            }
38765        }
38766        ShellRef::VertexShell(i) => {
38767            if i.0 >= model.vertex_shell_arena.items.len() {
38768                return Err(AuthorError::DanglingRef {
38769                    entity: "VERTEX_SHELL",
38770                });
38771            }
38772        }
38773        ShellRef::WireShell(i) => {
38774            if i.0 >= model.wire_shell_arena.items.len() {
38775                return Err(AuthorError::DanglingRef {
38776                    entity: "WIRE_SHELL",
38777                });
38778            }
38779        }
38780        ShellRef::Complex(i) => {
38781            if i.0 >= model.complex_unit_arena.items.len() {
38782                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
38783            }
38784        }
38785    }
38786    Ok(())
38787}
38788fn check_size_select_ref(model: &StepModel, r: &SizeSelectRef) -> Result<(), AuthorError> {
38789    match r {
38790        SizeSelectRef::LengthMeasureWithUnit(i) => {
38791            if i.0 >= model.length_measure_with_unit_arena.items.len() {
38792                return Err(AuthorError::DanglingRef {
38793                    entity: "LENGTH_MEASURE_WITH_UNIT",
38794                });
38795            }
38796        }
38797        SizeSelectRef::MassMeasureWithUnit(i) => {
38798            if i.0 >= model.mass_measure_with_unit_arena.items.len() {
38799                return Err(AuthorError::DanglingRef {
38800                    entity: "MASS_MEASURE_WITH_UNIT",
38801                });
38802            }
38803        }
38804        SizeSelectRef::MeasureRepresentationItem(i) => {
38805            if i.0 >= model.measure_representation_item_arena.items.len() {
38806                return Err(AuthorError::DanglingRef {
38807                    entity: "MEASURE_REPRESENTATION_ITEM",
38808                });
38809            }
38810        }
38811        SizeSelectRef::MeasureWithUnit(i) => {
38812            if i.0 >= model.measure_with_unit_arena.items.len() {
38813                return Err(AuthorError::DanglingRef {
38814                    entity: "MEASURE_WITH_UNIT",
38815                });
38816            }
38817        }
38818        SizeSelectRef::PlaneAngleMeasureWithUnit(i) => {
38819            if i.0 >= model.plane_angle_measure_with_unit_arena.items.len() {
38820                return Err(AuthorError::DanglingRef {
38821                    entity: "PLANE_ANGLE_MEASURE_WITH_UNIT",
38822                });
38823            }
38824        }
38825        SizeSelectRef::RatioMeasureWithUnit(i) => {
38826            if i.0 >= model.ratio_measure_with_unit_arena.items.len() {
38827                return Err(AuthorError::DanglingRef {
38828                    entity: "RATIO_MEASURE_WITH_UNIT",
38829                });
38830            }
38831        }
38832        SizeSelectRef::UncertaintyMeasureWithUnit(i) => {
38833            if i.0 >= model.uncertainty_measure_with_unit_arena.items.len() {
38834                return Err(AuthorError::DanglingRef {
38835                    entity: "UNCERTAINTY_MEASURE_WITH_UNIT",
38836                });
38837            }
38838        }
38839        SizeSelectRef::DescriptiveMeasure(_) => {}
38840        SizeSelectRef::PositiveLengthMeasure(_) => {}
38841        SizeSelectRef::Complex(i) => {
38842            if i.0 >= model.complex_unit_arena.items.len() {
38843                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
38844            }
38845        }
38846    }
38847    Ok(())
38848}
38849fn check_start_request_item_ref(
38850    model: &StepModel,
38851    r: &StartRequestItemRef,
38852) -> Result<(), AuthorError> {
38853    match r {
38854        StartRequestItemRef::ProductDefinitionFormation(i) => {
38855            if i.0 >= model.product_definition_formation_arena.items.len() {
38856                return Err(AuthorError::DanglingRef {
38857                    entity: "PRODUCT_DEFINITION_FORMATION",
38858                });
38859            }
38860        }
38861        StartRequestItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
38862            if i.0
38863                >= model
38864                    .product_definition_formation_with_specified_source_arena
38865                    .items
38866                    .len()
38867            {
38868                return Err(AuthorError::DanglingRef {
38869                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
38870                });
38871            }
38872        }
38873        StartRequestItemRef::Complex(i) => {
38874            if i.0 >= model.complex_unit_arena.items.len() {
38875                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
38876            }
38877        }
38878    }
38879    Ok(())
38880}
38881fn check_state_observed_ref(model: &StepModel, r: &StateObservedRef) -> Result<(), AuthorError> {
38882    match r {
38883        StateObservedRef::StateObserved(i) => {
38884            if i.0 >= model.state_observed_arena.items.len() {
38885                return Err(AuthorError::DanglingRef {
38886                    entity: "STATE_OBSERVED",
38887                });
38888            }
38889        }
38890        StateObservedRef::Complex(i) => {
38891            if i.0 >= model.complex_unit_arena.items.len() {
38892                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
38893            }
38894        }
38895    }
38896    Ok(())
38897}
38898fn check_state_type_ref(model: &StepModel, r: &StateTypeRef) -> Result<(), AuthorError> {
38899    match r {
38900        StateTypeRef::StateType(i) => {
38901            if i.0 >= model.state_type_arena.items.len() {
38902                return Err(AuthorError::DanglingRef {
38903                    entity: "STATE_TYPE",
38904                });
38905            }
38906        }
38907        StateTypeRef::Complex(i) => {
38908            if i.0 >= model.complex_unit_arena.items.len() {
38909                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
38910            }
38911        }
38912    }
38913    Ok(())
38914}
38915fn check_style_context_select_ref(
38916    model: &StepModel,
38917    r: &StyleContextSelectRef,
38918) -> Result<(), AuthorError> {
38919    match r {
38920        StyleContextSelectRef::AdvancedBrepShapeRepresentation(i) => {
38921            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
38922                return Err(AuthorError::DanglingRef {
38923                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
38924                });
38925            }
38926        }
38927        StyleContextSelectRef::AdvancedFace(i) => {
38928            if i.0 >= model.advanced_face_arena.items.len() {
38929                return Err(AuthorError::DanglingRef {
38930                    entity: "ADVANCED_FACE",
38931                });
38932            }
38933        }
38934        StyleContextSelectRef::AnnotationCurveOccurrence(i) => {
38935            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
38936                return Err(AuthorError::DanglingRef {
38937                    entity: "ANNOTATION_CURVE_OCCURRENCE",
38938                });
38939            }
38940        }
38941        StyleContextSelectRef::AnnotationFillAreaOccurrence(i) => {
38942            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
38943                return Err(AuthorError::DanglingRef {
38944                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
38945                });
38946            }
38947        }
38948        StyleContextSelectRef::AnnotationOccurrence(i) => {
38949            if i.0 >= model.annotation_occurrence_arena.items.len() {
38950                return Err(AuthorError::DanglingRef {
38951                    entity: "ANNOTATION_OCCURRENCE",
38952                });
38953            }
38954        }
38955        StyleContextSelectRef::AnnotationPlaceholderLeaderLine(_) => {
38956            return Err(AuthorError::NotAp242 {
38957                entity: "ANNOTATION_PLACEHOLDER_LEADER_LINE",
38958            });
38959        }
38960        StyleContextSelectRef::AnnotationPlaceholderOccurrence(i) => {
38961            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
38962                return Err(AuthorError::DanglingRef {
38963                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
38964                });
38965            }
38966        }
38967        StyleContextSelectRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
38968            return Err(AuthorError::NotAp242 {
38969                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
38970            });
38971        }
38972        StyleContextSelectRef::AnnotationPlane(i) => {
38973            if i.0 >= model.annotation_plane_arena.items.len() {
38974                return Err(AuthorError::DanglingRef {
38975                    entity: "ANNOTATION_PLANE",
38976                });
38977            }
38978        }
38979        StyleContextSelectRef::AnnotationSymbol(i) => {
38980            if i.0 >= model.annotation_symbol_arena.items.len() {
38981                return Err(AuthorError::DanglingRef {
38982                    entity: "ANNOTATION_SYMBOL",
38983                });
38984            }
38985        }
38986        StyleContextSelectRef::AnnotationSymbolOccurrence(i) => {
38987            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
38988                return Err(AuthorError::DanglingRef {
38989                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
38990                });
38991            }
38992        }
38993        StyleContextSelectRef::AnnotationText(i) => {
38994            if i.0 >= model.annotation_text_arena.items.len() {
38995                return Err(AuthorError::DanglingRef {
38996                    entity: "ANNOTATION_TEXT",
38997                });
38998            }
38999        }
39000        StyleContextSelectRef::AnnotationTextCharacter(i) => {
39001            if i.0 >= model.annotation_text_character_arena.items.len() {
39002                return Err(AuthorError::DanglingRef {
39003                    entity: "ANNOTATION_TEXT_CHARACTER",
39004                });
39005            }
39006        }
39007        StyleContextSelectRef::AnnotationTextOccurrence(i) => {
39008            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
39009                return Err(AuthorError::DanglingRef {
39010                    entity: "ANNOTATION_TEXT_OCCURRENCE",
39011                });
39012            }
39013        }
39014        StyleContextSelectRef::AnnotationToAnnotationLeaderLine(_) => {
39015            return Err(AuthorError::NotAp242 {
39016                entity: "ANNOTATION_TO_ANNOTATION_LEADER_LINE",
39017            });
39018        }
39019        StyleContextSelectRef::AnnotationToModelLeaderLine(_) => {
39020            return Err(AuthorError::NotAp242 {
39021                entity: "ANNOTATION_TO_MODEL_LEADER_LINE",
39022            });
39023        }
39024        StyleContextSelectRef::ApllPoint(_) => {
39025            return Err(AuthorError::NotAp242 {
39026                entity: "APLL_POINT",
39027            });
39028        }
39029        StyleContextSelectRef::ApllPointWithSurface(_) => {
39030            return Err(AuthorError::NotAp242 {
39031                entity: "APLL_POINT_WITH_SURFACE",
39032            });
39033        }
39034        StyleContextSelectRef::AuxiliaryLeaderLine(_) => {
39035            return Err(AuthorError::NotAp242 {
39036                entity: "AUXILIARY_LEADER_LINE",
39037            });
39038        }
39039        StyleContextSelectRef::Axis1Placement(i) => {
39040            if i.0 >= model.axis1_placement_arena.items.len() {
39041                return Err(AuthorError::DanglingRef {
39042                    entity: "AXIS1_PLACEMENT",
39043                });
39044            }
39045        }
39046        StyleContextSelectRef::Axis2Placement2d(i) => {
39047            if i.0 >= model.axis2_placement2d_arena.items.len() {
39048                return Err(AuthorError::DanglingRef {
39049                    entity: "AXIS2_PLACEMENT_2D",
39050                });
39051            }
39052        }
39053        StyleContextSelectRef::Axis2Placement3d(i) => {
39054            if i.0 >= model.axis2_placement3d_arena.items.len() {
39055                return Err(AuthorError::DanglingRef {
39056                    entity: "AXIS2_PLACEMENT_3D",
39057                });
39058            }
39059        }
39060        StyleContextSelectRef::BSplineCurve(i) => {
39061            if i.0 >= model.b_spline_curve_arena.items.len() {
39062                return Err(AuthorError::DanglingRef {
39063                    entity: "B_SPLINE_CURVE",
39064                });
39065            }
39066        }
39067        StyleContextSelectRef::BSplineCurveWithKnots(i) => {
39068            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
39069                return Err(AuthorError::DanglingRef {
39070                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
39071                });
39072            }
39073        }
39074        StyleContextSelectRef::BSplineSurface(i) => {
39075            if i.0 >= model.b_spline_surface_arena.items.len() {
39076                return Err(AuthorError::DanglingRef {
39077                    entity: "B_SPLINE_SURFACE",
39078                });
39079            }
39080        }
39081        StyleContextSelectRef::BSplineSurfaceWithKnots(i) => {
39082            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
39083                return Err(AuthorError::DanglingRef {
39084                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
39085                });
39086            }
39087        }
39088        StyleContextSelectRef::BezierCurve(i) => {
39089            if i.0 >= model.bezier_curve_arena.items.len() {
39090                return Err(AuthorError::DanglingRef {
39091                    entity: "BEZIER_CURVE",
39092                });
39093            }
39094        }
39095        StyleContextSelectRef::BezierSurface(i) => {
39096            if i.0 >= model.bezier_surface_arena.items.len() {
39097                return Err(AuthorError::DanglingRef {
39098                    entity: "BEZIER_SURFACE",
39099                });
39100            }
39101        }
39102        StyleContextSelectRef::BoundedCurve(i) => {
39103            if i.0 >= model.bounded_curve_arena.items.len() {
39104                return Err(AuthorError::DanglingRef {
39105                    entity: "BOUNDED_CURVE",
39106                });
39107            }
39108        }
39109        StyleContextSelectRef::BoundedPcurve(i) => {
39110            if i.0 >= model.bounded_pcurve_arena.items.len() {
39111                return Err(AuthorError::DanglingRef {
39112                    entity: "BOUNDED_PCURVE",
39113                });
39114            }
39115        }
39116        StyleContextSelectRef::BoundedSurface(i) => {
39117            if i.0 >= model.bounded_surface_arena.items.len() {
39118                return Err(AuthorError::DanglingRef {
39119                    entity: "BOUNDED_SURFACE",
39120                });
39121            }
39122        }
39123        StyleContextSelectRef::BoundedSurfaceCurve(i) => {
39124            if i.0 >= model.bounded_surface_curve_arena.items.len() {
39125                return Err(AuthorError::DanglingRef {
39126                    entity: "BOUNDED_SURFACE_CURVE",
39127                });
39128            }
39129        }
39130        StyleContextSelectRef::BrepWithVoids(i) => {
39131            if i.0 >= model.brep_with_voids_arena.items.len() {
39132                return Err(AuthorError::DanglingRef {
39133                    entity: "BREP_WITH_VOIDS",
39134                });
39135            }
39136        }
39137        StyleContextSelectRef::CameraImage(i) => {
39138            if i.0 >= model.camera_image_arena.items.len() {
39139                return Err(AuthorError::DanglingRef {
39140                    entity: "CAMERA_IMAGE",
39141                });
39142            }
39143        }
39144        StyleContextSelectRef::CameraImage3dWithScale(i) => {
39145            if i.0 >= model.camera_image3d_with_scale_arena.items.len() {
39146                return Err(AuthorError::DanglingRef {
39147                    entity: "CAMERA_IMAGE_3D_WITH_SCALE",
39148                });
39149            }
39150        }
39151        StyleContextSelectRef::CameraModel(i) => {
39152            if i.0 >= model.camera_model_arena.items.len() {
39153                return Err(AuthorError::DanglingRef {
39154                    entity: "CAMERA_MODEL",
39155                });
39156            }
39157        }
39158        StyleContextSelectRef::CameraModelD3(i) => {
39159            if i.0 >= model.camera_model_d3_arena.items.len() {
39160                return Err(AuthorError::DanglingRef {
39161                    entity: "CAMERA_MODEL_D3",
39162                });
39163            }
39164        }
39165        StyleContextSelectRef::CameraModelD3MultiClipping(i) => {
39166            if i.0 >= model.camera_model_d3_multi_clipping_arena.items.len() {
39167                return Err(AuthorError::DanglingRef {
39168                    entity: "CAMERA_MODEL_D3_MULTI_CLIPPING",
39169                });
39170            }
39171        }
39172        StyleContextSelectRef::CameraModelD3WithHlhsr(i) => {
39173            if i.0 >= model.camera_model_d3_with_hlhsr_arena.items.len() {
39174                return Err(AuthorError::DanglingRef {
39175                    entity: "CAMERA_MODEL_D3_WITH_HLHSR",
39176                });
39177            }
39178        }
39179        StyleContextSelectRef::CartesianPoint(i) => {
39180            if i.0 >= model.cartesian_point_arena.items.len() {
39181                return Err(AuthorError::DanglingRef {
39182                    entity: "CARTESIAN_POINT",
39183                });
39184            }
39185        }
39186        StyleContextSelectRef::CharacterizedRepresentation(i) => {
39187            if i.0 >= model.characterized_representation_arena.items.len() {
39188                return Err(AuthorError::DanglingRef {
39189                    entity: "CHARACTERIZED_REPRESENTATION",
39190                });
39191            }
39192        }
39193        StyleContextSelectRef::Circle(i) => {
39194            if i.0 >= model.circle_arena.items.len() {
39195                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
39196            }
39197        }
39198        StyleContextSelectRef::ClosedShell(i) => {
39199            if i.0 >= model.closed_shell_arena.items.len() {
39200                return Err(AuthorError::DanglingRef {
39201                    entity: "CLOSED_SHELL",
39202                });
39203            }
39204        }
39205        StyleContextSelectRef::ComplexTriangulatedFace(i) => {
39206            if i.0 >= model.complex_triangulated_face_arena.items.len() {
39207                return Err(AuthorError::DanglingRef {
39208                    entity: "COMPLEX_TRIANGULATED_FACE",
39209                });
39210            }
39211        }
39212        StyleContextSelectRef::ComplexTriangulatedSurfaceSet(i) => {
39213            if i.0 >= model.complex_triangulated_surface_set_arena.items.len() {
39214                return Err(AuthorError::DanglingRef {
39215                    entity: "COMPLEX_TRIANGULATED_SURFACE_SET",
39216                });
39217            }
39218        }
39219        StyleContextSelectRef::CompositeCurve(i) => {
39220            if i.0 >= model.composite_curve_arena.items.len() {
39221                return Err(AuthorError::DanglingRef {
39222                    entity: "COMPOSITE_CURVE",
39223                });
39224            }
39225        }
39226        StyleContextSelectRef::CompositeText(i) => {
39227            if i.0 >= model.composite_text_arena.items.len() {
39228                return Err(AuthorError::DanglingRef {
39229                    entity: "COMPOSITE_TEXT",
39230                });
39231            }
39232        }
39233        StyleContextSelectRef::CompoundRepresentationItem(i) => {
39234            if i.0 >= model.compound_representation_item_arena.items.len() {
39235                return Err(AuthorError::DanglingRef {
39236                    entity: "COMPOUND_REPRESENTATION_ITEM",
39237                });
39238            }
39239        }
39240        StyleContextSelectRef::Conic(i) => {
39241            if i.0 >= model.conic_arena.items.len() {
39242                return Err(AuthorError::DanglingRef { entity: "CONIC" });
39243            }
39244        }
39245        StyleContextSelectRef::ConicalSurface(i) => {
39246            if i.0 >= model.conical_surface_arena.items.len() {
39247                return Err(AuthorError::DanglingRef {
39248                    entity: "CONICAL_SURFACE",
39249                });
39250            }
39251        }
39252        StyleContextSelectRef::ConnectedFaceSet(i) => {
39253            if i.0 >= model.connected_face_set_arena.items.len() {
39254                return Err(AuthorError::DanglingRef {
39255                    entity: "CONNECTED_FACE_SET",
39256                });
39257            }
39258        }
39259        StyleContextSelectRef::ConstructiveGeometryRepresentation(i) => {
39260            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
39261                return Err(AuthorError::DanglingRef {
39262                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
39263                });
39264            }
39265        }
39266        StyleContextSelectRef::ConstructiveGeometryRepresentationRelationship(i) => {
39267            if i.0
39268                >= model
39269                    .constructive_geometry_representation_relationship_arena
39270                    .items
39271                    .len()
39272            {
39273                return Err(AuthorError::DanglingRef {
39274                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION_RELATIONSHIP",
39275                });
39276            }
39277        }
39278        StyleContextSelectRef::ContextDependentOverRidingStyledItem(i) => {
39279            if i.0
39280                >= model
39281                    .context_dependent_over_riding_styled_item_arena
39282                    .items
39283                    .len()
39284            {
39285                return Err(AuthorError::DanglingRef {
39286                    entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
39287                });
39288            }
39289        }
39290        StyleContextSelectRef::ContextDependentShapeRepresentation(i) => {
39291            if i.0
39292                >= model
39293                    .context_dependent_shape_representation_arena
39294                    .items
39295                    .len()
39296            {
39297                return Err(AuthorError::DanglingRef {
39298                    entity: "CONTEXT_DEPENDENT_SHAPE_REPRESENTATION",
39299                });
39300            }
39301        }
39302        StyleContextSelectRef::CoordinatesList(i) => {
39303            if i.0 >= model.coordinates_list_arena.items.len() {
39304                return Err(AuthorError::DanglingRef {
39305                    entity: "COORDINATES_LIST",
39306                });
39307            }
39308        }
39309        StyleContextSelectRef::Curve(i) => {
39310            if i.0 >= model.curve_arena.items.len() {
39311                return Err(AuthorError::DanglingRef { entity: "CURVE" });
39312            }
39313        }
39314        StyleContextSelectRef::CylindricalSurface(i) => {
39315            if i.0 >= model.cylindrical_surface_arena.items.len() {
39316                return Err(AuthorError::DanglingRef {
39317                    entity: "CYLINDRICAL_SURFACE",
39318                });
39319            }
39320        }
39321        StyleContextSelectRef::DefinedCharacterGlyph(i) => {
39322            if i.0 >= model.defined_character_glyph_arena.items.len() {
39323                return Err(AuthorError::DanglingRef {
39324                    entity: "DEFINED_CHARACTER_GLYPH",
39325                });
39326            }
39327        }
39328        StyleContextSelectRef::DefinedSymbol(i) => {
39329            if i.0 >= model.defined_symbol_arena.items.len() {
39330                return Err(AuthorError::DanglingRef {
39331                    entity: "DEFINED_SYMBOL",
39332                });
39333            }
39334        }
39335        StyleContextSelectRef::DefinitionalRepresentation(i) => {
39336            if i.0 >= model.definitional_representation_arena.items.len() {
39337                return Err(AuthorError::DanglingRef {
39338                    entity: "DEFINITIONAL_REPRESENTATION",
39339                });
39340            }
39341        }
39342        StyleContextSelectRef::DefinitionalRepresentationRelationship(i) => {
39343            if i.0
39344                >= model
39345                    .definitional_representation_relationship_arena
39346                    .items
39347                    .len()
39348            {
39349                return Err(AuthorError::DanglingRef {
39350                    entity: "DEFINITIONAL_REPRESENTATION_RELATIONSHIP",
39351                });
39352            }
39353        }
39354        StyleContextSelectRef::DefinitionalRepresentationRelationshipWithSameContext(i) => {
39355            if i.0
39356                >= model
39357                    .definitional_representation_relationship_with_same_context_arena
39358                    .items
39359                    .len()
39360            {
39361                return Err(AuthorError::DanglingRef {
39362                    entity: "DEFINITIONAL_REPRESENTATION_RELATIONSHIP_WITH_SAME_CONTEXT",
39363                });
39364            }
39365        }
39366        StyleContextSelectRef::DegenerateToroidalSurface(i) => {
39367            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
39368                return Err(AuthorError::DanglingRef {
39369                    entity: "DEGENERATE_TOROIDAL_SURFACE",
39370                });
39371            }
39372        }
39373        StyleContextSelectRef::DescriptiveRepresentationItem(i) => {
39374            if i.0 >= model.descriptive_representation_item_arena.items.len() {
39375                return Err(AuthorError::DanglingRef {
39376                    entity: "DESCRIPTIVE_REPRESENTATION_ITEM",
39377                });
39378            }
39379        }
39380        StyleContextSelectRef::Direction(i) => {
39381            if i.0 >= model.direction_arena.items.len() {
39382                return Err(AuthorError::DanglingRef {
39383                    entity: "DIRECTION",
39384                });
39385            }
39386        }
39387        StyleContextSelectRef::DraughtingAnnotationOccurrence(i) => {
39388            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
39389                return Err(AuthorError::DanglingRef {
39390                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
39391                });
39392            }
39393        }
39394        StyleContextSelectRef::DraughtingCallout(i) => {
39395            if i.0 >= model.draughting_callout_arena.items.len() {
39396                return Err(AuthorError::DanglingRef {
39397                    entity: "DRAUGHTING_CALLOUT",
39398                });
39399            }
39400        }
39401        StyleContextSelectRef::DraughtingModel(i) => {
39402            if i.0 >= model.draughting_model_arena.items.len() {
39403                return Err(AuthorError::DanglingRef {
39404                    entity: "DRAUGHTING_MODEL",
39405                });
39406            }
39407        }
39408        StyleContextSelectRef::Edge(i) => {
39409            if i.0 >= model.edge_arena.items.len() {
39410                return Err(AuthorError::DanglingRef { entity: "EDGE" });
39411            }
39412        }
39413        StyleContextSelectRef::EdgeCurve(i) => {
39414            if i.0 >= model.edge_curve_arena.items.len() {
39415                return Err(AuthorError::DanglingRef {
39416                    entity: "EDGE_CURVE",
39417                });
39418            }
39419        }
39420        StyleContextSelectRef::EdgeLoop(i) => {
39421            if i.0 >= model.edge_loop_arena.items.len() {
39422                return Err(AuthorError::DanglingRef {
39423                    entity: "EDGE_LOOP",
39424                });
39425            }
39426        }
39427        StyleContextSelectRef::ElementarySurface(i) => {
39428            if i.0 >= model.elementary_surface_arena.items.len() {
39429                return Err(AuthorError::DanglingRef {
39430                    entity: "ELEMENTARY_SURFACE",
39431                });
39432            }
39433        }
39434        StyleContextSelectRef::Ellipse(i) => {
39435            if i.0 >= model.ellipse_arena.items.len() {
39436                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
39437            }
39438        }
39439        StyleContextSelectRef::ExternallyDefinedHatchStyle(i) => {
39440            if i.0 >= model.externally_defined_hatch_style_arena.items.len() {
39441                return Err(AuthorError::DanglingRef {
39442                    entity: "EXTERNALLY_DEFINED_HATCH_STYLE",
39443                });
39444            }
39445        }
39446        StyleContextSelectRef::ExternallyDefinedTileStyle(i) => {
39447            if i.0 >= model.externally_defined_tile_style_arena.items.len() {
39448                return Err(AuthorError::DanglingRef {
39449                    entity: "EXTERNALLY_DEFINED_TILE_STYLE",
39450                });
39451            }
39452        }
39453        StyleContextSelectRef::Face(i) => {
39454            if i.0 >= model.face_arena.items.len() {
39455                return Err(AuthorError::DanglingRef { entity: "FACE" });
39456            }
39457        }
39458        StyleContextSelectRef::FaceBound(i) => {
39459            if i.0 >= model.face_bound_arena.items.len() {
39460                return Err(AuthorError::DanglingRef {
39461                    entity: "FACE_BOUND",
39462                });
39463            }
39464        }
39465        StyleContextSelectRef::FaceOuterBound(i) => {
39466            if i.0 >= model.face_outer_bound_arena.items.len() {
39467                return Err(AuthorError::DanglingRef {
39468                    entity: "FACE_OUTER_BOUND",
39469                });
39470            }
39471        }
39472        StyleContextSelectRef::FaceSurface(i) => {
39473            if i.0 >= model.face_surface_arena.items.len() {
39474                return Err(AuthorError::DanglingRef {
39475                    entity: "FACE_SURFACE",
39476                });
39477            }
39478        }
39479        StyleContextSelectRef::FillAreaStyleHatching(i) => {
39480            if i.0 >= model.fill_area_style_hatching_arena.items.len() {
39481                return Err(AuthorError::DanglingRef {
39482                    entity: "FILL_AREA_STYLE_HATCHING",
39483                });
39484            }
39485        }
39486        StyleContextSelectRef::FillAreaStyleTileColouredRegion(i) => {
39487            if i.0 >= model.fill_area_style_tile_coloured_region_arena.items.len() {
39488                return Err(AuthorError::DanglingRef {
39489                    entity: "FILL_AREA_STYLE_TILE_COLOURED_REGION",
39490                });
39491            }
39492        }
39493        StyleContextSelectRef::FillAreaStyleTileCurveWithStyle(i) => {
39494            if i.0
39495                >= model
39496                    .fill_area_style_tile_curve_with_style_arena
39497                    .items
39498                    .len()
39499            {
39500                return Err(AuthorError::DanglingRef {
39501                    entity: "FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE",
39502                });
39503            }
39504        }
39505        StyleContextSelectRef::FillAreaStyleTileSymbolWithStyle(i) => {
39506            if i.0
39507                >= model
39508                    .fill_area_style_tile_symbol_with_style_arena
39509                    .items
39510                    .len()
39511            {
39512                return Err(AuthorError::DanglingRef {
39513                    entity: "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE",
39514                });
39515            }
39516        }
39517        StyleContextSelectRef::FillAreaStyleTiles(i) => {
39518            if i.0 >= model.fill_area_style_tiles_arena.items.len() {
39519                return Err(AuthorError::DanglingRef {
39520                    entity: "FILL_AREA_STYLE_TILES",
39521                });
39522            }
39523        }
39524        StyleContextSelectRef::GeometricCurveSet(i) => {
39525            if i.0 >= model.geometric_curve_set_arena.items.len() {
39526                return Err(AuthorError::DanglingRef {
39527                    entity: "GEOMETRIC_CURVE_SET",
39528                });
39529            }
39530        }
39531        StyleContextSelectRef::GeometricRepresentationItem(i) => {
39532            if i.0 >= model.geometric_representation_item_arena.items.len() {
39533                return Err(AuthorError::DanglingRef {
39534                    entity: "GEOMETRIC_REPRESENTATION_ITEM",
39535                });
39536            }
39537        }
39538        StyleContextSelectRef::GeometricSet(i) => {
39539            if i.0 >= model.geometric_set_arena.items.len() {
39540                return Err(AuthorError::DanglingRef {
39541                    entity: "GEOMETRIC_SET",
39542                });
39543            }
39544        }
39545        StyleContextSelectRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
39546            if i.0
39547                >= model
39548                    .geometrically_bounded_surface_shape_representation_arena
39549                    .items
39550                    .len()
39551            {
39552                return Err(AuthorError::DanglingRef {
39553                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
39554                });
39555            }
39556        }
39557        StyleContextSelectRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
39558            if i.0
39559                >= model
39560                    .geometrically_bounded_wireframe_shape_representation_arena
39561                    .items
39562                    .len()
39563            {
39564                return Err(AuthorError::DanglingRef {
39565                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
39566                });
39567            }
39568        }
39569        StyleContextSelectRef::Group(i) => {
39570            if i.0 >= model.group_arena.items.len() {
39571                return Err(AuthorError::DanglingRef { entity: "GROUP" });
39572            }
39573        }
39574        StyleContextSelectRef::Hyperbola(i) => {
39575            if i.0 >= model.hyperbola_arena.items.len() {
39576                return Err(AuthorError::DanglingRef {
39577                    entity: "HYPERBOLA",
39578                });
39579            }
39580        }
39581        StyleContextSelectRef::IntegerRepresentationItem(i) => {
39582            if i.0 >= model.integer_representation_item_arena.items.len() {
39583                return Err(AuthorError::DanglingRef {
39584                    entity: "INTEGER_REPRESENTATION_ITEM",
39585                });
39586            }
39587        }
39588        StyleContextSelectRef::IntersectionCurve(i) => {
39589            if i.0 >= model.intersection_curve_arena.items.len() {
39590                return Err(AuthorError::DanglingRef {
39591                    entity: "INTERSECTION_CURVE",
39592                });
39593            }
39594        }
39595        StyleContextSelectRef::LeaderCurve(i) => {
39596            if i.0 >= model.leader_curve_arena.items.len() {
39597                return Err(AuthorError::DanglingRef {
39598                    entity: "LEADER_CURVE",
39599                });
39600            }
39601        }
39602        StyleContextSelectRef::LeaderDirectedCallout(i) => {
39603            if i.0 >= model.leader_directed_callout_arena.items.len() {
39604                return Err(AuthorError::DanglingRef {
39605                    entity: "LEADER_DIRECTED_CALLOUT",
39606                });
39607            }
39608        }
39609        StyleContextSelectRef::LeaderTerminator(i) => {
39610            if i.0 >= model.leader_terminator_arena.items.len() {
39611                return Err(AuthorError::DanglingRef {
39612                    entity: "LEADER_TERMINATOR",
39613                });
39614            }
39615        }
39616        StyleContextSelectRef::Line(i) => {
39617            if i.0 >= model.line_arena.items.len() {
39618                return Err(AuthorError::DanglingRef { entity: "LINE" });
39619            }
39620        }
39621        StyleContextSelectRef::Loop(i) => {
39622            if i.0 >= model.loop_arena.items.len() {
39623                return Err(AuthorError::DanglingRef { entity: "LOOP" });
39624            }
39625        }
39626        StyleContextSelectRef::ManifoldSolidBrep(i) => {
39627            if i.0 >= model.manifold_solid_brep_arena.items.len() {
39628                return Err(AuthorError::DanglingRef {
39629                    entity: "MANIFOLD_SOLID_BREP",
39630                });
39631            }
39632        }
39633        StyleContextSelectRef::ManifoldSurfaceShapeRepresentation(i) => {
39634            if i.0
39635                >= model
39636                    .manifold_surface_shape_representation_arena
39637                    .items
39638                    .len()
39639            {
39640                return Err(AuthorError::DanglingRef {
39641                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
39642                });
39643            }
39644        }
39645        StyleContextSelectRef::MappedItem(i) => {
39646            if i.0 >= model.mapped_item_arena.items.len() {
39647                return Err(AuthorError::DanglingRef {
39648                    entity: "MAPPED_ITEM",
39649                });
39650            }
39651        }
39652        StyleContextSelectRef::MeasureRepresentationItem(i) => {
39653            if i.0 >= model.measure_representation_item_arena.items.len() {
39654                return Err(AuthorError::DanglingRef {
39655                    entity: "MEASURE_REPRESENTATION_ITEM",
39656                });
39657            }
39658        }
39659        StyleContextSelectRef::MechanicalDesignAndDraughtingRelationship(i) => {
39660            if i.0
39661                >= model
39662                    .mechanical_design_and_draughting_relationship_arena
39663                    .items
39664                    .len()
39665            {
39666                return Err(AuthorError::DanglingRef {
39667                    entity: "MECHANICAL_DESIGN_AND_DRAUGHTING_RELATIONSHIP",
39668                });
39669            }
39670        }
39671        StyleContextSelectRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
39672            if i.0
39673                >= model
39674                    .mechanical_design_geometric_presentation_representation_arena
39675                    .items
39676                    .len()
39677            {
39678                return Err(AuthorError::DanglingRef {
39679                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
39680                });
39681            }
39682        }
39683        StyleContextSelectRef::MechanicalDesignPresentationRepresentationWithDraughting(i) => {
39684            if i.0
39685                >= model
39686                    .mechanical_design_presentation_representation_with_draughting_arena
39687                    .items
39688                    .len()
39689            {
39690                return Err(AuthorError::DanglingRef {
39691                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
39692                });
39693            }
39694        }
39695        StyleContextSelectRef::MechanicalDesignShadedPresentationRepresentation(i) => {
39696            if i.0
39697                >= model
39698                    .mechanical_design_shaded_presentation_representation_arena
39699                    .items
39700                    .len()
39701            {
39702                return Err(AuthorError::DanglingRef {
39703                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
39704                });
39705            }
39706        }
39707        StyleContextSelectRef::OffsetSurface(i) => {
39708            if i.0 >= model.offset_surface_arena.items.len() {
39709                return Err(AuthorError::DanglingRef {
39710                    entity: "OFFSET_SURFACE",
39711                });
39712            }
39713        }
39714        StyleContextSelectRef::OneDirectionRepeatFactor(i) => {
39715            if i.0 >= model.one_direction_repeat_factor_arena.items.len() {
39716                return Err(AuthorError::DanglingRef {
39717                    entity: "ONE_DIRECTION_REPEAT_FACTOR",
39718                });
39719            }
39720        }
39721        StyleContextSelectRef::OpenShell(i) => {
39722            if i.0 >= model.open_shell_arena.items.len() {
39723                return Err(AuthorError::DanglingRef {
39724                    entity: "OPEN_SHELL",
39725                });
39726            }
39727        }
39728        StyleContextSelectRef::OrientedClosedShell(i) => {
39729            if i.0 >= model.oriented_closed_shell_arena.items.len() {
39730                return Err(AuthorError::DanglingRef {
39731                    entity: "ORIENTED_CLOSED_SHELL",
39732                });
39733            }
39734        }
39735        StyleContextSelectRef::OrientedEdge(i) => {
39736            if i.0 >= model.oriented_edge_arena.items.len() {
39737                return Err(AuthorError::DanglingRef {
39738                    entity: "ORIENTED_EDGE",
39739                });
39740            }
39741        }
39742        StyleContextSelectRef::OverRidingStyledItem(i) => {
39743            if i.0 >= model.over_riding_styled_item_arena.items.len() {
39744                return Err(AuthorError::DanglingRef {
39745                    entity: "OVER_RIDING_STYLED_ITEM",
39746                });
39747            }
39748        }
39749        StyleContextSelectRef::Path(i) => {
39750            if i.0 >= model.path_arena.items.len() {
39751                return Err(AuthorError::DanglingRef { entity: "PATH" });
39752            }
39753        }
39754        StyleContextSelectRef::Pcurve(i) => {
39755            if i.0 >= model.pcurve_arena.items.len() {
39756                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
39757            }
39758        }
39759        StyleContextSelectRef::Placement(i) => {
39760            if i.0 >= model.placement_arena.items.len() {
39761                return Err(AuthorError::DanglingRef {
39762                    entity: "PLACEMENT",
39763                });
39764            }
39765        }
39766        StyleContextSelectRef::PlanarBox(i) => {
39767            if i.0 >= model.planar_box_arena.items.len() {
39768                return Err(AuthorError::DanglingRef {
39769                    entity: "PLANAR_BOX",
39770                });
39771            }
39772        }
39773        StyleContextSelectRef::PlanarExtent(i) => {
39774            if i.0 >= model.planar_extent_arena.items.len() {
39775                return Err(AuthorError::DanglingRef {
39776                    entity: "PLANAR_EXTENT",
39777                });
39778            }
39779        }
39780        StyleContextSelectRef::Plane(i) => {
39781            if i.0 >= model.plane_arena.items.len() {
39782                return Err(AuthorError::DanglingRef { entity: "PLANE" });
39783            }
39784        }
39785        StyleContextSelectRef::Point(i) => {
39786            if i.0 >= model.point_arena.items.len() {
39787                return Err(AuthorError::DanglingRef { entity: "POINT" });
39788            }
39789        }
39790        StyleContextSelectRef::PolyLoop(i) => {
39791            if i.0 >= model.poly_loop_arena.items.len() {
39792                return Err(AuthorError::DanglingRef {
39793                    entity: "POLY_LOOP",
39794                });
39795            }
39796        }
39797        StyleContextSelectRef::Polyline(i) => {
39798            if i.0 >= model.polyline_arena.items.len() {
39799                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
39800            }
39801        }
39802        StyleContextSelectRef::PresentationArea(i) => {
39803            if i.0 >= model.presentation_area_arena.items.len() {
39804                return Err(AuthorError::DanglingRef {
39805                    entity: "PRESENTATION_AREA",
39806                });
39807            }
39808        }
39809        StyleContextSelectRef::PresentationLayerAssignment(i) => {
39810            if i.0 >= model.presentation_layer_assignment_arena.items.len() {
39811                return Err(AuthorError::DanglingRef {
39812                    entity: "PRESENTATION_LAYER_ASSIGNMENT",
39813                });
39814            }
39815        }
39816        StyleContextSelectRef::PresentationRepresentation(i) => {
39817            if i.0 >= model.presentation_representation_arena.items.len() {
39818                return Err(AuthorError::DanglingRef {
39819                    entity: "PRESENTATION_REPRESENTATION",
39820                });
39821            }
39822        }
39823        StyleContextSelectRef::PresentationSet(i) => {
39824            if i.0 >= model.presentation_set_arena.items.len() {
39825                return Err(AuthorError::DanglingRef {
39826                    entity: "PRESENTATION_SET",
39827                });
39828            }
39829        }
39830        StyleContextSelectRef::PresentationView(i) => {
39831            if i.0 >= model.presentation_view_arena.items.len() {
39832                return Err(AuthorError::DanglingRef {
39833                    entity: "PRESENTATION_VIEW",
39834                });
39835            }
39836        }
39837        StyleContextSelectRef::ProductConceptFeatureCategory(i) => {
39838            if i.0 >= model.product_concept_feature_category_arena.items.len() {
39839                return Err(AuthorError::DanglingRef {
39840                    entity: "PRODUCT_CONCEPT_FEATURE_CATEGORY",
39841                });
39842            }
39843        }
39844        StyleContextSelectRef::QualifiedRepresentationItem(i) => {
39845            if i.0 >= model.qualified_representation_item_arena.items.len() {
39846                return Err(AuthorError::DanglingRef {
39847                    entity: "QUALIFIED_REPRESENTATION_ITEM",
39848                });
39849            }
39850        }
39851        StyleContextSelectRef::QuasiUniformCurve(i) => {
39852            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
39853                return Err(AuthorError::DanglingRef {
39854                    entity: "QUASI_UNIFORM_CURVE",
39855                });
39856            }
39857        }
39858        StyleContextSelectRef::QuasiUniformSurface(i) => {
39859            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
39860                return Err(AuthorError::DanglingRef {
39861                    entity: "QUASI_UNIFORM_SURFACE",
39862                });
39863            }
39864        }
39865        StyleContextSelectRef::RationalBSplineCurve(i) => {
39866            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
39867                return Err(AuthorError::DanglingRef {
39868                    entity: "RATIONAL_B_SPLINE_CURVE",
39869                });
39870            }
39871        }
39872        StyleContextSelectRef::RationalBSplineSurface(i) => {
39873            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
39874                return Err(AuthorError::DanglingRef {
39875                    entity: "RATIONAL_B_SPLINE_SURFACE",
39876                });
39877            }
39878        }
39879        StyleContextSelectRef::RealRepresentationItem(i) => {
39880            if i.0 >= model.real_representation_item_arena.items.len() {
39881                return Err(AuthorError::DanglingRef {
39882                    entity: "REAL_REPRESENTATION_ITEM",
39883                });
39884            }
39885        }
39886        StyleContextSelectRef::RepositionedTessellatedItem(i) => {
39887            if i.0 >= model.repositioned_tessellated_item_arena.items.len() {
39888                return Err(AuthorError::DanglingRef {
39889                    entity: "REPOSITIONED_TESSELLATED_ITEM",
39890                });
39891            }
39892        }
39893        StyleContextSelectRef::Representation(i) => {
39894            if i.0 >= model.representation_arena.items.len() {
39895                return Err(AuthorError::DanglingRef {
39896                    entity: "REPRESENTATION",
39897                });
39898            }
39899        }
39900        StyleContextSelectRef::RepresentationItem(i) => {
39901            if i.0 >= model.representation_item_arena.items.len() {
39902                return Err(AuthorError::DanglingRef {
39903                    entity: "REPRESENTATION_ITEM",
39904                });
39905            }
39906        }
39907        StyleContextSelectRef::RepresentationRelationship(i) => {
39908            if i.0 >= model.representation_relationship_arena.items.len() {
39909                return Err(AuthorError::DanglingRef {
39910                    entity: "REPRESENTATION_RELATIONSHIP",
39911                });
39912            }
39913        }
39914        StyleContextSelectRef::RepresentationRelationshipWithTransformation(i) => {
39915            if i.0
39916                >= model
39917                    .representation_relationship_with_transformation_arena
39918                    .items
39919                    .len()
39920            {
39921                return Err(AuthorError::DanglingRef {
39922                    entity: "REPRESENTATION_RELATIONSHIP_WITH_TRANSFORMATION",
39923                });
39924            }
39925        }
39926        StyleContextSelectRef::SeamCurve(i) => {
39927            if i.0 >= model.seam_curve_arena.items.len() {
39928                return Err(AuthorError::DanglingRef {
39929                    entity: "SEAM_CURVE",
39930                });
39931            }
39932        }
39933        StyleContextSelectRef::ShapeDimensionRepresentation(i) => {
39934            if i.0 >= model.shape_dimension_representation_arena.items.len() {
39935                return Err(AuthorError::DanglingRef {
39936                    entity: "SHAPE_DIMENSION_REPRESENTATION",
39937                });
39938            }
39939        }
39940        StyleContextSelectRef::ShapeRepresentation(i) => {
39941            if i.0 >= model.shape_representation_arena.items.len() {
39942                return Err(AuthorError::DanglingRef {
39943                    entity: "SHAPE_REPRESENTATION",
39944                });
39945            }
39946        }
39947        StyleContextSelectRef::ShapeRepresentationRelationship(i) => {
39948            if i.0 >= model.shape_representation_relationship_arena.items.len() {
39949                return Err(AuthorError::DanglingRef {
39950                    entity: "SHAPE_REPRESENTATION_RELATIONSHIP",
39951                });
39952            }
39953        }
39954        StyleContextSelectRef::ShapeRepresentationWithParameters(i) => {
39955            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
39956                return Err(AuthorError::DanglingRef {
39957                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
39958                });
39959            }
39960        }
39961        StyleContextSelectRef::ShellBasedSurfaceModel(i) => {
39962            if i.0 >= model.shell_based_surface_model_arena.items.len() {
39963                return Err(AuthorError::DanglingRef {
39964                    entity: "SHELL_BASED_SURFACE_MODEL",
39965                });
39966            }
39967        }
39968        StyleContextSelectRef::SolidModel(i) => {
39969            if i.0 >= model.solid_model_arena.items.len() {
39970                return Err(AuthorError::DanglingRef {
39971                    entity: "SOLID_MODEL",
39972                });
39973            }
39974        }
39975        StyleContextSelectRef::SphericalSurface(i) => {
39976            if i.0 >= model.spherical_surface_arena.items.len() {
39977                return Err(AuthorError::DanglingRef {
39978                    entity: "SPHERICAL_SURFACE",
39979                });
39980            }
39981        }
39982        StyleContextSelectRef::StyledItem(i) => {
39983            if i.0 >= model.styled_item_arena.items.len() {
39984                return Err(AuthorError::DanglingRef {
39985                    entity: "STYLED_ITEM",
39986                });
39987            }
39988        }
39989        StyleContextSelectRef::Surface(i) => {
39990            if i.0 >= model.surface_arena.items.len() {
39991                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
39992            }
39993        }
39994        StyleContextSelectRef::SurfaceCurve(i) => {
39995            if i.0 >= model.surface_curve_arena.items.len() {
39996                return Err(AuthorError::DanglingRef {
39997                    entity: "SURFACE_CURVE",
39998                });
39999            }
40000        }
40001        StyleContextSelectRef::SurfaceOfLinearExtrusion(i) => {
40002            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
40003                return Err(AuthorError::DanglingRef {
40004                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
40005                });
40006            }
40007        }
40008        StyleContextSelectRef::SurfaceOfRevolution(i) => {
40009            if i.0 >= model.surface_of_revolution_arena.items.len() {
40010                return Err(AuthorError::DanglingRef {
40011                    entity: "SURFACE_OF_REVOLUTION",
40012                });
40013            }
40014        }
40015        StyleContextSelectRef::SweptSurface(i) => {
40016            if i.0 >= model.swept_surface_arena.items.len() {
40017                return Err(AuthorError::DanglingRef {
40018                    entity: "SWEPT_SURFACE",
40019                });
40020            }
40021        }
40022        StyleContextSelectRef::SymbolRepresentation(i) => {
40023            if i.0 >= model.symbol_representation_arena.items.len() {
40024                return Err(AuthorError::DanglingRef {
40025                    entity: "SYMBOL_REPRESENTATION",
40026                });
40027            }
40028        }
40029        StyleContextSelectRef::SymbolTarget(i) => {
40030            if i.0 >= model.symbol_target_arena.items.len() {
40031                return Err(AuthorError::DanglingRef {
40032                    entity: "SYMBOL_TARGET",
40033                });
40034            }
40035        }
40036        StyleContextSelectRef::TerminatorSymbol(i) => {
40037            if i.0 >= model.terminator_symbol_arena.items.len() {
40038                return Err(AuthorError::DanglingRef {
40039                    entity: "TERMINATOR_SYMBOL",
40040                });
40041            }
40042        }
40043        StyleContextSelectRef::TessellatedAnnotationOccurrence(i) => {
40044            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
40045                return Err(AuthorError::DanglingRef {
40046                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
40047                });
40048            }
40049        }
40050        StyleContextSelectRef::TessellatedCurveSet(i) => {
40051            if i.0 >= model.tessellated_curve_set_arena.items.len() {
40052                return Err(AuthorError::DanglingRef {
40053                    entity: "TESSELLATED_CURVE_SET",
40054                });
40055            }
40056        }
40057        StyleContextSelectRef::TessellatedFace(i) => {
40058            if i.0 >= model.tessellated_face_arena.items.len() {
40059                return Err(AuthorError::DanglingRef {
40060                    entity: "TESSELLATED_FACE",
40061                });
40062            }
40063        }
40064        StyleContextSelectRef::TessellatedGeometricSet(i) => {
40065            if i.0 >= model.tessellated_geometric_set_arena.items.len() {
40066                return Err(AuthorError::DanglingRef {
40067                    entity: "TESSELLATED_GEOMETRIC_SET",
40068                });
40069            }
40070        }
40071        StyleContextSelectRef::TessellatedItem(i) => {
40072            if i.0 >= model.tessellated_item_arena.items.len() {
40073                return Err(AuthorError::DanglingRef {
40074                    entity: "TESSELLATED_ITEM",
40075                });
40076            }
40077        }
40078        StyleContextSelectRef::TessellatedShapeRepresentation(i) => {
40079            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
40080                return Err(AuthorError::DanglingRef {
40081                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
40082                });
40083            }
40084        }
40085        StyleContextSelectRef::TessellatedShell(i) => {
40086            if i.0 >= model.tessellated_shell_arena.items.len() {
40087                return Err(AuthorError::DanglingRef {
40088                    entity: "TESSELLATED_SHELL",
40089                });
40090            }
40091        }
40092        StyleContextSelectRef::TessellatedSolid(i) => {
40093            if i.0 >= model.tessellated_solid_arena.items.len() {
40094                return Err(AuthorError::DanglingRef {
40095                    entity: "TESSELLATED_SOLID",
40096                });
40097            }
40098        }
40099        StyleContextSelectRef::TessellatedStructuredItem(i) => {
40100            if i.0 >= model.tessellated_structured_item_arena.items.len() {
40101                return Err(AuthorError::DanglingRef {
40102                    entity: "TESSELLATED_STRUCTURED_ITEM",
40103                });
40104            }
40105        }
40106        StyleContextSelectRef::TessellatedSurfaceSet(i) => {
40107            if i.0 >= model.tessellated_surface_set_arena.items.len() {
40108                return Err(AuthorError::DanglingRef {
40109                    entity: "TESSELLATED_SURFACE_SET",
40110                });
40111            }
40112        }
40113        StyleContextSelectRef::TextLiteral(i) => {
40114            if i.0 >= model.text_literal_arena.items.len() {
40115                return Err(AuthorError::DanglingRef {
40116                    entity: "TEXT_LITERAL",
40117                });
40118            }
40119        }
40120        StyleContextSelectRef::TopologicalRepresentationItem(i) => {
40121            if i.0 >= model.topological_representation_item_arena.items.len() {
40122                return Err(AuthorError::DanglingRef {
40123                    entity: "TOPOLOGICAL_REPRESENTATION_ITEM",
40124                });
40125            }
40126        }
40127        StyleContextSelectRef::ToroidalSurface(i) => {
40128            if i.0 >= model.toroidal_surface_arena.items.len() {
40129                return Err(AuthorError::DanglingRef {
40130                    entity: "TOROIDAL_SURFACE",
40131                });
40132            }
40133        }
40134        StyleContextSelectRef::TrimmedCurve(i) => {
40135            if i.0 >= model.trimmed_curve_arena.items.len() {
40136                return Err(AuthorError::DanglingRef {
40137                    entity: "TRIMMED_CURVE",
40138                });
40139            }
40140        }
40141        StyleContextSelectRef::TwoDirectionRepeatFactor(i) => {
40142            if i.0 >= model.two_direction_repeat_factor_arena.items.len() {
40143                return Err(AuthorError::DanglingRef {
40144                    entity: "TWO_DIRECTION_REPEAT_FACTOR",
40145                });
40146            }
40147        }
40148        StyleContextSelectRef::UniformCurve(i) => {
40149            if i.0 >= model.uniform_curve_arena.items.len() {
40150                return Err(AuthorError::DanglingRef {
40151                    entity: "UNIFORM_CURVE",
40152                });
40153            }
40154        }
40155        StyleContextSelectRef::UniformSurface(i) => {
40156            if i.0 >= model.uniform_surface_arena.items.len() {
40157                return Err(AuthorError::DanglingRef {
40158                    entity: "UNIFORM_SURFACE",
40159                });
40160            }
40161        }
40162        StyleContextSelectRef::ValueRepresentationItem(i) => {
40163            if i.0 >= model.value_representation_item_arena.items.len() {
40164                return Err(AuthorError::DanglingRef {
40165                    entity: "VALUE_REPRESENTATION_ITEM",
40166                });
40167            }
40168        }
40169        StyleContextSelectRef::Vector(i) => {
40170            if i.0 >= model.vector_arena.items.len() {
40171                return Err(AuthorError::DanglingRef { entity: "VECTOR" });
40172            }
40173        }
40174        StyleContextSelectRef::Vertex(i) => {
40175            if i.0 >= model.vertex_arena.items.len() {
40176                return Err(AuthorError::DanglingRef { entity: "VERTEX" });
40177            }
40178        }
40179        StyleContextSelectRef::VertexLoop(i) => {
40180            if i.0 >= model.vertex_loop_arena.items.len() {
40181                return Err(AuthorError::DanglingRef {
40182                    entity: "VERTEX_LOOP",
40183                });
40184            }
40185        }
40186        StyleContextSelectRef::VertexPoint(i) => {
40187            if i.0 >= model.vertex_point_arena.items.len() {
40188                return Err(AuthorError::DanglingRef {
40189                    entity: "VERTEX_POINT",
40190                });
40191            }
40192        }
40193        StyleContextSelectRef::VertexShell(i) => {
40194            if i.0 >= model.vertex_shell_arena.items.len() {
40195                return Err(AuthorError::DanglingRef {
40196                    entity: "VERTEX_SHELL",
40197                });
40198            }
40199        }
40200        StyleContextSelectRef::WireShell(i) => {
40201            if i.0 >= model.wire_shell_arena.items.len() {
40202                return Err(AuthorError::DanglingRef {
40203                    entity: "WIRE_SHELL",
40204                });
40205            }
40206        }
40207        StyleContextSelectRef::Complex(i) => {
40208            if i.0 >= model.complex_unit_arena.items.len() {
40209                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
40210            }
40211        }
40212    }
40213    Ok(())
40214}
40215fn check_styled_item_ref(model: &StepModel, r: &StyledItemRef) -> Result<(), AuthorError> {
40216    match r {
40217        StyledItemRef::AnnotationCurveOccurrence(i) => {
40218            if i.0 >= model.annotation_curve_occurrence_arena.items.len() {
40219                return Err(AuthorError::DanglingRef {
40220                    entity: "ANNOTATION_CURVE_OCCURRENCE",
40221                });
40222            }
40223        }
40224        StyledItemRef::AnnotationFillAreaOccurrence(i) => {
40225            if i.0 >= model.annotation_fill_area_occurrence_arena.items.len() {
40226                return Err(AuthorError::DanglingRef {
40227                    entity: "ANNOTATION_FILL_AREA_OCCURRENCE",
40228                });
40229            }
40230        }
40231        StyledItemRef::AnnotationOccurrence(i) => {
40232            if i.0 >= model.annotation_occurrence_arena.items.len() {
40233                return Err(AuthorError::DanglingRef {
40234                    entity: "ANNOTATION_OCCURRENCE",
40235                });
40236            }
40237        }
40238        StyledItemRef::AnnotationPlaceholderOccurrence(i) => {
40239            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
40240                return Err(AuthorError::DanglingRef {
40241                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
40242                });
40243            }
40244        }
40245        StyledItemRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
40246            return Err(AuthorError::NotAp242 {
40247                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
40248            });
40249        }
40250        StyledItemRef::AnnotationPlane(i) => {
40251            if i.0 >= model.annotation_plane_arena.items.len() {
40252                return Err(AuthorError::DanglingRef {
40253                    entity: "ANNOTATION_PLANE",
40254                });
40255            }
40256        }
40257        StyledItemRef::AnnotationSymbolOccurrence(i) => {
40258            if i.0 >= model.annotation_symbol_occurrence_arena.items.len() {
40259                return Err(AuthorError::DanglingRef {
40260                    entity: "ANNOTATION_SYMBOL_OCCURRENCE",
40261                });
40262            }
40263        }
40264        StyledItemRef::AnnotationTextOccurrence(i) => {
40265            if i.0 >= model.annotation_text_occurrence_arena.items.len() {
40266                return Err(AuthorError::DanglingRef {
40267                    entity: "ANNOTATION_TEXT_OCCURRENCE",
40268                });
40269            }
40270        }
40271        StyledItemRef::ContextDependentOverRidingStyledItem(i) => {
40272            if i.0
40273                >= model
40274                    .context_dependent_over_riding_styled_item_arena
40275                    .items
40276                    .len()
40277            {
40278                return Err(AuthorError::DanglingRef {
40279                    entity: "CONTEXT_DEPENDENT_OVER_RIDING_STYLED_ITEM",
40280                });
40281            }
40282        }
40283        StyledItemRef::DraughtingAnnotationOccurrence(i) => {
40284            if i.0 >= model.draughting_annotation_occurrence_arena.items.len() {
40285                return Err(AuthorError::DanglingRef {
40286                    entity: "DRAUGHTING_ANNOTATION_OCCURRENCE",
40287                });
40288            }
40289        }
40290        StyledItemRef::LeaderCurve(i) => {
40291            if i.0 >= model.leader_curve_arena.items.len() {
40292                return Err(AuthorError::DanglingRef {
40293                    entity: "LEADER_CURVE",
40294                });
40295            }
40296        }
40297        StyledItemRef::LeaderTerminator(i) => {
40298            if i.0 >= model.leader_terminator_arena.items.len() {
40299                return Err(AuthorError::DanglingRef {
40300                    entity: "LEADER_TERMINATOR",
40301                });
40302            }
40303        }
40304        StyledItemRef::OverRidingStyledItem(i) => {
40305            if i.0 >= model.over_riding_styled_item_arena.items.len() {
40306                return Err(AuthorError::DanglingRef {
40307                    entity: "OVER_RIDING_STYLED_ITEM",
40308                });
40309            }
40310        }
40311        StyledItemRef::StyledItem(i) => {
40312            if i.0 >= model.styled_item_arena.items.len() {
40313                return Err(AuthorError::DanglingRef {
40314                    entity: "STYLED_ITEM",
40315                });
40316            }
40317        }
40318        StyledItemRef::TerminatorSymbol(i) => {
40319            if i.0 >= model.terminator_symbol_arena.items.len() {
40320                return Err(AuthorError::DanglingRef {
40321                    entity: "TERMINATOR_SYMBOL",
40322                });
40323            }
40324        }
40325        StyledItemRef::TessellatedAnnotationOccurrence(i) => {
40326            if i.0 >= model.tessellated_annotation_occurrence_arena.items.len() {
40327                return Err(AuthorError::DanglingRef {
40328                    entity: "TESSELLATED_ANNOTATION_OCCURRENCE",
40329                });
40330            }
40331        }
40332        StyledItemRef::Complex(i) => {
40333            if i.0 >= model.complex_unit_arena.items.len() {
40334                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
40335            }
40336        }
40337    }
40338    Ok(())
40339}
40340fn check_styled_item_target_ref(
40341    model: &StepModel,
40342    r: &StyledItemTargetRef,
40343) -> Result<(), AuthorError> {
40344    match r {
40345        StyledItemTargetRef::AdvancedBrepShapeRepresentation(i) => {
40346            if i.0 >= model.advanced_brep_shape_representation_arena.items.len() {
40347                return Err(AuthorError::DanglingRef {
40348                    entity: "ADVANCED_BREP_SHAPE_REPRESENTATION",
40349                });
40350            }
40351        }
40352        StyledItemTargetRef::AdvancedFace(i) => {
40353            if i.0 >= model.advanced_face_arena.items.len() {
40354                return Err(AuthorError::DanglingRef {
40355                    entity: "ADVANCED_FACE",
40356                });
40357            }
40358        }
40359        StyledItemTargetRef::AnnotationPlaceholderLeaderLine(_) => {
40360            return Err(AuthorError::NotAp242 {
40361                entity: "ANNOTATION_PLACEHOLDER_LEADER_LINE",
40362            });
40363        }
40364        StyledItemTargetRef::AnnotationPlaceholderOccurrence(i) => {
40365            if i.0 >= model.annotation_placeholder_occurrence_arena.items.len() {
40366                return Err(AuthorError::DanglingRef {
40367                    entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE",
40368                });
40369            }
40370        }
40371        StyledItemTargetRef::AnnotationPlaceholderOccurrenceWithLeaderLine(_) => {
40372            return Err(AuthorError::NotAp242 {
40373                entity: "ANNOTATION_PLACEHOLDER_OCCURRENCE_WITH_LEADER_LINE",
40374            });
40375        }
40376        StyledItemTargetRef::AnnotationPlane(i) => {
40377            if i.0 >= model.annotation_plane_arena.items.len() {
40378                return Err(AuthorError::DanglingRef {
40379                    entity: "ANNOTATION_PLANE",
40380                });
40381            }
40382        }
40383        StyledItemTargetRef::AnnotationSymbol(i) => {
40384            if i.0 >= model.annotation_symbol_arena.items.len() {
40385                return Err(AuthorError::DanglingRef {
40386                    entity: "ANNOTATION_SYMBOL",
40387                });
40388            }
40389        }
40390        StyledItemTargetRef::AnnotationText(i) => {
40391            if i.0 >= model.annotation_text_arena.items.len() {
40392                return Err(AuthorError::DanglingRef {
40393                    entity: "ANNOTATION_TEXT",
40394                });
40395            }
40396        }
40397        StyledItemTargetRef::AnnotationTextCharacter(i) => {
40398            if i.0 >= model.annotation_text_character_arena.items.len() {
40399                return Err(AuthorError::DanglingRef {
40400                    entity: "ANNOTATION_TEXT_CHARACTER",
40401                });
40402            }
40403        }
40404        StyledItemTargetRef::AnnotationToAnnotationLeaderLine(_) => {
40405            return Err(AuthorError::NotAp242 {
40406                entity: "ANNOTATION_TO_ANNOTATION_LEADER_LINE",
40407            });
40408        }
40409        StyledItemTargetRef::AnnotationToModelLeaderLine(_) => {
40410            return Err(AuthorError::NotAp242 {
40411                entity: "ANNOTATION_TO_MODEL_LEADER_LINE",
40412            });
40413        }
40414        StyledItemTargetRef::ApllPoint(_) => {
40415            return Err(AuthorError::NotAp242 {
40416                entity: "APLL_POINT",
40417            });
40418        }
40419        StyledItemTargetRef::ApllPointWithSurface(_) => {
40420            return Err(AuthorError::NotAp242 {
40421                entity: "APLL_POINT_WITH_SURFACE",
40422            });
40423        }
40424        StyledItemTargetRef::AuxiliaryLeaderLine(_) => {
40425            return Err(AuthorError::NotAp242 {
40426                entity: "AUXILIARY_LEADER_LINE",
40427            });
40428        }
40429        StyledItemTargetRef::Axis1Placement(i) => {
40430            if i.0 >= model.axis1_placement_arena.items.len() {
40431                return Err(AuthorError::DanglingRef {
40432                    entity: "AXIS1_PLACEMENT",
40433                });
40434            }
40435        }
40436        StyledItemTargetRef::Axis2Placement2d(i) => {
40437            if i.0 >= model.axis2_placement2d_arena.items.len() {
40438                return Err(AuthorError::DanglingRef {
40439                    entity: "AXIS2_PLACEMENT_2D",
40440                });
40441            }
40442        }
40443        StyledItemTargetRef::Axis2Placement3d(i) => {
40444            if i.0 >= model.axis2_placement3d_arena.items.len() {
40445                return Err(AuthorError::DanglingRef {
40446                    entity: "AXIS2_PLACEMENT_3D",
40447                });
40448            }
40449        }
40450        StyledItemTargetRef::BSplineCurve(i) => {
40451            if i.0 >= model.b_spline_curve_arena.items.len() {
40452                return Err(AuthorError::DanglingRef {
40453                    entity: "B_SPLINE_CURVE",
40454                });
40455            }
40456        }
40457        StyledItemTargetRef::BSplineCurveWithKnots(i) => {
40458            if i.0 >= model.b_spline_curve_with_knots_arena.items.len() {
40459                return Err(AuthorError::DanglingRef {
40460                    entity: "B_SPLINE_CURVE_WITH_KNOTS",
40461                });
40462            }
40463        }
40464        StyledItemTargetRef::BSplineSurface(i) => {
40465            if i.0 >= model.b_spline_surface_arena.items.len() {
40466                return Err(AuthorError::DanglingRef {
40467                    entity: "B_SPLINE_SURFACE",
40468                });
40469            }
40470        }
40471        StyledItemTargetRef::BSplineSurfaceWithKnots(i) => {
40472            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
40473                return Err(AuthorError::DanglingRef {
40474                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
40475                });
40476            }
40477        }
40478        StyledItemTargetRef::BezierCurve(i) => {
40479            if i.0 >= model.bezier_curve_arena.items.len() {
40480                return Err(AuthorError::DanglingRef {
40481                    entity: "BEZIER_CURVE",
40482                });
40483            }
40484        }
40485        StyledItemTargetRef::BezierSurface(i) => {
40486            if i.0 >= model.bezier_surface_arena.items.len() {
40487                return Err(AuthorError::DanglingRef {
40488                    entity: "BEZIER_SURFACE",
40489                });
40490            }
40491        }
40492        StyledItemTargetRef::BoundedCurve(i) => {
40493            if i.0 >= model.bounded_curve_arena.items.len() {
40494                return Err(AuthorError::DanglingRef {
40495                    entity: "BOUNDED_CURVE",
40496                });
40497            }
40498        }
40499        StyledItemTargetRef::BoundedPcurve(i) => {
40500            if i.0 >= model.bounded_pcurve_arena.items.len() {
40501                return Err(AuthorError::DanglingRef {
40502                    entity: "BOUNDED_PCURVE",
40503                });
40504            }
40505        }
40506        StyledItemTargetRef::BoundedSurface(i) => {
40507            if i.0 >= model.bounded_surface_arena.items.len() {
40508                return Err(AuthorError::DanglingRef {
40509                    entity: "BOUNDED_SURFACE",
40510                });
40511            }
40512        }
40513        StyledItemTargetRef::BoundedSurfaceCurve(i) => {
40514            if i.0 >= model.bounded_surface_curve_arena.items.len() {
40515                return Err(AuthorError::DanglingRef {
40516                    entity: "BOUNDED_SURFACE_CURVE",
40517                });
40518            }
40519        }
40520        StyledItemTargetRef::BrepWithVoids(i) => {
40521            if i.0 >= model.brep_with_voids_arena.items.len() {
40522                return Err(AuthorError::DanglingRef {
40523                    entity: "BREP_WITH_VOIDS",
40524                });
40525            }
40526        }
40527        StyledItemTargetRef::CameraImage(i) => {
40528            if i.0 >= model.camera_image_arena.items.len() {
40529                return Err(AuthorError::DanglingRef {
40530                    entity: "CAMERA_IMAGE",
40531                });
40532            }
40533        }
40534        StyledItemTargetRef::CameraImage3dWithScale(i) => {
40535            if i.0 >= model.camera_image3d_with_scale_arena.items.len() {
40536                return Err(AuthorError::DanglingRef {
40537                    entity: "CAMERA_IMAGE_3D_WITH_SCALE",
40538                });
40539            }
40540        }
40541        StyledItemTargetRef::CameraModel(i) => {
40542            if i.0 >= model.camera_model_arena.items.len() {
40543                return Err(AuthorError::DanglingRef {
40544                    entity: "CAMERA_MODEL",
40545                });
40546            }
40547        }
40548        StyledItemTargetRef::CameraModelD3(i) => {
40549            if i.0 >= model.camera_model_d3_arena.items.len() {
40550                return Err(AuthorError::DanglingRef {
40551                    entity: "CAMERA_MODEL_D3",
40552                });
40553            }
40554        }
40555        StyledItemTargetRef::CameraModelD3MultiClipping(i) => {
40556            if i.0 >= model.camera_model_d3_multi_clipping_arena.items.len() {
40557                return Err(AuthorError::DanglingRef {
40558                    entity: "CAMERA_MODEL_D3_MULTI_CLIPPING",
40559                });
40560            }
40561        }
40562        StyledItemTargetRef::CameraModelD3WithHlhsr(i) => {
40563            if i.0 >= model.camera_model_d3_with_hlhsr_arena.items.len() {
40564                return Err(AuthorError::DanglingRef {
40565                    entity: "CAMERA_MODEL_D3_WITH_HLHSR",
40566                });
40567            }
40568        }
40569        StyledItemTargetRef::CartesianPoint(i) => {
40570            if i.0 >= model.cartesian_point_arena.items.len() {
40571                return Err(AuthorError::DanglingRef {
40572                    entity: "CARTESIAN_POINT",
40573                });
40574            }
40575        }
40576        StyledItemTargetRef::CharacterizedRepresentation(i) => {
40577            if i.0 >= model.characterized_representation_arena.items.len() {
40578                return Err(AuthorError::DanglingRef {
40579                    entity: "CHARACTERIZED_REPRESENTATION",
40580                });
40581            }
40582        }
40583        StyledItemTargetRef::Circle(i) => {
40584            if i.0 >= model.circle_arena.items.len() {
40585                return Err(AuthorError::DanglingRef { entity: "CIRCLE" });
40586            }
40587        }
40588        StyledItemTargetRef::ClosedShell(i) => {
40589            if i.0 >= model.closed_shell_arena.items.len() {
40590                return Err(AuthorError::DanglingRef {
40591                    entity: "CLOSED_SHELL",
40592                });
40593            }
40594        }
40595        StyledItemTargetRef::ComplexTriangulatedFace(i) => {
40596            if i.0 >= model.complex_triangulated_face_arena.items.len() {
40597                return Err(AuthorError::DanglingRef {
40598                    entity: "COMPLEX_TRIANGULATED_FACE",
40599                });
40600            }
40601        }
40602        StyledItemTargetRef::ComplexTriangulatedSurfaceSet(i) => {
40603            if i.0 >= model.complex_triangulated_surface_set_arena.items.len() {
40604                return Err(AuthorError::DanglingRef {
40605                    entity: "COMPLEX_TRIANGULATED_SURFACE_SET",
40606                });
40607            }
40608        }
40609        StyledItemTargetRef::CompositeCurve(i) => {
40610            if i.0 >= model.composite_curve_arena.items.len() {
40611                return Err(AuthorError::DanglingRef {
40612                    entity: "COMPOSITE_CURVE",
40613                });
40614            }
40615        }
40616        StyledItemTargetRef::CompositeText(i) => {
40617            if i.0 >= model.composite_text_arena.items.len() {
40618                return Err(AuthorError::DanglingRef {
40619                    entity: "COMPOSITE_TEXT",
40620                });
40621            }
40622        }
40623        StyledItemTargetRef::Conic(i) => {
40624            if i.0 >= model.conic_arena.items.len() {
40625                return Err(AuthorError::DanglingRef { entity: "CONIC" });
40626            }
40627        }
40628        StyledItemTargetRef::ConicalSurface(i) => {
40629            if i.0 >= model.conical_surface_arena.items.len() {
40630                return Err(AuthorError::DanglingRef {
40631                    entity: "CONICAL_SURFACE",
40632                });
40633            }
40634        }
40635        StyledItemTargetRef::ConnectedFaceSet(i) => {
40636            if i.0 >= model.connected_face_set_arena.items.len() {
40637                return Err(AuthorError::DanglingRef {
40638                    entity: "CONNECTED_FACE_SET",
40639                });
40640            }
40641        }
40642        StyledItemTargetRef::ConstructiveGeometryRepresentation(i) => {
40643            if i.0 >= model.constructive_geometry_representation_arena.items.len() {
40644                return Err(AuthorError::DanglingRef {
40645                    entity: "CONSTRUCTIVE_GEOMETRY_REPRESENTATION",
40646                });
40647            }
40648        }
40649        StyledItemTargetRef::CoordinatesList(i) => {
40650            if i.0 >= model.coordinates_list_arena.items.len() {
40651                return Err(AuthorError::DanglingRef {
40652                    entity: "COORDINATES_LIST",
40653                });
40654            }
40655        }
40656        StyledItemTargetRef::Curve(i) => {
40657            if i.0 >= model.curve_arena.items.len() {
40658                return Err(AuthorError::DanglingRef { entity: "CURVE" });
40659            }
40660        }
40661        StyledItemTargetRef::CylindricalSurface(i) => {
40662            if i.0 >= model.cylindrical_surface_arena.items.len() {
40663                return Err(AuthorError::DanglingRef {
40664                    entity: "CYLINDRICAL_SURFACE",
40665                });
40666            }
40667        }
40668        StyledItemTargetRef::DefinedCharacterGlyph(i) => {
40669            if i.0 >= model.defined_character_glyph_arena.items.len() {
40670                return Err(AuthorError::DanglingRef {
40671                    entity: "DEFINED_CHARACTER_GLYPH",
40672                });
40673            }
40674        }
40675        StyledItemTargetRef::DefinedSymbol(i) => {
40676            if i.0 >= model.defined_symbol_arena.items.len() {
40677                return Err(AuthorError::DanglingRef {
40678                    entity: "DEFINED_SYMBOL",
40679                });
40680            }
40681        }
40682        StyledItemTargetRef::DefinitionalRepresentation(i) => {
40683            if i.0 >= model.definitional_representation_arena.items.len() {
40684                return Err(AuthorError::DanglingRef {
40685                    entity: "DEFINITIONAL_REPRESENTATION",
40686                });
40687            }
40688        }
40689        StyledItemTargetRef::DegenerateToroidalSurface(i) => {
40690            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
40691                return Err(AuthorError::DanglingRef {
40692                    entity: "DEGENERATE_TOROIDAL_SURFACE",
40693                });
40694            }
40695        }
40696        StyledItemTargetRef::Direction(i) => {
40697            if i.0 >= model.direction_arena.items.len() {
40698                return Err(AuthorError::DanglingRef {
40699                    entity: "DIRECTION",
40700                });
40701            }
40702        }
40703        StyledItemTargetRef::DraughtingCallout(i) => {
40704            if i.0 >= model.draughting_callout_arena.items.len() {
40705                return Err(AuthorError::DanglingRef {
40706                    entity: "DRAUGHTING_CALLOUT",
40707                });
40708            }
40709        }
40710        StyledItemTargetRef::DraughtingModel(i) => {
40711            if i.0 >= model.draughting_model_arena.items.len() {
40712                return Err(AuthorError::DanglingRef {
40713                    entity: "DRAUGHTING_MODEL",
40714                });
40715            }
40716        }
40717        StyledItemTargetRef::Edge(i) => {
40718            if i.0 >= model.edge_arena.items.len() {
40719                return Err(AuthorError::DanglingRef { entity: "EDGE" });
40720            }
40721        }
40722        StyledItemTargetRef::EdgeCurve(i) => {
40723            if i.0 >= model.edge_curve_arena.items.len() {
40724                return Err(AuthorError::DanglingRef {
40725                    entity: "EDGE_CURVE",
40726                });
40727            }
40728        }
40729        StyledItemTargetRef::EdgeLoop(i) => {
40730            if i.0 >= model.edge_loop_arena.items.len() {
40731                return Err(AuthorError::DanglingRef {
40732                    entity: "EDGE_LOOP",
40733                });
40734            }
40735        }
40736        StyledItemTargetRef::ElementarySurface(i) => {
40737            if i.0 >= model.elementary_surface_arena.items.len() {
40738                return Err(AuthorError::DanglingRef {
40739                    entity: "ELEMENTARY_SURFACE",
40740                });
40741            }
40742        }
40743        StyledItemTargetRef::Ellipse(i) => {
40744            if i.0 >= model.ellipse_arena.items.len() {
40745                return Err(AuthorError::DanglingRef { entity: "ELLIPSE" });
40746            }
40747        }
40748        StyledItemTargetRef::ExternallyDefinedHatchStyle(i) => {
40749            if i.0 >= model.externally_defined_hatch_style_arena.items.len() {
40750                return Err(AuthorError::DanglingRef {
40751                    entity: "EXTERNALLY_DEFINED_HATCH_STYLE",
40752                });
40753            }
40754        }
40755        StyledItemTargetRef::ExternallyDefinedTileStyle(i) => {
40756            if i.0 >= model.externally_defined_tile_style_arena.items.len() {
40757                return Err(AuthorError::DanglingRef {
40758                    entity: "EXTERNALLY_DEFINED_TILE_STYLE",
40759                });
40760            }
40761        }
40762        StyledItemTargetRef::Face(i) => {
40763            if i.0 >= model.face_arena.items.len() {
40764                return Err(AuthorError::DanglingRef { entity: "FACE" });
40765            }
40766        }
40767        StyledItemTargetRef::FaceBound(i) => {
40768            if i.0 >= model.face_bound_arena.items.len() {
40769                return Err(AuthorError::DanglingRef {
40770                    entity: "FACE_BOUND",
40771                });
40772            }
40773        }
40774        StyledItemTargetRef::FaceOuterBound(i) => {
40775            if i.0 >= model.face_outer_bound_arena.items.len() {
40776                return Err(AuthorError::DanglingRef {
40777                    entity: "FACE_OUTER_BOUND",
40778                });
40779            }
40780        }
40781        StyledItemTargetRef::FaceSurface(i) => {
40782            if i.0 >= model.face_surface_arena.items.len() {
40783                return Err(AuthorError::DanglingRef {
40784                    entity: "FACE_SURFACE",
40785                });
40786            }
40787        }
40788        StyledItemTargetRef::FillAreaStyleHatching(i) => {
40789            if i.0 >= model.fill_area_style_hatching_arena.items.len() {
40790                return Err(AuthorError::DanglingRef {
40791                    entity: "FILL_AREA_STYLE_HATCHING",
40792                });
40793            }
40794        }
40795        StyledItemTargetRef::FillAreaStyleTileColouredRegion(i) => {
40796            if i.0 >= model.fill_area_style_tile_coloured_region_arena.items.len() {
40797                return Err(AuthorError::DanglingRef {
40798                    entity: "FILL_AREA_STYLE_TILE_COLOURED_REGION",
40799                });
40800            }
40801        }
40802        StyledItemTargetRef::FillAreaStyleTileCurveWithStyle(i) => {
40803            if i.0
40804                >= model
40805                    .fill_area_style_tile_curve_with_style_arena
40806                    .items
40807                    .len()
40808            {
40809                return Err(AuthorError::DanglingRef {
40810                    entity: "FILL_AREA_STYLE_TILE_CURVE_WITH_STYLE",
40811                });
40812            }
40813        }
40814        StyledItemTargetRef::FillAreaStyleTileSymbolWithStyle(i) => {
40815            if i.0
40816                >= model
40817                    .fill_area_style_tile_symbol_with_style_arena
40818                    .items
40819                    .len()
40820            {
40821                return Err(AuthorError::DanglingRef {
40822                    entity: "FILL_AREA_STYLE_TILE_SYMBOL_WITH_STYLE",
40823                });
40824            }
40825        }
40826        StyledItemTargetRef::FillAreaStyleTiles(i) => {
40827            if i.0 >= model.fill_area_style_tiles_arena.items.len() {
40828                return Err(AuthorError::DanglingRef {
40829                    entity: "FILL_AREA_STYLE_TILES",
40830                });
40831            }
40832        }
40833        StyledItemTargetRef::GeometricCurveSet(i) => {
40834            if i.0 >= model.geometric_curve_set_arena.items.len() {
40835                return Err(AuthorError::DanglingRef {
40836                    entity: "GEOMETRIC_CURVE_SET",
40837                });
40838            }
40839        }
40840        StyledItemTargetRef::GeometricRepresentationItem(i) => {
40841            if i.0 >= model.geometric_representation_item_arena.items.len() {
40842                return Err(AuthorError::DanglingRef {
40843                    entity: "GEOMETRIC_REPRESENTATION_ITEM",
40844                });
40845            }
40846        }
40847        StyledItemTargetRef::GeometricSet(i) => {
40848            if i.0 >= model.geometric_set_arena.items.len() {
40849                return Err(AuthorError::DanglingRef {
40850                    entity: "GEOMETRIC_SET",
40851                });
40852            }
40853        }
40854        StyledItemTargetRef::GeometricallyBoundedSurfaceShapeRepresentation(i) => {
40855            if i.0
40856                >= model
40857                    .geometrically_bounded_surface_shape_representation_arena
40858                    .items
40859                    .len()
40860            {
40861                return Err(AuthorError::DanglingRef {
40862                    entity: "GEOMETRICALLY_BOUNDED_SURFACE_SHAPE_REPRESENTATION",
40863                });
40864            }
40865        }
40866        StyledItemTargetRef::GeometricallyBoundedWireframeShapeRepresentation(i) => {
40867            if i.0
40868                >= model
40869                    .geometrically_bounded_wireframe_shape_representation_arena
40870                    .items
40871                    .len()
40872            {
40873                return Err(AuthorError::DanglingRef {
40874                    entity: "GEOMETRICALLY_BOUNDED_WIREFRAME_SHAPE_REPRESENTATION",
40875                });
40876            }
40877        }
40878        StyledItemTargetRef::Hyperbola(i) => {
40879            if i.0 >= model.hyperbola_arena.items.len() {
40880                return Err(AuthorError::DanglingRef {
40881                    entity: "HYPERBOLA",
40882                });
40883            }
40884        }
40885        StyledItemTargetRef::IntersectionCurve(i) => {
40886            if i.0 >= model.intersection_curve_arena.items.len() {
40887                return Err(AuthorError::DanglingRef {
40888                    entity: "INTERSECTION_CURVE",
40889                });
40890            }
40891        }
40892        StyledItemTargetRef::LeaderDirectedCallout(i) => {
40893            if i.0 >= model.leader_directed_callout_arena.items.len() {
40894                return Err(AuthorError::DanglingRef {
40895                    entity: "LEADER_DIRECTED_CALLOUT",
40896                });
40897            }
40898        }
40899        StyledItemTargetRef::Line(i) => {
40900            if i.0 >= model.line_arena.items.len() {
40901                return Err(AuthorError::DanglingRef { entity: "LINE" });
40902            }
40903        }
40904        StyledItemTargetRef::Loop(i) => {
40905            if i.0 >= model.loop_arena.items.len() {
40906                return Err(AuthorError::DanglingRef { entity: "LOOP" });
40907            }
40908        }
40909        StyledItemTargetRef::ManifoldSolidBrep(i) => {
40910            if i.0 >= model.manifold_solid_brep_arena.items.len() {
40911                return Err(AuthorError::DanglingRef {
40912                    entity: "MANIFOLD_SOLID_BREP",
40913                });
40914            }
40915        }
40916        StyledItemTargetRef::ManifoldSurfaceShapeRepresentation(i) => {
40917            if i.0
40918                >= model
40919                    .manifold_surface_shape_representation_arena
40920                    .items
40921                    .len()
40922            {
40923                return Err(AuthorError::DanglingRef {
40924                    entity: "MANIFOLD_SURFACE_SHAPE_REPRESENTATION",
40925                });
40926            }
40927        }
40928        StyledItemTargetRef::MappedItem(i) => {
40929            if i.0 >= model.mapped_item_arena.items.len() {
40930                return Err(AuthorError::DanglingRef {
40931                    entity: "MAPPED_ITEM",
40932                });
40933            }
40934        }
40935        StyledItemTargetRef::MechanicalDesignGeometricPresentationRepresentation(i) => {
40936            if i.0
40937                >= model
40938                    .mechanical_design_geometric_presentation_representation_arena
40939                    .items
40940                    .len()
40941            {
40942                return Err(AuthorError::DanglingRef {
40943                    entity: "MECHANICAL_DESIGN_GEOMETRIC_PRESENTATION_REPRESENTATION",
40944                });
40945            }
40946        }
40947        StyledItemTargetRef::MechanicalDesignPresentationRepresentationWithDraughting(i) => {
40948            if i.0
40949                >= model
40950                    .mechanical_design_presentation_representation_with_draughting_arena
40951                    .items
40952                    .len()
40953            {
40954                return Err(AuthorError::DanglingRef {
40955                    entity: "MECHANICAL_DESIGN_PRESENTATION_REPRESENTATION_WITH_DRAUGHTING",
40956                });
40957            }
40958        }
40959        StyledItemTargetRef::MechanicalDesignShadedPresentationRepresentation(i) => {
40960            if i.0
40961                >= model
40962                    .mechanical_design_shaded_presentation_representation_arena
40963                    .items
40964                    .len()
40965            {
40966                return Err(AuthorError::DanglingRef {
40967                    entity: "MECHANICAL_DESIGN_SHADED_PRESENTATION_REPRESENTATION",
40968                });
40969            }
40970        }
40971        StyledItemTargetRef::OffsetSurface(i) => {
40972            if i.0 >= model.offset_surface_arena.items.len() {
40973                return Err(AuthorError::DanglingRef {
40974                    entity: "OFFSET_SURFACE",
40975                });
40976            }
40977        }
40978        StyledItemTargetRef::OneDirectionRepeatFactor(i) => {
40979            if i.0 >= model.one_direction_repeat_factor_arena.items.len() {
40980                return Err(AuthorError::DanglingRef {
40981                    entity: "ONE_DIRECTION_REPEAT_FACTOR",
40982                });
40983            }
40984        }
40985        StyledItemTargetRef::OpenShell(i) => {
40986            if i.0 >= model.open_shell_arena.items.len() {
40987                return Err(AuthorError::DanglingRef {
40988                    entity: "OPEN_SHELL",
40989                });
40990            }
40991        }
40992        StyledItemTargetRef::OrientedClosedShell(i) => {
40993            if i.0 >= model.oriented_closed_shell_arena.items.len() {
40994                return Err(AuthorError::DanglingRef {
40995                    entity: "ORIENTED_CLOSED_SHELL",
40996                });
40997            }
40998        }
40999        StyledItemTargetRef::OrientedEdge(i) => {
41000            if i.0 >= model.oriented_edge_arena.items.len() {
41001                return Err(AuthorError::DanglingRef {
41002                    entity: "ORIENTED_EDGE",
41003                });
41004            }
41005        }
41006        StyledItemTargetRef::Path(i) => {
41007            if i.0 >= model.path_arena.items.len() {
41008                return Err(AuthorError::DanglingRef { entity: "PATH" });
41009            }
41010        }
41011        StyledItemTargetRef::Pcurve(i) => {
41012            if i.0 >= model.pcurve_arena.items.len() {
41013                return Err(AuthorError::DanglingRef { entity: "PCURVE" });
41014            }
41015        }
41016        StyledItemTargetRef::Placement(i) => {
41017            if i.0 >= model.placement_arena.items.len() {
41018                return Err(AuthorError::DanglingRef {
41019                    entity: "PLACEMENT",
41020                });
41021            }
41022        }
41023        StyledItemTargetRef::PlanarBox(i) => {
41024            if i.0 >= model.planar_box_arena.items.len() {
41025                return Err(AuthorError::DanglingRef {
41026                    entity: "PLANAR_BOX",
41027                });
41028            }
41029        }
41030        StyledItemTargetRef::PlanarExtent(i) => {
41031            if i.0 >= model.planar_extent_arena.items.len() {
41032                return Err(AuthorError::DanglingRef {
41033                    entity: "PLANAR_EXTENT",
41034                });
41035            }
41036        }
41037        StyledItemTargetRef::Plane(i) => {
41038            if i.0 >= model.plane_arena.items.len() {
41039                return Err(AuthorError::DanglingRef { entity: "PLANE" });
41040            }
41041        }
41042        StyledItemTargetRef::Point(i) => {
41043            if i.0 >= model.point_arena.items.len() {
41044                return Err(AuthorError::DanglingRef { entity: "POINT" });
41045            }
41046        }
41047        StyledItemTargetRef::PolyLoop(i) => {
41048            if i.0 >= model.poly_loop_arena.items.len() {
41049                return Err(AuthorError::DanglingRef {
41050                    entity: "POLY_LOOP",
41051                });
41052            }
41053        }
41054        StyledItemTargetRef::Polyline(i) => {
41055            if i.0 >= model.polyline_arena.items.len() {
41056                return Err(AuthorError::DanglingRef { entity: "POLYLINE" });
41057            }
41058        }
41059        StyledItemTargetRef::PresentationArea(i) => {
41060            if i.0 >= model.presentation_area_arena.items.len() {
41061                return Err(AuthorError::DanglingRef {
41062                    entity: "PRESENTATION_AREA",
41063                });
41064            }
41065        }
41066        StyledItemTargetRef::PresentationRepresentation(i) => {
41067            if i.0 >= model.presentation_representation_arena.items.len() {
41068                return Err(AuthorError::DanglingRef {
41069                    entity: "PRESENTATION_REPRESENTATION",
41070                });
41071            }
41072        }
41073        StyledItemTargetRef::PresentationView(i) => {
41074            if i.0 >= model.presentation_view_arena.items.len() {
41075                return Err(AuthorError::DanglingRef {
41076                    entity: "PRESENTATION_VIEW",
41077                });
41078            }
41079        }
41080        StyledItemTargetRef::QuasiUniformCurve(i) => {
41081            if i.0 >= model.quasi_uniform_curve_arena.items.len() {
41082                return Err(AuthorError::DanglingRef {
41083                    entity: "QUASI_UNIFORM_CURVE",
41084                });
41085            }
41086        }
41087        StyledItemTargetRef::QuasiUniformSurface(i) => {
41088            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
41089                return Err(AuthorError::DanglingRef {
41090                    entity: "QUASI_UNIFORM_SURFACE",
41091                });
41092            }
41093        }
41094        StyledItemTargetRef::RationalBSplineCurve(i) => {
41095            if i.0 >= model.rational_b_spline_curve_arena.items.len() {
41096                return Err(AuthorError::DanglingRef {
41097                    entity: "RATIONAL_B_SPLINE_CURVE",
41098                });
41099            }
41100        }
41101        StyledItemTargetRef::RationalBSplineSurface(i) => {
41102            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
41103                return Err(AuthorError::DanglingRef {
41104                    entity: "RATIONAL_B_SPLINE_SURFACE",
41105                });
41106            }
41107        }
41108        StyledItemTargetRef::RepositionedTessellatedItem(i) => {
41109            if i.0 >= model.repositioned_tessellated_item_arena.items.len() {
41110                return Err(AuthorError::DanglingRef {
41111                    entity: "REPOSITIONED_TESSELLATED_ITEM",
41112                });
41113            }
41114        }
41115        StyledItemTargetRef::Representation(i) => {
41116            if i.0 >= model.representation_arena.items.len() {
41117                return Err(AuthorError::DanglingRef {
41118                    entity: "REPRESENTATION",
41119                });
41120            }
41121        }
41122        StyledItemTargetRef::RepresentationReference(i) => {
41123            if i.0 >= model.representation_reference_arena.items.len() {
41124                return Err(AuthorError::DanglingRef {
41125                    entity: "REPRESENTATION_REFERENCE",
41126                });
41127            }
41128        }
41129        StyledItemTargetRef::SeamCurve(i) => {
41130            if i.0 >= model.seam_curve_arena.items.len() {
41131                return Err(AuthorError::DanglingRef {
41132                    entity: "SEAM_CURVE",
41133                });
41134            }
41135        }
41136        StyledItemTargetRef::ShapeDimensionRepresentation(i) => {
41137            if i.0 >= model.shape_dimension_representation_arena.items.len() {
41138                return Err(AuthorError::DanglingRef {
41139                    entity: "SHAPE_DIMENSION_REPRESENTATION",
41140                });
41141            }
41142        }
41143        StyledItemTargetRef::ShapeRepresentation(i) => {
41144            if i.0 >= model.shape_representation_arena.items.len() {
41145                return Err(AuthorError::DanglingRef {
41146                    entity: "SHAPE_REPRESENTATION",
41147                });
41148            }
41149        }
41150        StyledItemTargetRef::ShapeRepresentationWithParameters(i) => {
41151            if i.0 >= model.shape_representation_with_parameters_arena.items.len() {
41152                return Err(AuthorError::DanglingRef {
41153                    entity: "SHAPE_REPRESENTATION_WITH_PARAMETERS",
41154                });
41155            }
41156        }
41157        StyledItemTargetRef::ShellBasedSurfaceModel(i) => {
41158            if i.0 >= model.shell_based_surface_model_arena.items.len() {
41159                return Err(AuthorError::DanglingRef {
41160                    entity: "SHELL_BASED_SURFACE_MODEL",
41161                });
41162            }
41163        }
41164        StyledItemTargetRef::SolidModel(i) => {
41165            if i.0 >= model.solid_model_arena.items.len() {
41166                return Err(AuthorError::DanglingRef {
41167                    entity: "SOLID_MODEL",
41168                });
41169            }
41170        }
41171        StyledItemTargetRef::SphericalSurface(i) => {
41172            if i.0 >= model.spherical_surface_arena.items.len() {
41173                return Err(AuthorError::DanglingRef {
41174                    entity: "SPHERICAL_SURFACE",
41175                });
41176            }
41177        }
41178        StyledItemTargetRef::Surface(i) => {
41179            if i.0 >= model.surface_arena.items.len() {
41180                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
41181            }
41182        }
41183        StyledItemTargetRef::SurfaceCurve(i) => {
41184            if i.0 >= model.surface_curve_arena.items.len() {
41185                return Err(AuthorError::DanglingRef {
41186                    entity: "SURFACE_CURVE",
41187                });
41188            }
41189        }
41190        StyledItemTargetRef::SurfaceOfLinearExtrusion(i) => {
41191            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
41192                return Err(AuthorError::DanglingRef {
41193                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
41194                });
41195            }
41196        }
41197        StyledItemTargetRef::SurfaceOfRevolution(i) => {
41198            if i.0 >= model.surface_of_revolution_arena.items.len() {
41199                return Err(AuthorError::DanglingRef {
41200                    entity: "SURFACE_OF_REVOLUTION",
41201                });
41202            }
41203        }
41204        StyledItemTargetRef::SweptSurface(i) => {
41205            if i.0 >= model.swept_surface_arena.items.len() {
41206                return Err(AuthorError::DanglingRef {
41207                    entity: "SWEPT_SURFACE",
41208                });
41209            }
41210        }
41211        StyledItemTargetRef::SymbolRepresentation(i) => {
41212            if i.0 >= model.symbol_representation_arena.items.len() {
41213                return Err(AuthorError::DanglingRef {
41214                    entity: "SYMBOL_REPRESENTATION",
41215                });
41216            }
41217        }
41218        StyledItemTargetRef::SymbolTarget(i) => {
41219            if i.0 >= model.symbol_target_arena.items.len() {
41220                return Err(AuthorError::DanglingRef {
41221                    entity: "SYMBOL_TARGET",
41222                });
41223            }
41224        }
41225        StyledItemTargetRef::TessellatedCurveSet(i) => {
41226            if i.0 >= model.tessellated_curve_set_arena.items.len() {
41227                return Err(AuthorError::DanglingRef {
41228                    entity: "TESSELLATED_CURVE_SET",
41229                });
41230            }
41231        }
41232        StyledItemTargetRef::TessellatedFace(i) => {
41233            if i.0 >= model.tessellated_face_arena.items.len() {
41234                return Err(AuthorError::DanglingRef {
41235                    entity: "TESSELLATED_FACE",
41236                });
41237            }
41238        }
41239        StyledItemTargetRef::TessellatedGeometricSet(i) => {
41240            if i.0 >= model.tessellated_geometric_set_arena.items.len() {
41241                return Err(AuthorError::DanglingRef {
41242                    entity: "TESSELLATED_GEOMETRIC_SET",
41243                });
41244            }
41245        }
41246        StyledItemTargetRef::TessellatedItem(i) => {
41247            if i.0 >= model.tessellated_item_arena.items.len() {
41248                return Err(AuthorError::DanglingRef {
41249                    entity: "TESSELLATED_ITEM",
41250                });
41251            }
41252        }
41253        StyledItemTargetRef::TessellatedShapeRepresentation(i) => {
41254            if i.0 >= model.tessellated_shape_representation_arena.items.len() {
41255                return Err(AuthorError::DanglingRef {
41256                    entity: "TESSELLATED_SHAPE_REPRESENTATION",
41257                });
41258            }
41259        }
41260        StyledItemTargetRef::TessellatedShell(i) => {
41261            if i.0 >= model.tessellated_shell_arena.items.len() {
41262                return Err(AuthorError::DanglingRef {
41263                    entity: "TESSELLATED_SHELL",
41264                });
41265            }
41266        }
41267        StyledItemTargetRef::TessellatedSolid(i) => {
41268            if i.0 >= model.tessellated_solid_arena.items.len() {
41269                return Err(AuthorError::DanglingRef {
41270                    entity: "TESSELLATED_SOLID",
41271                });
41272            }
41273        }
41274        StyledItemTargetRef::TessellatedStructuredItem(i) => {
41275            if i.0 >= model.tessellated_structured_item_arena.items.len() {
41276                return Err(AuthorError::DanglingRef {
41277                    entity: "TESSELLATED_STRUCTURED_ITEM",
41278                });
41279            }
41280        }
41281        StyledItemTargetRef::TessellatedSurfaceSet(i) => {
41282            if i.0 >= model.tessellated_surface_set_arena.items.len() {
41283                return Err(AuthorError::DanglingRef {
41284                    entity: "TESSELLATED_SURFACE_SET",
41285                });
41286            }
41287        }
41288        StyledItemTargetRef::TextLiteral(i) => {
41289            if i.0 >= model.text_literal_arena.items.len() {
41290                return Err(AuthorError::DanglingRef {
41291                    entity: "TEXT_LITERAL",
41292                });
41293            }
41294        }
41295        StyledItemTargetRef::TopologicalRepresentationItem(i) => {
41296            if i.0 >= model.topological_representation_item_arena.items.len() {
41297                return Err(AuthorError::DanglingRef {
41298                    entity: "TOPOLOGICAL_REPRESENTATION_ITEM",
41299                });
41300            }
41301        }
41302        StyledItemTargetRef::ToroidalSurface(i) => {
41303            if i.0 >= model.toroidal_surface_arena.items.len() {
41304                return Err(AuthorError::DanglingRef {
41305                    entity: "TOROIDAL_SURFACE",
41306                });
41307            }
41308        }
41309        StyledItemTargetRef::TrimmedCurve(i) => {
41310            if i.0 >= model.trimmed_curve_arena.items.len() {
41311                return Err(AuthorError::DanglingRef {
41312                    entity: "TRIMMED_CURVE",
41313                });
41314            }
41315        }
41316        StyledItemTargetRef::TwoDirectionRepeatFactor(i) => {
41317            if i.0 >= model.two_direction_repeat_factor_arena.items.len() {
41318                return Err(AuthorError::DanglingRef {
41319                    entity: "TWO_DIRECTION_REPEAT_FACTOR",
41320                });
41321            }
41322        }
41323        StyledItemTargetRef::UniformCurve(i) => {
41324            if i.0 >= model.uniform_curve_arena.items.len() {
41325                return Err(AuthorError::DanglingRef {
41326                    entity: "UNIFORM_CURVE",
41327                });
41328            }
41329        }
41330        StyledItemTargetRef::UniformSurface(i) => {
41331            if i.0 >= model.uniform_surface_arena.items.len() {
41332                return Err(AuthorError::DanglingRef {
41333                    entity: "UNIFORM_SURFACE",
41334                });
41335            }
41336        }
41337        StyledItemTargetRef::Vector(i) => {
41338            if i.0 >= model.vector_arena.items.len() {
41339                return Err(AuthorError::DanglingRef { entity: "VECTOR" });
41340            }
41341        }
41342        StyledItemTargetRef::Vertex(i) => {
41343            if i.0 >= model.vertex_arena.items.len() {
41344                return Err(AuthorError::DanglingRef { entity: "VERTEX" });
41345            }
41346        }
41347        StyledItemTargetRef::VertexLoop(i) => {
41348            if i.0 >= model.vertex_loop_arena.items.len() {
41349                return Err(AuthorError::DanglingRef {
41350                    entity: "VERTEX_LOOP",
41351                });
41352            }
41353        }
41354        StyledItemTargetRef::VertexPoint(i) => {
41355            if i.0 >= model.vertex_point_arena.items.len() {
41356                return Err(AuthorError::DanglingRef {
41357                    entity: "VERTEX_POINT",
41358                });
41359            }
41360        }
41361        StyledItemTargetRef::VertexShell(i) => {
41362            if i.0 >= model.vertex_shell_arena.items.len() {
41363                return Err(AuthorError::DanglingRef {
41364                    entity: "VERTEX_SHELL",
41365                });
41366            }
41367        }
41368        StyledItemTargetRef::WireShell(i) => {
41369            if i.0 >= model.wire_shell_arena.items.len() {
41370                return Err(AuthorError::DanglingRef {
41371                    entity: "WIRE_SHELL",
41372                });
41373            }
41374        }
41375        StyledItemTargetRef::Complex(i) => {
41376            if i.0 >= model.complex_unit_arena.items.len() {
41377                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
41378            }
41379        }
41380    }
41381    Ok(())
41382}
41383fn check_supported_item_ref(model: &StepModel, r: &SupportedItemRef) -> Result<(), AuthorError> {
41384    match r {
41385        SupportedItemRef::Action(i) => {
41386            if i.0 >= model.action_arena.items.len() {
41387                return Err(AuthorError::DanglingRef { entity: "ACTION" });
41388            }
41389        }
41390        SupportedItemRef::ActionDirective(i) => {
41391            if i.0 >= model.action_directive_arena.items.len() {
41392                return Err(AuthorError::DanglingRef {
41393                    entity: "ACTION_DIRECTIVE",
41394                });
41395            }
41396        }
41397        SupportedItemRef::ActionMethod(i) => {
41398            if i.0 >= model.action_method_arena.items.len() {
41399                return Err(AuthorError::DanglingRef {
41400                    entity: "ACTION_METHOD",
41401                });
41402            }
41403        }
41404        SupportedItemRef::Complex(i) => {
41405            if i.0 >= model.complex_unit_arena.items.len() {
41406                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
41407            }
41408        }
41409    }
41410    Ok(())
41411}
41412fn check_surface_ref(model: &StepModel, r: &SurfaceRef) -> Result<(), AuthorError> {
41413    match r {
41414        SurfaceRef::BSplineSurface(i) => {
41415            if i.0 >= model.b_spline_surface_arena.items.len() {
41416                return Err(AuthorError::DanglingRef {
41417                    entity: "B_SPLINE_SURFACE",
41418                });
41419            }
41420        }
41421        SurfaceRef::BSplineSurfaceWithKnots(i) => {
41422            if i.0 >= model.b_spline_surface_with_knots_arena.items.len() {
41423                return Err(AuthorError::DanglingRef {
41424                    entity: "B_SPLINE_SURFACE_WITH_KNOTS",
41425                });
41426            }
41427        }
41428        SurfaceRef::BezierSurface(i) => {
41429            if i.0 >= model.bezier_surface_arena.items.len() {
41430                return Err(AuthorError::DanglingRef {
41431                    entity: "BEZIER_SURFACE",
41432                });
41433            }
41434        }
41435        SurfaceRef::BoundedSurface(i) => {
41436            if i.0 >= model.bounded_surface_arena.items.len() {
41437                return Err(AuthorError::DanglingRef {
41438                    entity: "BOUNDED_SURFACE",
41439                });
41440            }
41441        }
41442        SurfaceRef::ConicalSurface(i) => {
41443            if i.0 >= model.conical_surface_arena.items.len() {
41444                return Err(AuthorError::DanglingRef {
41445                    entity: "CONICAL_SURFACE",
41446                });
41447            }
41448        }
41449        SurfaceRef::CylindricalSurface(i) => {
41450            if i.0 >= model.cylindrical_surface_arena.items.len() {
41451                return Err(AuthorError::DanglingRef {
41452                    entity: "CYLINDRICAL_SURFACE",
41453                });
41454            }
41455        }
41456        SurfaceRef::DegenerateToroidalSurface(i) => {
41457            if i.0 >= model.degenerate_toroidal_surface_arena.items.len() {
41458                return Err(AuthorError::DanglingRef {
41459                    entity: "DEGENERATE_TOROIDAL_SURFACE",
41460                });
41461            }
41462        }
41463        SurfaceRef::ElementarySurface(i) => {
41464            if i.0 >= model.elementary_surface_arena.items.len() {
41465                return Err(AuthorError::DanglingRef {
41466                    entity: "ELEMENTARY_SURFACE",
41467                });
41468            }
41469        }
41470        SurfaceRef::OffsetSurface(i) => {
41471            if i.0 >= model.offset_surface_arena.items.len() {
41472                return Err(AuthorError::DanglingRef {
41473                    entity: "OFFSET_SURFACE",
41474                });
41475            }
41476        }
41477        SurfaceRef::Plane(i) => {
41478            if i.0 >= model.plane_arena.items.len() {
41479                return Err(AuthorError::DanglingRef { entity: "PLANE" });
41480            }
41481        }
41482        SurfaceRef::QuasiUniformSurface(i) => {
41483            if i.0 >= model.quasi_uniform_surface_arena.items.len() {
41484                return Err(AuthorError::DanglingRef {
41485                    entity: "QUASI_UNIFORM_SURFACE",
41486                });
41487            }
41488        }
41489        SurfaceRef::RationalBSplineSurface(i) => {
41490            if i.0 >= model.rational_b_spline_surface_arena.items.len() {
41491                return Err(AuthorError::DanglingRef {
41492                    entity: "RATIONAL_B_SPLINE_SURFACE",
41493                });
41494            }
41495        }
41496        SurfaceRef::SphericalSurface(i) => {
41497            if i.0 >= model.spherical_surface_arena.items.len() {
41498                return Err(AuthorError::DanglingRef {
41499                    entity: "SPHERICAL_SURFACE",
41500                });
41501            }
41502        }
41503        SurfaceRef::Surface(i) => {
41504            if i.0 >= model.surface_arena.items.len() {
41505                return Err(AuthorError::DanglingRef { entity: "SURFACE" });
41506            }
41507        }
41508        SurfaceRef::SurfaceOfLinearExtrusion(i) => {
41509            if i.0 >= model.surface_of_linear_extrusion_arena.items.len() {
41510                return Err(AuthorError::DanglingRef {
41511                    entity: "SURFACE_OF_LINEAR_EXTRUSION",
41512                });
41513            }
41514        }
41515        SurfaceRef::SurfaceOfRevolution(i) => {
41516            if i.0 >= model.surface_of_revolution_arena.items.len() {
41517                return Err(AuthorError::DanglingRef {
41518                    entity: "SURFACE_OF_REVOLUTION",
41519                });
41520            }
41521        }
41522        SurfaceRef::SweptSurface(i) => {
41523            if i.0 >= model.swept_surface_arena.items.len() {
41524                return Err(AuthorError::DanglingRef {
41525                    entity: "SWEPT_SURFACE",
41526                });
41527            }
41528        }
41529        SurfaceRef::ToroidalSurface(i) => {
41530            if i.0 >= model.toroidal_surface_arena.items.len() {
41531                return Err(AuthorError::DanglingRef {
41532                    entity: "TOROIDAL_SURFACE",
41533                });
41534            }
41535        }
41536        SurfaceRef::UniformSurface(i) => {
41537            if i.0 >= model.uniform_surface_arena.items.len() {
41538                return Err(AuthorError::DanglingRef {
41539                    entity: "UNIFORM_SURFACE",
41540                });
41541            }
41542        }
41543        SurfaceRef::Complex(i) => {
41544            if i.0 >= model.complex_unit_arena.items.len() {
41545                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
41546            }
41547        }
41548    }
41549    Ok(())
41550}
41551fn check_surface_rendering_properties_ref(
41552    model: &StepModel,
41553    r: &SurfaceRenderingPropertiesRef,
41554) -> Result<(), AuthorError> {
41555    match r {
41556        SurfaceRenderingPropertiesRef::SurfaceRenderingProperties(i) => {
41557            if i.0 >= model.surface_rendering_properties_arena.items.len() {
41558                return Err(AuthorError::DanglingRef {
41559                    entity: "SURFACE_RENDERING_PROPERTIES",
41560                });
41561            }
41562        }
41563    }
41564    Ok(())
41565}
41566fn check_surface_side_style_select_ref(
41567    model: &StepModel,
41568    r: &SurfaceSideStyleSelectRef,
41569) -> Result<(), AuthorError> {
41570    match r {
41571        SurfaceSideStyleSelectRef::PreDefinedSurfaceSideStyle(i) => {
41572            if i.0 >= model.pre_defined_surface_side_style_arena.items.len() {
41573                return Err(AuthorError::DanglingRef {
41574                    entity: "PRE_DEFINED_SURFACE_SIDE_STYLE",
41575                });
41576            }
41577        }
41578        SurfaceSideStyleSelectRef::SurfaceSideStyle(i) => {
41579            if i.0 >= model.surface_side_style_arena.items.len() {
41580                return Err(AuthorError::DanglingRef {
41581                    entity: "SURFACE_SIDE_STYLE",
41582                });
41583            }
41584        }
41585        SurfaceSideStyleSelectRef::Complex(i) => {
41586            if i.0 >= model.complex_unit_arena.items.len() {
41587                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
41588            }
41589        }
41590    }
41591    Ok(())
41592}
41593fn check_surface_style_element_select_ref(
41594    model: &StepModel,
41595    r: &SurfaceStyleElementSelectRef,
41596) -> Result<(), AuthorError> {
41597    match r {
41598        SurfaceStyleElementSelectRef::SurfaceStyleBoundary(i) => {
41599            if i.0 >= model.surface_style_boundary_arena.items.len() {
41600                return Err(AuthorError::DanglingRef {
41601                    entity: "SURFACE_STYLE_BOUNDARY",
41602                });
41603            }
41604        }
41605        SurfaceStyleElementSelectRef::SurfaceStyleControlGrid(i) => {
41606            if i.0 >= model.surface_style_control_grid_arena.items.len() {
41607                return Err(AuthorError::DanglingRef {
41608                    entity: "SURFACE_STYLE_CONTROL_GRID",
41609                });
41610            }
41611        }
41612        SurfaceStyleElementSelectRef::SurfaceStyleFillArea(i) => {
41613            if i.0 >= model.surface_style_fill_area_arena.items.len() {
41614                return Err(AuthorError::DanglingRef {
41615                    entity: "SURFACE_STYLE_FILL_AREA",
41616                });
41617            }
41618        }
41619        SurfaceStyleElementSelectRef::SurfaceStyleParameterLine(i) => {
41620            if i.0 >= model.surface_style_parameter_line_arena.items.len() {
41621                return Err(AuthorError::DanglingRef {
41622                    entity: "SURFACE_STYLE_PARAMETER_LINE",
41623                });
41624            }
41625        }
41626        SurfaceStyleElementSelectRef::SurfaceStyleRendering(i) => {
41627            if i.0 >= model.surface_style_rendering_arena.items.len() {
41628                return Err(AuthorError::DanglingRef {
41629                    entity: "SURFACE_STYLE_RENDERING",
41630                });
41631            }
41632        }
41633        SurfaceStyleElementSelectRef::SurfaceStyleRenderingWithProperties(i) => {
41634            if i.0
41635                >= model
41636                    .surface_style_rendering_with_properties_arena
41637                    .items
41638                    .len()
41639            {
41640                return Err(AuthorError::DanglingRef {
41641                    entity: "SURFACE_STYLE_RENDERING_WITH_PROPERTIES",
41642                });
41643            }
41644        }
41645        SurfaceStyleElementSelectRef::SurfaceStyleSegmentationCurve(i) => {
41646            if i.0 >= model.surface_style_segmentation_curve_arena.items.len() {
41647                return Err(AuthorError::DanglingRef {
41648                    entity: "SURFACE_STYLE_SEGMENTATION_CURVE",
41649                });
41650            }
41651        }
41652        SurfaceStyleElementSelectRef::SurfaceStyleSilhouette(i) => {
41653            if i.0 >= model.surface_style_silhouette_arena.items.len() {
41654                return Err(AuthorError::DanglingRef {
41655                    entity: "SURFACE_STYLE_SILHOUETTE",
41656                });
41657            }
41658        }
41659        SurfaceStyleElementSelectRef::Complex(i) => {
41660            if i.0 >= model.complex_unit_arena.items.len() {
41661                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
41662            }
41663        }
41664    }
41665    Ok(())
41666}
41667fn check_symbol_style_select_ref(
41668    model: &StepModel,
41669    r: &SymbolStyleSelectRef,
41670) -> Result<(), AuthorError> {
41671    match r {
41672        SymbolStyleSelectRef::SymbolColour(i) => {
41673            if i.0 >= model.symbol_colour_arena.items.len() {
41674                return Err(AuthorError::DanglingRef {
41675                    entity: "SYMBOL_COLOUR",
41676                });
41677            }
41678        }
41679    }
41680    Ok(())
41681}
41682fn check_symbol_target_ref(model: &StepModel, r: &SymbolTargetRef) -> Result<(), AuthorError> {
41683    match r {
41684        SymbolTargetRef::SymbolTarget(i) => {
41685            if i.0 >= model.symbol_target_arena.items.len() {
41686                return Err(AuthorError::DanglingRef {
41687                    entity: "SYMBOL_TARGET",
41688                });
41689            }
41690        }
41691    }
41692    Ok(())
41693}
41694fn check_tessellated_item_ref(
41695    model: &StepModel,
41696    r: &TessellatedItemRef,
41697) -> Result<(), AuthorError> {
41698    match r {
41699        TessellatedItemRef::ComplexTriangulatedFace(i) => {
41700            if i.0 >= model.complex_triangulated_face_arena.items.len() {
41701                return Err(AuthorError::DanglingRef {
41702                    entity: "COMPLEX_TRIANGULATED_FACE",
41703                });
41704            }
41705        }
41706        TessellatedItemRef::ComplexTriangulatedSurfaceSet(i) => {
41707            if i.0 >= model.complex_triangulated_surface_set_arena.items.len() {
41708                return Err(AuthorError::DanglingRef {
41709                    entity: "COMPLEX_TRIANGULATED_SURFACE_SET",
41710                });
41711            }
41712        }
41713        TessellatedItemRef::CoordinatesList(i) => {
41714            if i.0 >= model.coordinates_list_arena.items.len() {
41715                return Err(AuthorError::DanglingRef {
41716                    entity: "COORDINATES_LIST",
41717                });
41718            }
41719        }
41720        TessellatedItemRef::RepositionedTessellatedItem(i) => {
41721            if i.0 >= model.repositioned_tessellated_item_arena.items.len() {
41722                return Err(AuthorError::DanglingRef {
41723                    entity: "REPOSITIONED_TESSELLATED_ITEM",
41724                });
41725            }
41726        }
41727        TessellatedItemRef::TessellatedCurveSet(i) => {
41728            if i.0 >= model.tessellated_curve_set_arena.items.len() {
41729                return Err(AuthorError::DanglingRef {
41730                    entity: "TESSELLATED_CURVE_SET",
41731                });
41732            }
41733        }
41734        TessellatedItemRef::TessellatedFace(i) => {
41735            if i.0 >= model.tessellated_face_arena.items.len() {
41736                return Err(AuthorError::DanglingRef {
41737                    entity: "TESSELLATED_FACE",
41738                });
41739            }
41740        }
41741        TessellatedItemRef::TessellatedGeometricSet(i) => {
41742            if i.0 >= model.tessellated_geometric_set_arena.items.len() {
41743                return Err(AuthorError::DanglingRef {
41744                    entity: "TESSELLATED_GEOMETRIC_SET",
41745                });
41746            }
41747        }
41748        TessellatedItemRef::TessellatedItem(i) => {
41749            if i.0 >= model.tessellated_item_arena.items.len() {
41750                return Err(AuthorError::DanglingRef {
41751                    entity: "TESSELLATED_ITEM",
41752                });
41753            }
41754        }
41755        TessellatedItemRef::TessellatedShell(i) => {
41756            if i.0 >= model.tessellated_shell_arena.items.len() {
41757                return Err(AuthorError::DanglingRef {
41758                    entity: "TESSELLATED_SHELL",
41759                });
41760            }
41761        }
41762        TessellatedItemRef::TessellatedSolid(i) => {
41763            if i.0 >= model.tessellated_solid_arena.items.len() {
41764                return Err(AuthorError::DanglingRef {
41765                    entity: "TESSELLATED_SOLID",
41766                });
41767            }
41768        }
41769        TessellatedItemRef::TessellatedStructuredItem(i) => {
41770            if i.0 >= model.tessellated_structured_item_arena.items.len() {
41771                return Err(AuthorError::DanglingRef {
41772                    entity: "TESSELLATED_STRUCTURED_ITEM",
41773                });
41774            }
41775        }
41776        TessellatedItemRef::TessellatedSurfaceSet(i) => {
41777            if i.0 >= model.tessellated_surface_set_arena.items.len() {
41778                return Err(AuthorError::DanglingRef {
41779                    entity: "TESSELLATED_SURFACE_SET",
41780                });
41781            }
41782        }
41783        TessellatedItemRef::Complex(i) => {
41784            if i.0 >= model.complex_unit_arena.items.len() {
41785                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
41786            }
41787        }
41788    }
41789    Ok(())
41790}
41791fn check_tessellated_structured_item_ref(
41792    model: &StepModel,
41793    r: &TessellatedStructuredItemRef,
41794) -> Result<(), AuthorError> {
41795    match r {
41796        TessellatedStructuredItemRef::ComplexTriangulatedFace(i) => {
41797            if i.0 >= model.complex_triangulated_face_arena.items.len() {
41798                return Err(AuthorError::DanglingRef {
41799                    entity: "COMPLEX_TRIANGULATED_FACE",
41800                });
41801            }
41802        }
41803        TessellatedStructuredItemRef::TessellatedFace(i) => {
41804            if i.0 >= model.tessellated_face_arena.items.len() {
41805                return Err(AuthorError::DanglingRef {
41806                    entity: "TESSELLATED_FACE",
41807                });
41808            }
41809        }
41810        TessellatedStructuredItemRef::TessellatedStructuredItem(i) => {
41811            if i.0 >= model.tessellated_structured_item_arena.items.len() {
41812                return Err(AuthorError::DanglingRef {
41813                    entity: "TESSELLATED_STRUCTURED_ITEM",
41814                });
41815            }
41816        }
41817        TessellatedStructuredItemRef::Complex(i) => {
41818            if i.0 >= model.complex_unit_arena.items.len() {
41819                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
41820            }
41821        }
41822    }
41823    Ok(())
41824}
41825fn check_text_or_character_ref(
41826    model: &StepModel,
41827    r: &TextOrCharacterRef,
41828) -> Result<(), AuthorError> {
41829    match r {
41830        TextOrCharacterRef::AnnotationText(i) => {
41831            if i.0 >= model.annotation_text_arena.items.len() {
41832                return Err(AuthorError::DanglingRef {
41833                    entity: "ANNOTATION_TEXT",
41834                });
41835            }
41836        }
41837        TextOrCharacterRef::AnnotationTextCharacter(i) => {
41838            if i.0 >= model.annotation_text_character_arena.items.len() {
41839                return Err(AuthorError::DanglingRef {
41840                    entity: "ANNOTATION_TEXT_CHARACTER",
41841                });
41842            }
41843        }
41844        TextOrCharacterRef::CompositeText(i) => {
41845            if i.0 >= model.composite_text_arena.items.len() {
41846                return Err(AuthorError::DanglingRef {
41847                    entity: "COMPOSITE_TEXT",
41848                });
41849            }
41850        }
41851        TextOrCharacterRef::DefinedCharacterGlyph(i) => {
41852            if i.0 >= model.defined_character_glyph_arena.items.len() {
41853                return Err(AuthorError::DanglingRef {
41854                    entity: "DEFINED_CHARACTER_GLYPH",
41855                });
41856            }
41857        }
41858        TextOrCharacterRef::TextLiteral(i) => {
41859            if i.0 >= model.text_literal_arena.items.len() {
41860                return Err(AuthorError::DanglingRef {
41861                    entity: "TEXT_LITERAL",
41862                });
41863            }
41864        }
41865        TextOrCharacterRef::Complex(i) => {
41866            if i.0 >= model.complex_unit_arena.items.len() {
41867                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
41868            }
41869        }
41870    }
41871    Ok(())
41872}
41873fn check_tolerance_method_definition_ref(
41874    model: &StepModel,
41875    r: &ToleranceMethodDefinitionRef,
41876) -> Result<(), AuthorError> {
41877    match r {
41878        ToleranceMethodDefinitionRef::LimitsAndFits(i) => {
41879            if i.0 >= model.limits_and_fits_arena.items.len() {
41880                return Err(AuthorError::DanglingRef {
41881                    entity: "LIMITS_AND_FITS",
41882                });
41883            }
41884        }
41885        ToleranceMethodDefinitionRef::ToleranceValue(i) => {
41886            if i.0 >= model.tolerance_value_arena.items.len() {
41887                return Err(AuthorError::DanglingRef {
41888                    entity: "TOLERANCE_VALUE",
41889                });
41890            }
41891        }
41892    }
41893    Ok(())
41894}
41895fn check_tolerance_select_ref(
41896    model: &StepModel,
41897    r: &ToleranceSelectRef,
41898) -> Result<(), AuthorError> {
41899    match r {
41900        ToleranceSelectRef::ApproximationToleranceDeviation(_) => {
41901            return Err(AuthorError::NotAp242 {
41902                entity: "APPROXIMATION_TOLERANCE_DEVIATION",
41903            });
41904        }
41905        ToleranceSelectRef::ApproximationToleranceParameter(_) => {
41906            return Err(AuthorError::NotAp242 {
41907                entity: "APPROXIMATION_TOLERANCE_PARAMETER",
41908            });
41909        }
41910    }
41911    Ok(())
41912}
41913fn check_tolerance_zone_ref(model: &StepModel, r: &ToleranceZoneRef) -> Result<(), AuthorError> {
41914    match r {
41915        ToleranceZoneRef::ToleranceZone(i) => {
41916            if i.0 >= model.tolerance_zone_arena.items.len() {
41917                return Err(AuthorError::DanglingRef {
41918                    entity: "TOLERANCE_ZONE",
41919                });
41920            }
41921        }
41922        ToleranceZoneRef::ToleranceZoneWithDatum(i) => {
41923            if i.0 >= model.tolerance_zone_with_datum_arena.items.len() {
41924                return Err(AuthorError::DanglingRef {
41925                    entity: "TOLERANCE_ZONE_WITH_DATUM",
41926                });
41927            }
41928        }
41929        ToleranceZoneRef::Complex(i) => {
41930            if i.0 >= model.complex_unit_arena.items.len() {
41931                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
41932            }
41933        }
41934    }
41935    Ok(())
41936}
41937fn check_tolerance_zone_form_ref(
41938    model: &StepModel,
41939    r: &ToleranceZoneFormRef,
41940) -> Result<(), AuthorError> {
41941    match r {
41942        ToleranceZoneFormRef::ToleranceZoneForm(i) => {
41943            if i.0 >= model.tolerance_zone_form_arena.items.len() {
41944                return Err(AuthorError::DanglingRef {
41945                    entity: "TOLERANCE_ZONE_FORM",
41946                });
41947            }
41948        }
41949    }
41950    Ok(())
41951}
41952fn check_tolerance_zone_target_ref(
41953    model: &StepModel,
41954    r: &ToleranceZoneTargetRef,
41955) -> Result<(), AuthorError> {
41956    match r {
41957        ToleranceZoneTargetRef::AngularLocation(i) => {
41958            if i.0 >= model.angular_location_arena.items.len() {
41959                return Err(AuthorError::DanglingRef {
41960                    entity: "ANGULAR_LOCATION",
41961                });
41962            }
41963        }
41964        ToleranceZoneTargetRef::AngularSize(i) => {
41965            if i.0 >= model.angular_size_arena.items.len() {
41966                return Err(AuthorError::DanglingRef {
41967                    entity: "ANGULAR_SIZE",
41968                });
41969            }
41970        }
41971        ToleranceZoneTargetRef::AngularityTolerance(i) => {
41972            if i.0 >= model.angularity_tolerance_arena.items.len() {
41973                return Err(AuthorError::DanglingRef {
41974                    entity: "ANGULARITY_TOLERANCE",
41975                });
41976            }
41977        }
41978        ToleranceZoneTargetRef::CircularRunoutTolerance(i) => {
41979            if i.0 >= model.circular_runout_tolerance_arena.items.len() {
41980                return Err(AuthorError::DanglingRef {
41981                    entity: "CIRCULAR_RUNOUT_TOLERANCE",
41982                });
41983            }
41984        }
41985        ToleranceZoneTargetRef::CoaxialityTolerance(i) => {
41986            if i.0 >= model.coaxiality_tolerance_arena.items.len() {
41987                return Err(AuthorError::DanglingRef {
41988                    entity: "COAXIALITY_TOLERANCE",
41989                });
41990            }
41991        }
41992        ToleranceZoneTargetRef::ConcentricityTolerance(i) => {
41993            if i.0 >= model.concentricity_tolerance_arena.items.len() {
41994                return Err(AuthorError::DanglingRef {
41995                    entity: "CONCENTRICITY_TOLERANCE",
41996                });
41997            }
41998        }
41999        ToleranceZoneTargetRef::CylindricityTolerance(i) => {
42000            if i.0 >= model.cylindricity_tolerance_arena.items.len() {
42001                return Err(AuthorError::DanglingRef {
42002                    entity: "CYLINDRICITY_TOLERANCE",
42003                });
42004            }
42005        }
42006        ToleranceZoneTargetRef::DatumReferenceCompartment(i) => {
42007            if i.0 >= model.datum_reference_compartment_arena.items.len() {
42008                return Err(AuthorError::DanglingRef {
42009                    entity: "DATUM_REFERENCE_COMPARTMENT",
42010                });
42011            }
42012        }
42013        ToleranceZoneTargetRef::DatumReferenceElement(i) => {
42014            if i.0 >= model.datum_reference_element_arena.items.len() {
42015                return Err(AuthorError::DanglingRef {
42016                    entity: "DATUM_REFERENCE_ELEMENT",
42017                });
42018            }
42019        }
42020        ToleranceZoneTargetRef::DimensionalLocation(i) => {
42021            if i.0 >= model.dimensional_location_arena.items.len() {
42022                return Err(AuthorError::DanglingRef {
42023                    entity: "DIMENSIONAL_LOCATION",
42024                });
42025            }
42026        }
42027        ToleranceZoneTargetRef::DimensionalLocationWithPath(i) => {
42028            if i.0 >= model.dimensional_location_with_path_arena.items.len() {
42029                return Err(AuthorError::DanglingRef {
42030                    entity: "DIMENSIONAL_LOCATION_WITH_PATH",
42031                });
42032            }
42033        }
42034        ToleranceZoneTargetRef::DimensionalSize(i) => {
42035            if i.0 >= model.dimensional_size_arena.items.len() {
42036                return Err(AuthorError::DanglingRef {
42037                    entity: "DIMENSIONAL_SIZE",
42038                });
42039            }
42040        }
42041        ToleranceZoneTargetRef::DimensionalSizeWithDatumFeature(i) => {
42042            if i.0 >= model.dimensional_size_with_datum_feature_arena.items.len() {
42043                return Err(AuthorError::DanglingRef {
42044                    entity: "DIMENSIONAL_SIZE_WITH_DATUM_FEATURE",
42045                });
42046            }
42047        }
42048        ToleranceZoneTargetRef::DimensionalSizeWithPath(i) => {
42049            if i.0 >= model.dimensional_size_with_path_arena.items.len() {
42050                return Err(AuthorError::DanglingRef {
42051                    entity: "DIMENSIONAL_SIZE_WITH_PATH",
42052                });
42053            }
42054        }
42055        ToleranceZoneTargetRef::DirectedDimensionalLocation(i) => {
42056            if i.0 >= model.directed_dimensional_location_arena.items.len() {
42057                return Err(AuthorError::DanglingRef {
42058                    entity: "DIRECTED_DIMENSIONAL_LOCATION",
42059                });
42060            }
42061        }
42062        ToleranceZoneTargetRef::FlatnessTolerance(i) => {
42063            if i.0 >= model.flatness_tolerance_arena.items.len() {
42064                return Err(AuthorError::DanglingRef {
42065                    entity: "FLATNESS_TOLERANCE",
42066                });
42067            }
42068        }
42069        ToleranceZoneTargetRef::GeneralDatumReference(i) => {
42070            if i.0 >= model.general_datum_reference_arena.items.len() {
42071                return Err(AuthorError::DanglingRef {
42072                    entity: "GENERAL_DATUM_REFERENCE",
42073                });
42074            }
42075        }
42076        ToleranceZoneTargetRef::GeometricTolerance(i) => {
42077            if i.0 >= model.geometric_tolerance_arena.items.len() {
42078                return Err(AuthorError::DanglingRef {
42079                    entity: "GEOMETRIC_TOLERANCE",
42080                });
42081            }
42082        }
42083        ToleranceZoneTargetRef::GeometricToleranceWithDatumReference(i) => {
42084            if i.0
42085                >= model
42086                    .geometric_tolerance_with_datum_reference_arena
42087                    .items
42088                    .len()
42089            {
42090                return Err(AuthorError::DanglingRef {
42091                    entity: "GEOMETRIC_TOLERANCE_WITH_DATUM_REFERENCE",
42092                });
42093            }
42094        }
42095        ToleranceZoneTargetRef::GeometricToleranceWithDefinedAreaUnit(i) => {
42096            if i.0
42097                >= model
42098                    .geometric_tolerance_with_defined_area_unit_arena
42099                    .items
42100                    .len()
42101            {
42102                return Err(AuthorError::DanglingRef {
42103                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_AREA_UNIT",
42104                });
42105            }
42106        }
42107        ToleranceZoneTargetRef::GeometricToleranceWithDefinedUnit(i) => {
42108            if i.0
42109                >= model
42110                    .geometric_tolerance_with_defined_unit_arena
42111                    .items
42112                    .len()
42113            {
42114                return Err(AuthorError::DanglingRef {
42115                    entity: "GEOMETRIC_TOLERANCE_WITH_DEFINED_UNIT",
42116                });
42117            }
42118        }
42119        ToleranceZoneTargetRef::GeometricToleranceWithMaximumTolerance(i) => {
42120            if i.0
42121                >= model
42122                    .geometric_tolerance_with_maximum_tolerance_arena
42123                    .items
42124                    .len()
42125            {
42126                return Err(AuthorError::DanglingRef {
42127                    entity: "GEOMETRIC_TOLERANCE_WITH_MAXIMUM_TOLERANCE",
42128                });
42129            }
42130        }
42131        ToleranceZoneTargetRef::GeometricToleranceWithModifiers(i) => {
42132            if i.0 >= model.geometric_tolerance_with_modifiers_arena.items.len() {
42133                return Err(AuthorError::DanglingRef {
42134                    entity: "GEOMETRIC_TOLERANCE_WITH_MODIFIERS",
42135                });
42136            }
42137        }
42138        ToleranceZoneTargetRef::LineProfileTolerance(i) => {
42139            if i.0 >= model.line_profile_tolerance_arena.items.len() {
42140                return Err(AuthorError::DanglingRef {
42141                    entity: "LINE_PROFILE_TOLERANCE",
42142                });
42143            }
42144        }
42145        ToleranceZoneTargetRef::ModifiedGeometricTolerance(i) => {
42146            if i.0 >= model.modified_geometric_tolerance_arena.items.len() {
42147                return Err(AuthorError::DanglingRef {
42148                    entity: "MODIFIED_GEOMETRIC_TOLERANCE",
42149                });
42150            }
42151        }
42152        ToleranceZoneTargetRef::ParallelismTolerance(i) => {
42153            if i.0 >= model.parallelism_tolerance_arena.items.len() {
42154                return Err(AuthorError::DanglingRef {
42155                    entity: "PARALLELISM_TOLERANCE",
42156                });
42157            }
42158        }
42159        ToleranceZoneTargetRef::PerpendicularityTolerance(i) => {
42160            if i.0 >= model.perpendicularity_tolerance_arena.items.len() {
42161                return Err(AuthorError::DanglingRef {
42162                    entity: "PERPENDICULARITY_TOLERANCE",
42163                });
42164            }
42165        }
42166        ToleranceZoneTargetRef::PositionTolerance(i) => {
42167            if i.0 >= model.position_tolerance_arena.items.len() {
42168                return Err(AuthorError::DanglingRef {
42169                    entity: "POSITION_TOLERANCE",
42170                });
42171            }
42172        }
42173        ToleranceZoneTargetRef::RoundnessTolerance(i) => {
42174            if i.0 >= model.roundness_tolerance_arena.items.len() {
42175                return Err(AuthorError::DanglingRef {
42176                    entity: "ROUNDNESS_TOLERANCE",
42177                });
42178            }
42179        }
42180        ToleranceZoneTargetRef::StraightnessTolerance(i) => {
42181            if i.0 >= model.straightness_tolerance_arena.items.len() {
42182                return Err(AuthorError::DanglingRef {
42183                    entity: "STRAIGHTNESS_TOLERANCE",
42184                });
42185            }
42186        }
42187        ToleranceZoneTargetRef::SurfaceProfileTolerance(i) => {
42188            if i.0 >= model.surface_profile_tolerance_arena.items.len() {
42189                return Err(AuthorError::DanglingRef {
42190                    entity: "SURFACE_PROFILE_TOLERANCE",
42191                });
42192            }
42193        }
42194        ToleranceZoneTargetRef::SymmetryTolerance(i) => {
42195            if i.0 >= model.symmetry_tolerance_arena.items.len() {
42196                return Err(AuthorError::DanglingRef {
42197                    entity: "SYMMETRY_TOLERANCE",
42198                });
42199            }
42200        }
42201        ToleranceZoneTargetRef::TotalRunoutTolerance(i) => {
42202            if i.0 >= model.total_runout_tolerance_arena.items.len() {
42203                return Err(AuthorError::DanglingRef {
42204                    entity: "TOTAL_RUNOUT_TOLERANCE",
42205                });
42206            }
42207        }
42208        ToleranceZoneTargetRef::UnequallyDisposedGeometricTolerance(i) => {
42209            if i.0
42210                >= model
42211                    .unequally_disposed_geometric_tolerance_arena
42212                    .items
42213                    .len()
42214            {
42215                return Err(AuthorError::DanglingRef {
42216                    entity: "UNEQUALLY_DISPOSED_GEOMETRIC_TOLERANCE",
42217                });
42218            }
42219        }
42220        ToleranceZoneTargetRef::Complex(i) => {
42221            if i.0 >= model.complex_unit_arena.items.len() {
42222                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
42223            }
42224        }
42225    }
42226    Ok(())
42227}
42228fn check_transformation_ref(model: &StepModel, r: &TransformationRef) -> Result<(), AuthorError> {
42229    match r {
42230        TransformationRef::FunctionallyDefinedTransformation(i) => {
42231            if i.0 >= model.functionally_defined_transformation_arena.items.len() {
42232                return Err(AuthorError::DanglingRef {
42233                    entity: "FUNCTIONALLY_DEFINED_TRANSFORMATION",
42234                });
42235            }
42236        }
42237        TransformationRef::ItemDefinedTransformation(i) => {
42238            if i.0 >= model.item_defined_transformation_arena.items.len() {
42239                return Err(AuthorError::DanglingRef {
42240                    entity: "ITEM_DEFINED_TRANSFORMATION",
42241                });
42242            }
42243        }
42244        TransformationRef::ListItemDefinedTransformation(v) => {
42245            for e in v {
42246                check_item_defined_transformation_ref(model, e)?;
42247            }
42248        }
42249        TransformationRef::SetItemDefinedTransformation(v) => {
42250            for e in v {
42251                check_item_defined_transformation_ref(model, e)?;
42252            }
42253        }
42254        TransformationRef::Complex(i) => {
42255            if i.0 >= model.complex_unit_arena.items.len() {
42256                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
42257            }
42258        }
42259    }
42260    Ok(())
42261}
42262fn check_trimming_select_ref(model: &StepModel, r: &TrimmingSelectRef) -> Result<(), AuthorError> {
42263    match r {
42264        TrimmingSelectRef::ApllPoint(_) => {
42265            return Err(AuthorError::NotAp242 {
42266                entity: "APLL_POINT",
42267            });
42268        }
42269        TrimmingSelectRef::ApllPointWithSurface(_) => {
42270            return Err(AuthorError::NotAp242 {
42271                entity: "APLL_POINT_WITH_SURFACE",
42272            });
42273        }
42274        TrimmingSelectRef::CartesianPoint(i) => {
42275            if i.0 >= model.cartesian_point_arena.items.len() {
42276                return Err(AuthorError::DanglingRef {
42277                    entity: "CARTESIAN_POINT",
42278                });
42279            }
42280        }
42281        TrimmingSelectRef::ParameterValue(_) => {}
42282    }
42283    Ok(())
42284}
42285fn check_two_direction_repeat_factor_ref(
42286    model: &StepModel,
42287    r: &TwoDirectionRepeatFactorRef,
42288) -> Result<(), AuthorError> {
42289    match r {
42290        TwoDirectionRepeatFactorRef::TwoDirectionRepeatFactor(i) => {
42291            if i.0 >= model.two_direction_repeat_factor_arena.items.len() {
42292                return Err(AuthorError::DanglingRef {
42293                    entity: "TWO_DIRECTION_REPEAT_FACTOR",
42294                });
42295            }
42296        }
42297        TwoDirectionRepeatFactorRef::Complex(i) => {
42298            if i.0 >= model.complex_unit_arena.items.len() {
42299                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
42300            }
42301        }
42302    }
42303    Ok(())
42304}
42305fn check_uncertainty_measure_with_unit_ref(
42306    model: &StepModel,
42307    r: &UncertaintyMeasureWithUnitRef,
42308) -> Result<(), AuthorError> {
42309    match r {
42310        UncertaintyMeasureWithUnitRef::UncertaintyMeasureWithUnit(i) => {
42311            if i.0 >= model.uncertainty_measure_with_unit_arena.items.len() {
42312                return Err(AuthorError::DanglingRef {
42313                    entity: "UNCERTAINTY_MEASURE_WITH_UNIT",
42314                });
42315            }
42316        }
42317    }
42318    Ok(())
42319}
42320fn check_unit_ref(model: &StepModel, r: &UnitRef) -> Result<(), AuthorError> {
42321    match r {
42322        UnitRef::AreaUnit(i) => {
42323            if i.0 >= model.area_unit_arena.items.len() {
42324                return Err(AuthorError::DanglingRef {
42325                    entity: "AREA_UNIT",
42326                });
42327            }
42328        }
42329        UnitRef::ContextDependentUnit(i) => {
42330            if i.0 >= model.context_dependent_unit_arena.items.len() {
42331                return Err(AuthorError::DanglingRef {
42332                    entity: "CONTEXT_DEPENDENT_UNIT",
42333                });
42334            }
42335        }
42336        UnitRef::ConversionBasedUnit(i) => {
42337            if i.0 >= model.conversion_based_unit_arena.items.len() {
42338                return Err(AuthorError::DanglingRef {
42339                    entity: "CONVERSION_BASED_UNIT",
42340                });
42341            }
42342        }
42343        UnitRef::DerivedUnit(i) => {
42344            if i.0 >= model.derived_unit_arena.items.len() {
42345                return Err(AuthorError::DanglingRef {
42346                    entity: "DERIVED_UNIT",
42347                });
42348            }
42349        }
42350        UnitRef::LengthUnit(i) => {
42351            if i.0 >= model.length_unit_arena.items.len() {
42352                return Err(AuthorError::DanglingRef {
42353                    entity: "LENGTH_UNIT",
42354                });
42355            }
42356        }
42357        UnitRef::MassUnit(i) => {
42358            if i.0 >= model.mass_unit_arena.items.len() {
42359                return Err(AuthorError::DanglingRef {
42360                    entity: "MASS_UNIT",
42361                });
42362            }
42363        }
42364        UnitRef::NamedUnit(i) => {
42365            if i.0 >= model.named_unit_arena.items.len() {
42366                return Err(AuthorError::DanglingRef {
42367                    entity: "NAMED_UNIT",
42368                });
42369            }
42370        }
42371        UnitRef::PlaneAngleUnit(i) => {
42372            if i.0 >= model.plane_angle_unit_arena.items.len() {
42373                return Err(AuthorError::DanglingRef {
42374                    entity: "PLANE_ANGLE_UNIT",
42375                });
42376            }
42377        }
42378        UnitRef::RatioUnit(i) => {
42379            if i.0 >= model.ratio_unit_arena.items.len() {
42380                return Err(AuthorError::DanglingRef {
42381                    entity: "RATIO_UNIT",
42382                });
42383            }
42384        }
42385        UnitRef::SiUnit(i) => {
42386            if i.0 >= model.si_unit_arena.items.len() {
42387                return Err(AuthorError::DanglingRef { entity: "SI_UNIT" });
42388            }
42389        }
42390        UnitRef::SolidAngleUnit(i) => {
42391            if i.0 >= model.solid_angle_unit_arena.items.len() {
42392                return Err(AuthorError::DanglingRef {
42393                    entity: "SOLID_ANGLE_UNIT",
42394                });
42395            }
42396        }
42397        UnitRef::TimeUnit(i) => {
42398            if i.0 >= model.time_unit_arena.items.len() {
42399                return Err(AuthorError::DanglingRef {
42400                    entity: "TIME_UNIT",
42401                });
42402            }
42403        }
42404        UnitRef::VolumeUnit(i) => {
42405            if i.0 >= model.volume_unit_arena.items.len() {
42406                return Err(AuthorError::DanglingRef {
42407                    entity: "VOLUME_UNIT",
42408                });
42409            }
42410        }
42411        UnitRef::Complex(i) => {
42412            if i.0 >= model.complex_unit_arena.items.len() {
42413                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
42414            }
42415        }
42416    }
42417    Ok(())
42418}
42419fn check_value_qualifier_ref(model: &StepModel, r: &ValueQualifierRef) -> Result<(), AuthorError> {
42420    match r {
42421        ValueQualifierRef::PrecisionQualifier(i) => {
42422            if i.0 >= model.precision_qualifier_arena.items.len() {
42423                return Err(AuthorError::DanglingRef {
42424                    entity: "PRECISION_QUALIFIER",
42425                });
42426            }
42427        }
42428        ValueQualifierRef::TypeQualifier(i) => {
42429            if i.0 >= model.type_qualifier_arena.items.len() {
42430                return Err(AuthorError::DanglingRef {
42431                    entity: "TYPE_QUALIFIER",
42432                });
42433            }
42434        }
42435        ValueQualifierRef::UncertaintyQualifier(i) => {
42436            if i.0 >= model.uncertainty_qualifier_arena.items.len() {
42437                return Err(AuthorError::DanglingRef {
42438                    entity: "UNCERTAINTY_QUALIFIER",
42439                });
42440            }
42441        }
42442        ValueQualifierRef::ValueFormatTypeQualifier(i) => {
42443            if i.0 >= model.value_format_type_qualifier_arena.items.len() {
42444                return Err(AuthorError::DanglingRef {
42445                    entity: "VALUE_FORMAT_TYPE_QUALIFIER",
42446                });
42447            }
42448        }
42449    }
42450    Ok(())
42451}
42452fn check_vector_ref(model: &StepModel, r: &VectorRef) -> Result<(), AuthorError> {
42453    match r {
42454        VectorRef::Vector(i) => {
42455            if i.0 >= model.vector_arena.items.len() {
42456                return Err(AuthorError::DanglingRef { entity: "VECTOR" });
42457            }
42458        }
42459        VectorRef::Complex(i) => {
42460            if i.0 >= model.complex_unit_arena.items.len() {
42461                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
42462            }
42463        }
42464    }
42465    Ok(())
42466}
42467fn check_versioned_action_request_ref(
42468    model: &StepModel,
42469    r: &VersionedActionRequestRef,
42470) -> Result<(), AuthorError> {
42471    match r {
42472        VersionedActionRequestRef::VersionedActionRequest(i) => {
42473            if i.0 >= model.versioned_action_request_arena.items.len() {
42474                return Err(AuthorError::DanglingRef {
42475                    entity: "VERSIONED_ACTION_REQUEST",
42476                });
42477            }
42478        }
42479    }
42480    Ok(())
42481}
42482fn check_vertex_ref(model: &StepModel, r: &VertexRef) -> Result<(), AuthorError> {
42483    match r {
42484        VertexRef::Vertex(i) => {
42485            if i.0 >= model.vertex_arena.items.len() {
42486                return Err(AuthorError::DanglingRef { entity: "VERTEX" });
42487            }
42488        }
42489        VertexRef::VertexPoint(i) => {
42490            if i.0 >= model.vertex_point_arena.items.len() {
42491                return Err(AuthorError::DanglingRef {
42492                    entity: "VERTEX_POINT",
42493                });
42494            }
42495        }
42496        VertexRef::Complex(i) => {
42497            if i.0 >= model.complex_unit_arena.items.len() {
42498                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
42499            }
42500        }
42501    }
42502    Ok(())
42503}
42504fn check_vertex_loop_ref(model: &StepModel, r: &VertexLoopRef) -> Result<(), AuthorError> {
42505    match r {
42506        VertexLoopRef::VertexLoop(i) => {
42507            if i.0 >= model.vertex_loop_arena.items.len() {
42508                return Err(AuthorError::DanglingRef {
42509                    entity: "VERTEX_LOOP",
42510                });
42511            }
42512        }
42513    }
42514    Ok(())
42515}
42516fn check_view_volume_ref(model: &StepModel, r: &ViewVolumeRef) -> Result<(), AuthorError> {
42517    match r {
42518        ViewVolumeRef::ViewVolume(i) => {
42519            if i.0 >= model.view_volume_arena.items.len() {
42520                return Err(AuthorError::DanglingRef {
42521                    entity: "VIEW_VOLUME",
42522                });
42523            }
42524        }
42525        ViewVolumeRef::Complex(i) => {
42526            if i.0 >= model.complex_unit_arena.items.len() {
42527                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
42528            }
42529        }
42530    }
42531    Ok(())
42532}
42533fn check_work_item_ref(model: &StepModel, r: &WorkItemRef) -> Result<(), AuthorError> {
42534    match r {
42535        WorkItemRef::ProductDefinitionFormation(i) => {
42536            if i.0 >= model.product_definition_formation_arena.items.len() {
42537                return Err(AuthorError::DanglingRef {
42538                    entity: "PRODUCT_DEFINITION_FORMATION",
42539                });
42540            }
42541        }
42542        WorkItemRef::ProductDefinitionFormationWithSpecifiedSource(i) => {
42543            if i.0
42544                >= model
42545                    .product_definition_formation_with_specified_source_arena
42546                    .items
42547                    .len()
42548            {
42549                return Err(AuthorError::DanglingRef {
42550                    entity: "PRODUCT_DEFINITION_FORMATION_WITH_SPECIFIED_SOURCE",
42551                });
42552            }
42553        }
42554        WorkItemRef::Complex(i) => {
42555            if i.0 >= model.complex_unit_arena.items.len() {
42556                return Err(AuthorError::DanglingRef { entity: "COMPLEX" });
42557            }
42558        }
42559    }
42560    Ok(())
42561}