Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*The Dark Princess
Message 1 of 1 (145 Views)

object annotation scales BIG AHA!

145 Views, 0 Replies
03-30-2010 11:31 AM
this seems to work on retrun scales for blocks, dims, text and hatches -
returns nil if no scales found or not annotative.


you're all welcome to it - I'd love feedback

most of it is library stuff which I included - thanks to a nice library
function the actual code is pretty small


Jamie

(defun get_obj_scales (en / scales)

;-------library functions---------
(defun jddsubst (ed1 dxf1 newval1)
(if (= (type ed1) 'ENAME)
(setq ed1 (entget ed1))
)
(if (assoc dxf1 ed1)
(subst (cons dxf1 newval1)(assoc dxf1 ed1) ed1)
(reverse (cons (cons dxf1 newval1) (reverse ed1)))
)
)
(defun arctgv (dxf_code list_1)
(setq list_1 (cond
((= (type dxf_code) 'SYM)
(if (= (type list_1) 'ENAME)
(vlax-ename->vla-object list_1)
list_1
)
)
(T
(if (= (type list_1) 'VLA-OBJECT)
(vlax-vla-object->ename list_1)
list_1
)
)
)
)
(cond
((= (type list_1) 'ENAME)
(cdr (assoc dxf_code (entget list_1)))
)
((= (type list_1) 'LIST)
(cdr (assoc dxf_code list_1))
)
((= (type list_1) 'VLA-OBJECT)
(if (vlax-property-available-p list_1 dxf_code)
(vl-catch-all-apply 'vlax-get-property (list list_1
dxf_code))
nil
)
)
(T nil)
)
)
(defun eng ( x / )
(if (vl-catch-all-error-p (setq x (vl-catch-all-apply 'entget (list x))))
nil
x
)
)
;----------------main progn------------
(foreach x (eng (arctgv 350 (arctgv 360 (reverse (eng (arctgv 360
en))))))
(if (and (= (car x) 350)
(setq ed1 (entget (cdr x)))
(arctgv 340 ed1)
)
(setq scales (jddsubst scales (arctgv 300 (arctgv 340 ed1))
(arctgv 141 (arctgv 340 ed1))))
)
)
scales
)
Post to the Community

Have questions about Autodesk products? Ask the community.

New Post
Announcements
Do you have 60 seconds to spare? The Autodesk Community Team is revamping our site ranking system and we want your feedback! Please click here to launch the 5 question survey. As always your input is greatly appreciated.