Change Pipe Network Flow Direction
11 Apr 2016Can I get a show of hands for how many of you wish you could set the default Flow Direction Method when creating pipes? That’s a lot of raised hands. Of course, you can create a pipe rule in VBA or .NET to have this automated. But that turns into a lot of steps, just to change this one setting for each pipe. Thankfully, Autodesk has allowed access to this property through AutoLISP.
The property “FlowDirection” is a read-only property of the queried pipe. But there is another property of the pipe named “FlowDirectionMethod” which is writable.
The FlowDirectionMethod property requires an integer. The allowable integers range from 0 to 3 and represent “Bi-Directional” at 0, “Start to End”, “End to Start”, and finally “By Slope” at 3.
(defun OP:setFlowMethod (oPipe iMethod / eSetPropertyAttempt)
;; Change flow direction method of supplied pipe object
;;_ Copyright © 2016 by Richard Lawrence
(setq eSetPropertyAttempt
(vl-catch-all-apply
'vlax-put-property
(list oPipe
'FlowDirectionMethod
iMethod
)
)
)
(if (vl-catch-all-error-p eSetPropertyAttempt)
(vl-catch-all-error-message eSetPropertyAttempt)
t
)
)
Select allThis is intended as a sub-routine. One would need to supply the associated pipe object and the corresponding integer to this routine.
If you liked this post, you can share it with your followers or follow me on Twitter!