This procedure creates a partial topology and uses map_topocomplete to add the missing elements to complete it.
To complete a topology
- Create a polygon topology and save it to a file.
- Start a new project and attach the drawing using ade_aliasadd, ade_dsattach, and ade_dwgactivate.
- Query in some of the topology's objects to create a partial topology. Use query functions.
- Load the topology into memory from the project drawing.
- Open the topology with read access.
- Test the topology for correctness and completeness.
- Optionally, you can get topology statistics. You can add code to display the statistics.
- Close the topology.
- Use map_topocomplete to bring in the missing objects to complete the topology.
- Repeat steps 5 through 7 to test the topology for completeness.
- Unload the topology. >
(ade_qryclear) ; clear all queries (ade_qrysettype "draw") ; draw query results (setq pt1 (list 2.9123 8.8513 0.0)) (setq pt2 (list 5.9134 1.1634 0.0)) (setq pt3 (list 10.7931 1.7354 0.0)) (setq pt4 (list 10.0371 8.8742 0.0)) (setq lst (list "polygon" "crossing" pt1 pt2 pt3 pt4)) (setq qry_id (ade_qrydefine "" "" "" "location" lst "")) (if (null qry_id ) (prompt "\nERROR: Query definition failed.") (progn (prompt "\nQuerying in part of the polygon topology.") (setq result (ade_qryexecute)) (if (null result) (prompt "\nExecution of query failed.") ) ) )
(setq result (tpm_acload name nil))
(setq tpm_id (tpm_acopen "test" nil))
(if (tpm_infocorrect tpm_id) (prompt "\nTopology is correct.") (prompt "\nTopology is not correct.") ) (if (tpm_infocomplete tpm_id) (prompt "\nTopology is complete.") (prompt "\nTopology is not complete.") )
(setq lst (map_topostat tpm_id))
(if (null lst)
(prompt "\nERROR: Unable to get statistics.")
(progn
(prompt "\nNumber of nodes: ")
(princ (cdr (assoc "node_count" lst)))
(prompt "\nNumber of links: ")
(princ (cdr (assoc "link_count" lst)))
)
)
(tpm_acclose tpm_id)
(map_topocomplete "test")
(tpm_acunload "test")