Hello everyone,
few years ago I found on the web the following code that allows you to insert DIMENSION entities in the drawing :
(defun entmakeDimLinear (p1 p2 TXT EBENE STIL LAYER COLOR)
;Use: (entmakeDimLinear (getpoint)(getpoint) "TEST" '(0.7 . 1) "STANDARD" "0" nil)
;EBENE '(ABSTAND . POSITIONSEBENE) '([REAL] . [INTEGER]) : (7 . 2) ;???????????????
(if (= (length p1) 2)(setq p1 (append p1 (list 0.0)))) ;aggiunge la Z
(if (= (length p2) 2)(setq p2 (append p2 (list 0.0)))) ;aggiunge la Z
(defun Is3DPoint? (P)
(and P (= 'LIST (type P))
(or (= 'REAL (type (car P)))
(= 'INT (type (car P)))
)
(or (= 'REAL (type (cadr P)))
(= 'INT (type (cadr P)))
)
(or (= 'REAL (type (caddr P)))
(= 'INT (type (caddr P)))
)
)
)
(if (and
(Is3DPoint? p1)(Is3DPoint? p2)
(entmake (list
'(0 . "DIMENSION")
'(100 . "AcDbEntity")
'(67 . 0)
'(410 . "Model")
(cons 8 (if (and LAYER (= 'STR(type LAYER))(tblobjname "LAYER" LAYER))LAYER (getvar "CLAYER")));sonst CLAYER
(cons 62 (if (and COLOR (= 'INT (type COLOR)))COLOR 256));sonst VONLAYER
'(100 . "AcDbDimension")
(if (and EBENE
(= 'LIST (type EBENE))
(car EBENE)(or (= 'REAL (type (car EBENE)))(= 'INT (type (car EBENE))))(/= (car EBENE) 0.0)
(cdr EBENE)(or (= 'REAL (type (cdr EBENE)))(= 'INT (type (cdr EBENE))))(/= (cdr EBENE) 0.0)
)
(cons 10 (polar p2 (+ (angle p1 p2) (/ pi 2.0)) (* (car EBENE) (cdr EBENE))))
(cons 10 p2)
)
'(12 0.0 0.0 0.0)
'(70 . 33)
(cons 1 (if (and TXT (= 'STR(type TXT)))TXT ""))
'(71 . 5)
'(72 . 1)
'(41 . 1.0)
'(73 . 0)
'(74 . 0)
'(75 . 0)
'(52 . 0.0)
'(53 . 0.0)
'(54 . 0.0)
'(51 . 0.0)
'(210 0.0 0.0 1.0)
(cons 3 (if (and STIL (= 'STR(type STIL))(tblobjname "DIMSTYLE" STIL))STIL (getvar "DIMSTYLE")))
'(100 . "AcDbAlignedDimension")
(cons 13 p1)
(cons 14 p2)
'(15 0.0 0.0 0.0)
'(16 0.0 0.0 0.0)
'(40 . 0.0)
'(50 . 0.0)
)
)
)
(entlast)
)
)
Unfortunately this code inserts non-associative dimensions regardless of the value of DIMASSOC.
Do you have any suggestion to solve this limitation?