i have a Question that i cannot seem to wrap my head around:
I have some Code that I start with a 3D model open and that generates me a new Drawing of that part (I am using Master-Model , so drawing and 3D are different entities). Next I want my code to add a Symbol on that Drawing . The tested Code is from a JOurnal and does exactly that, but when i execute it in the context of my big Macro, the Symbols are added to the Modelling (3D) Application of the Drafting instead of the Drafting itself even though i specifically run some code that switches to the Drafting Application!
Is there a way i can specify in the CustomSymbolBuilder that the Symbol has to be added to the Drafting View?
Here is the Code, that adds the Symbols:
Dim thatSession As Session = Session.GetSession()
Dim workPart As Part = thatSession.Parts.Work
Dim displayPart As Part = thatSession.Parts.Display
Dim I As Integer = 0
'switch to drafting View
Dim ThatUFSession As UFSession = UFSession.GetUFSession
For I = 0 To Anzahl
Dim nullAnnotations_CustomSymbol As Annotations.CustomSymbol = Nothing
Dim draftingCustomSymbolBuilder1 As Annotations.DraftingCustomSymbolBuilder
draftingCustomSymbolBuilder1 = Workpart.Annotations.CustomSymbols.CreateDraftingCustomSymbolBuilder(nullAnnotations_CustomSymbol)
draftingCustomSymbolBuilder1.SelectSymbol("\\fsprmc01\CADHOME\Drawing_Standard\General\SYMBOLS\Key Characteristic Symbol.sym.prt")
Dim nullView As View = Nothing
Dim point1 As Point3d = New Point3d(345, 120 - I * 6, 0.0)
draftingCustomSymbolBuilder1.Origin.Origin.SetValue(Nothing, nullView, point1)
Dim nXObject1 As NXObject
Dim Txt() As Object = draftingCustomSymbolBuilder1.Texts().GetContents
draftingCustomSymbolBuilder1.ControlledNoteTitle = 2
draftingCustomSymbolBuilder1.ControlledNoteTitle = I + 2
nXObject1 = draftingCustomSymbolBuilder1.Commit()
Thanks a lot for your Help!
I think you actually have to open the drawing, not just set the display state.
Record a journal where you start in modeling (e.g. TOP view), then open "sheet 1".
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled