Creating Part Design Hole Standards

Creating Part Design Hole Standards

Update 11/3/2024

Just a quick clarification, the typedef defines the behavior of the standard, in this case the typedef only contains the Name and Main Diameter as a result these are the only affected fields in the Simple Hole Command when the Standard is applied. Notice that in the typeval I have all of the attributes defined, but the system is mart enough to only respect those previously defined by the typedef.

XML

Introduction

When defining Holes, we have to key in values for all of the fields which can become very repetitive and even troublesome from human fallibility standpoint. Out of The Box there is a way to define sets of Standard Hole sizes for the Five Types of Holes; Simple, Tapered, Counter Bored, Counter Sunk and Counter Drilled. This will allow you to select a Standard from the dropdown menu in the Hole Definition dialogue window, which will automatically fill the values for Main Diameter, Depth, Counter Bore Diameter, Counter Bore Depth, Thread Pitch, Thread Diameter etc.

Hole Standard

Folder Structure

You must store hole standards .xml files in separate directories under the following directory.

<Installation>\resources\standard

You must create the following directories under the standard directory.

  • SimpleHole to store simple hole files.
  • TaperedHole to store tapered hole files.
  • CounterSunkHole to store countersunk hole.
  • CounterDrilledHole to store counter drilled hole.
  • CounterBoredHole to store counterbored hole.

XML Base Files

Simple Hole

  • Description of the standard: Mandatory
  • Main Hole diameter: Mandatory
  • Main Hole Depth: Optional
  • Bottom Angle: Optional
  • Thread Diameter: Optional
  • Thread Depth: Optional
  • Pitch: Optional
  • Thread Description: Optional
MandatoryMandatoryOptionalOptionalOptionalOptionalOptionalOptional
NameMainDiameterMainDepthBottomAngleThreadDiameterThreadDepthPitchThreadDescription
Sample1102012011.8101.25Sample1
Sample2131011014.2102Sample2
Simple Hole Example Data

Create a New XML file and paste this XML content into the new file, and save it to the SimpleHole directory.

XML

Tapered Hole

  • Description of the standard: Mandatory
  • Main Hole diameter: Mandatory
  • Tapered angle: Mandatory
  • Anchor Point: Mandatory
    • Note: If you set the Anchor Point value to 0, the anchor point is placed at the bottom of the hole. If you set the Anchor Point value to 1, the anchor point is placed at the top of the hole.
  • Main Hole Depth: Optional
  • Bottom Angle: Optional
  • Thread Diameter: Optional
  • Thread Depth: Optional
  • Pitch: Optional
  • Thread Description: Optional
MandatoryMandatoryMandatoryMandatoryOptionalOptionalOptionalOptionalOptionalOptional
NameMainDiameterMainDepthTaperedAngleAnchorPointBottomAngleThreadDiameterThreadDepthPitchThreadDescription
Sample110525012011.251.25Sample1
Sample2141035111015.852Sample2

Create a New XML file and paste this XML content into the new file, and save it to the TaperedHole directory.

XML

Countersunk Hole

  • Description of the standard: Mandatory
  • Main Hole diameter: Mandatory
  • Counter Sunk Mode: Mandatory
    • Notes:
      • If you set Counter Sunk Mode to 0, you can define Counter Sunk Depth and Counter Sunk Angle.
      • If you set Counter Sunk Mode to 1, you can define Counter Sunk Diameter and Counter Sunk Depth.
      • If you set Counter Sunk Mode to 2, you can define Counter Sunk Diameter and Counter Sunk Angle.
  • Counter Sunk Diameter: Mandatory
  • Counter Sunk Depth: Mandatory
  • Counter Sunk Angle: Mandatory
  • Main Hole Depth: Optional
  • Bottom Angle: Optional
  • Thread Diameter: Optional
  • Thread Depth: Optional
  • Pitch: Optional
  • Thread Description: Optional
