Cancel
Showing results for 
Search instead for 
Did you mean: 

Bounding Box of View and Dimensioning

Pioneer
Pioneer

Hello Team,

 

We want to get the bounding of views so that we will place the remaining with reference to bounding box of fron view.

 

How do we create/place dimensions to views?

 

Please let us know your views soon.

11 REPLIES

Re: Bounding Box of View and Dimensioning

Siemens Phenom Siemens Phenom
Siemens Phenom

 

If your question is related to drawing member views, you can use UF_DRAW_ask_view_borders() to get X and Y minimum and maximum values, in drawing coordinates.  This is also wrapped for use in NX Open .Net as AskViewBorders.

 

 

Re: Bounding Box of View and Dimensioning

Pioneer
Pioneer

Thanks steve, what about dimensing to views. I want to create overall dimension to front & righ views without any user selection using NXOPEN. I have recorded Journal there is huge code for single dimension and I could not pass hard coded values e.g. drafting curve so need proper code.

 

Re: Bounding Box of View and Dimensioning

Experimenter
Experimenter
Which language do you need?

Re: Bounding Box of View and Dimensioning

Pioneer
Pioneer
VB.NET NXOPEN

Re: Bounding Box of View and Dimensioning

Pioneer
Pioneer

VB.NET using NXOPEN.

Re: Bounding Box of View and Dimensioning

Pioneer
Pioneer

Hello Team,

Kindly help me to find the bounding box dimensions of the view placed in NX10.0 Dwg file using VB.net for NXOpen. I've shared my code snippet.

 

Public Sub FrontViewPlace(ByVal theSession As NXOpen.Session, ByVal workPartDwg As NXOpen.Part, ByVal childPart3D As NXOpen.Part)
        Try
            Dim part1 As NXOpen.Part = childPart3D

            Dim viewCreationWizardBuilder1 As NXOpen.Drawings.ViewCreationWizardBuilder

            viewCreationWizardBuilder1 = part1.DraftingViews.CreateViewCreationWizardBuilder()

            viewCreationWizardBuilder1.MultipleViewPlacement.ViewPlacementCenter.Associative = True

            viewCreationWizardBuilder1.BaseView = "FRONT"

            viewCreationWizardBuilder1.SpecialBaseView = False

            viewCreationWizardBuilder1.ViewRepresentation = NXOpen.Drawings.ViewCreationWizardBuilder.ViewRepresentations.SmartLightweight

            viewCreationWizardBuilder1.Resolution = NXOpen.Drawings.ViewCreationWizardBuilder.ResolutionOption.Medium

            Dim loadStatus1 As Boolean
            loadStatus1 = part1.IsFullyLoaded

            viewCreationWizardBuilder1.Part = part1

            Dim nullNXOpen_Assemblies_Arrangement As NXOpen.Assemblies.Arrangement = Nothing

            viewCreationWizardBuilder1.ViewStyle.ViewStyleBase.Arrangement.SelectedArrangement = nullNXOpen_Assemblies_Arrangement

            viewCreationWizardBuilder1.BaseView = "FRONT"

            viewCreationWizardBuilder1.ViewStyle.ViewStyleBase.Part = part1

            viewCreationWizardBuilder1.ViewStyle.ViewStyleBase.PartName = part1.FullPath

            viewCreationWizardBuilder1.ViewScale.Numerator = 1.0

            viewCreationWizardBuilder1.PlacementOption = NXOpen.Drawings.ViewCreationWizardBuilder.Option.Manual

            'viewCreationWizardBuilder1.MultipleViewPlacement.OptionType = NXOpen.Drawings.MultipleViewPlacementBuilder.Option.Center

           
            'Dim workPart As NXOpen.Part = theSession.Parts.Work
            'Dim displayPart As NXOpen.Part = theSession.Parts.Display


            Dim point1 As NXOpen.Point3d = New NXOpen.Point3d(420.5, 297.0, 0.0)
            viewCreationWizardBuilder1.MultipleViewPlacement.ViewPlacementCenter.Placement.SetValue(Nothing, workPartDwg.Views.WorkView, point1)

            Dim nXObject3 As NXOpen.NXObject
            nXObject3 = viewCreationWizardBuilder1.Commit()

            Dim objects2() As NXOpen.NXObject
            objects2 = viewCreationWizardBuilder1.GetCommittedObjects()

            viewCreationWizardBuilder1.Destroy()

            Dim partSaveStatus1 As NXOpen.PartSaveStatus
            partSaveStatus1 = workPartDwg.Save(NXOpen.BasePart.SaveComponents.True, NXOpen.BasePart.CloseAfterSave.False)
            partSaveStatus1.Dispose()

            Dim view_borders(3) As Double
