×
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

Get all hole center points in a drawing using NXopen ?

Get all hole center points in a drawing using NXopen ?

Get all hole center points in a drawing using NXopen ?

(OP)
Hi All ,

How to get all the holes center points using NXOpen in a drawing file?

Regards,
Amitabh

RE: Get all hole center points in a drawing using NXopen ?

Why NXOpen?

maybe this can also helpfull
turn on the new NX6 Hole Table creation in drafting
set the variable  UGII_DRAFTING_HOLE_TABLE=1

Then you can use "Insert/Table/ Hole Table..."

best regards!

RE: Get all hole center points in a drawing using NXopen ?

(OP)
Thanks for the information.
I need to add notes to the holes in the drawing using NX open code.
Hence i wish to retrieve the center points of each of the holes in the drawing with respect to the drawing co-ordinate system.

Regards

RE: Get all hole center points in a drawing using NXopen ?

Hi biw01,

This is more complicated than you might think. I had designed some software for a client who had the same wishes.

There are multiple points you need to consider:


    What exactly is a "hole"? This is a vague term; NX works with features. Therefore, a SUBTRACT feature with a cylindrical form could be considered a hole. So are holes created with the NX hole feature, which consequently have their own types. In addition, you might have to think about holes created using instance geometries, holes created in circular / linear patterns, hole series, etc..

    Most features (not ALL!) have locations. SUBTRACT features, for example, do not. In this case you will need to determine the circular edges which belong to this feature, for example.

    From your hole locations you will need to map them to the view for which you want to create the labels.

Marc
NX Software Developer

RE: Get all hole center points in a drawing using NXopen ?

Here is a journal (part of a larger program) which give all info including hole centres for HolePackage feature. Hope this gets you strarted.

CODE -->

Imports System Imports NXOpen Imports NXOpen.Features Imports NXOpen.UF Public Class report_selected_hole_feature ' class members Private Shared s As Session = Session.GetSession Private Shared theUI As UI = UI.GetUI Private Shared lw As ListingWindow = s.ListingWindow Private Shared workPart As Part = s.Parts.Work Private Shared ufs As UFSession = UFSession.GetUFSession() Public Shared Function Main(ByVal args() As String) As Integer lw.Open() Dim dp As Part = s.Parts.Work Dim featname As String For Each feat As Feature In dp.Features If feat.FeatureType = "HOLE PACKAGE" Then featname = feat.GetFeatureName lw.WriteLine("Feature type: " & feat.FeatureType _ & " Feature name: " + feat.GetFeatureName _ & " Class type: " & feat.GetType.FullName) report_holepackage_feature(feat) End If Next Return 0 End Function Public Shared Function report_holepackage_feature(ByRef hpFeat As HolePackage) As Integer Dim hpBuilder As HolePackageBuilder = workPart.Features.CreateHolePackageBuilder(hpFeat) Dim hType As HolePackageBuilder.Types = hpBuilder.Type lw.WriteLine(" Type: " & hType.ToString()) If hType = HolePackageBuilder.Types.GeneralHole Then Dim hForm As HolePackageBuilder.HoleForms = hpBuilder.GeneralHoleForm lw.WriteLine(" Form: " & hForm.ToString()) End If Dim dia1 As Double = Nothing Dim arc_data As NXOpen.UF.UFEval.Arc = Nothing Dim cnt1 As Integer = 0 Dim bodies() As Body = hpFeat.GetBodies() ' Dim edges1() As Edge Dim edgetype1 As Integer = Nothing For Each bd As Body In bodies lw.WriteLine(" Body: " & bd.ToString()) Next Dim origins() As Point3d Dim model_pt(2) As Double Dim map_pt(1) As Double Dim datapnt(1) As Double hpFeat.GetOrigins(origins) For Each pt As Point3d In origins lw.WriteLine(" Origin: " & pt.ToString()) model_pt(0) = pt.X model_pt(1) = pt.Y model_pt(2) = pt.Z Next Dim exprs() As Expression = hpFeat.GetExpressions() For Each exp As Expression In exprs If exp.Equation.StartsWith("p") Then lw.WriteLine(" Expression: " & exp.Equation & " " & exp.Description) Else lw.WriteLine("Depth = THRU Hole") End If Next End Function End Class

Regards

Frank Swinkels

RE: Get all hole center points in a drawing using NXopen ?

(OP)
Thanks Frank , i will try this code snippet and will let you know if i need more help.

Thanks once again.

Amitabh

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