×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Create Linked Exterior using NX open

Create Linked Exterior using NX open

Create Linked Exterior using NX open

(OP)
I am trying to create a linked exterior using VB.NET code.Even though i provide my program with a selected body and a face to create the linked exterior , the selected face is not getting attached to the body using code.
Any reason why the face is not getting attached ?

PFB the code below

Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        'Dim dPart As Part = s.Parts.WorkComponent
        Dim bodies(0) As Body

        bodies(0) = sBody
        Dim comps(bodies.Length - 1) As Assemblies.Component
        Dim xforms(bodies.Length - 1) As NXOpen.Tag
        Dim body_tags(bodies.Length - 1) As NXOpen.Tag
        Dim proto As NXObject
        'MsgBox("running")
        Try

            For ii As Integer = 0 To bodies.Length - 1
                If bodies(ii).IsOccurrence() Then
                    comps(ii) = bodies(ii).OwningComponent
                    proto = bodies(ii).Prototype
                    body_tags(ii) = proto.Tag
                    ufs.So.CreateXformAssyCtxt(comps(ii).Tag, _
                        comps(ii).Tag, NXOpen.Tag.Null, xforms(ii))
                    MsgBox("running1")
                Else
                    comps(ii) = Nothing
                    body_tags(ii) = bodies(ii).Tag
                    xforms(ii) = NXOpen.Tag.Null
                    MsgBox("running2")
                End If
            Next
            'MsgBox("running")
            Dim directions(,) As Double = _
                {{1, 0, 0}}
            Dim n_faces As Integer = 1
            Dim faces(0) As Tag
            faces(0) = sTag
            Dim comp_index() As Integer = Nothing

            'comp_index(comp_index.Length - 1) = 1
            'MsgBox("running")

            'ufs.Modl.IdentifyExteriorUsingHl(bodies.Length, body_tags, _
            '    xforms, 6, directions, _
            '    0.0254, _
            '    UFConstants.UF_LINKED_HL_RES_COARSE, n_faces, faces, comp_index)
            'MsgBox("running")
            'body_tags(0) = bodyTag
            Dim extData As UFModl.LinkedExt
            With extData
                .at_timestamp = False
                .bodies = body_tags
                .delete_openings = True
                .faces = faces
                .group_results = UFConstants.UF_LINKED_EXT_GROUP_NONE
                .mass_props = True
                .num_bodies = bodies.Length
                .num_faces = faces.Length
                .xform_index = comp_index
                .xforms = xforms
            End With
            'MsgBox("running")
            Dim extFeat As NXOpen.Tag = Nothing
            Dim mark As Session.UndoMarkId = s.SetUndoMark( _
                Session.MarkVisibility.Visible, "Create Linked Exterior")

            ufs.Modl.CreateLinkedExterior(extData, extFeat)

            'MsgBox("running")
            Dim n_groups As Integer
            Dim groups() As NXOpen.Tag = Nothing
            Dim n_subfeats As Integer
            Dim subfeats() As NXOpen.Tag = Nothing
            Dim mass_props(46) As Double

            ufs.Modl.AskLinkedExterior(extFeat, extData, n_groups, groups, _
                n_subfeats, subfeats, mass_props)

            Dim bList As ArrayList = New ArrayList
            Dim bTag As NXOpen.Tag

            For ii As Integer = 0 To n_subfeats - 1
                ufs.Modl.AskFeatBody(subfeats(ii), bTag)
                bList.Add(bTag)
            Next
            MsgBox("done")
            'Dim bTags() As NXOpen.Tag = bList.ToArray(GetType(NXOpen.Tag))
            'ufs.Modl.DeleteBodyParms(bTags)
            'ufs.Ps.ExportData(bTags, "C:\temp\export_test.x_t")
        Catch ex As Exception
            MsgBox(ex.StackTrace + Chr(13) + Chr(13) + Chr(13) + ex.Message)
        End Try
    End Sub

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources