Here is a simple routine that searches for all dimensions in a drawing and asks the user to enter the name of the layer that you would like the dimensions to be on.
As seen Below:
There are some dimensions on the wrong layers.
- DIMLAY <enter> to start
- DIM <enter> this is the name of the dimension layer in my drawing. This will be different per drawing.
; This program selects all dimensions and places them ; on a user-specified layer. ; (defun C:DimLay (/ SETD LAY) ; Begin function (setvar "CMDECHO" 0) ; Turn off command echo (setq SETD (ssget "X" '((0 . "DIMENSION")))) ; Selection set of dims (if (null SETD) ; If there are no dims (princ "\nThere are no associated dimensions.") ; THEN tell user (progn ; ELSE begin (progn) (setq LAY (getstring "\nTransfer to which layer? ")) ; Get layer name (command ".CHPROP" SETD "" "LA" LAY "") ; Change dimensions to layer ) ; End (progn) ) ; End (if) (setvar "CMDECHO" 1) ; Turn on command echo (princ) ; Clean exit ) ; End function ; - -( End of Program )- -
May I add the dimension inside block?