DesEngineer4
Mechanical
- Feb 19, 2013
- 181
HI ALL,
Can any one help me in the below issue.
I am using the below recorded journal form NX 7.5 to import some label charts in my drafting interface.
(Please see the attachments)
I need this journal to ask the user to pick a point (select point). This journal is placing the label in the same place
where I have recorded the journal. So, if it asks for the point then it is easy for the user.
Thanks in Advance
Thanks & Regards,
Sam
Can any one help me in the below issue.
I am using the below recorded journal form NX 7.5 to import some label charts in my drafting interface.
(Please see the attachments)
I need this journal to ask the user to pick a point (select point). This journal is placing the label in the same place
where I have recorded the journal. So, if it asks for the point then it is easy for the user.
Thanks in Advance
Code:
Option Strict Off
Imports System
Imports NXOpen
Module NXJournal
Sub Main
Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work
Dim displayPart As Part = theSession.Parts.Display
' ----------------------------------------------
' Menu: File->Import->Parasolid...
' ----------------------------------------------
' ----------------------------------------------
' Menu: File->Import->Part...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Import Part")
Dim importer1 As Importer
importer1 = workPart.ImportManager.CreatePartImporter()
Dim partImporter1 As PartImporter = CType(importer1, PartImporter)
partImporter1.FileName = "D:\Lean\Practice\toleranceblock_ideas.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
Dim destinationPoint1 As Point3d = New Point3d(3.55135030864198, 6.07986111111111, 0.0)
partImporter1.DestinationPoint = destinationPoint1
Dim markId2 As Session.UndoMarkId
markId2 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Import Part Commit")
Dim nXObject1 As NXObject
nXObject1 = partImporter1.Commit()
theSession.DeleteUndoMark(markId2, Nothing)
partImporter1.Destroy()
Dim markId3 As Session.UndoMarkId
markId3 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Import Part")
Dim importer2 As Importer
importer2 = workPart.ImportManager.CreatePartImporter()
Dim partImporter2 As PartImporter = CType(importer2, PartImporter)
partImporter2.FileName = "D:\Lean\Practice\toleranceblock_ideas.prt"
partImporter2.Scale = 1.0
partImporter2.CreateNamedGroup = False
partImporter2.ImportViews = False
partImporter2.ImportCamObjects = False
partImporter2.LayerOption = PartImporter.LayerOptionType.Work
partImporter2.DestinationCoordinateSystemSpecification = PartImporter.DestinationCoordinateSystemSpecificationType.Work
Dim element2 As Matrix3x3
element2.Xx = 1.0
element2.Xy = 0.0
element2.Xz = 0.0
element2.Yx = 0.0
element2.Yy = 1.0
element2.Yz = 0.0
element2.Zx = 0.0
element2.Zy = 0.0
element2.Zz = 1.0
Dim nXMatrix2 As NXMatrix
nXMatrix2 = workPart.NXMatrices.Create(element2)
partImporter2.DestinationCoordinateSystem = nXMatrix2
Dim destinationPoint2 As Point3d = New Point3d(3.55135030864198, 6.07986111111111, 0.0)
partImporter2.DestinationPoint = destinationPoint2
Dim markId4 As Session.UndoMarkId
markId4 = theSession.SetUndoMark(Session.MarkVisibility.Invisible, "Import Part Commit")
Dim nXObject2 As NXObject
nXObject2 = partImporter2.Commit()
theSession.DeleteUndoMark(markId4, Nothing)
partImporter2.Destroy()
Dim scaleAboutPoint1 As Point3d = New Point3d(-8.60493827160494, -2.71593364197531, 0.0)
Dim viewCenter1 As Point3d = New Point3d(8.60493827160494, 2.71593364197531, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint1, viewCenter1)
Dim scaleAboutPoint2 As Point3d = New Point3d(-7.37873456790124, -2.04367283950617, 0.0)
Dim viewCenter2 As Point3d = New Point3d(7.37873456790123, 2.04367283950617, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint2, viewCenter2)
Dim scaleAboutPoint3 As Point3d = New Point3d(-5.90298765432099, -1.63493827160494, 0.0)
Dim viewCenter3 As Point3d = New Point3d(5.90298765432098, 1.63493827160494, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint3, viewCenter3)
Dim scaleAboutPoint4 As Point3d = New Point3d(-4.72239012345679, -1.30795061728395, 0.0)
Dim viewCenter4 As Point3d = New Point3d(4.72239012345679, 1.30795061728395, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint4, viewCenter4)
Dim scaleAboutPoint5 As Point3d = New Point3d(-3.77791209876543, -1.04636049382716, 0.0)
Dim viewCenter5 As Point3d = New Point3d(3.77791209876543, 1.04636049382716, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint5, viewCenter5)
Dim scaleAboutPoint6 As Point3d = New Point3d(-3.02232967901234, -0.83708839506173, 0.0)
Dim viewCenter6 As Point3d = New Point3d(3.02232967901234, 0.837088395061727, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint6, viewCenter6)
Dim scaleAboutPoint7 As Point3d = New Point3d(-2.41786374320988, -0.669670716049385, 0.0)
Dim viewCenter7 As Point3d = New Point3d(2.41786374320988, 0.669670716049381, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint7, viewCenter7)
Dim scaleAboutPoint8 As Point3d = New Point3d(-1.9342909945679, -0.535736572839508, 0.0)
Dim viewCenter8 As Point3d = New Point3d(1.9342909945679, 0.535736572839504, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(1.25, scaleAboutPoint8, viewCenter8)
Dim scaleAboutPoint9 As Point3d = New Point3d(-1.38953148997531, -0.126321044543212, 0.0)
Dim viewCenter9 As Point3d = New Point3d(1.38953148997531, 0.126321044543208, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(0.8, scaleAboutPoint9, viewCenter9)
Dim scaleAboutPoint10 As Point3d = New Point3d(-1.73691436246914, -0.146622640987656, 0.0)
Dim viewCenter10 As Point3d = New Point3d(1.73691436246914, 0.146622640987653, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(0.8, scaleAboutPoint10, viewCenter10)
Dim scaleAboutPoint11 As Point3d = New Point3d(-2.17114295308642, -0.18327830123457, 0.0)
Dim viewCenter11 As Point3d = New Point3d(2.17114295308642, 0.183278301234566, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(0.8, scaleAboutPoint11, viewCenter11)
Dim scaleAboutPoint12 As Point3d = New Point3d(-2.7051172345679, -0.229097876543211, 0.0)
Dim viewCenter12 As Point3d = New Point3d(2.7051172345679, 0.229097876543208, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(0.8, scaleAboutPoint12, viewCenter12)
Dim scaleAboutPoint13 As Point3d = New Point3d(-3.38139654320987, -0.27535802469136, 0.0)
Dim viewCenter13 As Point3d = New Point3d(3.38139654320987, 0.275358024691356, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(0.8, scaleAboutPoint13, viewCenter13)
Dim scaleAboutPoint14 As Point3d = New Point3d(-3.70356543209876, 0.564483950617281, 0.0)
Dim viewCenter14 As Point3d = New Point3d(3.70356543209876, -0.564483950617284, 0.0)
workPart.Views.WorkView.ZoomAboutPoint(0.8, scaleAboutPoint14, viewCenter14)
' ----------------------------------------------
' Menu: View->Operation->Fit
' ----------------------------------------------
workPart.Views.WorkView.Fit()
' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------
End Sub
End Module
Thanks & Regards,
Sam