tpm_elemadj

tpm_elemadj

Anonymous
Not applicable
465 Views
6 Replies
Message 1 of 7

tpm_elemadj

Anonymous
Not applicable
Hi All,

I am working on learning the topology functions and I can not get the tpm_elemadj function to work. I am using global variables for topo_id and cent_id and these print out correctly from the princ statements. but the lst and final princ statements print nil. The code follows:

;A fair amount of this code came from Rackesh at www.4d-technologies.com
;David Van Eman

(defun C:rect (/ cent_id lst TopoName topo_id)
(setq TopoName (getstring "Enter Topology name."))
(setq
Exists nil
lst '()
)

(if (setq Exists (tpm_acexist TopoName T nil))
(setq LoadedNow (tpm_acload TopoName))
)

(if Exists
(progn
(setq topo_id (tpm_acopen TopoName nil))

(Centid)
(princ (strcat "\nrect cent_id: " (rtos cent_id 2 0) "\n"))

(Adj)
(princ "\nPast Adj function")
(tpm_acclose topo_Id)
)
(if LoadedNow
(tpm_acunload TopoName)
)
)
(princ)
)


(defun Centid (/ cell ss cnt pt)

(if topo_id
(progn
(setq cell (getstring "Enter Cell number: "))
(setq ss (ssget "x" (list '(0 . "TEXT") (cons 1 cell))))
(setq cnt 0)
(if ss
(repeat (sslength ss)
(setq pt (cdr (assoc 10 (entget (ssname ss cnt)))))
)
)
(setq cent_id (tpm_elemfind topo_id 3 pt))
(princ (strcat "\nCentid cent_id: " (rtos cent_id 2 0) "\n"))
(setq ss nil)
)
)
(princ)
)


(defun Adj (/ final)
(princ "\n\nIn Adj")
(princ (strcat "\nTopo ID: " (rtos topo_id 2 0)))
(princ (strcat "\nCentroid ID: " (rtos cent_id 2 0)))
(setq lst (tpm_elemadj topo_id cent_id 1)) ;HERE IS THE PROBLEM
(setq final (vl-prin1-to-string lst))
(princ lst)
(princ final)
(princ "\nAdj done\n")
)

Thanks to anyone who takes a look at this.
Dave
0 Likes
466 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
FYI

System: Dell precision 490
4GB ram
Intel Xeon 5150 2.66GHz
Nvidia Quadro FX 3500
Dual Dell 2007 WFP monitors

Autodesk 2004 products
0 Likes
Message 3 of 7

Anonymous
Not applicable
What happens if you change this line
(setq topo_id (tpm_acopen TopoName nil))
to this
(setq topo_id (tpm_acopen TopoName T))

Are you using the VLisp editor to write and test run the code? If so add a
watch to the variables topo_id & cent_id, make sure they are REALs not
strings or integers.
Last you do have a dwg open with a topologies open when you are running it
correct?
--

Murph
The world is not FLAT so why is your GIS data?
http://map3d.wordpress.com
wrote in message news:5665136@discussion.autodesk.com...
Hi All,

I am working on learning the topology functions and I can not get the
tpm_elemadj function to work. I am using global variables for topo_id and
cent_id and these print out correctly from the princ statements. but the lst
and final princ statements print nil. The code follows:

;A fair amount of this code came from Rackesh at www.4d-technologies.com
;David Van Eman

(defun C:rect (/ cent_id lst TopoName topo_id)
(setq TopoName (getstring "Enter Topology name."))
(setq
Exists nil
lst '()
)

(if (setq Exists (tpm_acexist TopoName T nil))
(setq LoadedNow (tpm_acload TopoName))
)

(if Exists
(progn
(setq topo_id (tpm_acopen TopoName nil))

(Centid)
(princ (strcat "\nrect cent_id: " (rtos cent_id 2 0) "\n"))

(Adj)
(princ "\nPast Adj function")
(tpm_acclose topo_Id)
)
(if LoadedNow
(tpm_acunload TopoName)
)
)
(princ)
)


(defun Centid (/ cell ss cnt pt)

(if topo_id
(progn
(setq cell (getstring "Enter Cell number: "))
(setq ss (ssget "x" (list '(0 . "TEXT") (cons 1 cell))))
(setq cnt 0)
(if ss
(repeat (sslength ss)
(setq pt (cdr (assoc 10 (entget (ssname ss cnt)))))
)
)
(setq cent_id (tpm_elemfind topo_id 3 pt))
(princ (strcat "\nCentid cent_id: " (rtos cent_id 2 0) "\n"))
(setq ss nil)
)
)
(princ)
)


(defun Adj (/ final)
(princ "\n\nIn Adj")
(princ (strcat "\nTopo ID: " (rtos topo_id 2 0)))
(princ (strcat "\nCentroid ID: " (rtos cent_id 2 0)))
(setq lst (tpm_elemadj topo_id cent_id 1)) ;HERE IS THE PROBLEM
(setq final (vl-prin1-to-string lst))
(princ lst)
(princ final)
(princ "\nAdj done\n")
)

Thanks to anyone who takes a look at this.
Dave
0 Likes
Message 4 of 7

Anonymous
Not applicable
Murph!

Thats it! Thank You!!

Dave
0 Likes
Message 5 of 7

Anonymous
Not applicable
YW.


--

Murph
The world is not FLAT so why is your GIS data?
http://map3d.wordpress.com
wrote in message news:5666730@discussion.autodesk.com...
Murph!

Thats it! Thank You!!

Dave
0 Likes
Message 6 of 7

Anonymous
Not applicable
Murph,

FYI. It was the T in the setq topo_id line that did the trick.

Dave
0 Likes
Message 7 of 7

Anonymous
Not applicable
That's what I thought, the T allow you to write to it, nil was read only.

--

Murph
The world is not FLAT so why is your GIS data?
http://map3d.wordpress.com
wrote in message news:5666748@discussion.autodesk.com...
Murph,

FYI. It was the T in the setq topo_id line that did the trick.

Dave
0 Likes