Hallo
Hmm bei Lisp stehe ich ja echt auf dem Schlauch
Also folgendes Problem.
Es gibt das schöne ACADM Script "titleexg.lsp".
Ich habe dies simpel geändert
(defun c:titleexg-first ( /
BLONEW EXIST
)
damit es auch als Kommando gestartet werden kann (also ohne AMSCRIPT).
Soweit so gut (ist übrigens Acad Version 2011).
nun ist es aber so das bei Start logischerweise ein Dialog zum bestimmen der neuen DWG kommt.
Ist auch klar da "blonew" nicht belegt ist.
Ich habe jedoch eine fixe datei welche dort genommen werden soll also zum Beispiel
c:\NewTB.dwg
Könnt ihr mal schauen ob man das bestehende so umstricken kann das der Dialog nicht erscheint und die gewünschte Vorbelegung genommen wird ?
Danke für eure Hilfe
Hier die bisherige Datei
********************************************************
;this function will be called only once when the script starts
(defun c:titleexg-first ( /
BLONEW EXIST
)
;startfunction to set the variables
(gen1sv)
(setq blonew (gencfgget "gen@user@blonew"))
(prompt (genmsg "genscr" 81))
;read new blockname from the configuration
(if (not blonew)(progn
(gencfgnew "gen@user@blonew" '(("TYPE""GenCfgString")("dwg" nil)("cfg" nil))
(setq blonew "")
)))
(setq exist nil)
;new block must exist
(while (not exist)
(setq blonew(getfiled (genmsg "genscr" 74) "" "dwg" 2))
(setq blonew (strcat(gendwgohne blonew) ".dwg"))
(setq exist(findfile blonew))
(if (not exist)(prompt (strcat (genmsg "genscr" 63) blonew (genmsg "genscr" 64))))
)
;store blocknames in configuration
(gencfgset "gen@user@blonew" blonew)
;now exchange block
(titleexg)
(gen1un)
)
;this is the function for each dwg from the script
(defun titleexg ( /
ATTLIS BLONEW BLONEWCFG ENTLIS LIS OBJ OBJLIS OK OLDENAME XDATA
)
(gen1sv)
;read from configuration
;why is it made so complicated ?
;because the title is included inside an object
(setq
blonewcfg (gencfgget "gen@user@blonew")
;blonew is the pure blockname (no path, no .dwg)
blonew (gendwgohne(gendwgfilter blonewcfg))
)
;makes sense only if the old block is there
;make selectionsset
(setq objlis (genobjssgetx '(("SORT" ("TIT")))) )
;read attributes
(foreach obj objlis
;data of object
(setq xdata(gencdrlese"xdata"(gentitgetdata obj)))
(print xdata)
;when the first dwg is touched again entget=nil
(if(and
xdata
(setq oldename(gencdrlese "htit" xdata))
(setq oldename(handent oldename))
(setq xdata (genlistexchg "htit" xdata oldename))
(setq bename(gencdrlese "hra" xdata))
(setq bename(handent bename))
(setq xdata (genlistexchg "hra" xdata bename))
(genentget oldename)
)
(progn
;change entity list
(setq entlis (entget oldename '("*")))
;reenter the attributes
(setq attlis (genal-al oldename))
(command "_.ucs" "_w")
(setvar "attdia" 0)(setvar "attreq" 0)
;insert the block with the old data from the block
;genalblock also activates the translator
;this is the genius function to exchange attributes
(genlade "gen" "genbas7" genalblock)
(setq ok (genalblock (list
(list "BLOCK" blonewcfg)
(list "INS" (cdr(assoc 10 entlis)))
(list "SIZE"
(cdr(assoc 41 entlis))
(cdr(assoc 42 entlis))
(cdr(assoc 43 entlis))
)
(list "ANGR" (cdr(assoc 50 entlis)))
(list "TRANS" 2)
(list "CHECK" 1)
)))
(if ok (progn
(setq xdata (genlistexchg "TITLE" xdata blonewcfg))
(genobjedit (list
(list "OBJ" obj)
(list "XAPPL" "GENTITLE")
(list "XVER" "13")
(list "XDATA" xdata)
(list "XFLAG" 1)
(list "XART" T)
)
)
;attribute
;set attributes of new title
(genalexchg(list(list"ENAME"(entlast))(list"ATTRI"attlis)))
;the new titleblock gets the ename from the old
(genswapid oldename (entlast) 1 1)
;the old one has now the new ename
(entdel (entlast))
(command "_.save" "")
));if ok
));if progn
);foreach
(gen1un)
)
------------------
************************************
Eine Antwort auf diesen Beitrag verfassen (mit Zitat/Zitat des Beitrags) IP