Showing results for 
Search instead for 
Do you mean 
Reply

Read hole callout dimension (NX Open)

[ Edited ]

Hi,

I am trying to read drawing dimensions to a file. I used workPart.Dimensions.ToArray() method. Linear dimensions are fine. However, dimensions that made with "hole callout"(Radial Dimension-> Mesurement -> Hole Callout) have more than one entity in the array. For example, a general hole will have three dimensions in the array (HoleDimension 119341, RadiusDimension 160698, RadiusDimension 160672). Is in NX Open or UG Open a function that relates these dimensions?

I found ufs.Drf.AskControllingMemberOfCallout(callout, out controllingMember); in UG Open but this function does not work for hole callout Tag.

Can somebody tell me how can I relate those dimentions?

Thank you,

Regards,

15 REPLIES

Re: Read hole callout dimension (NX Open)

Looks like you need to go through

RadialDimensionBuilder.Style.HoleCalloutSettings.GetListOfParameters and  GetNthParameterValue(..)

 

Re: Read hole callout dimension (NX Open)

[ Edited ]

Hi,

Thank you for your reply.

Right now I am using RadialDimensionBuilder.Style.HoleCalloutSettings.G​etListOfParameters.

 

For the hole 1/4-20 <#D> .250  <#D> .500

                     Tap Drilling <o> .201

I got the following list of parameters displayed:

 

ThreadSize True

ThreadDepth False

Depth True

LineBreak False

Pitch False

Angle False

LineBreak False

MinorDiameter False

LineBreak False

MajorDiameter False

LineBreak False

TapDrillDiameter False

 

Thread Depth, and Tap Drill Dia. are false but they are displayed.

Here the first problem I am not able to say exactly what display and what not.

The second problem, since I've got the hole callout from radiaDimensionBuilder, I need to skip values of this hole callout in dimensions array. How can I do it?

The dimensions array gives me for the same hole callout the following list of dimensions:

 

HoleDimension 69827

1/4-20 RadiusDimension 64745

0.250 RadiusDimension 69408

0.500 RadiusDimension 68330

0.050 RadiusDimension 68303

60.000° MinorAngularDimension 68336

0.190 RadiusDimension 69461

0.250 RadiusDimension 69489

0.201 RadiusDimension 69453

 

 

 

 

 

 

Re: Read hole callout dimension (NX Open)

@ntr,

What version of NX are you using? I ask because when I run your code, I get an error: "external component has thrown an exception". I'm running NX 9.0.3.4

Re: Read hole callout dimension (NX Open)

I have NX 10.0.3.5. Holecallout setting builder was introduce in NX 9. I have an external error when the component with hole is not loaded fully.

 

Re: Read hole callout dimension (NX Open)

[ Edited ]

For my test case, I created a new part and drawing in the same file; so I know it is fully loaded.

 

It works for you in NX 9?

 

I'll have to load NX 10 and try there.

Re: Read hole callout dimension (NX Open)

yes for me it work in NX9 and 10, but in the code above I missing line that opens listing window.

 

theSession.ListingWindow.Open();

 

Re: Read hole callout dimension (NX Open)

//Here is a Journal I copy:

 

using NXOpen;
using NXOpen.UF;
using NXOpen.Annotations;
using NXOpen.Features;

public class HoleCycle
{

    public static void Main(string[] args)
    {
        NXOpen.Session theSession = NXOpen.Session.GetSession();
        NXOpen.Part workPart = theSession.Parts.Work;
        NXOpen.Part displayPart = theSession.Parts.Display;
        NXOpen.UF.UFSession ufs = UFSession.GetUFSession();
        theSession.ListingWindow.Open();
        var dimensions = workPart.Dimensions.ToArray();
        for (var i = 0; i < dimensions.Length; i++)
        {
            var dim = dimensions[i];
            if (!(dim is OrdinateOriginDimension))
            {
                if (dim is HoleDimension)
                {
                    var radiaDimensionBuilder = workPart.Dimensions.CreateRadialDimensionBuilder(dim);
                    if ((int)radiaDimensionBuilder.Measurement.Method == 9)
                    {
                        var holeCalloutSettings = radiaDimensionBuilder.Style.HoleCalloutSettings;
                        NXObject holeDimType = radiaDimensionBuilder.FirstAssociativity.Value;
                        var holeDimTypeHolePackage = holeDimType as HolePackage;
                        if (holeDimTypeHolePackage != null)
                        {
                            var holeBuilder = workPart.Features.CreateHolePackageBuilder(holeDimTypeHolePackage);
                            HoleCalloutSettingsBuilder.Featuretype holeType = (HoleCalloutSettingsBuilder.Featuretype)holeBuilder.Type;
                            var listOfParameters = radiaDimensionBuilder.Style.HoleCalloutSettings.GetListOfParameters(holeType);
                            foreach (HoleCalloutSettingsBuilder.Parametertype holeParameter in radiaDimensionBuilder.Style.HoleCalloutSettings.GetListOfParameters(holeType))
                            {
                                var nthValue = radiaDimensionBuilder.Style.HoleCalloutSettings.GetNthParameterValue(holeType, (int)holeParameter);
                                var nthDisplay = radiaDimensionBuilder.Style.HoleCalloutSettings.GetNthParameterDisplay(holeType, (int)holeParameter);
                                var nthPrefix = radiaDimensionBuilder.Style.HoleCalloutSettings.GetNthParameterPrefix(holeType, (int)holeParameter);
                                var nthSuffix = radiaDimensionBuilder.Style.HoleCalloutSettings.GetNthParameterSuffix(holeType, (int)holeParameter);
                                var paraVal = holeParameter;
                                theSession.ListingWindow.WriteLine(paraVal.ToString() + " " + nthDisplay.ToString());
                                //if ((nthValue != null))
                                //{
                                //   theSession.ListingWindow.WriteLine(nthValue.ToString());
                                // }
                            }
                            holeBuilder.Destroy();
                        }
                    }
                    radiaDimensionBuilder.Destroy();//Kills RadialDimensionBuiolder From Memory
                }
            }
        }
    }
               
    public static int GetUnloadOption(string dummy) { return (int)NXOpen.Session.LibraryUnloadOption.Immediately; }

}

Re: Read hole callout dimension (NX Open)

That one gives me a memory access violation...

Re: Read hole callout dimension (NX Open)

[ Edited ]

The code works on mine.