Set dimscale to selected dim

Discussion in 'AutoCAD' started by Royker, Feb 2, 2004.

  1. Royker

    Royker Guest

    I've been toying around with a macro that will set the dimscale to the scale of a selected dimension. What I can't figure out is how to extract the dimension scale property of the selected dimension. I have done somewhat the opposite by having a Diesel function extract the value of the dimscale variable and applying as the scale when inserting a block.
     
    Royker, Feb 2, 2004
    #1
  2. Here's a function to return the DIMSCALE of a selected dimension:

    To use it, supply it with an entity name, e.g. (getdimscale (car (entsel)))

    (defun getdimscale (en / el xd dimscal)
    (if en
    (progn
    (setq el (entget en))
    ; check to see if it's a dimension object.
    (if (= (cdr (assoc 0 el)) "DIMENSION")
    (progn
    ; check to see if an override for DIMSCALE (assoc 40) is set.
    (setq en (entget en '("ACAD")))
    (setq xd (cdr (assoc -3 en)))
    (if (assoc 40 xd)
    ; yes, override exists....
    (setq dimscal (cdr (assoc 40 xd)))
    )
    ; no override, get DIMSCALE from DIMSTYLE table...
    (if (not dimscal)
    (setq dimscal
    (cdr
    (assoc 40
    (tblsearch "DIMSTYLE" (cdr (assoc 3 el)))
    )
    )
    )
    )
    )
    )
    )
    )
    dimscal
    )
     
    Allen Johnson, Feb 2, 2004
    #2
  3. (setq obj (vlax-ename->vla-object (car (entsel "\nselect a dimension:"))))

    (vla-get-scalefactor obj)
     
    Jason Piercey, Feb 2, 2004
    #3
  4. Use -dimstyle

    and select dimension

    Then repeat and select Apply

    Jan


    scale of a selected dimension. What I can't figure out is how to extract the
    dimension scale property of the selected dimension. I have done somewhat the
    opposite by having a Diesel function extract the value of the dimscale
    variable and applying as the scale when inserting a block.
     
    Jan Nademlejnsky, Feb 2, 2004
    #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.