Nobull84 Posted March 18, 2014 Posted March 18, 2014 Has anyone seen a dimension lisp where I could replace the text with, for example, "? /P E.O.S." automatically without having to manually do it? I have other things to use this with but if someone where to provide something like this I think I could manipulate it to what I want. Ideally, I'd like to be able to copy a dimstyle that I already have and just have a constant in place of the actual dim. This way it would keep my layers, arrow types and other settings, etc... Any ideas are appreciated! -Nobull Quote
MSasu Posted March 18, 2014 Posted March 18, 2014 Basically you will need to create a selectio set using SSGET and an apropriate filter - there WCMATCH may be o help; parse its entities using SSNAME and get their associated lists with ENTGET. The label is stored in DXF code 1. Use SUBST to replace it and ENTMOD to update the entity. Quote
Nobull84 Posted March 18, 2014 Author Posted March 18, 2014 Thanks for the response MSasu. I'm sure your directions would work but, unfortunately, I'm not really able to build lisp functions yet. (still studying when I can on my own). Have you, or anyone, seen something like what you describe put together? I think my title should still state "Newbie" Thanks again, -Nobull Quote
lamensterms Posted March 18, 2014 Posted March 18, 2014 Hey NoBull, What is it you would like to do exactly? Replace the dimension text with a predetermined value, as you create the dimensions? Quote
Nobull84 Posted March 18, 2014 Author Posted March 18, 2014 lamensterms, Yea, that's about right. After placing a dimensioning, maybe the distance of two unknown steel beams, I have to question the location of them. I estimate the positions, dim it, then ddedit the dimension to "?" or "? E.O.S." or something along those lines and then put a cloud around it. I'm trying to phase out the changing of the text as sometimes it needs done too often and it always ends being the same text. -Nobull Quote
lamensterms Posted March 18, 2014 Posted March 18, 2014 Sounds pretty simple, I can certainly help you with some amateur code of my own, but it won't be until tomorrow when I get to work. Someone else might be able to sort something out for you in the meantime. Quote
MSasu Posted March 18, 2014 Posted March 18, 2014 Something like this? ;;; Edit Dimension to Query (18-III-2014) (defun c:EDQ( / ssetDim assocDim ) (prompt "\nSelect dimensions to mark with \"?\":") (while (setq ssetDim (ssget "_:S:E" '((0 . "DIMENSION")))) (entmod (subst '(1 . "?") (assoc 1 (setq assocDim (entget (ssname ssetDim 0)))) assocDim)) ) (princ) ) Instructions to use, courtesy of Lee Mac. Quote
Nobull84 Posted March 18, 2014 Author Posted March 18, 2014 MSasu, Not quite what I had in mind. I'm looking for a dimension command that has a default text. I think that's the simplest way I can put it. Hopefully, when I can get the lisp I need I can alter it to certain dimstyles. I'm sure I can alter the text to my needs. That does take a step out of what I was doing before so we're definitely headed in the right direction. Thanks again, -Nobull Quote
lamensterms Posted March 19, 2014 Posted March 19, 2014 Hey NoBull, Try this one: (DEFUN C:du () (setq ocmd (getvar "CMDECHO")) (setvar "cmdecho" 1) (command "dimlinear" pause pause pause) (setvar "cmdecho" 0) (command "dimedit" "n" "???" "L" "") (setvar "CMDECHO" ocmd) (princ) ) Note that I have set this up to work with DIMLINEAR, but you could probably tweak it to work with other dimension types. Not very sophisticated code, but it did work when I tested it. Good luck. Quote
MSasu Posted March 19, 2014 Posted March 19, 2014 Lamensterms, you may simplify that to avoid editing the newly added dimension: (command "[color=red]_[/color]dimlinear" pause pause [color=magenta]"_T" "???"[/color] pause) Quote
lamensterms Posted March 19, 2014 Posted March 19, 2014 Hi Mircea, Oh cool, I didn't even realise the DIMLINEAR command had the ability to edit the dimension text upon insertion. That would simplify the code even further. Thanks a lot for the tip. Quote
Nobull84 Posted March 19, 2014 Author Posted March 19, 2014 (edited) lamensterms, That's exactly what I need. Simple and to the point. One beginner question so I may manipulate to my needs: How can make two lines in the resulting dimension. I have one, for example, that is simply a "?". But I would like to do another with a "?", then start a new line, and have "D.E." thanks for the help thus far, -Nobull *update* Figured it out " \\P " Thanks again for the code Edited March 19, 2014 by Nobull84 Quote
Nobull84 Posted March 19, 2014 Author Posted March 19, 2014 Just in case someone wants to use this. I altered this to prompt a square revcloud afterward. The end result is this: (DEFUN C:D1 () (command ".dimstyle" "R" "[b]DIMSTYLE NAME HERE[/b]") (COMMAND "CLAYER" "[b]LAYER NAME HERE[/b]") (setq ocmd (getvar "CMDECHO")) (setvar "cmdecho" 1) (command "dimlinear" pause pause pause) (setvar "cmdecho" 0) (command "dimedit" "n" "?" "L" "") (setvar "CMDECHO" ocmd) (COMMAND "CLAYER" "[b]LAYER NAME HERE[/b]") (setq p1(getpoint "\nPick first corner of window: ")) (setq p2(getcorner p1 "\nOpposite corner: ")) (setvar "plinewid" 0) (command "rectang" p1 p2) (command "REVCLOUD" "O" (entlast) "N") (COMMAND "CLAYER" "0") (PRINC) ) I put several of these with different text, layers, and dimstyles together. It works well for what I do. I'm sure the code is "messy" as I only know how to copy and paste things together with slight variations. The only thing it could use is a return to the previous layer after the lisp completes but I don't really know how to do that... yet. In the meantime, does the trick. Thank you to all that got this going. This forum is an invaluable resource. -Nobull Quote
lamensterms Posted March 19, 2014 Posted March 19, 2014 Hey NoBull, Glad you found a solution. Regarding the layer setting, try this: (DEFUN C:D1 () (command ".dimstyle" "R" "DIMSTYLE NAME HERE") [color="red"][b] (setq LAYOR (getvar "CLAYER"))[/b][/color] (COMMAND "CLAYER" "LAYER NAME HERE") (setq ocmd (getvar "CMDECHO")) (setvar "cmdecho" 1) (command "dimlinear" pause pause pause) (setvar "cmdecho" 0) (command "dimedit" "n" "?" "L" "") (setvar "CMDECHO" ocmd) (COMMAND "CLAYER" "LAYER NAME HERE") (setq p1(getpoint "\nPick first corner of window: ")) (setq p2(getcorner p1 "\nOpposite corner: ")) (setvar "plinewid" 0) (command "rectang" p1 p2) (command "REVCLOUD" "O" (entlast) "N") [color="red"][b](setvar "CLAYER" LAYOR)[/b][/color] (PRINC) ) Marcus 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.