niedzviedz
Mechanical
- Apr 1, 2012
- 307
Hello,
I wanna create journal to select drafting view and then toggle between hidden lines invisible or dashed.
I create some code, but I need help.
I receive an errors: (I translate it to english, so there maybe some misunderstanding)
[ul]
[li]line 28 - There is no arguments for selview [/li]
[li]line 28 - You cannot convert from type nxopen.drawings.draftingview to string [/li]
[li]line 41 - draftview is not declared [/li]
[/ul]
With best regards
Michael
I wanna create journal to select drafting view and then toggle between hidden lines invisible or dashed.
I create some code, but I need help.
Code:
Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF
Imports NXOpen.UI
Module Module1
Dim theSession As Session = Session.GetSession()
Dim ui As UI = UI.GetUI()
Dim ufs 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()
Dim theDrftView As Drawings.DraftingView
Dim response1 as Selection.Response = Selection.Response.Cancel
start1:
response1 = SelectDraftingView(theDrftView)
EditView(theDrftView)
end1:
End Sub
Sub EditView(ByVal thedrafview as drawings.DraftingView)
Dim markId3 As Session.UndoMarkId
Dim dimname1 As String = Nothing
For Each selectedView As View In theDrftView
dimname1 = selectedView.ToString()
If dimname1.Contains("projected") = True Then
Dim projectedView1 As Drawings.ProjectedView = selectedView
projectedView1.Style.HiddenLines.HiddenlineFont = Preferences.Font.Invisible
workPart.DraftingViews.SuppressViewBreaks(projectedView1)
projectedView1.Commit()
workPart.DraftingViews.RestoreViewBreaks(projectedView1)
end if
Next
Dim nErrs1 As Integer
nErrs1 = theSession.UpdateManager.DoUpdate(markId3)
End Sub
Function SelectDraftingView(ByVal prompt As String, ByRef selView As Drawings.DraftingView) As
Selection.Response
Dim theUI As UI = UI.GetUI
Dim title As String = "Select a drafting view"
Dim includeFeatures As Boolean = False
Dim keepHighlighted As Boolean = False
Dim selAction As Selection.SelectionAction = Selection.SelectionAction.ClearAndEnableSpecific
Dim cursor As Point3d
Dim scope As Selection.SelectionScope = Selection.SelectionScope.WorkPart
Dim selectionMask_array(0) As Selection.MaskTriple
Dim selObj As TaggedObject
With selectionMask_array(0)
.Type = UFConstants.UF_view_type
.Subtype = UFConstants.UF_all_subtype
End With
Dim resp As Selection.Response = theUI.SelectionManager.SelectTaggedObject(prompt, _
title, scope, selAction, _
includeFeatures, keepHighlighted, selectionMask_array, _
selObj, cursor)
If resp = Selection.Response.ObjectSelected OrElse resp = Selection.Response.ObjectSelectedByName Then
selView = CType(selObj, Drawings.DraftingView)
Return Selection.Response.Ok
Else
Return Selection.Response.Cancel
End If
End Function
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
[ul]
[li]line 28 - There is no arguments for selview [/li]
[li]line 28 - You cannot convert from type nxopen.drawings.draftingview to string [/li]
[li]line 41 - draftview is not declared [/li]
[/ul]
With best regards
Michael