PCL and Customization > Accessing the Patran Database > Nodes
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX''">   
Nodes
Exporting Node Data
There are three parts to extracting node data from a Patran database. First, a count of the number of nodes must be obtained in order to allocate memory for the storage of the node data. Second, the IDs of all the nodes of interest must be extracted. Third, the node data is retrieved. Nodes can be extracted on an individual basis if the node ID is already known or all the nodes of a specified group can be retrieved or all the nodes in the model can be extracted.
To get the count of nodes in the entire model the following function is used.
 
db_count_nodes
( <num_nodes> )
  
Output:
 
 
INTEGER
<num_nodes>
The internal ID of the currently active group.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name differs. It is DbFCountNodes.
int DbFCountNodes ( num_nodes )
int 	*num_nodes
The function described below determines the number of nodes in a specified group.
  
db_count_nodes_in_group
( <group_id>, <num_nodes> )
 
Input:
 
 
INTEGER
<group_id>
The internal ID of the group of which the nodes are to be members. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600.
Output:
 
 
INTEGER
<num_nodes>
The number of nodes belonging to the specified group.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name differs. It is DbFCountNodesInGroup.
int DbFCountNodesInGroup ( group_id, num_nodes )
int	group_id 
int 	*num_nodes
The IDs of all the nodes in the database are retrieved through the following functions.
 
db_get_node_ids
( <num_nodes>, <node_ids> )
 
Input:
 
 
INTEGER
<num_nodes>
The number of nodes in the database.
Output:
 
 
INTEGER ARRAY
<node_ids>
The number of nodes belonging to the specified group.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name differs. It is DbFGetNodeIds.
int DbFGetNodeIds ( num_nodes, node_ids )
int 	num_nodes
int 	*node_ids
The IDs of the nodes belonging to a specified group are retrieved through the function below.
 
db_get_all_node_ids_in_group
( <num_nodes>,<group_id>,<node_ids>)
  
Input:
 
 
INTEGER
<num_nodes>
The number of nodes belonging to the specified
group.
INTEGER
<group_id>
The internal ID of the group of which the nodes are to be members. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600
Output:
 
 
INTEGER ARRAY
<node_ids>
An array containing the <num_nodes> IDs of all the nodes belonging to the specified group.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
To extract the actual node data, the function described below is used. This function can be used to extract node information for individual nodes, for all the nodes of a group and for all the nodes in the database, depending on the number of node IDs input.
Notes:
The C name differs. It is DbFGetAllNodeIdsInGroup.
int DbFGetAllNodeIdsInGroup ( num_nodes, group_id, node_ids )
int 	num_nodes
int 	group_id
int 	*node_ids
  
db_get_nodes
(num_nodes, nodes_ids, ref_coords, analy_coords, glob_xyzs)
 
Input:
 
 
INTEGER
num_nodes
The number of nodes belonging to the specified group.
INTEGER
node_ids(num_nodes)
The IDs of the nodes of interest.
Output:
 
 
INTEGER
ref_coords(num_nodes)
The IDs of the reference coordinate frames for the nodes of interest. Zero if no reference.
INTEGER ARRAY
analy_coords
An array containing the analysis coordinate frame ID for each specified node.
REAL
glob_xyzs(num_nodes,3)
An array containing the global rectangular position vector for each node.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name differs. It is DbFGetNodes.
int DbFGetNodes ( num_nodes, node_ids, ref_coords, analy_coords, glob_xyzs )
int 	num_nodes
int 	*node_ids
int 	*ref_coords
int 	*analy_coords
float 	*glob_xyzs
 
db_get_node_ass_elem
(element_count, element_id, node_count, node_id)
Description:
 
 
This function finds the nodes associated to the given elements.
Input:
 
 
INTEGER
element_count
This value specifies the number of elements.
INTEGER
element_id (elem_count)
This array specifies the element ids.
Output:
 
 
INTEGER
node_count
This value returns the number of nodes and the number of offsets in the node_id output value.
INTEGER
node_id(VIRTUAL)
This array returns the node ids.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate an error.
Error Conditions:
 
-1
This is an internal error status condition. There is no corresponding status message in the message database.
Remarks:
Memory is allocated for the output variable within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.
Example:
INTEGER status, element_count, element_id(100), node_count, @
        node_id(VIRTUAL), i_elem, i_node
element_count = 100
FOR (i_elem = 1 TO element_count) 
   element_id(i_elem) = i_elem
END FOR
status = db_get_node_ass_elem(element_count, element_id, @
            node_count, node_id)
IF (0 < status) THEN
   msg_to_form(status, 4, 0, 0, 0.0, ““)
