niedzviedz
Mechanical
- Apr 1, 2012
- 307
Hello everyone,
I have some problem with titleblock. Everything works great, when drawing has only one sheet. When I add more (by file import part, I have macro to do that), the cells on the second sheet looks similar to this: [REMARKS] or [DESIGNED BY], [ORDER] etc. Then I have to manually go to that sheet and then click populate title block, next put enter on each cell. After that everything looks the same like on first sheet. Next thing is, that I need use this drawing in next order, so I have journal to change values on each model in assembly to new ones. But on drawing which has more than one sheet, stays values from previous order. I think, there is some error in nx code.
That's why I record some journal to update this for me. I have title blocks for few company's we work, so the cells are different for each company. The best way will be, if journal will be the same for all, but I think it's not possible. Bellow is some code I created (now its only for one cell).
First thing I would like to change is the declaration of title block, because now it will work only in this example:
second thing is to list all cell labels in title block, so I don't have to place them manually.
Any one can help me to solve this?
With best regards
Michael
I have some problem with titleblock. Everything works great, when drawing has only one sheet. When I add more (by file import part, I have macro to do that), the cells on the second sheet looks similar to this: [REMARKS] or [DESIGNED BY], [ORDER] etc. Then I have to manually go to that sheet and then click populate title block, next put enter on each cell. After that everything looks the same like on first sheet. Next thing is, that I need use this drawing in next order, so I have journal to change values on each model in assembly to new ones. But on drawing which has more than one sheet, stays values from previous order. I think, there is some error in nx code.
That's why I record some journal to update this for me. I have title blocks for few company's we work, so the cells are different for each company. The best way will be, if journal will be the same for all, but I think it's not possible. Bellow is some code I created (now its only for one cell).
Code:
Option Strict Off
Imports System
Imports NXOpen
Module NXJournal
Sub Main (ByVal args() As String)
Dim theSession As NXOpen.Session = NXOpen.Session.GetSession()
Dim workPart As NXOpen.Part = theSession.Parts.Work
Dim displayPart As NXOpen.Part = theSession.Parts.Display
Dim lw As ListingWindow = theSession.ListingWindow
lw.Open()
Dim markId1 As NXOpen.Session.UndoMarkId
markId1 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Visible, "Start")
Dim titleblocks1(1) As NXOpen.Annotations.TitleBlock
Dim titleBlock1 As NXOpen.Annotations.TitleBlock = CType(workPart.FindObject("HANDLE R-1251327"), NXOpen.Annotations.TitleBlock)
titleblocks1(0) = titleBlock1
Dim titleBlock2 As NXOpen.Annotations.TitleBlock = CType(workPart.FindObject("HANDLE R-1289660"), NXOpen.Annotations.TitleBlock)
titleblocks1(1) = titleBlock2
Dim editTitleBlockBuilder1 As NXOpen.Annotations.EditTitleBlockBuilder
editTitleBlockBuilder1 = workPart.DraftingManager.TitleBlocks.CreateEditTitleBlockBuilder(titleblocks1)
Dim titleBlockCellBuilderList1 As NXOpen.Annotations.TitleBlockCellBuilderList
titleBlockCellBuilderList1 = editTitleBlockBuilder1.Cells
theSession.SetUndoMarkName(markId1, "Populate Title Block Dialog")
Dim markId4 As NXOpen.Session.UndoMarkId
markId4 = theSession.SetUndoMark(NXOpen.Session.MarkVisibility.Invisible, "Populate Title Block")
dim text(14) as string
text(0) = editTitleBlockBuilder1.getCellValueForLabel("REMARKS")
text(0) = editTitleBlockBuilder1.setCellValueForLabel("REMARKS", text(0))
lw.close
end sub
End module
First thing I would like to change is the declaration of title block, because now it will work only in this example:
Code:
Dim titleBlock1 As NXOpen.Annotations.TitleBlock = CType(workPart.FindObject("HANDLE R-1251327"), NXOpen.Annotations.TitleBlock)
titleblocks1(0) = titleBlock1
Dim titleBlock2 As NXOpen.Annotations.TitleBlock = CType(workPart.FindObject("HANDLE R-1289660"), NXOpen.Annotations.TitleBlock)
titleblocks1(1) = titleBlock2
second thing is to list all cell labels in title block, so I don't have to place them manually.
Any one can help me to solve this?
With best regards
Michael