Hello all,
I need a Lisp which can match pipe inverts to other pipes. Like Matchprop of Cad command but it will only match Inverts of first selected pipe to other selected pipes.
Thank you.
Solved! Go to Solution.
Solved by hippe013. Go to Solution.
@saqib_tipa, I am not much of a coder, but I would vote for this on the C3D Ideas Forum!
When convenient, could a Lisp expert please assist me with my post?
Thanks.
Thank you for reply, I need to match pipe Invert levels (start Invert Elevation & End Invert Elevation) to other selected pipes. Suppose I select pipe 1 so it should store pipe 1 invert levels and then I select pipe 2,3,4 then it should apply pipe 1 Invert levels to pipe 2,3,4.
Hope you understand.
Thanks.
@hippe013 wrote:Can you explain, in detail, the workflow that you imagine?
From the source pipe, which invert end gets applied to which end of the target pipe? Is that based on user selection, selecting close to start point uses the start versus selecting closer to the end point uses the end invert?
Or is it select source pipe, and its start invert gets applied to the start of the target pipe and the end invert of source pipe gets applied to the end invert of the target pipe?
I do think that with the previous examples that I have shown you that you are capable of writing this one on your own. Below is a quick example of getting a single source pipe and then prompting for a selection set of target pipes.
Then loop through each pipe in the selection set and set its inverts.
(defun c:PipeMatchInverts ( / srcSS tarSS)
(princ "\nSelect Source Pipe: ")
(setq srcSS (ssget ":s+." '(( 0 . "AECC_PIPE"))))
(if srcSS
(progn
(princ "\nSelect Select Target Pipes:")
(setq tarSS (ssget '(( 0 . "AECC_PIPE"))))
(if tarSS
(progn
(setq srcPipe (vlax-ename->vla-object (ssname srcSS 0)))
(setq halfDia (/ (vlax-get-property srcPipe 'InnerDiameterOrWidth) 2.0))
(setq p0Inv (- (caddr (vlax-safearray->list (vlax-variant-value (vlax-get-property srcPipe 'PointAtParam 0)))) halfdia))
(setq p1Inv (- (caddr (vlax-safearray->list (vlax-variant-value (vlax-get-property srcPipe 'PointAtParam 1)))) halfdia))
(setq n 0)
(repeat (sslength tarSS)
(setq tarPipe (vlax-ename->vla-object (ssname tarSS n)))
(P:PipeSetInverts tarPipe p0Inv p1Inv)
(setq n (+ n 1))
)
)
)
)
)
(princ)
)
(defun P:PipeSetInverts (pipe startInvert endInvert / p0 p1)
(setq halfDia (/ (vlax-get-property pipe 'InnerDiameterOrWidth) 2.0))
(setq p0 (vlax-safearray->list (vlax-variant-value (vlax-get-property pipe 'PointAtParam 0))))
(setq p1 (vlax-safearray->list (vlax-variant-value (vlax-get-property pipe 'PointAtParam 1))))
(if startInvert (setq p0 (list (car p0) (cadr p0) (+ startInvert halfDia))))
(if endInvert (setq p1 (list (car p1) (cadr p1) (+ endInvert halfdia))))
(vlax-invoke-method pipe 'SetStartAndEndPoints (vlax-3d-point p0)(vlax-3d-point p1))
)
Note, this code does NOT resize the structures after the pipes have been adjusted. I will let you figure how to have the structures resize.
Thank you for the reply. Sir believe me I am not able to write Lisp code by my own. It's very difficult for me to write such code. Previous example you are talking about I just tried to figure out but could not. This code looks different from previous code, and I know I cannot do it in the first place.
The code you provided now is very nice and working as I want to. I don't need structures to resize at the moment, if needed I will ask for your help again but for now it's enough for me.
Thank you so much again for your help. You are amazing.
Can't find what you're looking for? Ask the community or share your knowledge.