cancel
Showing results for 
Search instead for 
Did you mean: 

Drafting Inferred Dimension

Experimenter
Experimenter

I using journal to edit the hole dimension(counterbore) according to ASME standard by appending text and symbol. My current method is using inferred dimension to create the default annotation, and then use the journal to select the created annotation(using selectobject) and modify it.

What i want to achieve is combine the inferred dimension and the modification(the journal)together as one step, but i don't know how to call the inferred dimension method. Beside, the selectobject method doesn't allow me to select the curve or point for dimensioning purpose.

How can i call those standard function like create view, create parallel dimension, etc. Is it possible to show those standard dialogs and handle the event from it?

6 REPLIES

Re: Drafting Inferred Dimension

Phenom
Phenom

If your drafting standard is set to ASME and the hole callout dimension doesn't comply to the standard, I'd suggest raising the issue with GTAC so it can be fixed.

Re: Drafting Inferred Dimension

Experimenter
Experimenter
thx for the reply, my main concern is on the programming part instead of the integrity of the built in standard.

Re: Drafting Inferred Dimension

Siemens Phenom Siemens Phenom
Siemens Phenom

As far as I know, there is no way for an NX/Open program to display one of NX's built-in dialogs (which I think is what you're trying to do). There's a (small) chance that some clever combination of NX/Open and macros and SendKeys might work, but it will be messy and fragile.

 

So, better to create your own UI that allows the user to select objects, and then create the dimensions. It will be difficult to do all the inferencing that NX does, so your function might need to be more explicit about what results are desired.

山田
yamada

Re: Drafting Inferred Dimension

Experimenter
Experimenter
So how can I select the curve/edge in drafting and proceed for dimensioning? It seems like I can only select annotations, view, sketches(I tried all the masktriples already)

Re: Drafting Inferred Dimension

Esteemed Contributor
Esteemed Contributor

First, I would try a plain selection with NO masking.

Try hover over the edge - see if you can select the edge in quick-pick dialog.

Make sure selection is set to "entire assembly" (not work part only)?

Ken Akerboom Sr CAx Systems Engr, Moog, Inc.
Production: NX10.0.3.5 MP5 + patch/TC11.2
I'd rather be e-steemed than e-diseaseled


Re: Drafting Inferred Dimension

Phenom
Phenom

My point was that you should not need custom programming to create an annotation that complies with a standard. If NX is set to use a certain standard and it doesn't create callouts to that standard, it should be brought to the attention of the developers.

 

Anyway, until it gets fixed, here is one method to allow the user to select drafting curves (I assume you are using NX 9?).

 

Option Strict Off
Imports System
Imports NXOpen
Imports NXOpen.UF

Module Module1

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

    Dim init_proc_ref As UFUi.SelInitFnT = AddressOf init_proc_body

    Sub Main()

        Dim lw As ListingWindow = theSession.ListingWindow
        lw.Open()

        Dim theDraftingCurve As Drawings.DraftingCurve
        Dim theViewTag As Tag
        Dim theView As View

        theDraftingCurve = SelectDraftingCurve("Select a drafting curve", theViewTag)
        If theDraftingCurve Is Nothing Then
            Exit Sub
        End If

        theView = Utilities.NXObjectManager.Get(theViewTag)

        lw.WriteLine("selected from view: " & theView.Name)

        lw.Close()

    End Sub


    Function SelectDraftingCurve(ByVal prompt As String, ByRef objView As Tag) As Drawings.DraftingCurve

        Dim response As Integer = 0
        Dim objs() As Tag = Nothing
        Dim user_data As System.IntPtr
        Dim selTag As Tag = Nothing
        Dim cursor(2) As Double
        Dim view As Tag = Nothing

        theUFSession.Ui.LockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)

        Dim cursorView As Integer
        theUFSession.Ui.AskCursorView(cursorView)
        theUFSession.Ui.SetCursorView(0)

        Try
            theUFSession.Ui.SelectWithSingleDialog("Select Drafting Curve: ", prompt, _
                UFConstants.UF_UI_SEL_SCOPE_ANY_IN_ASSEMBLY, init_proc_ref, _
                user_data, response, selTag, cursor, view)
            objView = view
        Finally
            theUFSession.Ui.UnlockUgAccess(UFConstants.UF_UI_FROM_CUSTOM)
        End Try

        If Not selTag.Equals(Tag.Null) Then
            'the SelectWithSingleDialog method returns a tag,
            'return the object from the given tag
            Dim tempCurve As Drawings.DraftingCurve
            theUFSession.Disp.SetHighlight(selTag, 0)
            tempCurve = Utilities.NXObjectManager.Get(selTag)
            theUFSession.Ui.SetCursorView(cursorView)
            Return tempCurve
        Else
            theUFSession.Ui.SetCursorView(cursorView)
            Return Nothing
        End If

    End Function

    Function init_proc_body(ByVal select_ As IntPtr, _
                                  ByVal userdata As IntPtr) As Integer
        'this function must have the same signature as UFUi.SelInitFnT Delegate

        'setup mask to filter for curves
        Dim num_triples As Integer = 4
        Dim mask_triples As UFUi.Mask() = New UFUi.Mask(3) {}
        mask_triples(0).object_type = UFConstants.UF_line_type
        mask_triples(0).object_subtype = 0
        mask_triples(0).solid_type = 0
        mask_triples(1).object_type = UFConstants.UF_circle_type
        mask_triples(1).object_subtype = 0
        mask_triples(1).solid_type = 0
        mask_triples(2).object_type = UFConstants.UF_spline_type
        mask_triples(2).object_subtype = 0
        mask_triples(2).solid_type = 0
        mask_triples(3).object_type = UFConstants.UF_solid_silhouette_type
        mask_triples(3).object_subtype = 0
        mask_triples(3).solid_type = 0


        theUFSession.Ui.SetSelMask(select_, _
                          UFUi.SelMaskAction.SelMaskClearAndEnableSpecific, _
                          num_triples, mask_triples)

        Return UFConstants.UF_UI_SEL_SUCCESS

    End Function

    Public Function GetUnloadOption(ByVal dummy As String) As Integer

        'Unloads the image when the NX session terminates
        GetUnloadOption = NXOpen.Session.LibraryUnloadOption.AtTermination

    End Function

End Module