This is what we use might help
(defun c:dh (/ dp1 dp2)
(setvar "cmdecho" 0)
(setq oldclayv (getvar "clayer")
)
(command "-dimstyle" "r" "wdt_linear001")
(command "-layer" "s" "wdt-dim" "")
(prompt "first extension line origin or return to select: ")
(command "_dim1" "hor" pause pause pause)
(setvar "clayer" oldclayv)
(princ)
)
Before I begin: Tom, I'm going to critique your code a bit, so please don't take offense. I do this so that we might all put out better code. Believe it or not, people actually sell poorly coded work and get away with it. I'll explain in a bit of rage within the critique.
Okay, here it is. Taking what Tom posted; critiquing it lightly (not to bash or abuse) and adding suggestions. Note: I don't have Autocad while writing this. Here goes anyway:
First line (/ dp1 dp2) There are no variables declared or set. There then seems to be no reason to not do this (). However, there are variables set which should be placed between ( and )
I'm going to step right over the "-dimstyle" command. I don't see how that works at this point.
(command "-layer" "s" "wdt-dim" "") [exasperated breath mode]Sigh[/ebm] As a programmer, you may think that using "s" is perfectly fine, and if it works it must be, but if someone ever comes to you and says, "Hey, that lisp you gave me didn't work. It told me to tell it what I want to do with the layer command..." don't be hard on him. He didn't know what layer you were trying to hard code. The better used value in this case would be to use "m" ILO "s". Even if the layer exists, it'll only be set, whereas if the layer doesn't exist, it will be made and set, unless you do as you've done and used "s", then you might want to brace yourself for questions. P.S. The reason this topic bothers me sooooooo much at this time more than EVER before, is for the mere fact that at my current employ, I'm forced to use this AWFUL program called AutoCrete. This is someones great idea of selling a product to a bunch of unknowing concrete contractors and making a killing. So, what's stopping me from going into this nuthead's lisp and improving it, you ask?
? Well, the bonehead had the nerve to encrypt the one lisp that might mean anything. The actual lsp file is encrypted. It's not fas. Anybody know of a good decrypter? Okay, back on with the critique.
(command "_dim1" "hor" pause pause pause) I'm not going to guess at what each succesive pause means, but the line before it seems to imply something. Now, since Andre' has need of more than "hor", wouldn't it be wise to setup some sort of user interaction? (initget "Hor Ver Ang") Then, set a variable to catch this solution before and then passing it to the command line. At the same time, more often than not, pause is used as select item or getpoint. If it's to get a point use getpoint set to a variable. If it's to get an entity, use one of the various methods available, i.e. entsel. Then, pass it along in variable form to the command line. Now, you say, "Well, I want to see the dimension on the screen before selecting all the points." Okay, use pause, but minimize the amount of times you use it. I know there are other ways of accomplishing this, but I do want to keep this simple.