cancel
Showing results for 
Search instead for 
Did you mean: 

Converting a component to its Part equivalent

Builder
Builder

How do convert a component to its Part equivalent.

I want to get the "FullPath" of the component and the only way I know how to get that is by getting its Part.

Is there a better way of doing this without having to get the Part?

6 REPLIES

Re: Converting a component to its Part equivalent

Honored Contributor
Honored Contributor

If all you want to do is get the full path to the component part, you can use:

 

theComponent.Prototype.OwningPart.FullPath

 

Which is essentially the same as getting the part, but you can do it in one line of code and you don't need to maintain a separate variable referencing the part.

Re: Converting a component to its Part equivalent

Builder
Builder
I do that and it says the owning part is null. Any idea why?
CONFIDENTIALITY WARNING: This email communication and any attachments contain privileged and confidential information intended only for the use of the intended recipient. If the reader of this communication is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution, use or reproduction of this communication or its attached contents is prohibited. If you have received this communication in error, please notify us immediately by return email and delete this message and any attachment from your system.

Re: Converting a component to its Part equivalent

Honored Contributor
Honored Contributor

Is the component loaded? If not, you will get a null reference.

 

You can use the .AskComponentData function that will return the part name even if the component is not loaded.

Re: Converting a component to its Part equivalent

Builder
Builder
Where is that method located? It isn't part of the Component class.
CONFIDENTIALITY WARNING: This email communication and any attachments contain privileged and confidential information intended only for the use of the intended recipient. If the reader of this communication is not the intended recipient, or the employee or agent responsible to deliver it to the intended recipient, you are hereby notified that any dissemination, distribution, use or reproduction of this communication or its attached contents is prohibited. If you have received this communication in error, please notify us immediately by return email and delete this message and any attachment from your system.

Re: Converting a component to its Part equivalent

Siemens Phenom Siemens Phenom
Siemens Phenom

It's in the Open C interface

 

NXOpen.UF.UFAssem.AskComponentData

Re: Converting a component to its Part equivalent

Honored Contributor
Honored Contributor

Here's an incomplete code snippet showing its use:

 

Dim partName As String = ""
Dim refsetName As String = ""
Dim instanceName As String = ""
Dim origin(2) As Double
Dim csysMatrix(8) As Double
Dim transform(3, 3) As Double

Try
    If theComp.Prototype.OwningPart.IsFullyLoaded Then
        'component is fully loaded
    Else
        'component is partially loaded
    End If

Catch ex As NullReferenceException
    'component is not loaded
    theUfSession.Assem.AskComponentData(theComponent.Tag, partName, refsetName, instanceName, origin, csysMatrix, transform)

Catch ex As NXException
    'handle exception
    
End Try