Message 1 of 2
ADD MLEADERLINE Y+200 FROM (VLAX-INVOKE Oml 'GetLeaderLineVertices 0)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello, Im triyng to add 1 MLEADERLINE to a set of mleaders
i'm tring this way
(vl-load-com)
(defun c:t3 () (c:ADD_MLeaderLine3))
(defun c:ADD_MLeaderLine3()
(setq acadObj (vlax-get-acad-object))
(setq doc (vla-get-ActiveDocument acadObj))
(setq points (vlax-make-safearray vlax-vbDouble '(0 . 5)))
(vlax-safearray-fill points '(1 1 0
4 4 0
)
)
(setq i 0)
(setq modelSpace (vla-get-ModelSpace doc))
(if (setq i -1
s (ssget "_:L" '((0 . "MULTILEADER"))))
(repeat (sslength s)
(setq e (ssname s (setq i (1+ i))))
(setq oml (vlax-Ename->Vla-Object e))
(setq vrt (VLAX-INVOKE Oml 'GetLeaderLineVertices 0)) ;---------------
; (setq vrt2 (list (nth 0 vrt)(nth 1 vrt)(nth 2 vrt)))
; (princ vrt)
; (princ vrt2)
; (setq vrt2 (v+ vrt2 '(0 200 0)))
; (princ vrt2)
(setq points2 (vlax-make-safearray vlax-vbDouble '(0 . 2)))
(setq points2 (vlax-make-array-type
(list (cons 0 (nth 0 vrt)) (cons 1 (+ 200 (nth 1 vrt)))
(cons 2 (nth 2 vrt))
)
vlax-vbDouble))
))
(setq r (vla-AddLeader oML))
(vla-AddLeaderLine oML r points2)
)
(defun v+ (v1 v2)(mapcar '+ v1 v2))
; https://www.theswamp.org/index.php?topic=7063.0
(defun vlax-make-array-type (lst atype)
(vlax-safearray-fill
(vlax-make-safearray
atype
(cons 0 (1- (length lst))))
lst))
; example
; $ (vlax-make-array-type
; (list 1001 1000 1002 1070 1000 1070 1070 1002)
; vlax-vbinteger)
; #<safearray...>
and I get an error about
Comando: T3
Designe objetos: Designe esquina opuesta: 1 encontrados
Designe objetos: ; error: Fallo en vlax-safearray-fill. Lista de inicialización no válida. #<safearray...> ((0 . 29.456) (1 . 1613.46) (2 . 0.0))
Comando:
these are the sentences where im having problems:
(setq points2 (vlax-make-safearray vlax-vbDouble '(0 . 2)))
(setq points2 (vlax-make-array-type
(list (cons 0 (nth 0 vrt)) (cons 1 (+ 200 (nth 1 vrt)))
(cons 2 (nth 2 vrt))
)
vlax-vbDouble))
-and these one:
(vla-AddLeaderLine oML r points2)
i dont manage so well with safearrays so any help will be great
thanks