dimstyle via vlisp

Discussion in 'AutoCAD' started by Jamie Duncan, Mar 1, 2005.

  1. Jamie Duncan

    Jamie Duncan Guest

    I've researched the web, studied the acad2004 customization guide, looked at
    some of the posts in here, and I'm still too thickheaded to understand it
    exactly. Anyway - I've gleaned this gem from Jason Piercey or Luis E.

    (defun make_ds ( Name VarLst / Obj)
    (setq *doc* (vla-get-activedocument (vlax-get-acad-object))
    *dims* (vla-get-dimstyles *doc*) )
    (cond
    (VarLst
    (mapcar
    '(lambda (x)
    (vla-setvariable *doc* (car x) (cadr x))
    )
    VarLst
    )
    (setq Obj (vla-add *dims* Name))
    (vla-copyfrom Obj *doc*)
    (vla-put-activedimstyle *doc* Obj)
    )
    (T
    (setq Obj (vla-add *dims* Name))
    )
    )
    Obj
    )

    so I assume you call the function as follows:

    (setq var_list (list (cons "dimtxt" 2) etc etc)

    and then (make_ds "funkychicken" var_list)

    I'm not exactly sure about this

    (setq Obj (vla-add *dims* Name));;; add dimstyle funkychicken to an object?
    why not directly to the doc?
    (vla-copyfrom Obj *doc*);;; copy diumstyle object into doc?
    (vla-put-activedimstyle *doc* Obj);;; set current dimstyle to funkychicken
    is that to make sure that it isn't just overrides to the current dimstyle?

    what about the overrides (setting the dimvars will be seen as overrides to
    the current style right?)

    why wouldn't we create the dimstyle, set the vars, and then save the
    overrides?

    and how about creating a child style immediately after setting the current
    style to funkchicken?


    Please excuse my ignorance about vlisp
     
    Jamie Duncan, Mar 1, 2005
    #1
  2. this is what I use:

    (defun rcmd-addDimStyle (name / dimStyle)
    (if (not (vl-catch-all-error-p
    (setq
    dimStyle
    (vl-catch-all-apply
    'vla-add
    (list (vla-get-dimStyles (rcmd-thisDwg))
    name)))))
    (progn
    (vla-copyFrom dimStyle (rcmd-thisDwg))
    (vla-put-activeDimstyle (rcmd-thisDwg) dimStyle))))

    and also basically the same criteria... using vla-setvariable to make have
    my own standards...
     
    Luis Esquivel, Mar 1, 2005
    #2
  3. Jamie Duncan

    mmm Guest

    okay, now it's going to take me a bit of studying to digest that,

    Thanks Luis!

    --
    Princess Jamie,

    Life shrinks or expands in proportion to one's courage.
    - Anais Nin

    | this is what I use:
    |
    | (defun rcmd-addDimStyle (name / dimStyle)
    | (if (not (vl-catch-all-error-p
    | (setq
    | dimStyle
    | (vl-catch-all-apply
    | 'vla-add
    | (list (vla-get-dimStyles (rcmd-thisDwg))
    | name)))))
    | (progn
    | (vla-copyFrom dimStyle (rcmd-thisDwg))
    | (vla-put-activeDimstyle (rcmd-thisDwg) dimStyle))))
    |
    | and also basically the same criteria... using vla-setvariable to make have
    | my own standards...
    |
    |
    |
    | | > somebody tagged me with that, originally for spite, but I adopted it and
    | it
    | > stuck!
    | >
    | >
    | >
    | >
    | > --
    | > Princess Jamie
    | >
    | >
    | > | > > >
    | > >> --
    | > >> Princess Jamie
    | > >
    | > > You become a princess now? :)
    | > >
    | > >
    | >
    | >
    |
    |
     
    mmm, Mar 2, 2005
    #3
  4. "> Life shrinks or expands in proportion to one's courage.

    and of what you eat.....
     
    Luis Esquivel, Mar 2, 2005
    #4
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.