GetReferenceKey

GetReferenceKey

Anonymous
Not applicable
544 Views
1 Reply
Message 1 of 2

GetReferenceKey

Anonymous
Not applicable
Have any body idea about the GetReferenceKey method of classes. I got a sample code from some where and tried to get the key for each face of a part but what i found that it is the same for most faces and only different for one or two face. Can any body help in this matter.

Thanks

Manoj
0 Likes
545 Views
1 Reply
Reply (1)
Message 2 of 2

Anonymous
Not applicable
Manoj,

 

The keys are unique for faces/edges/surface bodies
etc., and I see no problem in getting these keys. My best guess is that your
method

of comparing the keys is incorrect.

 

As a test trying highlighting the faces for which
you have obtained the keys. And then bind the key back to the face and then
highlight again.

With this you would notice that in both cases it is
refering to the same key.

 

 

Sub testRefKeys()
    Dim oDoc As
PartDocument
    Dim nKeyCont As Long
   

    Set oDoc =
ThisApplication.ActiveDocument
   

        Dim oCompDef As
PartComponentDefinition
        Set
oCompDef =
oDoc.ComponentDefinition
       

        ' Get the key
context
        ' Calling this method is a
must
       

        nKeyCont =
oDoc.ReferenceKeyManager.CreateKeyContext
       

        Dim oFace As
Face
        Set oFace =
oCompDef.SurfaceBodies(0).Faces(1)
       

        oDoc.HighlightSets.Add.AddItem
oFace
       

        'Get the reference Key from
face
        Dim oFaceRef() As
Byte
        Call
oFace.GetReferenceKey(oFaceRef,
nKeyCont)
               

        'Now get the face from the
Reference Key
        Dim oFacenew As
Face
        Set oFacenew =
oDoc.ReferenceKeyManager.BindKeyToObject(oFaceRef,
nKeyCont)
       

        oDoc.HighlightSets.Add.AddItem
oFacenew
 
End Sub

 

 

Cheers

Thilak

 

 



style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">

Have any body idea about the GetReferenceKey method of classes. I got a
sample code from some where and tried to get the key for each face of a part
but what i found that it is the same for most faces and only different for one
or two face. Can any body help in this matter.

Thanks

Manoj

0 Likes