'Retrieve the dimensions of Bounding Box of Front View Dim dc As DrawingSheetCollection = workPartDwg.DrawingSheets For Each sheet As DrawingSheet In dc Dim dw As DraftingView() = sheet.GetDraftingViews() For Each vw As DraftingView In dw MsgBox(" View Name: " + vw.Name) Try theUfSession.Draw.AskViewBorders(vw.Tag, view_borders) Catch ex As Exception End Try Next Next Catch ex As Exception End Try End Sub

Can't get the dimensions of Bounding Box for 'Front@1 view' in view_borders. 

 

Kindly let me know whrer I'm going wrong and help me with this soon.

 

 

Kind Regards,

Juhi.

Re: Bounding Box of View and Dimensioning

Siemens Phenom Siemens Phenom
Siemens Phenom

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.Drawings
Imports NXOpen.UF

Module report_corners_of_drawing_member_views

    Dim theSession As Session = Session.GetSession()
    Dim theUFSession As UFSession = UFSession.GetUFSession()

    Sub Main()

        Dim workPart As Part = theSession.Parts.Work
        Dim dc As DrawingSheetCollection = workPart.DrawingSheets
        Dim view_borders(3) As Double

        For Each thisSheet As DrawingSheet In dc
            Echo("Sheet: " & thisSheet.Name())
            Dim dw As DraftingView() = thisSheet.GetDraftingViews()
            For Each vw As DraftingView In dw
                Echo("   Member View Name: " + vw.Name)
                Try
                    theUFSession.Draw.AskViewBorders(vw.Tag, view_borders)
                    Echo("      Lower  Left at: " & view_borders(0) & ", " & view_borders(1))
                    Echo("      Upper Right at: " & view_borders(2) & ", " & view_borders(3))
                Catch ex As Exception
                End Try
            Next
            Echo("   ")
        Next

    End Sub

    Sub Echo(ByVal output As String)

        theSession.ListingWindow.Open()
        theSession.ListingWindow.WriteLine(output)
        theSession.LogFile.WriteLine(output)

    End Sub

    Public Function GetUnloadOption(ByVal dummy As String) As Integer
        Return Session.LibraryUnloadOption.Immediately
    End Function

End Module

Re: Bounding Box of View and Dimensioning

Pioneer
Pioneer
Hello,
Thank You for your help. I've applied your code. But I could not reach out to the desired output. Since I'm novice to the NX Customization, I've been facing problems.
I've attached the snapshot of "NX Exception" which I'm getting. Also I've attached the Input Part files on which I'm running the code.
In anticipation of your help to the problem.


Regards
Juhi Gupta

Re: Bounding Box of View and Dimensioning

Pioneer
Pioneer

Hello,

Thank You for your help. I’ve applied your code. But I could not reach out to the desired output. Since I’m novice to the NX Customization, I’ve been facing problems.

I’ve attached the snapshot of “NX Exception” which I’m getting. Also I’ve attached the Input Part files on which I’m running the code.

In anticipation of your help to the problem.

 

 

Regards

Juhi Gupta