Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

NX Journal - Finding Tag of Component in Assembly knowing displayname 1

Status
Not open for further replies.

jmarkus

Mechanical
Jul 11, 2001
377
0
16
CA
Hi,

I have a journal that identifies a component (child) in an old assembly, and then checks to see how many of that component is in a new assembly (newcomponent), using the below wrapper:

Code:
ufs.Assem.AskOccsOfPart(newcomponent.Prototype.OwningPart.Tag, child.Prototype.OwningPart.Tag,numOccs)

I would like to access the actual instance of the component in that new assembly in order to display it on the screen using DisplayManager.ShowObjects. I can't just reference the "child" since that is the component in the old assembly. How would I find the reference of its occurrence in the new assembly?

Thanks,
Jeff
 
Replies continue below

Recommended for you

The .AskOccsOfPart function takes 3 arguments: tag of the parent part, tag of the part, and an empty array of tags (passed byref). The function will use the tag array to return the tags of the occurrences. The return value of the function is the number of instances.

How is "numOccs" defined and used in your code? If it is an integer, your code should look something like:
Code:
dim numOccs as integer
dim occTags() as tag
numOccs = ufs.Assem.AskOccsOfPart(newcomponent.Prototype.OwningPart.Tag, child.Prototype.OwningPart.Tag, occTags())

www.nxjournaling.com
 
Cowski,

Thanks for your comment. Yes, I am using ufs.Assem.AskOccsOfPart to return the number of instances of a component in the 'newcomponent' assembly, as you suggest:

Code:
QTY=ufs.Assem.AskOccsOfPart(newcomponent.Prototype.OwningPart.Tag, child.Prototype.OwningPart.Tag,numOccs)

(where QTY is an integer)

I forgot that the 3rd parameter returns the tags of the occurrences, since before all I was using it for was a count. Now I want to actually access these objects in ShowObject/HideObject operations. So I guess I'm already halfway there - I have the tags of the right objects, I just need help making them into displayable objects.

Jeff



 
The NXObjectManager will help you get an object from its tag. Since we know these tags represent components, we can do something like this:
Code:
For Each temp As Tag In occTags
    Dim myComp As Assemblies.Component
    myComp = Utilities.NXObjectManager.Get(temp)

If we don't know the object types beforehand or if we are dealing with multiple object types, we'd have to convert them to something more generic, like a TaggedObject.

www.nxjournaling.com
 
Status
Not open for further replies.
Back
Top