PDA

View Full Version : Z co-ordinate



nigel.chesworth
2005-04-04, 08:48 AM
is there a way to take a numeric piece of text and a block and change the Z value of the items selected to the value indicated by the selected numeric text.

The piece of text that I am selecting indicates the desired Z value. I want to introduce some level of automation to the process. I am currently selecting the items and changing the Z property item by item.

kennet.sjoberg
2005-04-04, 03:00 PM
Yes, easy i WCS but not in UCS

is the text TEXT or MTEXT ?
is the text inside a block or free standing ?

: ) Happy Computing !

kennet

kennet.sjoberg
2005-04-04, 10:11 PM
Nigel, here You have something to start with, now it works only on simple objects.


(defun c:Ztext (/ Ent Ztext Zvalue SelSet Index Ent EntDxf )
(if (setq Ent (entsel "Select the Ztext : " ) )
(progn
(setq Ztext (entget (car Ent )) )
(if (= (cdr (assoc 0 Ztext )) "TEXT" )
(progn
(setq Zvalue (atof (cdr (assoc 1 Ztext ))) )
(prompt "Select object to change Z" )
(if (setq SelSet (ssget) )
(progn
(setq Index 0 )
(while (setq Ent (ssname SelSet Index ) )
(setq EntDxf (entget Ent ) )
;; make a cond statement here for different objectypes
(if (assoc 10 EntDxf ) (setq EntDxf (subst (list 10 (cadr (assoc 10 EntDxf )) (caddr (assoc 10 EntDxf )) Zvalue ) (assoc 10 EntDxf ) EntDxf ) ) ( ) )
(if (assoc 11 EntDxf ) (setq EntDxf (subst (list 11 (cadr (assoc 11 EntDxf )) (caddr (assoc 11 EntDxf )) Zvalue ) (assoc 11 EntDxf ) EntDxf ) ) ( ) )
(entmod EntDxf )
(entupd EntName )
(setq Index (1+ Index ) )
)
)
(princ "No object to change Z selected ! " )
)
)
(princ "This is not a legal text object ! " )
)
)
(princ "Nothing selected ! " )
)
(princ)
)

: ) Happy Computing !

kennet