alanjt Posted April 29, 2010 Posted April 29, 2010 Nice work Lee. However, I think you have some redundancy with you midpoint command. Why Subtract the distance and startpoint? It will always be zero. Here's basically the same thing (posted at theswamp a few days ago). http://www.theswamp.org/index.php?topic=33138.msg385886#msg385886 Quote
Lee Mac Posted April 29, 2010 Posted April 29, 2010 Habit I suppose - wanting to be certain, but I suppose it is a bit redundant. Thanks mate. Quote
gordon_Gjs Posted April 29, 2010 Posted April 29, 2010 Lee Mac that works greats and is what I am looking for! Would it be possible to make an adjustment if I am not being too picky? Could the value be centered in the middle of the line instead of floating on top? Do you know if this could be reworked to work in Autocad 2010 LT with an add-on tool-kit? I tried to run it using the "SlingShot" tool-kit and it comes up... "Select objects: ; error: unable to get ObjectID: " ...After I select the object and hit enter. Thanks for this great Lisp! Great Job! Quote
Lee Mac Posted April 29, 2010 Posted April 29, 2010 I'm not sure about the LT Extender, as I have never worked with one, but I can certainly center the Text in the middle of the Polylines/Lines. Would you like a Background mask also? Quote
gordon_Gjs Posted April 29, 2010 Posted April 29, 2010 Could it be possible to make one with and without mask so I can compair? Sorry if I am a bug! Thanks! Quote
Lee Mac Posted April 29, 2010 Posted April 29, 2010 The effect of a Background Mask can be seen here: http://www.cadtutor.net/forum/showthread.php?t=42426 Quote
Lee Mac Posted April 29, 2010 Posted April 29, 2010 Try this Gordon, I've added Circles and Arcs also: [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] c:PlL [b][color=RED]([/color][/b] [b][color=BLUE]/[/color][/b] *error* spc i ss e Der p obj typ [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vl-load-com[/color][/b][b][color=RED])[/color][/b] [i][color=#990099];; Lee Mac ~ 29.04.10[/color][/i] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] *error* [b][color=RED]([/color][/b] msg [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]or[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]wcmatch[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcase[/color][/b] msg[b][color=RED])[/color][/b] [b][color=#a52a2a]"*BREAK,*CANCEL*,*EXIT*"[/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=BLUE]strcat[/color][/b] [b][color=#a52a2a]"\n** Error: "[/color][/b] msg [b][color=#a52a2a]" **"[/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] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] spc [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]or[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [color=Blue][b]AcModelSpace[/b][/color] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-ActiveSpace[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] doc [b][color=RED]([/color][/b][b][color=BLUE]vla-get-ActiveDocument[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-get-acad-object[/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]eq[/color][/b] [b][color=Blue]:vlax-true[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-MSpace[/color][/b] doc[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-ModelSpace[/color][/b] doc[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-PaperSpace[/color][/b] doc[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] i [b][color=#009900]-1[/color][/b] ss [b][color=RED]([/color][/b][b][color=BLUE]ssget[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=RED]([/color][/b][b][color=#009900]0[/color][/b] . [b][color=#a52a2a]"CIRCLE,ARC,LINE,*POLYLINE"[/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]while[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] e [b][color=RED]([/color][/b][b][color=BLUE]ssname[/color][/b] ss [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] i [b][color=RED]([/color][/b][b][color=BLUE]1+[/color][/b] i[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] Der [b][color=RED]([/color][/b][b][color=BLUE]angle[/color][/b] [b][color=DARKRED]'[/color][/b][b][color=RED]([/color][/b][b][color=#009999]0.[/color][/b] [b][color=#009999]0.[/color][/b] [b][color=#009999]0.[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getFirstDeriv[/color][/b] e [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getParamatPoint[/color][/b] e [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] p [b][color=RED]([/color][/b]MidPoint e[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=RED]([/color][/b][b][color=BLUE]setq[/color][/b] Obj [b][color=RED]([/color][/b]MCMText spc p [b][color=#009999]0.[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcat[/color][/b] [b][color=#a52a2a]"%<\\AcObjProp Object(%<\\_ObjId "[/color][/b] [b][color=RED]([/color][/b]GetObjectID [b][color=RED]([/color][/b][b][color=BLUE]vlax-ename->vla-object[/color][/b] e[b][color=RED])[/color][/b] doc[b][color=RED])[/color][/b] [b][color=#a52a2a]">%)."[/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=#a52a2a]"CIRCLE"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] typ [b][color=RED]([/color][/b][b][color=BLUE]cdr[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]assoc[/color][/b] [b][color=#009900]0[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]entget[/color][/b] e[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=#a52a2a]"Circumference"[/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=#a52a2a]"ARC"[/color][/b] typ[b][color=RED])[/color][/b] [b][color=#a52a2a]"ArcLength"[/color][/b] [b][color=RED])[/color][/b] [b][color=RED]([/color][/b] [b][color=#a52a2a]"Length"[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=#a52a2a]" \\f \"[/color][color=#a52a2a]%lu6\[/color][/b][b][color=#a52a2a]">%"[/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-rotation[/color][/b] Obj [b][color=RED]([/color][/b]MakeReadable Der[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] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] MCMText [b][color=RED]([/color][/b]block point width string [b][color=BLUE]/[/color][/b] o[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-put-AttachmentPoint[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]setq[/color][/b] o [b][color=RED]([/color][/b][b][color=BLUE]vla-AddMText[/color][/b] block [b][color=RED]([/color][/b][b][color=BLUE]vlax-3D-point[/color][/b] point[b][color=RED])[/color][/b] width string[b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=Blue]acAttachmentPointMiddleCenter[/color][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-put-InsertionPoint[/color][/b] o [b][color=RED]([/color][/b][b][color=BLUE]vlax-3D-point[/color][/b] point[b][color=RED])[/color][/b][b][color=RED])[/color][/b] o[b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] MakeReadable [b][color=RED]([/color][/b] a [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]and[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]>[/color][/b] a [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] [b][color=BLUE]pi[/color][/b] [b][color=#009900]2[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]<=[/color][/b] a [b][color=BLUE]pi[/color][/b][b][color=RED])[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]-[/color][/b] a [b][color=BLUE]pi[/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]and[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]>[/color][/b] a [b][color=BLUE]pi[/color][/b][b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]<=[/color][/b] a [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]*[/color][/b] [b][color=#009900]3[/color][/b] [b][color=BLUE]pi[/color][/b][b][color=RED])[/color][/b] [b][color=#009900]2[/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]+[/color][/b] a [b][color=BLUE]pi[/color][/b][b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED]([/color][/b] a [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]defun[/color][/b] GetObjectID [b][color=RED]([/color][/b] obj doc [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]if[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]eq[/color][/b] [b][color=#a52a2a]"X64"[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]strcase[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]getenv[/color][/b] [b][color=#a52a2a]"PROCESSOR_ARCHITECTURE"[/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]vlax-invoke-method[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-Utility[/color][/b] doc[b][color=RED])[/color][/b] [b][color=DARKRED]'[/color][/b]GetObjectIdString obj [b][color=Blue]:vlax-false[/color][/b] [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]itoa[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vla-get-Objectid[/color][/b] obj[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]defun[/color][/b] MidPoint [b][color=RED]([/color][/b] e [b][color=RED])[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getPointatDist[/color][/b] e [b][color=RED]([/color][/b][b][color=BLUE]/[/color][/b] [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getDistatParam[/color][/b] e [b][color=RED]([/color][/b][b][color=BLUE]vlax-curve-getEndParam[/color][/b] e[b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=#009999]2.[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] [b][color=RED])[/color][/b] Quote
alanjt Posted April 30, 2010 Posted April 30, 2010 Habit I suppose - wanting to be certain, but I suppose it is a bit redundant. Thanks mate. No problem. Hope the link helped. Quote
gordon_Gjs Posted April 30, 2010 Posted April 30, 2010 I just tried it and it works great, how hard would it be to take off background mask?? Thanks! Quote
Baber62 Posted July 30, 2013 Posted July 30, 2013 Hats off to both Lee and Alan ... lifesavers the both of you. Posted a similar question today requesting similar output ... should have known that you guys would have already encountered it and dealt with it by now. Thanks again. Quote
Lee Mac Posted July 30, 2013 Posted July 30, 2013 Wow - that is old code... Glad it helps Baber. Quote
Browning Zed Posted April 30, 2014 Posted April 30, 2014 Hi. Prompt how to change lisp removing autonumbering, but leaving the alignment? Quote
Edwin Mendoza Posted October 8, 2015 Posted October 8, 2015 Hi Lee, You may be able to assist me with this: Making DIMARC.lsp execute globally (or should I say, execute in a loop). Hence labels all arc segments in a drawing. Please note that preference is arc, not 3 Point Angular Dimension. Attached lsp files could lead you through. Sincerely with thanks, Edwin DIMARC.lsp MDIM_Multiple Polylines.lsp Quote
Edwin Mendoza Posted October 8, 2015 Posted October 8, 2015 By the way, it is likewise requesting a lisp to convert 3 Point Angular Dimension to Arc globally. Cheers, Edwin:) 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.