# # Ext_Int_Ordered_Boundary_Nodes.met Export Template # -------------------------------------------------- # # This template will export boundary nodes in their # drawing order (triangular mesh) # # It can be used to export the boundary nodes in the order they # are drawn for a drawing program or a plotter or for ant other purpose # # The template writes the boundary nodes using the Argus ONE # contour format. You can copy the contours from the output file # and export them into an Argus ONE information type layer # Other export formats can be added ot replace the one available here. # # IMPORTANT NOTE: This template will export both external # and internal boundary nodes. It was adopted from the outEdgeOrdered # tempplate by Argus Holdings on May 2010. All rights to the template # belong to Argus Holdings but you may use it feely if you do not remove # this note. # # Another IMPORTANT NOTE: This template is not designed to # work with nodes that are on more than one # boundary segment # # This template make use of the ArrayPIE dll. You must have # such three Array PIEs placed in your ArgusPIE directory # They should be named MyArray1.dll, MyArray2.dll and MyArray3.dll # The ArrayPIE can be downloaded from our ftp site at: # http://www.argusone.com/pub/ArgusPIEs/PC_PIEs/ArrayPIE/ArrayPIE.dll # # the boundaries, external and internal are exported in a random order. # Another template, Ext_1st_Int_Ordered_Boundary_Nodes.met is available # from the site which does export the external boundary first and the # internal boundaries after # Define Variable: i [Integer] Define Variable: j [Integer] Define Variable: k [Integer] Define Variable: l [Integer] Define Variable: count [Integer] Define Variable: starti [Integer] Define Variable: last2 [Integer] Define Variable: NumberOfBoundaryNodes [Integer] Define Variable: NumberOfBoundaryNodesDoubled [Integer] Define Variable: MaxBoundaries [Integer] Define Variable: Boundary [Integer] Define Variable: TotalCountedNodes [Integer] Define Variable: ok [Integer] Define Variable: ok2 [Integer] Define Variable: Test [Integer] Define Variable: ExportFormat [Integer] Define Variable: NodeNumber [Integer] # # Set Variable: j:= 0 Set Variable: i:= 0 Set Variable: k:= 0 Set Variable: l:= 0 Set Variable: count:= 0 Set Variable: NumberOfBoundaryNodes:= CountNodes(NodeOnBoundary()) Set Variable: NumberOfBoundaryNodesDoubled:= 2*NumberOfBoundaryNodes Set Variable: MaxBoundaries:=NumberOfBoundaryNodes Set Variable: TotalCountedNodes:= 0 #Set Variable: ExportFormat:=1 Set Variable: ExportFormat:=2 # # This part of the template will calculate the element edges that # are on the boundary of the mesh (triangular mesh) and load them # into an array (MyArray1.DLL) # # This part is a modification of the OutEdge template # Redirect output to: $BaseName$ # # Initialize three arrays - for each one an Array PIE dll # file must be in the Argus PIE directory # Set Variable: ok:= 1 Set Variable: Test:= MyArray1Init(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE MyArray1.DLL could not be found! Please make sure such a PIE is in the ArgusPIE directory!" Set Variable: ok:= 0 End if # Set Variable: ok:= 1 Set Variable: Test:= MyArray2Init(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE MyArray2.DLL could not be found! Please make sure such a PIE is in the ArgusPIE directory!" Set Variable: ok:= 0 End if # Set Variable: ok:= 1 Set Variable: Test:= MyArray3Init(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE MyArray3.DLL could not be found! Please make sure such a PIE is in the ArgusPIE directory!" Set Variable: ok:= 0 End if # If: ok # Fill all three arrays with zeros Loop for: Variable i from: 0 to: NumberOfBoundaryNodesDoubled-1 step: 1 Evaluate expression: MyArray1Set(i,0) Evaluate expression: MyArray2Set(i,0) Evaluate expression: MyArray3Set(i,0) End loop # # This part will loop through the elements and assign the array members the node numbers # Set i to -1 because the arrays start at 0 Set Variable: i:= -1 # Loop for: Elements # Output all boundary edges # the output (for each edge )will be: # elem node1 node2 # where: # elem is the number of the element # node1 is the first node of the edge (counterclockwise when looking from elem) # node2 is the second node of the edge If: NthNeighbourNum(1) = 0 Set Variable: i:= i+1 Evaluate expression: MyArray1Set(i,NthNodeNum(1)) Set Variable: i:= i+1 Evaluate expression: MyArray1Set(i,NthNodeNum(2)) End if If: NthNeighbourNum(2) = 0 Set Variable: i:= i+1 Evaluate expression: MyArray1Set(i,NthNodeNum(2)) Set Variable: i:= i+1 Evaluate expression: MyArray1Set(i,NthNodeNum(3)) End if If: NthNeighbourNum(3) = 0 Set Variable: i:= i+1 Evaluate expression: MyArray1Set(i,NthNodeNum(3)) Set Variable: i:= i+1 Evaluate expression: MyArray1Set(i,NthNodeNum(1)) End if End loop # # Loop through the array containing the boundary nodes and copy them to a new array # in the order they appear in the mesh, each node followed by the node it is # connected to loop for: variable Boundary from: 1 to: MaxBoundaries # TotalCountedNodes counts how many nodes were already written out # when it is equal to the number of boundary nodes the process ends If: TotalCountedNodes0 Evaluate expression: MyArray3Set(l,MyArray1Get(k)) Set Variable: l:=l+1 End if End Loop Loop for: Variable k from: 0 to:l-1 Evaluate expression: MyArray1Set(k, MyArray3Get(k)) Evaluate expression: MyArray2Set(k,0) End loop End if End if End loop End if End loop End if End loop # Evaluate expression: MyArray1Dispose() Evaluate expression: MyArray2Dispose() Evaluate expression: MyArray3Dispose() End if End file