Zoo后的结果不一致
当我使用Autoscript运行带有脚本的lisp时,所有用于更改层等的代码都可以很好地工作,但它并不总是最大化并保存在缩放位置。。。只是有时候。我可以在相同的文件上运行脚本两次,得到不同的结果。问题是,它会放大到范围,然后缩小一点,然后保存。此外,没有正确缩放到范围的文件大约要大4倍,如果我在文件失败后手动打开文件,缩放到范围,然后关闭,就可以了。
发生什么事?是跑得太快还是怎么的?日志似乎表明一切正常。
(defun c:tapconvert ()
; *Runs various upgrades to tap cards converted from DGNs
; *Changes layer names to friendly names, sets layer colors, sets active layer to Dimensions1, locks the 0 layer,
;inserts blocks from block library, replaces symbols for objects with blocks, removes duplicate items,
; purges unused items, zooms to extents, saves and closes the drawing.
;
;
; *Changes layer names from Microstation Levels to friendly names*
(setq old_name "Level 1" new_name "Border")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 2" new_name "Roadway")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 3" new_name "Road_Name")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 4" new_name "Building")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 5" new_name "Street_Text")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 6" new_name "Walkway")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 7" new_name "Top_Text")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 8" new_name "Water_Main")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 10" new_name "Dimensions1")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 11" new_name "Misc_Text")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 12" new_name "Reducer")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 15" new_name "Meter_Pit")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 22" new_name "Curb_Valve")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 26" new_name "Service_Tap")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 30" new_name "Manhole")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 37" new_name "Catch_Basin")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 60" new_name "Dimensions2")
(command "-rename" "layer" old_name new_name)
(setq old_name "Level 63" new_name "Misc")
(command "-rename" "layer" old_name new_name)
;
(command "-overkill" "ALL" "" ""); Removes duplicate drawing elements for cleanup / file size reduction
(command "purge" "A" "*" "N"); Purges all unused layers, blocks, etc. from the drawing to reduce file size*
;
; *Recreates and colors all layers to account for purged/removed layers*
(command "-layer" "M" "Border" "C" "T" "255,255,255" "" "")
(command "-layer" "M" "Building" "C" "T" "184,121,0" "" "")
(command "-layer" "M" "Catch_Basin" "C" "T" "185,185,185" "" "")
(command "-layer" "M" "Curb_Valve" "C" "T" "255,0,0" "" "")
(command "-layer" "M" "Dimensions2" "C" "T" "185,185,185" "" "")
(command "-layer" "M" "Manhole" "C" "T" "185,185,185" "" "")
(command "-layer" "M" "Meter_Pit" "C" "T" "184,121,0" "" "")
(command "-layer" "M" "Misc" "C" "T" "185,185,185" "" "")
(command "-layer" "M" "Misc_Text" "C" "T" "0,255,255" "" "")
(command "-layer" "M" "Reducer" "C" "T" "255,0,0" "" "")
(command "-layer" "M" "Road_Name" "C" "T" "165,135,115" "" "")
(command "-layer" "M" "Roadway" "C" "T" "165,135,115" "" "")
(command "-layer" "M" "Service_Tap" "C" "T" "184,121,0" "" "")
(command "-layer" "M" "Street_Text" "C" "T" "184,121,0" "" "")
(command "-layer" "M" "Top_Text" "C" "T" "184,121,0" "" "")
(command "-layer" "M" "Walkway" "C" "T" "165,135,115" "" "")
(command "-layer" "M" "Water_Main" "C" "T" "0,135,255" "" "")
(command "-layer" "M" "Dimensions1" "C" "T" "185,185,185" "" ""); Recreates and colors Dimensions1 last to make it the active layer for editing
(command "-layer" "LO" "0" ""); *Locks the zero layer*
;
;
; *Sets dimension style settings: all dimension scaling to 28x default, 1 decimal point, rounds to 1/2 foot, adds foot indicator*
(setvar "DIMSCALE" 28)
(setvar "DIMDEC" 1)
(setvar "DIMRND" 0.5)
(setvar "DIMPOST" "'")
;
(command "zoom" "e"); Zooms to extents
;(command "qsave") ; Saves drawing but Autoscript does this automatically
;(command "close") ; Closes drawing but Autoscript does this automatically
(princ "Processes Complete!")
)
有一次我遇到了一个关于最大化的问题,我用一种奇怪的方式克服了它。。。也许这帮不了你,但谁知道呢。。。这就是我所做的:
在代码结束时,我遇到了一个放大错误的问题,我发现问题出在我的情况下,我的DWG中有两个布局(Layout1和Layout2)的视口。。。看起来其中一个布局中的较大视口阻止了我在模型空间中进行最大化缩放(tilemode 1)。。。所以我决定在代码结束时切换到所有布局,然后切换到(tilemode 1)并进行最大化。。。经过这个过程,ACAD允许我正确缩放。。。我不知道这是否是与我和我的代码相同的问题,但最好做些改变并观察结果,而不是什么都不做,让它被机器打败-ACAD。。。
因此,也许可以尝试:
(foreach lay (layoutlist)
(setvar 'ctab lay)
)
(setvar 'tilemode 1)
(command "_.zoom" "e")
我希望你能用自己的方式解决问题,因为我看不出你的代码明显不足。。。
M、 R。 问题是,我没有使用任何布局,因为这些图纸都是简单的范围打印,8.5x11。
页:
[1]