nanoCAD Platform Help

Steel welded neck GOST 12821-80

Script (only the BeforeConnect and OnConnect procedures)

Other can be seen in the database of the standard details.

// For flange necessary to geometric constraints
// Have been installed on the gasket and parametric -
// The second flange.
function OnConnect {
  // When setting dependencies on multiple objects, we first
  // Store information about objects,
  // And then use it to install, depending
  
  // So, the first stage - the selection of the parameters
  // Here rPart is 0 (the serial number of the query begins
  // 0.
  // If this is the first request, and the selected object = laying GOST 15180,
  // Save the parameters of the object (pads) under the number 0
  if (rPart == 0 & & obj.strTheName == " GOST 15180-86 ") {
     setWorkId (0, obj.objectID);
     Handled = OBJ_HANDLED;
  };
  
  // For the second request - check further whether this
  // Object flange GOST 12821, and, if so, to save the parameters of this
  // Flange at number 1.
  if (rPart == 1 & & obj.strTheName == " GOST 12821-80 ") {
     setWorkId (1, obj.objectID);
     Handled = OBJ_HANDLED;
  };
  
  
  // Then consider the stored data objects:
  // If something was preserved in the first stage, that is, the data is not equal to 0
  if (getWorkId (0) = 0)
  {
     // Restore the data object variable obj 0
     getObjData (getWorkId (0), obj);
     // Closest to the insertion point plane
     strNearestPlane = GetNearestPlane (pntOrigin);
     // If the plane had been found,
     if (strNearestPlane! = UnknownValue) {
        // We set the geometric constraints of the insert.
        SetGeomConstraint (INSERT, CONTRDIRECT, obj, WP1, strNearestPlane, 0, TRUE);
        // Do not choose a direction vector
        NoVectorSelect = 1;
     };
  };
  
  // If in the latter case the data has been stored, then:
  if (getWorkId (1) = 0)
  {
     // Restore them back to the variable obj
     getObjData (getWorkId (1), obj);
    
     // Set a set of parametric dependencies
     // In nominal pressure, nominal size,
     // Form with a cut flange Series and a number of performances.
     SetParamConstraint (Py, obj, EXPR, " obj.Py ", TRUE);
     SetParamConstraint (Dy, obj, EXPR, " obj.Dy ", TRUE);
     SetParamConstraint (bSection, obj, EXPR, " obj.bSection ", TRUE);
     SetParamConstraint (R, obj, EXPR, " obj.R ", TRUE);
     SetParamConstraint (isp_row, obj, EXPR, " obj.isp_row ", TRUE);
     NoVectorSelect = 1;
  };
  
  // This block is realized when joining the flange to the pipe
  // The first request for a check type and subtype
  if (rPart == 0 & & obj.strTheType == " Tube " & & obj.strTheSubType == " Round ") {
     // Is the nearest plane
     strNearestPlane = GetNearestPlane (pntOrigin);
     if (strNearestPlane! = UnknownValue) {
        // Set geometric
        SetGeomConstraint (INSERT, CONTRDIRECT, obj, WP2, strNearestPlane, 0, TRUE);
        SetGeomConstraint (DIRECITON, CODIRECT, obj, WPnormal, obj.WPnormal, 0, TRUE);
        NoVectorSelect = 1;
     };
     // And parametric dependence
     SetParamConstraint (Dn, obj, EXPR, " obj.B ", TRUE);
     Handled = OBJ_HANDLED;
  };
};