Pipe inverts lisp

Pipe inverts lisp

wizman
Enthusiast Enthusiast
2,101 Views
3 Replies
Message 1 of 4

Pipe inverts lisp

wizman
Enthusiast
Enthusiast

Hi,

 

Is there a way to access or change start or end pipe inverts thru lisp?

 

Thanks,

Ron

0 Likes
Accepted solutions (1)
2,102 Views
3 Replies
Replies (3)
Message 2 of 4

rkmcswain
Mentor
Mentor
Accepted 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)
)

 

Message 3 of 4

wizman
Enthusiast
Enthusiast

rkmcswain, thank you  for showing your solution. much appreciated.

 

Regards,

Ron

 

 

0 Likes
Message 4 of 4

rkmcswain
Mentor
Mentor
wizman wrote:

rkmcswain, thank you  for showing your solution. much appreciated.

No problem @wizman. Hope it helps.  

 

 

 

 

 

 

 

0 Likes