DMcNiel Posted July 27, 2009 Posted July 27, 2009 First, I am very new to writing lisp:unsure: I have a small lisp that I use to change the z value of a lwpolyline and I have a hyperlink set up to show me that value when I hover over the lwpolyline. I am not actually linking to anything. So my question is, can I get rid of the text in the hyperlink box that says "Ctrl+click to follow link" ? ;Zdepth lisp ;Moves a single selected polyline Z coordinate to user specified elevation ;Created 7/9/09 DJM ( defun c:RX (/ a x b c d a1 ) (setvar "cmdecho" 1) (setq a(entget (car (entsel)))) (setq x(cdr (assoc -1 a))) (setq b(assoc 38 a)) (setq c(getreal "\nENTER NEW Z VALUE")) (setq d(cons (car b ) c)) (setq a1(subst d b a)) (entmod a1) (setq c(rtos c 2 3)) (command "-hyperlink" "i" "o" x "" "current drawing" "none" c) ) Quote
The Buzzard Posted July 27, 2009 Posted July 27, 2009 First, I am very new to writing lisp:unsure: I have a small lisp that I use to change the z value of a lwpolyline and I have a hyperlink set up to show me that value when I hover over the lwpolyline. I am not actually linking to anything. So my question is, can I get rid of the text in the hyperlink box that says "Ctrl+click to follow link" ? ;Zdepth lisp ;Moves a single selected polyline Z coordinate to user specified elevation ;Created 7/9/09 DJM ( defun c:RX (/ a x b c d a1 ) (setvar "cmdecho" 1) (setq a(entget (car (entsel)))) (setq x(cdr (assoc -1 a))) (setq b(assoc 38 a)) (setq c(getreal "\nENTER NEW Z VALUE")) (setq d(cons (car b ) c)) (setq a1(subst d b a)) (entmod a1) (setq c(rtos c 2 3)) (command "-hyperlink" "i" "o" x "" "current drawing" "none" c) ) I only see the Z length or thicnkness and nothing else. I do not see the text in the hyperlink box you mention. I also notice whatever value entered for the hyperlink will be incorrect if the z value of the object is actually different. Quote
DMcNiel Posted July 27, 2009 Author Posted July 27, 2009 Thanks for taking a look. It may be a hyperlink setting that either shows or doesn't show that text. The hyperlinked value is whatever value is typed in for the z elevation movement, so the hyperlinked value should change whenever the z elevation changes, when using this routine. Ohh, by the way I am using autocad 2008 on a WIN XP system. Not sure if that makes any difference but I didn't mention it earlier. Quote
The Buzzard Posted July 27, 2009 Posted July 27, 2009 Thanks for taking a look. It may be a hyperlink setting that either shows or doesn't show that text. The hyperlinked value is whatever value is typed in for the z elevation movement, so the hyperlinked value should change whenever the z elevation changes, when using this routine. Ohh, by the way I am using autocad 2008 on a WIN XP system. Not sure if that makes any difference but I didn't mention it earlier. Originally I tested it in 2004. Since you brought up the idea about version, I tested it also now in 2009 and yes, I see the message now. Not sure at this stage how to get rid of it. I would review the command and any associated variables to see if this can be changed. If I find something first, I will bring it to your attention. Also take a look at this link: http://www.cadtutor.net/forum/showthread.php?t=36273 It does something along the lines of what I think your trying to do. I am not sure exactly, But give it a look anyway. Quote
Lee Mac Posted July 27, 2009 Posted July 27, 2009 I'm not sure that you can remove the Ctrl+click message, but here is an alternative method: [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:rx [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] ent Obj zVal[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]while[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] ent [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entsel[/color][/b] [b][color=#ff00ff]"\nSelect LWPolyline: "[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cond[/color][/b] [b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=DARKRED]'[/color][/b]ENAME [b][color=RED]([/color][/b][b][color=BLUE]type[/color][/b] ent[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]not[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#ff00ff]"AcDbPolyline"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-ObjectName[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] Obj [b][color=RED]([/color][/b][b][color=BLUE]vlax-ename->vla-object[/color][/b] ent[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n** Object is not an LWPOLYLINE **"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]t[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b] [b][color=#ff00ff]"\n** Nothing Selected **"[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] zVal [b][color=RED]([/color][/b][b][color=BLUE]getdist[/color][/b] [b][color=#ff00ff]"\nEnter New Z Value: "[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]progn[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-put-Elevation[/color][/b] Obj zVal[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-add[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-Hyperlinks[/color][/b] Obj[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-princ-to-string[/color][/b] zVal[b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]princ[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] A few pointers, if I may: Use more descriptive names for your variables, it makes the code 10x easier to read and understand - especially when you are first learning. Use conditional statements, such as IF, or a WHILE loop, to allow for null user input, or a missed click - else these will result in an error. When using the "command" function, include the language compatibility prefixes, i.e.: (command "_.line" (list 0 1 0) (list 2 3 4) "") Well done for localising your variables, many new LISP'ers miss that, and it can cause a lot of trouble.. If you have any further questions, just ask Lee Quote
DMcNiel Posted July 27, 2009 Author Posted July 27, 2009 Thanks for the pointers, I like the part about being more descriptive with the variables. With the code you have there, when I edited the Z elevation the first time the hyperlink was correct. When I used the same routine to change the elevation again, the hyperlink info didn't change. And , of course, the "Ctrl + click to follow link" was still there. Thanks for the help. Quote
Lee Mac Posted July 27, 2009 Posted July 27, 2009 I hadn't allowed for re-editing of hyperlinks, will update the code. And, yes, as I stated in my previous post, I don't think you can remove the Ctrl+click message. Lee Quote
Lee Mac Posted July 27, 2009 Posted July 27, 2009 Code updated, assuming 1 hyperlink per object: (defun c:rx (/ ent Obj zVal) (vl-load-com) (while (progn (setq ent (car (entsel "\nSelect LWPolyline: "))) (cond ((eq 'ENAME (type ent)) (if (not (eq "AcDbPolyline" (vla-get-ObjectName (setq Obj (vlax-ename->vla-object ent))))) (princ "\n** Object is not an LWPOLYLINE **"))) (t (princ "\n** Nothing Selected **"))))) (if (setq zVal (getdist "\nEnter New Z Value: ")) (progn (vla-put-Elevation Obj zVal) (if (zerop (vla-get-Count (setq hlnk (vla-get-Hyperlinks Obj)))) (vla-add hlnk (vl-princ-to-string zVal)) (vlax-for lnk hlnk (vla-put-url lnk zVal))))) (princ)) 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.