Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
*Daniel J. Altamura, R.A.
Message 1 of 3 (449 Views)

Turn Off Annotative Property of Dimstyle?

449 Views, 2 Replies
06-11-2009 02:39 PM
I have found several routines (see below) to make a dimstyle annotative, but
how can I turn it off? Can this be modified to do the opposite? Thanks for
any help.

;;; For Dimstyles use the following
;;; (SetDimAnnotative "Style Name")
;;;
;;; Original Code by: Harrie Zeha
;;; Autodesk discussion post thread:
;;; http://discussion.autodesk.com/thread.jspa?messageID=5730957

(defun SetDimAnnotative (Name / *doc* *dims* app xd1 xd2 rt1 rt2)
(vl-load-com)
(setq *dims* (vla-get-dimstyles
(vla-get-activedocument (vlax-get-acad-object))
)
)
(vlax-for itm *dims*
(setq *dimstl* (cons (vla-get-name itm) *dimstl*))
)
(if (member Name *dimstl*)
(progn
(setq obj (vla-item *dims* Name)
app "AcadAnnotative"
)
(regapp app)
(setq xd1 (vlax-make-safearray vlax-vbInteger '(0 . 5)))
(vlax-safearray-fill
xd1
(list 1001 1000 1002 1070 1070 1002)
)
(setq xd2 (vlax-make-safearray vlax-vbVariant '(0 . 5)))
(vlax-safearray-fill
xd2
(list "AcadAnnotative"
"AnnotativeData"
"{"
(vlax-make-variant 1 vlax-vbInteger)
(vlax-make-variant 1 vlax-vbInteger)
"}"
)
)
(vla-setxdata obj xd1 xd2)
(vla-getxdata obj app 'rt1 'rt2)
(mapcar
(function (lambda
(x y)
(cons x y)
)
)
(vlax-safearray->list rt1)
(mapcar 'vlax-variant-value (vlax-safearray->list rt2))
)
)
)
)
--
Daniel J. Altamura, Registered Architect
Altamura Architectural Consulting
and SoftWorx, Autodesk Authorized Developer
http://partnerproducts.autodesk.com/popups/company.asp?rdid=2139
------------------------------------------------------------------------------
*Daniel J. Altamura, R.A.
Message 2 of 3 (449 Views)

Re: Turn Off Annotative Property of Dimstyle?

06-22-2009 07:56 AM in reply to: *Daniel J. Altamura, R.A.
For anyone interested, I found the solution, courtesy of Autodesk Developer
support.

;;; Turn On:
(list "AcadAnnotative"
"AnnotativeData"
"{"
(vlax-make-variant 1 vlax-vbInteger)
(vlax-make-variant 1 vlax-vbInteger)
"}"
)

;;; Turn Off:
(list "AcadAnnotative"
"AnnotativeData"
"{"
(vlax-make-variant 0 vlax-vbInteger)
(vlax-make-variant 0 vlax-vbInteger)
"}"
)

--
Daniel J. Altamura, Registered Architect
Altamura Architectural Consulting
and SoftWorx, Autodesk Authorized Developer
http://partnerproducts.autodesk.com/popups/company.asp?rdid=2139
------------------------------------------------------------------------------

"Daniel J. Altamura"; "R.A." wrote in message
news:6200368@discussion.autodesk.com...
I have found several routines (see below) to make a dimstyle annotative, but
how can I turn it off? Can this be modified to do the opposite? Thanks for
any help.

;;; For Dimstyles use the following
;;; (SetDimAnnotative "Style Name")
;;;
;;; Original Code by: Harrie Zeha
;;; Autodesk discussion post thread:
;;; http://discussion.autodesk.com/thread.jspa?messageID=5730957

(defun SetDimAnnotative (Name / *doc* *dims* app xd1 xd2 rt1 rt2)
(vl-load-com)
(setq *dims* (vla-get-dimstyles
(vla-get-activedocument (vlax-get-acad-object))
)
)
(vlax-for itm *dims*
(setq *dimstl* (cons (vla-get-name itm) *dimstl*))
)
(if (member Name *dimstl*)
(progn
(setq obj (vla-item *dims* Name)
app "AcadAnnotative"
)
(regapp app)
(setq xd1 (vlax-make-safearray vlax-vbInteger '(0 . 5)))
(vlax-safearray-fill
xd1
(list 1001 1000 1002 1070 1070 1002)
)
(setq xd2 (vlax-make-safearray vlax-vbVariant '(0 . 5)))
(vlax-safearray-fill
xd2
(list "AcadAnnotative"
"AnnotativeData"
"{"
(vlax-make-variant 1 vlax-vbInteger)
(vlax-make-variant 1 vlax-vbInteger)
"}"
)
)
(vla-setxdata obj xd1 xd2)
(vla-getxdata obj app 'rt1 'rt2)
(mapcar
(function (lambda
(x y)
(cons x y)
)
)
(vlax-safearray->list rt1)
(mapcar 'vlax-variant-value (vlax-safearray->list rt2))
)
)
)
)
--
Daniel J. Altamura, Registered Architect
Altamura Architectural Consulting
and SoftWorx, Autodesk Authorized Developer
http://partnerproducts.autodesk.com/popups/company.asp?rdid=2139
------------------------------------------------------------------------------
Member
renmanz
Posts: 5
Registered: ‎10-27-2004
Message 3 of 3 (291 Views)

Re: Turn Off Annotative Property of Dimstyle?

10-15-2012 11:19 AM in reply to: *Daniel J. Altamura, R.A.

This is what i have been looking for but it dosent seem to work for me. I copied to note pad and saved it as a lsp file. when i run the lisp it says it loaded successfully. Using AutoCAD 2012

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.