- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi TQ1918,
I am a year too late, but maybe this will help future people.
I did not create this lsp file, but I did edit it from an all thread rod lsp to pipe elevation lsp. So with this lsp file, it asks me for the desired elevation of the top of pipe in inches and then it does its magic to lengthen or shorten the pipe to the desired height. However, it does not work for the bottom of pipe. The command is "PTop".
(defun c:PTop (/ scr fil ss inc)
(setq scr (strcat (getvar "Logfilepath") "tmp.cod")
inc (getreal "Specify desired elevation for top of pipe in inches:")
ss (mapfilter "#39=2041" 0 0 1)
fil (open scr "w"))
(write-line "If item.CID = 2041 Then" fil)
(write-line "dim dia = item.endlocation(1, \"top\") - item.endlocation(1, \"z\")" fil)
(write-line "dim ton = item.endlocation(1, \"z\") + item.dim[\"Length\"].numvalue - dia" fil)
(write-line (strcat "dim uel = " (vl-princ-to-string inc)) fil)
(write-line "dim cel = ton" fil)
(write-line "dim nel = uel - cel" fil)
(write-line "item.dim[\"Length\"].value = item.dim[\"Length\"].numvalue + nel" fil)
(write-line "if item.dim[\"Length\"].value < 0.0 then" fil)
(write-line "item.dim[\"Length\"].value = 0" fil)
(write-line "endif endif" fil)
(close fil)
(executescript scr ss)
(command ".redraw")
(princ)
)