(defun c:cd ( / js n ent_dim dxf_ent lremov dxf_cod pt_break p1 p2 p_nw1 p_nw2)
;;; Created by http://forums.autodesk.com/t5/user/viewprofilepage/user-id/524107
;;; Translated to English by Igal Averbuh 2016
(princ "\nSelect Dimmension to Divide: ")
(setq js
(ssget "_+.:E:S"
(list
(cons 0 "DIMENSION")
(cons 67 (if (eq (getvar "CVPORT") 2) 0 1))
(cons 410 (if (eq (getvar "CVPORT") 2) "Model" (getvar "CTAB")))
)
)
)
(cond
(js
(setq
ent_dim (ssname js 0)
dxf_ent (entget ent_dim)
lremov nil
dxf_cod dxf_ent
)
(cond
((or (zerop (rem (cdr (assoc 70 dxf_ent)) 32)) (eq (rem (cdr (assoc 70 dxf_ent)) 32) 1))
(foreach n dxf_cod (if (member (car n) '(2 5 330 -1)) (setq lremov (cons (car n) lremov))))
(foreach m lremov
(setq dxf_cod (vl-remove (assoc m dxf_cod) dxf_cod))
)
(entmake dxf_cod)
(setq dxf_cod (entget (entlast)))
(initget 1)
(setq
pt_break (trans (getpoint "\nSelect division point: ") 1 0)
p1 (cdr (assoc 13 dxf_ent))
p2 (cdr (assoc 14 dxf_ent))
p_nw2 (polar p2 (angle p2 pt_break) (distance p2 pt_break))
dxf_ent (subst (cons 14 p_nw2) (assoc 14 dxf_ent) dxf_ent)
)
(entmod dxf_ent)
(setq
p_nw1 (polar p1 (angle p1 pt_break) (distance p1 pt_break))
dxf_cod (subst (cons 13 p_nw1) (assoc 13 dxf_cod) dxf_cod)
)
(entmod dxf_cod)
)
(T
(princ "\nThis is not aligned, rotated, horizontal or vertical Dimennsion.")
)
)
)
)
(prin1)
)
(c:cd)

Advertisements