PaulyPHI Posted Friday at 02:38 PM Posted Friday at 02:38 PM Hi, I have been racking my brains to amend this lisp to do what i want and have failed.... so i ask you the gods of lisp for some help. I have acquired a lisp file via google AI that will set the elevation (z axis) of a poly line, easier to just select the pline and type in the elevation i hear you cry.... But my cunning plan was to amend the elevation of said pline by selecting the pline then select the text/mtext next to it..... I thought i could add some command to do this by looking at another lisp i have that does a similar thing, but i am a numpty and have given up.... I know there are many wise men out there that could just type some lines with their eyes shut and solve my problem... Obviously i would be greatly indebted to such persons and wish boundless fortune upon them granting wishes galore if i could... Also I just want an easy life as i approach retirement and thinking for gets in the way of thinking for myself..... Begging you nicely.. Paul SetPlineZ.lsp Quote
pkenewell Posted Friday at 04:22 PM Posted Friday at 04:22 PM (edited) @PaulyPHI Give this a try.SetPlineZ_Updated.lsp Edited 32 minutes ago by pkenewell Edited to change (atof) to (distof) to cover more numerical types, i.e. fractions - Thanks darshjalal for the idea in his code. 1 2 1 Quote
darshjalal Posted yesterday at 05:17 AM Posted yesterday at 05:17 AM PETA-INSERT ELEVATIONS FROM TEXTS INSIDE THE CLOSED OR OPEN POLYINE.LSP Try this one too 1 Quote
PaulyPHI Posted 4 hours ago Author Posted 4 hours ago On 5/22/2026 at 5:22 PM, pkenewell said: @PaulyPHI Give this a try.SetPlineZ_Updated.lsp Thank you very much sir, works perfect. I have compared the modified text file to the original and my brain just melted.... i can see some text that makes sense but the rest is just gobldee goop to me.... I'm just not programmed to understand it... Thank you once again. 1 Quote
pkenewell Posted 55 minutes ago Posted 55 minutes ago @PaulyPHI Here is a quick walk-though: This uses Visual LISP to pull the text string from the selected object and convert it to a real number. See the added comments below. (if (and ;; Logical AND = All conditions must be met. ;; 1) an object must be selected. (setq es (entsel "\nSelect Text Object: ")) ;; 2) The selected object must have a text string property, i.e. TEXT, MTEXT, ATTRIBUTE, MLEADER, etc. (vlax-property-available-p (vlax-ename->vla-object (car es)) 'TextString) ;; 3) Retrieve the textsting value if the above conditions are met. (setq newZ (vla-get-textstring (vlax-ename->vla-object (car es)))) ;; 4) The textstring value must evaluate to greater than 0 when converted to a real number. This only works if the text is numerical. (> (setq newZ (atof newZ)) 0.0) ) ;; if all conditions are met, then continue to the (progn) block that performs the changes. Quote
pkenewell Posted 51 minutes ago Posted 51 minutes ago On 5/25/2026 at 1:17 AM, darshjalal said: PETA-INSERT ELEVATIONS FROM TEXTS INSIDE THE CLOSED OR OPEN POLYINE.LSP Try this one too @darshjalal Nice work! Your added Automatic mode, and the code to strip numbers out of the text is over and above! 1 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.