Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

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

Turn Off Annotative Property of Dimstyle?

477 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 (477 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 (319 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

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.