ELSE
   IF (0 > status) THEN
      /* Error information already displayed */
   ELSE
      write_line(“node_count =”, no
de_count)
      FOR (i_node = 1 TO  node_count)
         write_line(“node_id(“, i_node, ”) =”, node_id(i_node))
      END FOR
   END IF
END IF
 
db_get_node_ass_geo
(lp_geo, node_count, node_id)
Description:
 
 
This function finds the nodes associated to the given geometry.
Input:
 
 
STRING
lp_geo [ ]
This value contains the list processor string of geometric entities. Ex: “Surface 3.1 5.1”. This string can be empty or not allocated and the function will exit normally (Return Value=0).
Output:
 
 
INTEGER
node_count
This value returns the number of nodes and the number of offsets in the node_id output value.
INTEGER
node_id(VIRTUAL)
This array returns the node ids.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate an error.
Error Conditions:
 
-1
This is an internal error status condition. There is no corresponding status message in the message database.
Remarks:
Memory is allocated for the output variable within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.
Example:
INTEGER status, node_count, node_id(VIRTUAL), i_node
STRING lp_geo[100]
 
lp_geo = “Solid 1.2.3 Surface 4”
status = db_get_node_ass_geo(lp_geo, node_count, node_id)
IF (0 < status) THEN
   msg_to_form(status, 4, 0, 0, 0.0, ““)
ELSE
   IF (0 > status) THEN
      /* Error information already displayed */
   ELSE
      write_line(“node_count =”, node_count)
      FOR (i_node = 1 TO  node_count)
         write_line(“node_id(“, i_node, ”) =”, node_id(i_node))
      END FOR
   END IF
END IF
 
 
db_get_node_ass_mpc
(mpc_count, mpc_id, node_count, node_id)
Description:
 
 
This function finds the nodes associated to the given MPCs.
Input:
 
 
INTEGER
mpc_count
This value specifies the number of MPCs.
INTEGER
mpc_id (mpc_count)
This array specifies the MPC ids.
Output:
 
 
INTEGER
node_count
This value returns the number of nodes and the number of offsets in the node_id output value.
INTEGER
node_id(VIRTUAL)
This array returns the node ids.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate an error.
Error Conditions:
 
-1
This is an internal error status condition. There is no corresponding status message in the message database.
Remarks:
Memory is allocated for the output variable within this function. If memory was allocated prior to the call, it is released prior to re-allocation. Therefore, if this function is used within a loop, there is no need to release the memory of the output variable.
Example:
INTEGER status, mpc_count, mpc_id(100), node_count, @
        node_id(VIRTUAL), i_mpc, i_node
 
mpc_count = 100
FOR (i_mpc = 1 TO mpc_count) 
   mpc_id(i_mpc) = i_mpc
END FOR
status = db_get_node_ass_mpc(mpc_count, mpc_id, node_count, @
            node_id)
IF (0 < status) THEN
   msg_to_form(status, 4, 0, 0, 0.0, ““)
ELSE
   IF (0 > status) THEN
      /* Error information already displayed */
   ELSE
      write_line(“node_count =”, node_count)
      FOR (i_node = 1 TO  node_count)
         write_line(“node_id(“, i_node, ”) =”, node_id(i_node))
      END FOR
   END IF
END IF
 
Importing Node Data
The function used to add node data to a database is as follows:
 
db_create_nodes
( <num_nodes>, <ref_coords>, <analy_coords>, <glob_xyzs>, <group_id>, <node_ids>, <node_exist> )
  
Input:
 
 
INTEGER
<num_nodes>
The number of nodes to be added to the database.
INTEGER ARRAY
<ref_coords>
The IDs of the reference coordinate frames for all <num_nodes> nodes. Zero if no reference.
INTEGER ARRAY
<analy_coords>
The IDs of the analysis coordinate frames for all <num_nodes> nodes. Zero if no reference.
REAL ARRAY
<glob_xyzs>
A 3x<num_nodes> array containing the global rectangular position vector for each node.
INTEGER
<group_id>
The internal ID of the group of which the nodes are to be members. This ID can be determined by either “db_get_group_id” or “db_get_current_group_id” as described in Groups, 600.
INTEGER ARRAY
<node_ids>
The <num_nodes> IDs of all the nodes.
Output:
 
 
INTEGER
<node_exist>
The ID of the first node which already exists in the database. Zero if no duplicates were encountered.
INTEGER
<Return Value>
This function returns a value of 0 when executed successfully and a non zero value to indicate a change in status or an error.
Notes:
The C name differs. It is DbFCreateNodes.
int DbFCreateNodes ( num_nodes, ref_coords, analy_coords, glob_xyzs, group_id, 
	node_ids, node_exist )
int 	num_nodes
int 	*ref_coords
int 	*analy_coords
float 	*glob_xyzs
int 	group_id
int 	*node_ids
int 	*node_exist