@_gile
May i kindly ask your help again?
In the end i want to be able to do this.
and a lot is already working
1. extract from xls old att
2. extract from xls new att
Point 1 and 2 are done thanks to your piece of code
now i need to do following ( i will show code i use below )
The list looks like this ( more then 3 entry's offcourse)
(("ISO_PIPESPEC" "n.v.t.") ("ISO_MEDIUM" "n.v.t.") ("ISO_DESIGN_PRESS" "n.v.t.")
what needs to be done is adding 2 more things to each individual list
So it will looks like this
(("ISO_PIPESPEC" "n.v.t." "extra1" extra2") ("ISO_MEDIUM" "n.v.t." "extra4" extra5") ("ISO_DESIGN_PRESS" "n.v.t." "extra6" extra7")
Ofcourse extra1 is just a sample name
Why do i want this
I need to change old ATT TAGS into new ones
and i need to update the ATT value with a field that is linked to customdwgprop
To add the info i need in dwg props i use something like this
(setq App (vlax-Get-Acad-Object)
Doc (vla-Get-ActiveDocument App)
DwgProps (vla-Get-SummaryInfo Doc))
;(setq lst '("a" "b" "c" "d"))
; Var b is the list made with the renameTAGG.lsp
(foreach lstt b
(setq c (car lstt))
(setq d (cadr lstt))
(vla-AddCustomInfo DwgProps c d)
And for the ATT change part i use this
;;GET XLS WITH TAGS
(setq csv (findfile "attchange.xls"))
;;GET ALL OLD AND NEW TAGS
(setq a (getexcel csv "Pipe Line Group" nil))
;;OLD TAG
(setq b (car a))
;;NEW TAG
(setq c (cadr a))
;;PROMPT
(setq d nil)
(setq str (strcat "%<\\AcVar CustomDP." c " \\f \"%tc3\">%")) <-- this one is used to make a field linked to dwgpropname
(setq tagLst ; All tags must be upper case.
(list
; OLD TAG NEW TAG PROMPT VALUE
(list b c d str) ; \U+00A0 = Unicode non-breaking space.
;(list "SHT_CALL_ON" "ITEM_$" "PROMPTSTRING2" "VALUE2")
)
)
(setq doc (vla-get-activedocument (vlax-get-acad-object)))
(vla-endundomark doc)
(vla-startundomark doc)
(vlax-for blk (vla-get-blocks doc)
(if (= :vlax-false (vla-get-isxref blk))
(vlax-for obj blk
(cond
((= "AcDbBlockReference" (vla-get-objectname obj))
(if (= :vlax-true (vla-get-hasattributes obj))
(foreach att (vlax-invoke obj 'getattributes)
(if (setq new (assoc (vla-get-tagstring att) tagLst))
(progn
(vla-put-tagstring att (cadr new))
(vla-put-textstring att (cadddr new))
)
)
)
)
)
((= "AcDbAttributeDefinition" (vla-get-objectname obj))
(if (setq new (assoc (vla-get-tagstring obj) tagLst))
(progn
(vla-put-tagstring obj (cadr new))
(vla-put-textstring obj (cadddr new))
(vla-put-promptstring obj (caddr new))
)
)
)
)
)
)
)
(vla-endundomark doc)
(princ)
Maybe you know a quicker and better way or maybe you can fix this 🙂
Kind regards
If this was of any help please kudo and/or Accept as Solution
Kind Regards