روش های دستور GUI

روش های دستور GUI

روش های دستور GUI
روش های دستور GUI با گره دستورات GUI در درخت ویرایشگر مطابقت دارد. درخت ویرایشگر برای مثال در قسمت Choose Commands to Run در پنجره تنظیمات برای یک شی دکمه در Application Builder نمایش داده می شود.

 
Name
Syntax
Description
clearAllMeshes
clearAllMeshes()
Clears all meshes.
clearAllSolutions
clearAllSolutions()
Clears all solutions.
clearSelection
clearSelection(String graphics)
clearSelection(FormObject graphics)
Clears the selection in the given graphics object.
exit
exit()
Exits the application.
fileOpen
fileOpen(String name)
Opens a file with the associated program on the client.
fileSaveAs
boolean fileSaveAs(String file)
Downloads a file to the client. See also the section “Example code”. The method returns a boolean that indicates if the operation was successful or not.
printGraphics
printGraphics(String graphicsName)
printGraphics(FormObject graphics)
Prints the given graphics object.
saveApplication
saveApplication(boolean confirm)
Saves the application. The boolean argument determines if the user is prompted with a confirmation dialog before saving.
saveApplicationAs
boolean saveApplication()
Saves the application under a different name. If the return value is false then the user canceled the operation and the application was not saved.
saveApplicationOnServer
saveApplicationOnServer(boolean confirm)
Saves the application on server. The boolean argument determines if the user is prompted with a confirmation dialog before saving.
saveApplicationOnServerAs
boolean saveApplicationOnServerAs()
Saves the application on server under a different name. (Or as an MPH file.) If the return value is false then the user canceled the operation and the application was not saved.
scenelight
sceneLight(String graphicsName)
sceneLight(FormObject graphics)
Toggles scene light in the given graphics object.
selectAll
selectAll(String graphics)
selectAll(FormObject graphics)
Sets the selection to all entities in the given graphics object.
transparency
transparency(String graphicsName)
transparency(FormObject graphics)
Toggles transparency in the given graphics object.
zoomExtents
zoomExtents(String graphicsName)
zoomExtents(FormObject graphics)
Makes the entire model visible within the extent of the given graphics object.

کد مثال
برای مثال هایی از نحوه استفاده از fileSaveAs ، به مقدمه Application Builder مراجعه کنید. این روش اغلب برای ذخیره فایل ها به طور کلی مورد نیاز است.
شما می توانید برنامه ای ایجاد کنید که به طور خودکار با اجرای خطوط کد زیر، به عنوان مثال، پس از حل، ذخیره و خارج شود:
saveModel(model”C:\\COMSOL\\file.mph”);
exit();
یا
saveModel (model, “common:///file.mph”);
exit();
این در تنظیمات سرور COMSOL مفید است زیرا استفاده از exit() در این روش، هر مجوزی را که بررسی می شود آزاد می کند.