tpm_tracebestroute

AutoCAD Map 3D AutoLISP

Up a level
tpm_tracebestroute
 
 

Calculates the best round-trip route.

(tpm_tracebestroute tpm_id trace_id node0 node1 ... noden)

Returns a topology ID (real) representing the best route or nil.

tpm_id Topology ID (real) representing the network you are analyzing
trace_id Tracing model ID (real) returned by tpm_tracealloc
node0 Element ID (real) of the start and end node
node1 ... noden Element IDs (real) of the nodes to visit

The best route topology, whose ID this function returns if successful, is assigned an arbitrary name and is open for read. To get its name, use tpm_infoname. To change its name, use tpm_mntrename.

For the best route trace to succeed, the total calculated resistance cannot be greater than the value set for the maximum resistance or less than the value set for the minimum resistance. See tpm_tracesetmaxres and tpm_tracesetminres. The accumulated resistance value is the total resistance of the nodes and links that make up the best route.

Typical usage:

(setq bestroute 
   (tpm_tracebestroute 
      tpm_id 
      trace_id 
      7.0 1.0 4.0 10.0 5.0 6.0 9.0))

where 7.0 is the element ID of the start and end node and the remaining arguments are element IDs of the nodes to visit. (Element IDs are returned by tpm_traceelemid.)

ADSRX Equivalent

ade_id

tpm_tracebestroute

ade_id tpm_id,

ade_id trace_id,

struct resbuf *nodes);

Returns a topology ID or ADE_NULLID.

The list of nodes is implemented as a resbuf chain, which you can create like this:

struct resbuf *nodes;             // node list
struct resbuf rb0, rb1, .., rbN;  // resbuf elements
ade_id node0, node1, .., nodeN;   // nodes to analyze
// get tracing element IDs for the nodes 
// that we will analyze and assign them to 
// node0, node1, .., nodeN
...
rb0.restype = RTLONG;
rb0.resval.rlong = node0;
rb0.rbnext = &rb1;
rb1.restype = RTLONG;
rb1.resval.rlong = node1;
rb1.rbnext = &rb2;
...
rbN.restype = RTLONG;
rbN.resval.rlong = nodeN;
rbN.rbnext = NULL;
nodes = &rb0;