Creating a dim style using lisp

bstaples

Usenet Archive
Joined
Jul 17, 2003
Messages
21
Reaction score
0
I'm trying to create a lisp routine that will restore our standard dimension styles. Right now we're just inserting blank template dwgs but if someone purges the dims out of their dwg, we have to use quick select to find the block and delete it. I know there's got to be a faster and easier way through lisp. I have one that works for layers and text but I'm having trouble with the dimension one. I can manually go through the command line in autocad but when I try to duplicate it in a lisp file, it asks for "Enter new value for dimension variable <-2>:" I think I'm doing something wrong when trying to get into the DIM mode in the lisp code. I've only done a few dimvars in the lisp to see if it would work but I'll post what I have so far. Can anyone guide me as to how to create a restore dimension styles lisp? Also of note, I'm a novice at lisp, I only understand the basics. Brian
 
This is how I've set ours up:

(COMMAND "-DIMSTYLE" "R" "Standard")
(COMMAND "-STYLE" "Standard" "romans" "0" "" "" "" "" "") (COMMAND "TEXTSIZE" ".09375") (COMMAND "DIMTXT" ".09375") (SETVAR "DIMDEC" 5) (SETVAR "DIMADEC" 0) (SETVAR "DIMALT" 0) (SETVAR "DIMALTD" 1) (SETVAR "DIMASZ" 0.125) (SETVAR "DIMATFIT" 3) (SETVAR "DIMAUNIT" 1)
(SETVAR "DIMAZIN" 0)

(IF (= (GETVAR "TILEMODE") 0)(SETVAR "DIMSCALE" 0))
(command "-dimstyle" "s" "standard" "y")

(defun chgdim ( / cont gr code) (setq gr (ssget "_x" (list (cons 0 "dimension") (cons 3 "STANDARD$0")))) (setq cont 0) (if gr (repeat (sslength gr) (setq code (entget (ssname gr cont))) (setq code (subst (cons 3 "STANDARD") (assoc 3 code) code)) (entmod code) (setq cont (+ 1 cont)) ) ) (princ) )

(if (tblsearch "DIMSTYLE" "Standard$0")(progn
(chgdim)
(command "-purge" "d" "*" "n") ))
 
Rudy said:
Hey Frank, aren't you missing something in that example?

Let's say I am. What are the chances that I, having been the one who missed it in the first place, would be able to spot it?
 
Frank, I tried understanding your code about adding a child style but I'm confused. If I wanted to add a leader child to the code above, how would it look? Brian
 
Wasn't that your example?

Excuse me if it's not, but there are other factors to consider.
 
Rudy said:
I've got to admit, I like the way you answer everyone. Kinda funny at times. You do the same thing, but don't like it when they do it to you.

You've lost me. You hinted at a problem and failed to provide any information on it. That is not indicative of my posts in this group. In any event, I find your method of broaching this topic to be most unhelpful.

You hijacked a technical thread to make a personal point. Both that point and the solution to the problem you alluded to continue to elude me.
 
I didn't make a personal point, that's your misunderstanding.

I simply implied that the example you posted may need a bit more settings to be consider.

You took it out of proportion, by making it personal.

My questioning your example wasn't to attack you, only to suggestion that there was a bit more not covered, and at the same time open the example a bit more for enhancing, that's all, no more, and no less.

Yes your example was simple and too the point, but the style could have addressed style settings, blocks, etc.
 
*All* you need to do is substitute the child name for the parent name.

Just an example, I realize there are other things that could be addressed.

; create parent style
(entmake
(list
'(0 . "DIMSTYLE")
'(100 . "AcDbSymbolTableRecord")
'(100 . "AcDbDimStyleTableRecord")
'(2 . "Test")
'(70 . 0)
)
)

; create child leader style
(entmake
(list
'(0 . "DIMSTYLE")
'(100 . "AcDbSymbolTableRecord")
'(100 . "AcDbDimStyleTableRecord")
'(2 . "Test$7") ;<--------- just change the name
'(70 . 0)
)
)

bstaples said:
Sorry for the confusion. I meant the example posted by jclaider. I can get that one to
create the parent style but now I want to add a leader child style.
 

Latest threads

Back
Top