Message 1 of 4
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
Is there a way to access or change start or end pipe inverts thru lisp?
Thanks,
Ron
Solved! Go to Solution.
Hi,
Is there a way to access or change start or end pipe inverts thru lisp?
Thanks,
Ron
Solved! Go to Solution.
Yes. One way is shown below.
Note that in this simple example, the elevations (10.0 and 11.0) are hardcoded, and there is no error checking obviously.
Note also, that this code sets the centerline elevations, not the invert. You'll have to calculate the centerline elevation from the desired invert elevation.
(defun c:foo ( / sel ent obj p0 p1 p0a p1a)
; Select the pipe
(setq sel (entsel))
; Get the entity name
(setq ent (car sel))
; Convert to object
(setq obj (vlax-ename->vla-object ent))
; Get the Pipe START POINT
(setq p0 (vlax-safearray->list
(vlax-variant-value (vlax-get-property obj 'PointAtParam 0))
)
)
; Get the Pipe END POINT
(setq p1 (vlax-safearray->list
(vlax-variant-value (vlax-get-property obj 'PointAtParam 1))
)
)
; Calculate new START POINT
(setq p0a (list (nth 0 p0) (nth 1 p0) 10.0))
; Calculate new END POINT
(setq p1a (list (nth 0 p1) (nth 1 p1) 11.0))
; Make the changes
(vlax-invoke-method
obj
'SetStartAndEndPoints
(vlax-3d-point p0a)
(vlax-3d-point p1a)
)
(princ)
)