Autoform應(yīng)用技巧:設(shè)置Autoform起始工作目錄
2016-11-14 by:CAE仿真在線 來源:互聯(lián)網(wǎng)
Autoform不論是3.X還是4.X,用缺省安裝的快捷方式啟動(dòng)的時(shí)候,進(jìn)入Autoform打開文檔的位置都是用戶目錄(如C:\Documents
and
Settings\username,username為當(dāng)前用戶名),3.X版本的可以通過修改桌面快捷方式的目錄起始位置而達(dá)到啟動(dòng)打開預(yù)先設(shè)定的目錄(右鍵點(diǎn)擊Autoform快捷方式-屬性-快捷方式-起始位置),避免缺省手工輸入的麻煩,但是該方法對于4.X版本根本不起作用,進(jìn)入Autoform后打開文檔的位置還是用戶目錄。
下面來介紹設(shè)置Autoform起始工作目錄的三個(gè)方法:
方法一:
修改啟動(dòng)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為盤符,/.../.../為路經(jīng),記得以/結(jié)尾。
存盤,運(yùn)行OK。
修改啟動(dòng)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為盤符,/.../.../為路經(jīng),記得以/結(jié)尾。
存盤,運(yùn)行OK。
如果改了還是不行,那肯定是沒有修改正確,你可以把你的af-xstart.vbs文件和目錄發(fā)給我,我可以幫你修改。
下面的是我的af-xstart.vbs,注意看單引號后的注釋:
' AutoForm startup vbs file
' AutoForm Engineering GmbH
' 2004-12-10 gk
' 增加Autoform啟動(dòng)預(yù)設(shè)工作目錄的支持,by plusplus, 2008-03-24
' AutoForm Engineering GmbH
' 2004-12-10 gk
' 增加Autoform啟動(dòng)預(yù)設(shè)工作目錄的支持,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"
' 定義工作目錄,
只須更改&后面路徑,盤符不用帶冒號,
' 格式:"盤符/目錄/目錄/",可根據(jù)自己的需要定義
WORKDIR = device & "D/Autoform_Workshop/"
' 格式:"盤符/目錄/目錄/",可根據(jù)自己的需要定義
WORKDIR = device & "D/Autoform_Workshop/"
' Autoform界面執(zhí)行文件
' AF_HOME_XX(可為32/40/41,根據(jù)af實(shí)際的版本)
' xaf_X.X.X(可為3.2/4.04/4.07/4.1.0/4.1.1, 根據(jù)af實(shí)際的版本)
Const xafexecute = "$AF_HOME_41/xaf_4.1.1"
' AF_HOME_XX(可為32/40/41,根據(jù)af實(shí)際的版本)
' xaf_X.X.X(可為3.2/4.04/4.07/4.1.0/4.1.1, 根據(jù)af實(shí)際的版本)
Const xafexecute = "$AF_HOME_41/xaf_4.1.1"
'Autoform版本顯示, 可根據(jù)af實(shí)際的版本更改
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兄發(fā)現(xiàn)的):
設(shè)置HOME變量:HOME="起始工作目錄",這里以"D:\Autoform4.1"為例。
不過該方法的缺點(diǎn)是:改變了整個(gè)windows的home目錄,af的設(shè)置變量會重新改寫到
新的home目錄,如果有其他程序用到home目錄,也將定位到此目錄。
方法三:
切換到工作目錄,點(diǎn)擊sim文件,即可運(yùn)行Autoform(適用于4.xx版本),那么Autoform的工作目錄就是當(dāng)前的目錄。
新的home目錄,如果有其他程序用到home目錄,也將定位到此目錄。
方法三:
切換到工作目錄,點(diǎn)擊sim文件,即可運(yùn)行Autoform(適用于4.xx版本),那么Autoform的工作目錄就是當(dāng)前的目錄。
開放分享:優(yōu)質(zhì)有限元技術(shù)文章,助你自學(xué)成才
相關(guān)標(biāo)簽搜索:Autoform應(yīng)用技巧:設(shè)置Autoform起始工作目錄 Autoform分析培訓(xùn)班 Autoform汽車模具仿真 Autoform視頻教程 Autoform資料下載 在線軟件培訓(xùn) 汽車鈑金代做 Fluent、CFX流體分析 HFSS電磁分析 Ansys培訓(xùn) Abaqus培訓(xùn) 有限元培訓(xùn) Solidworks培訓(xùn)
編輯