Visual LISP, AutoLISP and General Customization
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
Splines to their correct elevation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Hi all,
I have a (2D) drawing with hundreds of elevation lines as splines. They all have their supposed z elevation as text next to them. Is there a lisp that would raise these splines to the elevation in the text by firstselecting the spline and then clicking on the elevation text?
Thanks!
Samu
Solved! Go to Solution.
Re: Splines to their correct elevation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
samu3 wrote:Hi all,
I have a (2D) drawing with hundreds of elevation lines as splines. They all have their supposed z elevation as text next to them. Is there a lisp that would raise these splines to the elevation in the text by firstselecting the spline and then clicking on the elevation text?
Thanks!
Samu
(defun c:elevate (/ spl txt elev)
(vl-load-com)
(prompt "\nSelect Polyline")
(while (and (setq spl (ssget "_:S:L" '((0 . "*POLYLINE"))))
(not (redraw (setq pl (ssname spl 0)) 3))
(princ "\nSelect text for elevation:")
(setq txt (ssget "_:S" '((0 . "TEXT"))))
(numberp
(setq elev (read (vla-get-textstring (vlax-ename->vla-object (ssname txt 0)))))
) ;_ end of numberp
) ;_ end of and
(redraw pl 4)
(vla-put-elevation (vlax-ename->vla-object pl) elev)
(princ (strcat "\nElevation at " (rtos elev 2 2)))
) ;_ end of while
(princ)
)
HTH
Re: Splines to their correct elevation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
samu3 wrote:
...I have a (2D) drawing with hundreds of elevation lines as splines....would raise these splines to the elevation in the text
by firstselecting the spline and then clicking on the elevation text?...
it if they are splines, and not lwpolylines with the spline option ...
they are 3d objects and don't have the elevation property, each fit point may have different elevation,
So, if they all have the same elevation, try this code:
(defun c:test(/ tx) (prompt "\nSelect contour line to change elevation : ") (command "select" "single" pause) (setq tx (cdr (assoc 1 (entget (car (entsel"\nSelect elevation text : ")))))) (command "change" "p" "" "p" "e" tx "") (PRINC) )
Hope that helps,
Henrique
Re: Splines to their correct elevation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
hmsilva wrote:
it if they are splines, and not lwpolylines with the spline option ...
they are 3d objects and don't have the elevation property, each fit point may have different elevation,Henrique
Good point Henrique
....
(if (vlax-property-available-p (vlax-ename->vla-object pl) 'Elevation) (progn (vla-put-elevation (vlax-ename->vla-object pl) elev) (princ (strcat "\n<<<Elevation at " (rtos elev 2 2) ">>>")) )(princ (strcat "\n<<<Unable to Change Elevation>>>")))
....
Holler if you need help putting this together samu3
HTH
Re: Splines to their correct elevation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Re: Splines to their correct elevation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
Sorry for the late reply... But thank you so much guys, you solved my problem! Appreciate it!
Samu
Re: Splines to their correct elevation
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
samu3 wrote:Sorry for the late reply... But thank you so much guys, you solved my problem! Appreciate it!
Samu
Happy to help samu3
Cheers
