Message 1 of 4
Lisp to Modify Pipe Label to Add Material Property
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I am trying to write a lisp that will allow me to remove and add the pipe material property in a pipe label style. Below is the code that is intended to add the pipe material property to the label style:
(defun c:PipeLabelMat (/) (setq style0 (vlax-get (vla-get-activedocument (getpipeapp)) 'pipenetworklabelstyles)) (setq style1 (vlax-get style0 'PipeLabelStyles)) (setq style2 (vlax-get-property style1 'item "STRM- N")) (setq style3 (vlax-get-property style2 'textcomponents)) (setq style4 (vlax-get-property style3 'item "Pipe Data")) (setq style5 (vlax-get-property style4 'Contents)) (vlax-put style5 'value "<[2D Length - Center to Center(Uft|P0|RN|AP|Sn|OF)]>' - <[Pipe Inner Diameter or Width(Uin|P0|RN|AP|GC|UN|SD|OF)]>\" <[Material(CP)]> @ <[Pipe Slope(FP|P2|RN|AP|Sn|OF)]>\\P ") (vla-regen (vla-get-activedocument (vlax-get-acad-object)) acAllViewports) (princ) (princ "\nMaterial Added") (princ)) (defun getpipeapp (/ c3d verstring prodstring) (setq c3d (strcat "HKEY_LOCAL_MACHINE\\" (if vlax-user-product-key (vlax-user-product-key) (vlax-product-key))) c3d (vl-registry-read c3d "Release") verstring (substr c3d 1 (vl-string-search "." c3d (+ (vl-string-search "." c3d) 1))) prodstring (strcat "AeccXUiPipe.AeccPipeApplication." verstring)) (if (setq c3d (vla-getinterfaceobject (vlax-get-acad-object) prodstring)) c3d nil))
When I run the lisp, I get the following:
but the syntax in the pipe label style looks correct:
The code seems to work for every property except pipe material. Does anyone know why the pipe material is not recognized or if there is a different way to get the pipe material in the label style.
Thank you.