import, insert in WCS center

I need to import the part in the zero point of the WCS.
If WCS is offset relative to the absolute coordinate system, then when i import some part into WCS, the values of X Y Z is not zero, I enter the zeros. Journal recorded non-zero values and then imports the part is not in WCS:

Dim destinationPoint1 As NXOpen.Point3d = New NXOpen.Point3d(45.0, 41.0, 25.0)
How to assign the zero point of the WCS???
Or how solve my problem?

Dim partImporter1 As NXOpen.PartImporter
partImporter1 = workPart.ImportManager.CreatePartImporter()
partImporter1.FileName = "D:\macro\comp1.prt"
partImporter1.Scale = 1.0
partImporter1.CreateNamedGroup = False
partImporter1.ImportViews = False
partImporter1.ImportCamObjects = False
partImporter1.LayerOption = NXOpen.PartImporter.LayerOptionType.Work
partImporter1.DestinationCoordinateSystemSpecification = NXOpen.PartImporter.DestinationCoordinateSystemSpecificationType.Work
Dim element1 As NXOpen.Matrix3x3
element1.Xx = 1.0
element1.Xy = 0.0
element1.Xz = 0.0
element1.Yx = 0.0
element1.Yy = 1.0
element1.Yz = 0.0
element1.Zx = 0.0
element1.Zy = 0.0
element1.Zz = 1.0
Dim nXMatrix1 As NXOpen.NXMatrix
nXMatrix1 = workPart.NXMatrices.Create(element1)
partImporter1.DestinationCoordinateSystem = nXMatrix1
Dim destinationPoint1 As NXOpen.Point3d = New NXOpen.Point3d(45.0, 41.0, 25.0)
partImporter1.DestinationPoint = destinationPoint1
Dim markId2 As NXOpen.Session.UndoMarkId
markId2 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Import Part Commit")
Dim nXObject1 As NXOpen.NXObject
nXObject1 = partImporter1.Commit()
theSession.DeleteUndoMark(markId2, Nothing)
partImporter1.Destroy()

Do you truly want to import the part or do you want to add it as a component to your current file?

Importing the part will bring in a copy of all the geometry to the target part. All of the sketches, extrudes, etc will show up in the target part's part navigator.

Adding the part as a component will allow you to view the geometry, but will not import the parent geometry into your part. This is the preferred method when creating an assembly.

Yes, I want to import this part. In fact, this part contains 2D information for the technologist, signs and symbols, consisting of curves. It does not contain any sketches, drawing, etc., geometry imported into it from *.cgm file. Actual this is the standard template. I need to create a fragment of code that is able to import such templates in WCS.

The journal records the coordinates of the fixed point, and does not work for any of the provisions of WCS, that's my problem.

I hope that you will help to get the ball rolling..

Try changing the destination point to the WCS origin. Similarly, you could change the orientation to the WCS orientation if you desire to do so.

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

Dim theSession As Session = Session.GetSession()
Dim theUfSession As UFSession = UFSession.GetUFSession()

Sub Main()

If IsNothing(theSession.Parts.BaseWork) Then
'active part required
Return
End If

Dim workPart As Part = theSession.Parts.Work
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()

Const undoMarkName As String = "import part to WCS"
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, undoMarkName)

Dim partImporter1 As PartImporter
partImporter1 = workPart.ImportManager.CreatePartImporter()

'change the following line to point to the part you want to import
partImporter1.FileName = "C:\Temp\import_block.prt"
partImporter1.Scale = 1.0
partImporter1.CreateNamedGroup = False
partImporter1.ImportViews = False
partImporter1.ImportCamObjects = False
partImporter1.LayerOption = PartImporter.LayerOptionType.Work
partImporter1.DestinationCoordinateSystemSpecification = PartImporter.DestinationCoordinateSystemSpecificationType.Work

Dim element1 As Matrix3x3
element1.Xx = 1.0
element1.Xy = 0.0
element1.Xz = 0.0
element1.Yx = 0.0
element1.Yy = 1.0
element1.Yz = 0.0
element1.Zx = 0.0
element1.Zy = 0.0
element1.Zz = 1.0
Dim nXMatrix1 As NXMatrix
nXMatrix1 = workPart.NXMatrices.Create(element1)

partImporter1.DestinationCoordinateSystem = nXMatrix1

'set destination point to WCS origin
Dim destinationPoint1 As Point3d = workPart.WCS.Origin
partImporter1.DestinationPoint = destinationPoint1

Dim nXObject1 As NXObject
nXObject1 = partImporter1.Commit()

partImporter1.Destroy()

lw.Close()

End Sub

Public Function GetUnloadOption(ByVal dummy As String) As Integer

'Unloads the image immediately after execution within NX
GetUnloadOption = NXOpen.Session.LibraryUnloadOption.Immediately

End Function

End Module

Thank you so much! It work! =)