Autoform应用技巧:设置Autoform起始工作目录
2016-11-14 by:CAE仿真在线 来源:互联网
Autoform不论是3.X还是4.X,用缺省安装的快捷方式启动的时候,进入Autoform打开文档的位置都是用户目录(如C:\Documents
and
Settings\username,username为当前用户名),3.X版本的可以通过修改桌面快捷方式的目录起始位置而达到启动打开预先设定的目录(右键点击Autoform快捷方式-属性-快捷方式-起始位置),避免缺省手工输入的麻烦,但是该方法对于4.X版本根本不起作用,进入Autoform后打开文档的位置还是用户目录。
下面来介绍设置Autoform起始工作目录的三个方法:
方法一:
修改启动Autoform的脚本文件,即到Autoform安装目录修改af-xstart.vbs文件(右键选编辑),
找到
XAF = """" & "$AF_HOME_XX/xaf_X.XX " & ARGS & " -geom +0+0" & """"
其中XX/X.XX为Autoform的版本号
把它改为
XAF = """" & "$AF_HOME_XX/xaf_X.XX -wd /dev/fs/X/.../.../ " & ARGS & " -geom +0+0" & """"
其中X为盘符,/.../.../为路经,记得以/结尾。
存盘,运行OK。
修改启动Autoform的脚本文件,即到Autoform安装目录修改af-xstart.vbs文件(右键选编辑),
找到
XAF = """" & "$AF_HOME_XX/xaf_X.XX " & ARGS & " -geom +0+0" & """"
其中XX/X.XX为Autoform的版本号
把它改为
XAF = """" & "$AF_HOME_XX/xaf_X.XX -wd /dev/fs/X/.../.../ " & ARGS & " -geom +0+0" & """"
其中X为盘符,/.../.../为路经,记得以/结尾。
存盘,运行OK。
如果改了还是不行,那肯定是没有修改正确,你可以把你的af-xstart.vbs文件和目录发给我,我可以帮你修改。
下面的是我的af-xstart.vbs,注意看单引号后的注释:
' AutoForm startup vbs file
' AutoForm Engineering GmbH
' 2004-12-10 gk
' 增加Autoform启动预设工作目录的支持,by plusplus, 2008-03-24
' AutoForm Engineering GmbH
' 2004-12-10 gk
' 增加Autoform启动预设工作目录的支持,by plusplus, 2008-03-24
Option Explicit
Dim ARGS
Dim FILENAME
Dim WORKDIR
Dim FILENAME
Dim WORKDIR
ARGS = ""
FILENAME = ""
Const device = "/dev/fs/"
Const netdir = "/net"
FILENAME = ""
Const device = "/dev/fs/"
Const netdir = "/net"
' 定义工作目录,
只须更改&后面路径,盘符不用带冒号,
' 格式:"盘符/目录/目录/",可根据自己的需要定义
WORKDIR = device & "D/Autoform_Workshop/"
' 格式:"盘符/目录/目录/",可根据自己的需要定义
WORKDIR = device & "D/Autoform_Workshop/"
' Autoform界面执行文件
' AF_HOME_XX(可为32/40/41,根据af实际的版本)
' xaf_X.X.X(可为3.2/4.04/4.07/4.1.0/4.1.1, 根据af实际的版本)
Const xafexecute = "$AF_HOME_41/xaf_4.1.1"
' AF_HOME_XX(可为32/40/41,根据af实际的版本)
' xaf_X.X.X(可为3.2/4.04/4.07/4.1.0/4.1.1, 根据af实际的版本)
Const xafexecute = "$AF_HOME_41/xaf_4.1.1"
'Autoform版本显示, 可根据af实际的版本更改
Const afversion = "AutoForm Version 4.1.1"
Const afversion = "AutoForm Version 4.1.1"
StartAutoForm()
WScript.Quit
function GetPosixName()
Dim PosixName, J, Length, start, Pos
PosixName = ""
Length=Len(FILENAME)
Pos = Instr(FILENAME, ":\")
If Pos > 0 Then
PosixName = device & Mid(FILENAME, Pos-1, 1)
Else
Pos = Instr(FILENAME, "\\")
If Pos > 0 Then
PosixName = netdir
Else
PosixName = ""
End if
End if
Dim PosixName, J, Length, start, Pos
PosixName = ""
Length=Len(FILENAME)
Pos = Instr(FILENAME, ":\")
If Pos > 0 Then
PosixName = device & Mid(FILENAME, Pos-1, 1)
Else
Pos = Instr(FILENAME, "\\")
If Pos > 0 Then
PosixName = netdir
Else
PosixName = ""
End if
End if
If (Pos > 0)
Then
Start = Pos + 1
Else
Start = 1
End if
Start = Pos + 1
Else
Start = 1
End if
For J = Start to
Length
If Mid(FILENAME, J, 1) = "\" Then
PosixName = PosixName & "/"
else
PosixName = PosixName & Mid(FILENAME, J, 1)
End if
Next
If Mid(FILENAME, J, 1) = "\" Then
PosixName = PosixName & "/"
else
PosixName = PosixName & Mid(FILENAME, J, 1)
End if
Next
PosixName = "\"""
& PosixName & "\"""
' WScript.Echo PosixName
GetPosixName = PosixName
GetPosixName = PosixName
end function
function StartAutoForm
Dim I, ExceedVersion,
ExceedReg, ExceedPath, Rsxpath, Interix, Exceed
Dim PSX, KSH, XAF, WSHShell, objArgs
Dim PSX, KSH, XAF, WSHShell, objArgs
set WSHShell =
WScript.CreateObject("WScript.Shell")
set objArgs = WScript.Arguments
set objArgs = WScript.Arguments
For I = 0 to objArgs.Count
- 1
If objArgs(I) = "-jn" Then
FileName = objArgs(I+1)
ARGS = ARGS & " " & objArgs(I) & " " & GetPosixName
I=I+2
Else
ARGS = ARGS & " " & objArgs(I)
End if
Next
If objArgs(I) = "-jn" Then
FileName = objArgs(I+1)
ARGS = ARGS & " " & objArgs(I) & " " & GetPosixName
I=I+2
Else
ARGS = ARGS & " " & objArgs(I)
End if
Next
' WScript.Echo ARGS
ExceedVersion =
WSHShell.RegRead("HKLM\SOFTWARE\AutoForm\AutoForm\4.1.000\EXCEED_VERSION")
ExceedReg = "HKLM\SOFTWARE\Hummingbird\Connectivity\" & ExceedVersion & "\Exceed\HomeDir"
ExceedReg = "" & ExceedReg & ""
ExceedReg = "HKLM\SOFTWARE\Hummingbird\Connectivity\" & ExceedVersion & "\Exceed\HomeDir"
ExceedReg = "" & ExceedReg & ""
ExceedPath =
WSHShell.RegRead(ExceedReg)
Rsxpath = WSHShell.RegRead("HKLM\SOFTWARE\AutoForm\AutoForm\4.1.000\WINSYS32DIR")
Interix = WSHShell.RegRead("HKLM\SOFTWARE\AutoForm\AutoForm\4.1.000\INTERIXDIR")
Rsxpath = WSHShell.RegRead("HKLM\SOFTWARE\AutoForm\AutoForm\4.1.000\WINSYS32DIR")
Interix = WSHShell.RegRead("HKLM\SOFTWARE\AutoForm\AutoForm\4.1.000\INTERIXDIR")
Exceed = ExceedPath
& "exceed.exe"
Exceed = """" & Exceed & """"
WSHShell.Run(Exceed)
Exceed = """" & Exceed & """"
WSHShell.Run(Exceed)
PSX = Rsxpath &
"\POSIX.EXE /c "
KSH = Interix & "\bin\ksh -l -c "
XAF = """" & xafexecute & " -nofork " & "-wd " & WORKDIR & ARGS & " -geom +0+0" & """"
KSH = Interix & "\bin\ksh -l -c "
XAF = """" & xafexecute & " -nofork " & "-wd " & WORKDIR & ARGS & " -geom +0+0" & """"
XAF = KSH &
XAF
XAF = PSX & XAF
XAF = PSX & XAF
' Start hidden (no dos-box,
comment out when startup problems - see below)
WshShell.Run "cmd.exe /C " & XAF , 0
WshShell.Run "cmd.exe /C " & XAF , 0
' Start XAF (with dos-box,
comment in when startup problems w/o dos-box)
' WSHShell.Run(XAF)
' WSHShell.Run(XAF)
' WshShell.Popup ARGS
WshShell.Popup "Starting AutoForm ...",2, afversion
WshShell.Popup "Starting AutoForm ...",2, afversion
end function
af-xstart.vbs脚本文件下载
方法二(cowper兄发现的):
设置HOME变量:HOME="起始工作目录",这里以"D:\Autoform4.1"为例。
不过该方法的缺点是:改变了整个windows的home目录,af的设置变量会重新改写到
新的home目录,如果有其他程序用到home目录,也将定位到此目录。
方法三:
切换到工作目录,点击sim文件,即可运行Autoform(适用于4.xx版本),那么Autoform的工作目录就是当前的目录。
新的home目录,如果有其他程序用到home目录,也将定位到此目录。
方法三:
切换到工作目录,点击sim文件,即可运行Autoform(适用于4.xx版本),那么Autoform的工作目录就是当前的目录。
开放分享:优质有限元技术文章,助你自学成才
相关标签搜索:Autoform应用技巧:设置Autoform起始工作目录 Autoform分析培训班 Autoform汽车模具仿真 Autoform视频教程 Autoform资料下载 在线软件培训 汽车钣金代做 Fluent、CFX流体分析 HFSS电磁分析 Ansys培训 Abaqus培训 有限元培训 Solidworks培训
编辑