Lisp gives duplicated key error while no duplicates are present
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Dear forum members
Thanks to @_gile for the time and afford helping me
I added 1 line to add custom props as well but the routine keeps giving back a automation error
; error: Automation Error. Duplicate key
The list that is use looks like this is only way longer
(("ISO_PIPESPEC" "n.v.t.1" "A" "b") ("ISO_MEDIUM" "n.v.t.2" "A" "b") ("ISO_DESIGN_PRESS" "n.v.t.3" "A" "b"))
The variable that holds the list is vier
This is the script I use.
Below script I have more info
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(setq dwgprop (vla-get-summaryinfo(vla-get-activedocument(Vlax-get-acad-object))))
(vla-endundomark doc)
(vla-startundomark doc)
;; iterate the block table
(vlax-for blk (vla-get-blocks doc)
(if (= :vlax-false (vla-get-isxref blk))
(progn
(vlax-for obj blk
(if (and (= "AcDbAttributeDefinition" (vla-get-objectname obj))
(setq new (assoc (vla-get-tagstring obj) vier))
)
(progn
;; rename the tag and prompt of the ATTDEF
;(vla-put-tagstring obj (cadr new)) ;(princ new)
;(vla-put-textstring obj (cadddr new)) ;(princ new)
;(vla-put-promptstring obj (caddr new)) ;(princ new)
;(vla-addcustominfo obj (cadr new)(cadddr new))
(vla-addcustominfo dwgprop (cadr new)(cadddr new))
;(vla-addcustominfo(vla-get-summaryinfo(vla-get-activedocument(Vlax-get-acad-object)))(cadr new)(cadddr new))
(setq name (vla-get-Name blk))
)
)
)
;; ATTSYNC the inserted references
(if (= name (vla-get-Name blk))
(command "_.ATTSYNC" "_Name" name)
)
)
)
);end vlax-for blk
(vla-endundomark doc)
(princ)
The TAG / TEXT and PROMPSTRING are working fine
The addcustominfo gives back the error
What am I doing wrong here?
Kind Regards