Automating dimensions

Discussion in 'AutoCAD' started by Gordon Stephens, Feb 22, 2005.

  1. I am trying to automate dimensioning by saving the current layer, setting it
    to Dims, placing the dimension and then resetting things as follows

    (defun C:DH ( / dim_lay dim_col)
    (setq dim_lay (getvar "clayer"))
    (setq dim_col (getvar "cecolor"))
    (setvar "cecolor" "bylayer")
    (command "-Layer" "T" "Dims" "M" "Dims" "C" "1" "Dims" "L" "Continuous"
    "Dims" "" )

    (command "dim1" "hor" )

    (setvar "clayer" dim_lay)
    (setvar "cecolor" dim_col)
    ) ; dim horizontal

    Trouble is, it doesn't seem to set the layer or reset it?

    I've tried various versions and with separate sub-routines, but although I
    can carry out the various commands manually, for some reason, I can't
    automate it with this lisp. It carries out the "dim1" "hor", somehow gives
    a "4" input to the request for the first extension line, which is ignored &
    I pick the point(s), and the dimension is drawn with no change from the
    current layer and colour!

    Would be grateful for some hints please.
    TIA

    Gordon S.
     
    Gordon Stephens, Feb 22, 2005
    #1
  2. Hmmm,


    Well I'm not sure why I don't seem to get any replies here - CAN ANYBODY
    SEE MY POSTS?

    Anyway, I managed to figure it out myself in the end when I realised that
    the "4" that was being input to the dim1 command was coming from the
    subsequent commands to set cecolor back to the existing, as it was cyan.

    Therefore, I changed the line below to add a couple of pauses for placing
    the dimension :-

    (command "dim1" "hor" pause pause )

    This seems to have done the trick.

    GS.
     
    Gordon Stephens, Feb 23, 2005
    #2
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.