MandatoryMandatoryMandatoryMandatoryMandatoryMandatoryOptionalOptionalOptionalOptional
NameMainDiameterModeCounterSunkDepthCounterSunkAngleCounterSunkDiameterBottomAngleThreadDiameterPitchThreadDescription

Create a New XML file and paste this XML content into the new file, and save it to the CounterSunkHole directory.

XML

Counterdrilled Hole

  • Description of the standard: Mandatory
  • Main Hole diameter: Mandatory
  • Mode: Mandatory
    • Notes:
      • If you set Mode to 0, you cannot define Counter Sunk Diameter.
      • If you set Mode to 1, you can define Counter Sunk Diameter.
  • Counter Drilled Diameter: Mandatory
  • Counter Drilled Depth: Mandatory
  • Counter Drilled Angle: Mandatory
  • Counter Sunk Diameter: Mandatory
  • Main Hole Depth: Optional
  • Bottom Angle: Optional
  • Thread Diameter: Optional
  • Thread Depth: Optional
  • Pitch: Optional
  • Thread Description: Optional

Create a New XML file and paste this XML content into the new file, and save it to the CounterDrilledHole directory.

XML

Counterbored Hole

  • Description of the standard: Mandatory
  • Main Hole diameter: Mandatory
  • Counter Bored Diameter: Mandatory
  • Counter Bored Depth: Mandatory
  • Main Hole Depth: Optional
  • Bottom Angle: Optional
  • Thread Diameter: Optional
  • Thread Depth: Optional
  • Pitch: Optional
  • Thread Description: Optional

Create a New XML file and paste this XML content into the new file, and save it to the CounterBoredHole directory.

XML

XML File Structure

Within the XML File Structure is comprised of three chunks;

  • Units
  • Type Definition
  • Type Value

Units

This section defines the used Units within the Type Definition

XML

Type Definition

This section defines the structure of the Hole Type and the Attributes that can be Valuated within the XML file. I would recommend setting all of the values to 0.0 for the Float Values, 0 for the Int Values and set the Name and Description to Base<HoleType> i.e., BaseCounterDrilledHole, so you don’t confuse this with an actual set of values for a specific hole type.

XML

Type Value

The last section contains the individual Hole definitions, the Name attribute must be unique, I would recommend starting with Sample1 and Sample2 to get used to how this file works with the Hole function.

XML

Managing XML File Change

You can edit the XML file in two ways;

  • XML File Direct Edit
  • XML File Edition Through the Standards Interface

XML File Direct Edit

The XML file can be directly edited with a tool such as ‘NotePad++‘, without restarting CATIA. As long as the either the Hole Type is Changed and then changed back or the Standard set to No Standard or another Standard and then set back the Standard will update in the session post XML changes once the file is saved.

XML File Edition Through the Standards Interface

Its important to note that if the ‘CollectionStandard‘ environment variable is pointed to a different directory than the <Installation>\resources\standard folder then once any edition is made a copy of the new file will be created in the ‘CollectionStandard‘ folder. When a duplicate file is found in the ‘CollectionStandard‘ folder this file is used by default.

To use the Standards Interface you must have ‘Leader‘ access. Then from the top right hand corner within the thick client select Preferences->Standards to open the Standards Editor. In the top left-hand dropdown select the Category and then select the XML file to edit.

Standards Editor

Serializing and Deserializing the XML Files in C#

The following code will allow you to Deserialize the Standard Hole XML files into a class structure defined by the classes shown below. We can then add additional Standard Hole definitions and re-serialize the XML file again.

C#

XML Classes

Node
C#
Typedef
C#
Typeval
C#
Floatval
C#
Strval
C#

ViewModels

Eventually we will ahve a Nice User Interface where we can create new Standard Holes to do that we will need View Models, the following classes represent the required View Models.

Abstract Hole View Model

C#

Simple Hole View Model

C#

Tappered Hole View Model

C#

Counter Sunk Hole View Model

C#

Counter Drilled Hole View Model

C#

Counter Bored Hole View Model

C#