I've tried the first thing, its not too hard. The new layer has the same
properties (color, linetyp) as the old one.
The second I did not understand what you exactly want. Maybe you can give an
example, how the command line options should look like.
(defun C:setelev ( / laypref inc hi olddir dir eln oldlay newlay)
(vl-load-com)
(setq laypref (getstring "\nLayer prefix: ")
inc (getreal "\nIncrement (+): ")
hi (vlax-get-property (vlax-ename->vla-object (car (entsel "\n1.
polyline: "))) 'Elevation)
olddir "Increase")
(princ hi)
(initget "Increase Decrease eXit")
(setq dir (if (setq dir (getkword (strcat "\n[Increase/Decrease]<" (substr
olddir 1 1) ">: "))) dir olddir)
hi (if (= "Increase" dir) (+ hi inc) (- hi inc)))
(while (not (= dir "eXit"))
(setq eln (car (entsel (strcat "\nPolyline for elev=" (rtos hi) ": "))))
(if (= (cdr (assoc 0 (entget eln))) "LWPOLYLINE")
(progn
(vlax-put-property (vlax-ename->vla-object eln) 'Elevation hi)
(setq newlay (strcat laypref (setq oldlay (vlax-get-property
(vlax-ename->vla-object eln) 'Layer))))
(entmake (subst (cons 2 newlay) (assoc 2 (entget (tblobjname "layer"
oldlay))) (entget (tblobjname "layer" oldlay))))
(vlax-put-property (vlax-ename->vla-object eln) 'Layer newlay)
(setq olddir dir)
(initget "Increase Decrease eXit")
(setq dir (if (setq dir (getkword (strcat
"\n[Increase/Decrease/eXit]<" (substr olddir 1 1) ">: "))) dir olddir)
hi (if (= "Increase" dir) (+ hi inc) (- hi inc)))
)
(princ "\nno polyline selected")
)
)
(princ)
)
--
bob.at
CAD & GIS Services, Graz, Austria
schrieb im Newsbeitrag news:6013583@discussion.autodesk.com...
After working with this lisp for a few hours, I'm lovin it, but was
wondering if theres any way to make a few changes with out too much trouble?
One, is there any way for lisp routines to change object layers? I was
thinking that once the elevation has been changed on a contour, that it
would be a huge help if it could move that contour to a new layer, with the
same name, just with NEW or something added to the front of the layer name,
and if the layers not there, it automatically adds it. This would help out
so I can turn off the new layers and see what still needs to be done.
Also, I found that this code is great for just going from one contour to the
next, but when theres little island like contours floating around, you have
to exit the command and redo it. Would it be possible without too much
trouble to make it start the command, ask the increment value, and ask
increase or decrease. After that, for each new contour it asks for a
reference, then the new contour to be changed. It would involve picking a
reference then new contour each time, making it a bit slower, but easier to
move around the topo without having to restart the command, and it giving
you the option to pick increase or decrease before picking the new reference
contour, and if you select nothing, it just defaults to the last thing you
selected and you can go right ahead and pick the reference and just keep
going.
If all this is too much trouble, I understand. What I have been given
already is a tremendous help.