Hide Table of Contents

DimXpert Example (C#)

This example shows how to call interfaces, methods, and properties in the SolidWorks Document Manager API for parts with DimXpert features and annotations.

To learn how to build parts containing DimXpert features and annotations that work with a particular API, open the examples in the Examples section in the SolidWorks Document Manager API topic of interest.

//----------------------------------------------------------------------------

// Preconditions:

// 1. Create a part that contains DimXpert features

//    and annotations (see NOTES below).

// 2. Add the SolidWorks.Interop.swdocumentmgr.dll reference

//    to the project:

//    a. Right-click the project in Project Explorer.

//    b. Select Add Reference.

//    c. Click the Browse tab.

//    d. Load:

// <SolidWorks_install_dir>\api\redist\CLR2\SolidWorks.Interop.swdocumentmgr.dll

// 3. Substitute the fileName string with the path to the part

//    you just created.

// 4. Substitute <your_license_code> in GetApplication() with

//    your license code.

// 5. Compile and run this program.

//

// Postconditions: Inspect the Immediate Window and the code to see how an

// API is used.

//

// NOTES:

// You must convert older parts to the latest supported version

// of SolidWorks in order to get the DimXpert CAD identifiers

// for features and annotations using the API. To convert an older

// part to the latest supported version:

// 1. Open the part in a version of SolidWorks that contains

//    this API.

// 2. Save the part, clicking OK in the pop-up dialog to

//    convert the part.

//    NOTE:  If you are using a tutorial part, be sure to save

//    the part to another name.

// 3. Close the part.

//--------------------------------------------------------------------------

 

using SolidWorks.Interop.sldworks;

using SolidWorks.Interop.swconst;

using SolidWorks.Interop.swdocumentmgr;

using System;

using System.Diagnostics;

 

    partial class SolidWorksMacro

    {

        public void Main()

        {

            SwDMClassFactory classfac = default(SwDMClassFactory);

            SwDMApplication docMgr = default(SwDMApplication);

            SwDMDocument5 swDoc = default(SwDMDocument5);

            SwDmDocumentOpenError e = default(SwDmDocumentOpenError);

            classfac = new SwDMClassFactory();

 

            // Substitute your license code below

            docMgr = classfac.GetApplication("<your_license_code>");

 

            Debug.Print("Latest supported file version: " + docMgr.GetLatestSupportedFileVersion());

            string fileName = null;

 

            // Substitute the path to your DimXpert part below

            fileName = "K:\\HELP\\Samples Macros\\SW2010\\swdocumentmgrapi\\dimXpert_parts\\cover_with_dimensions.sldprt";

            

            swDoc = (SwDMDocument5)docMgr.GetDocument(fileName, SwDmDocumentType.swDmDocumentPart, true, out e);

            if ((swDoc == null))

            {

                System.Windows.Forms.MessageBox.Show(fileName + " not found");

                return;

            }

            Debug.Print(" Loaded document version: " + swDoc.GetVersion());

            Debug.Print(" Loaded document name: " + fileName);

            Debug.Print(" ");

            object[] vConfigNames = null;

            string configName = null;

            SwDMConfiguration12 configObj = default(SwDMConfiguration12);

            int index = 0;

            SwDMDimXpertPart myDimXpertPart = default(SwDMDimXpertPart);

            object[] vFeatures = null;

            SwDMDimXpertFeature myFeature = default(SwDMDimXpertFeature);

            object[] vAnnotations = null;

            SwDMDimXpertAnnotation myAnnotation = default(SwDMDimXpertAnnotation);

            SwDMDimXpertBlockTolerances myBlockTolerance = default(SwDMDimXpertBlockTolerances);

            object[] vObject = null;

            int[] vInt = null;

            int featureIndex = 0;

            int annoIndex = 0;

            int vObjectIndex = 0;

            SwDMDimXpertFeature tempFeature = default(SwDMDimXpertFeature);

            SwDMDimXpertFeature tempFeature1 = default(SwDMDimXpertFeature);

            SwDMDimXpertFeature endFeature1 = default(SwDMDimXpertFeature);

            SwDMDimXpertFeature endFeature2 = default(SwDMDimXpertFeature);

            SwDMDimXpertPlaneFeature planeFeature1 = default(SwDMDimXpertPlaneFeature);

            SwDMDimXpertPlaneFeature planeFeature2 = default(SwDMDimXpertPlaneFeature);

            swDmDimXpertDatum datum = default(swDmDimXpertDatum);

            swDmDimXpertDistanceFosUsage_e fosUsage = default(swDmDimXpertDistanceFosUsage_e);

            swDmDimXpertMaterialConditionModifier_e modifier = default(swDmDimXpertMaterialConditionModifier_e);

            swDmDimXpertBlockToleranceType_e bltType = default(swDmDimXpertBlockToleranceType_e);

            double X = 0;

            double Y = 0;

            double Z = 0;

            double i = 0;

            double j = 0;

            double k = 0;

            double longi = 0;

            double longj = 0;

            double longk = 0;

            double width = 0;

            double length = 0;

            double angle = 0;

            double Distance = 0;

            double Tolerance = 0;

            double Value = 0;

            bool isMax = false;

            bool Enabled = false;

            swDmDimXpertFeatureType_e feattype = default(swDmDimXpertFeatureType_e);

            swDmDimXpertAnnotationType_e annotype = default(swDmDimXpertAnnotationType_e);

            SwDMDimXpertGeometricTolerance myGeoTol = default(SwDMDimXpertGeometricTolerance);

            SwDMDimXpertDimensionTolerance myDimTol = default(SwDMDimXpertDimensionTolerance);

            SwDMDimXpertOrientationGeoTol myOriTol = default(SwDMDimXpertOrientationGeoTol);

            double plusTol = 0;

            double minusTol = 0;

            double lowerTol = 0;

            double upperTol = 0;

            bool boolstatus = false;

            vConfigNames = (Object[])swDoc.ConfigurationManager.GetConfigurationNames();

            if (!((vConfigNames == null)))

            {

                for (index = vConfigNames.GetLowerBound(0); index <= vConfigNames.GetUpperBound(0); index++)

                {

                    configName = (String)vConfigNames[index];

                    configObj = (SwDMConfiguration12)swDoc.ConfigurationManager.GetConfigurationByName(configName);

                    if ((configObj != null))

                    {

                        myDimXpertPart = configObj.DimXpertPart;

                        if ((myDimXpertPart != null))

                        {

                            vFeatures = (Object[])myDimXpertPart.GetFeatures();

                            if (!((vFeatures == null)))

                            {

                                Debug.Print(" ");

                                Debug.Print(myDimXpertPart.GetFeatureCount() + " DimXpert features:");

                                Debug.Print(" ");

                                for (featureIndex = vFeatures.GetLowerBound(0); featureIndex <= vFeatures.GetUpperBound(0); featureIndex++)

                                {

                                    myFeature = (SwDMDimXpertFeature)vFeatures[featureIndex];

                                    Debug.Print(featureIndex + " : " + "Feature name = " + myFeature.Name);

                                    feattype = myFeature.type;

                                    switch (feattype)

                                    {

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_Plane:

                                            Debug.Print(" Type = Plane");

                                            SwDMDimXpertPlaneFeature myPlaneFeature = default(SwDMDimXpertPlaneFeature);

                                            myPlaneFeature = (SwDMDimXpertPlaneFeature)myFeature;

                                            boolstatus = myPlaneFeature.GetNominalPlane(ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" NomPlane(x,y,z,i,j,k): " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_BestfitPlane:

                                            Debug.Print(" Type = Best fit plane");

                                            SwDMDimXpertBestFitPlaneFeature myBestFitPlaneFeature = default(SwDMDimXpertBestFitPlaneFeature);

                                            myBestFitPlaneFeature = (SwDMDimXpertBestFitPlaneFeature)myFeature;

                                            boolstatus = myBestFitPlaneFeature.GetNominalPlane(ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" NominalPlane(x,y,z,i,j,k): " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            Debug.Print(" Number of sub-features: " + myBestFitPlaneFeature.GetSubFeatureCount());

                                            if (myBestFitPlaneFeature.GetSubFeatureCount() > 0)

                                            {

                                                Debug.Print(" Sub-features:");

                                                vObject = (Object[])myBestFitPlaneFeature.GetSubFeatures();

                                                for (vObjectIndex = vObject.GetLowerBound(0); vObjectIndex <= vObject.GetUpperBound(0); vObjectIndex++)

                                                {

                                                    tempFeature = (SwDMDimXpertFeature)vObject[vObjectIndex];

                                                    Debug.Print(" " + tempFeature.Name);

                                                }

                                            }

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_Chamfer:

                                            Debug.Print(" Type = Chamfer");

                                            SwDMDimXpertChamferFeature myChamferFeature = default(SwDMDimXpertChamferFeature);

                                            myChamferFeature = (SwDMDimXpertChamferFeature)myFeature;

                                            Debug.Print(" Chamfer angle: " + myChamferFeature.Angle);

                                            Debug.Print(" Chamfer angle type (swDmDimXpertChamferAngleType_e): " + myChamferFeature.AngleType);

                                            Debug.Print(" Chamfer type (swDmDimXpertChamferType_e): " + myChamferFeature.ChamferType);

                                            Debug.Print(" Distance 1: " + myChamferFeature.Distance1);

                                            Debug.Print(" Distance 2: " + myChamferFeature.Distance2);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_CompoundClosedSlot3D:

                                            Debug.Print(" Type = Compound closed slot 3D");

                                            SwDMDimXpertCompoundClosedSlot3dFeature myClosedSlotFeature = default(SwDMDimXpertCompoundClosedSlot3dFeature);

                                            myClosedSlotFeature = (SwDMDimXpertCompoundClosedSlot3dFeature)myFeature;

                                            tempFeature = myClosedSlotFeature.GetBottomFeature();

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Bottom feature: " + tempFeature.Name);

                                            }

                                            endFeature1 = null;

                                            endFeature2 = null;

                                            planeFeature1 = null;

                                            planeFeature2 = null;

                                            boolstatus = myClosedSlotFeature.GetEndFeatures(ref endFeature1, ref endFeature2);

                                            if ((endFeature1 != null) & (endFeature2 != null))

                                            {

                                                Debug.Print(" End features: " + endFeature1.Name + ", " + endFeature2.Name);

                                            }

                                            boolstatus = myClosedSlotFeature.GetNominalBottomPlane(ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" Bottom plane(x,y,z,i,j,k): " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            boolstatus = myClosedSlotFeature.GetNominalClosedSlot(ref width, ref length, ref X, ref Y, ref Z, ref i, ref j, ref k, ref longi, ref longj, ref longk);

                                            Debug.Print(" Closed slot(width,length,x,j,z,i,j,k,longi,longj,longk): " + width + ", " + length + ", " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k + ", " + longi + ", " + longj + ", " + longk);

                                            boolstatus = myClosedSlotFeature.GetNominalTopPlane(ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" Top plane(x,y,z,i,j,k): " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            boolstatus = myClosedSlotFeature.GetPlaneFeatures(ref planeFeature1, ref planeFeature2);

                                            if ((planeFeature1 != null) & (planeFeature2 != null))

                                            {

                                                Debug.Print(" Plane features: " + ((SwDMDimXpertFeature)planeFeature1).Name + ", " + ((SwDMDimXpertFeature)planeFeature2).Name);

                                            }

                                            Debug.Print(" Closed slot is blind and not through all: " + myClosedSlotFeature.Blind);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_CompoundHole:

                                            Debug.Print(" Type = Compound hole");

                                            SwDMDimXpertCompoundHoleFeature myHole = default(SwDMDimXpertCompoundHoleFeature);

                                            myHole = (SwDMDimXpertCompoundHoleFeature)myFeature;

                                            Debug.Print(" Hole is blind and not through all: " + myHole.Blind);

                                            SwDMDimXpertFeature bottomFeature = default(SwDMDimXpertFeature);

                                            bottomFeature = myHole.GetBottomFeature();

                                            if ((bottomFeature != null))

                                            {

                                                Debug.Print(" Bottom feature type (swDmDimXpertFeatureType_e) = " + bottomFeature.type);

                                            }

                                            SwDMDimXpertFeature refFeature = default(SwDMDimXpertFeature);

                                            refFeature = myHole.GetReferenceFeature();

                                            if ((refFeature != null))

                                            {

                                                Debug.Print(" Reference feature type (swDmDimXpertFeatureType_e) = " + refFeature.type);

                                            }

                                            if (myHole.GetSubFeatureCount() > 0)

                                            {

                                                vObject = (Object[])myHole.GetSubFeatures();

                                                Debug.Print(" Sub-features: ");

                                          

                                                for (vObjectIndex = vObject.GetLowerBound(0); vObjectIndex <= vObject.GetUpperBound(0); vObjectIndex++)

                                                {

                                                    tempFeature = (SwDMDimXpertFeature)vObject[vObjectIndex];

                                                    Debug.Print(" " + tempFeature.Name);

                                                }

                                            }

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_CompoundNotch:

                                            Debug.Print(" Type = Compound notch");

                                            SwDMDimXpertCompoundNotchFeature myNotchFeature = default(SwDMDimXpertCompoundNotchFeature);

                                            myNotchFeature = (SwDMDimXpertCompoundNotchFeature)myFeature;

                                            tempFeature = myNotchFeature.GetBottomFeature();

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Bottom feature: " + tempFeature.Name);

                                            }

                                            endFeature1 = (SwDMDimXpertFeature)myNotchFeature.GetEndFeature();

                                            if ((endFeature1 != null))

                                            {

                                                Debug.Print(" End feature: " + endFeature1.Name);

                                            }

                                            boolstatus = myNotchFeature.GetNominalBottomPlane(ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" Bottom plane(x,y,z,i,j,k): " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            boolstatus = myNotchFeature.GetNominalNotch(ref width, ref length, ref X, ref Y, ref Z, ref i, ref j, ref k, ref longi, ref longj, ref longk);

                                            Debug.Print(" Notch(width,length,x,j,z,i,j,k,longi,longj,longk): " + width + ", " + length + ", " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k + ", " + longi + ", " + longj + ", " + longk);

                                            tempFeature = (SwDMDimXpertFeature)myNotchFeature.GetOpenSideReferenceFeature();

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Open side reference feature: " + tempFeature.Name);

                                            }

                                            tempFeature = (SwDMDimXpertFeature)myNotchFeature.GetTopReferenceFeature();

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Top reference feature: " + tempFeature.Name);

                                            }

                                            planeFeature1 = null;

                                            planeFeature2 = null;

                                            boolstatus = myNotchFeature.GetPlaneFeatures(ref planeFeature1, ref planeFeature2);

                                            if ((planeFeature1 != null) & (planeFeature2 != null))

                                            {

                                                Debug.Print(" Plane features: " + ((SwDMDimXpertFeature)planeFeature1).Name + ", " + ((SwDMDimXpertFeature)planeFeature2).Name);

                                            }

                                            Debug.Print(" Notch is blind and not through all: " + myNotchFeature.Blind);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_CompoundWidth:

                                            Debug.Print(" Type = Compound width");

                                            SwDMDimXpertCompoundWidthFeature myWidthFeature = default(SwDMDimXpertCompoundWidthFeature);

                                            myWidthFeature = (SwDMDimXpertCompoundWidthFeature)myFeature;

                                            boolstatus = myWidthFeature.GetNominalCompoundWidth(ref width, ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" Compound width(width,x,j,z,i,j,k): " + width + ", " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            boolstatus = myWidthFeature.GetNominalLongitude(ref i, ref j, ref k);

                                            Debug.Print(" Nominal longitude(longi, longj, longk): " + longi + ", " + longj + ", " + longk);

                                            Debug.Print(" Compound width is for a hole and not a pin: " + myWidthFeature.Inner);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_Cone:

                                            Debug.Print(" Type = Cone");

                                            SwDMDimXpertConeFeature myConeFeature = default(SwDMDimXpertConeFeature);

                                            myConeFeature = (SwDMDimXpertConeFeature)myFeature;

                                            boolstatus = myConeFeature.GetNominalBottomPlane(ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" Nominal bottom plane(x,y,z,i,j,k): " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            boolstatus = myConeFeature.GetNominalCone(ref angle, ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" Cone(angle,x,j,z,i,j,k): " + angle + ", " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            boolstatus = myConeFeature.GetNominalTopPlane(ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" Nominal top plane(x,y,z,i,j,k): " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            Debug.Print(" Cone is a hole and not a pin: " + myConeFeature.Inner);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_Cylinder:

                                            Debug.Print(" Type = Cylinder");

                                            SwDMDimXpertCylinderFeature myCylinder = default(SwDMDimXpertCylinderFeature);

                                            myCylinder = (SwDMDimXpertCylinderFeature)myFeature;

                                            boolstatus = myCylinder.GetNominalTopPlane(ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" TopPlane(x,y,z,i,j,k): " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            boolstatus = myCylinder.GetNominalCylinder(ref angle, ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" Cylinder(radius,x,j,z,i,j,k): " + angle + ", " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            boolstatus = myCylinder.GetNominalBottomPlane(ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" BottomPlane(x,y,z,i,j,k): " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            bool isThreaded = false;

                                            string threadDesignation = null;

                                            double threadDepth = 0;

                                            threadDesignation = null;

                                            boolstatus = myCylinder.GetThread(ref isThreaded, ref threadDesignation, ref threadDepth);

                                            Debug.Print(" Cylinder is threaded: " + isThreaded);

                                            if ((isThreaded))

                                            {

                                                Debug.Print(" Cylinder thread designation: " + threadDesignation);

                                                Debug.Print(" Cylinder thread depth: " + threadDepth);

                                            }

                                            Debug.Print(" Cylinder is a hole and not a pin: " + myCylinder.Inner);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_Extrude:

                                            Debug.Print(" Type = Extrude");

                                            SwDMDimXpertExtrudeFeature myExtrude = default(SwDMDimXpertExtrudeFeature);

                                            myExtrude = (SwDMDimXpertExtrudeFeature)myFeature;

                                            tempFeature = (SwDMDimXpertFeature)myExtrude.GetBottomFeature();

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Bottom feature: " + tempFeature.Name);

                                            }

                                            tempFeature = (SwDMDimXpertFeature)myExtrude.GetBottomBlends();

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Bottom blends: " + tempFeature.Name);

                                            }

                                            tempFeature = (SwDMDimXpertFeature)myExtrude.GetTopBlends();

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Top blends: " + tempFeature.Name);

                                            }

                                            tempFeature = (SwDMDimXpertFeature)myExtrude.GetReferenceFeature();

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Reference feature: " + tempFeature.Name);

                                            }

                                            Debug.Print(" Number of sub-features: " + myExtrude.GetSubFeatureCount());

                                            if (myExtrude.GetSubFeatureCount() > 0)

                                            {

                                                Debug.Print(" Sub-features:");

                                                vObject = (Object[])myExtrude.GetSubFeatures();

                                            

                                                for (vObjectIndex = vObject.GetLowerBound(0); vObjectIndex <= vObject.GetUpperBound(0); vObjectIndex++)

                                                {

                                                    tempFeature = (SwDMDimXpertFeature)vObject[vObjectIndex];

                                                    Debug.Print(" " + tempFeature.Name);

                                                }

                                            }

                                            Debug.Print(" Extrude is blind and not through all: " + myExtrude.Blind);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_Fillet:

                                            Debug.Print(" Type = Fillet");

                                            SwDMDimXpertFilletFeature myFillet = default(SwDMDimXpertFilletFeature);

                                            myFillet = (SwDMDimXpertFilletFeature)myFeature;

                                            Debug.Print(" Fillet is for a hole and not a pin: " + myFillet.Inner);

                                            Debug.Print(" Radius = " + myFillet.Radius);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_IntersectCircle:

                                            Debug.Print(" Type = Intersect circle");

                                            SwDMDimXpertIntersectCircleFeature myICircle = default(SwDMDimXpertIntersectCircleFeature);

                                            myICircle = (SwDMDimXpertIntersectCircleFeature)myFeature;

                                            tempFeature = (SwDMDimXpertFeature)myICircle.GetIntersectFeature();

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Intersect feature: " + tempFeature.Name);

                                            }

                                            tempFeature = (SwDMDimXpertFeature)myICircle.GetPlaneFeature();

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Plane feature: " + tempFeature.Name);

                                            }

                                            boolstatus = myICircle.GetNominalCircle(ref angle, ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" Intersect circle(radius,x,y,z,i,j,k): " + angle + ", " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_IntersectLine:

                                            Debug.Print(" Type = Intersect line");

                                            SwDMDimXpertIntersectLineFeature myILine = default(SwDMDimXpertIntersectLineFeature);

                                            myILine = (SwDMDimXpertIntersectLineFeature)myFeature;

                                            tempFeature = null;

                                            tempFeature1 = null;

                                            boolstatus = myILine.GetPlaneFeatures(ref tempFeature, ref tempFeature1);

                                            if ((tempFeature != null) & (tempFeature1 != null))

                                            {

                                                Debug.Print(" Plane feature 1: " + tempFeature.Name);

                                                Debug.Print(" Plane feature 2: " + tempFeature1.Name);

                                            }

                                            boolstatus = myILine.GetNominalLine(ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" Intersect line(x,y,z,i,j,k): " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_IntersectPlane:

                                            Debug.Print(" Type = Intersect plane");

                                            SwDMDimXpertIntersectPlaneFeature myIPlane = default(SwDMDimXpertIntersectPlaneFeature);

                                            myIPlane = (SwDMDimXpertIntersectPlaneFeature)myFeature;

                                            tempFeature = null;

                                            tempFeature1 = null;

                                            boolstatus = myIPlane.GetFeatures(ref tempFeature, ref tempFeature1);

                                            if ((tempFeature != null) & (tempFeature1 != null))

                                            {

                                                Debug.Print(" Feature 1: " + tempFeature.Name);

                                                Debug.Print(" Feature 2: " + tempFeature1.Name);

                                            }

                                            boolstatus = myIPlane.GetNominalPlane(ref X, ref Y, ref Z, ref i, ref j, ref k);

                                            Debug.Print(" Intersect plane(x,y,z,i,j,k): " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_IntersectPoint:

                                            Debug.Print(" Type = Intersect point");

                                            SwDMDimXpertIntersectPointFeature myIPoint = default(SwDMDimXpertIntersectPointFeature);

                                            myIPoint = (SwDMDimXpertIntersectPointFeature)myFeature;

                                            tempFeature = null;

                                            tempFeature1 = null;

                                            boolstatus = myIPoint.GetFeatures(ref tempFeature, ref tempFeature1);

                                            if ((tempFeature != null) & (tempFeature1 != null))

                                            {

                                                Debug.Print(" Feature 1: " + tempFeature.Name);

                                                Debug.Print(" Feature 2: " + tempFeature1.Name);

                                            }

                                            boolstatus = myIPoint.GetNominalPoint(ref X, ref Y, ref Z);

                                            boolstatus = myIPoint.GetNominalVector(ref i, ref j, ref k);

                                            Debug.Print(" Intersect point(x,y,z,i,j,k): " + X + ", " + Y + ", " + Z + ", " + i + ", " + j + ", " + k);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_Pattern:

                                            Debug.Print(" Type = Pattern");

                                            SwDMDimXpertPatternFeature myPattern = default(SwDMDimXpertPatternFeature);

                                            myPattern = (SwDMDimXpertPatternFeature)myFeature;

                                            Debug.Print(" Number of sub-features: " + myPattern.GetSubFeatureCount());

                                            if (myPattern.GetSubFeatureCount() > 0)

                                            {

                                                Debug.Print(" Sub-features:");

                                                vObject = (Object[])myPattern.GetSubFeatures();

                                            

                                                for (vObjectIndex = vObject.GetLowerBound(0); vObjectIndex <= vObject.GetUpperBound(0); vObjectIndex++)

                                                {

                                                    tempFeature = (SwDMDimXpertFeature)vObject[vObjectIndex];

                                                    Debug.Print(" " + tempFeature.Name);

                                                }

                                            }

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_Sphere:

                                            Debug.Print(" Type = Sphere");

                                            SwDMDimXpertSphereFeature mySphere = default(SwDMDimXpertSphereFeature);

                                            mySphere = (SwDMDimXpertSphereFeature)myFeature;

                                            boolstatus = mySphere.GetNominalSphere(ref angle, ref X, ref Y, ref Z);

                                            Debug.Print(" Sphere(radius,x,j,z): " + angle + ", " + X + ", " + Y + ", " + Z);

                                            Debug.Print(" Sphere is for a hole and not a pin: " + mySphere.Inner);

                                            break;

                                        case swDmDimXpertFeatureType_e.swDmDimXpertFeature_Surface:

                                            Debug.Print(" Type = Surface");

                                            break;

                                        default:

                                            Debug.Print(" Type = <unknown>");

                                            break;

                                    }

                                    Debug.Print(" CAD identifier count = " + myFeature.GetCadIdentifierCount());

                                    if (myFeature.GetCadIdentifierCount() > 0)

                                    {

                                        Debug.Print(" CAD Identifiers:");

                                        vObject = (Object[])myFeature.GetCadIdentifiers();

       

                                        for (vObjectIndex = vObject.GetLowerBound(0); vObjectIndex <= vObject.GetUpperBound(0); vObjectIndex++)

                                        {

                                            Debug.Print("       " + vObject[vObjectIndex]);

                                        }

                                    }

                                    Debug.Print(" Suppressed = " + myFeature.IsSuppressed());

                                    Debug.Print(" ");

                                }

                            }

                            myBlockTolerance = (SwDMDimXpertBlockTolerances)myDimXpertPart.GetBlockTolerances();

                            Debug.Print(" DimXpert block tolerance settings:");

                            Debug.Print(" ");

                            double linear1 = 0;

                            double linear2 = 0;

                            double linear3 = 0;

                            double angular = 0;

                            int linear1Prec = 0;

                            int linear2Prec = 0;

                            int linear3Prec = 0;

                            bltType = myBlockTolerance.type;

                            switch (bltType)

                            {

                                case swDmDimXpertBlockToleranceType_e.swDmDimXpertBlockToleranceType_ASMEInch:

                                    boolstatus = myBlockTolerance.GetToleranceValues(ref linear1, ref linear1Prec, ref linear2, ref linear2Prec, ref linear3, ref linear3Prec, ref angular);

                                    Debug.Print(" ASMEInch Dimension 1 tolerance: " + linear1);

                                    Debug.Print(" ASMEInch Dimension 1 tolerance precision: " + linear1Prec);

                                    Debug.Print(" ASMEInch Dimension 2 tolerance: " + linear2);

                                    Debug.Print(" ASMEInch Dimension 2 tolerance precision: " + linear2Prec);

                                    Debug.Print(" ASMEInch Dimension 3 tolerance: " + linear3);

                                    Debug.Print(" ASMEInch Dimension 3 tolerance precision: " + linear3Prec);

                                    Debug.Print(" ASMEInch Angular tolerance: " + angular);

                                    break;

                                case swDmDimXpertBlockToleranceType_e.swDmDimXpertBlockToleranceType_ISO2768:

                                    swDmDimXpertISO2768PartType_e ISO2768Type = default(swDmDimXpertISO2768PartType_e);

                                    boolstatus = myBlockTolerance.GetISO2768PartType(ref ISO2768Type);

                                    Debug.Print(" ISO 2768 part type (swDmDimXpertISO2768PartType_e): " + ISO2768Type);

                                    break;

                                case swDmDimXpertBlockToleranceType_e.swDmDimXpertBlockToleranceType_unknown:

                                    Debug.Print(" Block tolerance unknown");

                                    break;

                            }

                            vAnnotations = (Object[])myDimXpertPart.GetAnnotations();

                            if (!((vAnnotations == null)))

                            {

                                Debug.Print(" ");

                                Debug.Print(myDimXpertPart.GetAnnotationCount() + " DimXpert annotations:");

                                Debug.Print(" ");

                                for (annoIndex = vAnnotations.GetLowerBound(0); annoIndex <= vAnnotations.GetUpperBound(0); annoIndex++)

                                {

                                    myDimTol = null;

                                    myGeoTol = null;

                                    myOriTol = null;

                                    myAnnotation = (SwDMDimXpertAnnotation)vAnnotations[annoIndex];

                                    Debug.Print(annoIndex + " : " + "Annotation name = " + myAnnotation.Name);

                                    annotype = myAnnotation.type;

                                    switch (annotype)

                                    {

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDatum:

                                            Debug.Print(" Type = Datum");

                                            swDmDimXpertDatum myDatum = default(swDmDimXpertDatum);

                                            myDatum = (swDmDimXpertDatum)myAnnotation;

                                            Debug.Print(" ID = " + myDatum.Identifier);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_AngleBetween:

                                            Debug.Print(" Type = Angle-between dimension tolerance");

                                            SwDMDimXpertAngleBetweenDimTol myAngBetDimTol = default(SwDMDimXpertAngleBetweenDimTol);

                                            myAngBetDimTol = (SwDMDimXpertAngleBetweenDimTol)myAnnotation;

                                            boolstatus = myAngBetDimTol.GetDirectionVector(ref i, ref j, ref k);

                                            Debug.Print(" DirectionVector(i,j,k): " + i + ", " + j + ", " + k);

                                            Debug.Print(" Feature of origin: " + myAngBetDimTol.OriginFeature.Name);

                                            Debug.Print(" Calculate supplement angle? " + myAngBetDimTol.Supplement);

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_ChamferDimension:

                                            Debug.Print(" Type = Chamfer dimension tolerance");

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            SwDMDimXpertChamferDimTol myChamferDimTol = default(SwDMDimXpertChamferDimTol);

                                            myChamferDimTol = (SwDMDimXpertChamferDimTol)myAnnotation;

                                            Debug.Print(" Chamfer dimension type (swDmDimXpertChamferDimensionType_e): " + myChamferDimTol.ChamferType);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_CompositeDistanceBetween:

                                            Debug.Print(" Type = Composite distance-between dimension tolerance");

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            SwDMDimXpertCompositeDistanceBetweenDimTol myCompDistBetDimTol = default(SwDMDimXpertCompositeDistanceBetweenDimTol);

                                            myCompDistBetDimTol = (SwDMDimXpertCompositeDistanceBetweenDimTol)myAnnotation;

                                            boolstatus = myCompDistBetDimTol.GetDirectionVector(ref i, ref j, ref k);

                                            Debug.Print(" Direction vector(i,j,k): " + i + ", " + j + ", " + k);

                                            tempFeature1 = null;

                                            boolstatus = myCompDistBetDimTol.GetFeature(ref tempFeature1, ref fosUsage);

                                            if ((tempFeature1 != null))

                                            {

                                                Debug.Print(" Composite distance-between dimension tolerance feature: " + tempFeature1.Name);

                                                Debug.Print(" Feature of size usage (swDmDimXpertDistanceFosUsage_e): " + fosUsage);

                                            }

                                            boolstatus = myCompDistBetDimTol.GetIntraFeature(ref tempFeature1, ref fosUsage);

                                            if ((tempFeature1 != null))

                                            {

                                                Debug.Print(" Feature-locating feature: " + tempFeature1.Name);

                                                Debug.Print(" Feature of size usage for feature-locating(swDmDimXpertDistanceFosUsage_e): " + fosUsage);

                                            }

                                            boolstatus = myCompDistBetDimTol.GetOriginFeature(ref tempFeature1, ref fosUsage);

                                            if ((tempFeature1 != null))

                                            {

                                                Debug.Print(" Feature of origin for this dimension tolerance: " + tempFeature1.Name);

                                                Debug.Print(" Feature of size usage (swDmDimXpertDistanceFosUsage_e): " + fosUsage);

                                            }

                                            Debug.Print(" Type of dimension tolerance for feature-locating (swDmDimXpertDimensionToleranceType_e): " + myCompDistBetDimTol.DimensionTypeIntraFeature);

                                            Debug.Print(" Tolerance for feature-locating: " + myCompDistBetDimTol.GetNominalValueIntraFeature());

                                            boolstatus = myCompDistBetDimTol.GetPlusAndMinusToleranceIntraFeature(ref plusTol, ref minusTol);

                                            Debug.Print(" Plus / Minus limit for feature-locating: " + plusTol + " / " + minusTol);

                                            boolstatus = myCompDistBetDimTol.GetUpperAndLowerLimitIntraFeature(ref upperTol, ref lowerTol);

                                            Debug.Print(" Upper / Lower limit for feature-locating: " + upperTol + " / " + lowerTol);

                                            Debug.Print(" Block tolerance precision for feature-locating: " + myCompDistBetDimTol.BlockToleranceDecimalPlacesIntraFeature);

                                            Debug.Print(" Limits and fits code for feature-locating: " + myCompDistBetDimTol.LimitsAndFitsCodeIntraFeature);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_ConeAngle:

                                            Debug.Print(" Type = Cone angle dimension tolerance");

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_CounterBore:

                                            Debug.Print(" Type = Counterbore dimension tolerance");

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            SwDMDimXpertCounterBoreDimTol myCounterBoreDimTol = default(SwDMDimXpertCounterBoreDimTol);

                                            myCounterBoreDimTol = (SwDMDimXpertCounterBoreDimTol)myAnnotation;

                                            tempFeature = myCounterBoreDimTol.ReferenceFeature;

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Reference Feature for this dimension tolerance: " + tempFeature.Name);

                                            }

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_CounterSinkAngle:

                                            Debug.Print(" Type = Countersink angle dimension tolerance");

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            SwDMDimXpertCounterSinkAngleDimTol myCounterSinkAngleDimTol = default(SwDMDimXpertCounterSinkAngleDimTol);

                                            myCounterSinkAngleDimTol = (SwDMDimXpertCounterSinkAngleDimTol)myAnnotation;

                                            tempFeature = myCounterSinkAngleDimTol.ReferenceFeature;

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Reference Feature for this dimension tolerance: " + tempFeature.Name);

                                            }

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_CounterSinkDiameter:

                                            Debug.Print(" Type = Countersink diameter dimension tolerance");

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            SwDMDimXpertCounterSinkDiameterDimTol myCounterSinkDiameterDimTol = default(SwDMDimXpertCounterSinkDiameterDimTol);

                                            myCounterSinkDiameterDimTol = (SwDMDimXpertCounterSinkDiameterDimTol)myAnnotation;

                                            tempFeature = myCounterSinkDiameterDimTol.ReferenceFeature;

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Reference Feature for this dimension tolerance: " + tempFeature.Name);

                                            }

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_Depth:

                                            Debug.Print(" Type = Depth dimension tolerance");

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            SwDMDimXpertDepthDimTol myDepthDimTol = default(SwDMDimXpertDepthDimTol);

                                            myDepthDimTol = (SwDMDimXpertDepthDimTol)myAnnotation;

                                            Debug.Print(" Tolerance is for thread depth: " + myDepthDimTol.IsThreadDepth());

                                            tempFeature = myDepthDimTol.ReferenceFeature;

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Reference Feature for this dimension tolerance: " + tempFeature.Name);

                                            }

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_Diameter:

                                            Debug.Print(" Type = Diameter dimension tolerance");

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            SwDMDimXpertDiameterDimTol myDiameterDimTol = default(SwDMDimXpertDiameterDimTol);

                                            myDiameterDimTol = (SwDMDimXpertDiameterDimTol)myAnnotation;

                                            Debug.Print(" Pattern treatment type (swDmDimXpertPatternTreatmentType_e): " + myDiameterDimTol.PatternTreatment);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_DistanceBetween:

                                            Debug.Print(" Type = Distance-between dimension tolerance");

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            SwDMDimXpertDistanceBetweenDimTol myDistBetDimTol = default(SwDMDimXpertDistanceBetweenDimTol);

                                            myDistBetDimTol = (SwDMDimXpertDistanceBetweenDimTol)myAnnotation;

                                            boolstatus = myDistBetDimTol.GetDirectionVector(ref i, ref j, ref k);

                                            Debug.Print(" Direction vector(i,j,k): " + i + ", " + j + ", " + k);

                                            tempFeature1 = null;

                                            boolstatus = myDistBetDimTol.GetFeature(ref tempFeature1, ref fosUsage);

                                            if ((tempFeature1 != null))

                                            {

                                                Debug.Print(" Distance-between dimension tolerance feature: " + tempFeature1.Name);

                                                Debug.Print(" Feature of size usage (swDmDimXpertDistanceFosUsage_e): " + fosUsage);

                                            }

                                            boolstatus = myDistBetDimTol.GetOriginFeature(ref tempFeature1, ref fosUsage);

                                            if ((tempFeature1 != null))

                                            {

                                                Debug.Print(" Feature of origin for this dimension tolerance: " + tempFeature1.Name);

                                                Debug.Print(" Feature of size usage(swDmDimXpertDistanceFosUsage_e): " + fosUsage);

                                            }

                                            Debug.Print(" Pattern treatment type (swDmDimXpertPatternTreatmentType_e): " + myDistBetDimTol.PatternTreatment);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_Length:

                                            Debug.Print(" Type = Length dimension tolerance");

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_Radius:

                                            Debug.Print(" Type = Radius dimension tolerance");

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            SwDMDimXpertRadiusDimTol myRadiusDimTol = default(SwDMDimXpertRadiusDimTol);

                                            myRadiusDimTol = (SwDMDimXpertRadiusDimTol)myAnnotation;

                                            Debug.Print(" Pattern treatment type (swDmDimXpertPatternTreatmentType_e): " + myRadiusDimTol.PatternTreatment);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertDimTol_Width:

                                            Debug.Print(" Type = Width dimension tolerance");

                                            myDimTol = (SwDMDimXpertDimensionTolerance)myAnnotation;

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_Angularity:

                                            Debug.Print(" " + annoIndex + " : Type = Angularity geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            myOriTol = (SwDMDimXpertOrientationGeoTol)myAnnotation;

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_Circularity:

                                            Debug.Print(" Type = Circularity geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_CircularRunout:

                                            Debug.Print(" Type = Circular runout geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_CompositeLineProfile:

                                            Debug.Print(" Type = Composite line profile geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            SwDMDimXpertCompositeLineProfileGeoTol myCompLineProfileGeoTol = default(SwDMDimXpertCompositeLineProfileGeoTol);

                                            myCompLineProfileGeoTol = (SwDMDimXpertCompositeLineProfileGeoTol)myAnnotation;

                                            boolstatus = myCompLineProfileGeoTol.GetPlanarZoneVector(ref i, ref j, ref k);

                                            Debug.Print(" Planar zone vector(i,j,k): " + i + ", " + j + ", " + k);

                                            Debug.Print(" Outer tolerance value: " + myCompLineProfileGeoTol.OuterToleranceValue);

                                            Debug.Print(" Outer tolerance value in the lower tier: " + myCompLineProfileGeoTol.OuterToleranceValueLowerTier);

                                            Debug.Print(" Primary datum repeated in lower tier: " + myCompLineProfileGeoTol.PrimaryInLowerTier);

                                            Debug.Print(" Secondary datum repeated in lower tier: " + myCompLineProfileGeoTol.SecondaryInLowerTier);

                                            Debug.Print(" Tertiary datum repeated in lower tier: " + myCompLineProfileGeoTol.TertiaryInLowerTier);

                                            Debug.Print(" Tolerance in lower tier: " + myCompLineProfileGeoTol.ToleranceLowerTier);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_CompositePosition:

                                            Debug.Print(" Type = Composite position geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            SwDMDimXpertCompositePositionGeoTol myCompPosGeoTol = default(SwDMDimXpertCompositePositionGeoTol);

                                            myCompPosGeoTol = (SwDMDimXpertCompositePositionGeoTol)myAnnotation;

                                            boolstatus = myCompPosGeoTol.GetMaxTolerance(ref isMax, ref Tolerance);

                                            Debug.Print(" Maximum tolerance is set: " + isMax);

                                            if (isMax)

                                            {

                                                Debug.Print(" Maximum tolerance: " + Tolerance);

                                            }

                                            boolstatus = myCompPosGeoTol.GetMaxToleranceLowerTier(ref isMax, ref Tolerance);

                                            Debug.Print(" Maximum tolerance is set in lower tier: " + isMax);

                                            if (isMax)

                                            {

                                                Debug.Print(" Maximum tolerance in lower tier: " + Tolerance);

                                            }

                                            boolstatus = myCompPosGeoTol.GetPlanarZoneVector(ref i, ref j, ref k);

                                            Debug.Print(" Planar zone vector(i,j,k): " + i + ", " + j + ", " + k);

                                            boolstatus = myCompPosGeoTol.GetProjectedZone(ref Enabled, ref Value);

                                            Debug.Print(" Projected zone is in force: " + Enabled);

                                            if (Enabled)

                                            {

                                                Debug.Print("Value: " + Value);

                                            }

                                            Debug.Print(" Material condition modifier (swDmDimXpertMaterialConditionModifier_e): " + myCompPosGeoTol.Modifier);

                                            Debug.Print(" Material condition modifier in lower tier (swDmDimXpertMaterialConditionModifier_e): " + myCompPosGeoTol.ModifierLowerTier);

                                            Debug.Print(" Primary datum repeated in lower tier: " + myCompPosGeoTol.PrimaryInLowerTier);

                                            Debug.Print(" Secondary datum repeated in lower tier: " + myCompPosGeoTol.SecondaryInLowerTier);

                                            Debug.Print(" Tertiary datum repeated in lower tier: " + myCompPosGeoTol.TertiaryInLowerTier);

                                            Debug.Print(" Tolerance in lower tier: " + myCompPosGeoTol.ToleranceLowerTier);

                                            Debug.Print(" Position zone type (swDmDimXpertPositionZoneType_e): " + myCompPosGeoTol.ZoneType);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_CompositeSurfaceProfile:

                                            Debug.Print(" Type = Composite surface profile geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            SwDMDimXpertCompositeSurfaceProfileGeoTol myCompSurfProfGeoTol = default(SwDMDimXpertCompositeSurfaceProfileGeoTol);

                                            myCompSurfProfGeoTol = (SwDMDimXpertCompositeSurfaceProfileGeoTol)myAnnotation;

                                            Debug.Print(" Outer tolerance: " + myCompSurfProfGeoTol.OuterToleranceValue);

                                            Debug.Print(" Outer tolerance in lower tier: " + myCompSurfProfGeoTol.OuterToleranceValueLowerTier);

                                            Debug.Print(" Primary datum repeated in lower tier: " + myCompSurfProfGeoTol.PrimaryInLowerTier);

                                            Debug.Print(" Secondary datum repeated in lower tier: " + myCompSurfProfGeoTol.SecondaryInLowerTier);

                                            Debug.Print(" Tertiary datum repeated in lower tier: " + myCompSurfProfGeoTol.TertiaryInLowerTier);

                                            Debug.Print(" Tolerance in lower tier: " + myCompSurfProfGeoTol.ToleranceLowerTier);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_Concentricity:

                                            Debug.Print(" Type = Concentricity geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            SwDMDimXpertConcentricityGeoTol myConcentricityGeoTol = default(SwDMDimXpertConcentricityGeoTol);

                                            myConcentricityGeoTol = (SwDMDimXpertConcentricityGeoTol)myAnnotation;

                                            boolstatus = myConcentricityGeoTol.GetMaxTolerance(ref isMax, ref Tolerance);

                                            Debug.Print(" Maximum tolerance is set: " + isMax);

                                            if (isMax)

                                            {

                                                Debug.Print(" Maximum tolerance: " + Tolerance);

                                            }

                                            Debug.Print(" Material condition modifier (swDmDimXpertMaterialConditionModifier_e): " + myConcentricityGeoTol.Modifier);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_Cylindricity:

                                            Debug.Print(" Type = Cylindricity geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_Flatness:

                                            Debug.Print(" Type = Flatness geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            SwDMDimXpertFlatnessGeoTol myFlatnessGeoTol = default(SwDMDimXpertFlatnessGeoTol);

                                            myFlatnessGeoTol = (SwDMDimXpertFlatnessGeoTol)myAnnotation;

                                            boolstatus = myFlatnessGeoTol.GetPerUnitArea(ref Enabled, ref length, ref width, ref i, ref j, ref k);

                                            Debug.Print(" Per unit area(enabled,width,length,i,j,k): " + Enabled + ", " + length + ", " + width + ", " + i + ", " + j + ", " + k);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_LineProfile:

                                            Debug.Print(" Type = Line profile geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            SwDMDimXpertLineProfileGeoTol myLineProfileGeoTol = default(SwDMDimXpertLineProfileGeoTol);

                                            myLineProfileGeoTol = (SwDMDimXpertLineProfileGeoTol)myAnnotation;

                                            boolstatus = myLineProfileGeoTol.GetPlanarZoneVector(ref i, ref j, ref k);

                                            Debug.Print(" Planar zone vector(i,j,k): " + i + ", " + j + ", " + k);

                                            Debug.Print(" Outer tolerance value: " + myLineProfileGeoTol.OuterToleranceValue);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_Parallelism:

                                            Debug.Print(" Type = Parallelism geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            myOriTol = (SwDMDimXpertOrientationGeoTol)myAnnotation;

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_Perpendicularity:

                                            Debug.Print(" Type = Perpendicularity geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            myOriTol = (SwDMDimXpertOrientationGeoTol)myAnnotation;

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_Position:

                                            Debug.Print(" Type = Position geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            SwDMDimXpertPositionGeoTol myPosGeoTol = default(SwDMDimXpertPositionGeoTol);

                                            myPosGeoTol = (SwDMDimXpertPositionGeoTol)myAnnotation;

                                            boolstatus = myPosGeoTol.GetMaxTolerance(ref isMax, ref Tolerance);

                                            Debug.Print(" Maximum tolerance is set: " + isMax);

                                            if (isMax)

                                            {

                                                Debug.Print(" Maximum tolerance: " + Tolerance);

                                            }

                                            boolstatus = myPosGeoTol.GetPlanarZoneVector(ref i, ref j, ref k);

                                            Debug.Print(" Planar zone vector(i,j,k): " + i + ", " + j + ", " + k);

                                            boolstatus = myPosGeoTol.GetProjectedZone(ref Enabled, ref Value);

                                            Debug.Print(" Projected zone is in force: " + Enabled);

                                            if (Enabled)

                                            {

                                                Debug.Print(" Value: " + Value);

                                            }

                                            Debug.Print(" Material condition modifier (swDmDimXpertMaterialConditionModifier_e): " + myPosGeoTol.Modifier);

                                            Debug.Print(" Position zone type (swDmDimXpertPositionZoneType_e): " + myPosGeoTol.ZoneType);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_Straightness:

                                            Debug.Print(" Type = Straightness geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            SwDMDimXpertStraightnessGeoTol myStraightnessGeoTol = default(SwDMDimXpertStraightnessGeoTol);

                                            myStraightnessGeoTol = (SwDMDimXpertStraightnessGeoTol)myAnnotation;

                                            boolstatus = myStraightnessGeoTol.GetMaxTolerance(ref isMax, ref Tolerance);

                                            Debug.Print(" Maximum tolerance is set: " + isMax);

                                            if (isMax)

                                            {

                                                Debug.Print(" Maximum tolerance: " + Tolerance);

                                            }

                                            boolstatus = myStraightnessGeoTol.GetPerUnitLength(ref Enabled, ref Distance);

                                            Debug.Print(" Per unit length(enabled,distance): " + Enabled + ", " + Distance);

                                            boolstatus = myStraightnessGeoTol.GetPlanarZoneVector(ref i, ref j, ref k);

                                            Debug.Print(" Planar zone vector(i,j,k): " + i + ", " + j + ", " + k);

                                            Debug.Print(" Material condition modifier (swDmDimXpertMaterialConditionModifier_e): " + myStraightnessGeoTol.Modifier);

                                            Debug.Print(" Position zone type (swDmDimXpertStraightnessZoneType_e): " + myStraightnessGeoTol.ZoneType);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_SurfaceProfile:

                                            Debug.Print(" Type = SurfaceProfile geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            SwDMDimXpertSurfaceProfileGeoTol mySurfProfGeoTol = default(SwDMDimXpertSurfaceProfileGeoTol);

                                            mySurfProfGeoTol = (SwDMDimXpertSurfaceProfileGeoTol)myAnnotation;

                                            Debug.Print(" Outer tolerance: " + mySurfProfGeoTol.OuterToleranceValue);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_Symmetry:

                                            Debug.Print(" Type = Symmetry geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            SwDMDimXpertSymmetryGeoTol mySymmetryGeoTol = default(SwDMDimXpertSymmetryGeoTol);

                                            mySymmetryGeoTol = (SwDMDimXpertSymmetryGeoTol)myAnnotation;

                                            boolstatus = mySymmetryGeoTol.GetMaxTolerance(ref isMax, ref Tolerance);

                                            Debug.Print(" Maximum tolerance is set: " + isMax);

                                            Debug.Print(" Maximum tolerance: " + Tolerance);

                                            boolstatus = mySymmetryGeoTol.GetZoneDirection(ref i, ref j, ref k);

                                            Debug.Print(" Zone direction(i,j,k): " + i + ", " + j + ", " + k);

                                            modifier = mySymmetryGeoTol.Modifier;

                                            Debug.Print(" Modifier (swDmDimXpertMaterialConditionModifier_e): " + modifier);

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_Tangency:

                                            Debug.Print(" Type = Tangency geometric tolerance");

                                            SwDMDimXpertTangencyGeoTol myTangencyGeoTol = default(SwDMDimXpertTangencyGeoTol);

                                            myTangencyGeoTol = (SwDMDimXpertTangencyGeoTol)myAnnotation;

                                            tempFeature = null;

                                            boolstatus = myTangencyGeoTol.GetOriginFeature(ref tempFeature);

                                            if ((tempFeature != null))

                                            {

                                                Debug.Print(" Feature of origin for this geometric tolerance: " + tempFeature.Name);

                                            }

                                            break;

                                        case swDmDimXpertAnnotationType_e.swDmDimXpertGeoTol_TotalRunout:

                                            Debug.Print(" Type = Total runout geometric tolerance");

                                            myGeoTol = (SwDMDimXpertGeometricTolerance)myAnnotation;

                                            break;

                                        default:

                                            Debug.Print(" Type = <unknown>");

                                            break;

                                    }

                                    // Annotation Information

                                    Debug.Print(" Annotation Information:");

                                    Debug.Print(" CAD identifier count = " + myAnnotation.GetCadIdentifierCount());

                                    if (myAnnotation.GetCadIdentifierCount() > 0)

                                    {

                                        Debug.Print(" CAD Identifiers:");

                                        vObject = (Object[])myAnnotation.GetCadIdentifiers();

                                   

                                                for (vObjectIndex = vObject.GetLowerBound(0); vObjectIndex <= vObject.GetUpperBound(0); vObjectIndex++)

                                                {

                                                    Debug.Print("       " + vObject[vObjectIndex]);

                                                }

                                    }

                                    Debug.Print(" Is free state: " + myAnnotation.IsFreeState());

                                    Debug.Print(" Is statistical: " + myAnnotation.IsStatistical());

                                    Debug.Print(" Is suppressed: " + myAnnotation.IsSuppressed());

                                    Debug.Print(" Is to be inspected: " + myAnnotation.IsToBeInspected());

                                    if ((myAnnotation.Feature == null))

                                    {

                                        Debug.Print(" Is not associated with a feature");

                                    }

                                    else

                                    {

                                        Debug.Print(" Is associated with a feature");

                                    }

                                    // Geometric Tolerance Information for Orientation Dimensions

                                    if ((myOriTol != null))

                                    {

                                        Debug.Print(" Orientation Geometric Tolerance Information:");

                                        boolstatus = myOriTol.GetMaxTolerance(ref isMax, ref Tolerance);

                                        Debug.Print(" Maximum tolerance is set: " + isMax);

                                        if (isMax)

                                        {

                                            Debug.Print(" Maximum tolerance: " + Tolerance);

                                        }

                                        boolstatus = myOriTol.GetPlanarZoneVector(ref i, ref j, ref k);

                                        Debug.Print(" Planar zone vector(i,j,k): " + i + ", " + j + ", " + k);

                                        boolstatus = myOriTol.GetProjectedZone(ref Enabled, ref Value);

                                        Debug.Print(" Projected zone is in force: " + Enabled);

                                        if (Enabled)

                                        {

                                            Debug.Print("Value: " + Value);

                                        }

                                        Debug.Print(" Material condition modifier (swDmDimXpertMaterialConditionModifier_e): " + myOriTol.Modifier);

                                        Debug.Print(" Position zone type (swDmDimXpertOrientationZoneType_e): " + myOriTol.ZoneType);

                                    }

                                    // Geometric Tolerance Information

                                    if ((myGeoTol != null))

                                    {

                                        Debug.Print(" Geometric Tolerance Information:");

                                        Debug.Print(" Number of primary datums: " + myGeoTol.GetPrimaryDatumCount());

                                        if (myGeoTol.GetPrimaryDatumCount() > 0)

                                        {

                                            

                                            vInt = (int[])myGeoTol.GetPrimaryDatumModifiers();

                                            for (vObjectIndex = vInt.GetLowerBound(0); vObjectIndex <= vInt.GetUpperBound(0); vObjectIndex++)

                                            {

                                                modifier = (swDmDimXpertMaterialConditionModifier_e)vInt[vObjectIndex];

                                                Debug.Print(" Primary datum modifier (swDmDimXpertMaterialConditionModifier_e): " + modifier);

                                            }

                                            

                                            vObject = (Object[])myGeoTol.GetPrimaryDatums();

                                            for (vObjectIndex = vObject.GetLowerBound(0); vObjectIndex <= vObject.GetUpperBound(0); vObjectIndex++)

                                            {

                                                datum = (swDmDimXpertDatum)vObject[vObjectIndex];

                                                Debug.Print(" Primary datum: " + datum.Identifier);

                                            }

                                        }

                                        Debug.Print(" Number of secondary datums: " + myGeoTol.GetSecondaryDatumCount());

                                        if (myGeoTol.GetSecondaryDatumCount() > 0)

                                        {

                                            

                                            vInt = (int[])myGeoTol.GetSecondaryDatumModifiers();

                                            for (vObjectIndex = vInt.GetLowerBound(0); vObjectIndex <= vInt.GetUpperBound(0); vObjectIndex++)

                                            {

                                                modifier = (swDmDimXpertMaterialConditionModifier_e)vInt[vObjectIndex];

                                                Debug.Print(" Secondary datum modifier (swDmDimXpertMaterialConditionModifier_e): " + modifier);

                                            }

                                            

                                            vObject = (Object[])myGeoTol.GetSecondaryDatums();

                                            for (vObjectIndex = vObject.GetLowerBound(0); vObjectIndex <= vObject.GetUpperBound(0); vObjectIndex++)

                                            {

                                                datum = (swDmDimXpertDatum)vObject[vObjectIndex];

                                                Debug.Print(" Secondary datum: " + datum.Identifier);

                                            }

                                        }

                                        Debug.Print(" Number of tertiary datums: " + myGeoTol.GetTertiaryDatumCount());

                                        if (myGeoTol.GetTertiaryDatumCount() > 0)

                                        {

                                            

                                            vInt = (int[])myGeoTol.GetTertiaryDatumModifiers();

                                            for (vObjectIndex = vInt.GetLowerBound(0); vObjectIndex <= vInt.GetUpperBound(0); vObjectIndex++)

                                            {

                                                modifier = (swDmDimXpertMaterialConditionModifier_e)vInt[vObjectIndex];

                                                Debug.Print(" Tertiary datum modifier (swDmDimXpertMaterialConditionModifier_e): " + modifier);

                                            }

                                            

                                            vObject = (Object[])myGeoTol.GetTertiaryDatums();

                                            for (vObjectIndex = vObject.GetLowerBound(0); vObjectIndex <= vObject.GetUpperBound(0); vObjectIndex++)

                                            {

                                                datum = (swDmDimXpertDatum)vObject[vObjectIndex];

                                                Debug.Print(" Tertiary datum: " + datum.Identifier);

                                            }

                                        }

                                        Debug.Print(" Geometric Tolerance: " + myGeoTol.Tolerance);

                                    }

                                    // Dimension Tolerance Information

                                    if ((myDimTol != null))

                                    {

                                        Debug.Print(" Dimension Tolerance Information:");

                                        Debug.Print(" Dimension tolerance type (swDmDimXpertDimensionToleranceType_e): " + myDimTol.DimensionType);

                                        Debug.Print(" Dimension tolerance: " + myDimTol.GetNominalValue());

                                        boolstatus = myDimTol.GetPlusAndMinusTolerance(ref plusTol, ref minusTol);

                                        Debug.Print(" Plus / Minus: " + plusTol + " / " + minusTol);

                                        boolstatus = myDimTol.GetUpperAndLowerLimit(ref upperTol, ref lowerTol);

                                        Debug.Print(" Upper / Lower: " + upperTol + " / " + lowerTol);

                                        Debug.Print(" Block tolerance precision: " + myDimTol.BlockToleranceDecimalPlaces);

                                        Debug.Print(" Limits and fits code: " + myDimTol.LimitsAndFitsCode);

                                    }

                                    Debug.Print(" ");

                                }

                            }

                        }

                    }

                }

            }

        }

        public SldWorks swApp;

    }

 



Provide feedback on this topic

SOLIDWORKS welcomes your feedback concerning the presentation, accuracy, and thoroughness of the documentation. Use the form below to send your comments and suggestions about this topic directly to our documentation team. The documentation team cannot answer technical support questions. Click here for information about technical support.

* Required

 
*Email:  
Subject:   Feedback on Help Topics
Page:   DimXpert Example (C#)
*Comment:  
*   I acknowledge I have read and I hereby accept the privacy policy under which my Personal Data will be used by Dassault Systèmes

Print Topic

Select the scope of content to print:

x

We have detected you are using a browser version older than Internet Explorer 7. For optimized display, we suggest upgrading your browser to Internet Explorer 7 or newer.

 Never show this message again
x

Web Help Content Version: API Help (English only) 2013 SP05

To disable Web help from within SOLIDWORKS and use local help instead, click Help > Use SOLIDWORKS Web Help.

To report problems encountered with the Web help interface and search, contact your local support representative. To provide feedback on individual help topics, use the “Feedback on this topic” link on the individual topic page.