RyanAtNelco Posted May 8, 2009 Posted May 8, 2009 Hello, I am very new to LISP programming and finally have an idea for a lisp that would clear up alot of the drawings i work on but i have no idea where to start. I am trying to make something that would select all the dimensions and change the Z value of the text. There seems to be no field for Z position in dimension properties, however when i list a dimension there is a Z position. I want to do this because text displays incorrectly when the Z value is not precisely zero. I do not know how to translate any of this into code. Any info would be great and i would like to try to write this on my own so i can learn the process of writing a routine. Thanks in advance! Quote
Freerefill Posted May 8, 2009 Posted May 8, 2009 When I started with in-depth manipulation of an entity, I used (subst), (entmod) and (entupd) Basically, that list you get when you type (entget(car(entsel))) is what AutoCAD recognizes as the entity, and you can modify that list in order to modify the entity. Here's what I used to help me out: http://www.jefferypsanders.com/autolispintr_ent.html He pretty much taught me everything I know, until I found the AutoCAD LISP help file, and this forum. Quote
Lee Mac Posted May 8, 2009 Posted May 8, 2009 There are various ways to approach this - depending on a few things: Do you want the LISP to automatically select all dimension text? Do you want the user to select each individual dimension text, or maybe use a window selection method? Do you want to proceed with Visual LISP or plain Vanilla LISP Let me know how you would like to proceed and I will try to help you in any way that I can Lee Quote
lpseifert Posted May 8, 2009 Posted May 8, 2009 I'm curious (Lee) Using vla-get-Textposition creates a variant, vlax-variant-value makes a safearray, vlax-safearray->list creates a list. You can manipulate this list to create a new list to force Z to zero. How do you get the new list back to a variant to use vla-put-Textposition? (or am I approaching this entirely wrong?) Quote
Lee Mac Posted May 8, 2009 Posted May 8, 2009 You are on the right track Larry [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:dimtxt [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] dEnt dimObj tPos[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]and[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] dEnt [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 Dimension: "[/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]eq[/color][/b] [b][color=#ff00ff]"DIMENSION"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cdadr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] dEnt[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]setq[/color][/b] dimObj [b][color=RED]([/color][/b][b][color=BLUE]vlax-ename->vla-object[/color][/b] dEnt[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] tPos [b][color=RED]([/color][/b][b][color=BLUE]vlax-safearray->list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-variant-value[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-TextPosition[/color][/b] dimObj[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]vla-put-TextPosition[/color][/b] dimObj [b][color=RED]([/color][/b][b][color=BLUE]vlax-3D-point[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]list[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]car[/color][/b] tPos[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]cadr[/color][/b] tPos[b][color=RED])[/color][/b] [b][color=#009999]0.0[/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=RED])[/color][/b][b][color=RED])[/color][/b] Quote
Lee Mac Posted May 8, 2009 Posted May 8, 2009 Upon testing however, this doesn't seem to update the dimension..., :huh: Quote
RyanAtNelco Posted May 8, 2009 Author Posted May 8, 2009 Wow thanks for the quick replies! Im going to digest this material over the weekend. Quote
lpseifert Posted May 8, 2009 Posted May 8, 2009 Upon testing however, this doesn't seem to update the dimension..., no, but now I know how to make a point list a variant. Thanks Quote
RyanAtNelco Posted May 11, 2009 Author Posted May 11, 2009 What are the advantages to using visual lisp over vanilla lisp? Is visual easier to learn? Quote
Lee Mac Posted May 11, 2009 Posted May 11, 2009 What are the advantages to using visual lisp over vanilla lisp? Is visual easier to learn? There is more that you can accomplish using Visual LISP as it permits more access to program structure, whereas Vanilla LISP is not as versatile (and is older). I would say that Vanilla LISP is easier to learn, but Visual LISP is more intuitive when you have gotten to know it for a while. 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.