# # Ext1st_Int_Ordered_Boundary_Nodes.met Export Template # ----------------------------------------------------- # # This template will export boundary nodes in their # drawing order (triangular mesh), external boundary nodes # are exported first, while internal boundary nodes follows # # 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 paste them into an Argus ONE information and Maps type layers # 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 August 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 15 Array PIEs placed in your ArgusPIE directory and named # as follwos: # NodesArray1.dll # NodesXArray1.dll # NodesYArray1.dll # # NodesArray2.dll # NodesXArray2.dll # NodesYArray2.dll # # NodesArray3.dll # NodesXArray3.dll # NodesYArray3.dll # # boundaryNodesArray.dll # boundaryNodesXArray.dll # boundaryNodesYArray.dll # # boundaryAreaArray.dll # boundaryNumberOfNodesArray.dll # boundaryStartLocationArray.dll # # The ArrayPIE can be downloaded from our ftp site at: # http://www.argusone.com/pub/ArgusPIEs/PC_PIEs/ArrayPIE/ArrayPIE.dll # After you download it, simply duplicate it and 14 times and rename # the duplicates using the exact names listed above # # The last part of the template orders the boundaries such that # the external boundary is listed first. There is a simpler template # that does not order the boundaries and it is available from our web site # # 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: NodeNumber [Integer] Define Variable: NumberOfBoundaries [Interger] Define Variable: boundaryNodesArrayLength [Integer] Define Variable: doaminBoundaryLength [Integer] Define Variable: domainBoundaryStartLocation [Integer] Define Variable: internalBoundaryLength [Integer] Define Variable: internalBoundaryStartLocation [Integer] # Define Variable: area [Real] Define Variable: areaMax [Real] # # 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: NumberOfBoundaries:=0 Set Variable: boundaryNodesArrayLength:=0 Set Variable: doaminBoundaryLength:=0 Set Variable: domainBoundaryStartLocation:=0 Set Variable: internalBoundaryLength:=0 Set Variable: internalBoundaryStartLocation:=0 # # Set Variable: areaMax:=0.0 # # 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 (NodesArray1.DLL), it will also load the X and Y coordinates # of the nodes to two arrays (NodesXArray1.DLL and NodesYAarray1.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:= NodesArray1Init(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE NodesArray1.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:= NodesXArray1Init(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE NodesXArray1.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:= NodesYArray1Init(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE NodesYArray1.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:= NodesArray2Init(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE NodesArray2.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:= NodesXArray2Init(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE NodesXArray2.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:= NodesYArray2Init(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE NodesYArray2.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:= NodesArray3Init(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE NodesArray3.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:= NodesXArray3Init(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE NodesXArray3.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:= NodesYArray3Init(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE NodesYArray3.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:= boundaryNodesArrayInit(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE boundaryNodesArray.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:= boundaryNodesXArrayInit(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE boundaryNodesXArray.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:= boundaryNodesYArrayInit(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE boundaryYNodesArray.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:= boundaryAreaArrayInit(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE boundaryAreaArray.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:= boundaryNumberOfNodesArrayInit(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE boundaryNumberOfNodesArray.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:= boundaryStartLocationArrayInit(NumberOfBoundaryNodesDoubled) If: IsNAN(Test) Alert: "The PIE boundaryStartLocationArray.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 nine arrays with zeros Loop for: Variable i from: 0 to: NumberOfBoundaryNodesDoubled-1 step: 1 Evaluate expression: NodesArray1Set(i,0) Evaluate expression: NodesXArray1Set(i,0) Evaluate expression: NodesYArray1Set(i,0) Evaluate expression: NodesArray2Set(i,0) Evaluate expression: NodesXArray2Set(i,0) Evaluate expression: NodesYArray2Set(i,0) Evaluate expression: NodesArray3Set(i,0) Evaluate expression: NodesXArray3Set(i,0) Evaluate expression: NodesYArray3Set(i,0) # boundaryNodesArray stores the oredered boundary nodes, n+1 nodes per contour Evaluate Expression: boundaryNodesArraySet(i,0) # boundaryNodesXArray and boundaryNodesYArray store the oredered boundary nodes X and Y locations for n+1 nodes per contour Evaluate Expression: boundaryNodesXArraySet(i,0) Evaluate Expression: boundaryNodesYArraySet(i,0) Evaluate Expression: boundaryAreaArraySet(i,0) Evaluate Expression: boundaryNumberOfNodesArraySet(i,0) Evaluate Expression: boundaryStartLocationArraySet(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: # node1 node2 # where: # 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: NodesArray1Set(i,NthNodeNum(1)) Evaluate expression: NodesXArray1Set(i,NthNodeX(1)) Evaluate expression: NodesYArray1Set(i,NthNodeY(1)) Set Variable: i:= i+1 Evaluate expression: NodesArray1Set(i,NthNodeNum(2)) Evaluate expression: NodesXArray1Set(i,NthNodeX(2)) Evaluate expression: NodesYArray1Set(i,NthNodeY(2)) End if If: NthNeighbourNum(2) = 0 Set Variable: i:= i+1 Evaluate expression: NodesArray1Set(i,NthNodeNum(2)) Evaluate expression: NodesXArray1Set(i,NthNodeX(2)) Evaluate expression: NodesYArray1Set(i,NthNodeY(2)) Set Variable: i:= i+1 Evaluate expression: NodesArray1Set(i,NthNodeNum(3)) Evaluate expression: NodesXArray1Set(i,NthNodeX(3)) Evaluate expression: NodesYArray1Set(i,NthNodeY(3)) End if If: NthNeighbourNum(3) = 0 Set Variable: i:= i+1 Evaluate expression: NodesArray1Set(i,NthNodeNum(3)) Evaluate expression: NodesXArray1Set(i,NthNodeX(3)) Evaluate expression: NodesYArray1Set(i,NthNodeY(3)) Set Variable: i:= i+1 Evaluate expression: NodesArray1Set(i,NthNodeNum(1)) Evaluate expression: NodesXArray1Set(i,NthNodeX(1)) Evaluate expression: NodesYArray1Set(i,NthNodeY(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: NodesArray3Set(l,NodesArray1Get(k)) Evaluate expression: NodesXArray3Set(l,NodesXArray1Get(k)) Evaluate expression: NodesYArray3Set(l,NodesYArray1Get(k)) Set Variable: l:=l+1 End if End Loop Loop for: Variable k from: 0 to:l-1 Evaluate expression: NodesArray1Set(k, NodesArray3Get(k)) Evaluate expression: NodesXArray1Set(k, NodesXArray3Get(k)) Evaluate expression: NodesYArray1Set(k, NodesYArray3Get(k)) Evaluate expression: NodesArray2Set(k,0) Evaluate expression: NodesXArray2Set(k,0) Evaluate expression: NodesYArray2Set(k,0) End loop End if End if End loop End if End loop End if End loop # # Start export external boundary in Argus ONE contour format # Loop for: Variable k from: 0 to: NumberOfBoundaries-1 If: boundaryAreaArrayGet(k) = areaMax Set Variable: doaminBoundaryLength:= boundaryNumberOfNodesArrayGet(k) Set Variable: domainBoundaryStartLocation:=boundaryStartLocationArrayGet(k) # Start export of domain boundary in Argus ONE contour format Start a new line Export expression: "## Name:" [G0] End line Start a new line Export expression: "## Icon:0" [G0] End line Start a new line Export expression: "# Points Count Value" [G0] End line Start a new line Export expression: doaminBoundaryLength [G0] End line Start a new line Export expression: "# X pos Y pos" [G0] End line Loop for: Variable j from: domainBoundaryStartLocation+1 to: domainBoundaryStartLocation+doaminBoundaryLength Start a new line Export expression: boundaryNodesXArrayGet(j); [G0] Export expression: boundaryNodesYArrayGet(j) [G0] End line Evaluate Expression: boundaryNodesArraySet(j,0) Evaluate expression: boundaryNodesXArraySet(j,0) Evaluate expression: boundaryNodesYArraySet(j,0) End loop End if End loop # # Start export internal boundaries in Argus ONE contour format # Loop for: Variable k from: 0 to: NumberOfBoundaries-1 If: boundaryAreaArrayGet(k) != areaMax Set Variable: internalBoundaryLength:= boundaryNumberOfNodesArrayGet(k) Set Variable: internalBoundaryStartLocation:=boundaryStartLocationArrayGet(k) Start a new line Export expression: "## Name:" [G0] End line Start a new line Export expression: "## Icon:0" [G0] End line Start a new line Export expression: "# Points Count Value" [G0] End line Start a new line Export expression: internalBoundaryLength [G0] End line Start a new line Export expression: "# X pos Y pos" [G0] End line Loop for: Variable j from: internalBoundaryStartLocation+1 to: internalBoundaryStartLocation+internalBoundaryLength If: boundaryNodesArrayGet(j)!=0 Start a new line Export expression: boundaryNodesXArrayGet(j); [G0] Export expression: boundaryNodesYArrayGet(j) [G0] End line End if End loop End if End loop # # Dispose all arrays to free memory # Evaluate expression: NodesArray1Dispose() Evaluate expression: NodesXArray1Dispose() Evaluate expression: NodesYArray1Dispose() Evaluate expression: NodesArray2Dispose() Evaluate expression: NodesXArray2Dispose() Evaluate expression: NodesYArray2Dispose() Evaluate expression: NodesArray3Dispose() Evaluate expression: NodesXArray3Dispose() Evaluate expression: NodesYArray3Dispose() Evaluate expression: boundaryNodesArrayDispose() Evaluate Expression: boundaryNodesXArrayDispose() Evaluate Expression: boundaryNodesYArrayDispose() Evaluate Expression: boundaryAreaArrayDispose() Evaluate Expression: boundaryNumberOfNodesArrayDispose() Evaluate Expression: boundaryStartLocationArrayDispose() # End if End file