Creating a dim style using lisp

Discussion in 'AutoCAD' started by bstaples, Aug 14, 2003.

  1. bstaples

    bstaples Guest

    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
     
    bstaples, Aug 14, 2003
    #1
  2. bstaples

    jclaidler Guest

    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") ))
     
    jclaidler, Aug 14, 2003
    #2
  3. bstaples

    Rudy Tovar Guest

    Hey Frank, aren't you missing something in that example?
     
    Rudy Tovar, Aug 14, 2003
    #3
  4. 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 Oquendo, Aug 14, 2003
    #4
  5. bstaples

    bstaples Guest

    Thanks, I think that's exactly what I'm going after. brian
     
    bstaples, Aug 14, 2003
    #5
  6. bstaples

    bstaples Guest

    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
     
    bstaples, Aug 14, 2003
    #6
  7. bstaples

    Rudy Tovar Guest

    Wasn't that your example?

    Excuse me if it's not, but there are other factors to consider.
     
    Rudy Tovar, Aug 14, 2003
    #7
  8. 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.
     
    Frank Oquendo, Aug 14, 2003
    #8
  9. bstaples

    Rudy Tovar Guest

    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.
     
    Rudy Tovar, Aug 14, 2003
    #9
  10. *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)
    )
    )


    --

    -Jason
    Member of the Autodesk Discussion Forum Moderator Program


    create the parent style but now I want to add a leader child style.
     
    Jason Piercey, Aug 15, 2003
    #10
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.