cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

pro_model_item, id is not unique?

JB_87049
15-Moonstone

pro_model_item, id is not unique?

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.

 

ACCEPTED SOLUTION

Accepted Solutions
FabianWolf
13-Aquamarine
(To:JB_87049)

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.

View solution in original post

3 REPLIES 3
FabianWolf
13-Aquamarine
(To:JB_87049)

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_87049
15-Moonstone
(To:FabianWolf)

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.

FabianWolf
13-Aquamarine
(To:JB_87049)

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.

Announcements


Top Tags