Visual LISP, AutoLISP and General Customization
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page
using vla-put-li nearscalef actor
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
103 Views, 2 Replies
03-25-2009 12:32 PM
I'm okay with Lisp but not so good with the Active X commands. This routine should be easy
but I keep getting and error saying:
error: bad argument type: VLA-OBJECT ((-1 .) (0 . "DIMENSION") ... etc
Here is my code:
;************************************************* ********
; dls changes the linear scale factor of all dimensions to 4.0
;************************************************* *********
(defun c:dls(/ dims dimobj c)
(vl-load-com)
(setq c -1)
(setq dims (ssget "x" '((0 . "DIMENSION"))))
(repeat (sslength DIMS)
(setq c (1+ c))
(setq dimobj (entget (ssname dims 0)))
(vla-put-linearscalefactor dimobj 4.0)
)
)
Any help would be great
but I keep getting and error saying:
error: bad argument type: VLA-OBJECT ((-1 .
Here is my code:
;*************************************************
; dls changes the linear scale factor of all dimensions to 4.0
;*************************************************
(defun c:dls(/ dims dimobj c)
(vl-load-com)
(setq c -1)
(setq dims (ssget "x" '((0 . "DIMENSION"))))
(repeat (sslength DIMS)
(setq c (1+ c))
(setq dimobj (entget (ssname dims 0)))
(vla-put-linearscalefactor dimobj 4.0)
)
)
Any help would be great
*Some Buddy
Re: using vla-put-li nearscalef actor
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-25-2009 01:32 PM in reply to:
CNCjeff
Hi,
You have to convert an entity name label into an
ActiveX object, in order to be able to apply properties and methods on it. The
conversion is done using (vlax-ename->vla-object ...)
function. It takes an entity name type of data and returns an ActiveX object
type of data. Please note also that in your original code you don't test
if the selection set exists (an empty selection set would trigger an error
because (sslength ...) argument can't be nil) and also note that you don't
increment (or decrement, like in my example) your
size=3>c index, so your code would pass on the first element of
the selection set for as many times as the number of the items in the
selection set. Here is another function, modified and corrected. Try to compare
the two and see the errors and the differences:
ActiveX object, in order to be able to apply properties and methods on it. The
conversion is done using (vlax-ename->vla-object ...)
function. It takes an entity name type of data and returns an ActiveX object
type of data. Please note also that in your original code you don't test
if the selection set exists (an empty selection set would trigger an error
because (sslength ...) argument can't be nil) and also note that you don't
increment (or decrement, like in my example) your
size=3>c index, so your code would pass on the first element of
the selection set for as many times as the number of the items in the
selection set. Here is another function, modified and corrected. Try to compare
the two and see the errors and the differences:
;;;=================================
(defun c:dls ( / dims index)
(vl-load-com)
(if (setq dims (ssget "X" '((0 .
"DIMENSION"))))
(repeat (setq index (sslength
dims))
(vla-put-linearscalefactor
(vlax-ename->vla-object
(ssname dims (1- index))
)
4.0
)
(setq (index (1-
index)))
)
)
(princ)
)
(vl-load-com)
(if (setq dims (ssget "X" '((0 .
"DIMENSION"))))
(repeat (setq index (sslength
dims))
(vla-put-linearscalefactor
(vlax-ename->vla-object
(ssname dims (1- index))
)
4.0
)
(setq (index (1-
index)))
)
)
(princ)
)
;;;=================================
HTH
--
Humans are born with a wide horizon.
As time goes by, the
horizon narrows and
narrows, until it becomes a point of view.
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 2px solid; MARGIN-RIGHT: 0px">
<CNCjeff> a écrit dans le message de news:I'm
href="mailto:6149131@discussion.autodesk.com">6149131@discussion.autodesk.com...
okay with Lisp but not so good with the Active X commands. This routine should
be easy but I keep getting and error saying: error: bad argument type:
VLA-OBJECT ((-1 .) (0 . "DIMENSION") ... etc Here is
my code: ;********************************************************* ; dls
changes the linear scale factor of all dimensions to 4.0
;********************************************************** (defun c:dls(/
dims dimobj c) (vl-load-com) (setq c -1) (setq dims (ssget "x" '((0 .
"DIMENSION")))) (repeat (sslength DIMS) (setq c (1+ c)) (setq dimobj (entget
(ssname dims 0))) (vla-put-linearscalefactor dimobj 4.0) ) ) Any help would be
great
Re: using vla-put-li nearscalef actor
Options
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content
03-26-2009 05:54 AM in reply to:
CNCjeff
Thanks. I had to change a couple of parentheses but everything was there for me.
