Skip to main content
15-Moonstone
March 12, 2020
Solved

pro_model_item, id is not unique?

  • March 12, 2020
  • 1 reply
  • 1913 views

A hopefully not too dumb question.

In toolkit, in the structure pro_model_item which is used by ProDimension, ProAnnotation, ProAnnotationElem amongst others you have 3 structure members

typedef struct pro_model_item
{
 ProType type;
 int id;
 ProMdl owner;
}

I thought the id would be unique but apparently this is not the case (e.g. a gtol and a datum tag). So I was wondering should they be unique and what is the purpose of this id?

Any help is much appreciated.

 

Best answer by FabianWolf

If there are e.g. 20 notes or rather ProAnnotation's in the part, the ProModelitem's representing them only differ in the id. The type is of course the same (PRO_NOTE) as they're all notes and the owner is also the same because they exist in the same model. The id is the only attribute allowing to distinguish them.

1 reply

14-Alexandrite
March 12, 2020

Every valid modelitem is indeed unique within a part model. As you point out correctly, a modelitem doesn't only consist  of the id but also of type and owning model. The combination of all three elements builds the uniqueness.

 

Exception: In an assembly context a certain component can be assembled multiple times. In this case a modelitem is not really unique anymore, because it exists in every assembled instance of the component. In order to distinguish these modelitems, you have to build up a ProSelection by providing the assembly component path (ProAsmcomppath) of the owning component instance.

JB_8704915-MoonstoneAuthor
15-Moonstone
March 12, 2020

Thank you for your response. The fact that the combination of the three structure items is unique is logical. However,
The structure item
   ProMdl owner

ProMdl is a typedef for void * so this holds a memory address. I guess this points to a structure holding the model (part, assembly, ...) that holds this annotation. So that leaves type and id. I'm still wondering whether this is always unique and what the purpose of the id is? In my opinion, from a database point of view, the id should be unique unless its purpose differs from what the name suggests.

14-Alexandrite
March 12, 2020

If there are e.g. 20 notes or rather ProAnnotation's in the part, the ProModelitem's representing them only differ in the id. The type is of course the same (PRO_NOTE) as they're all notes and the owner is also the same because they exist in the same model. The id is the only attribute allowing to distinguish them.