geoidwalker 发表于 2022-7-5 17:54:20

设置环境图形设置A

两个简单的问题-希望有两个简单的答案:
我正在编写一个脚本来更改环境图形设置(请参见屏幕截图)。
除了在运行units命令后无法关闭文本窗口外,所有操作都正常,并且环境角度单位没有设置(在屏幕截图中以红色突出显示)。有ade命令可以做到这一点吗?
干杯
 

   ;Set projection to NAD83 UTM10 by default
   (ade_projsetwscode "UTM83-10")
   ;System Variables to be set
   ;Set Units
   (command "-aecdwgunits" 6 2 3 "No" "No");works
   (command)
   (command "-units" 2 3 2 8 270 "Y");works - but doesn't set ambient angular units
   (command)
   ;Shut off text window
   (command "graphscr"); doesn't work
   (command)https://www.cadtutor.net/forum/attachment.php?attachmentid=56238&cid=1&stc=1

BIGAL 发表于 2022-7-5 18:14:36

后面说的单位是一系列变量,下面有一个例子,对于aecdwgsetup来说应该是一样的,只需要找到,2种方式使用express,工具,系统变量编辑器。
还是setvar?*每次更改1。
 
(SETVAR "LUNITS" 2)
(SETVAR "ANGBASE" 0.0)
(SETVAR "ANGDIR" 0)
(SETVAR "LUPREC" 0)
(SETVAR "AUNITS" 0)
(SETVAR "AUPREC" 0)

Hippe013 发表于 2022-7-5 18:27:00

您需要通过Civil Application界面获取环境设置对象。这可能会让你走。
 
(setq prod (vlax-product-key))
(setq        prodStr        (strcat        "AeccXUiLand.AeccApplication"
                (cond ((vl-string-search "\\R17.0\\" prod)
                     ".4.0"
                      )
                      ;;2007
                      ((vl-string-search "\\R17.1\\" prod)
                     ".5.0"
                      )
                      ;;2008
                      ((vl-string-search "\\R17.2\\" prod)
                     ".6.0"
                      )
                      ;;2009
                      ((vl-string-search "\\R18.0\\" prod)
                     ".7.0"
                      )
                      ;;2010
                      ((vl-string-search "\\R18.1\\" prod)
                     ".8.0"
                      )
                      ;;2011
                      ((vl-string-search "\\R18.2\\" prod)
                     ".9.0"
                      )
                      ;;2012
                      ((vl-string-search "\\R19.0\\" prod)
                     ".10.0"
                      )
                      ;;2013
                      ((vl-string-search "\\R19.1\\" prod)
                     ".10.3"
                      )
                      ;;2014
                      ((vl-string-search "\\R20.0\\" prod)
                     ".10.4"
                      )
                      ;;2015
                      (t "")
                )
        )
)

(setq aeccApp (vlax-invoke-method (vlax-get-acad-object) 'GetInterfaceobject prodstr));Get the Civil Application

(setq aeccDoc (vlax-get-property aeccApp 'ActiveDocument)) ;Get the Active Civil Document from the Civil Application

(setq sets (vlax-get-property aeccDoc 'Settings)) ;Get the Root Settings from the Document

(setq dwgset (vlax-get-property sets 'DrawingSettings)) ;Get the Drawing Settings from the Root Settings

(setq ambset (vlax-get-property dwgset 'AmbientSettings)) ;Get the Ambient Settings from the dwg settings
 
 
就文本屏幕而言,请尝试:
 

(graphscr)
;or
(textscr)

geoidwalker 发表于 2022-7-5 18:53:55

谢谢Hippe013-这看起来很有希望。我会尝试一下,在假期里事情会慢一点。。。

geoidwalker 发表于 2022-7-5 19:08:49

好的,所以脚本现在正在工作,并做我希望它做的事。。。除非文本窗口不会关闭。(graphscr)按预期返回零-因此我有:
(图表)
(普林斯)
 
我尝试了各种迭代:
(命令“graphscr”)

(命令“_.graphschr”)
它们都返回nil,所以我知道它正在运行命令。。。然而,文本窗口不会关闭。。。。
如果在lisp完成后运行其中任何一个,请按预期关闭窗口。或者,如果我按F2键,它就会关闭-只是不是从Lisp程序开始的。。。。吼叫声
有什么想法吗?
页: [1]
查看完整版本: 设置环境图形设置A