Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations waross on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NX9 Journal File to Import Part to Multiple Drafting Sheets

Status
Not open for further replies.

MattBaumann

Mechanical
Oct 9, 2013
26
0
0
US
I currently have a journal file to delete all of my old titleblocks (from all sheets at once). Then I have to go to each sheet individually and run smaller journal files to import the titleblock of choice. Instead, I would like to import my new titleblock into every sheet in 1 step. Does anyone know of a journal file out there that could accomplish something like this or how does everyone else do this?

Thanks for any help,

Matt
 
Replies continue below

Recommended for you

Ha! If only we had interns year around here. I could combine the two journals, but it only imports the part to the active sheet. It would be nice if it imported the part to all sheets in the drafting file. If I had a journal file to accomplish that, then I could combine them and have all titleblocks replaced in one fell swoop. I wish Import->Part had an option to import into all sheets at once.
 
Take the code that imports the block and convert it into functions and/or subroutines as necessry. Then loop through the drawing sheets and import the title block to each. Something like:

Code:
for each theSheet as DrawingSheet in workpart.DrawingSheets
    theSheet.Open
    'call function or sub to import title block
    Call ImportBlock()
next

www.nxjournaling.com
 
I guess this will have to be a future project for me. I will first have to spend a little time on :)

Currently I just recorded a journal to import my part. It works and I guess that's all that matters. Haha. Thanks cowski and when I find more time to attack this I'll bug you again.

Option Strict Off
Imports System
Imports NXOpen

Module NXJournal
Sub Main (ByVal args() As String)

Dim theSession As Session = Session.GetSession()
Dim workPart As Part = theSession.Parts.Work

Dim displayPart As Part = theSession.Parts.Display

' ----------------------------------------------
' Menu: File->Import->Part...
' ----------------------------------------------
Dim markId1 As Session.UndoMarkId
markId1 = theSession.SetUndoMark(Session.MarkVisibility.Visible, "Import Part")

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

partImporter1.FileName = "N:\NX9\Titleblocks\Drawing-A0-Detail-template.prt"

partImporter1.Scale = 1.0

partImporter1.CreateNamedGroup = True

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(0.0, 0.0, 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()

' ----------------------------------------------
' Menu: Tools->Journal->Stop Recording
' ----------------------------------------------

End Sub
End Module
 
Status
Not open for further replies.
Back
Top